Thanks, but I cannot use this inside of _Update() as the port returns an empty 
CRef object.

The issue I’m running into now is my custom operator appears to connect with 
proper port and port group assignments, but I cannot find it anywhere in the 
scene.  The command used to apply the custom operator is not throwing any 
warnings or errors either.  I expect my custom operator on the primitive of the 
deformed object (deformer operator), but nothing is there.  Earlier versions of 
this custom operator worked as expected, so I’m kind of scratching my head as 
to what’s going on.  What’s really weird is I can find the custom operator 
using FindObjects2(), which says it’s attached to the scene_root.  Yet when I 
look at the scene root in the scene explorer, there’s nothing there.

Ever experience this weirdness?

I only get this weird behavior when using port groups and port group instances 
via CustomOperator.AddInputPortByClassID().  If I use static ports via 
CustomOperator.AddInputPort() the operator connects as expected, but I lose 
some features.  The command applying the custom operator is the same in both 
cases.


Matt






From: [email protected] 
[mailto:[email protected]] On Behalf Of Aloys Baillet
Sent: Monday, October 06, 2014 2:02 AM
To: [email protected]
Subject: Re: SDK: C++ Custom Operator port connections

Hi Matt,

You should use the GetPortAt method to retrieve ports. From the C++ Operator 
reference:
// For each port group
for ( LONG idxGroup = 0; idxGroup < op.GetNumPortGroups(); idxGroup++ )
// for each instance in a port group
for ( LONG idxInstance = 0; idxInstance < op.GetNumInstancesInGroup( idxGroup 
); idxInstance++ )
// for each port in a  port group instance
for ( LONG idxPort = 0; idxPort < op.GetNumPortsInGroup( idxGroup ); idxPort++ )
// get a specific port
Port port = op.GetPortAt( idxPort, idxGroup, idxInstance );

Cheers,

Aloys

On Thu, Oct 2, 2014 at 1:21 PM, Matt Lind 
<[email protected]<mailto:[email protected]>> wrote:
I have a Custom Operator written using the C++ SDK, and it uses dynamic port 
connections.

1) From inside the _Update() callback, how can I determine the number of 
connected ports in a dynamic custom operator where the number of input ports is 
arbitrary and not known ahead of time?  For example, the envelope operator – 
how does it know how many deformers and kinematic state properties are plugged 
into it?

2) How can I determine if an individual port is connected to anything?  So far 
I’ve been creating an object of the expected type then calling .IsValid().

For example:

X3DObject oObject = oOperator.GetInput( PortIndex );
If ( !oObject.IsValid() )
{
                                return( CStatus::Fail );
}

Is this the recommended way to validate a port connection?


Thanks,



Matt







--
Aloys Baillet
Lead Software Developer @ Animal Logic
The LEGO Movie

Reply via email to