View Full Version : Adding Variables to Scripted Controllers. How?
Wahooney 11-21-2005, 10:50 AM Is it possible to assign user variables for Scripted Controllers through script? I don't seem to be able to find anything in the manual regarding this.
Thanks guys.
|
|
Wahooney,,
can you give an example of what you are trying to do?
You could fetch the script, add your variables and put it back?
This sounds very complicated, though.
Georg
Wahooney
11-22-2005, 09:25 AM
The script controller in max 8 has those variables that allow you to directly access scene nodes, etc.
I want to assign those variables.
I see - but I can't help.
Sorry.
Georg
magicm
11-22-2005, 12:49 PM
Afaik, this can only be done with Expression controllers..
- Martijn
Wahooney
11-22-2005, 12:54 PM
That's a bit of an embuggerance!
magicm
11-22-2005, 01:14 PM
That's a bit of an imbuggerance! (a natural or artificial hazard that complicates any proposed course of action)
Yeah it is! ;)
Wahooney
11-22-2005, 01:19 PM
I suppose it's one of those half finished additions.
I suppose it's one of those half finished additions.
It was not added to the help but the same code works for script controllers. Or you can use.
scCon=float_Script()
showInterfaces scCon
--Will return
Interface: IScriptCtrl
Properties:
.ThrowOnError : bool : Read|Write
Methods:
<boolean>SetExpression <&TSTR>Expression
Expression is In parameter
<TSTR by value>GetExpression()
<TSTR by value>GetDescription()
<boolean>SetDescription <&TSTR>Description
Description is In parameter
<integer>NumVariables()
<boolean>AddConstant <&TSTR>Name <&fpvalue>Constant
Name is In parameter
Constant is In parameter
<boolean>AddTarget <&TSTR>Name <value>Target Offset:<time> Owner:<value>
Name is In parameter
Offset default value: 0f
Owner default value: undefined
<boolean>AddObject <&TSTR>Name <value>Object
Name is In parameter
<boolean>AddNode <&TSTR>Name <node>Node
Name is In parameter
<boolean>SetConstant <value>Which <&fpvalue>Constant
Constant is In parameter
<boolean>SetTarget <value>Which <value>Target Owner:<value>
Owner default value: undefined
<boolean>SetObject <value>Which <value>Object
<boolean>SetNode <value>Which <node>Node
<boolean>DeleteVariable <value>Which
<boolean>RenameVariable <value>Which <&TSTR>Name
Name is In parameter
<time>GetOffset <value>Which
<boolean>SetOffset <value>Which <time>Offset
<boolean>VariableExists <&TSTR>Name
Name is In parameter
<fpvalue by value>GetConstant <value>Which
<value>GetTarget <value>Which asObject:<boolean>
asObject default value: false
<maxObject>GetObject <value>Which
<node>GetNode <value>Which
<value>GetValue <value>Which asObject:<boolean>
asObject default value: false
<value>GetVarValue <value>Which
<enum>GetType <value>Which
GetType enums: {#unknown|#target|#constant|#object|#node
<TSTR by value>GetName <index>Index
<index>GetIndex <&TSTR>Name
Name is In parameter
<void>Update()
<TSTR by value>PrintDetails()
Actions:
Wahooney
11-22-2005, 01:48 PM
Thanks Paul, you're a life saver!
I didn't know about showInterfaces().
magicm
11-22-2005, 01:55 PM
scCon=float_Script()
showInterfaces scCon
DUH! Ofcourse!
Thanks for the heads up Paul ;)
Is it possible to assign user variables for Scripted Controllers through script? I don't seem to be able to find anything in the manual regarding this.
Thanks guys.
Sorry, my bad, I forgot to add the interface doc to the Help, it is more or less the same as for Expression controllers... Expect a public update of the Reference soon!
galagast
11-22-2005, 02:55 PM
In relation to script controllers... in max 6, say I have a sphere with a script controller which depends on another object, something like:
--script controller on sphere.radius
dependsOn $box01
$box01.height
now if I was to adjust the height of the box, the sphere's radius is adjusting A-OK.
but, if I was to copy the sphere geometry to have 2 spheres (sphere01 & sphere02), then adjust the height of the box, it does NOT update. Is there a way to refresh or update the dependcies?
In relation to script controllers... in max 6, say I have a sphere with a script controller which depends on another object, something like:
--script controller on sphere.radius
dependsOn $box01
$box01.height
now if I was to adjust the height of the box, the sphere's radius is adjusting A-OK.
but, if I was to copy the sphere geometry to have 2 spheres (sphere01 & sphere02), then adjust the height of the box, it does NOT update. Is there a way to refresh or update the dependcies?
Nope, you would have to change the code in the script controller your self. In Max 8 if you copied both objects it would update the dependancies for you.
galagast
11-22-2005, 04:22 PM
aww.. thanks paul :), now there's an embuggerance for me...
(I actually looked up the word at dictionary.com) hehe
CGTalk Moderation
11-22-2005, 04:22 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.