00001 /**************************************************************************************** 00002 00003 Copyright (C) 2012 Autodesk, Inc. 00004 All rights reserved. 00005 00006 Use of this software is subject to the terms of the Autodesk license agreement 00007 provided at the time of installation or download, or which otherwise accompanies 00008 this software in either electronic or hard copy form. 00009 00010 ****************************************************************************************/ 00011 00013 #ifndef _FBXSDK_UTILS_PROCESSOR_XREF_H_ 00014 #define _FBXSDK_UTILS_PROCESSOR_XREF_H_ 00015 00016 #include <fbxsdk/fbxsdk_def.h> 00017 00018 #include <fbxsdk/core/base/fbxmap.h> 00019 #include <fbxsdk/utils/fbxprocessor.h> 00020 00021 #include <fbxsdk/fbxsdk_nsbegin.h> 00022 00026 class FBXSDK_DLL FbxProcessorXRefCopy : public FbxProcessor 00027 { 00028 FBXSDK_OBJECT_DECLARE(FbxProcessorXRefCopy, FbxProcessor); 00029 00030 public: 00031 class FBXSDK_DLL MissingUrlHandler 00032 { 00033 public: 00034 virtual ~MissingUrlHandler(); 00035 virtual void MissingUrl(const FbxString& pUrl, const FbxProperty&) = 0; 00036 }; 00037 00042 FbxPropertyT<FbxString> OutputDirectory; 00043 00047 FbxPropertyT<FbxBool> UpdateProperties; 00048 00052 FbxPropertyT<FbxBool> TrackUpdatedProperties; 00053 00061 FbxPropertyT<FbxBool> ForceCopy; 00062 00066 FbxPropertyT<FbxBool> CopyFileTimes; 00068 00073 MissingUrlHandler* MissingUrlHandler; 00074 00079 struct PropertyUpdate 00080 { 00081 FbxProperty mProperty; 00082 FbxString mOriginalValue; 00083 00084 inline PropertyUpdate() {} 00085 inline PropertyUpdate(const FbxProperty& pProp, const FbxString& pVal) : 00086 mProperty(pProp), mOriginalValue(pVal) {} 00087 00088 inline bool operator <(const PropertyUpdate& pOther) const 00089 { 00090 return strcmp(mProperty.GetName(), pOther.mProperty.GetName()) < 0; 00091 } 00092 }; 00093 typedef FbxSet2<PropertyUpdate> UpdateSet; 00094 typedef FbxMap<FbxObject*, UpdateSet> PropertyUpdateMap; 00095 00101 PropertyUpdateMap& GetUpdatedProperties(); 00102 00106 void RevertPropertyChanges(); 00107 00111 struct FBXSDK_DLL AutoRevertPropertyChanges 00112 { 00113 AutoRevertPropertyChanges(FbxProcessorXRefCopy* pCopy) : mXRefCopy(pCopy) {} 00114 ~AutoRevertPropertyChanges() 00115 { 00116 if( mXRefCopy ) 00117 mXRefCopy->RevertPropertyChanges(); 00118 } 00119 00120 FbxProcessorXRefCopy* mXRefCopy; 00121 }; 00122 00124 // WARNING! 00125 // Anything beyond these lines may not be documented accurately and is 00126 // subject to change without notice. 00128 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00129 00130 protected: 00131 PropertyUpdateMap mUpdatedProperties; 00132 00133 // Constructor / Destructor 00134 protected: 00135 FbxProcessorXRefCopy(FbxManager& pManager, char const* pName); 00136 00137 bool ConstructProperties(bool pForceSet); 00138 00139 // Implements the rules specified for the ForceCopy property. 00140 // Also checks the ForceCopy property. 00141 bool ShouldCopyFile(const FbxString& pTarget, const FbxString& pSource) const; 00142 00146 protected: 00147 virtual bool internal_ProcessCollectionBegin (FbxCollection* pObject); 00148 virtual bool internal_ProcessCollectionEnd (FbxCollection* pObject); 00149 virtual bool internal_ProcessObject (FbxObject* pObject); 00150 bool ProcessPathProperty(FbxProperty &pProperty); 00151 virtual bool ValidPropertyForXRefCopy(FbxObject* pObject, FbxProperty& lProperty) const; 00153 00154 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 00155 00156 }; 00157 00158 #include <fbxsdk/fbxsdk_nsend.h> 00159 00160 #endif /* _FBXSDK_UTILS_PROCESSOR_XREF_H_ */