From 9a38ecee8ef54b3e85a88657d7ba96c3292e350e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 3 Jul 2024 15:34:03 +0300 Subject: viewer#1131 gltf model upload UI WIP #4 Hooked selection to tree view --- indra/newview/llselectmgr.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llselectmgr.cpp') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index b3420f9c57..17f968b921 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -56,6 +56,7 @@ #include "llattachmentsmgr.h" #include "llviewerwindow.h" #include "lldrawable.h" +#include "llfloatergltfasseteditor.h" #include "llfloaterinspect.h" #include "llfloaterreporter.h" #include "llfloaterreg.h" @@ -467,6 +468,11 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S3 if (object->isSelected() ) { // make sure point at position is updated updatePointAt(); + LLSelectNode* nodep = mSelectedObjects->findNode(object); + if (nodep) + { + nodep->selectGLTFNode(gltf_node, gltf_primitive, true); + } gEditMenuHandler = this; return NULL; } @@ -7187,6 +7193,12 @@ void dialog_refresh_all() { panel_task_info->dirty(); } + + LLFloaterGLTFAssetEditor * gltf_editor = LLFloaterReg::getTypedInstance("gltf_asset_editor"); + if (gltf_editor) + { + gltf_editor->dirty(); + } } S32 get_family_count(LLViewerObject *parent) -- cgit v1.2.3 From 22782a0c68e0d310f65c80cca47daec9b7b23f2b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 8 Jul 2024 13:11:07 +0300 Subject: viewer#1131 Fix gltf editor being a bit spamy --- indra/newview/llselectmgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llselectmgr.cpp') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 17f968b921..70356e8e96 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -7194,7 +7194,7 @@ void dialog_refresh_all() panel_task_info->dirty(); } - LLFloaterGLTFAssetEditor * gltf_editor = LLFloaterReg::getTypedInstance("gltf_asset_editor"); + LLFloaterGLTFAssetEditor * gltf_editor = LLFloaterReg::findTypedInstance("gltf_asset_editor"); if (gltf_editor) { gltf_editor->dirty(); -- cgit v1.2.3 From 21f40280eca12bca53e9894f01cac2e205bb2827 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 9 Jul 2024 10:42:49 +0300 Subject: viewer#1299 PBR texture stretches when "stretch textures" is unchecked --- indra/newview/llselectmgr.cpp | 80 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 3 deletions(-) (limited to 'indra/newview/llselectmgr.cpp') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 70356e8e96..fcd1c84ba4 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -3058,7 +3058,7 @@ void LLSelectMgr::adjustTexturesByScale(bool send_to_sim, bool stretch) for (U8 te_num = 0; te_num < object->getNumTEs(); te_num++) { - const LLTextureEntry* tep = object->getTE(te_num); + LLTextureEntry* tep = object->getTE(te_num); bool planar = tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR; if (planar == stretch) @@ -3092,8 +3092,6 @@ void LLSelectMgr::adjustTexturesByScale(bool send_to_sim, bool stretch) object->setTEScale(te_num, diffuse_scale_s, diffuse_scale_t); - LLTextureEntry* tep = object->getTE(te_num); - if (tep && !tep->getMaterialParams().isNull()) { LLMaterialPtr orig = tep->getMaterialParams(); @@ -3131,6 +3129,47 @@ void LLSelectMgr::adjustTexturesByScale(bool send_to_sim, bool stretch) LLMaterialMgr::getInstance()->put(object->getID(), te_num, *p); } } + + if (tep->getGLTFMaterial()) + { + LLPointer material = tep->getGLTFMaterialOverride(); + if (!material) + { + material = new LLGLTFMaterial(); + tep->setGLTFMaterialOverride(material); + } + + F32 scale_x = 1; + F32 scale_y = 1; + + for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i) + { + LLVector3 scale_ratio = selectNode->mGLTFScaleRatios[te_num][i]; + + if (planar) + { + scale_x = scale_ratio.mV[s_axis] / object_scale.mV[s_axis]; + scale_y = scale_ratio.mV[t_axis] / object_scale.mV[t_axis]; + } + else + { + scale_x = scale_ratio.mV[s_axis] * object_scale.mV[s_axis]; + scale_y = scale_ratio.mV[t_axis] * object_scale.mV[t_axis]; + } + material->mTextureTransform[i].mScale.set(scale_x, scale_y); + } + + LLFetchedGLTFMaterial* render_mat = (LLFetchedGLTFMaterial*)tep->getGLTFRenderMaterial(); + if (render_mat) + { + render_mat->applyOverride(*material); + } + + if (send_to_sim) + { + LLGLTFMaterialList::queueModify(object, te_num, material); + } + } send = send_to_sim; } } @@ -6854,6 +6893,7 @@ void LLSelectNode::saveGLTFMaterials(const uuid_vec_t& materials, const gltf_mat void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) { mTextureScaleRatios.clear(); + mGLTFScaleRatios.clear(); if (mObject.notNull()) { @@ -6888,6 +6928,40 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) v.mV[t_axis] = diffuse_t/scale.mV[t_axis]; mTextureScaleRatios.push_back(v); } + + LLGLTFMaterial* material = tep->getGLTFMaterialOverride(); + LLVector3 material_v; + F32 scale_x = 1; + F32 scale_y = 1; + std::vector material_v_vec; + for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i) + { + if (material) + { + LLGLTFMaterial::TextureTransform& transform = material->mTextureTransform[i]; + scale_x = transform.mScale[VX]; + scale_y = transform.mScale[VY]; + } + else + { + // Not having an override doesn't mean that there is no material + scale_x = 1; + scale_y = 1; + } + + if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR) + { + material_v.mV[s_axis] = scale_x * scale.mV[s_axis]; + material_v.mV[t_axis] = scale_y * scale.mV[t_axis]; + } + else + { + material_v.mV[s_axis] = scale_x / scale.mV[s_axis]; + material_v.mV[t_axis] = scale_y / scale.mV[t_axis]; + } + material_v_vec.push_back(material_v); + } + mGLTFScaleRatios.push_back(material_v_vec); } } } -- cgit v1.2.3 From 874794ea584588457dfde7ef17c447e2a0eb46bb Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Sun, 4 Aug 2024 21:00:10 -0400 Subject: Add LLUIColorTable debug-settings-like floater for easing skin design --- indra/newview/llselectmgr.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'indra/newview/llselectmgr.cpp') diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index fcd1c84ba4..342048252f 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -128,12 +128,12 @@ F32 LLSelectMgr::sHighlightAlpha = 0.f; F32 LLSelectMgr::sHighlightAlphaTest = 0.f; F32 LLSelectMgr::sHighlightUAnim = 0.f; F32 LLSelectMgr::sHighlightVAnim = 0.f; -LLColor4 LLSelectMgr::sSilhouetteParentColor; -LLColor4 LLSelectMgr::sSilhouetteChildColor; -LLColor4 LLSelectMgr::sHighlightInspectColor; -LLColor4 LLSelectMgr::sHighlightParentColor; -LLColor4 LLSelectMgr::sHighlightChildColor; -LLColor4 LLSelectMgr::sContextSilhouetteColor; +LLUIColor LLSelectMgr::sSilhouetteParentColor; +LLUIColor LLSelectMgr::sSilhouetteChildColor; +LLUIColor LLSelectMgr::sHighlightInspectColor; +LLUIColor LLSelectMgr::sHighlightParentColor; +LLUIColor LLSelectMgr::sHighlightChildColor; +LLUIColor LLSelectMgr::sContextSilhouetteColor; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // struct LLDeRezInfo @@ -6437,8 +6437,10 @@ void LLSelectMgr::renderSilhouettes(bool for_hud) bool wireframe_selection = (gFloaterTools && gFloaterTools->getVisible()) || LLSelectMgr::sRenderHiddenSelections; F32 fogCfx = (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() - gAgentCamera.getCameraPositionGlobal()).magVec() / (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4), 0.0, 1.0); - static LLColor4 sParentColor = LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha); - static LLColor4 sChildColor = LLColor4(sSilhouetteChildColor[VRED], sSilhouetteChildColor[VGREEN], sSilhouetteChildColor[VBLUE], LLSelectMgr::sHighlightAlpha); + LLColor4 sParentColor = sSilhouetteParentColor; + sParentColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; + LLColor4 sChildColor = sSilhouetteChildColor; + sChildColor.mV[VALPHA] = LLSelectMgr::sHighlightAlpha; auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor) { @@ -8006,12 +8008,9 @@ S32 LLObjectSelection::getSelectedObjectRenderCost() cost += object->getRenderCost(textures); computed_objects.insert(object->getID()); - const_child_list_t children = object->getChildren(); - for (const_child_list_t::const_iterator child_iter = children.begin(); - child_iter != children.end(); - ++child_iter) + const const_child_list_t& children = object->getChildren(); + for (LLViewerObject* child_obj : children) { - LLViewerObject* child_obj = *child_iter; LLVOVolume *child = dynamic_cast( child_obj ); if (child) { -- cgit v1.2.3