00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __GEO_CaptureOverrideData_h__
00020 #define __GEO_CaptureOverrideData_h__
00021
00022 #include "GEO_API.h"
00023 #include <UT/UT_IntArray.h>
00024 #include <UT/UT_PtrArray.h>
00025 #include <GB/GB_AttributeRef.h>
00026
00027 #include <UT/UT_Matrix4.h>
00028 #include <UT/UT_VectorTypes.h>
00029 class UT_IStream;
00030 class GB_Attribute;
00031 class GB_AttributeTable;
00032 class GB_AttributeData;
00033 class GB_PointGroup;
00034 class GEO_Detail;
00035 class GEO_CaptureOverrideDelta;
00036 class GB_CaptureBoneStorage;
00037
00038 class geo_CaptureOverridePointData;
00039
00040 typedef int (*GEO_CaptureRegionDataCB)( void *user_data,
00041 char *full_cregion_path,
00042 char *relative_cregion_path,
00043 GB_CaptureBoneStorage &tube_data );
00044
00045 class GEO_API GEO_CaptureOverrideData
00046 {
00047 public:
00048 GEO_CaptureOverrideData();
00049 virtual ~GEO_CaptureOverrideData();
00050
00051 void destroy();
00052
00053 void getOpPaths( UT_StringList &paths );
00054 void getOpPathsCopy( UT_PtrArray<char *> &paths );
00055 void setOpPaths( const UT_PtrArray<char *> &paths );
00056 int changeOpPaths( const char *old_name,
00057 const char *new_name );
00058 void changeCaptureRegionRoot( const char *old_root,
00059 const char *new_root );
00060 void refreshCaptureFrameInfo( const GEO_Detail &gdp,
00061 GEO_CaptureRegionDataCB get_region,
00062 void *user_data );
00063
00064
00065 void applyOverrides(GEO_Detail &gdp);
00066
00067
00068
00069
00070 void mergeCaptureWeightOverridesDelta(
00071 GEO_CaptureOverrideDelta &delta );
00072 void undoCaptureWeightOverridesDelta(
00073 const GEO_CaptureOverrideDelta &delta );
00074
00075 bool overrideExists( int point_num ) const;
00076
00077
00078 int64 getMemoryUsage() const;
00079
00080 int save( ostream &os, int binary ) const;
00081 bool load( UT_IStream &is );
00082
00083 private:
00084
00085
00086
00087
00088
00089
00090
00091
00092 void setOverride(int point_num, const float *weights, int size,
00093 UT_IntArray &map_from_delta,
00094 const UT_PtrArray<char *> &delta_paths,
00095 const UT_PtrArray<GB_CaptureBoneStorage *> &delta_tubes,
00096 UT_IntArray *added_delta_paths,
00097 bool &max_size_invalid);
00098
00099 void updateIndexBounds( int point_num, bool exists,
00100 bool &min_invalid, bool &max_invalid );
00101
00102 int findPathIndex( const char *path ) const;
00103
00104 private:
00105 UT_PtrArray<char *> myRegionPaths;
00106 UT_PtrArray<GB_CaptureBoneStorage *> myCaptureTubes;
00107
00108
00109
00110
00111 UT_PtrArray<geo_CaptureOverridePointData *> myWeights;
00112
00113 int myMinPointIndex;
00114 int myMaxPointIndex;
00115
00116 int myNumOverrides;
00117 int myMaxWeightDataSize;
00118 };
00119
00120 enum
00121 {
00122 GEO_CAPTUREOVERRIDE_NO_CHANGE = 0,
00123 GEO_CAPTUREOVERRIDE_SET = 1,
00124 GEO_CAPTUREOVERRIDE_CHANGE = 2,
00125 GEO_CAPTUREOVERRIDE_UNSET = 3,
00126 };
00127
00128 class geo_CaptureOverrideDeltaData;
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 class GEO_API GEO_CaptureOverrideDelta
00141 {
00142 public:
00143 GEO_CaptureOverrideDelta();
00144 virtual ~GEO_CaptureOverrideDelta();
00145
00146 void copyForUndo( const GEO_CaptureOverrideDelta &other );
00147
00148
00149 void destroy();
00150
00151
00152 bool removesOverride( int point_num ) const;
00153 bool addsOverride( int point_num ) const;
00154
00155
00156
00157 void addedCaptureRegion( const GEO_Detail &gdp, const char *path,
00158 int cindex );
00159
00160
00161
00162
00163
00164 void initCaptureWeightChange( const GEO_Detail &gdp );
00165
00166
00167
00168
00169 void beginCaptureWeightChange( const GB_AttributeData &data );
00170 void endCaptureWeightChange( const GB_AttributeData &data,
00171 unsigned int point_index,
00172 int operation );
00173
00174 const UT_PtrArray<char *> &getPaths() const
00175 { return myRegionPaths; }
00176 const UT_PtrArray<GB_CaptureBoneStorage *>
00177 &getCaptureTubes() const
00178 { return myCaptureTubes; }
00179 UT_IntArray &getRegionsAddedToOverrides()
00180 { return myAddedRegionsToOverrides; }
00181 const UT_IntArray &getRegionsAddedToOverrides() const
00182 { return myAddedRegionsToOverrides; }
00183
00184 int getNumChanges() const { return myChanges.entries(); }
00185 const geo_CaptureOverrideDeltaData *getChange(int i) const
00186 { return myChanges(i); }
00187
00188
00189 void undoOverrideDeltas( GEO_Detail &gdp );
00190
00191
00192 int64 getMemoryUsage() const;
00193
00194 private:
00195 void convertAndStorePtData( const float *gdp_data,
00196 int num_point_regions,
00197 float *&store_data, int &store_size );
00198
00199 void prepareCaptureRegionChange( int path_index );
00200 void convertAndRestorePtData( float *gdp_data,
00201 int num_point_regions,
00202 const float *store_data,
00203 int store_size,
00204 int entry_size,
00205 const UT_IntArray &map_to_gdp,
00206 float *tmp_data );
00207
00208
00209 private:
00210 UT_PtrArray<char *> myRegionPaths;
00211 UT_PtrArray<GB_CaptureBoneStorage *> myCaptureTubes;
00212
00213
00214
00215
00216 UT_IntArray myAddedRegionsToGdp;
00217 UT_IntArray myAddedRegionsToOverrides;
00218
00219 UT_PtrArray<geo_CaptureOverrideDeltaData *> myChanges;
00220
00221
00222 GB_Attribute *mySavedPathAttrib;
00223 GB_AttributeRef mySavedTubeOffset;
00224 const GB_AttributeTable *mySavedAttribs;
00225 float *mySavedData;
00226 GB_AttributeRef mySavedDataOffset;
00227 unsigned int mySavedDataSize;
00228 UT_IntArray myMapFromGdp;
00229 };
00230
00231 #endif // __GEO_CaptureOverrideData_h__
00232