Function port type (NOT_FUNCTION)


Active member
Does anyone know what datatype it is or how it works?

The SDK docs are outdated and don't even include NOT_FUNCTION and NOT_MATERIAL. While material is easy because the LWMaterial struct is defined, the Function type is more elusive.


NewTek Developer
It's pretty easy.

Create(void *priv, NodeID nodeID, LWError *err)
  iMyPlug *inst;
  //Reserve enough memeory for our instance structure
  inst = calloc(1, sizeof(iMyPlug));

  inst->function_input = nodeInputFunc->create(inst->nodeID, NOT_FUNCTION,"Function",NULL);


Evaluate(iTime *inst, LWNodalAccess *na, NodeOutputID nid, NodeValue nv)
    double variable_to_be_funcded = 0.23765;

    nodeInputFunc->evaluate(inst->function_input, na, &variable_to_be_funcded);

inst->function_input is assigned when you create your inputs in the Create callback. In Evaluate, the address of 'variable_to_be_funcded' is passed up the function input to a function node, the function node does it's operation and you then have a new value in 'variable_to_be_funcded' to work with. In this case I passed 0.23765 to the function node but of course it can be any scalar value.

Hope this helps, it's been a long time since I touched this aspect of nodes.


Active member
Great, thanks! That should be more than enough info :) I'm only looking into supporting the port type, but pass it along to other nodes without "doing" anything myself, so the data type was my main concern.
Top Bottom