schematic (lx_schematic.hpp)

From The Foundry MODO SDK wiki
Jump to: navigation, search
There are security restrictions on this page


Contents

Schematic

This module implements the schematic viewport.

SchematicConnection Interface

A SchematicConnection server manages a particular connection point for inter-item relations. Normally this is a graph link but can be any type of relation that the client wants to implement. The name of the connection point (the text shown on the node) is the name of the server.

This method is called for every item displayed in the schematic to determine if and how it supports this connection point. Failure or a zero falgs value means that the item doesn't have a connection.

(1) SDK: SchematicConnection::ItemFlags
         LXxMETHOD(  LxResult,
 ItemFlags) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *flags);

If any flags are set they define the type of connection this item allows.

SINGLE it can have a single incoming connection from one other item.
MULTIPLE it can have multiple incoming connection from one or more item.
ORDERED for multiple connections, the order of the connections is important.
REVERSE This server uses normal graphs, but reverses the to/from relationships. It is up to the server to set this flag even if it is managing the connections itself, otherwise link tool tips or missing nodes may not be properly identified.
PERITEM Typically an item type will have the same set of relationships for all items of that type, e.g. all "Replicator" items will have "Particle Source" and "Protopyes" relationships. In some cases, however, it might be desirable to have a relationship like "Dynamics" only be present for certain mesh items, but not all. In this case LXfSCON_PERITEM would be used, and PerItemFlags would be called for each item.
NOLISTS Schematic Connections can be displayed in list views, such as the deformer list. This flag prevents the schematic connection from being displayed in list views, limiting it to the schematic viewport only.
USESERVER this type of connection supports multiple relationships, and fully implements the advanced methods such as Count() & ByIndex(). This flag is typically combined with the flags above.
(2) SDK: LXfSCON_SINGLE, etc. defines
 #define LXfSCON_SINGLE           0x01
 #define LXfSCON_MULTIPLE         0x02
 #define LXfSCON_ORDERED          0x04
 #define LXfSCON_REVERSE          0x08
 #define LXfSCON_PERITEM          0x10
 #define LXfSCON_NOLISTS          0x20
 
 #define LXfSCON_USESERVER        0x80

(3) SDK: SchematicConnection::AllowConnect
         LXxMETHOD(  LxResult,
 AllowConnect) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to);

This function returnes LXe_TRUE if the connection is allowed between an item and an item type.

(4) SDK: SchematicConnection::AllowConnectType
         LXxMETHOD(  LxResult,
 AllowConnectType) (
         LXtObjectID              self,
         LXtObjectID              to,
         unsigned int             type);

This returns the name of a single graph. For connection points that can be described by one graph the graph name is sufficient for schematic to do all the legwork. Connecting adds a link from the source to the target in the graph, and drawing just enumerates the graph.

This must be implemented (to traverse output links), but all connections will be handled fully by the server (as given by the methods below) as long as Count() is implemented and returns LXe_OK.

(5) SDK: SchematicConnection::GraphName
         LXxMETHOD(  LxResult,
 GraphName) (
         LXtObjectID              self,
         const char             **name);

For connections not given by a single graph, the server has to provide the list of connections coming into an item presenting a connection point. These are given by a count and items by index.

(6) SDK: SchematicConnection::Count, etc.
         LXxMETHOD(  LxResult,
 Count) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *count);
 
         LXxMETHOD(  LxResult,
 ByIndex) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                 index,
         void                   **ppvObj);

Servers that enumerate the links themselves also need to manage creating and breaking links. The schematic view will call these methods from a context where undos are allowed.

(7) SDK: SchematicConnection::Connect, etc.
         LXxMETHOD(  LxResult,
 Connect) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to,
         int                      toIndex);
 
         LXxMETHOD(  LxResult,
 Disconnect) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to);

This method is called once to determine the minimum flags that will be used for any item. Certain flags can vary by item type, such as LXfSCON_SINGLE, LXfSCON_MULTIPLE and LXfSCON_ORDERED, but the flags LXfSCON_USESERVER and LXfSCON_REVERSE must be consistent for all item types.

LXfSCON_PERITEM should be added as a base flag if the flags can change over time. If set, ItemFlagsValid() will be called before any schematic draw.

Returning these flags allows us to initialize the server list once for all items.

If this method is not implemented, LXfSCON_USESERVER and LXfSCON_REVERSE are assumed to be 0.

(8) SDK: SchematicConnection::BaseFlags
         LXxMETHOD(  int,
 BaseFlags) (
         LXtObjectID              self);

When a graph should only be present on *some* items of a particular type, this is called for each item. When rejecting the graph for the element, this should return 0, otherwise it should typically return the same flags as returned by ItemFlags.

(9) SDK: SchematicConnection::PerItemFlags
         LXxMETHOD(  LxResult,
 PerItemFlags) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *flags);

When per-item flags are used, there are circumstances under which the flags for an item may change (e.g. a Dynamics package may be added or removed from a mesh). When this happens, any cached per-item data would need to be refreshed. This method is called before any schematic redraw, and if implemented, should return 1 if all item flags are still valid, or 0 if not.

This function will only be called once before validating, so once called, you can restore your internal valid flag.

(10) SDK: SchematicConnection::ItemFlagsValid
         LXxMETHOD(  int,
 ItemFlagsValid) (
         LXtObjectID              self);

(11) SDK: empty SchematicConnection User Class

Empty SchematicConnection Python user class.

(12) PY: empty SchematicConnection user class
 pass

(13) SDK: LXu_SCHEMATICCONNECTION, etc. defines
 #define LXu_SCHEMATICCONNECTION "7E238C0E-0D64-44ed-A780-13D25A2482D3"
 #define LXa_SCHEMATICCONNECTION "schematicConnection.v2"

Schematic Drop Destination

The ILxSchemaDrop interface is used when dropping items into a schematic view. This interface can be used to identify the group (assembly, workspace) into which the source was dropped, as well as the item, node, channel or graph that it may have been dropped on top of.

In addition, this also suports the ILxItem, ILxGroupDest & ILxChannelDest interfaces for alternate drop actions.

(14) SDK: LXu_SCHEMADEST, etc. defines
 #define LXu_SCHEMADEST                  "AA362F0B-DC2F-4480-82FF-32D38FD57F4F"
 #define LXa_SCHEMADEST                  "shemaDest"

(15) SDK: Declarations
 enum SchemaViewTypes {
         SCHEMAVIEW_Workspace    =  0,           // schematic view of a workspace
         SCHEMAVIEW_Overview     =  1,           // Hierarchical view of an assembly or all assemblies (if Group returns NULL)
         SCHEMAVIEW_Assembly     =  2,           // schematic view of an assembly
 };

This method returns the type of scheamtic view

(16) SDK: SchemaDest::ViewType
         LXxMETHOD( int,
 ViewType) (
         LXtObjectID              self);

This method is used to obtain the mouse position in the schematic

(17) SDK: SchemaDest::Position
         LXxMETHOD( LxResult,
 Position) (
         LXtObjectID              self,
         LXtVector                pos);

This method is used to obtain the Group (assembly, workspace) at the drop location.

(18) SDK: SchemaDest::Group
         LXxMETHOD( LxResult,
 Group) (
         LXtObjectID              self,
         void                    **ppvObj);

This method is used to obtain the item being dropped onto, it any.

(19) SDK: SchemaDest::Item
         LXxMETHOD( LxResult,
 Item) (
         LXtObjectID              self,
         void                    **ppvObj);

This method is used to obtain the schematic node being dropped onto, it any.

(20) SDK: SchemaDest::Node
         LXxMETHOD( LxResult,
 Node) (
         LXtObjectID              self,
         void                    **ppvObj);

This method is used to obtain the item channel being dropped onto, it any.

(21) SDK: SchemaDest::Channel
         LXxMETHOD( LxResult,
 Channel) (
         LXtObjectID              self,
         void                    **ppvObj);

This method is used to obtain the item graph being dropped onto, it any.

(22) SDK: SchemaDest::Graph
         LXxMETHOD( LxResult,
 Graph) (
         LXtObjectID              self,
         void                    **ppvObj);

This method is used to obtain the schematic link being dropped onto, it any.

(23) SDK: SchemaDest::Link
         LXxMETHOD( LxResult,
 Link) (
         LXtObjectID              self,
         void                    **ppvObj);

(24) SDK: CLxUser_SchemaDest::GetGroup method
         bool
 GetGroup (
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (&obj)))
                 return false;
 
         return item.take (obj);
 }
 
         bool
 GetItem (
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (&obj)))
                 return false;
 
         return item.take (obj);
 }

Empty SchemaDest Python user class.

(25) PY: empty SchemaDest user class
 pass

SchematicGroup Interface

Group items can be queried for a schematic group interface. This interface provides information about the nodes it contains, and allows the properties of the schematic to be queried and manipulated.

(26) SDK: LXu_SCHEMATICGROUP, etc. defines
 #define LXu_SCHEMATICGROUP                      "FD5B73D1-C9E2-44C2-8D8D-23EE7706B3AB"
 #define LXa_SCHEMATICGROUP                      "schematicgroup"

This returns the group item associated with a schematic group interface.

(27) SDK: SchematicGroup::Group
         LXxMETHOD(  LxResult,
 Group) (
         LXtObjectID               self,
         void                    **ppvObj);

This returns LXe_TRUE or LXe_FALSE if the group is a workspace.

(28) SDK: SchematicGroup::IsWorkspace
         LXxMETHOD(  LxResult,
 IsWorkspace) (
         LXtObjectID              self);

This function adds an item to the schematic group. If successful, the node is returned indirectly as an ILxSchematicNode.

(29) SDK: SchematicGroup::AddItem
         LXxMETHOD(  LxResult,
 AddItem) (
         LXtObjectID               self,
         LXtObjectID               item,
         void                    **ppvObj);

This function removes an item from the schematic group.

(30) SDK: SchematicGroup::RemoveItem
         LXxMETHOD(  void,
 RemoveItem) (
         LXtObjectID              self,
         LXtObjectID              item);

This function returns the number of schematic nodes in the workspace.

(31) SDK: SchematicGroup::NodeCount
         LXxMETHOD(  LxResult,
 NodeCount) (
         LXtObjectID              self,
         unsigned int            *count);

This function returns a schematic node by index. The returned object is of the type ILxSchematicNode.

(32) SDK: SchematicGroup::NodeByIndex
         LXxMETHOD(  LxResult,
 NodeByIndex) (
         LXtObjectID               self,
         unsigned int              index,
         void                    **ppvObj);

(33) SDK: CLxUser_SchematicGroup::NNodes method
         unsigned int
 NNodes ()
 {
         unsigned int             count = 0;
 
         if (LXx_OK (NodeCount (&count)))
                 return count;
 
         return 0;
 }

This function returns an assembly input node. The returned object is of the type ILxSchematicNode.

(34) SDK: SchematicGroup::InputNode
         LXxMETHOD(  LxResult,
 InputNode) (
         LXtObjectID               self,
         void                    **ppvObj);

This function returns an assembly output node. The returned object is of the type ILxSchematicNode.

(35) SDK: SchematicGroup::OutputNode
         LXxMETHOD(  LxResult,
 OutputNode) (
         LXtObjectID               self,
         void                    **ppvObj);

Empty Schematic Group Python user class.

(36) PY: empty SchematicGroup user class
 pass

SchematicNode Interface

Schematic Groups contain nodes, these nodes represent items, and may have properties such as exposed channels, exposed graphs, input connections, output connections, as well as visual properties such as a size, position and thumbnail. This interface allows the properties of the node to be queried and manipulated.

(37) SDK: LXu_SCHEMATICNODE, etc. defines
 #define LXu_SCHEMATICNODE                       "686F59FF-1E3F-4599-ADE0-E3613C483D38"
 #define LXa_SCHEMATICNODE                       "schematicnode"

Properties

This returns the group item that the node belongs to.

(38) SDK: SchematicNode::Group
         LXxMETHOD(  LxResult,
 Group) (
         LXtObjectID               self,
         void                    **ppvObj);

This returns the item that the node represents.

(39) SDK: SchematicNode::Item
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID               self,
         void                    **ppvObj);

This function adds a channel to a schematic node. The index provided should be the index of the channel on the item this node represents. If the channel already exists on another node, it will be moved.

(40) SDK: SchematicNode::AddChannel
         LXxMETHOD(  LxResult,
 AddChannel) (
         LXtObjectID              self,
         unsigned int             index);

Removes a channel from a schematic node. The index provided should be the index of the channel on the item this node represents.

(41) SDK: SchematicNode::RemoveChannel
         LXxMETHOD(  LxResult,
 RemoveChannel) (
         LXtObjectID              self,
         unsigned int             index);

INPUT Used for requesting an input channel or graph for a node.
OUTPUT Used for requesting an output channel or graph for a node.
(42) SDK: LXi_SCHMNODE_INPUT, etc. defines

This function returns the number of channels on a schematic node item.

(43) SDK: SchematicNode::ChannelCount
         LXxMETHOD(  LxResult,
 ChannelCount) (
         LXtObjectID              self,
         unsigned int            *count);

This function returns a SchematicNodeChannel object representing a specific channel by index. The type argument should be one of the LXi_SCHMNODE values, and specifies whether the input connection or the output connection is requested. The function will return NOTAVAILABLE if no input or output connection is available for the requested channel.

(44) SDK: SchematicNode::ChannelByIndex
         LXxMETHOD(  LxResult,
 ChannelByIndex) (
         LXtObjectID               self,
         unsigned int              index,
         unsigned int              type,
         void                    **ppvObj);

This function returns the number of item connections that are exposed on a schematic node.

(45) SDK: SchematicNode::ConnectionCount
         LXxMETHOD(  LxResult,
 ConnectionCount) (
         LXtObjectID              self,
         unsigned int            *count);

This function returns a SchematicNodeConnection object representing a specific item connection by index. The type argument should be one of the LXi_SCHMNODE values, and specifies whether the input connection or the output connection is requested. The function will return NOTAVAILABLE if no input or output connection is available.

(46) SDK: SchematicNode::ConnectionByIndex
         LXxMETHOD(  LxResult,
 ConnectionByIndex) (
         LXtObjectID               self,
         unsigned int              index,
         unsigned int              type,
         void                    **ppvObj);

Sub-Nodes

A single "root" node that is presented to the user may be constructed from multiple sub-nodes, each representing different item types. For example, a locator item can have any number of associated transform items, but these may be presented to the user as a single node.

This function returns LXe_TRUE if the node is a root node, otherwise it returns LXe_FALSE.

(47) SDK: SchematicNode::IsRoot
         LXxMETHOD (  LxResult,
 IsRoot) (
         LXtObjectID              self);

Given any sub-node, this function returns the root node.

(48) SDK: SchematicNode::RootNode
         LXxMETHOD(  LxResult,
 RootNode) (
         LXtObjectID               self,
         void                    **ppvObj);

Given any node, this function returns the number of associated sub-nodes.

(49) SDK: SchematicNode::SubNodeCount
         LXxMETHOD(  LxResult,
 SubNodeCount) (
         LXtObjectID              self,
         unsigned int            *count);

Given any node, this function allows the sub-nodes to be accessed by index. The returned object is of the type ILxSchematicNode.

(50) SDK: SchematicNode::SubNodeByIndex
         LXxMETHOD(  LxResult,
 SubNodeByIndex) (
         LXtObjectID               self,
         unsigned int              index,
         void                    **ppvObj);

(51) SDK: CLxUser_SchematicNode::NSubNodes method
         unsigned int
 NSubNodes ()
 {
         unsigned int             count = 0;
 
         if (LXx_OK (SubNodeCount (&count)))
                 return count;
 
         return 0;
 }

Style

This function returns the position of the schematic node. If this schematic node is a sub-node, the function will fail.

(52) SDK: SchematicNode::Position
         LXxMETHOD(  LxResult,
 Position) (
         LXtObjectID              self,
         double                  *x,
         double                  *y);

This function allows the position of the schematic node to be set. If this schematic node is a sub-node, the function will fail.

(53) SDK: SchematicNode::SetPosition
         LXxMETHOD(  LxResult,
 SetPosition) (
         LXtObjectID              self,
         double                   x,
         double                   y);

This function returns the size of the schematic node. This function will return the size of this specific node only, not including any sub-nodes.

(54) SDK: SchematicNode::Size
         LXxMETHOD(  LxResult,
 Size) (
         LXtObjectID              self,
         double                  *width,
         double                  *height);

This function returns the size of a root schematic node. If this schematic node is a sub-node, the function will fail.

(55) SDK: SchematicNode::AbsoluteSize
         LXxMETHOD(  LxResult,
 AbsoluteSize) (
         LXtObjectID              self,
         double                  *width,
         double                  *height);

This function returns LXe_TRUE or LXe_FALSE if the node is expanded to show connections.

(56) SDK: SchematicNode::Expanded
         LXxMETHOD(  LxResult,
 Expanded) (
         LXtObjectID              self);

Empty Schematic Node Python user class.

(57) PY: empty SchematicNode user class
 pass

SchematicNodeConnection Interface

Schematic Nodes connect to each other using links. These links can either represent item to item connections or channel to channel connections. The SchematicNodeConnection interface allows item connections to be walked from one node to another.

(58) SDK: LXu_SCHEMATICNODECONNECTION, etc. defines
 #define LXu_SCHEMATICNODECONNECTION             "5E015AAB-E069-4676-8F04-C7C8F88181A5"
 #define LXa_SCHEMATICNODECONNECTION             "schematicnodeconnection"

The flags method returns flags that represent the state of the schematic connection. It will be a bit mask containing some of the following.

INPUT The connection is an input connection and allows incoming connections from items.
OUTPUT The connection is an output connection and allows outgoing connections to items.
MULTIPLE The connection allows multiple items to be connected.
ORDERED The connection allows multiple items to be connected in a specific order. The MULTIPLE flag will always be set is ORDERED is set.
EXPANDED If the connection supports multiple ordered connections, the connection is expanded to display the multiple connections and allow them to be reordered.
(59) SDK: LXf_SCHMNODECONN_INPUT, etc. defines

(60) SDK: SchematicNodeConnection::Flags
         LXxMETHOD(  LxResult,
 Flags) (
         LXtObjectID              self,
         unsigned int            *flags);

This function returns the schematic node that this schematic node connection belongs to.

(61) SDK: SchematicNodeConnection::Node
         LXxMETHOD(  LxResult,
 Node) (
         LXtObjectID               self,
         void                    **ppvObj);

The Count function will return the number of items connected to the schematic connection. Currently, only input connections can be enumerated. Attempts to enumerate over output connections will return NOTAVAILABLE.

(62) SDK: SchematicNodeConnection::Count
         LXxMETHOD(  LxResult,
 Count) (
         LXtObjectID              self,
         unsigned int            *count);

The ByIndex function will return the SchematicNodeConnection on another item, that this schematic node connection is connected to.

(63) SDK: SchematicNodeConnection::ByIndex
         LXxMETHOD(  LxResult,
 ByIndex) (
         LXtObjectID               self,
         unsigned int              index,
         void                    **ppvObj);

The position function will return the absolute position of the schematic connection in the workspace. If the graph supports multiple connections, the position of a specific connection by index can be requested.

(64) SDK: SchematicNodeConnection::Position
         LXxMETHOD(  LxResult,
 Position) (
         LXtObjectID              self,
         unsigned int             index,
         double                  *x,
         double                  *y);

SchematicNodeChannel Interface

Schematic Nodes connect to each other using links. These links can either represent item to item connections or channel to channel connections. The SchematicNodeChannel interface allows channel connections to be walked from one node to another.

(65) SDK: LXu_SCHEMATICNODECHANNEL, etc. defines
 #define LXu_SCHEMATICNODECHANNEL                "322555CC-D635-48A4-BCDB-AE86CCFE29CF"
 #define LXa_SCHEMATICNODECHANNEL                "schematicnodechannel"

The flags method returns flags that represent the state of the schematic channel connection. It will be a bit mask containing some of the following.

INPUT The connection is an input connection and allows incoming connections from channels.
OUTPUT The connection is an output connection and allows outgoing connections to channels.
MULTIPLE The connection allows multiple channels to be connected.
(66) SDK: LXf_SCHMNODECHAN_INPUT, etc. defines

(67) SDK: SchematicNodeChannel::Flags
         LXxMETHOD(  LxResult,
 Flags) (
         LXtObjectID              self,
         unsigned int            *flags);

This function returns the schematic node that this schematic node channel belongs to.

(68) SDK: SchematicNodeChannel::Node
         LXxMETHOD(  LxResult,
 Node) (
         LXtObjectID               self,
         void                    **ppvObj);

This function returns the channel index for this schematic node channel.

(69) SDK: SchematicNodeChannel::Index
         LXxMETHOD(  LxResult,
 Index) (
         LXtObjectID              self,
         unsigned int            *index);

The Count function will return the number of channels connected to the schematic connection.

(70) SDK: SchematicNodeChannel::Count
         LXxMETHOD(  LxResult,
 Count) (
         LXtObjectID              self,
         unsigned int            *count);

The ByIndex function will return the SchematicNodeChannel on another item, that this schematic node channel is connected to.

(71) SDK: SchematicNodeChannel::ByIndex
         LXxMETHOD(  LxResult,
 ByIndex) (
         LXtObjectID               self,
         unsigned int              index,
         void                    **ppvObj);

The position function will return the absolute position of the schematic connection in the workspace.

(72) SDK: SchematicNodeChannel::Position
         LXxMETHOD(  LxResult,
 Position) (
         LXtObjectID              self,
         double                  *x,
         double                  *y);