iXrefObj.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2005 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 // DESCRIPTION: Interface to xref objects
00012 // AUTHOR: Attila Szabo - created Feb.09.2005
00013 //***************************************************************************/
00014 
00015 #pragma once
00016 
00017 #include "..\object.h"
00018 #include "..\assetmanagement\AssetUser.h"
00019 
00020 // Forward declarations
00021 class IObjXRefRecord;
00022 class Animatable;
00023 
00025 /* Although this interface is still supported, it is recommended that IXRefObject8 
00026 and IXRefItem is used instead.
00027 */
00052 class IXRefObject : public Object 
00053 {
00054     public:
00055         Class_ID ClassID() {return XREFOBJ_CLASS_ID;}
00056         SClass_ID SuperClassID() {return SYSTEM_CLASS_ID;}
00057 
00058         // Initialize a new XRef object
00073         virtual void Init(const MaxSDK::AssetManagement::AssetUser &asset, const MSTR &oname, Object *ob, BOOL asProxy=FALSE)=0;
00074 
00083         virtual void SetFile(const MaxSDK::AssetManagement::AssetUser &asset, BOOL proxy=FALSE, BOOL update=TRUE)=0;
00091         virtual void SetObjName(MCHAR *name, BOOL proxy=FALSE)=0;
00099         virtual void SetUseProxy(BOOL onOff,BOOL redraw=TRUE)=0;
00104         virtual void SetRenderProxy(BOOL onOff)=0;
00109         virtual void SetUpdateMats(BOOL onOff)=0;
00117         virtual void SetIgnoreAnim(BOOL onOff,BOOL redraw=TRUE)=0;
00118         
00124         virtual const MaxSDK::AssetManagement::AssetUser& GetFile(BOOL proxy=FALSE) const =0;
00130         virtual MSTR GetObjName(BOOL proxy=FALSE) const =0;
00132         virtual const MaxSDK::AssetManagement::AssetUser& GetCurFile() const =0;
00134         virtual void SetCurFile(const MaxSDK::AssetManagement::AssetUser&)=0;
00136         virtual const MSTR &GetCurObjName() const =0;
00138         virtual void SetCurObjName(const MCHAR* name)=0;
00141         virtual BOOL GetUseProxy() =0;
00144         virtual BOOL GetRenderProxy() =0;
00147         virtual BOOL GetUpdateMats() =0;
00150         virtual BOOL GetIgnoreAnim() =0;        
00151         
00152         // Causes browse dialogs to appear
00157         virtual void BrowseObject(BOOL proxy)=0;
00162         virtual void BrowseFile(BOOL proxy)=0;
00163 
00164         // Try to reload ref
00166         virtual void ReloadXRef()=0;
00167 };
00168 
00169 
00171 #define IID_XREF_OBJECT8 Interface_ID(0x470145ad, 0x3daa64e1)
00172 
00174 
00182 // Needs to derive from the IXrefObject in order to preserve sdk backward compatibility
00183 class IXRefObject8 : public IXRefObject, public FPMixinInterface
00184 {
00185 public:
00187 
00193     virtual const MaxSDK::AssetManagement::AssetUser& GetActiveFile() const = 0;
00194     
00196 
00202     virtual const MCHAR* GetActiveObjName() const = 0;
00203 
00205 
00211     virtual IObjXRefRecord* GetActiveRecord() const = 0;
00212 
00214 
00221     virtual Object* GetSourceObject(bool resolveNested = false, Tab<Modifier*> *modifiers = NULL) const = 0;
00222 
00224 
00227     static bool Is_IXRefObject8(Animatable& animatable);
00228 
00229     using FPMixinInterface::GetInterface;
00231 
00234     static IXRefObject8* GetInterface(InterfaceServer& is) {
00235         return static_cast<IXRefObject8*>(is.GetInterface(IID_XREF_OBJECT8));
00236     };
00237 
00238     // Function publishing - todo
00239     virtual Interface_ID GetID() { return IID_XREF_OBJECT8; }
00240 
00241     enum {
00242         kfpGetActiveFileName,
00243         kfpGetActiveObjName,
00244         kfpGetActiveRecord,
00245         kfpGetSourceObject,
00246     };
00247 
00248     BEGIN_FUNCTION_MAP
00249         RO_PROP_FN(kfpGetActiveFileName, FPGetActiveFileName, TYPE_FILENAME);
00250         RO_PROP_FN(kfpGetActiveObjName, GetActiveObjName, TYPE_STRING);
00251         RO_PROP_FN(kfpGetActiveRecord, GetActiveRecord, TYPE_INTERFACE);
00252         FN_2(kfpGetSourceObject, TYPE_REFTARG, FPGetSourceObject, TYPE_bool, TYPE_REFTARG_TAB_BR);
00253     END_FUNCTION_MAP
00254 
00255     // From FPMixinInterface
00256     virtual FPInterfaceDesc* GetDesc() { return &mFPInterfaceDesc; }
00257     static FPInterfaceDesc mFPInterfaceDesc;
00258 
00259     private:
00260         virtual const MCHAR* FPGetActiveFileName() const = 0;
00261         Object* FPGetSourceObject(bool resolveNestedXRef, Tab<ReferenceTarget*> &modifiers);
00262     protected:
00263         // Deprecated methods
00264         virtual void Init(const MaxSDK::AssetManagement::AssetUser &asset, const MSTR &oname, Object *ob, BOOL asProxy=FALSE)=0;
00265         virtual void SetFile(const MaxSDK::AssetManagement::AssetUser& asset, BOOL proxy=FALSE, BOOL update=TRUE)=0;
00266         virtual void SetObjName(MCHAR *name, BOOL proxy=FALSE)=0;
00267         virtual const MaxSDK::AssetManagement::AssetUser& GetFile(BOOL proxy=FALSE) const =0;
00268         virtual MSTR GetObjName(BOOL proxy=FALSE) const =0;
00269         // Exposed by class IXrefProxy
00270         virtual void SetUseProxy(BOOL onOff,BOOL redraw=TRUE)=0;
00271         virtual void SetRenderProxy(BOOL onOff)=0;
00272         virtual BOOL GetUseProxy() =0;
00273         virtual BOOL GetRenderProxy() =0;
00274         // Replaced by IXRefObject8::Get\SetCurFileName
00275         virtual const MaxSDK::AssetManagement::AssetUser& GetCurFile() const =0;
00276         virtual const MSTR &GetCurObjName() const =0;
00277 };
00278 
00279 inline bool IXRefObject8::Is_IXRefObject8(Animatable& animatable) {
00280     return ((animatable.SuperClassID() == SYSTEM_CLASS_ID) 
00281                     && (animatable.ClassID() == XREFOBJ_CLASS_ID));
00282 }
00283