schematic (lx_schematic.hpp)

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


SchematicConnection Interface (old)

(1) SDK: ILxSchematicConnection1 interface
         LXxMETHOD(  LxResult,
 ItemFlags) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *flags);
 
         LXxMETHOD(  LxResult,
 AllowConnect) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to);
 
         LXxMETHOD(  LxResult,
 GraphName) (
         LXtObjectID              self,
         const char             **name);
 
         LXxMETHOD(  LxResult,
 Count) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *count);
 
         LXxMETHOD(  LxResult,
 ByIndex) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                 index,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 Connect) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to,
         int                      toIndex);
 
         LXxMETHOD(  LxResult,
 Disconnect) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to);
 
         LXxMETHOD(  int,
 BaseFlags) (
         LXtObjectID              self);
 
         LXxMETHOD(  LxResult,
 PerItemFlags) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *flags);
 
         LXxMETHOD(  int,
 ItemFlagsValid) (
         LXtObjectID              self);

// Old Schematic Connection Interface (<MODOP)

(2) SDK: Declarations
 #define LXu_SCHEMATICCONNECTION1        "5AC0A075-72B7-4935-8DA5-588DF7999069"
 #define LXa_SCHEMATICCONNECTION1        "schematicConnection"

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.

(3) SDK: ILxSchematicConnection interface
         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 "Repicaotr" 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.
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.

(4) SDK: Declarations
 #define LXfSCON_SINGLE           0x01
 #define LXfSCON_MULTIPLE         0x02
 #define LXfSCON_ORDERED          0x04
 #define LXfSCON_REVERSE          0x08
 #define LXfSCON_PERITEM          0x10
 
 #define LXfSCON_USESERVER        0x80

(5) SDK: ILxSchematicConnection interface
         LXxMETHOD(  LxResult,
 AllowConnect) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to);

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

(6) SDK: ILxSchematicConnection interface
         LXxMETHOD(  LxResult,
 AllowConnectType) (
         LXtObjectID              self,
         LXtObjectID              from,
         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.

(7) SDK: ILxSchematicConnection interface
         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.

(8) SDK: ILxSchematicConnection interface
         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.

(9) SDK: ILxSchematicConnection interface
         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.

(10) SDK: ILxSchematicConnection interface
         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.

(11) SDK: ILxSchematicConnection interface
         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.

(12) SDK: ILxSchematicConnection interface
         LXxMETHOD(  int,
 ItemFlagsValid) (
         LXtObjectID              self);

(13) User Class: SchematicConnection method

Empty SchematicConnection Python user class.

(14) PY: SchematicConnection method
 pass

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