RE: Register Operator... How to deal with Ports.

Date : Wed, 21 May 2008 13:19:16 +0100
To : <XSI(at)Softimage.COM>
From : "kim aldis" <xsi(at)kim-aldis.co.uk>
Subject : RE: Register Operator... How to deal with Ports.

Does this help:-

 

                // Input portgroup for any number of profile inputs

                //

                PortGroup oProfilePortGroup = newOp.AddPortGroup( L"Profiles", 1,500 );

                newOp.AddInputPortByClassID( siPrimitiveID  , L"ProfilePrimIn", oProfilePortGroup.GetIndex(), 0, siOptionalInputPort );

 

 

                // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Connect up the ports %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

                //

                // Input Portgroup for the profile Kinestates

                //

                PortGroup oProfileKinePortGroup = newOp.AddPortGroup( L"KineStates", 1,500 );

                newOp.AddInputPortByClassID( siKinematicStateID  , L"PRofileKineIn", oProfileKinePortGroup.GetIndex(), 0, siOptionalInputPort );

               

 

                // connect up test null

                // Hmm, if we don't connect this, will it exist later?

                //newOp.ConnectToGroup( oOutputPortGroupPoints.GetIndex(), oNull.GetKinematics().GetLocal(), iInst );

 

                // ToDo: Connect up the point count parameter for our customised UV projection.

 

                // connect up the rail curve prim input

                newOp.ConnectToGroup( oRailCurvePortGroup_In.GetIndex(), oRailCurve.GetActivePrimitive(), iInst );

 

 

                // and connect up the profile(s) primitive(s) and kinestate(s)

                // oProfileList is a collection built earlier.

                for ( i = 0; i< oProfileList.GetCount(); i++ ) {

                                X3DObject o = oProfileList[i];

                                Primitive oPrim = o.GetActivePrimitive();

                                KinematicState oKineState = o.GetKinematics().GetLocal();        

               

                                CStatus stat = newOp.ConnectToGroup( oProfilePortGroup.GetIndex(), oPrim, iInst );

                                stat = newOp.ConnectToGroup( oProfileKinePortGroup.GetIndex(), oKineState, iInst );              

                   

                }

 

From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Jeremie Passerin
Sent: 14 May 2008 14:36
To: xsi(at)Softimage.COM
Subject: Register Operator... How to deal with Ports.

 

Hi List,

Maybe a stupid question,

I'm working on an operator that took several Inputs... I know how to connect group and so connect my inputs. But I've never been able to put more than one port on a group. Should be possible, shouldn't it ?

Here is what I do :

// Code ======================================
// Create the operator
var oOp = XSIFactory.CreateObject( "MyNewOp" );

// Groups and Ports
oOp.AddPortGroup( "OutGroup" ,1,1);
oOp.AddOutputPortByClassID( siKinematicStateID, "OutGlobal" );

oOp.AddPortGroup( "InGrGlobal" ,1,1 );
oOp.AddInputPortByClassID( siKinematicStateID, "InGlobal" );
oOp.AddInputPortByClassID( siUnknownClassID, "InPrimitive" );

// Connect
oOp.ConnectToGroup( 0, oObj.Kinematics.Global );
oOp.ConnectToGroup( 1, oObj2.Kinematics.Global );
// End Code ==================================

It works fine, except Obj2.Kinematics.Global is connected to Group 1 Port 0 and 1.
And then  ???? How do I connect an object to Group 1 Port 1  ? Is it simply possible to do so ?

My solution right now is to create as many Group as Port... but that way why is the use of Ports ?


thanx


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.