00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __SOP_CaptureData_h__
00020 #define __SOP_CaptureData_h__
00021
00022 #include "SOP_API.h"
00023 #include <OP/OP_Context.h>
00024 #include <GEO/GEO_Detail.h>
00025 #include <GU/GU_DetailHandle.h>
00026 #include <UT/UT_IntArray.h>
00027 #include <UT/UT_PtrArray.h>
00028 #include <UT/UT_String.h>
00029
00030 class UT_Matrix4;
00031 class UT_Vector3;
00032 class GU_Detail;
00033 class OP_Node;
00034 class SOP_Node;
00035
00036 class SOP_API SOP_CaptureData
00037 {
00038 public:
00039 SOP_CaptureData();
00040 virtual ~SOP_CaptureData();
00041
00042 void initialize(const OP_Node *node, const GU_Detail *gudp,
00043 GEO_Detail::CaptureType t = GEO_Detail::CAPTURE_BONE);
00044 void destroy();
00045 void dirtyCache();
00046
00047 bool updateRegionColors( OP_Context &context );
00048 bool updateRegionSOPPaths();
00049
00050 const UT_PtrArray<const UT_Vector3 *> &
00051 getRegionColors( OP_Context &context )
00052 {
00053 if( myColorsDirtyFlag )
00054 (void) updateRegionColors( context );
00055 return myRegionColors;
00056 }
00057
00058 const char *
00059 getRegionPath( int path_index )
00060 {
00061 if( myRegionsDirtyFlag )
00062 (void) updateRegions();
00063 return myRegionPaths(path_index);
00064 }
00065 int
00066 getNumRegions()
00067 {
00068 if( myRegionsDirtyFlag )
00069 (void) updateRegions();
00070 return myRegionPaths.entries();
00071 }
00072
00073 const char *
00074 getSOPPath( int path_index )
00075 {
00076 if( mySOPPathsDirtyFlag )
00077 (void) updateRegionSOPPaths();
00078 return myRegionSOPPaths(path_index);
00079 }
00080
00081 private:
00082 bool updateRegions();
00083 GU_DetailHandle getRegionHandle(UT_String path,
00084 OP_Context &context);
00085 int getRegionPrimNumber(int region_idx,
00086 OP_Context &context);
00087
00088 private:
00089 int myOpId;
00090 const GU_Detail *myGdp;
00091 UT_PtrArray<const UT_Vector3 *> myRegionColors;
00092 UT_PtrArray<const char *> myRegionPaths;
00093 UT_PtrArray<const char *> myRegionPrims;
00094 UT_PtrArray<char *> myRegionSOPPaths;
00095 UT_String myRegionRootPath;
00096 bool myColorsDirtyFlag : 1,
00097 myRegionsDirtyFlag : 1,
00098 mySOPPathsDirtyFlag : 1;
00099 GEO_Detail::CaptureType myCaptureType;
00100 };
00101
00102 SOP_API bool SOPgetCaptureRegion(SOP_Node *me, char *cregion,
00103 UT_Matrix4 &parent_xform,
00104 GU_DetailHandle &tube_gdh);
00105
00106 SOP_API int SOPaddCaptureRegion(SOP_Node *me,
00107 GU_Detail *gdp, const char *root_path,
00108 const char *cregion_name,
00109 GEO_Detail::CaptureType capture_type);
00110
00111 #endif // __SOP_CaptureData_h__
00112