On 24/06/2015 at 00:29, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Mac OSX ;
Language(s) : C++ ;
---------
Hi,
I have a method which gets called on a button press.
The method iterates through all my selected objects, and, for each selected object, through all the selected points. Then, for each selected point, the position gets updated.
My problem is, it does only update my last selected point.
Here is my code:
BaseDocument *doc = GetActiveDocument();
Float posX; this->GetFloat(DLG_EDITNUMBER_X, posX);
Float posY; this->GetFloat(DLG_EDITNUMBER_Y, posY);
Float posZ; this->GetFloat(DLG_EDITNUMBER_Z, posZ);
Vector newPosition = Vector(posX, posY, posZ);
Int32 setAxis; this->GetInt32(DLG_RADIOGROUP_AXIS_SET, setAxis);
Bool setX; this->GetBool(DLG_CHECKBOX_SET_X, setX);
Bool setY; this->GetBool(DLG_CHECKBOX_SET_Y, setY);
Bool setZ; this->GetBool(DLG_CHECKBOX_SET_Z, setZ);
Int32 modelModeSet = doc->GetMode();
if (modelModeSet == Mpoints)
{
AutoAlloc<AtomArray> selection;
if (!selection)
return false;
if (doc)
{
doc->GetActiveObjects(*selection, GETACTIVEOBJECTFLAGS_0);
op = doc->GetActiveObject();
}
if (selection->GetCount() > 1)
{
GePrint("More than one object selected");
Int32 objectCount = selection->GetCount();
GePrint("The object count is: " + String::IntToString(objectCount));
for (Int32 i = 0; i < objectCount; i++)
{
PointObject *opPoint = static_cast<PointObject*>(selection->GetIndex(i));
if (!opPoint) return false;
Matrix modelingAxis = opPoint->GetModelingAxis(doc);
Int32 pointCount = opPoint->GetPointCount();
Vector *points = opPoint->GetPointW();
BaseSelect *bs = opPoint->GetPointS();
for (Int32 o = 0; o < pointCount; o++)
{
if (bs->IsSelected(o))
{
Vector projection = newPosition - modelingAxis.off;
points[o] = points[o] + projection;
opPoint->Message(MSG_UPDATE);
}
}
}
}
}
Does somebody see what could be the problem here?
Thanks in advance for your help and time! I greatly appreciate it!
With kind regards,
Casimir Smets