seltypes (lx_seltypes.hpp)

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


Contents

Selection Types and Translation Interfaces

This defines common selection types and their packet translation interfaces. The interface can be acquired by querying the selection packet object for the selection type which can be found from the selection service global.

The autoInit() method is common to all the packet translation user classes. It simply inits the user class by getting the type implementation from the global service.

(1) Packet Translation $$ autoInit
         bool
 autoInit ()
 {
         CLxLoc_SelectionService  svc;
         LXtObjectID              obj;
 
         if (LXx_FAIL (svc.Allocate (LXsSELTYP_$$, &obj)))
                 return false;
 
         return take (obj);
 }

Scene Selection

Scene selection determines which scene is currently active for commands. The selection packet can be read or encoded.

(2) SDK: Declarations
 #define LXsSELTYP_SCENE                 "cinema"
 #define LXu_SCENEPACKETTRANSLATION      "A63F8E08-94D8-11D9-96D3-000A956C2E10"

(3) SDK: ILxScenePacketTranslation interface
         LXxMETHOD(  LxResult,
 Scene) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtObjectID              scene);

(4) User Class: ScenePacketTranslation method
         ''[[#C1|Packet Translation SCENE autoInit]]''
 
         bool
 GetScene (
         void                    *packet,
         CLxLoc_Scene            &scene)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Scene (packet, &obj)))
                 return false;
 
         return scene.take (obj);
 }

Empty ScenePacketTranslation Python user class.

(5) PY: ScenePacketTranslation method
 pass

Item Selection

Selected items can be of different types, and each packet encodes a single item selection.

(6) SDK: Declarations
 #define LXsSELTYP_ITEM                  "item"
 #define LXu_ITEMPACKETTRANSLATION       "029663CC-9571-11D9-B9AD-000A956C2E10"

(7) SDK: ILxItemPacketTranslation interface
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtObjectID              item);

(8) User Class: ItemPacketTranslation method
         ''[[#C1|Packet Translation ITEM autoInit]]''
 
         bool
 GetItem (
         void                    *packet,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (packet, &obj)))
                 return false;
 
         return item.take (obj);
 }

Empty ItemPacketTranslation Python user class.

(9) PY: ItemPacketTranslation method
 pass

Node Selection

Selected nodes can be of different types, and each packet encodes a single node selection.

(10) SDK: Declarations
 #define LXsSELTYP_NODE                  "schmNode"
 #define LXu_NODEPACKETTRANSLATION       "5A560F1B-DC73-4efb-8579-C6C7D9373C60"

(11) SDK: ILxNodePacketTranslation interface
         LXxMETHOD(  LxResult,
 Node) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtObjectID              node);

(12) User Class: NodePacketTranslation method
         ''[[#C1|Packet Translation NODE autoInit]]''
 
         bool
 GetNode (
         void                    *packet,
         CLxLoc_Item             &node)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Node (packet, &obj)))
                 return false;
 
         return node.take (obj);
 }

Empty NodePacketTranslation Python user class.

(13) PY: NodePacketTranslation method
 pass

Channel Selection

Selected channels are wrapped in a COM object that contains an item/channel pair.

(14) SDK: Declarations
 #define LXsSELTYP_CHANNEL               "channel"
 #define LXu_CHANNELPACKETTRANSLATION    "00DE9D39-6A83-46DC-9C28-360662922CE5"

(15) SDK: ILxChannelPacketTranslation interface
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  unsigned int,
 Index) (
         LXtObjectID              self,
         void                    *packet);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned int             index);

(16) User Class: ChannelPacketTranslation method
         ''[[#C1|Packet Translation CHANNEL autoInit]]''
 
         bool
 GetItem (
         void                    *packet,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (packet, &obj)))
                 return false;
 
         return item.take (obj);
 }

Empty ChannelPacketTranslation Python user class.

(17) PY: ChannelPacketTranslation method
 pass

Center Selection

Selected centers are identical to selected items, but need a different translation interface.

(18) SDK: Declarations
 #define LXsSELTYP_CENTER                "center"
 #define LXu_CENTERPACKETTRANSLATION     "52B10EAB-9EA6-4F28-81D1-2FEC51E02933"

(19) SDK: ILxCenterPacketTranslation interface
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtObjectID              item);

(20) User Class: CenterPacketTranslation method
         ''[[#C1|Packet Translation CENTER autoInit]]''
 
         bool
 GetItem (
         void                    *packet,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (packet, &obj)))
                 return false;
 
         return item.take (obj);
 }

Empty CenterPacketTranslation Python user class.

(21) PY: CenterPacketTranslation method
 pass

Pivot Selection

Pivots have an item and a type.

NOTE: define the types here...

(22) SDK: Declarations
 #define LXsSELTYP_PIVOT                 "pivot"
 #define LXu_PIVOTPACKETTRANSLATION      "9744D68E-D6CD-4652-AD33-073A24E16901"

(23) SDK: ILxPivotPacketTranslation interface
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  unsigned int,
 Type) (
         LXtObjectID              self,
         void                    *packet);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned int             type);

(24) User Class: PivotPacketTranslation method
         ''[[#C1|Packet Translation PIVOT autoInit]]''
 
         bool
 GetItem (
         void                    *packet,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (packet, &obj)))
                 return false;
 
         return item.take (obj);
 }

Empty PivotPacketTranslation Python user class.

(25) PY: PivotPacketTranslation method
 pass

Link Selection

Links are defined by a starting item and channel, and an ending item and channel.

NOTE: shouldn't we also know the graph?

(26) SDK: Declarations
 #define LXsSELTYP_LINK                  "link"
 #define LXu_LINKPACKETTRANSLATION       "EEA9F625-EB3C-43FD-A156-C8552D6D18C9"

(27) SDK: ILxLinkPacketTranslation interface
         LXxMETHOD(  LxResult,
 From) (
         LXtObjectID              self,
         void                    *packet,
         int                     *channel,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 To) (
         LXtObjectID              self,
         void                    *packet,
         int                     *channel,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtObjectID              fromItem,
         int                      fromChannel,
         LXtObjectID              toItem,
         int                      toChannel);

(28) User Class: LinkPacketTranslation method
         ''[[#C1|Packet Translation LINK autoInit]]''
 
         bool
 GetFrom (
         void                    *packet,
         CLxLoc_Item             &item,
         int                     *channel)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (From (packet, channel, &obj)))
                 return false;
 
         return item.take (obj);
 }
 
         bool
 GetTo (
         void                    *packet,
         CLxLoc_Item             &item,
         int                     *channel)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (To (packet, channel, &obj)))
                 return false;
 
         return item.take (obj);
 }

Empty LinkPacketTranslation Python user class.

(29) PY: LinkPacketTranslation method
 pass

Vertex Selection

A selected vertex is part of a mesh, which can be read from the packet. The selected vertex may also be discontinuous, in which case the polygon associated with the selected vertex will be non-null.

(30) SDK: Declarations
 #define LXsSELTYP_VERTEX                "vertex"
 #define LXu_VERTEXPACKETTRANSLATION     "D77B8382-9572-11D9-AFDE-000A956C2E10"

(31) SDK: ILxVertexPacketTranslation interface
         LXxMETHOD(  LxResult,
 Vertex) (
         LXtObjectID              self,
         void                    *packet,
         LXtPointID              *vertex);
 
         LXxMETHOD(  LxResult,
 Polygon) (
         LXtObjectID              self,
         void                    *packet,
         LXtPolygonID            *polygon);
 
         LXxMETHOD(  LxResult,
 Mesh) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtPointID               vertex,
         LXtPolygonID             polygon,
         LXtObjectID              mesh);
 
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);

(32) User mesh and item methods
         bool
 GetMesh (
         void                    *packet,
         CLxLoc_Mesh             &mesh)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Mesh (packet, &obj)))
                 return false;
 
         return mesh.take (obj);
 }
 
         bool
 GetItem (
         void                    *packet,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (packet, &obj)))
                 return false;
 
         return item.take (obj);
 }

(33) User Class: VertexPacketTranslation method
 ''[[#C1|Packet Translation VERTEX autoInit]]''
 ''[[#C32|User mesh and item methods]]''

Empty VertexPacketTranslation Python user class.

(34) PY: VertexPacketTranslation method
 pass

Edge Selection

A selected edge is given by a pair of vertices in a mesh. As with vertices, edge selections may be discontinuous in which case the polygon will be non-null.

(35) SDK: Declarations
 #define LXsSELTYP_EDGE                  "edge"
 #define LXu_EDGEPACKETTRANSLATION       "CA4DFE14-957E-11D9-AC64-000A956C2E10"

(36) SDK: ILxEdgePacketTranslation interface
         LXxMETHOD(  LxResult,
 Vertices) (
         LXtObjectID              self,
         void                    *packet,
         LXtPointID              *vertexA,
         LXtPointID              *vertexB);
 
         LXxMETHOD(  LxResult,
 Polygon) (
         LXtObjectID              self,
         void                    *packet,
         LXtPolygonID            *polygon);
 
         LXxMETHOD(  LxResult,
 Mesh) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtPointID               vertexA,
         LXtPointID               vertexB,
         LXtPolygonID             polygon,
         LXtObjectID              mesh);
 
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);

(37) User Class: EdgePacketTranslation method
 ''[[#C1|Packet Translation EDGE autoInit]]''
 ''[[#C32|User mesh and item methods]]''

Empty EdgePacketTranslation Python user class.

(38) PY: EdgePacketTranslation method
 pass

Polygon Selection

Polygon selection is just a polygon ID in a mesh.

(39) SDK: Declarations
 #define LXsSELTYP_POLYGON               "polygon"
 #define LXu_POLYGONPACKETTRANSLATION    "2E0929DC-9583-11D9-B058-000A956C2E10"

(40) SDK: ILxPolygonPacketTranslation interface
         LXxMETHOD(  LxResult,
 Polygon) (
         LXtObjectID              self,
         void                    *packet,
         LXtPolygonID            *polygon);
 
         LXxMETHOD(  LxResult,
 Mesh) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtPolygonID             polygon,
         LXtObjectID              mesh);
 
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                    *packet,
         void                   **ppvObj);

(41) User Class: PolygonPacketTranslation method
 ''[[#C1|Packet Translation POLYGON autoInit]]''
 ''[[#C32|User mesh and item methods]]''

Empty PolygonPacketTranslation Python user class.

(42) PY: PolygonPacketTranslation method
 pass

Vertex Map Selection

A selected vertex map consists entirely of a name and a type. Commands affect all selected mesh items that contain a vertex map with that name and type.

(43) SDK: Declarations
 #define LXsSELTYP_VERTEXMAP             "vmap"
 #define LXu_VMAPPACKETTRANSLATION       "BBCB6B90-9586-11D9-A3B8-000A956C2E10"

(44) SDK: ILxVMapPacketTranslation interface
         LXxMETHOD(  LxResult,
 Name) (
         LXtObjectID              self,
         void                    *packet,
         const char             **name);
 
         LXxMETHOD(  LxResult,
 Type) (
         LXtObjectID              self,
         void                    *packet,
         LXtID4                  *type);
 
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         LXtID4                   type,
         const char              *name);

(45) User Class: VMapPacketTranslation method
 ''[[#C1|Packet Translation VERTEXMAP autoInit]]''

Empty VMapPacketTranslation Python user class.

(46) PY: VMapPacketTranslation method
 pass

(47) SDK: Declarations
 #define LXsSELTYP_PRESETPATH                    "preset"
 #define LXu_PRESETPATHPACKETTRANSLATION         "6b95c2ac-9a9e-471f-9771-cf10fd5c6bcb"

Preset Path Selection

The preset path selection packet includes the path to a preset on disk, and an optional client identifier that can be used as a selection sub-type. These identifiers are usually associated with a Preset Browser viewport instance. See the Preset Browser documentation for more information on the preset path selection packet.

These return the path and identifier. If these strings are not set or empty in the packet, the pointers returned will be NULL.

(48) SDK: ILxPresetPathPacketTranslation interface
         LXxMETHOD(  LxResult,
 Path) (
         LXtObjectID               self,
         void                     *packet,
         const char              **path);
 
         LXxMETHOD(  LxResult,
 Identifier) (
         LXtObjectID               self,
         void                     *packet,
         const char              **identifier);

This creates anew packet from a given path and identifier. This packet is only valid until the next call to this function.

(49) SDK: ILxPresetPathPacketTranslation interface
         LXxMETHOD(  void *,
 Packet) (
         LXtObjectID              self,
         const char              *path,
         const char              *identifier);

(50) User Class: PresetPathPacketTranslation method
         ''[[#C1|Packet Translation PRESETPATH autoInit]]''
 
         const char *
 GetPath (
         void                    *packet)
 {
         const char              *path;
 
         if (LXx_FAIL (Path (packet, &path)))
                 return NULL;
 
         return path;
 }
 
         const char *
 GetIdentifier (
         void                    *packet)
 {
         const char              *identifier;
 
         if (LXx_FAIL (Identifier (packet, &identifier)))
                 return NULL;
 
         return identifier;
 }

Empty PresetPathPacketTranslation Python user class.

(51) PY: PresetPathPacketTranslation method
 pass

ILxItemChannel

This simple read-only interface is used to represent a single channel in an item as a single entity.

(52) SDK: Declarations
 #define LXu_ITEMCHANNEL                 "3cfab0aa-8e8c-452c-81e5-272842fff935"
 #define LXa_ITEMCHANNEL                 "itemchannel"

(53) SDK: ILxItemChannel interface
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                   **ppvObj);
 
         LXxMETHOD(  unsigned int,
 ChannelIndex) (
         LXtObjectID              self);

(54) User Class: ItemChannel method
         bool
 GetItem (
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Item (&obj)))
                 return false;
 
         return item.take (obj);
 }

Empty ILxItemChannel Python user class.

(55) PY: ItemChannel method
 pass