-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMeshGitNode.cpp
More file actions
630 lines (514 loc) · 20.5 KB
/
Copy pathMeshGitNode.cpp
File metadata and controls
630 lines (514 loc) · 20.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
#define MNoVersionString
#define MNoPluginEntry
#include "MeshGitNode.h"
#include "MatchComputer.h"
#include <maya/MGlobal.h>
#include <maya/MString.h>
#include "maya/MFnPlugin.h"
#include <maya/MFnStringData.h>
#include <maya/MPlugArray.h>
#include <maya/MDagPath.h>
#include <maya/MFnStringArrayData.h>
#include <string>
#include <iostream>
using namespace std;
#define McheckErr(stat,msg) \
if ( MS::kSuccess != stat ) { \
cerr << msg; \
return MS::kFailure; \
}
MStatus returnStatus;
//IMPLEMENTATION
//Node Attributes
MObject MeshGitNode::originalMesh;
MObject MeshGitNode::derivativeAMesh;
MObject MeshGitNode::derivativeBMesh;
MObject MeshGitNode::mergedMesh;
MObject MeshGitNode::currentFrame;
MObject MeshGitNode::editStringArray;
MTypeId MeshGitNode::id( 0x4E5000 );
void* MeshGitNode::creator()
{
return new MeshGitNode;
}
MeshGitNode::MeshGitNode(void)
{
}
MeshGitNode::~MeshGitNode(void)
{
}
MStatus MeshGitNode::initialize()
{
MGlobal::displayInfo("init started");
MFnUnitAttribute unitAttr;
MFnTypedAttribute typedAttr;
MFnNumericAttribute numericAttr;
MFnStringData stringFn;
MFnStringArrayData stringArrayFn;
MStatus returnStatus;
//Create the attributes
// Current time
//
MeshGitNode::currentFrame = unitAttr.create("currentFrame", "ct", MFnUnitAttribute::kTime, 0,
&returnStatus);
unitAttr.setKeyable(true);
//uAttr.setHidden(true);
returnStatus = addAttribute(MeshGitNode::currentFrame);
McheckErr(returnStatus, "ERROR adding currentFrame attribute\n");
MeshGitNode::editStringArray = typedAttr.create( "editStringArray", "es",
MFnData::kStringArray,
&returnStatus );
McheckErr(returnStatus, "ERROR creating MeshGitNode editStringArray attribute\n");
typedAttr.setStorable(true);
returnStatus = addAttribute(MeshGitNode::editStringArray);
McheckErr(returnStatus, "ERROR adding editStringArray attribute\n");
MeshGitNode::originalMesh = typedAttr.create( "originalMesh", "om",
MFnData::kMesh,
&returnStatus );
McheckErr(returnStatus, "ERROR creating MeshGitNode output attribute\n");
typedAttr.setStorable(false);
returnStatus = addAttribute(MeshGitNode::originalMesh);
McheckErr(returnStatus, "ERROR adding originalMesh attribute\n");
MeshGitNode::derivativeAMesh = typedAttr.create( "derivativeAMesh", "dam",
MFnData::kMesh,
&returnStatus );
McheckErr(returnStatus, "ERROR creating MeshGitNode output attribute\n");
typedAttr.setStorable(false);
returnStatus = addAttribute(MeshGitNode::derivativeAMesh);
McheckErr(returnStatus, "ERROR adding derivativeAMesh attribute\n");
MeshGitNode::derivativeBMesh = typedAttr.create( "derivativeBMesh", "dbm",
MFnData::kMesh,
&returnStatus );
McheckErr(returnStatus, "ERROR creating MeshGitNode output attribute\n");
typedAttr.setStorable(false);
returnStatus = addAttribute(MeshGitNode::derivativeBMesh);
McheckErr(returnStatus, "ERROR adding derivativeBMesh attribute\n");
MeshGitNode::mergedMesh = typedAttr.create( "mergedMesh", "mm",
MFnData::kMesh,
&returnStatus );
McheckErr(returnStatus, "ERROR creating MeshGitNode output attribute\n");
typedAttr.setStorable(false);
returnStatus = addAttribute(MeshGitNode::mergedMesh);
McheckErr(returnStatus, "ERROR adding mergedMesh attribute\n");
//Set the attribute affects
returnStatus = attributeAffects(currentFrame, outputGeom);
McheckErr(returnStatus, "AttributeAffects error for 'currentFrame'");
returnStatus = attributeAffects(MeshGitNode::originalMesh, outputGeom);
McheckErr(returnStatus, "AttributeAffects error for 'blendEndFrames'");
returnStatus = attributeAffects(MeshGitNode::derivativeAMesh, outputGeom);
McheckErr(returnStatus, "AttributeAffects error for 'blendEndFrames'");
returnStatus = attributeAffects(MeshGitNode::derivativeBMesh, outputGeom);
McheckErr(returnStatus, "AttributeAffects error for 'blendEndFrames'");
returnStatus = attributeAffects(inputGeom, outputGeom);
McheckErr(returnStatus, "AttributeAffects error for 'currentFrame'");
//std::cout << "Initialize Completed" << std::endl;
MGlobal::displayInfo("Initialize Completed!!!!");
return MS::kSuccess;
}
void MeshGitNode::postConstructor() {
cout<<"POST CONSTRUCTOR CALLED" << endl;
mergedVerts = new MPointArray();
diffResultsWindowName = "none";
diffResultsScrollListName = "none";
selectedEditIndex=-1;
}
MStatus MeshGitNode::storeAllVerts(MDataBlock& dataBlock)
{
MStatus status;
MGlobal::displayInfo("Starting storeAllVerts");
//Gets the handle to the output geometry
MArrayDataHandle ouputGeomHandle = dataBlock.outputArrayValue(outputGeom, &status);
reportError(status);
//Gets the number of geometries on the handle - should be 3
unsigned int numGeom = ouputGeomHandle.elementCount(&status);
reportError(status);
allVerts.clear();
allVerts.resize(numGeom);
allTransforms.clear();
allTransforms.resize(numGeom);
allMFnMeshObjects.clear();
allMFnMeshObjects.resize(numGeom);
//Get the input handle
MArrayDataHandle inputHandle = dataBlock.outputArrayValue(input, &status);
reportError(status);
//cout<< "NUM GEOMETRIES: " << numGeom << endl;
for(unsigned int i=0; i<numGeom; i++){
//MGlobal::displayInfo("Storing Geom " + i);
//get the element index that the current geom is in the datablock
int geomIndex = ouputGeomHandle.elementIndex(&status);
//go tot he correct geometry in the input geometry handle
status = inputHandle.jumpToElement(geomIndex);
reportError(status);
////get the value of the geometry
MDataHandle inputGeomValue = inputHandle.inputValue(&status);
reportError(status);
MObject meshObject = inputGeomValue.asMesh();
MFnMesh *currentMeshFn = new MFnMesh(meshObject);
allMFnMeshObjects[i] = currentMeshFn;
//cout<< " NUM POLYGONS " << allMFnMeshObjects[i]->numPolygons() << endl;
//Get the input geometry handle, and the group id as well
MDataHandle hGeom = inputGeomValue.child(inputGeom);
MDataHandle hGroup = inputGeomValue.child(groupId);
unsigned int groupId = hGroup.asLong();
if(i == 3)
mergedMeshGroupID= groupId;
////Get the output geometry handle output value
MDataHandle hOutputGeomValue = ouputGeomHandle.outputValue(&status);
////Copy over the data rfom the input to the output
status = hOutputGeomValue.copy(hGeom);
MDataHandle forMat = ouputGeomHandle.inputValue();
//MMatrix mat = forMat.geometryTransformMatrix();
////cout<< allTransforms[0] <<endl;
//allTransforms.push_back(mat);
////set an iterator over all points in the current input geometry and copy all the points into the all verts data structure
MItGeometry iter(hOutputGeomValue, groupId, false);
MPointArray currentVerts;
iter.allPositions(currentVerts, MSpace::kObject);
ouputGeomHandle.next();
//cout << "MESH " << i << endl;
//cout<< currentVerts << endl;
MPointArray* mp = new MPointArray(currentVerts);
allVerts[i] = mp;
}
ouputGeomHandle.setAllClean();
MGlobal::displayInfo("Ending storeAllVerts");
//for (unsigned int i = 0; i < allVerts.size(); i++) {
//cout << "MESHB " << i << endl;
//cout<< *allVerts[i] << endl;
//cout<<allTransforms[i]<<endl;
//}
return status;
}
vector<MPointArray*> MeshGitNode::getAllVerts()
{
return allVerts;
}
vector<MFnMesh*> MeshGitNode::getMFnMeshObjects()
{
return allMFnMeshObjects;
}
MStatus MeshGitNode::compute(const MPlug& plug, MDataBlock& dataBlock)
{
MStatus status = MStatus::kSuccess;
//if(allVerts.length()>3000)
// allVerts.clear();
MGlobal::displayInfo("COMPUTE CALLED!!");
if(plug.attribute() == outputGeom) {
MGlobal::displayInfo("plug is outputgeom ");
storeAllVerts(dataBlock);
status = MStatus::kSuccess;
status = deformOutputMesh(dataBlock);
//
}
MGlobal::displayInfo("Num geometries at end of COMPUTE function : " + allVerts.size());
return status;
}
MStatus MeshGitNode::deformOutputMesh(MDataBlock &dataBlock) {
//cout<<"Starting deforming merged mesh" << endl;
MStatus status;
if(mergedVerts==NULL){
//cout<<"NULL MERGEDVERTS" << endl;
}
//cout<<"MERGEDVERTS NOT NULL" << endl;
if(mergedVerts->length()<=1){
//cout<<"MERGEDVERTS NO LENGTH" << endl;
}
if(mergedVerts==NULL || mergedVerts->length()<=1){
//cout<<"Merged verts empty or null" << endl;
return status;
}
//cout<<"Starting deforming merged mesh 2" << endl;
MArrayDataHandle outputGeometryArrayHandle = dataBlock.outputArrayValue(outputGeom,
&status);
int numOutputGeoms= outputGeometryArrayHandle.elementCount(&status);
for (unsigned g = 0; g < numOutputGeoms; ++g) {
if(g<3){
outputGeometryArrayHandle.next();
continue;
}
MDataHandle hOutputGeom = outputGeometryArrayHandle.outputValue(&status);
//Transform to local space
unsigned int plugIndex = outputGeometryArrayHandle.elementIndex(&status);
MPlug outputGeometryPlug(thisMObject(), outputGeom);
MPlug outputPlug = outputGeometryPlug.elementByLogicalIndex(plugIndex,
&status);
// Get the connected node to have access to the path data
// of the actual geometry
MPlugArray connectedPlugs;
outputPlug.connectedTo(connectedPlugs, true, true);
MObject obj;
MDagPath dagPath;
// Iterate over each point in the output: by setting the group id, will
// Only get the points in the deformation set
MItGeometry iter(hOutputGeom, mergedMeshGroupID, false);
// Set the position on the iterator(will also set on output as point
// to same thing
status = iter.setAllPositions(*mergedVerts, MSpace::kObject);
// go to next geometry
outputGeometryArrayHandle.next();
}
findSelectedEditIndex();
//cout<<"Finished deforming merged mesh" << endl;
return status;
} // setupOutputGeometry
void MeshGitNode::startDiff()
{
mergedVerts = allVerts[0];
MPointArray* meshVertsB = allVerts[2];
cout << "meshVertsAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << endl;
cout<< *meshVertsB << endl;
meshOperator = new MeshOperator(allVerts, allMFnMeshObjects);
meshOperator->diff();
//MPointArray* meshVertsOrig = allVerts[0];
//MPointArray* meshVertsA = allVerts[1];
//MPointArray* meshVertsB = allVerts[2];
//MFnMesh* fnOrig = allMFnMeshObjects[0];
//MFnMesh* fnA = allMFnMeshObjects[1];
//MFnMesh* fnB = allMFnMeshObjects[2];
///*for (unsigned int i = 0; i < meshVertsOrig.length(); i++) {
// cout << meshVertsOrig[i] << endl;
//}*/
//MatchComputer* matchComputerA = new MatchComputer(meshVertsOrig, meshVertsA, fnOrig,fnA );
//MatchComputer* matchComputerB = new MatchComputer(meshVertsOrig, meshVertsB, fnOrig,fnB );
dA_bestMatches = meshOperator->dA_bestMatches;
dA_unmatchedPointsOrig = meshOperator->dA_unmatchedPointsOrig;
dA_unmatchedPointsA = meshOperator->dA_unmatchedPointsA;
dB_bestMatches = meshOperator->dB_bestMatches;
dB_unmatchedPointsOrig = meshOperator->dB_unmatchedPointsOrig;
dB_unmatchedPointsB = meshOperator->dB_unmatchedPointsB;
meshOperator->checkConflicts();
nonconflictingOriginalVerts = meshOperator->nonconflictingEdits;
conflictingOriginalVerts = meshOperator->conflictingEdits;
vector<MString> editStrings = meshOperator->editInfo;
//Present list of edits
if(diffResultsWindowName=="none"){
diffResultsWindowName = MGlobal::executeCommandStringResult("window -title \"Diff Results\" -widthHeight 420 380 -s false; columnLayout -adjustableColumn true;");
int numTotalEdits = meshOperator->allEdits.size();
MString totalEdits = "Total Edits: ";
totalEdits += numTotalEdits;
int numUnresolvedEdits = meshOperator->unresolvedEdits;
MString unresolvedEdits = "Unresolved Edits: ";
unresolvedEdits += numUnresolvedEdits;
//MGlobal::executeCommand("frameLayout -label \"Number of Edits \" -collapsable false;");
//MGlobal::executeCommand("rowLayout -numberOfColumns 2 -columnWidth2 210 210 -columnAlign2 left right;");
totalEditsLabel = MGlobal::executeCommandStringResult("text -label \"" + totalEdits + "\" -w 210 -al left;");
unresolvedEditsLabel = MGlobal::executeCommandStringResult("text -label \"" + unresolvedEdits + "\" -w 220 -al left;");
//MGlobal::executeCommand("setParent..;");
cout<< " totalEditsLabel " << totalEditsLabel << endl;
cout<< " unresolvedEditsLabel " << unresolvedEditsLabel << endl;
MGlobal::executeCommand("frameLayout -label \"Edit Operation Results\" -collapsable false; columnLayout -adjustableColumn true;");
MString command2 = "textScrollList -numberOfRows 20 -w 430 -allowMultiSelection false -fn fixedWidthFont -selectCommand (\"updateSelectedEditIndex()\") ";
for(int i = 0; i < editStrings.size(); i++){
MString s = editStrings.at(i);
command2 += "-append ";
command2 += "\"";
command2 += s;
command2 += "\" ";
}
command2 += " ;";
diffResultsScrollListName = MGlobal::executeCommandStringResult(command2);
MGlobal::executeCommand("button -label \"Merge Non-Conflicting Edits\" -command mergeUnconflicting;");
MGlobal::executeCommand("setParent..;");
MGlobal::executeCommand("frameLayout -label \"Resolve Selected Conflict\" -collapsable false;");
//MGlobal::executeCommand("rowLayout -numberOfColumns 3 -columnAlign3 center center center -columnWidth3 140 140 140;");
MGlobal::executeCommand("button -label \"Resolve with A\" -command conflictResolveA -actOnPress false -w 140 -enable false ResolveButtonA;");
MGlobal::executeCommand("button -label \"Resolve with B\" -command conflictResolveB -actOnPress false -w 140 -enable false ResolveButtonB;");
MGlobal::executeCommand("button -label \"Resolve with both\" -command conflictResolveBoth -actOnPress false -w 140 -enable false ResolveButtonAB;");
MGlobal::executeCommand("setParent..;");
MGlobal::executeCommand("showWindow;");
cout << "diffResultsWindowName " << diffResultsWindowName << endl;
cout << "diffResultsScrollListName " << diffResultsScrollListName << endl;
}
else
reloadDiffResultsWindow();
}
void MeshGitNode::reloadDiffResultsWindow(){
meshOperator->updateEditStrings();
cout<<"Starting reload Diff" << endl;
MGlobal::executeCommand("textScrollList -e -removeAll " + diffResultsScrollListName);
vector<MString> editStrings = meshOperator->editInfo;
for(int i = 0; i < editStrings.size(); i++){
MString command2 = "textScrollList -e -append ";
MString s = editStrings.at(i);
command2 += "\"";
command2 += s;
command2 += "\" ";
MString finalCommand = command2 + " " + diffResultsScrollListName;
MGlobal::executeCommand(finalCommand);
cout<<"Text Scroll Command " << finalCommand << endl;
}//window1|columnLayout114|textScrollList21
//fix labels
int numTotalEdits = meshOperator->allEdits.size();
MString totalEdits = "Total Edits: ";
totalEdits += numTotalEdits;
int numUnresolvedEdits = meshOperator->unresolvedEdits;
MString unresolvedEdits = "Unresolved Edits: ";
unresolvedEdits += numUnresolvedEdits;
MString command = "text -e -label " ;
command= command+ "\"";
command= command + totalEdits;
command= command +"\" " + totalEditsLabel;
MGlobal::executeCommand(command);
MString command2 = "text -e -label " ;
command2= command2 + "\"";
command2= command2 + unresolvedEdits;
command2= command2 +"\" " + unresolvedEditsLabel;
MGlobal::executeCommand(command2);
cout<< "totalEditsLabel " << totalEditsLabel << endl;
cout<< "unresolvedEditsLabel " << unresolvedEditsLabel << endl;
cout<< "command " << command << endl;
cout<< "command2 " << command2 << endl;
}
int MeshGitNode::findSelectedEditIndex(){
if(diffResultsScrollListName=="none")
return 0;
//cout<<"Starting find selected edit index" << endl;
MString finalCommand = "textScrollList -q -selectIndexedItem " + diffResultsScrollListName;
MIntArray indexArray;
MGlobal::executeCommand(finalCommand, indexArray);
//cout<<"indexArray.length " << indexArray.length() <<endl;
if(indexArray.length()<=0)
return 0;
selectedEditIndex = indexArray[0]-1;
cout<<"selectedEditIndex " << selectedEditIndex<<endl;
if (selectedEditIndex != -1) { // check valid index
bool conflicting = meshOperator->conflictingEdit(selectedEditIndex);
if (conflicting) {
//MGlobal::executeCommand("if (`window -exists ResolveConflictGUI`) { deleteUI -window ResolveConflictGUI; }");
//MGlobal::executeCommand("window -title \"Resolve Conflict\" -w 100 -h 150 ResolveConflictGUI; columnLayout -adjustableColumn true;");
MGlobal::executeCommand("button -e -enable true ResolveButtonA;");
MGlobal::executeCommand("button -e -enable true ResolveButtonB;");
MGlobal::executeCommand("button -e -enable true ResolveButtonAB;");
//MGlobal::executeCommand("setParent..; showWindow ResolveConflictGUI;");
}
else {
//MGlobal::executeCommand("if (`window -exists ResolveConflictGUI`) { deleteUI -window ResolveConflictGUI; }");
MGlobal::executeCommand("button -e -enable false ResolveButtonA;");
MGlobal::executeCommand("button -e -enable false ResolveButtonB;");
MGlobal::executeCommand("button -e -enable false ResolveButtonAB;");
}
}
return selectedEditIndex;
}
void MeshGitNode::manualResolveConflict(int rc)
{
mergedVerts = meshOperator->manualResolveEdit(rc);
reloadDiffResultsWindow();
}
bool MeshGitNode::getCurrentlySelectedEditPositions(MPoint& orginal, MPoint & derivA, MPoint &derivB, MPoint &output){
if(selectedEditIndex==-1)
return false;
//cout<<"Starting find selected edit index" << endl;
vector<EditOperation*> allEdits = meshOperator->allEdits;
if(allEdits.size()<=selectedEditIndex){
return false;
}
EditOperation* edit = allEdits[selectedEditIndex];
ComponentMatch* matchA = edit->matchA;
Match A = matchA->getMatches();
MeshComponent* A_original = A.originalComp;
MeshComponent* A_derivative = A.derivativeComp;
ComponentMatch* matchB = edit->matchB;
Match B = matchB->getMatches();
MeshComponent* B_original = B.originalComp;
MeshComponent* B_derivative = B.derivativeComp;
orginal = A_original->pos;
derivA = A_derivative->pos;
derivB = B_derivative->pos;
int index = A_original->index;
if(mergedVerts->length()<=index)
return true;
output = (*mergedVerts)[index];
cout<<"Output Vert " << output<< endl;
return true;
}
void MeshGitNode::mergeUnconflicting(){
mergedVerts = meshOperator->mergeUnconflictingEdits();
reloadDiffResultsWindow();
//need to set something dirty so that it recomputes
}
vector<MString> MeshGitNode::getEditStrings( ){
if(meshOperator==NULL)
return vector<MString>();
else return
meshOperator->editInfo;
}
//PRINTING AND DEBUGGING FUNCTIONS
void MeshGitNode::reportError(MStatus status )
{
if(status != MStatus::kSuccess){
MGlobal::displayInfo("ERROR in MeshGitDeformerNode " + status.errorString());
}
}
void MeshGitNode::printTEST()
{
MGlobal::displayInfo("TESTINGGGG");
}
void MeshGitNode::printVectorOfPoints(MString name, std::vector<MPointArray> &points)
{
MGlobal::displayInfo(name);
for(int i = 0; i <points.size(); i ++){
for(int j = 0; j <points[i].length(); j ++){
double x = points[i][j].x;
double y = points[i][j].y;
double z = points[i][j].z;
//std::string toPrint = "g" + i + std::string("v") + j + std::string("[") + x + std::string(",") + y + std::string(",") + z + std::string("]");
MString toPrint2 = "g" + i ;//+ "v" + j + "[" + x + "," + y + "," + z + "]";
toPrint2 += "v" + j;
toPrint2 +="[" + (int)x;
toPrint2 +="," +(int) y ;
toPrint2 +="," +(int) z ;
toPrint2 +="]";
//MGlobal::displayInfo("POINT");
MGlobal::displayInfo(toPrint2);
}
}
}
MStatus
MeshGitNode::deform( MDataBlock& block,
MItGeometry& iter,
unsigned int multiIndex)
//
// Method: deform
//
// Description: Deform the point with a squash algorithm
//
// Arguments:
// block : the datablock of the node
// iter : an iterator for the geometry to be deformed
// multiIndex : the index of the geometry that we are deforming
//
//
{
MGlobal::displayInfo("Deformation Started: num geoms = " + allVerts.size());
MStatus returnStatus;
// Envelope data from the base class.
// The envelope is simply a scale factor.
//
MDataHandle envData = block.inputValue(envelope, &returnStatus);
if (MS::kSuccess != returnStatus) return returnStatus;
float env = envData.asFloat();
// iterate through each point in the geometry
//
//if(multiIndex==0 ||allVerts.length()>10000){
// allVerts.clear();
//}
//for ( ; !iter.isDone(); iter.next()) {
// MPoint pt = iter.position();
// //pt *= omatinv;
// allVerts.append(pt.x,pt.y,pt.z,1.0);
// //float weight = weightValue(block,multiIndex,iter.index());
//
// // offset algorithm
// //
// //pt.y = pt.y + env*weight;
// //
// // end of offset algorithm
// //pt *= omat
// //MPoint pt =
// pt = pt;
// iter.setPosition(pt);
//}
//MGlobal::displayInfo("Num verts in node function : " + allVerts.length());
return returnStatus;
}