RE: SDK: C++ Custom Operator port connections

2014-10-06 Thread Matt Lind
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: softimage-boun...@listproc.autodesk.com 
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Aloys Baillet
Sent: Monday, October 06, 2014 2:02 AM
To: softimage@listproc.autodesk.com
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 
mailto:ml...@carbinestudios.com>> 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


Re: SDK: C++ Custom Operator port connections

2014-10-06 Thread Aloys Baillet
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  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


SDK: C++ Custom Operator port connections

2014-10-01 Thread Matt Lind
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






Re: connections

2013-12-19 Thread David Gallagher


Thanks! I'll try it.

On 12/19/2013 8:39 AM, Martin Yara wrote:
So, basically you want to add an equal expression to match 
grpDrivenPunkSkirtXXX to ctlPunkSkirtXXX kinematics right? If then, 
you could use a simple loop, and extract the null's name substring to 
get the ctl name.


Something like this (for scale):

# select grpDriven nulls
si = Application
for item in si.Selection:
ctl = si.ActiveSceneRoot.FindChild("ctl" + item.name 
[9:])

si.SetExpr(item.sclx, ctl.sclx)
si.SetExpr(item.scly, ctl.scly)
si.SetExpr(item.sclz, ctl.sclz)


On Thu, Dec 19, 2013 at 11:51 PM, Eric Thivierge 
mailto:ethivie...@hybride.com>> wrote:


This would be a perfect case for a for loop script. No tools built
in that I know of.


On Wednesday, December 18, 2013 9:54:43 PM, David Gallagher wrote:


I'm looking for some functionality that might already be there in
Softimage.

I want to connect a list of controls to other items -- in this
case a
list of "spaced" rig elements (that stay back at the origin).
I can select the lists here in the Parameter Connection
Editor, but
then I have to select all the transforms on both sides of the
list in
order to connect them.

I just want to connect all the transforms at one time. Instead
of this
one-by-one process.

Is there a tool out there to do this, or something I'm missing
in the
exisiting tool?
Thanks!







Re: connections

2013-12-19 Thread Martin Yara
So, basically you want to add an equal expression to match
grpDrivenPunkSkirtXXX to ctlPunkSkirtXXX kinematics right? If then, you
could use a simple loop, and extract the null's name substring to get the
ctl name.

Something like this (for scale):

# select grpDriven nulls
si = Application
for item in si.Selection:
ctl = si.ActiveSceneRoot.FindChild("ctl" + item.name[9:])
si.SetExpr(item.sclx, ctl.sclx)
si.SetExpr(item.scly, ctl.scly)
si.SetExpr(item.sclz, ctl.sclz)


On Thu, Dec 19, 2013 at 11:51 PM, Eric Thivierge wrote:

> This would be a perfect case for a for loop script. No tools built in that
> I know of.
>
>
> On Wednesday, December 18, 2013 9:54:43 PM, David Gallagher wrote:
>
>>
>> I'm looking for some functionality that might already be there in
>> Softimage.
>>
>> I want to connect a list of controls to other items -- in this case a
>> list of "spaced" rig elements (that stay back at the origin).
>> I can select the lists here in the Parameter Connection Editor, but
>> then I have to select all the transforms on both sides of the list in
>> order to connect them.
>>
>> I just want to connect all the transforms at one time. Instead of this
>> one-by-one process.
>>
>> Is there a tool out there to do this, or something I'm missing in the
>> exisiting tool?
>> Thanks!
>>
>>
>


Re: connections

2013-12-19 Thread Eric Thivierge
This would be a perfect case for a for loop script. No tools built in 
that I know of.


On Wednesday, December 18, 2013 9:54:43 PM, David Gallagher wrote:


I'm looking for some functionality that might already be there in
Softimage.

I want to connect a list of controls to other items -- in this case a
list of "spaced" rig elements (that stay back at the origin).
I can select the lists here in the Parameter Connection Editor, but
then I have to select all the transforms on both sides of the list in
order to connect them.

I just want to connect all the transforms at one time. Instead of this
one-by-one process.

Is there a tool out there to do this, or something I'm missing in the
exisiting tool?
Thanks!





Re: Inspecting ICE node connections from Python

2013-06-18 Thread Steven Caron
no sweat, it was a good reminder for me also :)

On Tue, Jun 18, 2013 at 12:21 PM, James Vecore wrote:

> Ah perfect, Thanks!
>
> ** **
>
> Not sure how I missed that one. I was digging through commands and must
> have overlooked those Properties.
>
> ** **
>
> Thank you,
>
> ** **
>
> -James
>
> ** **
>
>
>


RE: Inspecting ICE node connections from Python

2013-06-18 Thread James Vecore
Ah perfect, Thanks!

 

Not sure how I missed that one. I was digging through commands and must have
overlooked those Properties.

 

Thank you,

 

-James

 

From: softimage-boun...@listproc.autodesk.com
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Steven Caron
Sent: Tuesday, June 18, 2013 3:10 PM
To: softimage@listproc.autodesk.com
Subject: Re: Inspecting ICE node connections from Python

 

oh right, you want 'ConnectedPorts' and 'ConnectedNodes' property of an
ICENodePort class. this example isn't a proper step through the graph but it
shows you what you want... i think :)

 

from siutils import si

si = si()#
win32com.client.Dispatch('XSI.Application')

from siutils import log # LogMessage

from siutils import disp   # win32com.client.Dispatch

from siutils import C   # win32com.client.constants

 

for op in si.Selection(0).ActivePrimitive.ConstructionHistory:

if op.Type == "ICETree":

ICETree = op

# output port direction

log("output ports")

for node in op.Nodes:

for port in node.OutputPorts:

for connectedPort,connectedNode in zip(port.ConnectedPorts,
port.ConnectedNodes):

log("%s.%s -> %s.%s" % (node.Name, port.Name,
connectedNode.Name, connectedPort.Name))

# input port direction

log("input ports")

for node in op.Nodes:

for port in node.InputPorts:

for connectedPort,connectedNode in zip(port.ConnectedPorts,
port.ConnectedNodes):

log("%s.%s -> %s.%s" % (node.Name, port.Name,
connectedNode.Name, connectedPort.Name))

 

On Tue, Jun 18, 2013 at 11:43 AM, James Vecore 
wrote:

Thanks for the reply Steve.

 

I should have been more specific in my question. IsConnect does tell if the
port is connected and I had picked that up from the docs, but I don't see a
way to traverse backwards to the icenode that is feeding an input node. For
example, lets say I have a GetData node (Node A) and a custom ICECompound
(Node B). Node A is connected to an known input port in Node B.  So if I
have a reference to Node B and the input port I'm interested in, how could
find out that Node A is what is connected to that port? If you take the
inputPort.Value you will get None if the value is a complex type (and the
docs say these are not supported). The docs reference using
ICENodePort.Parameters for types that are not supported by
ICENodeInputPort.Value. However, inputPort.Parameters.Count == 0 and
enumerating over it gives:

 

# WARNING : 3407 - Values cannot be accessed on connected ports: 

 

I also searched all the commands with "ICE" in them and didn't see anything
that makes sense for my scenario. 

 

Any Ideas?

 

-James

 

 

From: softimage-boun...@listproc.autodesk.com
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Steven Caron
Sent: Tuesday, June 18, 2013 2:19 PM
To: softimage@listproc.autodesk.com
Subject: Re: Inspecting ICE node connections from Python

 

you want the ICENodePort class...

 

http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.
html?url=si_om/ICENodePort.html,topicNumber=si_om_ICENodePort_html

 

example code...

 

from siutils import si

si = si()#
win32com.client.Dispatch('XSI.Application')

from siutils import log # LogMessage

from siutils import disp   # win32com.client.Dispatch

from siutils import C   # win32com.client.constants

 

for op in si.Selection(0).ActivePrimitive.ConstructionHistory:

if op.Type == "ICETree":

ICETree = op

lastPort = list(ICETree.InputPorts)[-1]

if lastPort.IsConnected:

si.AddPortToICENode( lastPort,
"siNodePortDataInsertionLocationAfter" )

lastPort = list(ICETree.InputPorts)[-1]

log(lastPort.Name)

 

On Tue, Jun 18, 2013 at 11:10 AM, James Vecore 
wrote:

I'm looking for a way to inspect the connections between ice nodes from
Python. I'm trying to write a tool that will generate and update an ice
graph on demand based on some parameters. I need to be able to inspect an
existing ice graph and most importantly the connections between nodes in the
ICE graph. I can't seem to find how to do this in the docs. All I see
related to node connections is ConnectICENode. Ideally I would like
something like this AreICENodesConnected(outputPort, inputPort) or a way to
enumerate connections but I don't see anything available.

 

Am I missing something or is this just not possible from the Scripting API?

 

Thanks,

 

-James

 

James Vecore  |  Pluto  |  A Creative Content Place  |  hellopluto.com
<http://hellopluto.com/>   |  248.723. | 586.295.9473 mobile

 

 

 



Re: Inspecting ICE node connections from Python

2013-06-18 Thread Steven Caron
oh right, you want 'ConnectedPorts' and 'ConnectedNodes' property of an
ICENodePort class. this example isn't a proper step through the graph but
it shows you what you want... i think :)

from siutils import si
si = si() # win32com.client.Dispatch('XSI.Application')
from siutils import log # LogMessage
from siutils import disp # win32com.client.Dispatch
from siutils import C # win32com.client.constants

for op in si.Selection(0).ActivePrimitive.ConstructionHistory:
if op.Type == "ICETree":
ICETree = op
# output port direction
log("output ports")
for node in op.Nodes:
for port in node.OutputPorts:
for connectedPort,connectedNode in zip(port.ConnectedPorts,
port.ConnectedNodes):
log("%s.%s -> %s.%s" % (node.Name, port.Name,
connectedNode.Name, connectedPort.Name))
# input port direction
log("input ports")
for node in op.Nodes:
for port in node.InputPorts:
for connectedPort,connectedNode in zip(port.ConnectedPorts,
port.ConnectedNodes):
log("%s.%s -> %s.%s" % (node.Name, port.Name,
connectedNode.Name, connectedPort.Name))


On Tue, Jun 18, 2013 at 11:43 AM, James Vecore wrote:

> Thanks for the reply Steve.
>
> ** **
>
> I should have been more specific in my question. IsConnect does tell if
> the port is connected and I had picked that up from the docs, but I don’t
> see a way to traverse backwards to the icenode that is feeding an input
> node. For example, lets say I have a GetData node (Node A) and a custom
> ICECompound (Node B). Node A is connected to an known input port in Node B.
>  So if I have a reference to Node B and the input port I’m interested in,
> how could find out that Node A is what is connected to that port? If you
> take the inputPort.Value you will get None if the value is a complex type
> (and the docs say these are not supported). The docs reference using
> ICENodePort.Parameters for types that are not supported by
> ICENodeInputPort.Value. However, inputPort.Parameters.Count == 0 and
> enumerating over it gives:
>
> ** **
>
> # WARNING : 3407 - Values cannot be accessed on connected ports:  input_null>
>
> ** **
>
> I also searched all the commands with “ICE” in them and didn’t see
> anything that makes sense for my scenario. 
>
> ** **
>
> Any Ideas?
>
> ** **
>
> -James
>
> ** **
>
> ** **
>
> *From:* softimage-boun...@listproc.autodesk.com [mailto:
> softimage-boun...@listproc.autodesk.com] *On Behalf Of *Steven Caron
> *Sent:* Tuesday, June 18, 2013 2:19 PM
> *To:* softimage@listproc.autodesk.com
> *Subject:* Re: Inspecting ICE node connections from Python
>
> ** **
>
> you want the ICENodePort class...
>
> ** **
>
>
> http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_om/ICENodePort.html,topicNumber=si_om_ICENodePort_html
> 
>
> ** **
>
> example code...
>
> ** **
>
> from siutils import si
>
> si = si()#
> win32com.client.Dispatch('XSI.Application')
>
> from siutils import log # LogMessage
>
> from siutils import disp   # win32com.client.Dispatch
>
> from siutils import C   # win32com.client.constants
>
> ** **
>
> for op in si.Selection(0).ActivePrimitive.ConstructionHistory:
>
> if op.Type == "ICETree":
>
> ICETree = op
>
> lastPort = list(ICETree.InputPorts)[-1]
>
> if lastPort.IsConnected:
>
> si.AddPortToICENode( lastPort,
> "siNodePortDataInsertionLocationAfter" )
>
> lastPort = list(ICETree.InputPorts)[-1]****
>
> log(lastPort.Name)
>
> ** **
>
> On Tue, Jun 18, 2013 at 11:10 AM, James Vecore 
> wrote:
>
> I’m looking for a way to inspect the connections between ice nodes from
> Python. I’m trying to write a tool that will generate and update an ice
> graph on demand based on some parameters. I need to be able to inspect an
> existing ice graph and most importantly the connections between nodes in
> the ICE graph. I can’t seem to find how to do this in the docs. All I see
> related to node connections is ConnectICENode. Ideally I would like
> something like this AreICENodesConnected(outputPort, inputPort) or a way to
> enumerate connections but I don’t see anything available.
>
>  
>
> Am I missing something or is this just not possible from the Scripting API?
> 
>
>  
>
> Thanks,
>
>  
>
> -James
>
>  
>
> James Vecore  |  Pluto  |  A Creative Content Place  |  hellopluto.com
>  |  248.723. | 586.295.9473 mobile
>
>  
>
> ** **
>


RE: Inspecting ICE node connections from Python

2013-06-18 Thread James Vecore
Thanks for the reply Steve.

 

I should have been more specific in my question. IsConnect does tell if the
port is connected and I had picked that up from the docs, but I don't see a
way to traverse backwards to the icenode that is feeding an input node. For
example, lets say I have a GetData node (Node A) and a custom ICECompound
(Node B). Node A is connected to an known input port in Node B.  So if I
have a reference to Node B and the input port I'm interested in, how could
find out that Node A is what is connected to that port? If you take the
inputPort.Value you will get None if the value is a complex type (and the
docs say these are not supported). The docs reference using
ICENodePort.Parameters for types that are not supported by
ICENodeInputPort.Value. However, inputPort.Parameters.Count == 0 and
enumerating over it gives:

 

# WARNING : 3407 - Values cannot be accessed on connected ports: 

 

I also searched all the commands with "ICE" in them and didn't see anything
that makes sense for my scenario. 

 

Any Ideas?

 

-James

 

 

From: softimage-boun...@listproc.autodesk.com
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Steven Caron
Sent: Tuesday, June 18, 2013 2:19 PM
To: softimage@listproc.autodesk.com
Subject: Re: Inspecting ICE node connections from Python

 

you want the ICENodePort class...

 

http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.
html?url=si_om/ICENodePort.html,topicNumber=si_om_ICENodePort_html

 

example code...

 

from siutils import si

si = si()#
win32com.client.Dispatch('XSI.Application')

from siutils import log # LogMessage

from siutils import disp   # win32com.client.Dispatch

from siutils import C   # win32com.client.constants

 

for op in si.Selection(0).ActivePrimitive.ConstructionHistory:

if op.Type == "ICETree":

ICETree = op

lastPort = list(ICETree.InputPorts)[-1]

if lastPort.IsConnected:

si.AddPortToICENode( lastPort,
"siNodePortDataInsertionLocationAfter" )

lastPort = list(ICETree.InputPorts)[-1]

log(lastPort.Name)

 

On Tue, Jun 18, 2013 at 11:10 AM, James Vecore 
wrote:

I'm looking for a way to inspect the connections between ice nodes from
Python. I'm trying to write a tool that will generate and update an ice
graph on demand based on some parameters. I need to be able to inspect an
existing ice graph and most importantly the connections between nodes in the
ICE graph. I can't seem to find how to do this in the docs. All I see
related to node connections is ConnectICENode. Ideally I would like
something like this AreICENodesConnected(outputPort, inputPort) or a way to
enumerate connections but I don't see anything available.

 

Am I missing something or is this just not possible from the Scripting API?

 

Thanks,

 

-James

 

James Vecore  |  Pluto  |  A Creative Content Place  |  hellopluto.com
<http://hellopluto.com/>   |  248.723. | 586.295.9473 mobile

 

 



Re: Inspecting ICE node connections from Python

2013-06-18 Thread Steven Caron
you want the ICENodePort class...

http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=si_om/ICENodePort.html,topicNumber=si_om_ICENodePort_html

example code...

from siutils import si
si = si() # win32com.client.Dispatch('XSI.Application')
from siutils import log # LogMessage
from siutils import disp # win32com.client.Dispatch
from siutils import C # win32com.client.constants

for op in si.Selection(0).ActivePrimitive.ConstructionHistory:
if op.Type == "ICETree":
ICETree = op
lastPort = list(ICETree.InputPorts)[-1]
if lastPort.IsConnected:
si.AddPortToICENode( lastPort,
"siNodePortDataInsertionLocationAfter" )
lastPort = list(ICETree.InputPorts)[-1]
log(lastPort.Name)


On Tue, Jun 18, 2013 at 11:10 AM, James Vecore wrote:

> I’m looking for a way to inspect the connections between ice nodes from
> Python. I’m trying to write a tool that will generate and update an ice
> graph on demand based on some parameters. I need to be able to inspect an
> existing ice graph and most importantly the connections between nodes in
> the ICE graph. I can’t seem to find how to do this in the docs. All I see
> related to node connections is ConnectICENode. Ideally I would like
> something like this AreICENodesConnected(outputPort, inputPort) or a way to
> enumerate connections but I don’t see anything available.
>
> ** **
>
> Am I missing something or is this just not possible from the Scripting API?
> 
>
> ** **
>
> Thanks,
>
> ** **
>
> -James
>
> ** **
>
> James Vecore  |  Pluto  |  A Creative Content Place  |  hellopluto.com
>  |  248.723. | 586.295.9473 mobile
>
> ** **
>


Inspecting ICE node connections from Python

2013-06-18 Thread James Vecore
I'm looking for a way to inspect the connections between ice nodes from
Python. I'm trying to write a tool that will generate and update an ice
graph on demand based on some parameters. I need to be able to inspect an
existing ice graph and most importantly the connections between nodes in the
ICE graph. I can't seem to find how to do this in the docs. All I see
related to node connections is ConnectICENode. Ideally I would like
something like this AreICENodesConnected(outputPort, inputPort) or a way to
enumerate connections but I don't see anything available.

 

Am I missing something or is this just not possible from the Scripting API?

 

Thanks,

 

-James

 

James Vecore  |  Pluto  |  A Creative Content Place  |
<http://hellopluto.com/> hellopluto.com  |  248.723. | 586.295.9473
mobile