item (lx_item.hpp)

From The Foundry MODO SDK wiki
(Redirected from LXiCHANTYPE EVAL (index))
Jump to: navigation, search
There are security restrictions on this page


Contents

Item SDK

The item SDK is a set of interfaces for clients to query and alter items and the scenes they are in.

ILxSceneService

The scene service provides high-level scene and item system access. These methods are provided as general services that could be useful on any item.

(1) SDK: Declarations
 #define LXa_SCENESERVICE        "sceneservice3"
 #define LXu_SCENESERVICE        "50190141-0059-48FE-B27D-6C98E1348D7B"

(2) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 ScriptQuery) (
         LXtObjectID              self,
         void                   **ppvObj);

Scenes can be nested within other scenes, becoming their children, and are refered to as sub-scenes. A scene containing sub-scenes inherits all items contained in those child scenes, allowing them to be evelauted en-masse and to set parenting links between items across scenes, etc.

The root scene acts as a container for all loaded scenes. It is not visible to the user. Newly added scenes are created as sub-scenes of the root. When a scene is evaluated, all of its sub-scenes are also eveluated.

This method returns the root scene, and can be used to walk all of the sub-scenes.

(3) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 Root) (
         LXtObjectID              self,
         void                   **ppvObj);

(4) User Service Class: SceneService method
         bool
 GetRoot (
         CLxLoc_Scene            &scene)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Root (&obj)))
                 return false;
 
         return scene.take (obj);
 }

Item Types

These functions scan the list of item types, returning their type IDs. Types are given by integers and also by unique names. -1 is normally used to indicate all types, and 0 indicates no valid type.

(5) SDK: Types
 typedef int              LXtItemType;
 #define LXiTYPE_ANY      -1
 #define LXiTYPE_NONE      0

(6) SDK: ILxSceneService interface
         LXxMETHOD( unsigned,
 ItemTypeCount) (
         LXtObjectID              self);
 
         LXxMETHOD( LxResult,
 ItemTypeByIndex) (
         LXtObjectID              self,
         unsigned                 index,
         LXtItemType             *type);

(7) PY: SceneService method
 def ItemTypeList(self):
     """list of types = ItemTypeList()
     """
     return [ self.ItemTypeByIndex(i) for i in range(self.ItemTypeCount()) ]

Given a type name, this returns the type ID.

(8) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ItemTypeLookup) (
         LXtObjectID              self,
         const char              *name,
         LXtItemType             *type);

(9) User Service Class: SceneService method
         LXtItemType
 ItemType (
         const char              *name)
 {
         LXtItemType              type;
 
         if (LXx_FAIL (ItemTypeLookup (name, &type)))
                 return LXiTYPE_NONE;
 
         return type;
 }

This method returns the internal name of a type given it's type ID.

(10) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ItemTypeName) (
         LXtObjectID              self,
         LXtItemType              type,
         const char             **name);

Type codes can be tested for relationship. This returns LXe_TRUE if 'what' is the same type as, or a sub-type of, 'isA.'

(11) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ItemTypeTest) (
         LXtObjectID              self,
         LXtItemType              what,
         LXtItemType              isA);

It is also possible to look up the super-type code from a type code. This returns LXe_NOTFOUND if the item type has no super-type.

(12) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ItemTypeSuper) (
         LXtObjectID              self,
         LXtItemType              type,
         LXtItemType             *super);

This method returns the number of channels shared by two items. This is the number of channels defined by their common ancestor type, if any. If they do not share any channels, this returns LXe_NOTFOUND;

(13) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ItemTypeCommonChannels) (
         LXtObjectID              self,
         LXtObjectID              item1,
         LXtObjectID              item2,
         unsigned                *count);

These return the number of subtypes for a given type, and the name of each subtype by index.

(14) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ItemSubTypeCount) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int            *count);
 
         LXxMETHOD( LxResult,
 ItemSubTypeByIndex) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int             index,
         const char             **subtype);

(15) PY: SceneService method
 def ItemSubTypeList(self, type):
     """list of sub-types = ItemSubTypeList(type)
     """
     return [ self.ItemSubTypeByIndex(type, i) for i in range(self.ItemSubTypeCount(type)) ]

Utilities

This function returns the number of components in the given one of the LXiCHANMODE_* defines.

(16) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ChannelVectorSize) (
         LXtObjectID              self,
         unsigned int             mode,
         unsigned int            *size);

Useful for UIs and configs, this function returns the text hints array for the vector modes.

(17) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ChannelVectorTextHints) (
         LXtObjectID              self,
         const LXtTextValueHint **hints);

Scenes

Create an empty scene. This is parented to the root scene, and is truely empty not a default new scene.

(18) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 CreateScene) (
         LXtObjectID              self,
         void                   **ppvObj);

(19) User Service Class: SceneService method
         bool
 NewScene (
         CLxLoc_Scene            &scene)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (CreateScene (&obj)))
                 return false;
 
         return scene.take (obj);
 }

Destroy a scene. Effectively the same as closing it. All references to the contents of the scene must have been released.

(20) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 DestroyScene) (
         LXtObjectID              self,
         LXtObjectID              scene);

This method adds a sub-scene to another scene. The refItems flag can be set to have all items in the sub-cinema referenced in the parent.

(21) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 SubSceneAdd) (
         LXtObjectID              self,
         LXtObjectID              scene,
         LXtObjectID              other,
         unsigned                 refItems);

This loads a scene as a sub-scene. If the parent scene is null this will be a root scene.

(22) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 SubSceneLoad) (
         LXtObjectID              self,
         LXtObjectID              scene,
         const char              *path,
         LXtObjectID              monitor,
         void                   **ppvObj);

Transforms

Components of the transform are accessed by type.

(23) SDK: Types
 typedef unsigned        LXtTransformType;
 
 #define LXiXFRM_SCALE           0
 #define LXiXFRM_ROTATION        1
 #define LXiXFRM_POSITION        2
 #define LXiXFRM_PIVOT           3
 #define LXiXFRM_PIVOT_C         4
 #define LXiXFRM_SHEAR           5
 #define LXiXFRM_PIVOT_ROT       6
 #define LXiXFRM_PIVOT_ROT_C     7

Mesh Instances

Support for finding source items for mesh instance items and the instances of mesh items takes the following form:

Given an ILxItem of type LXi_CIT_INSTANCE, this function returns the LXi_CIT_MESH type source item.

(24) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 GetMeshInstSourceItem) (
         LXtObjectID              self,
         LXtObjectID              inst,
         void                   **ppvObj);

This method returns the number of mesh instances using the given mesh item as source.

(25) SDK: ILxSceneService interface
         LXxMETHOD(  int,
 MeshInstanceCount) (
         LXtObjectID              self,
         LXtObjectID              mesh);

This method returns the mesh instance using the given mesh item as source by index.

(26) SDK: ILxSceneService interface
         LXxMETHOD(  LxResult,
 MeshInstanceByIndex) (
         LXtObjectID              self,
         LXtObjectID              mesh,
         int                      index,
         void                   **ppvObj);

Images

Images are loaded with the following method. The two-way 'flags' argument should be set with the combination of LXf_LOADIMG_ flags specifying what steps may be taken to find the image. On successful return, the flags will be set to indicate what steps were actually taken, in this way the client can determine whether the image loaded differs from that specified due either to a user replacement, or to expansion to an absolute path.

(27) SDK: Declarations

(28) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 LoadImage) (
         LXtObjectID              self,
         LXtObjectID              scene,
         const char              *name,
         unsigned                *flags,
         LXtObjectID              monitor,
         void                   **ppvObj);

Replicators

The GetReplicatorEnumerator interface allows you to get an enumerator for a replicator item to enumerate the positions & orientations of replicants generated by its particle source.

(29) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 GetReplicatorEnumerator) (
         LXtObjectID              self,
         LXtObjectID              replicatorItem,
         void                   **ppvObj);

(30) User Service Class: SceneService method
         bool
 NewReplicatorEnumerator (
         ILxUnknownID                     pItem,
         CLxLoc_ReplicatorEnumerator     &replicatorEnum)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (GetReplicatorEnumerator (pItem, &obj)))
                 return false;
 
         return replicatorEnum.take (obj);
 }

Item Type Tags

Read the value of a tag for an item type, if any. If super is true the supertypes will also be checked.

(31) SDK: ILxSceneService interface
         LXxMETHOD( LxResult,
 ItemTypeGetTag) (
         LXtObjectID              self,
         LXtItemType              type,
         const char              *tag,
         unsigned                 super,
         const char             **value);

Type Support

This is a simple utility class that provides item type IDs. First time it's requested it's cached.

(32) User Class: additional
 class CLxItemType {
     public:
         const char              *type_name;
         LXtItemType              cached_code;
 
         CLxItemType (
                 const char      *typeName)
         {
                 type_name   = typeName;
                 cached_code = LXiTYPE_NONE;
         }
 
                 LXtItemType
         Type ()
         {
                 if (cached_code != LXiTYPE_NONE)
                         return cached_code;
 
                 CLxUser_SceneService srv;
 
                 cached_code = srv.ItemType (type_name);
                 return cached_code;
         }
 
                 operator
         LXtItemType ()
         {
                 return Type ();
         }
 };

ILxScene2Service

Legacy scene service for old plug-ins.

Provides old locator methods which are now part of ILxLocator.

(33) SDK: Declarations
 #define LXa_SCENE2SERVICE       "sceneservice2"
 #define LXu_SCENE2SERVICE       "3B1E02DD-8ACA-4f30-99C4-F87B626D4FA3"

(34) SDK: ILxScene2Service interface
         LXxMETHOD(  LxResult,
 ScriptQuery) (
         LXtObjectID              self,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 Root) (
         LXtObjectID              self,
         void                   **ppvObj);
 
         LXxMETHOD( LxResult,
 LoadImage) (
         LXtObjectID              self,
         LXtObjectID              scene,
         const char              *name,
         unsigned                *flags,
         LXtObjectID              monitor,
         void                   **ppvObj);
 
         LXxMETHOD( unsigned,
 ItemTypeCount) (
         LXtObjectID              self);
 
         LXxMETHOD( LxResult,
 ItemTypeByIndex) (
         LXtObjectID              self,
         unsigned                 index,
         LXtItemType             *type);
 
         LXxMETHOD( LxResult,
 ItemTypeLookup) (
         LXtObjectID              self,
         const char              *name,
         LXtItemType             *type);
 
         LXxMETHOD( LxResult,
 ItemTypeName) (
         LXtObjectID              self,
         LXtItemType              type,
         const char             **name);
 
         LXxMETHOD( LxResult,
 ItemTypeTest) (
         LXtObjectID              self,
         LXtItemType              what,
         LXtItemType              isA);
 
         LXxMETHOD( LxResult,
 ItemTypeSuper) (
         LXtObjectID              self,
         LXtItemType              type,
         LXtItemType             *super);
 
         LXxMETHOD( LxResult,
 ItemTypeCommonChannels) (
         LXtObjectID              self,
         LXtObjectID              item1,
         LXtObjectID              item2,
         unsigned                *count);
 
         LXxMETHOD( LxResult,
 ItemSubTypeCount) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int            *count);
 
         LXxMETHOD( LxResult,
 ItemSubTypeByIndex) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int             index,
         const char             **subtype);
 
         LXxMETHOD( LxResult,
 ChannelVectorSize) (
         LXtObjectID              self,
         unsigned int             mode,
         unsigned int            *size);
 
         LXxMETHOD( LxResult,
 ChannelVectorTextHints) (
         LXtObjectID              self,
         const LXtTextValueHint **hints);
 
         LXxMETHOD(  LxResult,
 SubSceneAdd) (
         LXtObjectID              self,
         LXtObjectID              scene,
         LXtObjectID              other,
         unsigned                 refItems);
 
         LXxMETHOD(  LxResult,
 SubSceneLoad) (
         LXtObjectID              self,
         LXtObjectID              scene,
         const char              *path,
         LXtObjectID              monitor,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 Import) (
         LXtObjectID              self,
         LXtObjectID              scene,
         const char              *path,
         LXtObjectID              monitor);
 
         LXxMETHOD(  LxResult,
 WorldTransform) (
         LXtObjectID              self,
         LXtObjectID              locator,
         double                   time,
         LXtMatrix                xfrm,
         LXtVector                pos);
 
         LXxMETHOD(  LxResult,
 GetTransformItem) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtTransformType         type,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 AddTransformItem) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtTransformType         type,
         void                   **ppvObj,
         unsigned                *index);
 
         LXxMETHOD(  LxResult,
 SetTransformVector) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtObjectID              chanWrite,
         LXtTransformType         type,
         LXtVector                value);
 
         LXxMETHOD(  LxResult,
 AddPreTransformItem) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtObjectID              chanWrite,
         LXtTransformType         type,
         LXtVector                value,
         void                   **ppvObj,
         unsigned                *index);
 
         LXxMETHOD(  LxResult,
 AddPostTransformItem) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtObjectID              chanWrite,
         LXtTransformType         type,
         LXtVector                value,
         void                   **ppvObj,
         unsigned                *index);
 
         LXxMETHOD(  LxResult,
 GetMeshInstSourceItem) (
         LXtObjectID              self,
         LXtObjectID              inst,
         void                   **ppvObj);
 
         LXxMETHOD(  int,
 MeshInstanceCount) (
         LXtObjectID              self,
         LXtObjectID              mesh);
 
         LXxMETHOD(  LxResult,
 MeshInstanceByIndex) (
         LXtObjectID              self,
         LXtObjectID              mesh,
         int                      index,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 SetTarget) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtObjectID              target,
         void                    **ppvObj);
 
         LXxMETHOD(  LxResult,
 PrependTransformItem) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtObjectID              chanWrite,
         LXtTransformType         type,
         LXtVector                value,
         void                   **ppvObj,
         unsigned                *index);
 
         LXxMETHOD(  LxResult,
 AppendTransformItem) (
         LXtObjectID              self,
         LXtObjectID              locator,
         LXtObjectID              chanWrite,
         LXtTransformType         type,
         LXtVector                value,
         void                   **ppvObj,
         unsigned                *index);

ILxScene

Scenes can contain sub-scenes, as mentioned above, as well as items.

(35) SDK: Declarations
 #define LXu_SCENE               "FF870F44-FED9-4dbc-95BA-2972A43FC936"
 #define LXa_SCENE               "scene2"

Scenes also support data tags though an ILxStringTag interface.

Localized scene object can be intialized from an item.

(36) User Class: Scene method
         bool
 from (
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         clear ();
         if (LXx_FAIL (item.Context (&obj)))
                 return false;
 
         return take (obj);
 }
 
 CLxUser_Scene (
         CLxLoc_Item             &item)
 {
         CLxUser_Scene ();
         from (item);
 }

(37) PY: Scene method
 def from_item(self, item):
     """Set the scene wrapper from an item: scene.from_item(item)
     """
     self.set(item.Context())

Basic Properties

Scenes can be set to represent a particular item type. This is done either on creation or during loading and cannot be subsequently changed. For example, a scene that represents a 3d object will have an item type of "mesh", a scene storing an image file will have an item type of "clip" etc. This function returns the root item type that the scene represents or zero if there is no specific type.

(38) SDK: ILxScene interface
         LXxMETHOD(  LXtItemType,
 ItemRootType) (
         LXtObjectID              self);

This returns the filename of the scene. The path is system-specific. This will return LXe_FALSE if the scene is unnamed, LXe_OK otherwise.

(39) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 Filename) (
         LXtObjectID              self,
         const char             **filename);

This method returns a human readable version of the filename suitable for display in the UI. The SHORT flag removes the file type extension, and STAR adds an asterisk for changed cinemas.

(40) SDK: Declarations

(41) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 FriendlyFilename) (
         LXtObjectID              self,
         unsigned                 flags,
         const char             **filename);

This returns the file format of the scene, which determines how the scene will be saved.

(42) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 FileFormat) (
         LXtObjectID              self,
         const char             **format);

Pass in 1 to indicate that the scene has been modified, and 0 to reset the state back to unchanged.

(43) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 Changed) (
         LXtObjectID              self,
         unsigned                 changed);

This returns LXe_TRUE if the scene has changed, and LXe_FALSE if it has not. It can also provide the number of changes since the last reset.

(44) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 HasChanged) (
         LXtObjectID              self,
         unsigned int            *numChanges);

Parenting, Enumeration and Sub-Scenes

This method returns the parent ILxScene, or LXe_NOTFOUND if this is the root scene, Thus this method can also be used to test if this scene is the root scene.

(45) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 Parent) (
         LXtObjectID              self,
         void                   **ppvObj);

These methods allow the scene's sub-scenes to be enumerated. The type argument can be used to filter the list by root type, or can be -1 to list all scenes.

(46) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 SubSceneCount) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int            *count);
 
         LXxMETHOD(  LxResult,
 SubSceneByIndex) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int             index,
         void                   **ppvObj);

Sub-scenes can be added by either loading them from disk or by adding an existing scene as a child.

Scene target flags ( LXf_SCENETARG_ ) set by the loader can be read with this method.

(47) SDK: ILxScene interface
         LXxMETHOD(  unsigned,
 LoadFlags) (
         LXtObjectID              self);

Actions

This function can allocate a channel I/O object presenting ILxChannelRead and ILxChannelWrite interfaces. The name indicates the name of the action to use, and a null name will evaluate final channels. The time specifies when values will be read, set or evaluated.

(48) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 Channels) (
         LXtObjectID              self,
         const char              *name,
         double                   time,
         void                   **ppvObj);

Easier versions to interface with other user classes.

(49) User Class: Scene method
         bool
 GetChannels (
         CLxLoc_ChannelRead      &chan,
         double                   time) const
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Channels (0, time, &obj))) return false;
         return chan.take (obj);
 }
 
         bool
 GetChannels (
         CLxLoc_ChannelRead      &chan,
         const char              *name,
         double                   time = 0.0) const
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Channels (name, time, &obj))) return false;
         return chan.take (obj);
 }
 
         bool
 GetSetupChannels (
         CLxLoc_ChannelRead      &chan) const
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (SetupChannels (&obj))) {
                 return false;
         }
         else {
                 return chan.take (obj);
         }
 }
 
         bool
 SetChannels (
         CLxLoc_ChannelWrite     &chan,
         const char              *name,
         double                   time = 0.0)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Channels (name, time, &obj))) return false;
         return chan.take (obj);
 }

Items

The most notable attribute of scenes is that they contain items. The item list can be enumerated with these methods. Items themselves are represented as ILxItemIDs.

(50) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemCount) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int            *count);
 
         LXxMETHOD(  LxResult,
 ItemByIndex) (
         LXtObjectID              self,
         LXtItemType              type,
         unsigned int             index,
         void                   **ppvObj);

(51) User Class: Scene method
         int
 NItems (
         LXtItemType              type)
 {
         unsigned                 n;
 
         if (LXx_OK (ItemCount (type, &n)))
                 return n;
         else
                 return -1;
 }
 
         bool
 GetItem (
         LXtItemType              type,
         unsigned                 index,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (ItemByIndex (type, index, &obj)))
                 return false;
 
         return item.take (obj);
 }

(52) PY: Scene method
 def ItemList(self, type):
     """list of items = ItemList(type)
     """
     return [ self.ItemByIndex(type,i) for i in range(self.ItemCount(type)) ]

Items can be looked up by their ID string or by unique name.

(53) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemLookup) (
         LXtObjectID              self,
         const char              *id,
         void                   **ppvObj);

(54) User Class: Scene method
         bool
 GetItem (
         const char              *name,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (ItemLookup (name, &obj)))
                 return false;
 
         return item.take (obj);
 }

These methods allow the item list to be walked by type, irrespective of the parenting hierarchy. types is a zero-terminated array of item types.

(55) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemCountByTypes) (
         LXtObjectID              self,
         const LXtItemType       *types,
         unsigned                *count);
 
         LXxMETHOD(  LxResult,
 ItemByIndexByTypes) (
         LXtObjectID              self,
         const LXtItemType       *types,
         unsigned                 index,
         void                   **ppvObj);

(56) User Class: Scene method
         bool
 GetItem (
         LXtItemType             *types,
         unsigned                 index,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (ItemByIndexByTypes (types, index, &obj)))
                 return false;
 
         return item.take (obj);
 }

This inexpensive method returns LXe_TRUE if an item of a given type exists in the scene and returns it.

(57) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 AnyItemOfType) (
         LXtObjectID              self,
         LXtItemType              type,
         void                   **ppvObj);

(58) User Class: Scene method
         bool
 GetItem (
         LXtItemType              type,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (AnyItemOfType (type, &obj)))
                 return false;
 
         return item.take (obj);
 }

This method returns the item in the given scene which is the same as, or a reference to, the given item. If there is no reference, the method will return LXe_NOTFOUND.

(59) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemLocalize) (
         LXtObjectID              self,
         LXtObjectID              item,
         void                   **ppvObj);

Creating Items

This method creates a new item of the given type and adds it to the scene.

(60) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemAdd) (
         LXtObjectID              self,
         LXtItemType              type,
         void                   **ppvObj);

The various user methods can take item type codes, item type strings, or type strings plus a scene service to avoid the cost of the constructor which has to query the application global.

(61) User Class: Scene method
         bool
 NewItem (
         LXtItemType              type,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (ItemAdd (type, &obj)))
                 return false;
 
         return item.take (obj);
 }
 
         bool
 NewItem (
         const char              *typeName,
         CLxLoc_SceneService     &svc,
         CLxLoc_Item             &item)
 {
         LXtItemType              type;
 
         if (LXx_FAIL (svc.ItemTypeLookup (typeName, &type)))
                 return false;
 
         return NewItem (type, item);
 }
 
         bool
 NewItem (
         const char              *typeName,
         CLxLoc_Item             &item)
 {
         CLxLoc_SceneService      svc;
 
         return NewItem (typeName, svc, item);
 }

This method creates a duplicate of an existing item. Also known as an instance.

(62) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemInstance) (
         LXtObjectID              self,
         LXtObjectID              item,
         void                   **ppvObj);

This creates a new reference top an existing item in the scene. If the reference already exists, it is returned isntead.

(63) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemAddReference) (
         LXtObjectID              self,
         LXtObjectID              item,
         void                   **ppvObj);

Items

Items represent the images, meshes, cameras, lights and so on in the scene.

(64) SDK: Declarations
 #define LXa_ITEM                "item"
 #define LXu_ITEM                "7FF2D6D5-5E28-4650-93ED-89FF257F9629"

Items also have an ILxAttributes interface which is a second method for acessing their channel list. Values read are the defaults for the channels, and setting values is disabled. Items aslo have an ILxStringTag interface for getting and setting their tags.

Basic Properties

This returns the item's type.

(65) SDK: ILxItem interface
         LXxMETHOD(  LXtItemType,
 Type) (
         LXtObjectID              self);

These methods test an item against a single type or an array of types, returning LXe_TRUE if the item inherits from the tested type(s).

(66) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 TestType) (
         LXtObjectID              self,
         LXtItemType              type);
 
         LXxMETHOD(  LxResult,
 TestTypes) (
         LXtObjectID              self,
         const LXtItemType       *types);

(67) User Class: Item method
         bool
 IsA (
         LXtItemType              type)
 {
         return (TestType (type) == LXe_OK);
 }
 
         bool
 IsA (
         LXtItemType             *types)
 {
         return (TestTypes (types) == LXe_OK);
 }

This returns the unique identifier string of the item. The pointer value itself can also be used as a unique identifier (since that's rather hard to do with COM interfaces) since it will never change once item creation or loading is complete.

(68) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 Ident) (
         LXtObjectID              self,
         const char             **ident);

(69) User Class: Item method
         const char *
 IdentPtr () const
 {
         const char              *id;
 
         Ident (&id);
         return id;
 }

Given he caveat that it might change during loading, the item ident can also be used to provide operator overloads allowing items to be sorted (less-than is the standard operator used for std::map searches, for example) and tested for equivalence.

(70) User Class: Item method
         bool
 operator< (
         const CLxUser_Item      &rhs) const
 {
         return IdentPtr () < rhs.IdentPtr ();
 }
 
         bool
 operator== (
         const CLxUser_Item      &rhs) const
 {
         return IdentPtr () == rhs.IdentPtr ();
 }

This string can also be set. This should only be done during loading, where an item already has a well-define ident that already doesn't conflict with any of the others in the same scene.

(71) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 SetIdent) (
         LXtObjectID              self,
         const char              *ident);

(72) User Class: Item method
         std::string
 GetIdentity ()
 {
         std::string      identity;
         const char      *ident;
 
         if (LXx_OK (Ident (&ident))) {
                 identity = std::string(ident);
         }
 
         return identity;
 }

The item's name can be set and read with these methods. The name read this way does not contain the disambiguating suffix, so it should only be used for saving.

(73) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 Name) (
         LXtObjectID              self,
         const char             **name);
 
         LXxMETHOD(  LxResult,
 SetName) (
         LXtObjectID              self,
         const char              *name);

A unique, human-readable name can also be returned. This name is suffixed with a number if necessary, in the user's preferred format.

(74) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 UniqueName) (
         LXtObjectID              self,
         const char             **name);

(75) User Class: Item method
         void
 GetUniqueName (
         std::string             &name)
 {
         const char              *sptr;
 
         if (LXx_OK (UniqueName (&sptr)))
                 name = sptr;
 }

The number which is appended to non-unique names to make them unique is persistent. Since it's logically part of the name the user keeps in mind for the item, we would like it to be the same after saving and loading. These methods allow for that.

(76) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 UniqueIndex) (
         LXtObjectID              self,
         unsigned                *index);

(77) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 SetUniqueIndex) (
         LXtObjectID              self,
         unsigned                 index);

Parenting, Children and References

This returns the parent item, or LXe_NOTFOUND if there is no parent because this is a root item.

(78) SDK: ILxItem interface
         LXxMETHOD( LxResult,
 Parent) (
         LXtObjectID              self,
         void                    **ppvObj);

(79) User Class: Item method
         bool
 GetParent (
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Parent (&obj)))
                 return false;
 
         return item.take (obj);
 }

This can be used to set the parent item.

(80) SDK: ILxItem interface
         LXxMETHOD( LxResult,
 SetParent) (
         LXtObjectID              self,
         LXtObjectID              parent);

These methods allow the item hierarchy within the scene to be walked.

(81) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 SubCount) (
         LXtObjectID              self,
         unsigned                *count);
 
         LXxMETHOD(  LxResult,
 SubByIndex) (
         LXtObjectID              self,
         unsigned                 index,
         void                   **ppvObj);

(82) User Class: Item method
         bool
 GetSubItem (
         unsigned                 index,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (SubByIndex (index, &obj)))
                 return false;
 
         return item.take (obj);
 }

(83) PY: Item method
 def SubList(self):
     """list of sub-items = SubList()
     """
     return [ self.SubByIndex(i) for i in range(self.SubCount()) ]

This returns the item's ancestor at the root of the scene, failing with LXe_NOTFOUND if this is a root item.

(84) SDK: ILxItem interface
         LXxMETHOD( LxResult,
 Root) (
         LXtObjectID              self,
         void                    **ppvObj);

(85) User Class: Item method
         bool
 GetRoot (
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Root (&obj)))
                 return false;
 
         return item.take (obj);
 }

This method returns the scene that the item belongs to.

(86) SDK: ILxItem interface
         LXxMETHOD( LxResult,
 Context) (
         LXtObjectID              self,
         void                    **ppvObj);

(87) User Class: Item method
         bool
 GetContext (
         CLxLoc_Scene            &scene)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (Context (&obj)))
                 return false;
 
         return scene.take (obj);
 }

This returns an item from a sub-scene if this item is a reference. If this item is native to its cinema this returns LXe_FAILED.

(88) SDK: ILxItem interface
         LXxMETHOD( LxResult,
 Reference) (
         LXtObjectID              self,
         void                    **ppvObj);

This returns LXe_TRUE if the item is referenced by any other item, meaning that it is part of any other hypergraph besides the parenting one.

(89) SDK: ILxItem interface
         LXxMETHOD( LxResult,
 IsReferenced) (
         LXtObjectID              self);

The source for an item is another item of the same or similar item type which is used as a source for undefined channels of this item. This is normally set implicitly by CineItemDuplicate().

(90) SDK: ILxItem interface
         LXxMETHOD( LxResult,
 Source) (
         LXtObjectID              self,
         void                   **ppvObj);
 
         LXxMETHOD( LxResult,
 SetSource) (
         LXtObjectID              self,
         LXtObjectID              source);

Channels

Items have parameter channels, values which vary by time and other circumstances. The channel is given by an index, and it is possible to iterate through all the channels in an item. This method returns the number of channels, and the indices go from 0 to N-1. Although many channels are common for items of the same type, they may also vary by item.

(91) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelCount) (
         LXtObjectID              self,
         unsigned                *count);

This can be used to lookup the channel by name, returning its index.

(92) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelLookup) (
         LXtObjectID              self,
         const char              *name,
         unsigned                *index);

(93) User Class: Item method
         unsigned
 NChannels () const
 {
         unsigned                 count;
 
         if (LXx_OK (ChannelCount (&count)))
                 return count;
 
         return 0;
 }
 
         int
 ChannelIndex (
         const char              *name) const
 {
         unsigned                 idx;
 
         if (LXx_OK (ChannelLookup (name, &idx)))
                 return idx;
 
         return -1;
 }

This returns the internal name of the channel, suitable for lookup.

(94) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelName) (
         LXtObjectID              self,
         unsigned                 index,
         const char              **name);

(95) PY: Item method
 def ChannelList(self):
     """list of channel names = ChannelList()
     """
     return [ self.ChannelName(i) for i in range(self.ChannelCount()) ]

Types, Vectors and Packages

This method returns the channel type given by the following predefined codes. The numeric and gradient types can be keyframed. The custom channel types can be stored in the action or they can be for evaluation only.

(96) SDK: Declarations

(97) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelType) (
         LXtObjectID              self,
         unsigned                 index,
         unsigned                *type);

This method returns the vector mode for the channel, one of the LXiCHANMODE_* vector settings chosen as the channel is defined. If this is part of a vector then the component index (usually 0-2) is returned along with LXe_TRUE; otherwise, this returns LXe_FALSE.

(98) SDK: Declarations
 #define LXiCHANMODE_SCALAR       0
 #define LXiCHANMODE_XY           1
 #define LXiCHANMODE_XYZ          2
 #define LXiCHANMODE_RGB          3
 #define LXiCHANMODE_RGBA         4
 #define LXiCHANMODE_UV           5
 #define LXiCHANMODE_UVW          6

(99) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelVectorMode) (
         LXtObjectID              self,
         unsigned                 index,
         unsigned                *mode,
         unsigned                *components);

This method returns the storage type of the channel, which can be valid exo-type name for numeric and stored custom types.

(100) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelStorageType) (
         LXtObjectID              self,
         unsigned                 index,
         const char              **type);

This returns the evaluation type of a channel, which is the type of slot allocated in the eval state vector. This will return the "gradstack" exo-type for gradient channels.

(101) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelEvalType) (
         LXtObjectID              self,
         unsigned                 index,
         const char              **type);

This method returns LXe_TRUE if the channel is a gradient, and returns the input and output types indirectly as well.

(102) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelGradient) (
         LXtObjectID              self,
         unsigned                 index,
         const char             **input,
         const char             **output);

This method returns the text hints for integer channels. If there are no hints, this returns LXe_NOTAVAILABLE. This will fail if the channel is not an integer channel.

(103) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelIntHint) (
         LXtObjectID              self,
         unsigned                 index,
         const LXtTextValueHint **hints);

(104) User Class: Item method
         int
 ChannelDecode (
         unsigned                 index,
         const char              *encoded) const
 {
         CLxLoc_ValueService      valueSvc;
         int                      value;
         const LXtTextValueHint  *hints;
 
         if (  LXx_OK (ChannelIntHint (index, &hints))
           &&  LXx_OK (valueSvc.TextHintDecode (encoded, hints, &value)) )
                 return value;
 
         return -1;
 }

The package a channel belongs to can be found with this function.

(105) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelPackage) (
         LXtObjectID              self,
         unsigned                 index,
         const char             **package);

Python Channel Values

Reading channel values can be done using the Python user wrapper class. It maintains a channel_read attribute that can be used for reading channels directly on the channel item.

(106) PY: Item method
 def ReadNone(self):
     if hasattr(self, 'channel_read'):
         del self.channel_read
 
 def ReadAction(self, name=lx.symbol.s_ACTIONLAYER_EDIT, time=0.0):
     """Read channel values from named action: ReadAction(<name>, <time>)
     """
     self.ReadNone()
     self.channel_read = self.Context().Channels(name, time)
 
 def ReadSetup(self):
     """Read evaluted channel values from setup: ReadSetup()
     """
     self.ReadNone()
     self.channel_read = self.Context().SetupChannels()
 
 def ReadEvaluated(self, time=0.0):
     """Read evaluated channel values: ReadEvaluated(<time>)
     """
     self.ReadAction(None, time)

Once set, channel values can be read using the user method Value() on the channel_read object.

(107) PY: Item method
 def __getitem__(self, index):
     """Read channel values: val = item[channel]
     """
     return self.ChannelValue(index)
 
 def ChannelValue(self, index):
     """Read channel values: val = ChannelValue(channel)
     Channel can be given by name or index.
     """
     if not hasattr(self, 'channel_read'):
         raise RuntimeError('Item wrapper not set for reading')
 
     return self.channel_read.Value(self, index)

Likewise writing sets the channel_write attribute which is then used for writing.

(108) PY: Item method
 def WriteAction(self, name=lx.symbol.s_ACTIONLAYER_EDIT, time=0.0):
     """Write channel values to named action: WriteAction(<name>, <time>)
     """
     if hasattr(self, 'channel_write'):
         del self.channel_write
 
     self.channel_write = ChannelWrite(self.Context().Channels(name, time))
 
 def __setitem__(self, index, value):
     """Set channel values: item[channel] = val
     """
     return self.SetChannel(index, value)
 
 def SetChannel(self, index, value, key=False):
     """Set channel values: SetChannel(channel, value, <key>)
     Channel can be given by name or index. Set key to true to make a keyframe.
     """
     if not hasattr(self, 'channel_write'):
         raise RuntimeError('Item wrapper not set for writing')
 
     return self.channel_write.Set(self, index, value, key)

Packages

Packages can be added to items directly. When a package is added, the channels for the package are added to the item, and the local data for the package is allocated and initialized for this item. If this item already has this package, then this function does nothing.

(109) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 PackageAdd) (
         LXtObjectID              self,
         const char              *package);

A item can be tested to see if it already has the given package. This returns LXe_TRUE if the package has been added to this item.

(110) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 PackageTest) (
         LXtObjectID              self,
         const char              *package);

This returns the index of the first channel in the package. This index is item specific, as different items may have different combinations of packages applied.

(111) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 PackageStartIndex) (
         LXtObjectID              self,
         const char              *package,
         unsigned                *index);

Packages can be removed with this function.

(112) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 PackageRemove) (
         LXtObjectID              self,
         const char              *package);

Adding User Channels

New user channels can be added directly to items using the following method. This returns an ILxAddChannel interface that will are appended new channels after the channels defined for the items type and any packages.

NOTE: This only works during load, adding user channels to items in the process of loading. It doesn't currently support adding channels in any other context.

(113) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 ChannelAdd) (
         LXtObjectID              self,
         void                   **ppvObj);

Item Tags

(114) SDK: ILxItem interface
         LXxMETHOD(  const char *,
 GetTag) (
         LXtObjectID              self,
         LXtID4                   type);

(115) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 SetTag) (
         LXtObjectID              self,
         LXtID4                   type,
         const char              *tag);

More (601) Methods

This is called by the package that implements the item, indicating that its synthetic name, if it has one, should be updated.

(116) SDK: ILxItem interface
         LXxMETHOD(  void,
 InvalidateName) (
         LXtObjectID              self);

Returns LXe_TRUE if this item was part of the most recent load or import. Flags can further refine the test to just import or items being loaded currently.

(117) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 WasLoaded) (
         LXtObjectID              self,
         unsigned                 test);

(118) SDK: Declarations
 #define LXfITEMLOAD_IMPORT      0x01
 #define LXfITEMLOAD_CURRENT     0x02

Delete the item from the scene.

(119) SDK: ILxItem interface
         LXxMETHOD(  LxResult,
 Delete) (
         LXtObjectID              self);

Scene Hyper-Graphs

Hyper-graphs provide a means to create relationship graphs between any client data, e.g. parenting, and to associate a name to the graph. The convenience methods above for parenting are high level accessors for the graph.

The term "hypergraph" refers to the fact that the graph is independent of the clients data objects, and multiple graphs over the same dataset can coexist. Hypergraphs are sparse, in that they only hold the elements that have been added to them, so there is no implied "root" or master node under which all elements can be found.

Since the graphs being used here are specific to scenes, they are wrapped in an ILxSceneGraph interface.

(120) SDK: Declarations
 #define LXa_SCENEGRAPH          "scenegraph"
 #define LXu_SCENEGRAPH          "FE07D3C5-C7E4-46af-8F0A-5AB173D48445"

Scene Graph Enumeration and Lookup

This method returns a scene graph from an ILxScene by name.

(121) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 GraphLookup) (
         LXtObjectID              self,
         const char              *name,
         void                   **ppvObj);

(122) User Class: Scene method
         bool
 GetGraph (
         const char              *name,
         CLxLocalizedObject      &graph)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (GraphLookup (name, &obj)))
                 return false;
 
         return graph.take (obj);
 }

Graphs can also be initialized from scenes and items.

(123) User Class: SceneGraph method
 ''[[#C124|Common Graph user class methods]]''

(124) Common Graph user class methods
         bool
 from (
         CLxLoc_Scene            &scene,
         const char              *name)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (scene.GraphLookup (name, &obj)))
                 return false;
 
         return take (obj);
 }
 
         bool
 from (
         CLxLoc_Item             &item,
         const char              *name)
 {
         CLxLoc_Scene             scene;
         LXtObjectID              obj;
 
         if (LXx_FAIL (item.Context (&obj)))
                 return false;
 
         scene.take (obj);
         return from (scene, name);
 }

The graph list can be walked more directly as well.

(125) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 GraphCount) (
         LXtObjectID              self,
         int                     *count);
 
         LXxMETHOD(  LxResult,
 GraphByIndex) (
         LXtObjectID              self,
         unsigned                 index,
         void                   **ppvObj);

Basic Properties

This method returns the name of a graph.

(126) SDK: ILxSceneGraph interface
         LXxMETHOD(  LxResult,
 Name) (
         LXtObjectID              self,
         const char             **name);

This returns the scene that the graph belongs to.

(127) SDK: ILxSceneGraph interface
         LXxMETHOD(  LxResult,
 Context) (
         LXtObjectID              self,
         void                   **ppvObj);

Root Items

Graphs can maintain root items in a specific order. Root items are those that do not link to any other items, like items without parents. These methods access that item list by count and index, returning ILxItemID's .

(128) SDK: ILxSceneGraph interface
         LXxMETHOD(  LxResult,
 RootCount) (
         LXtObjectID              self,
         int                     *count);
 
         LXxMETHOD(  LxResult,
 RootByIndex) (
         LXtObjectID              self,
         int                      index,
         void                   **ppvObj);

The above methods are useful, but slow. Thus we have these alternate methods.

(129) SDK: ILxSceneGraph interface
         LXxMETHOD(  LxResult,
 RootFirst) (
         LXtObjectID              self,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 RootNext) (
         LXtObjectID              self,
         void                   **ppvObj);

This function will place the given root item at the given index in the sequence. It returns LXe_OK on success, and an error code for failures including if the item is not in fact a root item.

(130) SDK: ILxSceneGraph interface
         LXxMETHOD(  LxResult,
 RootSetPos) (
         LXtObjectID              self,
         LXtObjectID              item,
         int                      pos);

Since clients can directly manipulate the hypergraph links, this function should be called to remove an item from the root sequence if it's no longer a root item.

(131) SDK: ILxSceneGraph interface
         LXxMETHOD(  LxResult,
 RootRemove) (
         LXtObjectID              self,
         LXtObjectID              item);

Empty SceneGraph Python user class.

(132) PY: SceneGraph method
 pass

Specific Scene Graph Interfaces

Different graphs may have different secondary interfaces for specific behaviors. The ILxSceneGraph object can queried for these alternate interfaces.

Item Graph Interface

The item graph interface provides item-to-item linking.

(133) SDK: Declarations
 #define LXa_ITEMGRAPH           "itemgraph"
 #define LXu_ITEMGRAPH           "C34D7C65-031A-4c9d-8C01-3187D383937B"

(134) User Class: ItemGraph method
 ''[[#C124|Common Graph user class methods]]''

Links can be established between any pair of nodes provided the rules for the hypergraph allow it. This function adds a link from one node to another, and the new reference is added to the end of each node's list.

(135) SDK: ILxItemGraph interface
         LXxMETHOD( LxResult,
 AddLink) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to);

This allows new links to be added or the order of existing links to be changed. The link will take on the corresponding index in the forward and reverse lists for each node. An index value of -1 leaves the index unchanged, and a positive index out of range puts the link at the end of the list.

(136) SDK: ILxItemGraph interface
         LXxMETHOD( LxResult,
 SetLink) (
         LXtObjectID              self,
         LXtObjectID              from,
         int                      fromIndex,
         LXtObjectID              to,
         int                      toIndex);

The function removes the link between two nodes. In theory it can fail based on the rules for the graph, but in practice it generally doesn't.

(137) SDK: ILxItemGraph interface
         LXxMETHOD( LxResult,
 DeleteLink) (
         LXtObjectID              self,
         LXtObjectID              from,
         LXtObjectID              to);

Enumerating Links

For nodes which are the source or destination of links, the links can be queried by using a count/byIndex syntax. These two functions get the "forward" links -- those for which this was the "from" node.

(138) SDK: ILxItemGraph interface
         LXxMETHOD( LxResult,
 FwdCount) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *count);
 
         LXxMETHOD( LxResult,
 FwdByIndex) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                 index,
         void                   **ppvObj);

The next two functions get the "reverse" links -- those for which this was the "to" node.

(139) SDK: ILxItemGraph interface
         LXxMETHOD( LxResult,
 RevCount) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                *count);
 
         LXxMETHOD( LxResult,
 RevByIndex) (
         LXtObjectID              self,
         LXtObjectID              item,
         unsigned                 index,
         void                   **ppvObj);

(140) User Class: ItemGraph method
         unsigned
 Forward (
         CLxLoc_Item             &item)
 {
         unsigned                 n;
 
         if (LXx_FAIL (FwdCount (item, &n)))
                 n = 0;
 
         return n;
 }
 
         bool
 Forward (
         CLxLoc_Item             &item,
         unsigned                 index,
         CLxLoc_Item             &dest)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (FwdByIndex (item, index, &obj)))
                 return false;
 
         return dest.take (obj);
 }
         unsigned
 Reverse (
         CLxLoc_Item             &item)
 {
         unsigned                 n;
 
         if (LXx_FAIL (RevCount (item, &n)))
                 n = 0;
 
         return n;
 }
 
         bool
 Reverse (
         CLxLoc_Item             &item,
         unsigned                 index,
         CLxLoc_Item             &dest)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (RevByIndex (item, index, &obj)))
                 return false;
 
         return dest.take (obj);
 }

Empty ItemGraph Python user class.

(141) PY: ItemGraph method
 pass

Channel Graph Interface

The item graph interface provides item/channel-to-item/channel linking. The methods are the same as those in the item graph interface above, but take an item/channel index pair instead of just an item.

(142) SDK: Declarations
 #define LXa_CHANNELGRAPH        "channelgraph"
 #define LXu_CHANNELGRAPH        "F70C8AD7-C15F-42e7-98F6-4C4C7F6D577E"

(143) User Class: ChannelGraph method
 ''[[#C124|Common Graph user class methods]]''

(144) SDK: ILxChannelGraph interface
         LXxMETHOD( LxResult,
 AddLink) (
         LXtObjectID              self,
         LXtObjectID              from,
         int                      fromChan,
         LXtObjectID              to,
         int                      toChan);
 
         LXxMETHOD( LxResult,
 SetLink) (
         LXtObjectID              self,
         LXtObjectID              from,
         int                      fromChan,
         int                      fromIndex,
         LXtObjectID              to,
         int                      toChan,
         int                      toIndex);
 
         LXxMETHOD( LxResult,
 DeleteLink) (
         LXtObjectID              self,
         LXtObjectID              from,
         int                      fromChan,
         LXtObjectID              to,
         int                      toChan);
 
         LXxMETHOD( LxResult,
 FwdCount) (
         LXtObjectID              self,
         LXtObjectID              item,
         int                      channel,
         unsigned                *count);
 
         LXxMETHOD( LxResult,
 FwdByIndex) (
         LXtObjectID              self,
         LXtObjectID              item,
         int                      channel,
         unsigned                 index,
         void                   **ppvObj,
         int                     *objChan);
 
         LXxMETHOD( LxResult,
 RevCount) (
         LXtObjectID              self,
         LXtObjectID              item,
         int                      channel,
         unsigned                *count);
 
         LXxMETHOD( LxResult,
 RevByIndex) (
         LXtObjectID              self,
         LXtObjectID              item,
         int                      channel,
         unsigned                 index,
         void                   **ppvObj,
         int                     *objChan);

Empty ChannelGraph Python user class.

(145) PY: ChannelGraph method
 pass

More Methods (501)

501

Methods are added here since we want them at the end of the structure.

(146) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemRemove) (
         LXtObjectID              self,
         LXtObjectID              item);

Removing items using a localized item is a bit tricky, since we want to drop our reference to it before destroying it for real.

(147) User Class: Scene method
         bool
 RemItem (
         CLxLoc_Item             &item)
 {
         ILxUnknownID             unk;
 
         unk = item;
         item.clear ();
         return LXx_OK (ItemRemove (unk)) ? true : false;
 }

This loads a file into an existing scene. A monitor must be provided, and can be obtained from ILxDialogService.

(148) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 Import) (
         LXtObjectID              self,
         const char              *path,
         LXtObjectID              monitor);

Invalidate an EvalModifier with the given server name. This is done automatically for item and graph events, but can also be done manually for other changes. Out of date modifier nodes will be destroyed and new ones created, allowing nodes to change their inputs and outputs.

(149) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 EvalModInvalidate) (
         LXtObjectID              self,
         const char              *modName);

Reset the state of an eval modifier. Modifier nodes remain as they are but any cached state is invalidated.

(150) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 EvalModReset) (
         LXtObjectID              self,
         const char              *modName);

Create a new item with the specified type from passed item, replacing the original.

(151) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemReplace) (
         LXtObjectID              self,
         LXtObjectID              item,
         int                      type,
         void                   **ppvObj);

(152) User Class: Scene method
         bool
 ReplaceItem (
         CLxLoc_Item             &item,
         LXtItemType              type,
         CLxLoc_Item             &newItem)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (ItemReplace (item, type, &obj)))
                 return false;
 
         return newItem.take (obj);
 }

This returns LXe_TRUE if the scene is in "Setup Mode", and LXe_FALSE otherwise.

(153) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 SetupMode) (
         LXtObjectID              self);

Alternate version of the Channels function, which evaluates channels in Setup mode.

(154) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 SetupChannels) (
         LXtObjectID              self,
         void                   **ppvObj);

Lookup using ident only, not full name.

(155) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemLookupIdent) (
         LXtObjectID              self,
         const char              *id,
         void                   **ppvObj);

(156) User Class: Scene method
         bool
 GetItemByIdent (
         const char              *name,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (ItemLookupIdent (name, &obj)))
                 return false;
 
         return item.take (obj);
 }

(157) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemLookupImported) (
         LXtObjectID              self,
         const char              *id,
         void                   **ppvObj);

(158) User Class: Scene method
         bool
 GetImportedItem (
         const char              *name,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (ItemLookupImported (name, &obj)))
                 return false;
 
         return item.take (obj);
 }

These functions can be used to get a list of all the possible (linked) render cameras.

(159) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 RenderCameraCount) (
         LXtObjectID              self,
         int                     *count);

Note that if RenderCameraCount gives zero, feeding a value of -1 into RenderCameraByIndex will actually get the render camera (which can be any camera).

(160) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 RenderCameraByIndex) (
         LXtObjectID              self,
         int                      index,
         void                   **ppvObj);

(161) User Class: Scene method
         int
 NRenderCameras ()
 {
         int                      n;
 
         if (LXx_OK (RenderCameraCount (&n)))
                 return n;
         else
                 return 0;
 }
 
         bool
 GetRenderCameraByIndex (
         int                      index,
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_FAIL (RenderCameraByIndex (index, &obj)))
                 return false;
 
         return item.take (obj);
 }

And this function, which takes in an eval, gets the current render camera index.

(162) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 RenderCameraIndex) (
         LXtObjectID              self,
         LXtObjectID              eval,
         int                     *index);

(163) User Class: Scene method
         int
 GetRenderCameraIndex (
         CLxLoc_Evaluation        eval)
 {
         ILxEvaluationID          ev;
         int                      i;
 
         eval.get ((void **)&ev);
 
         if (LXx_OK (RenderCameraIndex ((ILxUnknownID)ev, &i)))
                 return i;
         else
                 return 0;
 }

This method creates a duplicate of an existing item.

(164) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 ItemCopy) (
         LXtObjectID              self,
         LXtObjectID              item,
         void                   **ppvObj);

801

Items can be created in batch mode, where they are created in an incomplete state which is only finalized when the batch is ended. If the copy fails the client must call the abort function.

(165) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 BatchCreateBegin) (
         LXtObjectID              self);
 
         LXxMETHOD(  LxResult,
 BatchCreateEnd) (
         LXtObjectID              self);
 
         LXxMETHOD(  LxResult,
 BatchCreateAbort) (
         LXtObjectID              self);

Likewise copying items can be done in a batch state. This also allows the client to specify a different destination scene for the copies to be created.

(166) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 BatchCopyBegin) (
         LXtObjectID              self,
         LXtObjectID              destination);
 
         LXxMETHOD(  LxResult,
 BatchCopyEnd) (
         LXtObjectID              self);
 
         LXxMETHOD(  LxResult,
 BatchCopyAbort) (
         LXtObjectID              self);

This function can be used to get the world rotation of the workplane.

(167) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 WorkPlaneRotation) (
         LXtObjectID              self,
         LXtObjectID              chanRead,
         LXtMatrix                m3);

This function can be used to get the world position of the workplane.

(168) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 WorkPlanePosition) (
         LXtObjectID              self,
         LXtObjectID              chanRead,
         LXtVector                pos);

903

These function will return a list of items matching the item list type and arguments. The returned object is an ItemCollection. Because this is normally used for UI purposes, the collection includes only items that are visible to the user and filters out items that the user shouldn't see. There is an alternate "raw" form to get the unfiltered list.

(169) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 GeneralCollection) (
         LXtObjectID              self,
         const char              *typeName,
         const char              *arg,
         LXtObjectID              rootItem,
         void                   **ppvObj);

(170) SDK: ILxScene interface
         LXxMETHOD(  LxResult,
 GeneralCollectionRaw) (
         LXtObjectID              self,
         const char              *typeName,
         const char              *arg,
         LXtObjectID              rootItem,
         void                   **ppvObj);