MAINT-5588 FIXED Make bumpiness and shininess easier to find in the texture tab, with radio buttons

meow-7.2.2
Mnikolenko ProductEngine 2015-09-09 16:22:40 +03:00
parent 863016ea4b
commit b996f2ca55
2 changed files with 67 additions and 58 deletions

View File

@ -49,6 +49,7 @@
#include "llmaterialmgr.h"
#include "llmediaentry.h"
#include "llnotificationsutil.h"
#include "llradiogroup.h"
#include "llresmgr.h"
#include "llselectmgr.h"
#include "llspinctrl.h"
@ -90,10 +91,10 @@ std::string USE_TEXTURE;
LLRender::eTexIndex LLPanelFace::getTextureChannelToEdit()
{
LLComboBox* combobox_matmedia = getChild<LLComboBox>("combobox matmedia");
LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype");
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
LLRender::eTexIndex channel_to_edit = (combobox_matmedia && combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ?
(combobox_mattype ? (LLRender::eTexIndex)combobox_mattype->getCurrentIndex() : LLRender::DIFFUSE_MAP) : LLRender::DIFFUSE_MAP;
(radio_mat_type ? (LLRender::eTexIndex)radio_mat_type->getSelectedIndex() : LLRender::DIFFUSE_MAP) : LLRender::DIFFUSE_MAP;
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;
@ -162,7 +163,6 @@ BOOL LLPanelFace::postBuild()
LLComboBox* mComboTexGen;
LLComboBox* mComboMatMedia;
LLComboBox* mComboMatType;
LLCheckBoxCtrl *mCheckFullbright;
@ -283,12 +283,12 @@ BOOL LLPanelFace::postBuild()
mComboMatMedia->selectNthItem(MATMEDIA_MATERIAL);
}
mComboMatType = getChild<LLComboBox>("combobox mattype");
if(mComboMatType)
{
mComboMatType->setCommitCallback(LLPanelFace::onCommitMaterialType, this);
mComboMatType->selectNthItem(MATTYPE_DIFFUSE);
}
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
if(radio_mat_type)
{
radio_mat_type->setCommitCallback(LLPanelFace::onCommitMaterialType, this);
radio_mat_type->selectNthItem(MATTYPE_DIFFUSE);
}
mCtrlGlow = getChild<LLSpinCtrl>("glow");
if(mCtrlGlow)
@ -676,20 +676,21 @@ void LLPanelFace::updateUI()
}
getChildView("combobox matmedia")->setEnabled(editable);
LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype");
if (combobox_mattype)
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
if(radio_mat_type)
{
if (combobox_mattype->getCurrentIndex() < MATTYPE_DIFFUSE)
{
combobox_mattype->selectNthItem(MATTYPE_DIFFUSE);
}
if (radio_mat_type->getSelectedIndex() < MATTYPE_DIFFUSE)
{
radio_mat_type->selectNthItem(MATTYPE_DIFFUSE);
}
}
else
{
LL_WARNS("Materials") << "failed getChild for 'combobox mattype'" << LL_ENDL;
LL_WARNS("Materials") << "failed getChild for 'radio_material_type'" << LL_ENDL;
}
getChildView("combobox mattype")->setEnabled(editable);
getChildView("radio_material_type")->setEnabled(editable);
updateVisibility();
bool identical = true; // true because it is anded below
@ -1200,8 +1201,7 @@ void LLPanelFace::updateUI()
BOOL identical_repeats = true;
F32 repeats = 1.0f;
U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? combobox_mattype->getCurrentIndex() : MATTYPE_DIFFUSE;
U32 material_type = (combobox_matmedia->getCurrentIndex() == MATMEDIA_MATERIAL) ? radio_mat_type->getSelectedIndex() : MATTYPE_DIFFUSE;
LLSelectMgr::getInstance()->setTextureChannel(LLRender::eTexIndex(material_type));
switch (material_type)
@ -1466,22 +1466,21 @@ void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata)
void LLPanelFace::updateVisibility()
{
LLComboBox* combo_matmedia = getChild<LLComboBox>("combobox matmedia");
LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype");
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
LLComboBox* combo_shininess = getChild<LLComboBox>("combobox shininess");
LLComboBox* combo_bumpiness = getChild<LLComboBox>("combobox bumpiness");
if (!combo_mattype || !combo_matmedia || !combo_shininess || !combo_bumpiness)
if (!radio_mat_type || !combo_matmedia || !combo_shininess || !combo_bumpiness)
{
LL_WARNS("Materials") << "Combo box not found...exiting." << LL_ENDL;
return;
}
U32 materials_media = combo_matmedia->getCurrentIndex();
U32 material_type = combo_mattype->getCurrentIndex();
U32 material_type = radio_mat_type->getSelectedIndex();
bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled();
bool show_texture = (show_media || ((material_type == MATTYPE_DIFFUSE) && combo_matmedia->getEnabled()));
bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL) && combo_matmedia->getEnabled();
bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled();
getChildView("combobox mattype")->setVisible(!show_media);
getChildView("rptctrl")->setVisible(true);
getChildView("radio_material_type")->setVisible(!show_media);
// Media controls
getChildView("media_info")->setVisible(show_media);
@ -1608,9 +1607,9 @@ void LLPanelFace::updateShinyControls(bool is_setting_texture, bool mess_with_sh
}
LLComboBox* combo_matmedia = getChild<LLComboBox>("combobox matmedia");
LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype");
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
U32 materials_media = combo_matmedia->getCurrentIndex();
U32 material_type = combo_mattype->getCurrentIndex();
U32 material_type = radio_mat_type->getSelectedIndex();
bool show_media = (materials_media == MATMEDIA_MEDIA) && combo_matmedia->getEnabled();
bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR) && combo_matmedia->getEnabled();
U32 shiny_value = comboShiny->getCurrentIndex();
@ -1693,11 +1692,11 @@ void LLPanelFace::updateAlphaControls()
mat_media = combobox_matmedia->getCurrentIndex();
}
LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype");
U32 mat_type = MATTYPE_DIFFUSE;
if (combobox_mattype)
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
if(radio_mat_type)
{
mat_type = combobox_mattype->getCurrentIndex();
mat_type = radio_mat_type->getSelectedIndex();
}
show_alphactrls = show_alphactrls && (mat_media == MATMEDIA_MATERIAL);
@ -1985,12 +1984,11 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata)
LLUICtrl* repeats_ctrl = self->getChild<LLUICtrl>("rptctrl");
LLComboBox* combo_matmedia = self->getChild<LLComboBox>("combobox matmedia");
LLComboBox* combo_mattype = self->getChild<LLComboBox>("combobox mattype");
LLRadioGroup* radio_mat_type = self->getChild<LLRadioGroup>("radio_material_type");
U32 materials_media = combo_matmedia->getCurrentIndex();
U32 material_type = (materials_media == MATMEDIA_MATERIAL) ? combo_mattype->getCurrentIndex() : 0;
U32 material_type = (materials_media == MATMEDIA_MATERIAL) ? radio_mat_type->getSelectedIndex() : 0;
F32 repeats_per_meter = repeats_ctrl->getValue().asReal();
F32 obj_scale_s = 1.0f;
@ -2114,12 +2112,12 @@ void LLPanelFace::onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata)
void LLPanelFace::onTextureSelectionChanged(LLInventoryItem* itemp)
{
LL_DEBUGS("Materials") << "item asset " << itemp->getAssetUUID() << LL_ENDL;
LLComboBox* combo_mattype = getChild<LLComboBox>("combobox mattype");
if (!combo_mattype)
LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type");
if(radio_mat_type)
{
return;
return;
}
U32 mattype = combo_mattype->getCurrentIndex();
U32 mattype = radio_mat_type->getSelectedIndex();
std::string which_control="texture control";
switch (mattype)
{

View File

@ -117,26 +117,37 @@
name="Media"
value="Media" />
</combo_box>
<combo_box
height="23"
layout="topleft"
left_pad="10"
name="combobox mattype"
top_delta="0"
width="155">
<combo_box.item
label="Texture (diffuse)"
name="Texture (diffuse)"
value="Texture (diffuse)" />
<combo_box.item
label="Bumpiness (normal)"
name="Bumpiness (normal)"
value="Bumpiness (normal)" />
<combo_box.item
label="Shininess (specular)"
name="Shininess (specular)"
value="Shininess (specular)" />
</combo_box>
<radio_group
control_name="ComboMaterialType"
height="50"
layout="topleft"
left_pad="20"
top_delta="-10"
width="150"
visible = "false"
name="radio_material_type">
<radio_item
label="Texture (diffuse)"
name="Texture (diffuse)"
top="0"
layout="topleft"
height="16"
value="0"/>
<radio_item
label="Bumpiness (normal)"
layout="topleft"
top_pad="1"
height="16"
name="Bumpiness (normal)"
value="1"/>
<radio_item
label="Shininess (specular)"
name="Shininess (specular)"
height="16"
layout="topleft"
top_pad="1"
value="2"/>
</radio_group>
<texture_picker
can_apply_immediately="true"
default_image_name="Default"
@ -148,7 +159,7 @@
left="10"
name="texture control"
tool_tip="Click to choose a picture"
top_pad="8"
top_pad="7"
width="64" />
<text
type="string"
@ -520,7 +531,7 @@
left="10"
name="tex gen"
text_readonly_color="LabelDisabledColor"
top_pad="60"
top_pad="40"
width="140">
Mapping
</text>