group (lx_group.hpp)

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


Group Item Interface

The GroupItem interface provices services for operating on a group. Mainly enumerating the members of the group.

(1) SDK: LXu_GROUPITEM define
 #define LXu_GROUPITEM           "47FDFD87-3FBA-41A4-8044-74EC9D9AA986"

Since the enumeration has state we have to allocate one from the item interface.

(2) SDK: GroupItem::Enumerator
         LXxMETHOD(  LxResult,
 Enumerator) (
         LXtObjectID              self,
         void                   **ppvObj);

(3) SDK: CLxUser_GroupItem::GetEnumerator method
         bool
 GetEnumerator (
         CLxLoc_GroupEnumerator  &grpEnum)
 {
         LXtObjectID              obj;
 
         if (LXx_OK (Enumerator (&obj)))
                 return grpEnum.take (obj);
 
         grpEnum.clear ();
         return false;
 }

Empty GroupItem Python user class.

(4) PY: empty GroupItem user class
 pass

The GroupEnumerator interface allows traversal of the members of the group item, both items and channels.

(5) SDK: LXu_GROUPENUMERATOR, etc. defines
 #define LXu_GROUPENUMERATOR     "CA4E1FE0-B655-429F-9674-3E1D7DEA5D04" 
 #define LXfGRPTYPE_ITEM          0x01
 #define LXfGRPTYPE_CHANNEL       0x02
 #define LXfGRPTYPE_BOTH         (LXfGRPTYPE_ITEM | LXfGRPTYPE_CHANNEL)

The Enumerate() method takes a visitor and calls its Evaluate() method for each group member. The mask is used to select items, channels or both. During each Evaluate() call, the visitor can query the type of member and get information about the member.

(6) SDK: GroupEnumerator::Enumerate, etc.
         LXxMETHOD(  LxResult,
 Enumerate) (
         LXtObjectID              self,
         LXtObjectID              visitor,
         unsigned                 mask);
 
         LXxMETHOD(  unsigned,
 Type) (
         LXtObjectID              self);
 
         LXxMETHOD(  LxResult,
 Item) (
         LXtObjectID              self,
         void                   **ppvObj);
 
         LXxMETHOD(  LxResult,
 Channel) (
         LXtObjectID              self,
         void                   **ppvObj,
         unsigned                *index);

(7) SDK: CLxUser_GroupEnumerator::Enum method
         LxResult
 Enum (
         CLxImpl_AbstractVisitor *visitor,
         unsigned                 mask = LXfGRPTYPE_BOTH)
 {
         CLxInst_OneVisitor<CLxGenericVisitor>  gv;
 
         gv.loc.vis = visitor;
         return Enumerate (gv, mask);
 }
 
         bool
 GetItem (
         CLxLoc_Item             &item)
 {
         LXtObjectID              obj;
 
         if (LXx_OK (Item (&obj)))
                 return item.take (obj);
 
         item.clear ();
         return false;
 }

Empty GroupEnumerator Python user class.

(8) PY: empty GroupEnumerator user class
 pass