On 13/11/2015 at 07:39, xxxxxxxx wrote:
Howdy,
OK, I have your code working where I can set the Pose Morph sliders, but I'm having a problem in my test code.
What I'm trying to do is create a clone of the object, then set each Pose Morph slider on the clone to 100%, compare the points of the morphed clone with the original object, and select the points that have moved, but it's not working.
Here is my code:
bool SelectMorphedPoints(BaseDocument *doc)
{
BaseObject *op = doc->GetActiveObject(); if(!op) return false;
BaseTag *tag = op->GetTag(1024237); if(!tag) return false;
CAPoseMorphTag* pmTag = static_cast<CAPoseMorphTag*>(tag);
LONG i, mCnt = pmTag->GetMorphCount();
GeData sSet;
// set all sliders to 0.0
for(i=0; i<mCnt; ++i)
{
DescID sliderId = pmTag->GetMorphID(i);
sSet = Real(0.0);
pmTag->SetParameter(sliderId, sSet, DESCFLAGS_SET_0);
}
// clone the object
BaseObject *clone = (BaseObject* )op->GetClone(COPYFLAGS_0, NULL);
if(clone)
{
Vector *padr = GetPointArray(op);
Vector *cpadr = GetPointArray(clone);
BaseTag *clTag = clone->GetTag(1024237);
if(clTag)
{
CAPoseMorphTag* cpmTag = static_cast<CAPoseMorphTag*>(clTag);
if(cpmTag)
{
for(i=0; i<mCnt; ++i)
{
DescID sliderId = pmTag->GetMorphID(i);
sSet = Real(1.0);
pmTag->SetParameter(sliderId, sSet, DESCFLAGS_SET_0);
clone->Message(MSG_UPDATE);
BaseSelect *bs = ToPoint(op)->GetPointS();
if(bs) bs->DeselectAll();
LONG p, pCnt = LMin(ToPoint(op)->GetPointCount(),ToPoint(clone)->GetPointCount());
for (p=0; p<pCnt; p++)
{
if(!VectorEqual(padr[p], cpadr[p], 0.001)) bs->Select(p);
}
if(bs->GetCount() < 1) GePrint(" no points selected");
sSet = Real(0.0);
pmTag->SetParameter(sliderId, sSet, DESCFLAGS_SET_0);
}
}
}
BaseObject::Free(clone);
}
return true;
}
It prints "no points selected" every time. Why is it not working?
Adios,
Cactus Dan