MAINT-8844 Fixed selection inconsistancies (inworld manipulation vs tool floater)

meow-7.2.2
andreykproductengine 2018-07-16 17:35:29 +03:00
parent dc0bd05717
commit 1e883c5b39
4 changed files with 54 additions and 35 deletions

View File

@ -341,21 +341,17 @@ void LLPanelObject::getState( )
return;
}
// can move or rotate only linked group with move permissions, or sub-object with move and modify perms
BOOL enable_move = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
BOOL enable_scale = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && objectp->permModify();
BOOL enable_rotate = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ))
&& (selected_count == 1);
if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() > 1)
{
enable_move = FALSE;
enable_scale = FALSE;
enable_rotate = FALSE;
}
bool enable_move;
bool enable_modify;
LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(enable_move, enable_modify);
BOOL enable_scale = enable_modify;
BOOL enable_rotate = enable_move; // already accounts for a case of children, which needs permModify() as well
LLVector3 vec;
if (enable_move)

View File

@ -3676,6 +3676,39 @@ void LLSelectMgr::selectForceDelete()
SEND_ONLY_ROOTS);
}
BOOL LLSelectMgr::selectGetEditMoveLinksetPermissions(bool &move, bool &modify)
{
move = true;
modify = true;
bool selecting_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
for (LLObjectSelection::iterator iter = getSelection()->begin();
iter != getSelection()->end(); iter++)
{
LLSelectNode* nodep = *iter;
if (!nodep->mValid)
{
move = false;
modify = false;
return FALSE;
}
LLViewerObject* object = nodep->getObject();
LLViewerObject *root_object = (object == NULL) ? NULL : object->getRootEdit();
bool this_object_movable = false;
if (object->permMove() && !object->isPermanentEnforced() &&
((root_object == NULL) || !root_object->isPermanentEnforced()) &&
(object->permModify() || selecting_linked_set))
{
this_object_movable = true;
}
move = move && this_object_movable;
modify = modify && object->permModify();
}
return TRUE;
}
void LLSelectMgr::selectGetAggregateSaleInfo(U32 &num_for_sale,
BOOL &is_for_sale_mixed,
BOOL &is_sale_price_mixed,

View File

@ -675,6 +675,11 @@ public:
// returns TRUE if all the nodes are valid. Accumulates
// permissions in the parameter.
BOOL selectGetPermissions(LLPermissions& perm);
// returns TRUE if all the nodes are valid. Depends onto "edit linked" state
// Children in linksets are a bit special - they require not only move permission
// but also modify if "edit linked" is set, since you move them relative to parent
BOOL selectGetEditMoveLinksetPermissions(bool &move, bool &modify);
// Get a bunch of useful sale information for the object(s) selected.
// "_mixed" is true if not all objects have the same setting.

View File

@ -3826,37 +3826,22 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
{
if( !LLSelectMgr::getInstance()->getSelection()->isEmpty() )
{
BOOL moveable_object_selected = FALSE;
BOOL all_selected_objects_move = TRUE;
BOOL all_selected_objects_modify = TRUE;
BOOL selecting_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin();
iter != LLSelectMgr::getInstance()->getSelection()->end(); iter++)
{
LLSelectNode* nodep = *iter;
LLViewerObject* object = nodep->getObject();
LLViewerObject *root_object = (object == NULL) ? NULL : object->getRootEdit();
BOOL this_object_movable = FALSE;
if (object->permMove() && !object->isPermanentEnforced() &&
((root_object == NULL) || !root_object->isPermanentEnforced()) &&
(object->permModify() || selecting_linked_set))
{
moveable_object_selected = TRUE;
this_object_movable = TRUE;
}
all_selected_objects_move = all_selected_objects_move && this_object_movable;
all_selected_objects_modify = all_selected_objects_modify && object->permModify();
}
bool all_selected_objects_move;
bool all_selected_objects_modify;
// Note: This might be costly to do on each frame and when a lot of objects are selected
// we might be better off with some kind of memory for selection and/or states, consider
// optimizing, perhaps even some kind of selection generation at level of LLSelectMgr to
// make whole viewer benefit.
LLSelectMgr::getInstance()->selectGetEditMoveLinksetPermissions(all_selected_objects_move, all_selected_objects_modify);
BOOL draw_handles = TRUE;
if (tool == LLToolCompTranslate::getInstance() && (!moveable_object_selected || !all_selected_objects_move))
if (tool == LLToolCompTranslate::getInstance() && !all_selected_objects_move)
{
draw_handles = FALSE;
}
if (tool == LLToolCompRotate::getInstance() && (!moveable_object_selected || !all_selected_objects_move))
if (tool == LLToolCompRotate::getInstance() && !all_selected_objects_move)
{
draw_handles = FALSE;
}