INodeExposure.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  
00003     FILE: INodeExposure.h
00004 
00005     DESCRIPTION:  Public interface for determining if a node should be
00006                     exposed in misc. UIs (SelectObjects, TrackView etc).
00007 
00008     CREATED BY: Oleg Bayborodin
00009 
00010     HISTORY: - created March 21, 2002
00011 
00012  *> Copyright (c) 1998-2002, All Rights Reserved.
00013  **********************************************************************/
00014 
00015 #pragma once
00016 
00017 #include "iFnPub.h"
00018 #include "maxtypes.h"
00019 #include "inode.h"
00020 
00021 #define NODEEXPOSURE_INTERFACE Interface_ID(0x1b00412c, 0x6ebf48f2)
00022 #define NODEEXPOSURE_INTERFACE_TOAPPEND Interface_ID(0x1b00412c, 0x6ebf48f3)
00023 
00024 
00051 class INodeExposure : public FPMixinInterface {
00052 public:
00053 
00054 enum {  
00055         kSelectObjects, kSchematicView,     kMaxscript,
00056         kMerge,         kMergeAnimation,    kReplace, 
00057         kKeyEditor,     kCurveEditor,       kRangeEditor, // three components for TrackView editors
00058         kUI_num // always last in the enum
00059     };
00060 
00061     // Utilities:
00062     static INodeExposure* GetINodeExposure(INode& n) {
00063         return static_cast<INodeExposure*>(n.GetInterface(NODEEXPOSURE_INTERFACE)); }
00064 
00065     static INodeExposure* AppendINodeExposure(INode& n) {
00066         return static_cast<INodeExposure*>(n.GetInterface(NODEEXPOSURE_INTERFACE_TOAPPEND)); }
00067 
00068     // exposure in a specific UI
00077     virtual bool IsExposed(int ui) const =0;
00078     // set exposure in all UIs
00086     virtual void SetExposed(bool state) =0;
00087     // set exposure in a specific UI
00096     virtual void SetExposed(bool state, int ui) =0;
00097 
00098     // Derived methods. They are all inline'd at the end of the file.
00102     bool IsExposedInSelectObjects() const;
00103     bool IsExposedInSchematicView() const;
00104     bool IsExposedInMaxscript() const;
00105     bool IsExposedInMerge() const;
00106     bool IsExposedInMergeAnimation() const;
00107     bool IsExposedInReplace() const;
00113     bool IsExposedInTrackView() const;
00116     bool IsExposedInKeyEditor() const;
00119     bool IsExposedInCurveEditor() const;
00122     bool IsExposedInRangeEditor() const;
00130     void SetExposedInSelectObjects(bool state);
00131     void SetExposedInSchematicView(bool state);
00132     void SetExposedInMaxscript(bool state);
00133     void SetExposedInMerge(bool state);
00134     void SetExposedInMergeAnimation(bool state);
00135     void SetExposedInReplace(bool state);
00140     void SetExposedInTrackView(bool state);
00144     void SetExposedInKeyEditor(bool state);
00148     void SetExposedInCurveEditor(bool state);
00151     void SetExposedInRangeEditor(bool state);
00152     
00153     virtual IOResult    Save(ISave*) const =0;
00154     virtual IOResult    Load(ILoad*) =0;
00155     virtual void        Copy(INodeExposure*) =0;
00156 
00157     // makes exposure parameters to be permanent (not mutable)
00158     virtual void BakeExposure() =0;
00159     // defines if exposure is baked
00160     virtual bool IsExposureBaked() =0;
00161 
00162     // Used by implementation class:
00163     virtual const void* ObjectOf(void*) const =0;
00164     virtual       void* ObjectOf(void*) =0;
00165 
00166     // Due to FPMixinInterface:
00167     FPInterfaceDesc* GetDesc() { return GetDescByID(NODEEXPOSURE_INTERFACE); }
00168 
00169     // Function publishings:
00170     //
00171     enum FuncID {
00172         kIsExposed, kSetExposedInAll, kSetExposed, kBakeExposure
00173     };
00174 
00175 BEGIN_FUNCTION_MAP
00176     FN_1(kIsExposed,    TYPE_bool,  IsExposed,  TYPE_INT);
00177     VFN_1(kSetExposedInAll,         SetExposed, TYPE_bool);
00178     VFN_2(kSetExposed,              SetExposed, TYPE_bool, TYPE_INT);
00179     VFN_0(kBakeExposure,            BakeExposure );
00180 END_FUNCTION_MAP
00181 
00182 };
00183 
00184 // inlines for derived methods
00185 //
00186 inline bool INodeExposure::IsExposedInSelectObjects() const
00187 {
00188     return IsExposed(kSelectObjects);
00189 }
00190 
00191 inline bool INodeExposure::IsExposedInSchematicView() const
00192 {
00193     return IsExposed(kSchematicView);
00194 }
00195 
00196 inline bool INodeExposure::IsExposedInMaxscript() const
00197 {
00198     return IsExposed(kMaxscript);
00199 }
00200 
00201 inline bool INodeExposure::IsExposedInMerge() const
00202 {
00203     return IsExposed(kMerge);
00204 }
00205 
00206 inline bool INodeExposure::IsExposedInMergeAnimation() const
00207 {
00208     return IsExposed(kMergeAnimation);
00209 }
00210 
00211 inline bool INodeExposure::IsExposedInReplace() const
00212 {
00213     return IsExposed(kReplace);
00214 }
00215 
00216 inline bool INodeExposure::IsExposedInTrackView() const
00217 {
00218     return (IsExposed(kKeyEditor) || IsExposed(kCurveEditor) || IsExposed(kRangeEditor));
00219 }
00220 
00221 inline bool INodeExposure::IsExposedInKeyEditor() const
00222 {
00223     return IsExposed(kKeyEditor);
00224 }
00225 
00226 inline bool INodeExposure::IsExposedInCurveEditor() const
00227 {
00228     return IsExposed(kCurveEditor);
00229 }
00230 
00231 inline bool INodeExposure::IsExposedInRangeEditor() const
00232 {
00233     return IsExposed(kRangeEditor);
00234 }
00235 
00236 inline void INodeExposure::SetExposedInSelectObjects(bool state)
00237 {
00238     SetExposed(state, kSelectObjects);
00239 }
00240 
00241 inline void INodeExposure::SetExposedInSchematicView(bool state)
00242 {
00243     SetExposed(state, kSchematicView);
00244 }
00245 
00246 inline void INodeExposure::SetExposedInMaxscript(bool state)
00247 {
00248     SetExposed(state, kMaxscript);
00249 }
00250 
00251 inline void INodeExposure::SetExposedInMerge(bool state)
00252 {
00253     SetExposed(state, kMerge);
00254 }
00255 
00256 inline void INodeExposure::SetExposedInMergeAnimation(bool state)
00257 {
00258     SetExposed(state, kMergeAnimation);
00259 }
00260 
00261 inline void INodeExposure::SetExposedInReplace(bool state)
00262 {
00263     SetExposed(state, kReplace);
00264 }
00265 
00266 inline void INodeExposure::SetExposedInTrackView(bool state)
00267 {
00268     SetExposed(state, kKeyEditor);
00269     SetExposed(state, kCurveEditor);
00270     SetExposed(state, kRangeEditor);
00271 }
00272 
00273 inline void INodeExposure::SetExposedInKeyEditor(bool state)
00274 {
00275     SetExposed(state, kKeyEditor);
00276 }
00277 
00278 inline void INodeExposure::SetExposedInCurveEditor(bool state)
00279 {
00280     SetExposed(state, kCurveEditor);
00281 }
00282 
00283 inline void INodeExposure::SetExposedInRangeEditor(bool state)
00284 {
00285     SetExposed(state, kRangeEditor);
00286 }
00287 
00288 
00289