Re: Scripting : Little object question.

Date : Wed, 14 Jun 2006 22:20:10 +1000
To : XSI(at)Softimage.COM
From : "Aloys Baillet" <aloys.baillet(at)gmail.com>
Subject : Re: Scripting : Little object question.
Hi Guillaume,

You're actually dealing with XSI shortcuts...
The subdiv parameters actually belong to this object:
oPanel.ActivePrimitive.ConstructionHistory.Find("geom")
But XSI kindly provides you with a shortcut. Unfortunately they are
not always reliable...
So if you use that it will always work:

var oGeomOp = oPanel.ActivePrimitive.ConstructionHistory.Find("geom");
oGeomOp.Parameters("subdivu").Value = 2;
oGeomOp.Parameters("subdivv").Value = 2;

Cheers,

Aloys

On 6/14/06, guillaume laforge <guillaume.laforge.3d(at)gmail.com> wrote:
Hi list,

 I've got a strange error in a script. Not a big problem but I would like to
understand better XSI/Jscript behaviour.

 If I run those lines in this order it works fine :

 var oPanel = ActiveSceneRoot.AddGeometry("Grid","MeshSurface", "Panel" );
//create a polymesh grid
 oPanel.Parameters('subdivu').Value = 2; //set the U grid subdivision
 oPanel.Parameters('subdivv').Value = 2; //set the V grid subdivision

 oPanel.rotx = 90; //Rotate the grid
 ResetTransform(oPanel, siCtr, siRot, siXYZ); //freeze rotation
 oPanel.properties('visibility').rendvis.Value = 0;//Hide in render

 But if I change the order like bellow it throw an error at the last line (
null value or not an object ) :

 var oPanel = ActiveSceneRoot.AddGeometry("Grid","MeshSurface", "Panel" );
//create a polymesh grid
 oPanel.rotx = 90; //Rotate the grid
 ResetTransform(oPanel, siCtr, siRot, siXYZ); //freeze rotation
 oPanel.properties('visibility').rendvis.Value = 0;//Hide in render

 oPanel.Parameters('subdivu').Value = 2; //set the U grid subdivision
 oPanel.Parameters('subdivv').Value = 2; //set the V grid subdivision

 It looks like oPanel instance object is not updated. Is it the standard
behaviour ?

 Cheers,


-- Guillaume Laforge freelance TD | cg Artist


--
Aloys Baillet - XSI Technical Director
Character Dpt - Animal Logic
--
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.