Re: Point position before modeling marker
| Date : Sat, 16 Sep 2006 16:27:36 +0200 |
| To : XSI(at)Softimage.COM |
| From : "guillaume laforge" <guillaume.laforge.3d(at)gmail.com> |
| Subject : Re: Point position before modeling marker |
For general scripting, you want to look at Primitive.GetGeometry() which
you can pass in a value to specify what construction mode to retrieve the
geometry object from.For a scripted operator, I'm not so sure, since it
doesn't have one of those cog icons by the title in the SDK docs, so Soft
obviously don't recommend using it in a SCOP.
[/Andy ]
You are right, "Primitive.GetGeometry()" is not the solution for a SCOP. The SDK said that "mode" argument is ignored inside operators :-/.
[Robert]
I'm pretty sure you would be able to do it - both AddScriptedOp and
AddScriptedOpFromFile have a construction mode argument.
[/Robert]
Yes but it is not the created operator who need to be in modeling construction mode. I need it in secondary mode and read points position from modeling mode.
But thanks for your answer, it helps me to understand the next reply from Andy :-).
[Andy]
Could you add an operator in modelling mode and get it to save the point
positions into a userdatablob, then add an operator in secondary shape
mode to read it back in?
[/Andy]
Thanks Andy ! I think it is the way to go...but I'm stoped half the way.
I can create a userdatablob by script. I run those lines with all operators disable above modeling mode :
oPoints = oObject.ActivePrimitive.Geometry.Points.PositionArray.toArray();
var oBlob = oObject.AddProperty( "UserDataBlob", false, "v2nSaveModelingUDB" ) ;
oBlob.Value = oPoints
Now if I applied my "mask SCOP" in secondary mode it successfully read the point position from the userdatablob !
So I continue on this way and write an operator to dynamically save point position from modeling construction mode...and I miserably failed.
Here is the SCOP applied on a userdatablob :
function XSILoadPlugin( in_reg )
{
in_reg.Author = "Guillaume Laforge";
in_reg.Name = "v2nSaveModelingOp";
in_reg.Major = 1;
in_reg.Minor = 0;
in_reg.RegisterOperator("v2nSaveModelingOp");
in_reg.RegisterMenu(siMenuTbDeformID,"v2nSaveModelingOp_Menu",false,false);
//RegistrationInsertionPoint - do not remove this line
return true;
}
function v2nSaveModelingOp_Menu_Init( ctxt )
{
var oMenu;
oMenu = ctxt.Source;
oMenu.Filter = siGeometryFilter ;
oMenu.AddCallbackItem("v2nSaveModelingOp (JScript Plugin)","v2nSaveModelingOpMenu");
return true;
}
function v2nSaveModelingOpMenu( ctxt )
{
// This function is called when the "v2nSaveModelingOp (JScript Plugin)" menu is clicked.
var oTargets = Application.Selection;
// Loop so that we build a separate operator for each selected object.
for ( i = 0 ; i < oTargets.Count ; i++ )
{
oObject = oTargets.Item(i) ;
// Two connections on this SICO.
oObjectPrimitive = oObject.ActivePrimitive ;
oBlob = oObject.AddProperty( "UserDataBlob", false, "v2nSaveModelingUDB" ) ;
//v2nSaveModelingOp connexions
AddCustomOp( "v2nSaveModelingOp", // Type
oBlob , // Output
[ oBlob, oObjectPrimitive ], // Inputs
"v2nSaveModelingOp", // Name
siConstructionModeModeling ) ; //Applied in modeling Construction mode
}
}
function v2nSaveModelingOp_DefineLayout( ctx )
{
layout = ctx.Source
layout.Clear() ;
layout.AddItem( "Mute" ) ;
}
//v2nSaveModelingOp operator
function v2nSaveModelingOp_Update( ctx )
{
// Get the object primitive.
var oInputPrimitive = ctx.GetInputValue( 1 ) ;
ctx.OutputPort.Value = oInputPrimitive.Geometry.Points.PositionArray.toArray();
return;
}
No error warning occure when I apply this SCOP but when I read the userdatablob value it gives an "Invalid argument specified" at
this line in the SCOP : ctx.OutputPort.Value = oInputPrimitive.Geometry.Points.PositionArray.toArray ();
My question is, how to save points positions in this userdatablob with a SCOP ?
Thanks
Guillaume
- Follow-Ups:
- RE: Point position before modeling marker
- From: "Andy Nicholas" <andy(at)andynicholas.com>
- RE: Point position before modeling marker
- References:
- Point position before modeling marker
- From: "guillaume laforge" <guillaume.laforge.3d(at)gmail.com>
- Re: Point position before modeling marker
- From: "Andy Nicholas" <andy(at)andynicholas.com>
- Re: Point position before modeling marker
- From: "guillaume laforge" <guillaume.laforge.3d(at)gmail.com>
- Re: Point position before modeling marker
- From: "Andy Nicholas" <andy(at)andynicholas.com>
- Point position before modeling marker
| DATE: | << | >> | THREAD: | << | >> | INDEX: | Main | Thread |
|---|
- Previous by Date: Re: Realtime-Shader: Cubic texturing via OGL
- Next by Date: Re: Realtime-Shader: Cubic texturing via OGL
- Previous by Thread: Re: Realtime-Shader: Cubic texturing via OGL
- Next by Thread: Re: Realtime-Shader: Cubic texturing via OGL
- Index(es):
| Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available. |