IMetaData.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2007 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 /**************************************************************************
00011     FILE: IMetaData.h
00012 
00013     DESCRIPTION: Declares a public header for a function publish interface
00014         for creating and managing meta-data.
00015                     - interface ID
00016                     - FP command ID's
00017                     - Static FP interface declaration
00018 
00019     AUTHOR: leonarni - created 29-AUG-2007
00020 /***************************************************************************/
00021 
00022 #pragma once
00023 
00024 #include "iFnPub.h"
00025 #include "iparamb2.h"       // PB2Value
00026 #include "GetCOREInterface.h"
00027 // forward declarations
00028 class CustAttrib;
00029 
00031 #define IID_METADA_MANAGER Interface_ID(0xdcdd1738, 0x15ee4791)
00032 
00034 
00040 class IMetaDataManager : public FPStaticInterface 
00041 {
00042 public:
00043 
00044     typedef Class_ID MetaDataID;
00045 
00046     enum ControlAlign
00047     {
00048         eAlignLeft,
00049         eAlignCenter,
00050         eAlignRight
00051     };
00052     
00054 
00063     struct ParamDescriptor
00064     {
00065         ParamDescriptor():
00066             m_name(NULL),
00067             m_ctrlLabel(NULL),
00068             m_dataType(TYPE_STRING),
00069             m_ctrlType(TYPE_EDITBOX),
00070             m_width(-1),
00071             m_height(-1),
00072             m_offset(0, 0),
00073             m_ctrlAlign(eAlignCenter),
00074             m_sliderHorizontal(true),
00075             m_sliderTicks(0),
00076             m_labelOnTop(false),
00077             m_highlightColor(0.99f, 0.86f, 0.03f)
00078         {
00079         }
00080 
00081         MCHAR*      m_name;         // parameter name
00082         ParamType2  m_dataType;     // parameter data type
00083         PB2Value    m_defValue;     // default value
00084 
00085         // unused for now
00086         ULONGLONG   m_flags;        // per-parameter constructor flags (P_ANIMATABLE, P_TRANSIENT, etc.)
00087 
00088         // Optional fields (for integer or float parameters)
00089         PB2Value    m_rangeLow;     // low range value
00090         PB2Value    m_rangeHigh;    // high range value
00091 
00092         // UI
00093         ControlType2 m_ctrlType;    // Type of UI control
00094         MCHAR*      m_ctrlLabel;    // Control label
00095         int         m_width;
00096         int         m_height;
00097         IPoint2     m_offset;       // x and y offset in pixels, for fine-tuning control placement
00098         ControlAlign m_ctrlAlign;   
00099 
00100         bool        m_sliderHorizontal; // If not, vertical.
00101         int         m_sliderTicks;      // The number of ticks drawn along the slider
00102         bool        m_labelOnTop;       // For editboxes
00103         Color       m_highlightColor;   // For checkbutton booleans; color components between 0.0f and 1.0f
00104     };
00105 
00107 
00119     virtual MetaDataID CreateMetaDataDefinition
00120         (
00121             MCHAR*          in_custAttribSetName,
00122             MCHAR*          in_rollOutName,
00123             const Tab<ParamDescriptor>& in_paramDefs,
00124             MSTR*           out_errMsg = NULL
00125         ) = 0;
00126 
00128 
00134     virtual CustAttrib* AddMetaDataToAnimatable
00135         (
00136             const MetaDataID&   in_metaDataID,  
00137             Animatable&         in_animatable,
00138             int                 in_rank = -1            // default -1 means append
00139         ) = 0;
00140 
00142 
00149     virtual void AddMetaDataToAnimatables
00150         (
00151             const MetaDataID&       in_metaDataID,  
00152             const Tab<Animatable*>& in_animatables,
00153             Tab<CustAttrib*>&       out_metaData,
00154             bool    in_shared = false,
00155             int     in_rank = -1            // default -1 means append
00156         ) = 0;
00157 
00159 
00164     virtual bool RemoveMetaDataFromAnimatable
00165         (
00166             const MetaDataID&   in_metaDataID,  
00167             Animatable& in_animatable
00168         ) = 0;
00169 
00171     virtual int MetaDataCount() const = 0;
00172 
00174 
00178     virtual void GetAllMetaDataOwners(const MetaDataID& in_ID, Tab<Animatable*>& out_owners) = 0;
00179 
00181 
00185     virtual bool IsMetaDataDefined(const MetaDataID& in_ID) const = 0 ;
00186 
00188 
00193     virtual CustAttrib* GetMetaData(Animatable& in_animatable, const MetaDataID& in_ID) const = 0;
00194 
00196 
00200     virtual void GetAllMetaData(Animatable& in_animatable, Tab<CustAttrib*>& out_metaData) const = 0;
00201 
00202     static IMetaDataManager* GetInstance() {
00203         return static_cast<IMetaDataManager*>(GetCOREInterface(IID_METADA_MANAGER)); 
00204     }
00205 };
00206 
00207 static const IMetaDataManager::MetaDataID& EmptyMetaDataID = Class_ID(0x00000000, 0x00000000);
00208 
00209 
00210 // EOF