iBlockRef.h

Go to the documentation of this file.
00001      /**********************************************************************
00002  
00003     FILE: IBlockRef.h
00004 
00005     DESCRIPTION:  Public intefaces that defines the concept of block references
00006 
00007     CREATED BY: Attila Szabo, Discreet
00008 
00009     HISTORY: - created Aug 06, 2002
00010 
00011  *> Copyright (c) 1998-2002, All Rights Reserved.
00012  **********************************************************************/
00013 #pragma once
00014 #include "inode.h"
00015 #include "iFnPub.h"
00016 #include "maxtypes.h"
00017 
00018 
00019 // "Block" is a generic term for one or more objects that are combined 
00020 // to create a single object. A set of combined objects stored in a block 
00021 // table are called block definitions while a block reference is the object 
00022 // that references a block definition and is inserted in the scene.
00023 
00024 // This interface models a component of a block reference
00025 class IBlockRefComponent : public FPMixinInterface 
00026 {
00027     public:
00028         // --- Operations on block components
00029         virtual const MCHAR* GetName() const = 0;
00030 
00031         // --- Block management
00032         virtual bool Add(IBlockRefComponent* component) = 0;
00033         virtual bool Remove(IBlockRefComponent* component) = 0;
00034         virtual unsigned long NumComponents() const = 0;
00035         virtual unsigned long GetComponents(Tab<IBlockRefComponent*>& components) const = 0;
00036         virtual void ExpandSelection(Tab<INode*>& nodesToSelect) const = 0;
00037         // Returns true if an instance of this block component needs a selection 
00038     // box displayed around it when selected. Otherwise returns false
00039         virtual bool IsSelectionBoxNeeded() const = 0;
00040         
00041         // --- Block data I/O 
00042         virtual IOResult Save(ISave* isave) const = 0;
00043         virtual IOResult Load(ILoad* iload) = 0;
00044 }; 
00045 
00046 
00047 // Interface ID
00048 #define BLOCKREF_COMPONENT_INTERFACE Interface_ID(0x7f1f2104, 0x7ab7322b)
00049 #define ADD_BLOCKREF_COMPONENT_INTERFACE Interface_ID(0x4c794c3a, 0x3a693dbb)
00050 #define REMOVE_BLOCKREF_COMPONENT_INTERFACE Interface_ID(0x379c7c13, 0x47a32e07)
00051 
00052 // Utilities:
00053 // Client code has to make nodes either block components.
00054 // This is accomplished by calling IBlockMgr::MakeBlockRefComponent on a node instance.
00055 
00056 inline IBlockRefComponent* GetBlockRefComponent(INode& n) 
00057 {
00058     return static_cast<IBlockRefComponent*>(n.GetInterface(BLOCKREF_COMPONENT_INTERFACE)); 
00059 }
00060 
00061