PDA

View Full Version : SetOffset in a script controller


GrahamMac
03-14-2012, 04:48 PM
I need to control the V_Offset of dozens of maps with one custom attribute spinner.
I am writing a Maxscript to automatically set up a float script for each V_Offset parameter.

So far if I animate the spinner and scrub the timeline the V_Offsets update correctly but I would like to add a time offset to the float scripts too.


ctrl = float_script ()
meditMaterials[24].materialList[1].Color_map.Maps_0.Coordinates.V_Offset.controller = ctrl
--This puts a float script onto the V_Offset parameter of the correct map

ctrl.Addtarget "driver" $MasterObj[4]
ctrl.SetOffset " driver " 10
ctrl.setExpression "driver.CustAtt_A"
Currently this script sets up control but without any time offset even though in the Script controller dialogue the tick offset is set to 1920 (10 frames).

I think the problem stems from the addtarget line:
ctrl.Addtarget "driver" $MasterObj[4]
I tried the following but it doesn't help:
ctrl.Addtarget "driver" $Text002.baseobject.custom_attributes

Also tried this too but it creates an error:
ctrl.Addtarget "driver" $Text002.baseobject.custom_attributes.CustAtt_A
-- Runtime error: IScriptCtrl::AddTarget - Target needs to be object or subAnim, got: -0.0200213
Thanks for any help!
Graham

GrahamMac
03-14-2012, 05:17 PM
Sorted it!!

The code:
ctrl.Addtarget "driver" $Text002.baseobject.custom_attributes.Glow_lines

Should be:
ctrl.Addtarget "driver" $Text002.baseobject.custom_attributes.Glow_lines.controller


Graham

CGTalk Moderation
03-14-2012, 05:17 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.