Newbie problem with procedure

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 02 February 2004   #1
Newbie problem with procedure

Hi there

I have a problem when making a procedure of a smal script of mine and put it on an button.
The script is more like an action. The action makes a copy of my selected character, unlockes the channel attributes, and adds some attributes with information I want to use when I'm using these copies as blendshapes. First I select a bone and then I select the skin.
The script runs fine, but when I make a procedure from it, maya gives this error.

Error: Invalid call to "floor". Check number and types of arguments expected by the procedure.

This is the script:

global proc scriptA () {

$selec = `ls -sl`;
$gradenX = getAttr ($selec[0] + ".rotateX");
$gradenY = getAttr ($selec[0] + ".rotateY");
$gradenZ = getAttr ($selec[0] + ".rotateZ");
$gradenXflr = floor($gradenX);
$gradenXabs = abs($gradenXflr);
$gradenYflr = floor($gradenY);
$gradenYabs = abs($gradenYflr);
$gradenZflr = floor($gradenZ);
$gradenZabs = abs($gradenZflr);
gotoBindPose;
$newn = "lijf" + "_" + $selec[0] + "_" + "X" + $gradenXabs + "_" + "Y" + $gradenYabs + "_" + "Z" + $gradenZabs;
duplicate -n $newn $selec[1];
parent -w $newn;
setAttr -l false ($newn + ".translateX");
setAttr -l false ($newn + ".translateY");
setAttr -l false ($newn + ".translateZ");
setAttr -l false ($newn + ".rotateX");
setAttr -l false ($newn + ".rotateY");
setAttr -l false ($newn + ".rotateZ");
setAttr -l false ($newn + ".scaleX");
setAttr -l false ($newn + ".scaleY");
setAttr -l false ($newn + ".scaleZ");
setAttr ($newn + ".translateX") 15;

addAttr -ln blendinfo_rotX -at double;
setAttr -e -keyable true ($newn + ".blendinfo_rotX");
setAttr ($newn + ".blendinfo_rotX") $gradenX;

addAttr -ln blendinfo_rotY -at double;
setAttr -e -keyable true ($newn + ".blendinfo_rotY");
setAttr ($newn + ".blendinfo_rotY") $gradenY;

addAttr -ln blendinfo_rotZ -at double;
setAttr -e -keyable true ($newn + ".blendinfo_rotZ");
setAttr ($newn + ".blendinfo_rotZ") $gradenZ;

addAttr -ln jointname -dt "string";
setAttr ($newn + ".jointname") -type "string" $selec[0];

layerEditorAddObjects blends;

}

I hope you can help me with this problem

thanx in advance
 
Old 02 February 2004   #2
you need to cast what you pass into fllor as a float.

i.e. rewrite

$gradenX = getAttr ($selec[0] + ".rotateX");

to

float $gradenX = getAttr ($selec[0] + ".rotateX");

as well as all the others
__________________

 
Old 02 February 2004   #3
You must declare data type of your variables.

int 1, 15, 148
float 1.25, 0.2, 12.056
string "Mother", "Dadi"

Example :

int rand(0, 2); returns 0 or 1 or 2 (often 1)
float rand(0,2) returns 1.42 or 1.0365 or 0.956 ...
 
Old 02 February 2004   #4
Thanks a lot for youre fast replies

It is working now.
Until now I only made small scripts and I never had problems with not defining the proper variable type. So I guess when you make a procedure I have to make sure al the variables are difined proper.

thanx again for youre repies
 
Old 01 January 2006   #5
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 06:47 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.