Hello,
How to use ‘getBehaviors’
Hello,
The one parameter in getBehaviors() only sets, where the behaviors are searched (node, all nodes in component, or all nodes in attached components). The parameter is optional.
In Python 3 API, there is no direct replacement for Python 2 API:s method findBehavioursByType. However it’s a one-liner to implement from scratch, and then one can customize whether it e.g. finds also inherited types or finds from a specific node.
To get all boolean signals in a component, here’s two examples:
all_behaviors = comp.getBehaviors(vc.vcNodeTreeScope.COMPONENT) # All behaviors in all nodes of component
boolsignals = [beh for beh in all_behaviors if isinstance(beh, vc_beh.vcBooleanSignal)]
all_behaviors = comp.getBehaviors(vc.vcNodeTreeScope.COMPONENT) # All behaviors in all nodes of component
boolsignals = [beh for beh in all_behaviors if beh.Type == vc_beh.vcBehaviorType.BOOLEAN_SIGNAL)]