View Full Version : integer to Float
chiax2 02-12-2009, 06:09 AM Help someone...
I have set up my finger attribute in integer. and people have start posing and animating.
Is there a way to change the extra attribute from integer to float?
die die die....My mistake.
cheers,
Chia
|
|
tonytouch
02-12-2009, 06:58 AM
hi ,
well that depends ...
if -> you loaded your character as reference , you can change the original rig-file , and after changing , the fingers should perform like wanted .
if -> you did not load the character as reference - then you need to export your animation first , and after changing your rig , import the animation back into your scene .
you can e.g. create a character-set for your fingers , export your animation as clip / change your attributes / import animation .
or you can use e.g. dkAnim.mel to export/import animation-data .
-----------------------------------------------------------
to change your attributes , from integer to float - you need to delete your "old int"-attriubute first . as far as i know , you cannot just simply "change" the atributes from int to float ! so you need to do following ( ? in MEL ? )
1. get all connections from the attribute
(e.g. $ctrl = "L_hand_CON";$attribute = "indexCurl"; )
$conn = `listConnections -p on -source on ($ctrl + "." + $attribute)`;
2. delete your old attribute
deleteAttr -attribute $attribute $ctrl;
3. create a new attribute ( make sure you set min and max right , "double" is "float")
addAttr -ln $attribute -at "double" -min -10 -max 10 -dv 0 $ctrl;
setAttr -keyable true ($ctrl + "." + $attribute);
4. for-loop , to reconnect the connections ( in some casese there might be more connections than one / so i made a loop )
for ($h=0;$h<`size $conn`;$h++) connectAttr -f ($ctrl + "." + $attribute) $conn[$h];
--------------
this "should be working" .and i would recommend you , to use always use file-referencing for animation , as you can simply do changes to the rig .
chiax2
02-12-2009, 07:52 AM
thanks.
I am not a mel savvy person.
but i will advice from someone who knows this.
If I delete the old attribute will the reference file still follow the animation?
your scripts is that automate to redo jus tthe attribute and remain the set driven key thta has been set up untouch?
thanks for your help
cheers,
Chia
tonytouch
02-12-2009, 12:31 PM
if you ( for animation ) loaded the rig_file as a reference , and now just change the main_rig_silf , the animation should still exist in your animation_file ( where the rig is then "just animated" - as all the rigging-relevant information is "referenced" )
you should keep a backup , of your original rig !!!
---------------------------------
as for the setDrivenKeys ... if you take a look into the hypergraph-editor / select your CONTROLcurve and "graph / show output connections" , you see , that the original-attribute is connected to an "animCurve" ( e.g. "drivenObj_translateX.input" - the animCurve is created , once you "setDrivenKey"s ) - the animCurve has a regular ".input"-attribute , which you can find out about , with the "listConnections"-command .
when you deleteAttr your attribute , the animCurve will still exist , and you can connect a "new" float-attribute , which has the same name , as the old "integer"-one.
if there are more than one animCurve , which is connected to your attribute , you need to re-connect all of them , after deleteAttr the "odd integer" attribute .
--------------
for directConnections and setDrivenKeys this technique is working perfectly . but i remember some cases with "unitConversion"-nodes , which maya sometimes creates ( and i remember , dealing with it / but dont have it in mind right now , how i did it - but for your case , it should be simple as reconnecting the "animCurve.input"-attributes to the new float-attribute .
NolanSW
02-12-2009, 03:31 PM
If your attribute is a driver to set driven keys then I would suggest using this script first to export out the sdk's out to a file.
highend3d.com/maya/downloads/mel_scripts/animation/oa-Export-SDK-3881.html (http://highend3d.com/maya/downloads/mel_scripts/animation/oa-Export-SDK-3881.html)
Then once you've done that, delete the attributes and rebuild them as floats and then run the script produced from the export and all should be good. Saves the headache of breaking connections and such.
CGTalk Moderation
02-12-2009, 03:31 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.