Hello, I´ve been trying to setup a simple synoptic code setup that I can later reuse in other
synoptic components.
so the code it´s like this for a first hotspot called: round_area.
Hello, I´ve been trying to setup a simple script in jscript to select an object inside a model from a synpptic view setup un in javascript:
<html>
<body version="2">
<script language="JavaScript">
function round_area(in_obj,in_mousebutton,in_keymodifier)
{
SelectObj ("sphere, , True);
};
But I know that in order for making this re-usable I need to create some sort of variable?
I´m not a programmer guy, just a simple animator who´s a little confused by jscript syntax.
Anyone help?
Thanks.
Reusable Synoptic code
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Reusable Synoptic code
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Reusable Synoptic code
So far I got this:
<html>
<body version="2">
<script language="JavaScript">
function ball(in_obj,in_mousebutton,in_keymodifier)
{
SelectObj ("sphere"," ", True);
}
But it returns an error on line 2. I´m using xsi 2011 sp1.
Could you help me out with this simple thing, please?
Someone mentioned the syntax..I corrected on the select object line. But that still is causing an error 2
Why is it doing it not passing even the "body version" line, then??
<html>
<body version="2">
<script language="JavaScript">
function ball(in_obj,in_mousebutton,in_keymodifier)
{
SelectObj ("sphere"," ", True);
}
But it returns an error on line 2. I´m using xsi 2011 sp1.
Could you help me out with this simple thing, please?
Someone mentioned the syntax..I corrected on the select object line. But that still is causing an error 2
Why is it doing it not passing even the "body version" line, then??
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
craft
- Posts: 107
- Joined: 02 Jan 2010, 23:40
- Location: Portugal
Re: Reusable Synoptic code
line count is relative to the script itself, not the html structure. so, it addresses to the SelectObj line.
the " " part is the problem now. Specially with a space character inside... that means you're inputing a valid string saying: " ", when it expects either nothing or one of the following values: "ASITIS", "NODE", BRANCH", "TREE", "MODEL" (you really should check the SDK documentation, it's very helpfull)
So either replace that with the word null (no ""'s), or just remove the space character (the command's expecting a string, anyway) Also, use the word true, not True, or you'll get another error.
the " " part is the problem now. Specially with a space character inside... that means you're inputing a valid string saying: " ", when it expects either nothing or one of the following values: "ASITIS", "NODE", BRANCH", "TREE", "MODEL" (you really should check the SDK documentation, it's very helpfull)
So either replace that with the word null (no ""'s), or just remove the space character (the command's expecting a string, anyway) Also, use the word true, not True, or you'll get another error.
Code: Select all
function ball(in_obj,in_mousebutton,in_keymodifier)
{
SelectObj ("sphere", null, true);
}Tiago Beijoco
http://www.craft.host56.com
http://www.craft.host56.com
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Reusable Synoptic code
Marvelous!! It works now!
<html>
<body version="2">
<script language="JavaScript">
function ball(in_obj,in_mousebutton,in_keymodifier)
{
SelectObj ("sphere",null, null);
}
I really would like to learn the SDK on this subject. What´s the subject search for this as jscript?
Thank you very much Thiago.
<html>
<body version="2">
<script language="JavaScript">
function ball(in_obj,in_mousebutton,in_keymodifier)
{
SelectObj ("sphere",null, null);
}
I really would like to learn the SDK on this subject. What´s the subject search for this as jscript?
Thank you very much Thiago.
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
craft
- Posts: 107
- Joined: 02 Jan 2010, 23:40
- Location: Portugal
Re: Reusable Synoptic code
it's easy, really.
just type whatever command/object/method you want to read about in the script editor. double click the word and press F1 on the keyboard. Also works with incomplete words.
just type whatever command/object/method you want to read about in the script editor. double click the word and press F1 on the keyboard. Also works with incomplete words.
Tiago Beijoco
http://www.craft.host56.com
http://www.craft.host56.com
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Reusable Synoptic code
Wonderful TIP Tiago! The syntax for objects will be so clear from now on.
But what if I need to make the "reset" actor and the "keyframe" all parameters from the pose?
How would I code this in Js? I´ll be posting here my tries.
Thanks.
But what if I need to make the "reset" actor and the "keyframe" all parameters from the pose?
How would I code this in Js? I´ll be posting here my tries.
Thanks.
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Reusable Synoptic code
Tiago, in JS in order to create a Keyframe button for a selected object
what would be the syntax? I´ve been trying To erase the number here:
SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", 1, null, null, null, false, null);
And then it DOES save a keyframe wherever I am.
Since I´d like the script button to check if an object is selected, and if it´s so, then
keyframe on keyable attributes...how to organize this in a method that doesn´t involve all the names in all the transforms and rots in the model? Because writting them, would be madness, there are a gazillion names.
Thanks.
what would be the syntax? I´ve been trying To erase the number here:
SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", 1, null, null, null, false, null);
And then it DOES save a keyframe wherever I am.
Since I´d like the script button to check if an object is selected, and if it´s so, then
keyframe on keyable attributes...how to organize this in a method that doesn´t involve all the names in all the transforms and rots in the model? Because writting them, would be madness, there are a gazillion names.
Thanks.
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Reusable Synoptic code
So far I got this:
function keyfram(in_obj,in_mousebutton,in_keymodifier)
{
SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", null, null, null, false, null);
SaveKey("sphere.kine.local.rotx,sphere.kine.local.roty,sphere.kine.local.rotz", null, null, null, false, null);
}
and it works perfectly, keying on any frame I move to.
But my question is: is there a method to "GetCurrentSelection at Object" to name this like:
SaveKey("CurrentSelectedObject.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", null, null, null, false, null);
SaveKey("CurrentSelectedObject.kine....x)
SaveKey("CurrentSelectedObject.kine....y)
?
function keyfram(in_obj,in_mousebutton,in_keymodifier)
{
SaveKey("sphere.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", null, null, null, false, null);
SaveKey("sphere.kine.local.rotx,sphere.kine.local.roty,sphere.kine.local.rotz", null, null, null, false, null);
}
and it works perfectly, keying on any frame I move to.
But my question is: is there a method to "GetCurrentSelection at Object" to name this like:
SaveKey("CurrentSelectedObject.kine.local.posx,sphere.kine.local.posy,sphere.kine.local.posz", null, null, null, false, null);
SaveKey("CurrentSelectedObject.kine....x)
SaveKey("CurrentSelectedObject.kine....y)
?
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
-
luceric
- Posts: 1252
- Joined: 21 Jun 2009, 22:08
Re: Reusable Synoptic code
Just properly define the parameters as keyable or not and just call
SaveKeyOnKeyable
no need to specify any parameters
Or use a relative path
SaveKey "/kine.local.pos"
this is all in the documentation example of the SaveKey command.
SaveKeyOnKeyable
no need to specify any parameters
Or use a relative path
SaveKey "/kine.local.pos"
this is all in the documentation example of the SaveKey command.
-
sirdavid32
- Posts: 309
- Joined: 10 Feb 2010, 03:36
- Location: Ecuador
Re: Reusable Synoptic code
St.Blair, Lucernic, thanks:
SaveKey( "/kine.local.pos,kine.local.ori,kine.local.scl" );
This worked perfectly!!
SaveKey( "/kine.local.pos,kine.local.ori,kine.local.scl" );
This worked perfectly!!
Portfolio: https://www.behance.net/3dcinetv
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com
Vimeo: http://vimeo.com/3dcinetv
Web: http://www.3dcinetv.com