An operator must explicitly state that is related to a resource. For example, here is the description for
<?xml version="1.0" encoding="utf-8" ?>
<!-- Description of the CMB mesh Model "write" Operation -->
<AttDef Type="write" Label="Model - Write Resource" BaseType="operation">
<!-- Result -->
<AttDef Type="result(write)" BaseType="result"/>
Please note the
<AssociationsDef> tag above.
An operation’s associated resources are used to determine the availability of the operation in ModelBuilder. For example, if an operation has no associations, then it is always available for execution. When an operation is associated with a
smtk::bridge::mesh::Resource, it will be available for selection from the Operations panel when a
smtk::bridge::mesh::Resource is selected in the Resources panel.
Finally, in SMTK 2 a session is associated with a resource, not an operation. This is a departure from SMTK 1, where a session described the operators it supported. In SMTK 2, all operators can be created, but many have inputs that are scoped to a specific resource type.
To summarize, in your operation, you would
- Mark your operation as associated with a resource
- Access the resource in the operation’s
operateInternal() method via the operation’s
- Access the session through the resource’s