Commit 2b3ca1f1 authored by NiranV's avatar NiranV

Added: Show Selection Beam option to Build options.

Added: Show Light Radius option to Build options.
Added: Select by surrounding option to Build options.
Added: Next and Previous Element buttons to Build Tools.
Added: Selection Outlines option to Build Tools.
Changed: Renamed Grid Options window to Build options.
Changed: Moved Select Only My Objects to Build options.
Changed: Moved Select Only Physical Objects to Build options.
Changed: Moved Snap to Grid mode selection to Build options.
Changed: Swapped Snap to Grid for a checkbox and moved it to the other commonly used options.
parent 3457656b
......@@ -36,14 +36,29 @@
#include "llcombobox.h"
#include "llselectmgr.h"
#include "llviewercontrol.h"
#include "llfloatertools.h"
#include "llfloaterreg.h"
//
// Methods
//
void commit_grid_mode(LLUICtrl *ctrl)
{
LLComboBox* combo = (LLComboBox*)ctrl;
LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
}
LLFloaterBuildOptions::LLFloaterBuildOptions(const LLSD& key)
: LLFloater(key)
: LLFloater(key),
mComboGridMode(NULL)
{
mCommitCallbackRegistrar.add("BuildTool.toggleLightRadius", boost::bind(&LLFloaterBuildOptions::toggleLightRadius, this, _1));
mCommitCallbackRegistrar.add("BuildTool.toggleSelectSurrounding", boost::bind(&LLFloaterBuildOptions::toggleSelectSurrounding, this, _1));
mCommitCallbackRegistrar.add("BuildTool.gridMode", boost::bind(&commit_grid_mode, _1));
}
LLFloaterBuildOptions::~LLFloaterBuildOptions()
......@@ -51,6 +66,8 @@ LLFloaterBuildOptions::~LLFloaterBuildOptions()
BOOL LLFloaterBuildOptions::postBuild()
{
mComboGridMode = getChild<LLComboBox>("combobox grid mode");
return TRUE;
}
......@@ -58,6 +75,7 @@ BOOL LLFloaterBuildOptions::postBuild()
void LLFloaterBuildOptions::onOpen(const LLSD& key)
{
mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
refreshGridMode();
}
// virtual
......@@ -65,3 +83,61 @@ void LLFloaterBuildOptions::onClose(bool app_quitting)
{
mObjectSelection = NULL;
}
// static
void LLFloaterBuildOptions::setGridMode(S32 mode)
{
LLFloaterBuildOptions* options_floater = LLFloaterReg::getTypedInstance<LLFloaterBuildOptions>("build_options");
if (!options_floater || !options_floater->mComboGridMode)
{
return;
}
options_floater->mComboGridMode->setCurrentByIndex(mode);
}
//static
void LLFloaterBuildOptions::refreshGridMode()
{
LLFloaterBuildOptions* options_floater = LLFloaterReg::getTypedInstance<LLFloaterBuildOptions>("build_options");
if (!options_floater || !options_floater->mComboGridMode)
{
return;
}
LLComboBox* combo = options_floater->mComboGridMode;
S32 index = combo->getCurrentIndex();
combo->removeall();
switch (options_floater->mObjectSelection->getSelectType())
{
case SELECT_TYPE_HUD:
combo->add(options_floater->getString("grid_screen_text"));
combo->add(options_floater->getString("grid_local_text"));
break;
case SELECT_TYPE_WORLD:
combo->add(options_floater->getString("grid_world_text"));
combo->add(options_floater->getString("grid_local_text"));
combo->add(options_floater->getString("grid_reference_text"));
break;
case SELECT_TYPE_ATTACHMENT:
combo->add(options_floater->getString("grid_attachment_text"));
combo->add(options_floater->getString("grid_local_text"));
combo->add(options_floater->getString("grid_reference_text"));
break;
}
combo->setCurrentByIndex(index);
}
void LLFloaterBuildOptions::toggleLightRadius(LLUICtrl* ctrl)
{
// TomY TODO merge these
LLSelectMgr::sRenderLightRadius = ctrl->getValue();
}
void LLFloaterBuildOptions::toggleSelectSurrounding(LLUICtrl* ctrl)
{
// TomY TODO merge these
LLSelectMgr::sRectSelectInclusive = ctrl->getValue();
}
\ No newline at end of file
......@@ -36,6 +36,7 @@
#include "llselectmgr.h"
class LLObjectSelection;
class LLComboBox;
typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
......@@ -48,6 +49,11 @@ class LLFloaterBuildOptions
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void onClose(bool app_quitting);
static void setGridMode(S32 mode);
static void refreshGridMode();
void toggleLightRadius(LLUICtrl* ctrl);
void toggleSelectSurrounding(LLUICtrl* ctrl);
private:
friend class LLFloaterReg;
......@@ -55,5 +61,9 @@ class LLFloaterBuildOptions
~LLFloaterBuildOptions();
LLObjectSelectionHandle mObjectSelection;
LLComboBox* mComboGridMode;
LLUICtrl* mCheckMyObjects;
LLUICtrl* mCheckPhysicalObjects;
};
#endif
......@@ -250,18 +250,10 @@ BOOL LLFloaterTools::postBuild()
mCreatePanel = getChild<LLPanel>("create_panel");
mLandPanel = getChild<LLPanel>("land_panel");
mCheckMyObjects = getChild<LLUICtrl>("checkbox only my objects");
mCheckPhysicalObjects = getChild<LLUICtrl>("checkbox only physical objects");
mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts");
mCheckSnapToGrid = getChild<LLUICtrl>("checkbox snap to grid");
mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform");
mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures");
mComboGridMode = getChild<LLComboBox>("combobox grid mode");
mCheckSnapToGrid->setValue((BOOL)gSavedSettings.getBOOL("SnapEnabled"));
mCheckStretchUniform->setValue((BOOL)gSavedSettings.getBOOL("ScaleUniform"));
mCheckStretchTexture->setValue((BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
mCheckSelectIndividual->setValue((BOOL)gSavedSettings.getBOOL("EditLinkedParts"));
//
// Create Buttons
......@@ -283,11 +275,6 @@ BOOL LLFloaterTools::postBuild()
mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers");
mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates");
mCheckCopySelection->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
mCheckSticky->setValue((BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected"));
mCheckCopyCenters->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
mCheckCopyRotates->setValue((BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
mRadioGroupLand = getChild<LLRadioGroup>("land_radio_group");
mBtnApplyToSelection = getChild<LLButton>("button apply to selection");
mSliderDozerSize = getChild<LLSlider>("slider brush size");
......@@ -304,6 +291,9 @@ BOOL LLFloaterTools::postBuild()
mRemainingCapacity = getChild<LLTextBox>("remaining_capacity");
mNothingSelected = getChild<LLTextBox>("selection_empty");
mNextElement = getChild<LLButton>("next_part_btn");
mPrevElement = getChild<LLButton>("prev_part_btn");
mMediaInfo = getChild<LLTextBox>("media_info");
mMediaAdd = getChild<LLButton>("add_media");
mMediaDelete = getChild<LLButton>("delete_media");
......@@ -342,14 +332,10 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
mRadioGroupEdit(NULL),
mCheckSelectIndividual(NULL),
//BD
mCheckMyObjects(NULL),
mCheckPhysicalObjects(NULL),
mCheckSnapToGrid(NULL),
mBtnGridOptions(NULL),
mTitleMedia(NULL),
mComboGridMode(NULL),
mCheckStretchUniform(NULL),
mCheckStretchTexture(NULL),
......@@ -360,6 +346,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
mBtnLink(NULL),
mBtnUnlink(NULL),
//BD
mFocusPanel(NULL),
mGrabPanel(NULL),
mEditPanel(NULL),
......@@ -397,6 +384,10 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
mNothingSelected(NULL),
mMediaInfo(NULL),
//BD - Next / Previous Element
mNextElement(NULL),
mPrevElement(NULL),
mMediaAdd(NULL),
mMediaDelete(NULL),
mMediaAlign(NULL),
......@@ -423,7 +414,6 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
mCommitCallbackRegistrar.add("BuildTool.commitRadioMove", boost::bind(&commit_radio_group_move,_1));
mCommitCallbackRegistrar.add("BuildTool.commitRadioEdit", boost::bind(&commit_radio_group_edit,_1));
mCommitCallbackRegistrar.add("BuildTool.gridMode", boost::bind(&commit_grid_mode,_1));
mCommitCallbackRegistrar.add("BuildTool.selectComponent", boost::bind(&commit_select_component, this));
mCommitCallbackRegistrar.add("BuildTool.gridOptions", boost::bind(&LLFloaterTools::onClickGridOptions,this));
mCommitCallbackRegistrar.add("BuildTool.applyToSelection", boost::bind(&click_apply_to_selection, this));
......@@ -433,6 +423,9 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
mCommitCallbackRegistrar.add("BuildTool.DeleteMedia", boost::bind(&LLFloaterTools::onClickBtnDeleteMedia,this));
mCommitCallbackRegistrar.add("BuildTool.EditMedia", boost::bind(&LLFloaterTools::onClickBtnEditMedia,this));
mCommitCallbackRegistrar.add("BuildTool.NextPart", boost::bind(&LLFloaterTools::onSelectElement, this, _1, _2));
mCommitCallbackRegistrar.add("BuildTool.PrevPart", boost::bind(&LLFloaterTools::onSelectElement, this, _1, _2));
mCommitCallbackRegistrar.add("BuildTool.LinkObjects", boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance()));
mCommitCallbackRegistrar.add("BuildTool.UnlinkObjects", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()));
......@@ -618,6 +611,9 @@ void LLFloaterTools::refresh()
mSelectionCount->setVisible(have_selection);
mRemainingCapacity->setVisible(have_selection);
mNothingSelected->setVisible(!have_selection);
mNextElement->setEnabled(have_selection && (is_link_select || is_face_select));
mPrevElement->setEnabled(have_selection && (is_link_select || is_face_select));
}
......@@ -797,29 +793,13 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
{
mRadioGroupEdit->setValue("radio align");
}
}
S32 index = mComboGridMode->getCurrentIndex();
mComboGridMode->removeall();
switch (mObjectSelection->getSelectType())
{
case SELECT_TYPE_HUD:
mComboGridMode->add(getString("grid_screen_text"));
mComboGridMode->add(getString("grid_local_text"));
break;
case SELECT_TYPE_WORLD:
mComboGridMode->add(getString("grid_world_text"));
mComboGridMode->add(getString("grid_local_text"));
mComboGridMode->add(getString("grid_reference_text"));
break;
case SELECT_TYPE_ATTACHMENT:
mComboGridMode->add(getString("grid_attachment_text"));
mComboGridMode->add(getString("grid_local_text"));
mComboGridMode->add(getString("grid_reference_text"));
break;
}
mComboGridMode->setCurrentByIndex(index);
//BD - Refresh grid options
LLFloaterBuildOptions* options_floater = LLFloaterReg::getTypedInstance<LLFloaterBuildOptions>("build_options");
if (options_floater)
{
options_floater->refreshGridMode();
}
// Create buttons
......@@ -1133,25 +1113,6 @@ void LLFloaterTools::setObjectType( LLPCode pcode )
gFocusMgr.setMouseCapture(NULL);
}
void commit_grid_mode(LLUICtrl *ctrl)
{
LLComboBox* combo = (LLComboBox*)ctrl;
LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
}
// static
void LLFloaterTools::setGridMode(S32 mode)
{
LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build");
if (!tools_floater || !tools_floater->mComboGridMode)
{
return;
}
tools_floater->mComboGridMode->setCurrentByIndex(mode);
}
void LLFloaterTools::onClickGridOptions()
{
LLFloater* floaterp = LLFloaterReg::showInstance("build_options");
......@@ -2051,3 +2012,159 @@ void LLFloaterTools::updateMediaSettings()
mMediaSettings[ base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX ) ] = ! identical;
}
//BD - Shameless plug from llviewermenu.cpp
// Cycle selection through linked children or/and faces in selected object.
// FIXME: Order of children list is not always the same as sim's idea of link order. This may confuse
// resis. Need link position added to sim messages to address this.
void LLFloaterTools::onSelectElement(LLUICtrl* ctrl, const LLSD& userdata)
{
bool cycle_faces = LLToolFace::getInstance() == LLToolMgr::getInstance()->getCurrentTool();
bool cycle_linked = gSavedSettings.getBOOL("EditLinkedParts");
if (!cycle_faces && !cycle_linked)
{
// Nothing to do
return;
}
bool fwd = (userdata.asString() == "next");
bool prev = (userdata.asString() == "previous");
bool ifwd = (userdata.asString() == "includenext");
bool iprev = (userdata.asString() == "includeprevious");
LLViewerObject* to_select = NULL;
bool restart_face_on_part = !cycle_faces;
S32 new_te = 0;
if (cycle_faces)
{
// Cycle through faces of current selection, if end is reached, swithc to next part (if present)
LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
if (!nodep)
return;
to_select = nodep->getObject();
if (!to_select)
return;
S32 te_count = to_select->getNumTEs();
S32 selected_te = nodep->getLastOperatedTE();
if (fwd || ifwd)
{
if (selected_te < 0)
{
new_te = 0;
}
else if (selected_te + 1 < te_count)
{
// select next face
new_te = selected_te + 1;
}
else
{
// restart from first face on next part
restart_face_on_part = true;
}
}
else if (prev || iprev)
{
if (selected_te > te_count)
{
new_te = te_count - 1;
}
else if (selected_te - 1 >= 0)
{
// select previous face
new_te = selected_te - 1;
}
else
{
// restart from last face on next part
restart_face_on_part = true;
}
}
}
S32 object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();
if (cycle_linked && object_count && restart_face_on_part)
{
LLViewerObject* selected = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
if (selected && selected->getRootEdit())
{
LLViewerObject::child_list_t children = selected->getRootEdit()->getChildren();
children.push_front(selected->getRootEdit()); // need root in the list too
for (LLViewerObject::child_list_t::iterator iter = children.begin(); iter != children.end(); ++iter)
{
if ((*iter)->isSelected())
{
if (object_count > 1 && (fwd || prev)) // multiple selection, find first or last selected if not include
{
to_select = *iter;
if (fwd)
{
// stop searching if going forward; repeat to get last hit if backward
break;
}
}
else if ((object_count == 1) || (ifwd || iprev)) // single selection or include
{
if (fwd || ifwd)
{
++iter;
while (iter != children.end() && ((*iter)->isAvatar() || (ifwd && (*iter)->isSelected())))
{
++iter; // skip sitting avatars and selected if include
}
}
else // backward
{
iter = (iter == children.begin() ? children.end() : iter);
--iter;
while (iter != children.begin() && ((*iter)->isAvatar() || (iprev && (*iter)->isSelected())))
{
--iter; // skip sitting avatars and selected if include
}
}
iter = (iter == children.end() ? children.begin() : iter);
to_select = *iter;
break;
}
}
}
}
}
if (to_select)
{
if (gFocusMgr.childHasKeyboardFocus(gFloaterTools))
{
gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes
}
if (fwd || prev)
{
LLSelectMgr::getInstance()->deselectAll();
}
if (cycle_faces)
{
if (restart_face_on_part)
{
if (fwd || ifwd)
{
new_te = 0;
}
else
{
new_te = to_select->getNumTEs() - 1;
}
}
LLSelectMgr::getInstance()->addAsIndividual(to_select, new_te, FALSE);
}
else
{
LLSelectMgr::getInstance()->selectObjectOnly(to_select);
}
return;
}
return;
};
\ No newline at end of file
......@@ -105,8 +105,6 @@ class LLFloaterTools
bool selectedMediaEditable();
void updateLandImpacts();
static void setGridMode(S32 mode);
LLPanelFace* getPanelFace() { return mPanelFace; }
private:
......@@ -120,6 +118,8 @@ class LLFloaterTools
static bool multipleFacesSelectedConfirm(const LLSD& notification, const LLSD& response);
static void setObjectType( LLPCode pcode );
void onClickGridOptions();
//BD - Next / Previous Element
void onSelectElement(LLUICtrl* ctrl, const LLSD& userdata);
public:
LLButton *mBtnFocus;
......@@ -151,13 +151,10 @@ class LLFloaterTools
LLPanel* mLandPanel;
LLUICtrl* mCheckSnapToGrid;
LLUICtrl* mCheckMyObjects;
LLUICtrl* mCheckPhysicalObjects;
LLSlider* mZoomSlider;
LLButton* mBtnGridOptions;
LLComboBox* mComboGridMode;
LLCheckBoxCtrl* mCheckStretchUniform;
LLCheckBoxCtrl* mCheckStretchTexture;
......@@ -166,6 +163,10 @@ class LLFloaterTools
LLTextBox* mNothingSelected;
LLTextBox* mMediaInfo;
//BD - Next / Previous Element
LLButton* mNextElement;
LLButton* mPrevElement;
LLButton* mMediaAdd;
LLButton* mMediaDelete;
LLButton* mMediaAlign;
......
......@@ -87,16 +87,6 @@ const S32 SHINY_TEXTURE = 4; // use supplied specular map
//
std::string USE_TEXTURE;
LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit()
{
//BD
LLRender::eTexIndex channel_to_edit = (LLRender::eTexIndex)mRadioMaterialType->getSelectedIndex();
channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
return channel_to_edit;
}
// Things the UI provides...
//
LLUUID LLPanelFace::getCurrentNormalMap() { return mBumpyTextureCtrl->getImageAssetID(); }
......@@ -141,7 +131,6 @@ BOOL LLPanelFace::postBuild()
setMouseOpaque(FALSE);
mBtnAlign = getChild<LLButton>("align_media");
mRadioMaterialType = getChild<LLRadioGroup>("radio mattype");
mComboShiny = getChild<LLComboBox>("combobox shininess");
mComboBumpy = getChild<LLComboBox>("combobox bumpiness");
mComboAlpha = getChild<LLComboBox>("combobox alphamode");
......@@ -2230,3 +2219,13 @@ void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identic
} max_diff_repeats_func;
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&max_diff_repeats_func, repeats);
}
LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit()
{
//BD
LLRender::eTexIndex channel_to_edit = (LLRender::eTexIndex)mRadioMaterialType->getSelectedIndex();
channel_to_edit = (channel_to_edit == LLRender::NORMAL_MAP) ? (getCurrentNormalMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
channel_to_edit = (channel_to_edit == LLRender::SPECULAR_MAP) ? (getCurrentSpecularMap().isNull() ? LLRender::DIFFUSE_MAP : channel_to_edit) : channel_to_edit;
return channel_to_edit;
}
\ No newline at end of file
......@@ -145,6 +145,7 @@
#include "llfloatersidepanelcontainer.h"
#include "llsidepanelinventory.h"
#include "llteleporthistory.h"
#include "llfloaterbuildoptions.h"
#include "llurlaction.h"
#include "bdfunctions.h"
//BD - Pie Menu
......@@ -8675,7 +8676,7 @@ class LLToolsUseSelectionForGrid : public view_listener_t
} func;
LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT);
LLFloaterTools::setGridMode((S32)GRID_MODE_REF_OBJECT);
LLFloaterBuildOptions::setGridMode((S32)GRID_MODE_REF_OBJECT);
return true;
}
};
......
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
height="125"
height="250"
layout="topleft"
name="build options floater"
help_topic="build_options_floater"
save_rect="true"
title="Grid Options"
title="Build Options"
width="224">
<floater.string
name="grid_screen_text">
Screen
</floater.string>
<floater.string
name="grid_local_text">
Local
</floater.string>
<floater.string
name="grid_world_text">
World
</floater.string>
<floater.string
name="grid_reference_text">
Reference
</floater.string>
<floater.string
name="grid_attachment_text">
Attachment
</floater.string>
<check_box
control_name="GridSubUnit"
height="16"
label="Snap to sub-units"
layout="topleft"
name="GridSubUnit"
left="10"
top="20"
width="200" />
<check_box
control_name="GridCrossSections"
height="16"
label="View cross-sections"
layout="topleft"
name="GridCrossSection"
top_pad="0"
width="200" />
<text
type="string"
length="1"
follows="left|top"
height="19"