On 13/11/2015 at 10:21, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
---------
Howdy,
What I'm trying to do is create a clone of an object that has a Pose Morph tag on it, 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 are in different positions on the clone than on the original object, 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 = cpmTag->GetMorphID(i);
sSet = Real(1.0);
cpmTag->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);
cpmTag->SetParameter(sliderId, sSet, DESCFLAGS_SET_0);
}
}
}
BaseObject::Free(clone);
}
return true;
}
It prints "no points selected" for every morph. Why is it not working?
Adios,
Cactus Dan