PDA

View Full Version : Trouble with event handler execute string


DannyBoy3
11-30-2011, 09:42 PM
Hi. I am having trouble with the button event handler part of this code. It yields either a "expected while' or 'expected factor', or it throws a ' no get function for undefined', no matter what combination I use of string, do loop, etc.. Any help would be much appreciated,


ctrlcentre = circle radius:5
rotate ctrlcentre (angleaxis -91 [1,0,0])

morphs_used =#("up","down","turnaround")
addmodifier ctrlcentre (EmptyModifier ())
attdeff = ""
attStr = ""
attStr += "attdef = attributes facialctrl\n"
attStr += "(\n"
attStr += " parameters facialctrl rollout:Weights \n"
attStr += " (\n"

for i = 1 to morphs_used.count do
(
attStr += " " + morphs_used[i] + " type:#float ui: "+ morphs_used[i] as string+"Sl \n"

)

attStr += " )\n"
attStr += "rollout Weights \"Weights\" \n"
attStr += "("
attStr += " local range=[-2.00,2.00,1.00]\n"
attStr += "group \"Upper Left Position\" (\n"

for j = 1 to morphs_used.count do (

attStr += " slider "+ morphs_used[j] + "Sl \""+ morphs_used[j] + "\" range:range ; \n"

)
attStr += ")\n"
attStr += "group \"Upper Right Position\" (\n"



attStr += "button resetAll \"Reset All\" \n"

attStr += "on resetAll pressed " do ( for k = 1 to morphs_used.count do (


attStr+=" ctrlcentre.modifiers[#Attribute_Holder].custAttributes[1][k].value = 1.0\n" ;

)
)
attStr += " )\n"
attStr += " )"

attdeff = execute attStr

custAttributes.add ctrlcentre.modifiers[1] attdeff

denisT
11-30-2011, 09:55 PM
one bug is here for sure:

...
attStr += "on resetAll pressed " do ( for k = 1 to morphs_used.count do (

DannyBoy3
11-30-2011, 09:57 PM
AH...do you have any idea how it should go Denis?

denisT
12-01-2011, 01:16 AM
AH...do you have any idea how it should go Denis?
yes, i do... but this is your code, your idea, your challenge... and i don't want to rob you

DannyBoy3
12-01-2011, 08:49 PM
Yes, please rob me...I'm ready to be robbed of my challenge. Ive already been robbed of time trying to figure the thing out...

denisT
12-01-2011, 09:18 PM
Yes, please rob me...I'm ready to be robbed of my challenge. Ive already been robbed of time trying to figure the thing out...


delete objects
ctrlcentre = circle radius:5
morphs_used =#("up","down","turnaround")
attStr = ""
addmodifier ctrlcentre (EmptyModifier ())
(
attStr += "attdef = attributes facialctrl\n"
attStr += "(\n"
attStr += " parameters facialctrl rollout:Weights\n"
attStr += " (\n"

for k = 1 to morphs_used.count do
(
attStr += " " + morphs_used[k] + " type:#float ui:" + morphs_used[k] as string + "Sl\n"
)

attStr += " )\n"
attStr += " rollout Weights \"Weights\"\n"
attStr += " (\n"
attStr += " local range = [-2,2,1]\n"
attStr += " group \"Upper Left Position\"\n"
attStr += " (\n"

for k = 1 to morphs_used.count do
(
attStr += " slider " + morphs_used[k] + "Sl \""+ morphs_used[k] + "\" range:range\n"
)

attStr += " )\n"
attStr += " group \"Upper Right Position\"\n"
attStr += " (\n"
attStr += " )\n"
attStr += " button resetAll \"Reset All\" \n"
attStr += " on resetAll pressed do\n"
attStr += " (\n"

for k = 1 to morphs_used.count do
(
attStr+=" " + morphs_used[k] + " = 1\n"
)

attStr += " )\n"

attStr += " )\n"
attStr += ")"
ok
)

format "%\n" attStr

attdeff = execute attStr
custAttributes.add ctrlcentre.modifiers[1] attdeff


next time at least format your code for easy reading...

DannyBoy3
12-01-2011, 09:29 PM
Thank you Denis....! You have my vote for forum attendee of he year

CGTalk Moderation
12-01-2011, 09:29 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.