diff options
author | Oz Linden <oz@lindenlab.com> | 2013-01-11 18:51:28 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-01-11 18:51:28 -0500 |
commit | 597b374f382946b95d556af82cad612124b3211a (patch) | |
tree | 3afe023ecb709713ed0078313b4cefa3bdc76060 | |
parent | b3e10f0f4959e806828a46194bfda6ed523dbcb1 (diff) | |
parent | f4663e098c1f338259b46085188be19f8fad7543 (diff) |
merge first round of build floater changes
-rw-r--r-- | indra/newview/llpanelface.cpp | 159 | ||||
-rw-r--r-- | indra/newview/llpanelface.h | 1 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_tools_texture.xml | 228 |
3 files changed, 321 insertions, 67 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index e74c8509ce..0dedfae7da 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -66,6 +66,20 @@ #include "llviewertexturelist.h" // +// Constant definitions for comboboxes +// Must match the commbobox definitions in panel_tools_texture.xml +// +const U32 MATMEDIA_MATERIAL = 0; // Material +const U32 MATMEDIA_MEDIA = 1; // Media +const U32 MATTYPE_DIFFUSE = 0; // Diffuse material texture +const U32 MATTYPE_NORMAL = 1; // Normal map +const U32 MATTYPE_SPECULAR = 2; // Specular map +const U32 ALPHAMODE_NONE = 0; // No alpha mask applied +const U32 ALPHAMODE_MASK = 2; // Alpha masking mode +const U32 BUMPY_TEXTURE = 18; // use supplied normal map +const U32 SHINY_TEXTURE = 4; // use supplied specular map + +// // Methods // @@ -75,6 +89,7 @@ BOOL LLPanelFace::postBuild() childSetCommitCallback("combobox mattype",&LLPanelFace::onCommitMaterialType,this); childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); + childSetCommitCallback("combobox alphamode",&LLPanelFace::onCommitAlphaMode,this); childSetCommitCallback("TexScaleU",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexScaleV",&LLPanelFace::onCommitTextureInfo, this); childSetCommitCallback("TexRot",&LLPanelFace::onCommitTextureInfo, this); @@ -492,30 +507,33 @@ void LLPanelFace::getState() BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); // only turn on auto-adjust button if there is a media renderer and the media is loaded - getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); - LLCtrlSelectionInterface* combobox_matmedia = - childGetSelectionInterface("combobox matmedia"); + LLComboBox* combobox_matmedia = getChild<LLComboBox>("combobox matmedia"); if (combobox_matmedia) { - combobox_matmedia->selectNthItem(0); + if (combobox_matmedia->getCurrentIndex() < MATMEDIA_MATERIAL) + { + combobox_matmedia->selectNthItem(MATMEDIA_MATERIAL); + } } else { - llwarns << "failed childGetSelectionInterface for 'combobox matmedia'" << llendl; + llwarns << "failed getChild for 'combobox matmedia'" << llendl; } getChildView("combobox matmedia")->setEnabled(editable); - LLCtrlSelectionInterface* combobox_mattype = - childGetSelectionInterface("combobox mattype"); + LLComboBox* combobox_mattype = getChild<LLComboBox>("combobox mattype"); if (combobox_mattype) { - combobox_mattype->selectNthItem(0); + if (combobox_mattype->getCurrentIndex() < MATTYPE_DIFFUSE) + { + combobox_mattype->selectNthItem(MATTYPE_DIFFUSE); + } } else { - llwarns << "failed childGetSelectionInterface for 'combobox mattype'" << llendl; + llwarns << "failed getChild for 'combobox mattype'" << llendl; } getChildView("combobox mattype")->setEnabled(editable); onCommitMaterialsMedia(NULL, this); @@ -565,12 +583,41 @@ void LLPanelFace::getState() } func; identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, id ); + BOOL is_alpha = FALSE; + struct f2 : public LLSelectedTEGetFunctor<BOOL> + { + BOOL get(LLViewerObject* object, S32 te_index) + { + BOOL is_alpha = FALSE; + + LLViewerTexture* image = object->getTEImage(te_index); + if (image) is_alpha = image->getIsAlphaMask(); + return is_alpha; + } + } func2; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func2, is_alpha ); + if(LLViewerMedia::textureHasMedia(id)) { - getChildView("textbox autofix")->setEnabled(editable); getChildView("button align")->setEnabled(editable); } + if (!is_alpha) + { + // Selected texture has no alpha, force alpha mode None + LLCtrlSelectionInterface* combobox_alphamode = + childGetSelectionInterface("combobox alphamode"); + if (combobox_alphamode) + { + combobox_alphamode->selectNthItem(ALPHAMODE_NONE); + } + else + { + llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; + } + onCommitAlphaMode(getChild<LLComboBox>("combobox alpha"),this); + } + if (identical) { // All selected have the same texture @@ -579,6 +626,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + getChildView("combobox alphamode")->setEnabled(editable && is_alpha); + getChildView("label alphamode")->setEnabled(editable && is_alpha); + getChildView("maskcutoff")->setEnabled(editable && is_alpha); + getChildView("label maskcutoff")->setEnabled(editable && is_alpha); } } else @@ -591,6 +642,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( FALSE ); texture_ctrl->setEnabled( FALSE ); texture_ctrl->setImageAssetID( LLUUID::null ); + getChildView("combobox alphamode")->setEnabled( FALSE ); + getChildView("label alphamode")->setEnabled( FALSE ); + getChildView("maskcutoff")->setEnabled( FALSE); + getChildView("label maskcutoff")->setEnabled( FALSE ); } else { @@ -598,6 +653,10 @@ void LLPanelFace::getState() texture_ctrl->setTentative( TRUE ); texture_ctrl->setEnabled( editable ); texture_ctrl->setImageAssetID( id ); + getChildView("combobox alphamode")->setEnabled(editable && is_alpha); + getChildView("label alphamode")->setEnabled(editable && is_alpha); + getChildView("maskcutoff")->setEnabled(editable && is_alpha); + getChildView("label maskcutoff")->setEnabled(editable && is_alpha); } } } @@ -803,6 +862,15 @@ void LLPanelFace::getState() getChildView("combobox shininess")->setEnabled(editable); getChild<LLUICtrl>("combobox shininess")->setTentative(!identical); getChildView("label shininess")->setEnabled(editable); + getChildView("glossiness")->setEnabled(editable); + getChild<LLUICtrl>("glossiness")->setTentative(!identical); + getChildView("label glossiness")->setEnabled(editable); + getChildView("environment")->setEnabled(editable); + getChild<LLUICtrl>("environment")->setTentative(!identical); + getChildView("label environment")->setEnabled(editable); + getChildView("shinycolorswatch")->setEnabled(editable); + getChild<LLUICtrl>("shinycolorswatch")->setTentative(!identical); + getChildView("label shinycolor")->setEnabled(editable); } { @@ -955,12 +1023,9 @@ void LLPanelFace::getState() getChildView("label shininess")->setEnabled(FALSE); getChildView("label bumpiness")->setEnabled(FALSE); - getChildView("textbox autofix")->setEnabled(FALSE); - getChildView("button align")->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); - // Set variable values for numeric expressions LLCalc* calcp = LLCalc::getInstance(); @@ -1016,30 +1081,50 @@ void LLPanelFace::onSelectColor(const LLSD& data) void LLPanelFace::onCommitMaterialsMedia(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; - LLComboBox* mComboMaterialsMedia = self->getChild<LLComboBox>("combobox matmedia"); - if (!mComboMaterialsMedia) + LLComboBox* comboMaterialsMedia = self->getChild<LLComboBox>("combobox matmedia"); + if (!comboMaterialsMedia) { return; } - U32 materials_media = mComboMaterialsMedia->getCurrentIndex(); - LLComboBox* mComboMaterialType = self->getChild<LLComboBox>("combobox mattype"); - if (!mComboMaterialType) + U32 materials_media = comboMaterialsMedia->getCurrentIndex(); + LLComboBox* comboMaterialType = self->getChild<LLComboBox>("combobox mattype"); + if (!comboMaterialType) { return; } - U32 material_type = mComboMaterialType->getCurrentIndex(); - bool show_media = (materials_media == 1); - bool show_texture = (!show_media) && (material_type == 0); - bool show_bumpiness = (!show_media) && (material_type == 1); - bool show_shininess = (!show_media) && (material_type == 2); + U32 material_type = comboMaterialType->getCurrentIndex(); + bool show_media = (materials_media == MATMEDIA_MEDIA); + bool show_texture = (!show_media) && (material_type == MATTYPE_DIFFUSE); + bool show_bumpiness = (!show_media) && (material_type == MATTYPE_NORMAL); + bool show_shininess = (!show_media) && (material_type == MATTYPE_SPECULAR); self->getChildView("combobox mattype")->setVisible(!show_media); self->getChildView("media_info")->setVisible(show_media); self->getChildView("add_media")->setVisible(show_media); self->getChildView("delete_media")->setVisible(show_media); self->getChildView("button align")->setVisible(show_media); self->getChildView("texture control")->setVisible(show_texture); + self->getChildView("label alphamode")->setVisible(show_texture); + self->getChildView("combobox alphamode")->setVisible(show_texture); + self->getChildView("label maskcutoff")->setVisible(false); + self->getChildView("maskcutoff")->setVisible(false); + if (show_texture) + { + onCommitAlphaMode(ctrl, userdata); + } + self->getChildView("shinytexture control")->setVisible(show_shininess); self->getChildView("combobox shininess")->setVisible(show_shininess); self->getChildView("label shininess")->setVisible(show_shininess); + self->getChildView("label glossiness")->setVisible(false); + self->getChildView("glossiness")->setVisible(false); + self->getChildView("label environment")->setVisible(false); + self->getChildView("environment")->setVisible(false); + self->getChildView("label shinycolor")->setVisible(false); + self->getChildView("shinycolorswatch")->setVisible(false); + if (show_shininess) + { + onCommitShiny(ctrl, userdata); + } + self->getChildView("bumpytexture control")->setVisible(show_bumpiness); self->getChildView("combobox bumpiness")->setVisible(show_bumpiness); self->getChildView("label bumpiness")->setVisible(show_bumpiness); } @@ -1068,10 +1153,38 @@ void LLPanelFace::onCommitTexGen(LLUICtrl* ctrl, void* userdata) void LLPanelFace::onCommitShiny(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; + LLComboBox* comboShiny = self->getChild<LLComboBox>("combobox shininess"); + if (!comboShiny) + { + return; + } + U32 shiny_value = comboShiny->getCurrentIndex(); + bool show_shinyctrls = (shiny_value == SHINY_TEXTURE); // Use texture + self->getChildView("label glossiness")->setVisible(show_shinyctrls); + self->getChildView("glossiness")->setVisible(show_shinyctrls); + self->getChildView("label environment")->setVisible(show_shinyctrls); + self->getChildView("environment")->setVisible(show_shinyctrls); + self->getChildView("label shinycolor")->setVisible(show_shinyctrls); + self->getChildView("shinycolorswatch")->setVisible(show_shinyctrls); self->sendShiny(); } // static +void LLPanelFace::onCommitAlphaMode(LLUICtrl* ctrl, void* userdata) +{ + LLPanelFace* self = (LLPanelFace*) userdata; + LLComboBox* comboAlphaMode = self->getChild<LLComboBox>("combobox alphamode"); + if (!comboAlphaMode) + { + return; + } + U32 alpha_value = comboAlphaMode->getCurrentIndex(); + bool show_alphactrls = (alpha_value == ALPHAMODE_MASK); // Alpha masking + self->getChildView("label maskcutoff")->setVisible(show_alphactrls); + self->getChildView("maskcutoff")->setVisible(show_alphactrls); +} + +// static void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata) { LLPanelFace* self = (LLPanelFace*) userdata; diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index acac2c1bf5..56b4034a2d 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -85,6 +85,7 @@ protected: static void onCommitBump( LLUICtrl* ctrl, void* userdata); static void onCommitTexGen( LLUICtrl* ctrl, void* userdata); static void onCommitShiny( LLUICtrl* ctrl, void* userdata); + static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata); static void onCommitFullbright( LLUICtrl* ctrl, void* userdata); static void onCommitGlow( LLUICtrl* ctrl, void *userdata); static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata); diff --git a/indra/newview/skins/default/xui/en/panel_tools_texture.xml b/indra/newview/skins/default/xui/en/panel_tools_texture.xml index 26b2d83351..21cbf9673d 100644 --- a/indra/newview/skins/default/xui/en/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/en/panel_tools_texture.xml @@ -155,36 +155,36 @@ follows="left|top" height="10" layout="topleft" - name="label shininess" left_pad="10" + name="label alphamode" text_readonly_color="LabelDisabledColor" - top_delta="6" + top_delta="0" width="90"> - Shininess + Alpha mode </text> <combo_box height="23" layout="topleft" - left_pad="10" - name="combobox shininess" - top_delta="-6" - width="90"> + left_delta="0" + name="combobox alphamode" + top_pad="4" + width="120"> <combo_box.item label="None" name="None" value="None" /> <combo_box.item - label="Low" - name="Low" - value="Low" /> + label="Alpha blending" + name="Alpha blending" + value="Alpha blending" /> <combo_box.item - label="Medium" - name="Medium" - value="Medium" /> + label="Alpha masking" + name="Alpha masking" + value="Alpha masking" /> <combo_box.item - label="High" - name="High" - value="High" /> + label="Emissive mask" + name="Emissive mask" + value="Emissive mask" /> </combo_box> <text type="string" @@ -192,7 +192,43 @@ follows="left|top" height="10" layout="topleft" - left_delta="-100" + left_delta="0" + name="label maskcutoff" + text_readonly_color="LabelDisabledColor" + top_pad="4" + width="90"> + Mask cutoff + </text> + <spinner + decimal_digits="3" + follows="left|top" + height="19" + initial_value="0" + layout="topleft" + top_pad="4" + left_delta="0" + name="maskcutoff" + width="80" /> + <texture_picker + can_apply_immediately="true" + default_image_name="Default" + fallback_image="locked_image.j2c" + follows="left|top" + height="80" + label="Texture " + layout="topleft" + left="10" + name="bumpytexture control" + tool_tip="Click to choose a picture" + top_delta="-55" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_pad="10" name="label bumpiness" text_readonly_color="LabelDisabledColor" top_delta="0" @@ -278,13 +314,142 @@ label="weave" name="weave" value="weave" /> + <combo_box.item + label="Use texture" + name="Use texture" + value="Use texture" /> + </combo_box> + <texture_picker + can_apply_immediately="true" + default_image_name="Default" + fallback_image="locked_image.j2c" + follows="left|top" + height="80" + label="Texture " + layout="topleft" + left="10" + name="shinytexture control" + tool_tip="Click to choose a picture" + top_delta="-14" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + name="label shininess" + left_pad="10" + text_readonly_color="LabelDisabledColor" + top_delta="6" + width="90"> + Shininess + </text> + <combo_box + height="23" + layout="topleft" + left_pad="10" + name="combobox shininess" + top_delta="-6" + width="90"> + <combo_box.item + label="None" + name="None" + value="None" /> + <combo_box.item + label="Low" + name="Low" + value="Low" /> + <combo_box.item + label="Medium" + name="Medium" + value="Medium" /> + <combo_box.item + label="High" + name="High" + value="High" /> + <combo_box.item + label="Use texture" + name="Use texture" + value="Use texture" /> </combo_box> <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_delta="-100" + name="label glossiness" + text_readonly_color="LabelDisabledColor" + top_pad="8" + width="116"> + Glossiness + </text> + <spinner + decimal_digits="3" + follows="left|top" + height="19" + initial_value="0" + layout="topleft" + top_delta="-4" + left_pad="10" + name="glossiness" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_delta="-126" + name="label environment" + text_readonly_color="LabelDisabledColor" + top_pad="8" + width="116"> + Environment + </text> + <spinner + decimal_digits="3" + follows="left|top" + height="19" + initial_value="0" + layout="topleft" + top_delta="-4" + left_pad="10" + name="environment" + width="64" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left_delta="-126" + name="label shinycolor" + text_readonly_color="LabelDisabledColor" + top_pad="8" + width="116"> + Color + </text> + <!-- label is blank because control places it below the box --> + <color_swatch + can_apply_immediately="true" + follows="left|top" + height="45" + label="" + layout="topleft" + left_pad="10" + name="shinycolorswatch" + tool_tip="Click to open color picker" + top_delta="-4" + width="64" /> + <text follows="left|top|right" height="9" layout="topleft" left="10" - top_delta="-8" + top_delta="-50" use_ellipses="true" read_only="true" name="media_info" @@ -370,14 +535,6 @@ name="TexScaleU" top_pad="5" width="265" /> - <!-- <check_box - height="19" - label="Flip" - layout="topleft" - left_pad="5" - name="checkbox flip s" - top_delta="0" - width="70" /> --> <spinner follows="left|top" height="19" @@ -390,14 +547,6 @@ max_val="100" name="TexScaleV" width="265" /> - <!-- <check_box - height="19" - label="Flip" - layout="topleft" - left_pad="5" - name="checkbox flip t" - top_delta="0" - width="70" /> --> <spinner decimal_digits="1" follows="left|top" @@ -411,16 +560,7 @@ min_val="0.1" name="rptctrl" width="265" /> - <!-- <button - follows="left|top" - height="19" - label="Apply" - label_selected="Apply" - layout="topleft" - left_pad="5" - name="button apply" - width="75" /> --> - <spinner + <spinner decimal_digits="2" follows="left|top" height="19" |