OK, I didn't phrase some of that well for what I seek:

In addition to questions 1, 2, and 3, what I'd really like to know is how to 
access the variable number of input ports from inside the _Update() callback.  
For example, if I need to get direct access to the target primitive of variable 
input 3, is there a way I can directly call it?  Or do I have to iterate 
through the input ports and/or port groups and count indices until I find what 
I am looking for?

Matt



From: softimage-boun...@listproc.autodesk.com 
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Matt Lind
Sent: Wednesday, September 24, 2014 4:20 PM
To: softimage@listproc.autodesk.com
Subject: SDK: Custom Operator using dynamic ports via Port Groups

I have already combed the SDK docs, wiki, and SDK example code, but information 
and examples are rather lacking concerning a problem I need to solve.

I have a custom operator (deformer) which I'm developing using the C++ API.  It 
has a number of fixed inputs, plus a number of variable inputs (i.e. number of 
inputs can change depending on context which the operator is applied just like 
the envelope operator's inputs can vary with the number of deformers feeding 
the envelope).

The data types of the fixed inputs are the same/similar to the data types used 
for the variable inputs.  The variable inputs also have to be matched sets of 
source/target pairs.  For example, for each variable input port which reads a 
source transform, I must also have an associated target transform.  Either I 
get both and connect them to the operator, or I ignore and move onto the next 
pair.  To add a further wrinkle, each variable input consists of a 
kinematicsstate, primitive, and a ClusterProperty (weightmap)

Here are the input ports for the custom operator:


Fixed Inputs (these ports will always exist no matter how the operator is 
applied):

Source Primitive
Source Global Transform

Target Primitive
Target Global Transform

Target ClusterProperty 1 (weightmap)
Target ClusterProperty 2 (weightmap)
Target ClusterProperty 3 (weightmap)
Target ClusterProperty 4 (weightmap)

Variable inputs [1...N] (these inputs are optional and will only exist if the 
user chooses to involve them in the operator.  Each input is a package of 5 
input ports.  I must validate and connect all 5 pieces, or connect none of 
them.  Ideally, I would like the ability to add/remove inputs dynamically as 
the user changes his/her mind using the tool - again, much like adding/removing 
deformers in the envelope operator)

Source Surface 1 Primitive
Source Surface 1 Global Transform
Source Surface 1 ClusterProperty (weightmap)
Target Surface 1 Primitive
Target Surface 1 Global Transform

Source Surface 2 Primitive
Source Surface 2 Global Transform
Source Surface 2 ClusterProperty (weightmap)
Target Surface 2 Primitive
Target Surface 2 Global Transform

...

Source Surface N Primitive
Source Surface N Global Transform
Source Surface N ClusterProperty (weightmap)
Target Surface N Primitive
Target Surface N Global Transform


Questions:


1) How can I differentiate the fixed inputs from the variable inputs if the 
data type is the same?  (other than counting arguments in the argument list)?

2) Must I create port group(s) for the fixed inputs in order to play nice with 
the variable input port groups?

3) What is the best way to validate each variable input to ensure all 5 pieces 
exist and connect to the operator using port groups?

According to the SDK docs, I can put the primitives and transforms together in 
the same port group, but the associated ClusterProperty must be in its own port 
group by itself.  Should I put the 4 primitive and transform ports into one 
port group and the cluster property into a 2nd port group, or should I make 3 
port groups?  (eg; source primitive and transform, target primitive and 
transform, clusterproperty)

Thanks,

PS - it would be of great help to see a working example of a custom operator 
using a mixture of fixed ports and port groups with variable inputs - such as 
the envelope operator.  There isn't a single example in the documentation or 
SDK workgroup that puts all the information in one place to demonstrate how to 
use port groups making this a very frustrating experience.  The 
vertexcolormixer isn't very clear.  The constraint operator example is too 
simple.

Matt

Reply via email to