Public Member Functions

IGraphObjectManager Class Reference

This reference page is linked to from the following overview topics: Schematic View API, Schematic View Events, Schematic View Relationships.


Search for all occurrences

Detailed Description

Represents an instance of a schematic view window and provides methods for adding nodes and node pointers, refreshing the schematic view, accessing filter bits and updating and controlling the various editors within 3ds Max in ways that are not surfaced in the general interface.

See also:
IGraphNode, IGraphRef, Animatable

#include <svcore.h>

Inheritance diagram for IGraphObjectManager:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void  PushLevel (Animatable *anim, int id=SV_NO_ID)=0
  Push a level onto the animatable ownership stack.
virtual void  PopLevel ()=0
  Pops a level off the animatable ownership stack.
virtual SvGraphNodeReference  AddAnimatable (Animatable *anim, Animatable *owner, int id, DWORD flags=0)=0
  Adds an Animatable to the schematic view.
virtual IGraphRef AddReference (IGraphNode *maker, IGraphNode *target, SvReferenceType type)=0
  This method adds a reference from the specified "maker" node to the specified "target" node.
virtual IGraphRef AddRelationship (IGraphNode *maker, Animatable *anim, int id, SvRelationshipType type)=0
  This method adds a relationship from the specified "maker" node to the specified "target" node.
virtual void  SvEditSelectedNodeProperties ()=0
  Pops up the property editor dialog on the selected nodes in the schematic view.
virtual void  SvSelectInMaterialEditor (IGraphNode *gNode)=0
  Selects the given node in the material editor.
virtual void  SvSetCurEditObject (IGraphNode *gNode)=0
  Selects the given node in the modifier panel.
virtual bool  SvIsCurEditObject (IGraphNode *gNode)=0
  Returns true if the given node is current in the modifier panel.
virtual bool  ApplyModifier (IGraphNode *gModNode, IGraphNode *gParentNode)=0
virtual bool  DeleteModifier (IGraphNode *gNode)=0
virtual bool  ApplyController (IGraphNode *gSrcNode, IGraphNode *gDestNode)=0
  Invokes the copy/instance controller dialog within schematic view.
virtual void  SvInvalidateView ()=0
  Invalidates the schematic view window.
virtual void  SvInvalidateNode (IGraphNode *gNode)=0
  Invalidates a node in the schematic view window.
virtual void  SvUpdateMaterialEditor ()=0
  Forces the material editor to update.
virtual void  SvUpdateModifierPanel ()=0
  Forces the modifier panel to update.
virtual void  SetFilter (DWORD mask)=0
  Sets the specified filter bits.
virtual void  ClearFilter (DWORD mask)=0
  Clears the specified filter bits.
virtual bool  TestFilter (DWORD mask)=0
  Tets the specified filter bits.
virtual COLORREF  SvGetUIColor (int colorIndex)=0
  Get a SV UI color given a color index.
virtual HWND  GetHWnd ()=0
  Get HWnd for Schematic View window.

Member Function Documentation

virtual void PushLevel ( Animatable anim,
int  id = SV_NO_ID 
) [pure virtual]

Push a level onto the animatable ownership stack.

During traversal of the Animatable graph via SvTraverseAnimGraph(), this method (along with PopLevel()) should be called appropriately to maintain an ownership stack. This is required by the schematic view when nodes are added to the graph with the SV_DUPLICATE_INSTANCES flag set. Note: In 3ds Max 3.0, SV_DUPLICATE_INSTANCES is always on (i.e., the flag is ignored). Because of this, PushLevel() and PopLevel() should always be called in SvTraverseAnimGraph(). See the sample code in Animatable::SvStdTraverseAnimGraph() for an example of this.

Parameters:
anim This is the Animatable that you are, in all likelihood, about to add to the graph via the AddAnimatable() call.
id (default to SV_NO_ID) This is also the same "id" you'd pass into AddAnimatable(). The "id" is only required in cases where it's impossible for the schematic view to distinguish between two (or more) children in the tree that have the same Animatable but represent different sub-anims. For example, a box has both its width and height set to the same controller (instanced). In the schematic view, this is still shown in tree form so we need the ID to distinguish between the "width" and "height" children.
virtual void PopLevel ( ) [pure virtual]

Pops a level off the animatable ownership stack.

See also:
PushLevel()
virtual SvGraphNodeReference AddAnimatable ( Animatable anim,
Animatable owner,
int  id,
DWORD  flags = 0 
) [pure virtual]

Adds an Animatable to the schematic view.

Note that "owner" and "id" are actually arbitrary - they are used to provide context for this Animatable. This means that the plug-in developer can set them to any value. They are not used internally by the schematic view except in the "Sv*" methods (which the developer can override). So, when you add an Animatable to the schematic view, you would typically add the owner (parent) Animatable as well as the sub-anim id. This allows you to, for example, easily return the name of the object when queried by the SvGetName() call (whose default implementation is shown below):

    MSTR Animatable::SvGetName(IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited)
    {
        Animatable *owner;
        int subNum;
        MSTR name;
        owner = gNode->GetOwner();
        subNum = gNode->GetID();
        name = owner->SubAnimName(subNum);
    
        return name;
    }
Parameters:
anim Points to the animatable to add.
owner Points to the owner of "anim" above (typically).
id When nodes are added to the schematic view via this method this integer is provided. This value is not used internally by the schematic view. Rather, it is available to implementers of the Animatable::Sv*() methods to aid in identifying the node.
flags This flag is some combination of the bit flags in Flags for AddAnimatable() and SvTravereseAnimGraph()
Returns:
A SvGraphNodeReference object.
virtual IGraphRef* AddReference ( IGraphNode maker,
IGraphNode target,
SvReferenceType  type 
) [pure virtual]

This method adds a reference from the specified "maker" node to the specified "target" node.

Parameters:
maker Points to the 'maker' node in schematic view.
target Points to the 'target' node in schematic view.
type One of the following enum values:
  • REFTYPE_CHILD
  • REFTYPE_SUBANIM
  • REFTYPE_PLUGIN
Returns:
A pointer to an IGraphRef object.
Sample Code:
    SvGraphNodeReference Control::SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags)
    {
        int i;
        SvGraphNodeReference nodeRef;
        SvGraphNodeReference childNodeRef;
    
    //
    // Test filter to see if "Controllers" are active.
    // Bail out if they're off (being filtered out)...
    //
        if (!gom->TestFilter(SV_FILTER_CONTROLLERS))
            return SvGraphNodeReference();
    
    //
    // Push this level in the tree. Note that the sub-anim id is passed
    // in here because it's possible that the same instance of this control
    // may exist in multiple tracks of "owner".
    //
        gom->PushLevel(this, id);
    
    //
    // Some flags are set here pertaining to the control being added.
    // Note that the flags are also propagated down the tree
    // by passing them on to SubAnim(i)->SvTraverseAnimGraph(gom, this, i, flags);
    // SV_DUPLICATE_INSTANCES tells the schematic view not to
    // represent multiple instances with a single node. Instead they
    // are represented by multiple nodes in the schematic view
    // with the "triangle thingy" attached to the side to indicate
    // shared instances. This flag is ignored in R3 because
    // this mode of operation is globally enabled
    // SV_INITIALLY_HIDDEN tells the schematic view that this
    // control's node is to be initially displayed in the closed state.
    // Note that this has no effect if the node already exists
    // in the graph -- it only applies to newly added nodes.
    //
        flags |= SV_DUPLICATE_INSTANCES | SV_INITIALLY_HIDDEN;
    
    //
    // The control is added to the schematic view...
    //
        nodeRef = gom->AddAnimatable(this, owner, id, flags);
        if (nodeRef.stat == SVT_PROCEED) {
    //
    // This control's sub-anims are iterated over...
    //
            for (i = 0; i < NumSubs(); i++) {
                if (SubAnim(i)) {
    //
    // SvTraverseAnimGraph() is recursively called to add this sub-anim (and all its descendants) to the graph...
    //
                    childNodeRef = SubAnim(i)->SvTraverseAnimGraph(gom, this, i, flags);
    
    //
    // Now a link (node pointer) is created in the schematic between the control (nodeRef.gNode) and its child sub-anim (childNodeRef.gNode)....
    //
                    if (childNodeRef.stat != SVT_DO_NOT_PROCEED)
                        gom->AddReference(nodeRef.gNode, childNodeRef.gNode, REFTYPE_SUBANIM);
                }
            }
        }
    
    //
    // The tree level is popped. Note: a PopLevel() call must always be paired with a PushLevel() call!
    //
        gom->PopLevel();
    
        return nodeRef;
    }
virtual IGraphRef* AddRelationship ( IGraphNode maker,
Animatable anim,
int  id,
SvRelationshipType  type 
) [pure virtual]

This method adds a relationship from the specified "maker" node to the specified "target" node.

Parameters:
maker Points to the 'maker' node in schematic view.
target Points to the 'target' node in schematic view.
id An arbitrary ID that the Animatable can use later to identify itself.
type the type of the relationship
Returns:
A pointer to an IGraphRef object.
virtual void SvEditSelectedNodeProperties ( ) [pure virtual]

Pops up the property editor dialog on the selected nodes in the schematic view.

virtual void SvSelectInMaterialEditor ( IGraphNode gNode ) [pure virtual]

Selects the given node in the material editor.

Does nothing if "gNode" does not represent a material or map.

Parameters:
gNode Points to the node in schematic view.
virtual void SvSetCurEditObject ( IGraphNode gNode ) [pure virtual]

Selects the given node in the modifier panel.

Does nothing if "gNode" does not represent an object.

Parameters:
gNode Points to the node in schematic view.
virtual bool SvIsCurEditObject ( IGraphNode gNode ) [pure virtual]

Returns true if the given node is current in the modifier panel.

virtual bool ApplyModifier ( IGraphNode gModNode,
IGraphNode gParentNode 
) [pure virtual]
virtual bool DeleteModifier ( IGraphNode gNode ) [pure virtual]
virtual bool ApplyController ( IGraphNode gSrcNode,
IGraphNode gDestNode 
) [pure virtual]

Invokes the copy/instance controller dialog within schematic view.

The controller referenced by gSrcNode will be either copied or instanced into gDestNode. This is typically called from within a link callback:

    bool myControl::SvLinkChild(IGraphObjectManager *gom, IGraphNode *gNodeThis, IGraphNode *gNodeChild)
    {
        if( SvCanConcludeLink( gom, gNodeThis, gNodeChild ) )
            return gom->ApplyController(gNodeChild, gNodeThis);

        return false;
    }
Parameters:
gSrcNode The node that supplies the Matrix3 controller to apply.
gDestNode The node to apply the controller to.
Returns:
true if the controller is successfully applied, false if not.
virtual void SvInvalidateView ( ) [pure virtual]

Invalidates the schematic view window.

virtual void SvInvalidateNode ( IGraphNode gNode ) [pure virtual]

Invalidates a node in the schematic view window.

Parameters:
gNode - Points to the node in schematic view.
virtual void SvUpdateMaterialEditor ( ) [pure virtual]

Forces the material editor to update.

virtual void SvUpdateModifierPanel ( ) [pure virtual]

Forces the modifier panel to update.

virtual void SetFilter ( DWORD  mask ) [pure virtual]

Sets the specified filter bits.

Parameters:
mask See Schematic View Filter bits
virtual void ClearFilter ( DWORD  mask ) [pure virtual]

Clears the specified filter bits.

Parameters:
mask See Schematic View Filter bits
virtual bool TestFilter ( DWORD  mask ) [pure virtual]

Tets the specified filter bits.

Returns true if set; otherwise false.

Parameters:
mask See Schematic View Filter bits
virtual COLORREF SvGetUIColor ( int  colorIndex ) [pure virtual]

Get a SV UI color given a color index.

virtual HWND GetHWnd ( ) [pure virtual]

Get HWnd for Schematic View window.


IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager
IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager IGraphObjectManager