00001 /**************************************************************************************** 00002 00003 Copyright (C) 2013 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 00123 /***************************************************************************************************************************** 00124 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** 00125 *****************************************************************************************************************************/ 00126 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00127 protected: 00128 virtual void Construct(const FbxProcessorXRefCopy* pFrom); 00129 virtual void ConstructProperties(bool pForceSet); 00130 00131 PropertyUpdateMap mUpdatedProperties; 00132 00133 // Implements the rules specified for the ForceCopy property. 00134 // Also checks the ForceCopy property. 00135 bool ShouldCopyFile(const FbxString& pTarget, const FbxString& pSource) const; 00136 00137 virtual bool internal_ProcessCollectionBegin (FbxCollection* pObject); 00138 virtual bool internal_ProcessCollectionEnd (FbxCollection* pObject); 00139 virtual bool internal_ProcessObject (FbxObject* pObject); 00140 bool ProcessPathProperty(FbxProperty &pProperty); 00141 virtual bool ValidPropertyForXRefCopy(FbxObject* pObject, FbxProperty& lProperty) const; 00142 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ 00143 }; 00144 00145 #include <fbxsdk/fbxsdk_nsend.h> 00146 00147 #endif /* _FBXSDK_UTILS_PROCESSOR_XREF_H_ */