diff options
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r-- | indra/newview/llpanelface.cpp | 237 |
1 files changed, 141 insertions, 96 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 9761c6ae10..50a1bbc8f3 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -263,7 +263,7 @@ F32 LLPanelFace::getCurrentShinyOffsetV() { return getChild<LLUICtrl>( // Methods // -BOOL LLPanelFace::postBuild() +bool LLPanelFace::postBuild() { childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this); childSetCommitCallback("combobox bumpiness",&LLPanelFace::onCommitBump,this); @@ -322,7 +322,7 @@ BOOL LLPanelFace::postBuild() LLSpinCtrl* mCtrlGlow; - setMouseOpaque(FALSE); + setMouseOpaque(false); LLTextureCtrl* pbr_ctrl = findChild<LLTextureCtrl>("pbr_control"); if (pbr_ctrl) @@ -404,7 +404,7 @@ BOOL LLPanelFace::postBuild() mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2)); mColorSwatch->setFollowsTop(); mColorSwatch->setFollowsLeft(); - mColorSwatch->setCanApplyImmediately(TRUE); + mColorSwatch->setCanApplyImmediately(true); } mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch"); @@ -415,7 +415,7 @@ BOOL LLPanelFace::postBuild() mShinyColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectShinyColor, this, _2)); mShinyColorSwatch->setFollowsTop(); mShinyColorSwatch->setFollowsLeft(); - mShinyColorSwatch->setCanApplyImmediately(TRUE); + mShinyColorSwatch->setCanApplyImmediately(true); } mLabelColorTransp = getChild<LLTextBox>("color trans"); @@ -482,7 +482,7 @@ BOOL LLPanelFace::postBuild() clearCtrls(); - return TRUE; + return true; } LLPanelFace::LLPanelFace() @@ -503,7 +503,7 @@ LLPanelFace::~LLPanelFace() unloadMedia(); } -void LLPanelFace::onVisibilityChange(BOOL new_visibility) +void LLPanelFace::onVisibilityChange(bool new_visibility) { if (new_visibility) { @@ -655,7 +655,7 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {} virtual bool apply(LLViewerObject* object, S32 te) { - BOOL valid; + bool valid; F32 value; std::string prefix; @@ -1021,8 +1021,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) && objectp->getPCode() == LL_PCODE_VOLUME && objectp->permModify()) { - BOOL editable = objectp->permModify() && !objectp->isPermanentEnforced(); - BOOL attachment = objectp->isAttachment(); + bool editable = objectp->permModify() && !objectp->isPermanentEnforced(); + bool attachment = objectp->isAttachment(); bool has_pbr_material; bool has_faces_without_pbr; @@ -1237,27 +1237,35 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) // Texture { - mIsAlpha = FALSE; LLGLenum image_format = GL_RGB; bool identical_image_format = false; - LLSelectedTE::getImageFormat(image_format, identical_image_format); + bool missing_asset = false; + LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); - mIsAlpha = FALSE; - switch (image_format) + if (!missing_asset) { + mIsAlpha = false; + switch (image_format) + { case GL_RGBA: case GL_ALPHA: - { - mIsAlpha = TRUE; - } - break; + { + mIsAlpha = true; + } + break; case GL_RGB: break; default: - { - LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; + { + LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; + } + break; } - break; + } + else + { + // Don't know image's properties, use material's mode value + mIsAlpha = true; } if (LLViewerMedia::getInstance()->textureHasMedia(id)) @@ -1300,41 +1308,45 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) { if (identical_diffuse) { - texture_ctrl->setTentative(FALSE); + texture_ctrl->setTentative(false); texture_ctrl->setEnabled(editable && !has_pbr_material); texture_ctrl->setImageAssetID(id); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - texture_ctrl->setBakeTextureEnabled(TRUE); + bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; + getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); + getChildView("label alphamode")->setEnabled(can_change_alpha); + getChildView("maskcutoff")->setEnabled(can_change_alpha); + getChildView("label maskcutoff")->setEnabled(can_change_alpha); + + texture_ctrl->setBakeTextureEnabled(true); } else if (id.isNull()) { // None selected - texture_ctrl->setTentative(FALSE); - texture_ctrl->setEnabled(FALSE); + 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); + getChildView("combobox alphamode")->setEnabled(false); + getChildView("label alphamode")->setEnabled(false); + getChildView("maskcutoff")->setEnabled(false); + getChildView("label maskcutoff")->setEnabled(false); texture_ctrl->setBakeTextureEnabled(false); } else { // Tentative: multiple selected with different textures - texture_ctrl->setTentative(TRUE); + texture_ctrl->setTentative(true); texture_ctrl->setEnabled(editable && !has_pbr_material); texture_ctrl->setImageAssetID(id); - getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f && !has_pbr_material); - getChildView("label alphamode")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha && !has_pbr_material); - texture_ctrl->setBakeTextureEnabled(TRUE); + bool can_change_alpha = editable && mIsAlpha && !missing_asset && !has_pbr_material; + getChildView("combobox alphamode")->setEnabled(can_change_alpha && transparency <= 0.f); + getChildView("label alphamode")->setEnabled(can_change_alpha); + getChildView("maskcutoff")->setEnabled(can_change_alpha); + getChildView("label maskcutoff")->setEnabled(can_change_alpha); + + texture_ctrl->setBakeTextureEnabled(true); } if (attachment) @@ -1454,9 +1466,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("shinyScaleU")->setEnabled(editable && has_material && specmap_id.notNull()); getChildView("bumpyScaleU")->setEnabled(editable && has_material && normmap_id.notNull()); - BOOL diff_scale_tentative = !(identical && identical_diff_scale_s); - BOOL norm_scale_tentative = !(identical && identical_norm_scale_s); - BOOL spec_scale_tentative = !(identical && identical_spec_scale_s); + bool diff_scale_tentative = !(identical && identical_diff_scale_s); + bool norm_scale_tentative = !(identical && identical_norm_scale_s); + bool spec_scale_tentative = !(identical && identical_spec_scale_s); getChild<LLUICtrl>("TexScaleU")->setTentative( LLSD(diff_scale_tentative)); getChild<LLUICtrl>("shinyScaleU")->setTentative(LLSD(spec_scale_tentative)); @@ -1485,9 +1497,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) spec_scale_t = editable ? spec_scale_t : 1.0f; spec_scale_t *= identical_planar_texgen ? 2.0f : 1.0f; - BOOL diff_scale_tentative = !identical_diff_scale_t; - BOOL norm_scale_tentative = !identical_norm_scale_t; - BOOL spec_scale_tentative = !identical_spec_scale_t; + bool diff_scale_tentative = !identical_diff_scale_t; + bool norm_scale_tentative = !identical_norm_scale_t; + bool spec_scale_tentative = !identical_spec_scale_t; getChildView("TexScaleV")->setEnabled(editable && has_material); getChildView("shinyScaleV")->setEnabled(editable && has_material && specmap_id.notNull()); @@ -1523,9 +1535,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getNormalOffsetX(norm_offset_s, identical_norm_offset_s); LLSelectedTEMaterial::getSpecularOffsetX(spec_offset_s, identical_spec_offset_s); - BOOL diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s); - BOOL norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s); - BOOL spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s); + bool diff_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_s); + bool norm_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_s); + bool spec_offset_u_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_s); getChild<LLUICtrl>("TexOffsetU")->setValue( editable ? diff_offset_s : 0.0f); getChild<LLUICtrl>("bumpyOffsetU")->setValue(editable ? norm_offset_s : 0.0f); @@ -1553,9 +1565,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getNormalOffsetY(norm_offset_t, identical_norm_offset_t); LLSelectedTEMaterial::getSpecularOffsetY(spec_offset_t, identical_spec_offset_t); - BOOL diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t); - BOOL norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t); - BOOL spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t); + bool diff_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_diff_offset_t); + bool norm_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_norm_offset_t); + bool spec_offset_v_tentative = !(align_planar ? identical_planar_aligned : identical_spec_offset_t); getChild<LLUICtrl>("TexOffsetV")->setValue( editable ? diff_offset_t : 0.0f); getChild<LLUICtrl>("bumpyOffsetV")->setValue(editable ? norm_offset_t : 0.0f); @@ -1584,9 +1596,9 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) LLSelectedTEMaterial::getSpecularRotation(spec_rotation,identical_spec_rotation); LLSelectedTEMaterial::getNormalRotation(norm_rotation,identical_norm_rotation); - BOOL diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation); - BOOL norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation); - BOOL spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation); + bool diff_rot_tentative = !(align_planar ? identical_planar_aligned : identical_diff_rotation); + bool norm_rot_tentative = !(align_planar ? identical_planar_aligned : identical_norm_rotation); + bool spec_rot_tentative = !(align_planar ? identical_planar_aligned : identical_spec_rotation); F32 diff_rot_deg = diff_rotation * RAD_TO_DEG; F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; @@ -1715,7 +1727,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) break; } - BOOL repeats_tentative = !identical_repeats; + bool repeats_tentative = !identical_repeats; LLSpinCtrl* rpt_ctrl = getChild<LLSpinCtrl>("rptctrl"); if (force_set_values) @@ -1837,7 +1849,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } } S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - BOOL single_volume = (selected_count == 1); + bool single_volume = (selected_count == 1); mMenuClipboardColor->setEnabled(editable && single_volume); // Set variable values for numeric expressions @@ -1860,36 +1872,36 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (pbr_ctrl) { pbr_ctrl->setImageAssetID(LLUUID::null); - pbr_ctrl->setEnabled(FALSE); + pbr_ctrl->setEnabled(false); } LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); if (texture_ctrl) { texture_ctrl->setImageAssetID( LLUUID::null ); - texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. -// texture_ctrl->setValid(FALSE); + texture_ctrl->setEnabled( false ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl. +// texture_ctrl->setValid(false); } LLColorSwatchCtrl* mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); if (mColorSwatch) { - mColorSwatch->setEnabled( FALSE ); + mColorSwatch->setEnabled( false ); mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") ); - mColorSwatch->setValid(FALSE); + mColorSwatch->setValid(false); } LLRadioGroup* radio_mat_type = getChild<LLRadioGroup>("radio_material_type"); if (radio_mat_type) { radio_mat_type->setSelectedIndex(0); } - getChildView("color trans")->setEnabled(FALSE); - getChildView("rptctrl")->setEnabled(FALSE); - getChildView("tex gen")->setEnabled(FALSE); - getChildView("label shininess")->setEnabled(FALSE); - getChildView("label bumpiness")->setEnabled(FALSE); - getChildView("button align")->setEnabled(FALSE); - getChildView("pbr_from_inventory")->setEnabled(FALSE); - getChildView("edit_selected_pbr")->setEnabled(FALSE); - getChildView("save_selected_pbr")->setEnabled(FALSE); + getChildView("color trans")->setEnabled(false); + getChildView("rptctrl")->setEnabled(false); + getChildView("tex gen")->setEnabled(false); + getChildView("label shininess")->setEnabled(false); + getChildView("label bumpiness")->setEnabled(false); + getChildView("button align")->setEnabled(false); + getChildView("pbr_from_inventory")->setEnabled(false); + getChildView("edit_selected_pbr")->setEnabled(false); + getChildView("save_selected_pbr")->setEnabled(false); updateVisibility(); @@ -1999,7 +2011,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); - pbr_ctrl->setTentative(identical_pbr ? FALSE : TRUE); + pbr_ctrl->setTentative(!identical_pbr); pbr_ctrl->setEnabled(settable); pbr_ctrl->setImageAssetID(pbr_id); @@ -2115,7 +2127,7 @@ void LLPanelFace::refreshMedia() && first_object->permModify() )) { - getChildView("add_media")->setEnabled(FALSE); + getChildView("add_media")->setEnabled(false); mTitleMediaText->clear(); clearMediaSettings(); return; @@ -2126,13 +2138,13 @@ void LLPanelFace::refreshMedia() if (!has_media_capability) { - getChildView("add_media")->setEnabled(FALSE); + getChildView("add_media")->setEnabled(false); LL_WARNS("LLFloaterToolsMedia") << "Media not enabled (no capability) in this region!" << LL_ENDL; clearMediaSettings(); return; } - BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() + bool is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); bool editable = is_nonpermanent_enforced && (first_object->permModify() || selectedMediaEditable()); @@ -2252,7 +2264,7 @@ void LLPanelFace::refreshMedia() } } - getChildView("delete_media")->setEnabled(TRUE); + getChildView("delete_media")->setEnabled(true); } U32 materials_media = mComboMatMedia->getCurrentIndex(); @@ -2496,7 +2508,7 @@ void LLPanelFace::updateMediaSettings() // Auto play //value_bool = default_media_data.getAutoPlay(); - // set default to auto play TRUE -- angela EXT-5172 + // set default to auto play true -- angela EXT-5172 value_bool = true; struct functor_getter_auto_play : public LLSelectedTEGetFunctor< bool > { @@ -2508,7 +2520,7 @@ void LLPanelFace::updateMediaSettings() if (object->getTE(face)) if (object->getTE(face)->getMediaData()) return object->getTE(face)->getMediaData()->getAutoPlay(); - //return mMediaEntry.getAutoPlay(); set default to auto play TRUE -- angela EXT-5172 + //return mMediaEntry.getAutoPlay(); set default to auto play true -- angela EXT-5172 return true; }; @@ -2522,7 +2534,7 @@ void LLPanelFace::updateMediaSettings() // Auto scale - // set default to auto scale TRUE -- angela EXT-5172 + // set default to auto scale true -- angela EXT-5172 //value_bool = default_media_data.getAutoScale(); value_bool = true; struct functor_getter_auto_scale : public LLSelectedTEGetFunctor< bool > @@ -2535,7 +2547,7 @@ void LLPanelFace::updateMediaSettings() if (object->getTE(face)) if (object->getTE(face)->getMediaData()) return object->getTE(face)->getMediaData()->getAutoScale(); - // return mMediaEntry.getAutoScale(); set default to auto scale TRUE -- angela EXT-5172 + // return mMediaEntry.getAutoScale(); set default to auto scale true -- angela EXT-5172 return true; }; @@ -3220,9 +3232,9 @@ void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata) } // static -BOOL LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) { - BOOL accept = TRUE; + bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { @@ -3230,7 +3242,7 @@ BOOL LLPanelFace::onDragPbr(LLUICtrl*, LLInventoryItem* item) LLViewerObject* obj = node->getObject(); if (!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item)) { - accept = FALSE; + accept = false; break; } } @@ -3286,9 +3298,9 @@ void LLPanelFace::onSelectPbr(const LLSD& data) } // static -BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) +bool LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) { - BOOL accept = TRUE; + bool accept = true; for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++) { @@ -3296,7 +3308,7 @@ BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) LLViewerObject* obj = node->getObject(); if (!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item)) { - accept = FALSE; + accept = false; break; } } @@ -3321,13 +3333,14 @@ void LLPanelFace::onSelectTexture(const LLSD& data) LLGLenum image_format; bool identical_image_format = false; - LLSelectedTE::getImageFormat(image_format, identical_image_format); + bool missing_asset = false; + LLSelectedTE::getImageFormat(image_format, identical_image_format, missing_asset); LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); U32 alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - if (combobox_alphamode) + if (combobox_alphamode && !missing_asset) { switch (image_format) { @@ -4682,7 +4695,7 @@ void LLPanelFace::onPasteTexture(LLViewerObject* objectp, S32 te) else if (full_perm) { // Either library, local or existed as fullperm when user made a copy - LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(imageid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(imageid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); objectp->setTEImage(U8(te), image); } } @@ -5227,19 +5240,51 @@ void LLPanelFace::LLSelectedTE::getFace(LLFace*& face_to_return, bool& identical identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_te_face_func, face_to_return, false, (LLFace*)nullptr); } -void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face) +void LLPanelFace::LLSelectedTE::getImageFormat(LLGLenum& image_format_to_return, bool& identical_face, bool& missing_asset) { - LLGLenum image_format; - struct LLSelectedTEGetImageFormat : public LLSelectedTEGetFunctor<LLGLenum> + struct LLSelectedTEGetmatId : public LLSelectedTEFunctor { - LLGLenum get(LLViewerObject* object, S32 te_index) + LLSelectedTEGetmatId() + : mImageFormat(GL_RGB) + , mIdentical(true) + , mMissingAsset(false) + , mFirstRun(true) { - LLViewerTexture* image = object->getTEImage(te_index); - return image ? image->getPrimaryFormat() : GL_RGB; } - } get_glenum; - identical_face = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&get_glenum, image_format); - image_format_to_return = image_format; + bool apply(LLViewerObject* object, S32 te_index) override + { + LLViewerTexture* image = object ? object->getTEImage(te_index) : nullptr; + LLGLenum format = GL_RGB; + bool missing = false; + if (image) + { + format = image->getPrimaryFormat(); + missing = image->isMissingAsset(); + } + + if (mFirstRun) + { + mFirstRun = false; + mImageFormat = format; + mMissingAsset = missing; + } + else + { + mIdentical &= (mImageFormat == format); + mIdentical &= (mMissingAsset == missing); + } + return true; + } + LLGLenum mImageFormat; + bool mIdentical; + bool mMissingAsset; + bool mFirstRun; + } func; + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func); + + image_format_to_return = func.mImageFormat; + identical_face = func.mIdentical; + missing_asset = func.mMissingAsset; } void LLPanelFace::LLSelectedTE::getTexId(LLUUID& id, bool& identical) |