PDA

View Full Version : custom attributes and script controllers


alteredgene
07-08-2011, 03:59 AM
Hi everyone, thank you in advance for your time.

i have added custom attributes to objects called "timeOffset" in integer.
and those objects have script controller, that reference to their individual "timeOffset".

basically idea was to use the custom attributes to offset the animation.

and that works like a charm. however, when i reopen the file or just opening that file, will through up error saying

"unknown property" timeoffset

and will have all the script controller windows popping up per object.

odd thing is though, the script controller works just fine afterwards, just really annoying i have to click [close] on lot of dialogue window.

my guess is that custom attributes are added before the controllers are calculated?
thats why when loading file, it will through errors because the custom attributes have not been "added?

if that is the case, are there any way around this?

again thank you in advance for any help : )

lo
07-08-2011, 06:43 AM
maybe you can try setting the .throwOnError property of the controller to false.

If that doesn't work, you'll probably need a check inside the controller body if the CA exists or not.

alteredgene
07-11-2011, 03:35 AM
maybe you can try setting the .throwOnError property of the controller to false.

If that doesn't work, you'll probably need a check inside the controller body if the CA exists or not.

Thanks lo, yes, i could do some safety checking. as only annoyance is when the file is loaded, and it throws up 30 error dialogue, but seems to work just fine.

however, ended up using the "addTarget". basically added proper variable in the script controller, pointing at the CA. oddly, this seems to work just fine.

scriptCtrl = float_script()
scriptCtrl.AddTarget "timeOff" i.baseObject.wallTimeOffset[1]
scriptCtrl.script = "at time (F-timeOff) $wallMaster.pos.z"
i.position.controller.Zero_Pos_XYZ.Z_Position.controller = scriptCtrl

again thank you for your suggestion lo, will try that method next time : )

floopyb
07-11-2011, 07:20 AM
I think the problem is that your script controller is being loaded and evaluated before the other objects that are being referenced even exist, so you get an error initially. Once the scene is loaded everything exists so it works ok.
I generaly just put a try() catch() around them.

alteredgene
07-11-2011, 08:47 PM
I think the problem is that your script controller is being loaded and evaluated before the other objects that are being referenced even exist, so you get an error initially. Once the scene is loaded everything exists so it works ok.
I generaly just put a try() catch() around them.

thanks floopyb.

that's what i guessed, which makes sense.

basically they need to calculate the transform controllers before anything to "place" an object in space. and i guess this happens before CA is added to objects when loading.

thanks!

CGTalk Moderation
07-11-2011, 08:47 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.