[sldev] [VWR] How to "commit" translations in Build mode?
Ettore Pasquini
ettore_pasquini at 3dconnexion.com
Tue Oct 9 13:02:43 PDT 2007
I added a method to LLSelectMgr to translate the selected objects by a given
vector in Build mode. The motion per se happens correctly, but when I
release the objects (i.e. unselect them) they bounce back to the original
location. What's more puzzling is that rotations *are* "committed"
correctly. I don't understand why translations would require a different
treatment. How to "commit" them to the new position?
This is my code (extracted and adapted from LLSelectMgr::sendListToRegions)
:
LLViewerRegion *last_region, *current_region;
S32 objects_sent = 0, packets_sent = 0, objects_in_this_packet = 0;
current_region = node->getObject()->getRegion();
// prepare first bulk message
gMessageSystem->newMessage("MultipleObjectUpdate");
packAgentAndSessionID(&update_type);
for (LLViewerObject *obj; node; node = mSelectedObjects->getNextRootNode())
{
obj = node->getObject();
if (update_position)
obj->setPosition(obj->getPositionEdit() + displ_global);
if (update_rotation)
obj->setRotation(obj->getRotationEdit() * new_rot);
if (obj->mDrawable.notNull())
gPipeline.markMoved(obj->mDrawable, TRUE);
// remember the last region, look up the current one
last_region = current_region;
current_region = obj->getRegion();
// if to same simulator and message not too big
if ((current_region == last_region)
&& (! gMessageSystem->isSendFull(NULL))
&& (objects_in_this_packet < MAX_OBJECTS_PER_PACKET))
{
// add another instance of the body of the data
packMultipleUpdate(node, &update_type);
++objects_sent;
++objects_in_this_packet;
}
else
{
// otherwise send current message and start new one
gMessageSystem->sendReliable(last_region->getHost());
packets_sent++;
objects_in_this_packet = 0;
gMessageSystem->newMessage("MultipleObjectUpdate");
packAgentAndSessionID(&update_type);
}
}
Thanks,
Ettore
More information about the SLDev
mailing list