CICEPortState is used for accessing the state of a custom
ICENode
input port from the BeginEvaluate
callback.
The state information
is normally used by custom nodes for managing internal cache in
order to optimize the computation and improve performance. The
following port states are supported:
- Tip:
-
CICEPortState::siAnyDirtyState can be used to test if at least
one state is dirty.
- Note:
-
CICEPortState cannot be used in the Evaluate callback.
- Since:
- 8.0 (2010)
- Example:
- This example logs the dirty state information of input ports by
using the CICEPortState class. For a more detailed example see the
PortStateObserver
custom ICE node example
XSIPLUGINCALLBACK CStatus Port_State_Observer_BeginEvaluate( ICENodeContext& in_ctxt )
{
CICEPortState portGeomGroup( in_ctxt, ID_IN_GeometryGroup );
CICEPortState portGeomCurve( in_ctxt, ID_IN_NurbsCurve );
CICEPortState portGeomMesh( in_ctxt, ID_IN_MeshSurf );
CICEPortState portGeomNurbsSurf( in_ctxt, ID_IN_NurbsSurf );
CICEPortState portGeomCloud( in_ctxt, ID_IN_PointCloud );
CICEPortState data( in_ctxt, ID_IN_Data );
double dCurrentFrame = in_ctxt.GetTime();
LogPortStates( portGeomGroup, L"GeometryGroup", dCurrentFrame );
LogPortStates( portGeomCurve, L"NurbsCurve", dCurrentFrame );
LogPortStates( portGeomMesh, L"MeshSurf", dCurrentFrame );
LogPortStates( portGeomNurbsSurf, L"NurbsSurf", dCurrentFrame );
LogPortStates( portGeomCloud, L"PointCloud", dCurrentFrame );
LogPortStates( data, L"Data", dCurrentFrame );
return CStatus::OK;
}
static void LogPortStates( CICEPortState& in_port, const CString& in_portName, double in_dCurrentFrame )
{
if ( in_port.IsDirty( CICEPortState::siAnyDirtyState ) )
{
bool bTypeDirtyState = in_port.IsDirty( CICEPortState::siTypeDirtyState );
bool bDataDirtyState = in_port.IsDirty( CICEPortState::siDataDirtyState );
bool bTimeDirtyState = in_port.IsDirty( CICEPortState::siTimeDirtyState );
in_port.ClearState();
Application app;
if ( bTypeDirtyState)
{
app.LogMessage( ">>> Port " + in_portName + " siTypeDirtyState at frame " + CString(in_dCurrentFrame) + " is dirty" );
}
else
{
if ( bDataDirtyState)
{
app.LogMessage( ">>> Port " + in_portName + " siDataDirtyState at frame " + CString(in_dCurrentFrame) + " is dirty" );
}
else if ( bTimeDirtyState)
{
app.LogMessage( ">>> Port " + in_portName + " siTimeDirtyState at frame " + CString(in_dCurrentFrame) + " is dirty" );
}
}
}
}