[Closed] Instancing costom attributes to penn attribute holder
Hi all and Penn if your out there. i have made a bone face rigg based on Pauls DVD and also adding several deformer muscels and bone objects. things are coming along well and i have got to the point where i am going to add all my ctrl objects to the Penn attribute holder so adding 61 ctrls with all xyz rotation and positions is going to be a big lot of copying and pasteing that i dont want to have to do. so script time. the only problem here is that i have very little scripting experenace so i thought this would be a good one to get more experance on and have somthing others to use. at the moment i鈥檓 stuck on the small things so here goes.
here is a QT of what it looks like so far [dowload 3.5 meg]( http://www.kaffeineproductions.com/downloads/face%20muscle%20skin%20test2.mov)
[img] http://www.kaffeineproductions.com/downloads/muscle%20image2.jpg [/img]
here is the what i have scripted so far witch is mainly what i have lernt of the face rigg DVD however i鈥檓 using some of the strings in differnt ways witch could be the completly worng way of approcing this. i鈥檓 not really sure how i should be setting this out any comments would be apreciated.
--fn instanCTRLpennAttribute --i'll call it somthing better later
getobj=selection[1] --oject with the attributes
setobj=selection[2] --oject with penn attribute holder
objn=getobj.name
def=attributes myface
(
parameters faceP
(
objn_posX type:#float --name each attribute according to the frist selected object + the track
鈥搊bjn_posY type:#float
鈥搊bjn_posz type:#float
鈥搊bjn_rotx type:#float
鈥搊bjn_rotY type:#float
鈥搊bjn_rotz type:#float
)
)
--this next block of code will need instance the first obj tracks to the second obj track
鈥搕his is what i have so far which works but not from posX to the addid attribute”objn_posX”
getobj=selection[1] --first select object copying from
setobj=selection[2] --second select object paste to
getobj.position.x_position.controller=setobj.position.x_position.controller
i was thinkin of having a function that i could call on and have a interface for it later.
I am trying to create and name the attributes based on the first selected object and apply it to the second with the pen attribute holder. Does anyone knows how to append names?. which i have no idea how to do and cant seem to find anything in the maxscript help. so any help with appending names would be great also how do i instance controllers.
any pointers on the way i should layout the script would also be greatly apreciated.
cheers
john
just to make things esier to understand these are the thing i need to get going before i can even make it work.
i am tring to instance the one controller from on to the other.
this expression works
getobj=selection[1] –first select object copying from
setobj=selection[2] –second select object paste to
getobj.position.x_position.controller=setobj.position.x_position.controller
which works nice but when i try it for my costome attributte on my penn atributholder it errors out.
this is the expression i鈥檓 trying to get to work
getobj=selection[1]
setobj=selection[2]
getobj.position.x_position.controller=setobj.modifiers[1].myface.objn_posX.controller
where myface is the attribute and Objn_posX is the float that i鈥檓 trying to paste the instance to.
the error i鈥檓 getting is
[color=Pink]$Sphere:Sphere01 @ [-40.431576,-7.321520,0.000000]
$Editable_Mesh:Sphere02 @ [-15.382270,-8.209094,0.000000]
鈥?Type error: Assign needs controller, got: undefined
i can鈥檛 understand what i am doing worng any answers would be apreciated
[/color]
there is a spell error:
getobj.position.x_position.controller=setobj.pos[color=Red]it ion.x_position.controller[/color]
think you allready know鈥?
Wow, very cool, I realy want to see this deforming a face.
Well one thing that I see right off the bat is that you need to do the instance the other way around.
setobj.modifiers[1].myface.objn_posX.controller= getobj.position.x_position.controller
the reason is that the custom atttrbute parameter will not have a controller on it until it is animated. This way you are making the CA params controller = to the one that is already on the control.
The next error that I see is in the way that you are getting the position controller it self. You should be using this instead.
getobj.pos.controller.x_position.controller
The next problem if you are following my DVD鈥檚 to the letter is I use list controllers on just about every thing so that will still not get you the controller that you need. If the controller that you are after is the second controller in a list controller you will have to do this.
getobj.pos.controller[2].x_position.controller
So your final code should look more like this.
setobj.modifiers[1].myface.objn_posX.controller= getobj.pos.controller[2].x_position.controller
Let me know if that helps. I would also like to know what you think if the DVD, where it went well and where it didn鈥檛. It looks as though you have picked up alot from it and tried your hand at making your own and not just copying every thing that I have done. Great job.
Hi Paul,
thanks so much for the reply now you metion this problem it seams so obvious and simple. it even explains the error message i鈥檓 getting. cheers for that.good to know that i wasnt completely off the mark.
here is the link to the skin deformer working skin test
Not all the muscle are workin in this version and the neck i hadent started to get working yet but it shows the potetial of the rigg. i allso used some sqaush and stretch bones in bettween the face bones to get abit of bulging in some of the skin folds. although it would be good if i could very the scale factor for those bones so i could exagerate the squash and stretch. i see another script here!!hehe new doors are opening:thumbsup:
the next thing i can鈥檛 get to work is the attribute nameing so i want the getobj name plus posX posY posZ tacked on the end of the name. i understand i can do something like this to rename just objects.
for obj in selection do
(
obj.name = (obj.name + "posX" )
however i can鈥檛 get it to work on the costom attribute. i cant find out how to do it in script help iether.
i鈥檒l work on this today so i鈥檒l post agian probably later.
feedback on the Facial rigging DVD.
Paul this dvd was very well layed out and even went beyond my expection. The fact that you showed 2 methods of approching face riggs was awsome. i personally was mainly interested in the bone based rigg as i had atempted this a while back with no great resalts.the wiring pearamiters was a really good flexable aproach. Most of you demonstation are extremely easy to follow and you allways metion why this is the best approch. The maxscipts are i think the most important part for me as you show applied maxscripting and step by step explained all the fuctions you are using. Even for a maxscipt novice like me i suddenly felt that this was not beyond anyones reach. i would personlly be happy with just a dvd full of wrighting rigging scripts and pipline tools. i have yet to check out bobos dvd鈥檚
if i had to find somthing critical about the dvd the only thing i could say that might have inproved it would have been a chapter of theory behind facial structure and how a face works and the veriations between real and comical. apart from that it would have been interesting to see abit of a show and tell on some of the riggs you have done in the past. all in all these thing really would be icing on the cake.
I look farward to the next DVD if there are plans for a next one. any plans for what it might be?
thanks again for the help
cheers
john
Adjusting the amount of scale that affects the skin of the character can be achieved in the Skin modifier itself. Have a look at the Squash value, every one misses this one completely and I use it all the time.
As for changing the names of a parameter you can鈥檛 do that. You have to build the parameter with the name that you need. So if you want to dynamicaly set up the CA def based on the tracks that you are going to be adding you would have to build the whole CA def as a string formatting the parameters based on what you have selected. Then you add the def by executing the string into an def and apply it. From there you just wire to it as you have been.
Thanks for the feed back on the DVD. I was looking to add a whole section on facial animation but the DVD got so long I figured I would drop it as there is great information out there already. The book Stop Stairing is a great resource, it is all based on Maya but the areas that he covers facial animation is universal. There are also lots of great books for cartoon animation and facial studies done on humans that are great resources.
As for what is comming next鈥?well I鈥檓 going to keep that to my self as it will be very cool and I I hope well recieved.
hi paul,
yeah i understand about the dvd, its was jam packet anyway! no disapointmants for me:thumbsup:.] well i look farward to the next one no matter what it is i鈥檓 sure it will be good.
hehe i just work out that i cant do it when you post came through i just rewrote the script on edzactly what you just sayed. i think i鈥檓finally getting it. YAY
here is what i have
getobj=selection[1]
setobj=selection[2]
def=attributes (getobj.name)-- myface --
(
parameters faceP
(
posX type:#float
posY type:#float
posZ type:#float
rotX type:#float
rotY type:#float
rotZ type:#float
)
)
custAttributes.add setobj.modifiers[1] def
getobj=selection[1]
setobj=selection[2]
setobj.modifiers[1].myface.posX.controller= getobj.pos.controller.x_position.controller
setobj.modifiers[1].myface.posY.controller= getobj.pos.controller.x_position.controller
setobj.modifiers[1].myface.posZ.controller= getobj.pos.controller.x_position.controller
setobj.modifiers[1].myface.rotX.controller= getobj.pos.controller.x_position.controller
setobj.modifiers[1].myface.rotY.controller= getobj.pos.controller.x_position.controller
setobj.modifiers[1].myface.rotZ.controller= getobj.pos.controller.x_position.controller
of cousre i need to set it out so it all works together but i鈥檓 close i think.
just can鈥檛 get the def=attributes (getobj.name) to work but if i can get that then i will be really close to making this the work. whhhooooohooo
cheers
john
b=box name:"theObjectBeingControlled"
c=circle name:"theControlObject"
aParam=($theObjectBeingControlled.name+"_height")
str="def=attributes test
(
"
str+=" parameters testP rollout:testR
(
"
str+=" "+aParam +" type:#float UI:"+aParam +"
)
"
str+=" rollout testR \"Test\"
(
"
str+=" spinner " +aParam + " \""+aParam +"\"
)
"
str+=")
"
caDef=execute str
custAttributes.add c caDef
aParamName=(aParam as name)
paramWire.connect c.test[aParamName] b.baseObject[#height] aParam
select c
Try that, just run the code.
Hi paul,
thanks for that little example on strings took me awhile to undersatnd what you had done but after a dose of the maxscript Help i worked it out:thumbsup:now i鈥檓 a pro. strings are awsome if you hadn鈥檛 shown me i would have been flailing around on that one. i gather you have to use strings alot if there are verables that have no direct maxscipt fuction. really nice way of getting around this problem.
anyway here is what i have. i made it so evey object creates a new attribute name so that the paramiters will be easire to find if need be. just make two object the second need a modifier of some kind like the penn attribute holder just ctrl select in order you need to make the connection, althought i鈥檓 sure you know the drill. i must say i have never thought a costom attribute looked so go when its wired. hehe
getobj=selection[1]
setobj=selection[2]
dParam=(getobj.name)
aParam=(getobj.name+"_x")
bParam=(getobj.name+"_y")
cParam=(getobj.name+"_z")
--on botton press do
(
(
str="def=attributes "+dParam +"
(
"
str+=" parameters faceP
(
"
str+=" "+aParam +" type:#float
"
str+=" "+bParam +" type:#float
"
str+=" "+cParam +" type:#float
)
"
str+=")
"
)
caDef=execute str
custAttributes.add setobj.modifiers[1] caDef
)
--on button press do
(
(
str="
(
setobj.modifiers[1]."+dParam +"."+aParam +".controller= getobj.pos.controller.x_position.controller
"
str+=" setobj.modifiers[1]."+dParam +"."+bParam +".controller= getobj.pos.controller.y_position.controller
"
str+=" setobj.modifiers[1]."+dParam +"."+cParam +".controller= getobj.pos.controller.Z_position.controller
)
"
)
execute str
)
now i just need to create a verable for the animation track i want to instance eg the top controller
i am thinking of making a button so you can manually plug with an integer number or somthing. i鈥檒l tackle that one tomorrow.
just wondering is there any real reason you wired the controller as aposed to instance them in your example.
thanks for the tip on the squash and stretch i completely missed it. but i cant say i ever used squash and stretch until now. i need to do some more comical chacarters i think.
thanks agian paul for you time
cheers
john