|
Katana Plug-in APIs 0.1
|
00001 #ifndef FnGeolibCookInterface_H 00002 #define FnGeolibCookInterface_H 00003 00004 #include <cstddef> 00005 #include <string> 00006 #include <vector> 00007 00008 #include <FnAttribute/FnAttribute.h> 00009 00010 #include <FnGeolib/FnGeolibAPI.h> 00011 #include <FnGeolib/op/ns.h> 00012 #include <FnGeolib/suite/FnGeolibCookInterfaceSuite.h> 00013 00014 #include <FnPlatform/StringView.h> 00015 #include <FnPlatform/internal/Portability.h> 00016 00017 #include <FnPluginSystem/FnPlugin.h> 00018 #include <FnPluginSystem/FnPluginSystem.h> 00019 00020 // This is the GeolibOp client side wrapper for FnGeolibInterfaceSuite_v1. A 00021 // reference to an instance of this is handed to the GeolibOp::cook() function. 00022 // 00023 // This class is not meant to be derived from, just compiled into the Op plug- 00024 // in as a convenience. 00025 00026 00027 FNGEOLIBOP_NAMESPACE_ENTER 00028 { 00046 class FNGEOLIB_API GeolibCookInterface 00047 { 00048 public: 00065 class QueryAbortException 00066 { 00067 }; 00068 00069 GeolibCookInterface(FnGeolibCookInterfaceHandle interfaceHandle, 00070 FnGeolibCookInterfaceSuite_v1 *interfaceSuite); 00071 00076 enum ResetRoot 00077 { 00082 ResetRootFalse = kFnKatGeolibCookInterfaceResetRootFalse, 00083 00088 ResetRootTrue = kFnKatGeolibCookInterfaceResetRootTrue, 00089 00094 ResetRootAuto = kFnKatGeolibCookInterfaceResetRootAuto 00095 }; 00096 00097 // @cond FN_INTERNAL_DEV 00098 typedef enum ResetRoot ResetRoot; 00099 // @endcond 00100 00111 std::string getOutputName() const; 00112 00123 std::string getInputName() const; 00124 00137 std::string getOutputLocationPath() const; 00138 00145 std::string getInputLocationPath() const; 00146 00164 std::string getRelativeOutputLocationPath() const; 00165 00172 std::string getRelativeInputLocationPath() const; 00173 00182 std::string getRootLocationPath() const; 00183 00195 bool atRoot() const; 00196 00215 int getInputIndex() const; 00216 00230 int getNumInputs() const; 00231 00238 std::string getOpType() const; 00239 00253 FnAttribute::Attribute getOpArg(FnPlatform::StringView specificArgName = 00254 FnPlatform::StringView()) const; 00255 00302 FnAttribute::Attribute getAttr( 00303 FnPlatform::StringView attrName, 00304 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00305 int inputIndex = kFnKatGeolibDefaultInput) const; 00306 00315 bool doesLocationExist( 00316 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00317 int inputIndex = kFnKatGeolibDefaultInput) const; 00318 00340 FnAttribute::StringAttribute getPotentialChildren( 00341 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00342 int inputIndex = kFnKatGeolibDefaultInput) const; 00343 00349 void *getPrivateData() const; 00350 00377 void prefetch( 00378 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00379 int inputIndex = kFnKatGeolibDefaultInput) const; 00380 00394 FnAttribute::Attribute getOutputAttr( 00395 FnPlatform::StringView attrName) const; 00396 00430 void setAttr(FnPlatform::StringView attrName, 00431 const FnAttribute::Attribute& value, 00432 const bool groupInherit = true); 00433 00454 void copyAttr( 00455 FnPlatform::StringView dstAttrName, 00456 FnPlatform::StringView srcAttrName, 00457 const bool groupInherit = true, 00458 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00459 int inputIndex = kFnKatGeolibDefaultInput); 00460 00491 void extendAttr( 00492 FnPlatform::StringView dstAttrName, 00493 const FnAttribute::Attribute& value, 00494 FnPlatform::StringView srcAttrName = FnPlatform::StringView(), 00495 const bool groupInherit = true, 00496 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00497 int inputIndex = kFnKatGeolibDefaultInput); 00498 00506 void deleteAttr(FnPlatform::StringView attrName); 00507 00511 void deleteAttrs(); 00512 00522 void replaceAttrs( 00523 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00524 int inputIndex = kFnKatGeolibDefaultInput); 00541 typedef void (*FnDeletePrivateDataFunc)(void* privateData); 00542 00581 void createChild( 00582 FnPlatform::StringView name, 00583 FnPlatform::StringView opType = FnPlatform::StringView(), 00584 const FnAttribute::Attribute& opArgs = FnAttribute::Attribute(), 00585 ResetRoot resetRoot = ResetRootAuto, 00586 void* privateData = NULL, 00587 FnDeletePrivateDataFunc deletePrivateData = NULL); 00588 00599 void replaceChildren( 00600 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00601 int inputIndex = kFnKatGeolibDefaultInput); 00602 00607 void deleteChildren(); 00608 00616 void deleteChild(FnPlatform::StringView name); 00617 00628 void deleteSelf(); 00629 00658 void copyLocationToChild( 00659 FnPlatform::StringView child, 00660 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 00661 int inputIndex = kFnKatGeolibDefaultInput, 00662 FnPlatform::StringView orderBefore = FnPlatform::StringView()); 00663 00682 void replaceChildTraversalOp( 00683 FnPlatform::StringView opType, 00684 const FnAttribute::GroupAttribute& opArgs, 00685 void* privateData = NULL, 00686 FnDeletePrivateDataFunc deletePrivateData = NULL); 00687 00692 void stopChildTraversal(); 00693 00710 void execOp(FnPlatform::StringView opType, 00711 const FnAttribute::GroupAttribute& opArgs, 00712 void* privateData = NULL, 00713 FnDeletePrivateDataFunc deletePrivateData = NULL); 00714 00723 void resetRoot(); 00724 00729 // Need ability to pass this interface instance to other C APIs. 00730 FnGeolibCookInterfaceHandle getHandle() const {return _handle;} 00731 FnGeolibCookInterfaceSuite_v1 * getSuite() const {return _suite;} 00732 00733 private: 00734 FnGeolibCookInterfaceHandle _handle; 00735 FnGeolibCookInterfaceSuite_v1 *_suite; 00736 }; 00737 00748 class FNGEOLIB_API GeolibPrivateData 00749 { 00750 public: 00751 GeolibPrivateData() {} 00752 virtual ~GeolibPrivateData() {} 00753 00762 static void Delete(void* data) 00763 { 00764 delete static_cast<GeolibPrivateData*>(data); 00765 } 00766 }; 00767 00781 FNGEOLIB_API 00782 std::string GetInputLocationType( 00783 const GeolibCookInterface& interface, 00784 FnPlatform::StringView location = FnPlatform::StringView(), 00785 int inputIndex = kFnKatGeolibDefaultInput); 00786 00803 FNGEOLIB_API 00804 std::string GetAbsOutputLocationPath(const GeolibCookInterface & interface, 00805 const std::string & outputLocationPath); 00806 00824 FNGEOLIB_API 00825 std::string GetAbsInputLocationPath(const GeolibCookInterface & interface, 00826 const std::string & inputLocationPath); 00827 00836 FNGEOLIB_API 00837 void RenameChild(GeolibCookInterface & interface, 00838 FnPlatform::StringView src, FnPlatform::StringView dst); 00839 00853 FNGEOLIB_API 00854 FnAttribute::Attribute GetGlobalAttr( 00855 const GeolibCookInterface& interface, FnPlatform::StringView name, 00856 FnPlatform::StringView location = FnPlatform::StringView(), 00857 int inputIndex = kFnKatGeolibDefaultInput); 00858 00867 FNGEOLIB_API 00868 void ReportError(GeolibCookInterface & interface, 00869 const std::string & message); 00870 00879 FNGEOLIB_API 00880 void ReportWarning(GeolibCookInterface & interface, 00881 const std::string & message); 00882 00895 FNGEOLIB_API 00896 FnAttribute::GroupAttribute MergeImmediateGroupChildren( 00897 const std::vector<FnAttribute::GroupAttribute> & attrs); 00898 00914 FNGEOLIB_API 00915 FnAttribute::GroupAttribute GetGlobalXFormGroup( 00916 const GeolibCookInterface & interface, 00917 const std::string & inputLocationPath=std::string(), 00918 int inputIndex=kFnKatGeolibDefaultInput); 00919 00926 FNGEOLIB_API 00927 float GetCurrentTime(const GeolibCookInterface & interface); 00928 00935 FNGEOLIB_API 00936 float GetShutterOpen(const GeolibCookInterface & interface); 00937 00944 FNGEOLIB_API 00945 float GetShutterClose(const GeolibCookInterface & interface); 00946 00953 FNGEOLIB_API 00954 int GetNumSamples(const GeolibCookInterface & interface); 00955 00963 FNGEOLIB_API 00964 FnAttribute::Attribute GetGraphStateVariable( 00965 const GeolibCookInterface& interface, 00966 FnPlatform::StringView variableName); 00967 00969 // 00970 // WARNING - these are likely to be moved to an alternate library / header 00971 // 00973 00979 struct BoundPoint 00980 { 00981 BoundPoint() : x(0), y(0), z(0) {} 00982 BoundPoint(double x_, double y_, double z_) 00983 : x(x_), y(y_), z(z_) {} 00984 00988 double x; 00989 00993 double y; 00994 00998 double z; 00999 }; 01000 01014 FNGEOLIB_API 01015 FnAttribute::DoubleAttribute GetBoundAttr( 01016 const GeolibCookInterface& interface, 01017 FnPlatform::StringView inputLocationPath = FnPlatform::StringView(), 01018 int inputIndex = kFnKatGeolibDefaultInput); 01019 01032 FNGEOLIB_API 01033 void GetBoundAttrValue( 01034 double outMinBound[3], double outMaxBound[3], 01035 const FnAttribute::DoubleAttribute & boundAttr, 01036 float sampleTime); 01037 01053 FNGEOLIB_API 01054 void GetTransformedBoundAttrValue( 01055 std::vector<BoundPoint> & outPoints, 01056 const FnAttribute::DoubleAttribute & boundAttr, 01057 float sampleTime, const double xform[16]); 01058 01075 FNGEOLIB_API 01076 void GetTransformedBoundAttrValue( 01077 double outMinBound[3], double outMaxBound[3], 01078 const FnAttribute::DoubleAttribute & boundAttr, 01079 float sampleTime, const double xform[16]); 01080 01094 FNGEOLIB_API 01095 FnAttribute::DoubleAttribute MergeLocalBoundAttrs( 01096 const std::vector<FnAttribute::DoubleAttribute> & boundAttrs); 01097 01106 FNGEOLIB_API 01107 FnAttribute::GroupAttribute FilterNullAttributes( 01108 const FnAttribute::GroupAttribute & groupAttr); 01109 01129 FNGEOLIB_API 01130 FnAttribute::GroupAttribute ResolveReferentialInheritance( 01131 const FnGeolibOp::GeolibCookInterface& interface, 01132 FnPlatform::StringView keyAttrName, FnPlatform::StringView attrName, 01133 const std::string& inputLocationPath = std::string(), 01134 int inputIndex = kFnKatGeolibDefaultInput); 01135 01137 // 01138 // DEPRECATED - Do not use! Pending removal 01139 // 01141 01142 struct CreateLocationInfo 01143 { 01144 bool atLeaf; 01145 bool canMatchChildren; 01146 }; 01147 01148 FNGEOLIB_API 01149 void CreateLocation(CreateLocationInfo & createLocationInfo, 01150 GeolibCookInterface & interface, 01151 const std::string & location); 01152 01153 FNGEOLIB_API 01154 void CopyTree( 01155 GeolibCookInterface & interface, 01156 const std::string & dstLocation, 01157 const std::string & srcLocation, 01158 int srcInput=kFnKatGeolibDefaultInput); 01159 } 01160 FNGEOLIBOP_NAMESPACE_EXIT 01161 01162 #endif // FnGeolibCookInterface_H
1.7.3