00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GDT_CaptureWeight_h__
00022 #define __GDT_CaptureWeight_h__
00023
00024 #include "GDT_API.h"
00025 #include <UT/UT_IntArray.h>
00026 #include <UT/UT_PtrArray.h>
00027
00028 #include "GDT_Token.h"
00029
00030
00031 class UT_Matrix4;
00032 class UT_FloatArray;
00033 class GB_PointGroup;
00034 class GEO_Detail;
00035 class GDT_TokenList;
00036 class GU_DetailHandle;
00037
00038 typedef int (*GDT_CaptureRegionCB)( void *user_data,
00039 char *cregion,
00040 UT_Matrix4 &parent_xform,
00041 GU_DetailHandle &tube_gdp );
00042
00043
00044 class GDT_API GDT_CaptureWeight : public GDT_Token
00045 {
00046 public:
00047 GDT_CaptureWeight( unsigned int size );
00048 virtual ~GDT_CaptureWeight();
00049
00050 GDT_CaptureWeight( const GDT_CaptureWeight &other );
00051
00052 void getOpPaths( UT_StringList &paths );
00053 void getOpPathsCopy( UT_PtrArray<char *> &paths );
00054 void setOpPaths( const UT_PtrArray<char *> &paths );
00055 int changeOpPaths( const char *old_name,
00056 const char *new_name );
00057 void changeCaptureRegionRoot( const char *old_root,
00058 const char *new_root );
00059 void refreshCaptureFrameInfo(
00060 const GEO_Detail &gdp,
00061 GDT_CaptureRegionCB get_region,
00062 void *user_data );
00063
00064 virtual void applyDeltas( const GDT_TokenList &token_list,
00065 GEO_Detail &gdp,
00066 bool inverse=false ) const;
00067 virtual void applyScaledDelta(GEO_Detail &gdp, GEO_Point &pt,
00068 float scale = 1.0f) const;
00069
00070 void mergeCaptureWeightDeltas(
00071 const GDT_CaptureWeight &other,
00072 bool inverse = false );
00073
00074 virtual void zeroDeltas();
00075
00076
00077 void initCaptureWeightChange( const GEO_Detail &gdp );
00078 void beginCaptureWeightChange(
00079 const GB_AttributeData &data );
00080 void endCaptureWeightChange(
00081 const GB_AttributeData &data,
00082 unsigned int point_index );
00083
00084 virtual void resize( unsigned int size );
00085
00086 virtual unsigned int changed() const { return myMaxRow - myMinRow + 1; }
00087
00088 virtual unsigned int entries() const { return myNumRows; }
00089
00090
00091 virtual int save( ostream &os, int binary = 0 ) const;
00092 virtual bool load( UT_IStream &is );
00093
00094 private:
00095
00096
00097
00098 private:
00099 void destroy();
00100 void prepareCaptureRegionChange( int path_index );
00101
00102 private:
00103 UT_PtrArray<char *> myRegionPaths;
00104 UT_PtrArray<float *> myCaptureTubes;
00105 UT_PtrArray<UT_FloatArray *> myValues;
00106 unsigned int myNumRows;
00107 int myMinRow;
00108 int myMaxRow;
00109
00110
00111 float * mySavedData;
00112 int mySavedDataOffset;
00113 unsigned int mySavedDataSize;
00114 GB_Attribute * mySavedPathAttrib;
00115 int mySavedTubeOffset;
00116 const GB_AttributeTable * mySavedAttribs;
00117 UT_IntArray myMapFromGdp;
00118 };
00119
00120 #endif // __GDT_CaptureWeight_h__
00121