View Full Version : Scripted operator help
Sbowling 04-07-2007, 11:55 PM Hi,
I'm trying to learn how to use scripted operators, but I can't seem to figure out how to do anything with the in and/or out vaues. I've looked for beginner guides or tutorials, but they all seem to assume that I already understand this. I can do basic scripting, so that's not the issue, I just can't seem to get the values from the objects or return the value from the script back to the object.
If someone has a moment, I would really appreciate if you could show me a simple example, like using a cube's position on Y to control a sphere's rotation on Z or something like that. This is basic ith expressions, but I'm completely stumped as far as doing this with Scops.
Any help is really appreciated.
|
|
I've had a bit of trouble myself Sam. Chrystia and I were trying to find them in the SDK guides, but all we found we're "Custom" Operators, which were tagged as deprecated... she looked down that path, but I didn't get an update from her on whether they we're adequate for learning scops... she had to go away for the holiday.
See if Custom Operators can help get you started... and hopefully someone else can chime in and point us all in the right direction.
Sbowling
04-08-2007, 06:46 AM
Thanks Jdex!
It almost seems that this is so easy that this part doesn't need to be explained and I the only person who can't figure it out. :banghead: (http://forums.cgsociety.org/misc.php?do=getsmilies&wysiwyg=1&forumid=0#)
5quid
04-08-2007, 07:30 AM
assuming you have a scop connected like :
Outlocal | Out | cube.kine.local
Inlocal | In | null.kine.local
function Update(In_UpdateContext, Out, Inlocal){
// storing the kinematics property
var inY = Inlocal.Value.posy
// the variable name is only needed when there are multiple outputs
// otherwise we use the 'Out' var passed into the function as is
Out.Value.rotz.Value = inY.Value
}
doesn't get much more simple than this :)
tachy0n
04-08-2007, 09:04 AM
And note that the custom op docs are still perfectly fine. What's been deprecated is the part that deals with installing SCOPs, that has been replaced by self installing plugins.
stblair
04-08-2007, 02:23 PM
I've had a bit of trouble myself Sam. Chrystia and I were trying to find them in the SDK guides, but all we found we're "Custom" Operators, which were tagged as deprecated... she looked down that path, but I didn't get an update from her on whether they we're adequate for learning scops... she had to go away for the holiday.
See if Custom Operators can help get you started... and hopefully someone else can chime in and point us all in the right direction.
Scripted operators are documented in the User Guides (in the TOC, Customization > Scripted Operators).
One way to find out what you're dealing with is to simply log the classnames of the objects passed into the Update function:
LogMessage( classname( Inlocal ) );
LogMessage( classname( Inlocal.Value ) );
LogMessage( classname( Out.Value ) );
Sbowling
04-08-2007, 11:23 PM
Thanks Guys!
As usual, I was trying ot overcomplicate things.
Basically, to get the value of the "in" named Inposy (which is Cylinder.kine.local.posy) all I need to do is use inposy.value. To assign that to the out (named outposy) I just use out.value = inposy.value.
ThE_JacO
04-10-2007, 01:33 AM
assuming you have a scop connected like :
Outlocal | Out | cube.kine.local
Inlocal | In | null.kine.local
function Update(In_UpdateContext, Out, Inlocal){
// storing the kinematics property
var inY = Inlocal.Value.posy
// the variable name is only needed when there are multiple outputs
// otherwise we use the 'Out' var passed into the function as is
Out.Value.rotz.Value = inY.Value
}
doesn't get much more simple than this :)
doesn't get much simplier, but it can get less risky.
if you have an output value, you should also marshall a call to that value as an input, regardless of whether you intend to use that input value or not, this is meant to make sure that execution is correct and dirtyness is flagged on updates.
5quid
04-10-2007, 04:28 AM
doesn't get much simplier, but it can get less risky.
if you have an output value, you should also marshall a call to that value as an input, regardless of whether you intend to use that input value or not, this is meant to make sure that execution is correct and dirtyness is flagged on updates.
And if the question would have been : "please explain the subtle intricacy's of xsi's scene graph evaluation cycle" then maybe my example would have been less 'risky'.
but it wasn't, so i didn't.
:P
ThE_JacO
04-10-2007, 03:39 PM
And if the question would have been : "please explain the subtle intricacy's of xsi's scene graph evaluation cycle" then maybe my example would have been less 'risky'.
but it wasn't, so i didn't.
:P
It's never to early to make sure the next question won't be "why does my scop fail to update unless I tweak some off unrelated value?" :p
5quid
04-10-2007, 04:27 PM
Fair point :)
It's also never to early to mention that writing scops will ruin even the gentlest of dispositions.
ThE_JacO
04-11-2007, 11:47 PM
Fair point :)
It's also never to early to mention that writing scops will ruin even the gentlest of dispositions.
compulsory calls marshalling, also known as "WTF?!", wrecked more families then the 2nd world war.
true story!
CGTalk Moderation
04-11-2007, 11: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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.