summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-09-15 19:07:17 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-09-15 21:38:45 +0300
commit41d9d0dfe8b7a341b18951d562643aba5f73323a (patch)
treed97fed617616eb0734018931c39c76f150f69522 /indra
parente400a2f20031da67a228b0d23aea31756beca754 (diff)
#3988 Add a toggle for sculpty area validation
for QA purposes
Diffstat (limited to 'indra')
-rw-r--r--indra/llmath/llvolume.cpp8
-rw-r--r--indra/llmath/llvolume.h2
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llfloaterimagepreview.cpp3
-rw-r--r--indra/newview/llvovolume.cpp3
5 files changed, 20 insertions, 7 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index ece52db1b1..28ce4ef4b0 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -3289,7 +3289,7 @@ S32 sculpt_sides(F32 detail)
}
}
-static bool validate_sculpt_geometry(const LLVolume* volume)
+static bool validate_sculpt_geometry(const LLVolume* volume, bool validate_area)
{
if (!volume || volume->getNumVolumeFaces() == 0)
{
@@ -3365,7 +3365,7 @@ static bool validate_sculpt_geometry(const LLVolume* volume)
F32 area_ratio = total_triangle_area / bounding_surface;
constexpr F32 MAX_AREA_TO_AREA_RATIO = 16.0f;
- if (area_ratio > MAX_AREA_TO_AREA_RATIO)
+ if (validate_area && area_ratio > MAX_AREA_TO_AREA_RATIO)
{
LL_DEBUGS("LLVOLUME") << "Sculpt rejected: excessive triangle area."
<< " Face index: " << face_idx
@@ -3417,7 +3417,7 @@ static void sculpt_calc_mesh_resolution(U16 width, U16 height, U8 type, F32 deta
}
// sculpt replaces generate() for sculpted surfaces
-void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder)
+void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder, bool validate_area)
{
U8 sculpt_type = mParams.getSculptType();
@@ -3528,7 +3528,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
// Todo: can this be backed into createVolumeFaces?
// Or calculated without having to call createVolumeFaces first?
// Todo 2: should the same be done for meshes?
- valid_geometry = validate_sculpt_geometry(this);
+ valid_geometry = validate_sculpt_geometry(this, validate_area);
mSculptValidationCache[sculpt_level] = valid_geometry ? LLSculptValidationState::Valid : LLSculptValidationState::Invalid;
if (!valid_geometry)
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index 86a7bf0e6a..40e6f8e220 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -1095,7 +1095,7 @@ public:
U32 mFaceMask; // bit array of which faces exist in this volume
LLVector3 mLODScaleBias; // vector for biasing LOD based on scale
- void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder);
+ void sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level, bool visible_placeholder, bool validate_area);
void copyVolumeFaces(const LLVolume* volume);
void copyFacesTo(std::vector<LLVolumeFace> &faces) const;
void copyFacesFrom(const std::vector<LLVolumeFace> &faces);
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 459f8c1b42..85100254bc 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -15953,6 +15953,17 @@
<key>Value</key>
<integer>1000</integer>
</map>
+ <key>ValidateSculptyAreaRatio</key>
+ <map>
+ <key>Comment</key>
+ <string>Version information generated by running the viewer</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>VersionChannelName</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index bbff3e4c86..116286c872 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -926,8 +926,9 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
if (imagep)
{
+ static LLCachedControl<bool> validate_area(gSavedSettings, "ValidateSculptyAreaRatio", true);
LLImageDataSharedLock lock(imagep);
- mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0, false);
+ mVolume->sculpt(imagep->getWidth(), imagep->getHeight(), imagep->getComponents(), imagep->getData(), 0, false, validate_area());
}
const LLVolumeFace &vf = mVolume->getVolumeFace(0);
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 076e5eb22e..4a2d2da10c 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1444,7 +1444,8 @@ void LLVOVolume::sculpt()
}
}
- getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset());
+ static LLCachedControl<bool> validate_area(gSavedSettings, "ValidateSculptyAreaRatio", true);
+ getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset(), validate_area());
}
}