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 #include <UT/UT_VectorTypes.h>
00028
00029 #include "GDT_Token.h"
00030
00031 class GB_PointGroup;
00032 class GB_CaptureBoneStorage;
00033 class GEO_Detail;
00034 class GDT_TokenList;
00035 class GU_DetailHandle;
00036
00037 typedef int (*GDT_CaptureRegionCB)( void *user_data,
00038 char *cregion,
00039 UT_Matrix4 &parent_xform,
00040 GU_DetailHandle &tube_gdp );
00041
00042
00043 class GDT_API GDT_CaptureWeight : public GDT_Token
00044 {
00045 public:
00046 GDT_CaptureWeight( unsigned int size );
00047 virtual ~GDT_CaptureWeight();
00048
00049 GDT_CaptureWeight( const GDT_CaptureWeight &other );
00050
00051 void getOpPaths( UT_StringList &paths );
00052 void getOpPathsCopy( UT_PtrArray<char *> &paths );
00053 void setOpPaths( const UT_PtrArray<char *> &paths );
00054 int changeOpPaths( const char *old_name,
00055 const char *new_name );
00056 void changeCaptureRegionRoot( const char *old_root,
00057 const char *new_root );
00058 void refreshCaptureFrameInfo(
00059 const GEO_Detail &gdp,
00060 GDT_CaptureRegionCB get_region,
00061 void *user_data );
00062
00063 virtual void applyDeltas( const GDT_TokenList &token_list,
00064 GEO_Detail &gdp,
00065 bool inverse=false ) const;
00066 virtual void applyScaledDelta(GEO_Detail &gdp, GEO_Point &pt,
00067 float scale = 1.0f) const;
00068
00069 void mergeCaptureWeightDeltas(
00070 const GDT_CaptureWeight &other,
00071 bool inverse = false );
00072
00073 virtual void zeroDeltas();
00074
00075
00076 void initCaptureWeightChange( const GEO_Detail &gdp );
00077 void beginCaptureWeightChange(
00078 const GB_AttributeData &data );
00079 void endCaptureWeightChange(
00080 const GB_AttributeData &data,
00081 unsigned int point_index );
00082
00083 virtual void resize( unsigned int size );
00084
00085 virtual unsigned int changed() const { return myMaxRow - myMinRow + 1; }
00086
00087 virtual unsigned int entries() const { return myNumRows; }
00088
00089
00090 virtual int save( ostream &os, int binary = 0 ) const;
00091 bool jsonLoadDelta(UT_JSONParser &p, const char *name);
00092 virtual bool legacyLoad( UT_IStream &is );
00093
00094 private:
00095
00096
00097
00098 private:
00099 void destroy();
00100 void prepareCaptureRegionChange( int path_index );
00101 bool jsonLoadDeltaDefinition(UT_JSONParser &p);
00102 bool jsonLoadProperties(UT_JSONParser &p, int s, int count);
00103 bool jsonLoadObjects(UT_JSONParser &p, int s);
00104 bool jsonLoadObjectSets(UT_JSONParser &p);
00105 bool jsonLoad(UT_JSONParser &p);
00106
00107 private:
00108 UT_PtrArray<char *> myRegionPaths;
00109 UT_PtrArray<GB_CaptureBoneStorage *>myCaptureTubes;
00110 UT_PtrArray<UT_FloatArray *> myValues;
00111 unsigned int myNumRows;
00112 int myMinRow;
00113 int myMaxRow;
00114
00115
00116 float * mySavedData;
00117 GB_AttributeRef mySavedDataOffset;
00118 unsigned int mySavedDataSize;
00119 GB_Attribute * mySavedPathAttrib;
00120 GB_AttributeRef mySavedTubeOffset;
00121 const GB_AttributeTable * mySavedAttribs;
00122 UT_IntArray myMapFromGdp;
00123 };
00124
00125 #endif // __GDT_CaptureWeight_h__
00126