summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdoc/contributions.txt2
-rw-r--r--indra/llcharacter/lljoint.cpp4
-rw-r--r--indra/llcharacter/lljoint.h4
-rw-r--r--indra/llprimitive/llmodelloader.cpp38
-rw-r--r--indra/llprimitive/llmodelloader.h18
-rw-r--r--indra/llui/llscrolllistctrl.cpp3
-rw-r--r--indra/llui/llscrolllistctrl.h1
-rw-r--r--indra/llui/lltabcontainer.cpp4
-rw-r--r--indra/llui/lltabcontainer.h6
-rw-r--r--indra/llui/lltextbase.cpp12
-rw-r--r--indra/llui/lltextbase.h2
-rw-r--r--indra/newview/CMakeLists.txt1
-rw-r--r--indra/newview/app_settings/settings.xml199
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/previewV.glsl6
-rw-r--r--indra/newview/lldynamictexture.cpp15
-rw-r--r--indra/newview/llfloatermodelpreview.cpp893
-rw-r--r--indra/newview/llfloatermodelpreview.h36
-rw-r--r--indra/newview/lljointoverridedata.h53
-rw-r--r--indra/newview/llvoavatar.cpp50
-rw-r--r--indra/newview/llvoavatar.h26
-rw-r--r--indra/newview/pipeline.cpp6
-rw-r--r--indra/newview/skins/default/xui/en/floater_model_preview.xml550
22 files changed, 1540 insertions, 389 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index ca2e63cf9f..69efb1a824 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -259,6 +259,8 @@ Benja Kepler
VWR-746
Benjamin Bigdipper
Beth Walcher
+Beq Janus
+ SL-10288
Bezilon Kasei
Biancaluce Robbiani
CT-225
diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp
index e2f512f86e..441ef1a352 100644
--- a/indra/llcharacter/lljoint.cpp
+++ b/indra/llcharacter/lljoint.cpp
@@ -510,7 +510,7 @@ void LLJoint::clearAttachmentPosOverrides()
// getAllAttachmentPosOverrides()
//--------------------------------------------------------------------
void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
- std::set<LLVector3>& distinct_pos_overrides)
+ std::set<LLVector3>& distinct_pos_overrides) const
{
num_pos_overrides = m_attachmentPosOverrides.count();
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentPosOverrides.getMap().begin();
@@ -524,7 +524,7 @@ void LLJoint::getAllAttachmentPosOverrides(S32& num_pos_overrides,
// getAllAttachmentScaleOverrides()
//--------------------------------------------------------------------
void LLJoint::getAllAttachmentScaleOverrides(S32& num_scale_overrides,
- std::set<LLVector3>& distinct_scale_overrides)
+ std::set<LLVector3>& distinct_scale_overrides) const
{
num_scale_overrides = m_attachmentScaleOverrides.count();
LLVector3OverrideMap::map_type::const_iterator it = m_attachmentScaleOverrides.getMap().begin();
diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h
index 8112d246f2..6f69786f53 100644
--- a/indra/llcharacter/lljoint.h
+++ b/indra/llcharacter/lljoint.h
@@ -287,9 +287,9 @@ public:
void showAttachmentScaleOverrides(const std::string& av_info) const;
void getAllAttachmentPosOverrides(S32& num_pos_overrides,
- std::set<LLVector3>& distinct_pos_overrides);
+ std::set<LLVector3>& distinct_pos_overrides) const;
void getAllAttachmentScaleOverrides(S32& num_scale_overrides,
- std::set<LLVector3>& distinct_scale_overrides);
+ std::set<LLVector3>& distinct_scale_overrides) const;
// These are used in checks of whether a pos/scale override is considered significant.
bool aboveJointPosThreshold(const LLVector3& pos) const;
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index 4e468ff45f..5171621007 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -127,7 +127,7 @@ LLModelLoader::LLModelLoader(
, mStateCallback(state_cb)
, mOpaqueData(opaque_userdata)
, mRigValidJointUpload(true)
-, mLegacyRigValid(true)
+, mLegacyRigFlags(0)
, mNoNormalize(false)
, mNoOptimize(false)
, mCacheOnlyHitIfRigged(false)
@@ -136,6 +136,7 @@ LLModelLoader::LLModelLoader(
{
assert_main_thread();
sActiveLoaderList.push_back(this) ;
+ mWarningsArray = LLSD::emptyArray();
}
LLModelLoader::~LLModelLoader()
@@ -146,6 +147,7 @@ LLModelLoader::~LLModelLoader()
void LLModelLoader::run()
{
+ mWarningsArray.clear();
doLoadModel();
doOnIdleOneTime(boost::bind(&LLModelLoader::loadModelCallback,this));
}
@@ -387,7 +389,7 @@ void LLModelLoader::critiqueRigForUploadApplicability( const std::vector<std::st
//2. It is suitable for upload as standard av with just skin weights
bool isJointPositionUploadOK = isRigSuitableForJointPositionUpload( jointListFromAsset );
- bool isRigLegacyOK = isRigLegacy( jointListFromAsset );
+ U32 legacy_rig_flags = determineRigLegacyFlags( jointListFromAsset );
// It's OK that both could end up being true.
@@ -401,19 +403,16 @@ void LLModelLoader::critiqueRigForUploadApplicability( const std::vector<std::st
setRigValidForJointPositionUpload( false );
}
- if ( !isRigLegacyOK)
- {
- // This starts out true, becomes false if false for any loaded
- // mesh.
- setLegacyRigValid( false );
- }
+ legacy_rig_flags |= getLegacyRigFlags();
+ // This starts as 0, changes if any loaded mesh has issues
+ setLegacyRigFlags(legacy_rig_flags);
}
//-----------------------------------------------------------------------------
-// isRigLegacy()
+// determineRigLegacyFlags()
//-----------------------------------------------------------------------------
-bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAsset )
+U32 LLModelLoader::determineRigLegacyFlags( const std::vector<std::string> &jointListFromAsset )
{
//No joints in asset
if ( jointListFromAsset.size() == 0 )
@@ -426,7 +425,12 @@ bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAs
{
LL_WARNS() << "Rigged to " << jointListFromAsset.size() << " joints, max is " << mMaxJointsPerMesh << LL_ENDL;
LL_WARNS() << "Skinning disabled due to too many joints" << LL_ENDL;
- return false;
+ LLSD args;
+ args["Message"] = "TooManyJoint";
+ args["[JOINTS]"] = LLSD::Integer(jointListFromAsset.size());
+ args["[MAX]"] = LLSD::Integer(mMaxJointsPerMesh);
+ mWarningsArray.append(args);
+ return LEGACY_RIG_FLAG_TOO_MANY_JOINTS;
}
// Unknown joints in asset
@@ -437,16 +441,24 @@ bool LLModelLoader::isRigLegacy( const std::vector<std::string> &jointListFromAs
if (mJointMap.find(*it)==mJointMap.end())
{
LL_WARNS() << "Rigged to unrecognized joint name " << *it << LL_ENDL;
+ LLSD args;
+ args["Message"] = "UnrecognizedJoint";
+ args["[NAME]"] = *it;
+ mWarningsArray.append(args);
unknown_joint_count++;
}
}
if (unknown_joint_count>0)
{
LL_WARNS() << "Skinning disabled due to unknown joints" << LL_ENDL;
- return false;
+ LLSD args;
+ args["Message"] = "UnknownJoints";
+ args["[COUNT]"] = LLSD::Integer(unknown_joint_count);
+ mWarningsArray.append(args);
+ return LEGACY_RIG_FLAG_UNKNOWN_JOINT;
}
- return true;
+ return LEGACY_RIG_OK;
}
//-----------------------------------------------------------------------------
// isRigSuitableForJointPositionUpload()
diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h
index 643c45a6d8..fbc74554a0 100644
--- a/indra/llprimitive/llmodelloader.h
+++ b/indra/llprimitive/llmodelloader.h
@@ -42,6 +42,10 @@ typedef std::deque<std::string> JointNameSet;
const S32 SLM_SUPPORTED_VERSION = 3;
const S32 NUM_LOD = 4;
+const U32 LEGACY_RIG_OK = 0;
+const U32 LEGACY_RIG_FLAG_TOO_MANY_JOINTS = 1;
+const U32 LEGACY_RIG_FLAG_UNKNOWN_JOINT = 2;
+
class LLModelLoader : public LLThread
{
public:
@@ -166,7 +170,7 @@ public:
void critiqueRigForUploadApplicability( const std::vector<std::string> &jointListFromAsset );
//Determines if a rig is a legacy from the joint list
- bool isRigLegacy( const std::vector<std::string> &jointListFromAsset );
+ U32 determineRigLegacyFlags( const std::vector<std::string> &jointListFromAsset );
//Determines if a rig is suitable for upload
bool isRigSuitableForJointPositionUpload( const std::vector<std::string> &jointListFromAsset );
@@ -174,8 +178,9 @@ public:
const bool isRigValidForJointPositionUpload( void ) const { return mRigValidJointUpload; }
void setRigValidForJointPositionUpload( bool rigValid ) { mRigValidJointUpload = rigValid; }
- const bool isLegacyRigValid( void ) const { return mLegacyRigValid; }
- void setLegacyRigValid( bool rigValid ) { mLegacyRigValid = rigValid; }
+ const bool isLegacyRigValid(void) const { return mLegacyRigFlags == 0; }
+ U32 getLegacyRigFlags() const { return mLegacyRigFlags; }
+ void setLegacyRigFlags( U32 rigFlags ) { mLegacyRigFlags = rigFlags; }
//-----------------------------------------------------------------------------
// isNodeAJoint()
@@ -185,6 +190,9 @@ public:
return name != NULL && mJointMap.find(name) != mJointMap.end();
}
+ const LLSD logOut() const { return mWarningsArray; }
+ void clearLog() { mWarningsArray.clear(); }
+
protected:
LLModelLoader::load_callback_t mLoadCallback;
@@ -194,13 +202,15 @@ protected:
void* mOpaqueData;
bool mRigValidJointUpload;
- bool mLegacyRigValid;
+ U32 mLegacyRigFlags;
bool mNoNormalize;
bool mNoOptimize;
JointTransformMap mJointTransformMap;
+ LLSD mWarningsArray; // preview floater will pull logs from here
+
static std::list<LLModelLoader*> sActiveLoaderList;
static bool isAlive(LLModelLoader* loader) ;
};
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 6c8fde580f..352a00645f 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -132,6 +132,7 @@ LLScrollListCtrl::Params::Params()
sort_ascending("sort_ascending", true),
mouse_wheel_opaque("mouse_wheel_opaque", false),
commit_on_keyboard_movement("commit_on_keyboard_movement", true),
+ commit_on_selection_change("commit_on_selection_change", false),
heading_height("heading_height"),
page_lines("page_lines", 0),
background_visible("background_visible"),
@@ -161,7 +162,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
mMaxSelectable(0),
mAllowKeyboardMovement(true),
mCommitOnKeyboardMovement(p.commit_on_keyboard_movement),
- mCommitOnSelectionChange(false),
+ mCommitOnSelectionChange(p.commit_on_selection_change),
mSelectionChanged(false),
mNeedsScroll(false),
mCanSelect(true),
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index d7572d9fcf..79fe185f11 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -97,6 +97,7 @@ public:
// behavioral flags
Optional<bool> multi_select,
commit_on_keyboard_movement,
+ commit_on_selection_change,
mouse_wheel_opaque;
// display flags
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 6521b883f8..2a221fc19c 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -220,6 +220,7 @@ LLTabContainer::Params::Params()
last_tab("last_tab"),
use_custom_icon_ctrl("use_custom_icon_ctrl", false),
open_tabs_on_drag_and_drop("open_tabs_on_drag_and_drop", false),
+ enable_tabs_flashing("enable_tabs_flashing", false),
tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0),
use_ellipses("use_ellipses"),
font_halign("halign")
@@ -1102,6 +1103,9 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel)
p.pad_left( mLabelPadLeft );
p.pad_right(2);
}
+
+ // inits flash timer
+ p.button_flash_enable = mEnableTabsFlashing;
// *TODO : It seems wrong not to use p in both cases considering the way p is initialized
if (mCustomIconCtrlUsed)
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index 6bf963313c..8f93f1c47d 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -109,6 +109,11 @@ public:
* Open tabs on hover in drag and drop situations
*/
Optional<bool> open_tabs_on_drag_and_drop;
+
+ /**
+ * Open tabs on hover in drag and drop situations
+ */
+ Optional<bool> enable_tabs_flashing;
/**
* Paddings for LLIconCtrl in case of LLCustomButtonIconCtrl usage(use_custom_icon_ctrl = true)
@@ -310,6 +315,7 @@ private:
bool mCustomIconCtrlUsed;
bool mOpenTabsOnDragAndDrop;
+ bool mEnableTabsFlashing;
S32 mTabIconCtrlPad;
bool mUseTabEllipses;
};
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index e64078828b..ee749ae923 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2226,6 +2226,18 @@ void LLTextBase::needsReflow(S32 index)
mReflowIndex = llmin(mReflowIndex, index);
}
+S32 LLTextBase::removeFirstLine()
+{
+ if (!mLineInfoList.empty())
+ {
+ S32 length = getLineEnd(0);
+ deselect();
+ removeStringNoUndo(0, length);
+ return length;
+ }
+ return 0;
+}
+
void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params)
{
segment_vec_t segments;
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 058b804714..f8603ad67a 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -403,6 +403,7 @@ public:
virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style
virtual std::string getText() const;
void setMaxTextLength(S32 length) { mMaxTextByteLength = length; }
+ S32 getMaxTextLength() { return mMaxTextByteLength; }
// wide-char versions
void setWText(const LLWString& text);
@@ -431,6 +432,7 @@ public:
S32 getLength() const { return getWText().length(); }
S32 getLineCount() const { return mLineInfoList.size(); }
+ S32 removeFirstLine(); // returns removed length
void addDocumentChild(LLView* view);
void removeDocumentChild(LLView* view);
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index cf8f99ed25..caa636cc83 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -996,6 +996,7 @@ set(viewer_HEADER_FILES
llinventorymodelbackgroundfetch.h
llinventoryobserver.h
llinventorypanel.h
+ lljointoverridedata.h
lljoystickbutton.h
lllandmarkactions.h
lllandmarklist.h
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index da1e87fda4..ebbe506b02 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6639,8 +6639,190 @@
<key>Value</key>
<integer>600</integer>
</map>
+ <key>MeshPreviewCanvasColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Canvas colour for the Mesh uploader</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color4</string>
+ <key>Value</key>
+ <array>
+ <real>0.169</real>
+ <real>0.169</real>
+ <real>0.169</real>
+ <real>1.0</real>
+ </array>
+ </map>
+ <key>MeshPreviewEdgeColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Edge colour for the Mesh uploader preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color4</string>
+ <key>Value</key>
+ <array>
+ <real>0.4</real>
+ <real>0.4</real>
+ <real>0.4</real>
+ <real>1.0</real>
+ </array>
+ </map>
+ <key>MeshPreviewBaseColor</key>
+ <map>
+ <key>Comment</key>
+ <string>base diffuse colour for the Mesh uploader</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color4</string>
+ <key>Value</key>
+ <array>
+ <real>1.0</real>
+ <real>1.0</real>
+ <real>1.0</real>
+ <real>1.0</real>
+ </array>
+ </map>
+ <key>MeshPreviewBrightnessColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Brightness modifier</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color3</string>
+ <key>Value</key>
+ <array>
+ <real>0.9</real>
+ <real>0.9</real>
+ <real>0.9</real>
+ </array>
+ </map>
+ <key>MeshPreviewEdgeWidth</key>
+ <map>
+ <key>Comment</key>
+ <string>line thickness used when display edges is selected in mesh preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
+ <key>MeshPreviewPhysicsEdgeColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Edge colour for the Mesh uploader physics preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color4</string>
+ <key>Value</key>
+ <array>
+ <real>0.0</real>
+ <real>0.25</real>
+ <real>0.5</real>
+ <real>0.25</real>
+ </array>
+ </map>
+ <key>MeshPreviewPhysicsFillColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Fill colour for the Mesh uploader physics preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color4</string>
+ <key>Value</key>
+ <array>
+ <real>0.0</real>
+ <real>0.5</real>
+ <real>1.0</real>
+ <real>0.5</real>
+ </array>
+ </map>
+ <key>MeshPreviewPhysicsEdgeWidth</key>
+ <map>
+ <key>Comment</key>
+ <string>line thickness used when display physics is selected in mesh preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
+ <key>MeshPreviewDegenerateEdgeColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Edge colour for the Mesh uploader Degenerate preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color4</string>
+ <key>Value</key>
+ <array>
+ <real>1.0</real>
+ <real>0.0</real>
+ <real>0.0</real>
+ <real>1.0</real>
+ </array>
+ </map>
+ <key>MeshPreviewDegenerateFillColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Fill colour for the Mesh uploader Degenerate preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Color4</string>
+ <key>Value</key>
+ <array>
+ <real>1.0</real>
+ <real>0.0</real>
+ <real>0.0</real>
+ <real>0.5</real>
+ </array>
+ </map>
+ <key>MeshPreviewDegenerateEdgeWidth</key>
+ <map>
+ <key>Comment</key>
+ <string>line thickness used when display Degenerate is selected in mesh preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>3.0</real>
+ </map>
+ <key>MeshPreviewDegeneratePointSize</key>
+ <map>
+ <key>Comment</key>
+ <string>Large point size used to highlight degenerate triangle vertices in Mesh preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>8.0</real>
+ </map>
+ <key>MeshPreviewZoomLimit</key>
+ <map>
+ <key>Comment</key>
+ <string>Maximum Zoom level in preview</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>10.0</real>
+ </map>
<key>MigrateCacheDirectory</key>
- <map>
+ <map>
<key>Comment</key>
<string>Check for old version of disk cache to migrate to current location</string>
<key>Persist</key>
@@ -7879,7 +8061,17 @@
<key>Value</key>
<integer>13</integer>
</map>
-
+ <key>PreviewRenderSize</key>
+ <map>
+ <key>Comment</key>
+ <string>Resolution of the image rendered for the mesh upload preview (must be a power of 2)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>1024</integer>
+ </map>
<key>PreviewAmbientColor</key>
<map>
<key>Comment</key>
@@ -7896,8 +8088,6 @@
<real>1.0</real>
</array>
</map>
-
-
<key>PreviewDiffuse0</key>
<map>
<key>Comment</key>
@@ -16357,3 +16547,4 @@
</map>
</llsd>
+
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index 7f3f84398b..de2ea2a065 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -91,8 +91,8 @@ void main()
// Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
- col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
- col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
-
+ col.rgb += light_diffuse[2].rgb * calcDirectionalLight(norm, light_position[2].xyz);
+ col.rgb += light_diffuse[3].rgb * calcDirectionalLight(norm, light_position[3].xyz);
+ col /= 2.0;
vertex_color = col*color;
}
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index 8ef0dd2865..e180d91461 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -125,11 +125,11 @@ BOOL LLViewerDynamicTexture::render()
//-----------------------------------------------------------------------------
void LLViewerDynamicTexture::preRender(BOOL clear_depth)
{
- //only images up to 1024*1024 are supported
- llassert(mFullHeight <= 512);
- llassert(mFullWidth <= 512);
+ gPipeline.allocatePhysicsBuffer();
+ llassert(mFullWidth <= static_cast<S32>(gPipeline.mPhysicsDisplay.getWidth()));
+ llassert(mFullHeight <= static_cast<S32>(gPipeline.mPhysicsDisplay.getHeight()));
- if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI)
+ if (gGLManager.mHasFramebufferObject && gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsATI)
{ //using offscreen render target, just use the bottom left corner
mOrigin.set(0, 0);
}
@@ -216,11 +216,10 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
return TRUE;
}
- bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI;
-
+ bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsATI;
if (use_fbo)
{
- gPipeline.mWaterDis.bindTarget();
+ gPipeline.mPhysicsDisplay.bindTarget();
}
LLGLSLShader::bindNoShader();
@@ -258,7 +257,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
if (use_fbo)
{
- gPipeline.mWaterDis.flush();
+ gPipeline.mPhysicsDisplay.flush();
}
return ret;
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index c4186132fe..2a8638e340 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -76,6 +76,7 @@
#include "llsdserialize.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
+#include "lltabcontainer.h"
#include "lltoggleablemenu.h"
#include "lltrans.h"
#include "llvfile.h"
@@ -83,6 +84,7 @@
#include "llcallbacklist.h"
#include "llviewerobjectlist.h"
#include "llanimationstates.h"
+#include "llviewertexteditor.h"
#include "llviewernetwork.h"
#include "llviewershadermgr.h"
@@ -108,6 +110,8 @@ const double RETAIN_COEFFICIENT = 100;
// So this const is used as a size of Smooth combobox list.
const S32 SMOOTH_VALUES_NUMBER = 10;
+const F32 SKIN_WEIGHT_CAMERA_DISTANCE = 16.f;
+
void drawBoxOutline(const LLVector3& pos, const LLVector3& size);
@@ -261,7 +265,9 @@ void FindModel(LLModelLoader::scene& scene, const std::string& name_to_match, LL
LLFloaterModelPreview::LLFloaterModelPreview(const LLSD& key) :
LLFloaterModelUploadBase(key),
mUploadBtn(NULL),
-mCalculateBtn(NULL)
+mCalculateBtn(NULL),
+mUploadLogText(NULL),
+mTabContainer(NULL)
{
sInstance = this;
mLastMouseX = 0;
@@ -304,10 +310,10 @@ BOOL LLFloaterModelPreview::postBuild()
getChild<LLSpinCtrl>("lod_triangle_limit_" + lod_name[lod])->setCommitCallback(boost::bind(&LLFloaterModelPreview::onLODParamCommit, this, lod, true));
}
- childSetCommitCallback("upload_skin", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL);
- childSetCommitCallback("upload_joints", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL);
- childSetCommitCallback("lock_scale_if_joint_position", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL);
- childSetCommitCallback("upload_textures", boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this), NULL);
+ childSetCommitCallback("upload_skin", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
+ childSetCommitCallback("upload_joints", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
+ childSetCommitCallback("lock_scale_if_joint_position", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
+ childSetCommitCallback("upload_textures", boost::bind(&LLFloaterModelPreview::onUploadOptionChecked, this, _1), NULL);
childSetTextArg("status", "[STATUS]", getString("status_idle"));
@@ -330,13 +336,16 @@ BOOL LLFloaterModelPreview::postBuild()
getChild<LLCheckBoxCtrl>("show_edges")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
getChild<LLCheckBoxCtrl>("show_physics")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
getChild<LLCheckBoxCtrl>("show_textures")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
- getChild<LLCheckBoxCtrl>("show_skin_weight")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
+ getChild<LLCheckBoxCtrl>("show_skin_weight")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onShowSkinWeightChecked, this, _1));
getChild<LLCheckBoxCtrl>("show_joint_positions")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _1));
childDisable("upload_skin");
childDisable("upload_joints");
childDisable("lock_scale_if_joint_position");
+ childSetVisible("skin_too_many_joints", false);
+ childSetVisible("skin_unknown_joint", false);
+
initDecompControls();
LLView* preview_panel = getChild<LLView>("preview_panel");
@@ -392,6 +401,19 @@ BOOL LLFloaterModelPreview::postBuild()
mUploadBtn = getChild<LLButton>("ok_btn");
mCalculateBtn = getChild<LLButton>("calculate_btn");
+ mUploadLogText = getChild<LLViewerTextEditor>("log_text");
+ mTabContainer = getChild<LLTabContainer>("import_tab");
+
+ // Disable Overrides tab untill it has something to show and set callbacks
+ LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
+ S32 index = mTabContainer->getIndexForPanel(panel);
+ mTabContainer->enableTabButton(index, false);
+ panel->getChild<LLScrollListCtrl>("joints_list")->setCommitCallback(boost::bind(&LLFloaterModelPreview::onJointListSelection, this));
+
+ // Disable Logs tab untill it has something to show
+ panel = mTabContainer->getPanelByName("logs_panel");
+ index = mTabContainer->getIndexForPanel(panel);
+ mTabContainer->enableTabButton(index, false);
if (LLConvexDecomposition::getInstance() != NULL)
{
@@ -430,18 +452,58 @@ void LLFloaterModelPreview::initModelPreview()
delete mModelPreview;
}
- mModelPreview = new LLModelPreview(512, 512, this );
+ S32 tex_width = 512;
+ S32 tex_height = 512;
+
+ S32 max_width = llmin(gSavedSettings.getS32("PreviewRenderSize"), (S32)gPipeline.mScreenWidth);
+ S32 max_height = llmin(gSavedSettings.getS32("PreviewRenderSize"), (S32)gPipeline.mScreenHeight);
+
+ while ((tex_width << 1) <= max_width)
+ {
+ tex_width <<= 1;
+ }
+ while ((tex_height << 1) <= max_height)
+ {
+ tex_height <<= 1;
+ }
+
+ mModelPreview = new LLModelPreview(tex_width, tex_height, this);
mModelPreview->setPreviewTarget(16.f);
mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5));
mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, _1));
}
+void LLFloaterModelPreview::onUploadOptionChecked(LLUICtrl* ctrl)
+{
+ if (mModelPreview)
+ {
+ auto name = ctrl->getName();
+ mModelPreview->mViewOption[name] = !mModelPreview->mViewOption[name];
+ }
+ toggleCalculateButton(true);
+}
+
+void LLFloaterModelPreview::onShowSkinWeightChecked(LLUICtrl* ctrl)
+{
+ if (mModelPreview)
+ {
+ mModelPreview->mCameraOffset.clearVec();
+ onViewOptionChecked(ctrl);
+ }
+}
+
void LLFloaterModelPreview::onViewOptionChecked(LLUICtrl* ctrl)
{
if (mModelPreview)
{
- mModelPreview->mViewOption[ctrl->getName()] = !mModelPreview->mViewOption[ctrl->getName()];
-
+ auto name = ctrl->getName();
+ mModelPreview->mViewOption[name] = !mModelPreview->mViewOption[name];
+ if (name == "show_physics")
+ {
+ auto enabled = mModelPreview->mViewOption[name];
+ childSetEnabled("physics_explode", enabled);
+ childSetVisible("physics_explode", enabled);
+ }
mModelPreview->refresh();
}
}
@@ -497,6 +559,8 @@ void LLFloaterModelPreview::loadModel(S32 lod, const std::string& file_name, boo
void LLFloaterModelPreview::onClickCalculateBtn()
{
+ clearLogTab();
+
mModelPreview->rebuildUploadData();
bool upload_skinweights = childGetValue("upload_skin").asBoolean();
@@ -505,9 +569,12 @@ void LLFloaterModelPreview::onClickCalculateBtn()
if (upload_joint_positions)
{
- // Diagnostic message showing list of joints for which joint offsets are defined.
- // FIXME - given time, would be much better to put this in the UI, in updateStatusMessages().
- mModelPreview->getPreviewAvatar()->showAttachmentOverrides();
+ // Todo: this probably should be enabled when checkbox enables, not on calculate
+ populateOverridesTab();
+ }
+ else
+ {
+ disableOverridesTab();
}
mUploadModelUrl.clear();
@@ -522,6 +589,89 @@ void LLFloaterModelPreview::onClickCalculateBtn()
mUploadBtn->setEnabled(false);
}
+void populate_list_with_vectors(LLScrollListCtrl *list, const std::set<LLVector3> &vector_set, const LLVector3 &active)
+{
+ if (vector_set.empty())
+ {
+ return;
+ }
+ S32 count = 0;
+ LLScrollListCell::Params cell_params;
+ cell_params.font = LLFontGL::getFontSansSerif();
+ // Start out right justifying numeric displays
+ cell_params.font_halign = LLFontGL::HCENTER;
+
+ std::set<LLVector3>::const_iterator iter = vector_set.begin();
+ std::set<LLVector3>::const_iterator end = vector_set.end();
+ while (iter != end)
+ {
+ LLScrollListItem::Params item_params;
+ item_params.value = LLSD::Integer(count);
+
+ cell_params.column = "override";
+ if (*iter != active)
+ {
+ cell_params.value = "";
+ }
+ else
+ {
+ cell_params.value = "active"; //todo: localize
+ }
+
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "axis_x";
+ cell_params.value = iter->mV[VX];
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "axis_y";
+ cell_params.value = iter->mV[VY];
+ item_params.columns.add(cell_params);
+
+ cell_params.column = "axis_z";
+ cell_params.value = iter->mV[VZ];
+
+ item_params.columns.add(cell_params);
+
+ list->addRow(item_params);
+ count++;
+ iter++;
+ }
+}
+
+void LLFloaterModelPreview::onJointListSelection()
+{
+ LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
+ LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
+ LLScrollListCtrl *joints_pos = panel->getChild<LLScrollListCtrl>("pos_overrides_list");
+ LLScrollListCtrl *joints_scale = panel->getChild<LLScrollListCtrl>("scale_overrides_list");
+ LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("pos_overrides_descr");
+ LLTextBox *joint_scale_descr = panel->getChild<LLTextBox>("scale_overrides_descr");
+
+ joints_pos->deleteAllItems();
+ joints_scale->deleteAllItems();
+
+ LLScrollListItem *selected = joints_list->getFirstSelected();
+ if (selected)
+ {
+ std::string label = selected->getValue().asString();
+ LLJointOverrideData *data = &mJointOverrides[label];
+ populate_list_with_vectors(joints_pos, data->mPosOverrides, data->mActivePosOverride);
+ populate_list_with_vectors(joints_scale, data->mScaleOverrides, data->mActiveScaleOverride);
+
+ joint_pos_descr->setTextArg("[JOINT]", label);
+ joint_scale_descr->setTextArg("[JOINT]", label);
+ }
+ else
+ {
+ // temporary value (shouldn't happen)
+ std::string label = "mPelvis";
+ joint_pos_descr->setTextArg("[JOINT]", label);
+ joint_scale_descr->setTextArg("[JOINT]", label);
+ }
+
+}
+
void LLFloaterModelPreview::onDescriptionKeystroke(LLUICtrl* ctrl)
{
// Workaround for SL-4186, server doesn't allow name changes after 'calculate' stage
@@ -622,6 +772,7 @@ void LLFloaterModelPreview::onGenerateNormalsCommit(LLUICtrl* ctrl, void* userda
void LLFloaterModelPreview::toggleGenarateNormals()
{
bool enabled = childGetValue("gen_normals").asBoolean();
+ mModelPreview->mViewOption["gen_normals"] = enabled;
childSetEnabled("crease_angle", enabled);
if(enabled) {
mModelPreview->generateNormals();
@@ -665,6 +816,42 @@ void LLFloaterModelPreview::onLODParamCommit(S32 lod, bool enforce_tri_limit)
}
}
+void LLFloaterModelPreview::draw3dPreview()
+{
+ gGL.color3f(1.f, 1.f, 1.f);
+
+ gGL.getTexUnit(0)->bind(mModelPreview);
+
+
+ LLView* preview_panel = getChild<LLView>("preview_panel");
+
+ if (!preview_panel)
+ {
+ LL_WARNS() << "preview_panel not found in floater definition" << LL_ENDL;
+ }
+ LLRect rect = preview_panel->getRect();
+
+ if (rect != mPreviewRect)
+ {
+ mModelPreview->refresh();
+ mPreviewRect = preview_panel->getRect();
+ }
+
+ gGL.begin( LLRender::QUADS );
+ {
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mTop-1);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(mPreviewRect.mLeft, mPreviewRect.mBottom);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mBottom);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mTop-1);
+ }
+ gGL.end();
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+}
//-----------------------------------------------------------------------------
// draw()
@@ -1111,10 +1298,8 @@ void LLFloaterModelPreview::initDecompControls()
std::string label = llformat("%.1f", value);
combo_box->add(label, value, ADD_BOTTOM, true);
}
- combo_box->setValue(param[i].mDefault.mFloat);
-
}
-
+ combo_box->setValue(param[i].mDefault.mFloat);
combo_box->setCommitCallback(onPhysicsParamCommit, (void*) &param[i]);
}
}
@@ -1186,7 +1371,7 @@ void LLFloaterModelPreview::initDecompControls()
//LL_INFOS() << "-----------------------------" << LL_ENDL;
}
}
-
+ mDefaultDecompParams = mDecompParams;
childSetCommitCallback("physics_explode", LLFloaterModelPreview::onExplodeCommit, this);
}
@@ -1216,6 +1401,92 @@ void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handl
}
//-----------------------------------------------------------------------------
+// addStringToLog()
+//-----------------------------------------------------------------------------
+//static
+void LLFloaterModelPreview::addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod)
+{
+ if (sInstance && sInstance->hasString(message))
+ {
+ std::string str;
+ switch (lod)
+ {
+ case LLModel::LOD_IMPOSTOR: str = "LOD0 "; break;
+ case LLModel::LOD_LOW: str = "LOD1 "; break;
+ case LLModel::LOD_MEDIUM: str = "LOD2 "; break;
+ case LLModel::LOD_PHYSICS: str = "PHYS "; break;
+ case LLModel::LOD_HIGH: str = "LOD3 "; break;
+ default: break;
+ }
+
+ LLStringUtil::format_map_t args_msg;
+ LLSD::map_const_iterator iter = args.beginMap();
+ LLSD::map_const_iterator end = args.endMap();
+ for (; iter != end; ++iter)
+ {
+ args_msg[iter->first] = iter->second.asString();
+ }
+ str += sInstance->getString(message, args_msg);
+ sInstance->addStringToLogTab(str, flash);
+ }
+}
+
+// static
+void LLFloaterModelPreview::addStringToLog(const std::string& str, bool flash)
+{
+ if (sInstance)
+ {
+ sInstance->addStringToLogTab(str, flash);
+ }
+}
+
+// static
+void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool flash)
+{
+ if (sInstance)
+ {
+ sInstance->addStringToLogTab(strm.str(), flash);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// addStringToLogTab()
+//-----------------------------------------------------------------------------
+void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash)
+{
+ if (str.empty())
+ {
+ return;
+ }
+
+ LLWString text = utf8str_to_wstring(str);
+ S32 add_text_len = text.length() + 1; // newline
+ S32 editor_max_len = mUploadLogText->getMaxTextLength();
+ if (add_text_len > editor_max_len)
+ {
+ return;
+ }
+
+ LLPanel* panel = mTabContainer->getPanelByName("logs_panel");
+ S32 index = mTabContainer->getIndexForPanel(panel);
+ mTabContainer->enableTabButton(index, true);
+
+ // Make sure we have space for new string
+ S32 editor_text_len = mUploadLogText->getLength();
+ while (editor_max_len < (editor_text_len + add_text_len))
+ {
+ editor_text_len -= mUploadLogText->removeFirstLine();
+ }
+
+ mUploadLogText->appendText(str, true);
+
+ if (flash && mTabContainer->getCurrentPanel() != panel)
+ {
+ mTabContainer->setTabPanelFlashing(panel, true);
+ }
+}
+
+//-----------------------------------------------------------------------------
// LLModelPreview
//-----------------------------------------------------------------------------
@@ -1224,12 +1495,13 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
, mLodsQuery()
, mLodsWithParsingError()
, mPelvisZOffset( 0.0f )
-, mLegacyRigValid( false )
+, mLegacyRigFlags( U32_MAX )
, mRigValidJointUpload( false )
, mPhysicsSearchLOD( LLModel::LOD_PHYSICS )
, mResetJoints( false )
, mModelNoErrors( true )
, mLastJointUpdate( false )
+, mHasDegenerate( false )
{
mNeedsUpdate = TRUE;
mCameraDistance = 0.f;
@@ -1644,8 +1916,14 @@ void LLModelPreview::rebuildUploadData()
LLQuaternion identity;
if (!bind_rot.isEqualEps(identity,0.01))
{
- LL_WARNS() << "non-identity bind shape rot. mat is " << high_lod_model->mSkinInfo.mBindShapeMatrix
- << " bind_rot " << bind_rot << LL_ENDL;
+ std::ostringstream out;
+ out << "non-identity bind shape rot. mat is ";
+ out << high_lod_model->mSkinInfo.mBindShapeMatrix;
+ out << " bind_rot ";
+ out << bind_rot;
+ LL_WARNS() << out.str() << LL_ENDL;
+
+ LLFloaterModelPreview::addStringToLog(out, false);
setLoadState( LLModelLoader::WARNING_BIND_SHAPE_ORIENTATION );
}
}
@@ -1816,7 +2094,11 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable
if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::NUM_LODS - 1)
{
- LL_WARNS() << "Invalid level of detail: " << lod << LL_ENDL;
+ std::ostringstream out;
+ out << "Invalid level of detail: ";
+ out << lod;
+ LL_WARNS() << out.str() << LL_ENDL;
+ LLFloaterModelPreview::addStringToLog(out, true);
assert(lod >= LLModel::LOD_IMPOSTOR && lod < LLModel::NUM_LODS);
return;
}
@@ -2003,7 +2285,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
// Copy determinations about rig so UI will reflect them
//
setRigValidForJointPositionUpload(mModelLoader->isRigValidForJointPositionUpload());
- setLegacyRigValid(mModelLoader->isLegacyRigValid());
+ setLegacyRigFlags(mModelLoader->getLegacyRigFlags());
mModelLoader->loadTextures() ;
@@ -2193,7 +2475,12 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
if (importerDebug)
{
- LL_WARNS() << "Loded model name " << mModel[loaded_lod][idx]->mLabel << " for LOD " << loaded_lod << " doesn't match the base model. Renaming to " << name << LL_ENDL;
+ std::ostringstream out;
+ out << "Loded model name " << mModel[loaded_lod][idx]->mLabel;
+ out << " for LOD " << loaded_lod;
+ out << " doesn't match the base model. Renaming to " << name;
+ LL_WARNS() << out.str() << LL_ENDL;
+ LLFloaterModelPreview::addStringToLog(out, false);
}
mModel[loaded_lod][idx]->mLabel = name;
@@ -2217,7 +2504,6 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
mLoading = false;
if (mFMP)
{
- mFMP->getChild<LLCheckBoxCtrl>("confirm_checkbox")->set(FALSE);
if (!mBaseModel.empty())
{
const std::string& model_name = mBaseModel[0]->getName();
@@ -2351,7 +2637,10 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
// Allow LoD from -1 to LLModel::LOD_PHYSICS
if (which_lod < -1 || which_lod > LLModel::NUM_LODS - 1)
{
- LL_WARNS() << "Invalid level of detail: " << which_lod << LL_ENDL;
+ std::ostringstream out;
+ out << "Invalid level of detail: " << which_lod;
+ LL_WARNS() << out.str() << LL_ENDL;
+ LLFloaterModelPreview::addStringToLog(out, false);
assert(which_lod >= -1 && which_lod < LLModel::NUM_LODS);
return;
}
@@ -2719,8 +3008,20 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
void LLModelPreview::updateStatusMessages()
{
+// bit mask values for physics errors. used to prevent overwrite of single line status
+// TODO: use this to provied multiline status
+ enum PhysicsError
+ {
+ NONE=0,
+ NOHAVOK=1,
+ DEGENERATE=2,
+ TOOMANYHULLS=4,
+ TOOMANYVERTSINHULL=8
+ };
+
assert_main_thread();
+ U32 has_physics_error{ PhysicsError::NONE }; // physics error bitmap
//triangle/vertex/submesh count for each mesh asset for each lod
std::vector<S32> tris[LLModel::NUM_LODS];
std::vector<S32> verts[LLModel::NUM_LODS];
@@ -2810,43 +3111,57 @@ void LLModelPreview::updateStatusMessages()
mMaxTriangleLimit = total_tris[LLModel::LOD_HIGH];
}
- bool has_degenerate = false;
-
+ mHasDegenerate = false;
{//check for degenerate triangles in physics mesh
U32 lod = LLModel::LOD_PHYSICS;
const LLVector4a scale(0.5f);
- for (U32 i = 0; i < mModel[lod].size() && !has_degenerate; ++i)
+ for (U32 i = 0; i < mModel[lod].size() && !mHasDegenerate; ++i)
{ //for each model in the lod
if (mModel[lod][i] && mModel[lod][i]->mPhysics.mHull.empty())
{ //no decomp exists
S32 cur_submeshes = mModel[lod][i]->getNumVolumeFaces();
- for (S32 j = 0; j < cur_submeshes && !has_degenerate; ++j)
+ for (S32 j = 0; j < cur_submeshes && !mHasDegenerate; ++j)
{ //for each submesh (face), add triangles and vertices to current total
LLVolumeFace& face = mModel[lod][i]->getVolumeFace(j);
- for (S32 k = 0; (k < face.mNumIndices) && !has_degenerate; )
+ for (S32 k = 0; (k < face.mNumIndices) && !mHasDegenerate; )
{
- U16 index_a = face.mIndices[k+0];
- U16 index_b = face.mIndices[k+1];
- U16 index_c = face.mIndices[k+2];
+ U16 index_a = face.mIndices[k + 0];
+ U16 index_b = face.mIndices[k + 1];
+ U16 index_c = face.mIndices[k + 2];
- LLVector4a v1; v1.setMul(face.mPositions[index_a], scale);
- LLVector4a v2; v2.setMul(face.mPositions[index_b], scale);
- LLVector4a v3; v3.setMul(face.mPositions[index_c], scale);
-
- if (ll_is_degenerate(v1,v2,v3))
+ if (index_c == 0 && index_b == 0 && index_a == 0) // test in reverse as 3rd index is less likely to be 0 in a normal case
{
- has_degenerate = true;
+ LL_DEBUGS("MeshValidation") << "Empty placeholder triangle (3 identical index 0 verts) ignored" << LL_ENDL;
}
else
{
- k += 3;
+ LLVector4a v1; v1.setMul(face.mPositions[index_a], scale);
+ LLVector4a v2; v2.setMul(face.mPositions[index_b], scale);
+ LLVector4a v3; v3.setMul(face.mPositions[index_c], scale);
+ if (ll_is_degenerate(v1, v2, v3))
+ {
+ mHasDegenerate = true;
+ }
}
+ k += 3;
}
}
}
}
}
+ // flag degenerates here rather than deferring to a MAV error later
+ mFMP->childSetVisible("physics_status_message_text", mHasDegenerate); //display or clear
+ auto degenerateIcon = mFMP->getChild<LLIconCtrl>("physics_status_message_icon");
+ degenerateIcon->setVisible(mHasDegenerate);
+ if (mHasDegenerate)
+ {
+ has_physics_error |= PhysicsError::DEGENERATE;
+ mFMP->childSetValue("physics_status_message_text", mFMP->getString("phys_status_degenerate_triangles"));
+ LLUIImagePtr img = LLUI::getUIImage("ModelImport_Status_Error");
+ degenerateIcon->setImage(img);
+ }
+
mFMP->childSetTextArg("submeshes_info", "[SUBMESHES]", llformat("%d", total_submeshes[LLModel::LOD_HIGH]));
std::string mesh_status_na = mFMP->getString("mesh_status_na");
@@ -2971,14 +3286,22 @@ void LLModelPreview::updateStatusMessages()
}
}
}
- mFMP->childSetVisible("physics_status_message_text", physExceededVertexLimit);
- LLIconCtrl* physStatusIcon = mFMP->getChild<LLIconCtrl>("physics_status_message_icon");
- physStatusIcon->setVisible(physExceededVertexLimit);
+
if (physExceededVertexLimit)
{
- mFMP->childSetValue("physics_status_message_text", mFMP->getString("phys_status_vertex_limit_exceeded"));
- LLUIImagePtr img = LLUI::getUIImage("ModelImport_Status_Warning");
- physStatusIcon->setImage(img);
+ has_physics_error |= PhysicsError::TOOMANYVERTSINHULL;
+ }
+
+ if (!(has_physics_error & PhysicsError::DEGENERATE)){ // only update this field (incluides clearing it) if it is not already in use.
+ mFMP->childSetVisible("physics_status_message_text", physExceededVertexLimit);
+ LLIconCtrl* physStatusIcon = mFMP->getChild<LLIconCtrl>("physics_status_message_icon");
+ physStatusIcon->setVisible(physExceededVertexLimit);
+ if (physExceededVertexLimit)
+ {
+ mFMP->childSetValue("physics_status_message_text", mFMP->getString("phys_status_vertex_limit_exceeded"));
+ LLUIImagePtr img = LLUI::getUIImage("ModelImport_Status_Warning");
+ physStatusIcon->setImage(img);
+ }
}
if (getLoadState() >= LLModelLoader::ERROR_PARSING)
@@ -3008,11 +3331,15 @@ void LLModelPreview::updateStatusMessages()
}
}
- // Todo: investigate use of has_degenerate and include into mModelNoErrors upload blocking mechanics
- // current use of has_degenerate won't block upload permanently - later checks will restore the button
- if (!mModelNoErrors || has_degenerate)
+ if (!mModelNoErrors || mHasDegenerate)
{
mFMP->childDisable("ok_btn");
+ mFMP->childDisable("calculate_btn");
+ }
+ else
+ {
+ mFMP->childEnable("ok_btn");
+ mFMP->childEnable("calculate_btn");
}
if (mModelNoErrors && mLodsWithParsingError.empty())
@@ -3193,7 +3520,10 @@ void LLModelPreview::updateLodControls(S32 lod)
{
if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::LOD_HIGH)
{
- LL_WARNS() << "Invalid level of detail: " << lod << LL_ENDL;
+ std::ostringstream out;
+ out << "Invalid level of detail: " << lod;
+ LL_WARNS() << out.str() << LL_ENDL;
+ LLFloaterModelPreview::addStringToLog(out, false);
assert(lod >= LLModel::LOD_IMPOSTOR && lod <= LLModel::LOD_HIGH);
return;
}
@@ -3389,9 +3719,12 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
if (!vb->allocateBuffer(num_vertices, num_indices, TRUE))
{
// We are likely to crash due this failure, if this happens, find a way to gracefully stop preview
- LL_WARNS() << "Failed to allocate Vertex Buffer for model preview "
- << num_vertices << " vertices and "
- << num_indices << " indices" << LL_ENDL;
+ std::ostringstream out;
+ out << "Failed to allocate Vertex Buffer for model preview ";
+ out << num_vertices << " vertices and ";
+ out << num_indices << " indices";
+ LL_WARNS() << out.str() << LL_ENDL;
+ LLFloaterModelPreview::addStringToLog(out, true);
}
LLStrider<LLVector3> vertex_strider;
@@ -3539,8 +3872,20 @@ void LLModelPreview::loadedCallback(
LLModelPreview* pPreview = static_cast< LLModelPreview* >(opaque);
if (pPreview && !LLModelPreview::sIgnoreLoadedCallback)
{
- pPreview->loadModelCallback(lod);
- }
+ const LLSD out = pPreview->mModelLoader->logOut();
+ LLSD::array_const_iterator iter_out = out.beginArray();
+ LLSD::array_const_iterator end_out = out.endArray();
+ for (; iter_out != end_out; ++iter_out)
+ {
+ if (iter_out->has("Message"))
+ {
+ LLFloaterModelPreview::addStringToLog(iter_out->get("Message"), *iter_out, true, pPreview->mModelLoader->mLod);
+ }
+ }
+ pPreview->mModelLoader->clearLog();
+ pPreview->loadModelCallback(lod); // removes mModelLoader in some cases
+ }
+
}
void LLModelPreview::stateChangedCallback(U32 state,void* opaque)
@@ -3617,7 +3962,7 @@ void LLModelPreview::addEmptyFace( LLModel* pTarget )
pTarget->setNumVolumeFaces( faceCnt+1 );
pTarget->setVolumeFaceData( faceCnt+1, pos, norm, tc, index, buff->getNumVerts(), buff->getNumIndices() );
-}
+}
//-----------------------------------------------------------------------------
// render()
@@ -3637,11 +3982,26 @@ BOOL LLModelPreview::render()
bool textures = mViewOption["show_textures"];
bool physics = mViewOption["show_physics"];
+ // Extra configurability, to be exposed later as controls?
+ static LLCachedControl<LLColor4> canvas_col(gSavedSettings, "MeshPreviewCanvasColor");
+ static LLCachedControl<LLColor4> edge_col(gSavedSettings, "MeshPreviewEdgeColor");
+ static LLCachedControl<LLColor4> base_col(gSavedSettings, "MeshPreviewBaseColor");
+ static LLCachedControl<LLColor3> brightness(gSavedSettings, "MeshPreviewBrightnessColor");
+ static LLCachedControl<F32> edge_width(gSavedSettings, "MeshPreviewEdgeWidth");
+ static LLCachedControl<LLColor4> phys_edge_col(gSavedSettings, "MeshPreviewPhysicsEdgeColor");
+ static LLCachedControl<LLColor4> phys_fill_col(gSavedSettings, "MeshPreviewPhysicsFillColor");
+ static LLCachedControl<F32> phys_edge_width(gSavedSettings, "MeshPreviewPhysicsEdgeWidth");
+ static LLCachedControl<LLColor4> deg_edge_col(gSavedSettings, "MeshPreviewDegenerateEdgeColor");
+ static LLCachedControl<LLColor4> deg_fill_col(gSavedSettings, "MeshPreviewDegenerateFillColor");
+ static LLCachedControl<F32> deg_edge_width(gSavedSettings, "MeshPreviewDegenerateEdgeWidth");
+ static LLCachedControl<F32> deg_point_size(gSavedSettings, "MeshPreviewDegeneratePointSize");
+
S32 width = getWidth();
S32 height = getHeight();
LLGLSUIDefault def;
LLGLDisable no_blend(GL_BLEND);
+
LLGLEnable cull(GL_CULL_FACE);
LLGLDepthTest depth(GL_TRUE);
LLGLDisable fog(GL_FOG);
@@ -3661,8 +4021,7 @@ BOOL LLModelPreview::render()
gGL.pushMatrix();
gGL.loadIdentity();
- gGL.color4f(0.169f, 0.169f, 0.169f, 1.f);
-
+ gGL.color4fv(static_cast<LLColor4>(canvas_col).mV);
gl_rect_2d_simple( width, height );
gGL.matrixMode(LLRender::MM_PROJECTION);
@@ -3703,13 +4062,25 @@ BOOL LLModelPreview::render()
if (has_skin_weights && lodsReady())
{ //model has skin weights, enable view options for skin weights and joint positions
- if (fmp && isLegacyRigValid() )
- {
- fmp->enableViewOption("show_skin_weight");
- fmp->setViewOptionEnabled("show_joint_positions", skin_weight);
- mFMP->childEnable("upload_skin");
- mFMP->childSetValue("show_skin_weight", skin_weight);
- }
+ U32 flags = getLegacyRigFlags();
+ if (fmp)
+ {
+ if (flags == LEGACY_RIG_OK)
+ {
+ fmp->enableViewOption("show_skin_weight");
+ fmp->setViewOptionEnabled("show_joint_positions", skin_weight);
+ mFMP->childEnable("upload_skin");
+ mFMP->childSetValue("show_skin_weight", skin_weight);
+ }
+ else if ((flags & LEGACY_RIG_FLAG_TOO_MANY_JOINTS) > 0)
+ {
+ mFMP->childSetVisible("skin_too_many_joints", true);
+ }
+ else if ((flags & LEGACY_RIG_FLAG_UNKNOWN_JOINT) > 0)
+ {
+ mFMP->childSetVisible("skin_unknown_joint", true);
+ }
+ }
}
else
{
@@ -3776,10 +4147,9 @@ BOOL LLModelPreview::render()
if (skin_weight)
{
- target_pos = getPreviewAvatar()->getPositionAgent();
+ target_pos = getPreviewAvatar()->getPositionAgent() + offset;
z_near = 0.01f;
z_far = 1024.f;
- mCameraDistance = 16.f;
//render avatar previews every frame
refresh();
@@ -3797,8 +4167,9 @@ BOOL LLModelPreview::render()
LLQuaternion(mCameraYaw, LLVector3::z_axis);
LLQuaternion av_rot = camera_rot;
+ F32 camera_distance = skin_weight ? SKIN_WEIGHT_CAMERA_DISTANCE : mCameraDistance;
LLViewerCamera::getInstance()->setOriginAndLookAt(
- target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + offset) * av_rot), // camera
+ target_pos + ((LLVector3(camera_distance, 0.f, 0.f) + offset) * av_rot), // camera
LLVector3::z_axis, // up
target_pos); // point of interest
@@ -3810,8 +4181,7 @@ BOOL LLModelPreview::render()
stop_glerror();
gGL.pushMatrix();
- const F32 BRIGHTNESS = 0.9f;
- gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
+ gGL.color4fv(edge_col().mV);
const U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
@@ -3896,16 +4266,15 @@ BOOL LLModelPreview::render()
}
else
{
- gGL.diffuseColor4f(1,1,1,1);
+ gGL.diffuseColor4fv(static_cast<LLColor4>(base_col).mV);
}
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
-
+ gGL.diffuseColor4fv(static_cast<LLColor4>(edge_col).mV);
if (edges)
{
- glLineWidth(3.f);
+ glLineWidth(edge_width);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -3918,10 +4287,9 @@ BOOL LLModelPreview::render()
if (physics)
{
glClear(GL_DEPTH_BUFFER_BIT);
-
- for (U32 i = 0; i < 2; i++)
+ for (U32 pass = 0; pass < 2; pass++)
{
- if (i == 0)
+ if (pass == 0)
{ //depth only pass
gGL.setColorMask(false, false);
}
@@ -3931,8 +4299,8 @@ BOOL LLModelPreview::render()
}
//enable alpha blending on second pass but not first pass
- LLGLState blend(GL_BLEND, i);
-
+ LLGLState blend(GL_BLEND, pass);
+
gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
@@ -3941,175 +4309,187 @@ BOOL LLModelPreview::render()
LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS];
- if (!model)
- {
- continue;
- }
+ if (!model)
+ {
+ continue;
+ }
- gGL.pushMatrix();
- LLMatrix4 mat = instance.mTransform;
+ gGL.pushMatrix();
+ LLMatrix4 mat = instance.mTransform;
- gGL.multMatrix((GLfloat*) mat.mMatrix);
+ gGL.multMatrix((GLfloat*)mat.mMatrix);
- bool render_mesh = true;
+ bool render_mesh = true;
+ LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
+ if (decomp)
+ {
+ LLMutexLock(decomp->mMutex);
- LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
- if (decomp)
- {
- LLMutexLock(decomp->mMutex);
+ LLModel::Decomposition& physics = model->mPhysics;
- LLModel::Decomposition& physics = model->mPhysics;
+ if (!physics.mHull.empty())
+ {
+ render_mesh = false;
- if (!physics.mHull.empty())
- {
- render_mesh = false;
+ if (physics.mMesh.empty())
+ { //build vertex buffer for physics mesh
+ gMeshRepo.buildPhysicsMesh(physics);
+ }
- if (physics.mMesh.empty())
- { //build vertex buffer for physics mesh
- gMeshRepo.buildPhysicsMesh(physics);
- }
-
- if (!physics.mMesh.empty())
- { //render hull instead of mesh
- for (U32 i = 0; i < physics.mMesh.size(); ++i)
+ if (!physics.mMesh.empty())
+ { //render hull instead of mesh
+ for (U32 i = 0; i < physics.mMesh.size(); ++i)
+ {
+ if (explode > 0.f)
{
- if (explode > 0.f)
- {
- gGL.pushMatrix();
+ gGL.pushMatrix();
- LLVector3 offset = model->mHullCenter[i]-model->mCenterOfHullCenters;
- offset *= explode;
+ LLVector3 offset = model->mHullCenter[i] - model->mCenterOfHullCenters;
+ offset *= explode;
- gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
- }
+ gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
+ }
- static std::vector<LLColor4U> hull_colors;
+ static std::vector<LLColor4U> hull_colors;
- if (i+1 >= hull_colors.size())
- {
- hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 128));
- }
+ if (i + 1 >= hull_colors.size())
+ {
+ hull_colors.push_back(LLColor4U(rand() % 128 + 127, rand() % 128 + 127, rand() % 128 + 127, 128));
+ }
- gGL.diffuseColor4ubv(hull_colors[i].mV);
- LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals);
+ gGL.diffuseColor4ubv(hull_colors[i].mV);
+ LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals);
- if (explode > 0.f)
- {
- gGL.popMatrix();
- }
+ if (explode > 0.f)
+ {
+ gGL.popMatrix();
}
}
}
}
-
- if (render_mesh)
+ }
+
+ if (render_mesh)
+ {
+ if (mVertexBuffer[LLModel::LOD_PHYSICS].empty())
{
- if (mVertexBuffer[LLModel::LOD_PHYSICS].empty())
- {
- genBuffers(LLModel::LOD_PHYSICS, false);
- }
+ genBuffers(LLModel::LOD_PHYSICS, false);
+ }
- U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size();
+ U32 num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size();
+ if (pass > 0){
for (U32 i = 0; i < num_models; ++i)
{
LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.diffuseColor4f(0.4f, 0.4f, 0.0f, 0.4f);
+ gGL.diffuseColor4fv(phys_fill_col().mV);
buffer->setBuffer(type_mask & buffer->getTypeMask());
- buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
+ buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
- gGL.diffuseColor3f(1.f, 1.f, 0.f);
-
- glLineWidth(2.f);
+ gGL.diffuseColor4fv(phys_edge_col().mV);
+ glLineWidth(phys_edge_width);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
+ buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glLineWidth(1.f);
}
}
-
- gGL.popMatrix();
}
- glLineWidth(3.f);
- glPointSize(8.f);
- gPipeline.enableLightsFullbright(LLColor4::white);
- //show degenerate triangles
- LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
- LLGLDisable cull(GL_CULL_FACE);
- gGL.diffuseColor4f(1.f,0.f,0.f,1.f);
- const LLVector4a scale(0.5f);
+ gGL.popMatrix();
+ }
- for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
+ // only do this if mDegenerate was set in the preceding mesh checks [Check this if the ordering ever breaks]
+ if (pass > 0 && mHasDegenerate)
{
- LLModelInstance& instance = *iter;
-
- LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS];
-
- if (!model)
+ glLineWidth(deg_edge_width);
+ glPointSize(deg_point_size);
+ //show degenerate triangles
+ LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS);
+ LLGLDisable cull(GL_CULL_FACE);
+ const LLVector4a scale(0.5f);
+
+ for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
{
- continue;
- }
+ LLModelInstance& instance = *iter;
- gGL.pushMatrix();
- LLMatrix4 mat = instance.mTransform;
+ LLModel* model = instance.mLOD[LLModel::LOD_PHYSICS];
- gGL.multMatrix((GLfloat*) mat.mMatrix);
+ if (!model)
+ {
+ continue;
+ }
+ gGL.pushMatrix();
+ LLMatrix4 mat = instance.mTransform;
- LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
- if (decomp)
- {
- LLMutexLock(decomp->mMutex);
+ gGL.multMatrix((GLfloat*)mat.mMatrix);
- LLModel::Decomposition& physics = model->mPhysics;
- if (physics.mHull.empty())
+ LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread;
+ if (decomp)
{
- if (mVertexBuffer[LLModel::LOD_PHYSICS].empty())
- {
- genBuffers(LLModel::LOD_PHYSICS, false);
- }
-
- for (U32 i = 0; i < mVertexBuffer[LLModel::LOD_PHYSICS][model].size(); ++i)
- {
- LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
+ LLMutexLock(decomp->mMutex);
- buffer->setBuffer(type_mask & buffer->getTypeMask());
+ LLModel::Decomposition& physics = model->mPhysics;
- LLStrider<LLVector3> pos_strider;
- buffer->getVertexStrider(pos_strider, 0);
- LLVector4a* pos = (LLVector4a*) pos_strider.get();
-
- LLStrider<U16> idx;
- buffer->getIndexStrider(idx, 0);
+ if (physics.mHull.empty())
+ {
+ if (mVertexBuffer[LLModel::LOD_PHYSICS].empty())
+ {
+ genBuffers(LLModel::LOD_PHYSICS, false);
+ }
- for (U32 i = 0; i < buffer->getNumIndices(); i += 3)
+ auto num_degenerate = 0;
+ auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size();
+ for (U32 v = 0; v < num_models; ++v)
{
- LLVector4a v1; v1.setMul(pos[*idx++], scale);
- LLVector4a v2; v2.setMul(pos[*idx++], scale);
- LLVector4a v3; v3.setMul(pos[*idx++], scale);
+ LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][v];
+ if(buffer->getNumVerts() < 3)continue;
+
+ buffer->setBuffer(type_mask & buffer->getTypeMask());
+
+ LLStrider<LLVector3> pos_strider;
+ buffer->getVertexStrider(pos_strider, 0);
+ LLVector4a* pos = (LLVector4a*)pos_strider.get();
- if (ll_is_degenerate(v1,v2,v3))
+ LLStrider<U16> idx;
+ buffer->getIndexStrider(idx, 0);
+
+ LLVector4a v1, v2, v3;
+ for (U32 indices_offset = 0; indices_offset < buffer->getNumIndices(); indices_offset += 3)
{
- buffer->draw(LLRender::LINE_LOOP, 3, i);
- buffer->draw(LLRender::POINTS, 3, i);
+ v1.setMul(pos[*idx++], scale);
+ v2.setMul(pos[*idx++], scale);
+ v3.setMul(pos[*idx++], scale);
+
+ if (ll_is_degenerate(v1, v2, v3))
+ {
+ num_degenerate++;
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ gGL.diffuseColor3fv(deg_edge_col().mV);
+ buffer->drawRange(LLRender::TRIANGLES, 0, 2, 3, indices_offset);
+ buffer->drawRange(LLRender::POINTS, 0, 2, 3, indices_offset);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ gGL.diffuseColor3fv(deg_fill_col().mV);
+ buffer->drawRange(LLRender::TRIANGLES, 0, 2, 3, indices_offset);
+ }
}
}
}
}
- }
- gGL.popMatrix();
+ gGL.popMatrix();
+ }
+ glLineWidth(1.f);
+ glPointSize(1.f);
+ gPipeline.enableLightsPreview();
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
- glLineWidth(1.f);
- glPointSize(1.f);
- gPipeline.enableLightsPreview();
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
}
}
@@ -4118,7 +4498,7 @@ BOOL LLModelPreview::render()
target_pos = getPreviewAvatar()->getPositionAgent();
LLViewerCamera::getInstance()->setOriginAndLookAt(
- target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + offset) * av_rot), // camera
+ target_pos + ((LLVector3(camera_distance, 0.f, 0.f) + offset) * av_rot), // camera
LLVector3::z_axis, // up
target_pos); // point of interest
@@ -4191,11 +4571,11 @@ BOOL LLModelPreview::render()
}
buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0);
- gGL.diffuseColor3f(0.4f, 0.4f, 0.4f);
if (edges)
{
- glLineWidth(3.f);
+ gGL.diffuseColor4fv(edge_col().mV);
+ glLineWidth(edge_width);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -4258,14 +4638,17 @@ void LLModelPreview::rotate(F32 yaw_radians, F32 pitch_radians)
void LLModelPreview::zoom(F32 zoom_amt)
{
F32 new_zoom = mCameraZoom+zoom_amt;
-
- mCameraZoom = llclamp(new_zoom, 1.f, 10.f);
+ // TODO: stop clamping in render
+ static LLCachedControl<F32> zoom_limit(gSavedSettings, "MeshPreviewZoomLimit");
+ mCameraZoom = llclamp(new_zoom, 1.f, zoom_limit());
}
void LLModelPreview::pan(F32 right, F32 up)
{
- mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * mCameraDistance / mCameraZoom, -1.f, 1.f);
- mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
+ bool skin_weight = mViewOption["show_skin_weight"];
+ F32 camera_distance = skin_weight ? SKIN_WEIGHT_CAMERA_DISTANCE : mCameraDistance;
+ mCameraOffset.mV[VY] = llclamp(mCameraOffset.mV[VY] + right * camera_distance / mCameraZoom, -1.f, 1.f);
+ mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * camera_distance / mCameraZoom, -1.f, 1.f);
}
void LLModelPreview::setPreviewLOD(S32 lod)
@@ -4280,12 +4663,6 @@ void LLModelPreview::setPreviewLOD(S32 lod)
combo_box->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
mFMP->childSetValue("lod_file_" + lod_name[mPreviewLOD], mLODFile[mPreviewLOD]);
- LLComboBox* combo_box2 = mFMP->getChild<LLComboBox>("preview_lod_combo2");
- combo_box2->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
-
- LLComboBox* combo_box3 = mFMP->getChild<LLComboBox>("preview_lod_combo3");
- combo_box3->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
-
LLColor4 highlight_color = LLUIColorTable::instance().getColor("MeshImportTableHighlightColor");
LLColor4 normal_color = LLUIColorTable::instance().getColor("MeshImportTableNormalColor");
@@ -4315,12 +4692,15 @@ void LLFloaterModelPreview::onReset(void* user_data)
{
assert_main_thread();
+
LLFloaterModelPreview* fmp = (LLFloaterModelPreview*) user_data;
fmp->childDisable("reset_btn");
+ fmp->clearLogTab();
LLModelPreview* mp = fmp->mModelPreview;
std::string filename = mp->mLODFile[LLModel::LOD_HIGH];
fmp->resetDisplayOptions();
+ fmp->resetUploadOptions();
//reset model preview
fmp->initModelPreview();
@@ -4334,6 +4714,7 @@ void LLFloaterModelPreview::onUpload(void* user_data)
assert_main_thread();
LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data;
+ mp->clearLogTab();
mp->mUploadBtn->setEnabled(false);
@@ -4434,11 +4815,6 @@ void LLFloaterModelPreview::setStatusMessage(const std::string& msg)
mStatusMessage = msg;
}
-void LLFloaterModelPreview::toggleCalculateButton()
-{
- toggleCalculateButton(true);
-}
-
void LLFloaterModelPreview::toggleCalculateButton(bool visible)
{
mCalculateBtn->setVisible(visible);
@@ -4465,11 +4841,15 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible)
childSetTextArg("server_weight", "[SIM]", tbd);
childSetTextArg("physics_weight", "[PH]", tbd);
childSetTextArg("upload_fee", "[FEE]", tbd);
- childSetTextArg("price_breakdown", "[STREAMING]", tbd);
- childSetTextArg("price_breakdown", "[PHYSICS]", tbd);
- childSetTextArg("price_breakdown", "[INSTANCES]", tbd);
- childSetTextArg("price_breakdown", "[TEXTURES]", tbd);
- childSetTextArg("price_breakdown", "[MODEL]", tbd);
+ std::string dashes = hasString("--") ? getString("--") : "--";
+ childSetTextArg("price_breakdown", "[STREAMING]", dashes);
+ childSetTextArg("price_breakdown", "[PHYSICS]", dashes);
+ childSetTextArg("price_breakdown", "[INSTANCES]", dashes);
+ childSetTextArg("price_breakdown", "[TEXTURES]", dashes);
+ childSetTextArg("price_breakdown", "[MODEL]", dashes);
+ childSetTextArg("physics_breakdown", "[PCH]", dashes);
+ childSetTextArg("physics_breakdown", "[PM]", dashes);
+ childSetTextArg("physics_breakdown", "[PHU]", dashes);
}
}
@@ -4496,6 +4876,81 @@ void LLFloaterModelPreview::resetDisplayOptions()
}
}
+void LLFloaterModelPreview::resetUploadOptions()
+{
+ childSetValue("import_scale", 1);
+ childSetValue("pelvis_offset", 0);
+ childSetValue("physics_explode", 0);
+ childSetValue("physics_file", "");
+ childSetVisible("Retain%", false);
+ childSetVisible("Retain%_label", false);
+ childSetVisible("Detail Scale", true);
+ childSetVisible("Detail Scale label", true);
+
+ getChild<LLComboBox>("lod_source_" + lod_name[NUM_LOD - 1])->setCurrentByIndex(LLModelPreview::LOD_FROM_FILE);
+ for (S32 lod = 0; lod < NUM_LOD - 1; ++lod)
+ {
+ getChild<LLComboBox>("lod_source_" + lod_name[lod])->setCurrentByIndex(LLModelPreview::GENERATE);
+ childSetValue("lod_file_" + lod_name[lod], "");
+ }
+
+ for(auto& p : mDefaultDecompParams)
+ {
+ std::string ctrl_name(p.first);
+ LLUICtrl* ctrl = getChild<LLUICtrl>(ctrl_name);
+ if (ctrl)
+ {
+ ctrl->setValue(p.second);
+ }
+ }
+ getChild<LLComboBox>("physics_lod_combo")->setCurrentByIndex(0);
+ getChild<LLComboBox>("Cosine%")->setCurrentByIndex(0);
+}
+
+void LLFloaterModelPreview::clearLogTab()
+{
+ mUploadLogText->clear();
+ LLPanel* panel = mTabContainer->getPanelByName("logs_panel");
+ mTabContainer->setTabPanelFlashing(panel, false);
+}
+
+void LLFloaterModelPreview::populateOverridesTab()
+{
+ mJointOverrides.clear();
+ attach_override_data_map_t attach_not_in_use;
+ mModelPreview->getPreviewAvatar()->getAttachmentOverrides(mJointOverrides, attach_not_in_use);
+
+ if (mJointOverrides.empty())
+ {
+ disableOverridesTab();
+ return;
+ }
+
+ LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
+ S32 index = mTabContainer->getIndexForPanel(panel);
+ mTabContainer->enableTabButton(index, true);
+
+ LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list");
+ joints_list->deleteAllItems();
+
+ joint_override_data_map_t::iterator joint_iter = mJointOverrides.begin();
+ joint_override_data_map_t::iterator joint_end = mJointOverrides.end();
+ while (joint_iter != joint_end)
+ {
+ const std::string& listName = joint_iter->first;
+ joints_list->addSimpleElement(listName);
+ joint_iter++;
+ }
+ joints_list->selectFirstItem();
+}
+
+void LLFloaterModelPreview::disableOverridesTab()
+{
+ LLPanel *panel = mTabContainer->getPanelByName("overrides_panel");
+ S32 index = mTabContainer->getIndexForPanel(panel);
+ mTabContainer->enableTabButton(index, false);
+}
+
void LLFloaterModelPreview::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url)
{
mModelPhysicsFee = result;
@@ -4519,6 +4974,16 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived()
childSetTextArg("price_breakdown", "[INSTANCES]", llformat("%d", result["upload_price_breakdown"]["mesh_instance"].asInteger()));
childSetTextArg("price_breakdown", "[TEXTURES]", llformat("%d", result["upload_price_breakdown"]["texture"].asInteger()));
childSetTextArg("price_breakdown", "[MODEL]", llformat("%d", result["upload_price_breakdown"]["model"].asInteger()));
+
+ childSetTextArg("physics_breakdown", "[PCH]", llformat("%0.3f", result["model_physics_cost"]["hull"].asReal()));
+ childSetTextArg("physics_breakdown", "[PM]", llformat("%0.3f", result["model_physics_cost"]["mesh"].asReal()));
+ childSetTextArg("physics_breakdown", "[PHU]", llformat("%0.3f", result["model_physics_cost"]["decomposition"].asReal()));
+ childSetTextArg("streaming_breakdown", "[STR_TOTAL]", llformat("%d", result["streaming_cost"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_HIGH]", llformat("%d", result["streaming_params"]["high_lod"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_MED]", llformat("%d", result["streaming_params"]["medium_lod"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_LOW]", llformat("%d", result["streaming_params"]["low_lod"].asInteger()));
+ childSetTextArg("streaming_breakdown", "[STR_LOWEST]", llformat("%d", result["streaming_params"]["lowest_lod"].asInteger()));
+
childSetVisible("upload_fee", true);
childSetVisible("price_breakdown", true);
mUploadBtn->setEnabled(isModelUploadAllowed());
@@ -4526,7 +4991,11 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived()
void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(S32 status, const std::string& reason)
{
- LL_WARNS() << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << LL_ENDL;
+ std::ostringstream out;
+ out << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status;
+ out << " : " << reason << ")";
+ LL_WARNS() << out.str() << LL_ENDL;
+ LLFloaterModelPreview::addStringToLog(out, false);
doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, true));
}
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index edc90d1695..8988dd2565 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -30,6 +30,7 @@
#include "llfloaternamedesc.h"
#include "lldynamictexture.h"
+#include "lljointoverridedata.h"
#include "llquaternion.h"
#include "llmeshrepository.h"
#include "llmodel.h"
@@ -57,7 +58,9 @@ class domController;
class domSkin;
class domMesh;
class LLMenuButton;
+class LLTabContainer;
class LLToggleableMenu;
+class LLViewerTextEditor;
class LLFloaterModelPreview : public LLFloaterModelUploadBase
{
@@ -92,7 +95,10 @@ public:
/*virtual*/ void onClose(bool app_quitting);
static void onMouseCaptureLostModelPreview(LLMouseHandler*);
- static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
+ static void setUploadAmount(S32 amount) { sUploadAmount = amount; }
+ static void addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod = -1);
+ static void addStringToLog(const std::string& str, bool flash);
+ static void addStringToLog(const std::ostringstream& strm, bool flash);
void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost);
void setPreviewLOD(S32 lod);
@@ -109,11 +115,13 @@ public:
void loadModel(S32 lod, const std::string& file_name, bool force_disable_slm = false);
void onViewOptionChecked(LLUICtrl* ctrl);
+ void onUploadOptionChecked(LLUICtrl* ctrl);
bool isViewOptionChecked(const LLSD& userdata);
bool isViewOptionEnabled(const LLSD& userdata);
void setViewOptionEnabled(const std::string& option, bool enabled);
void enableViewOption(const std::string& option);
void disableViewOption(const std::string& option);
+ void onShowSkinWeightChecked(LLUICtrl* ctrl);
bool isModelLoading();
@@ -154,6 +162,7 @@ protected:
static void onAutoFillCommit(LLUICtrl*,void*);
void onLODParamCommit(S32 lod, bool enforce_tri_limit);
+ void draw3dPreview();
static void onExplodeCommit(LLUICtrl*, void*);
@@ -175,11 +184,13 @@ protected:
// FIXME - this function and mStatusMessage have no visible effect, and the
// actual status messages are managed by directly manipulation of
// the UI element.
- void setStatusMessage(const std::string& msg);
+ void setStatusMessage(const std::string& msg);
+ void addStringToLogTab(const std::string& str, bool flash);
LLModelPreview* mModelPreview;
LLPhysicsDecomp::decomp_params mDecompParams;
+ LLPhysicsDecomp::decomp_params mDefaultDecompParams;
S32 mLastMouseX;
S32 mLastMouseY;
@@ -203,8 +214,8 @@ protected:
LLSD mModelPhysicsFee;
private:
- void onClickCalculateBtn();
- void toggleCalculateButton();
+ void onClickCalculateBtn();
+ void onJointListSelection();
void onLoDSourceCommit(S32 lod);
@@ -214,10 +225,19 @@ private:
// resets display options of model preview to their defaults.
void resetDisplayOptions();
+ void resetUploadOptions();
+ void clearLogTab();
+ void populateOverridesTab();
+ void disableOverridesTab();
+
void createSmoothComboBox(LLComboBox* combo_box, float min, float max);
LLButton* mUploadBtn;
LLButton* mCalculateBtn;
+ LLViewerTextEditor* mUploadLogText;
+ LLTabContainer* mTabContainer;
+
+ joint_override_data_map_t mJointOverrides;
};
class LLMeshFilePicker : public LLFilePickerThread
@@ -296,8 +316,9 @@ public:
void setRigValidForJointPositionUpload( bool rigValid ) { mRigValidJointUpload = rigValid; }
//Accessors for the legacy rigs
- const bool isLegacyRigValid( void ) const { return mLegacyRigValid; }
- void setLegacyRigValid( bool rigValid ) { mLegacyRigValid = rigValid; }
+ const bool isLegacyRigValid( void ) const { return mLegacyRigFlags == 0; }
+ U32 getLegacyRigFlags() const { return mLegacyRigFlags; }
+ void setLegacyRigFlags( U32 rigFlags ) { mLegacyRigFlags = rigFlags; }
static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
static bool lodQueryCallback();
@@ -312,6 +333,7 @@ public:
static bool sIgnoreLoadedCallback;
std::vector<S32> mLodsQuery;
std::vector<S32> mLodsWithParsingError;
+ bool mHasDegenerate;
protected:
@@ -410,7 +432,7 @@ private:
float mPelvisZOffset;
bool mRigValidJointUpload;
- bool mLegacyRigValid;
+ U32 mLegacyRigFlags;
bool mLastJointUpdate;
diff --git a/indra/newview/lljointoverridedata.h b/indra/newview/lljointoverridedata.h
new file mode 100644
index 0000000000..99baa5f334
--- /dev/null
+++ b/indra/newview/lljointoverridedata.h
@@ -0,0 +1,53 @@
+/**
+ * @file lljointoverridedata.h
+ * @brief Declaration of LLJointOverrideData and LLAttachmentOverrideData
+ *
+ * $LicenseInfo:firstyear=2020&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2020, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_JOINTOVERRIDEDATA_H
+#define LL_JOINTOVERRIDEDATA_H
+
+//#include <map>
+//#include <string>
+//#include <vector>
+
+
+struct LLJointOverrideData
+{
+ std::set<LLVector3> mPosOverrides;
+ LLVector3 mActivePosOverride;
+ std::set<LLVector3> mScaleOverrides;
+ LLVector3 mActiveScaleOverride;
+};
+
+struct LLAttachmentOverrideData
+{
+ std::set<LLVector3> mPosOverrides;
+ LLVector3 mActivePosOverride;
+};
+
+typedef std::map<std::string, LLJointOverrideData> joint_override_data_map_t;
+typedef std::map<std::string, LLAttachmentOverrideData> attach_override_data_map_t;
+
+#endif // LL_JOINTOVERRIDEDATA_H
+
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 3b51d07f96..dac516d15c 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -6376,6 +6376,56 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const
}
//-----------------------------------------------------------------------------
+// getAttachmentOverrides
+//-----------------------------------------------------------------------------
+void LLVOAvatar::getAttachmentOverrides(joint_override_data_map_t &joint_overrides, attach_override_data_map_t &attach_overrides) const
+{
+ LLVector3 pos, scale;
+ LLUUID mesh_id;
+ S32 count = 0;
+
+ // Bones
+ for (avatar_joint_list_t::const_iterator iter = mSkeleton.begin();
+ iter != mSkeleton.end(); ++iter)
+ {
+ const LLJoint* pJoint = (*iter);
+ LLJointOverrideData data;
+ bool joint_override = false;
+ if (pJoint && pJoint->hasAttachmentPosOverride(pos, mesh_id))
+ {
+ pJoint->getAllAttachmentPosOverrides(count, data.mPosOverrides);
+ data.mActivePosOverride = pos;
+ joint_override = true;
+ }
+ if (pJoint && pJoint->hasAttachmentScaleOverride(scale, mesh_id))
+ {
+ pJoint->getAllAttachmentScaleOverrides(count, data.mPosOverrides);
+ data.mActiveScaleOverride = scale;
+ joint_override = true;
+ }
+ if (joint_override)
+ {
+ joint_overrides[pJoint->getName()] = data;
+ }
+ }
+
+ // Attachment points
+ for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ const LLViewerJointAttachment *attachment_pt = (*iter).second;
+ if (attachment_pt && attachment_pt->hasAttachmentPosOverride(pos, mesh_id))
+ {
+ LLAttachmentOverrideData data;
+ attachment_pt->getAllAttachmentPosOverrides(count, data.mPosOverrides);
+ data.mActivePosOverride = pos;
+ attach_overrides[attachment_pt->getName()] = data;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
// removeAttachmentOverridesForObject
//-----------------------------------------------------------------------------
void LLVOAvatar::removeAttachmentOverridesForObject(LLViewerObject *vo)
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 00dccc5d12..53a1d48d72 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -36,23 +36,25 @@
#include <boost/signals2/trackable.hpp>
#include "llavatarappearance.h"
+#include "llavatarappearancedefines.h"
+#include "llavatarrendernotifier.h"
+#include "llcontrol.h"
+#include "llcharacter.h"
#include "llchat.h"
#include "lldrawpoolalpha.h"
-#include "llviewerobject.h"
-#include "llcharacter.h"
-#include "llcontrol.h"
-#include "llviewerjointmesh.h"
-#include "llviewerjointattachment.h"
-#include "llrendertarget.h"
-#include "llavatarappearancedefines.h"
-#include "lltexglobalcolor.h"
#include "lldriverparam.h"
-#include "llviewertexlayer.h"
-#include "material_codes.h" // LL_MCODE_END
+#include "lljointoverridedata.h"
+#include "llrendertarget.h"
#include "llrigginginfo.h"
+#include "lltexglobalcolor.h"
+#include "llviewerjointmesh.h"
+#include "llviewerjointattachment.h"
+#include "llviewerobject.h"
#include "llviewerstats.h"
+#include "llviewertexlayer.h"
#include "llvovolume.h"
-#include "llavatarrendernotifier.h"
+
+#include "material_codes.h" // LL_MCODE_END
extern const LLUUID ANIM_AGENT_BODY_NOISE;
extern const LLUUID ANIM_AGENT_BREATHE_ROT;
@@ -215,6 +217,8 @@ public:
void rebuildAttachmentOverrides();
void updateAttachmentOverrides();
void showAttachmentOverrides(bool verbose = false) const;
+ void getAttachmentOverrides(joint_override_data_map_t& joint_overrides,
+ attach_override_data_map_t& attach_overrides) const;
void getAttachmentOverrideNames(std::set<std::string>& pos_names,
std::set<std::string>& scale_names) const;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index bec33790bd..fe7b6f06f3 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6589,7 +6589,7 @@ void LLPipeline::enableLightsPreview()
light->enable();
light->setPosition(light_pos);
light->setDiffuse(diffuse0);
- light->setAmbient(LLColor4::black);
+ light->setAmbient(ambient);
light->setSpecular(specular0);
light->setSpotExponent(0.f);
light->setSpotCutoff(180.f);
@@ -6600,7 +6600,7 @@ void LLPipeline::enableLightsPreview()
light->enable();
light->setPosition(light_pos);
light->setDiffuse(diffuse1);
- light->setAmbient(LLColor4::black);
+ light->setAmbient(ambient);
light->setSpecular(specular1);
light->setSpotExponent(0.f);
light->setSpotCutoff(180.f);
@@ -6610,7 +6610,7 @@ void LLPipeline::enableLightsPreview()
light->enable();
light->setPosition(light_pos);
light->setDiffuse(diffuse2);
- light->setAmbient(LLColor4::black);
+ light->setAmbient(ambient);
light->setSpecular(specular2);
light->setSpotExponent(0.f);
light->setSpotCutoff(180.f);
diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml
index 5a86eb06fb..b675a3e3be 100644
--- a/indra/newview/skins/default/xui/en/floater_model_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml
@@ -2,12 +2,12 @@
<floater
can_close="true"
can_drag_on_left="false"
- can_minimize="false"
- can_resize="false"
- height="480"
- min_height="480"
- width="980"
- min_width="980"
+ can_minimize="true"
+ can_resize="true"
+ height="600"
+ min_height="600"
+ width="1024"
+ min_width="1024"
name="Model Preview"
title="UPLOAD MODEL"
help_topic="upload_model" >
@@ -33,19 +33,26 @@
<string name="mesh_status_missing_lod">Missing required level of detail.</string>
<string name="mesh_status_invalid_material_list">LOD materials are not a subset of reference model.</string>
<string name="phys_status_vertex_limit_exceeded">Some physical hulls exceed vertex limitations.</string>
+ <string name="phys_status_degenerate_triangles">The physics mesh too dense remove the small thin triangles (see preview)</string>
<string name="layer_all">All</string> <!-- Text to display in physics layer combo box for "all layers" -->
<string name="decomposing">Analyzing...</string>
<string name="simplifying">Simplifying...</string>
<string name="tbd">TBD</string>
+
+ <!-- Warnings from model loader-->
+ <string name="TooManyJoint">Skinning disabled due to too many joints: [JOINTS], maximum: [MAX]</string>
+ <string name="UnrecognizedJoint">Rigged to unrecognized joint name [NAME]</string>
+ <string name="UnknownJoints">Skinning disabled due to [COUNT] unknown joints</string>
+
-<panel
- follows="top|left"
- height="455"
- layout="topleft"
- left="3"
- name="left_panel"
- top_pad="10"
- width="630">
+ <panel
+ follows="top|left"
+ height="580"
+ layout="topleft"
+ left="3"
+ name="left_panel"
+ top_pad="0"
+ width="630">
<panel
follows="all"
height="50"
@@ -81,7 +88,8 @@
height="300"
width="635"
name="import_tab"
- tab_position="top">
+ tab_position="top"
+ enable_tabs_flashing="true">
<!-- LOD PANEL -->
<panel
help_topic="upload_model_lod"
@@ -97,7 +105,7 @@
left="3"
name="lod_tab_border"
top_pad="0"
- width="629" />
+ width="619" />
<text
follows="left|top"
height="18"
@@ -755,8 +763,9 @@
name="first_step_name"
text_color="White"
top_pad="0"
- width="210">
- Step 1: Level of Detail
+ width="210"
+ valign="center">
+ Step 1: Pick a physics model :
</text>
<combo_box
follows="left|top"
@@ -798,7 +807,7 @@
layout="topleft"
left="18"
name="physics_tab_border"
- top_pad="15"
+ top_pad="10"
width="589"/>
<panel
bg_alpha_color="0 0 0 0"
@@ -807,7 +816,7 @@
follows="top|left"
left="18"
name="physics analysis"
- top_pad="15"
+ top_pad="10"
visible="true"
width="589">
<text
@@ -819,7 +828,7 @@
name="method_label"
text_color="White"
top_pad="0">
- Step 2: Analyze
+ Step 2: Convert to hulls (optional)
</text>
<text
follows="top|left"
@@ -905,7 +914,7 @@
layout="topleft"
left="18"
name="physics_tab_border"
- top_pad="15"
+ top_pad="10"
width="589"/>
<panel
bg_alpha_color="0 0 0 0"
@@ -914,7 +923,7 @@
height="66"
left="18"
name="physics simplification"
- top_pad="15"
+ top_pad="10"
width="589">
<text
text_color="White"
@@ -1013,7 +1022,7 @@
layout="topleft"
left="18"
name="physics_tab_border"
- top_pad="15"
+ top_pad="10"
width="589"/>
<panel
bg_alpha_color="0 0 0 0"
@@ -1075,10 +1084,9 @@
follows="left|top"
height="19"
layout="topleft"
- left_pad="5"
- top_delta="0"
+ top_pad="5"
name="physics message"
- width="270">
+ width="589">
<icon
follows="left|top"
height="16"
@@ -1093,7 +1101,7 @@
layout="topleft"
left_pad="2"
name="physics_status_message_text"
- width="252"
+ width="573"
top_delta="3"/>
</panel>
</panel>
@@ -1182,20 +1190,41 @@
label_text.text_color="White"
name="upload_skin"
top_pad="15"/>
+ <text
+ follows="top|left"
+ height="17"
+ left="40"
+ name="skin_too_many_joints"
+ text_color="Orange"
+ top_pad="-2"
+ width="150">
+ Too many skinned joints
+ </text>
+ <text
+ follows="top|left"
+ height="17"
+ left="40"
+ name="skin_unknown_joint"
+ text_color="Orange"
+ top_pad="-17"
+ width="150">
+ Model has an unknown joint(s)
+ </text>
<check_box
follows="top|left"
height="15"
label="Include joint positions"
label_text.text_color="White"
name="upload_joints"
- top_pad="15"/>
+ left_delta="-20"
+ top_pad="1"/>
<check_box
follows="top|left"
height="15"
label="Lock scale if joint position defined"
label_text.text_color="White"
name="lock_scale_if_joint_position"
- top_pad="15"/>
+ top_pad="16"/>
<text
follows="top|left"
height="15"
@@ -1217,15 +1246,166 @@
value="0.0"
width="80"/>
</panel>
+ <panel
+ label="Overrides"
+ layout="topleft"
+ name="overrides_panel"
+ title="Overrides">
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="275"
+ layout="topleft"
+ left="3"
+ name="log_tab_border"
+ top_pad="0"
+ width="619" />
+ <text
+ layout="topleft"
+ follows="top|left"
+ height="15"
+ left="6"
+ name="joints_descr"
+ top="4"
+ width="300">
+ Joints:
+ </text>
+ <scroll_list
+ layout="topleft"
+ follows="top|left"
+ name="joints_list"
+ column_padding="0"
+ draw_heading="false"
+ draw_stripes="false"
+ commit_on_selection_change="true"
+ heading_height="23"
+ height="253"
+ left="6"
+ top_pad="0"
+ width="150"/>
+ <text
+ layout="topleft"
+ follows="top|left"
+ height="15"
+ left_pad="5"
+ name="pos_overrides_descr"
+ top="4"
+ width="300">
+ Position overrides for joint '[JOINT]':
+ </text>
+ <scroll_list
+ layout="topleft"
+ follows="top|left"
+ name="pos_overrides_list"
+ column_padding="0"
+ draw_heading="true"
+ draw_stripes="false"
+ heading_height="23"
+ height="100"
+ left_delta="0"
+ top_pad="0"
+ width="310">
+ <scroll_list.columns
+ label="*"
+ name="override"
+ relative_width="0.22" />
+ <scroll_list.columns
+ label="X"
+ name="axis_x"
+ relative_width="0.26" />
+ <scroll_list.columns
+ label="Y"
+ name="axis_y"
+ relative_width="0.26" />
+ <scroll_list.columns
+ label="Z"
+ name="axis_z"
+ relative_width="0.26" />
+ </scroll_list>
+ <text
+ layout="topleft"
+ follows="top|left"
+ height="15"
+ left_delta="0"
+ name="scale_overrides_descr"
+ top_pad="3"
+ width="300">
+ Scale overrides for joint '[JOINT]':
+ </text>
+ <scroll_list
+ layout="topleft"
+ follows="top|left"
+ name="scale_overrides_list"
+ column_padding="0"
+ draw_heading="true"
+ draw_stripes="false"
+ heading_height="23"
+ height="100"
+ left_delta="0"
+ top_pad="0"
+ width="310">
+ <scroll_list.columns
+ label="*"
+ name="override"
+ relative_width="0.22" />
+ <scroll_list.columns
+ label="X"
+ name="axis_x"
+ relative_width="0.26" />
+ <scroll_list.columns
+ label="Y"
+ name="axis_y"
+ relative_width="0.26" />
+ <scroll_list.columns
+ label="Z"
+ name="axis_z"
+ relative_width="0.26" />
+ </scroll_list>
+ </panel>
+ <panel
+ label="Log"
+ layout="topleft"
+ name="logs_panel"
+ title="Log">
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="275"
+ layout="topleft"
+ left="3"
+ name="log_tab_border"
+ top_pad="0"
+ width="619" />
+ <text_editor
+ type="string"
+ length="1"
+ embedded_items="false"
+ follows="top|left"
+ font="SansSerif"
+ ignore_tab="false"
+ layout="topleft"
+ height="275"
+ left="4"
+ top="0"
+ right="-11"
+ max_length="65536"
+ name="log_text"
+ parse_urls="true"
+ spellcheck="false"
+ read_only="true"
+ word_wrap="true">
+ </text_editor>
+ </panel>
</tab_container>
<panel
- follows="top|left"
- height="80"
- layout="top|left"
- left="0"
+ follows="top|left|bottom"
+ layout="topleft"
+ height="197"
+ left="4"
+ border="true"
name="weights_and_warning_panel"
top_pad="3"
- width="625">
+ width="629">
<button
follows="top|left"
label="Calculate weights &amp; fee"
@@ -1265,10 +1445,10 @@
label_color="White"
layout="topleft"
name="reset_btn"
- right="-2"
+ right="-5"
top="3"
height="20"
- width="275"/>
+ width="265"/>
<!-- ========== WEIGHTS ==========-->
<text
follows="top|left"
@@ -1287,7 +1467,7 @@
left_pad="0"
name="prim_weight"
top_delta="0"
- width="120"
+ width="130"
word_wrap="true">
Land impact: [EQ]
</text>
@@ -1297,7 +1477,7 @@
left_pad="0"
name="download_weight"
top_delta="0"
- width="100"
+ width="130"
word_wrap="true">
Download: [ST]
</text>
@@ -1307,7 +1487,7 @@
layout="topleft"
left_pad="0"
name="physics_weight"
- width="90"
+ width="130"
word_wrap="true">
Physics: [PH]
</text>
@@ -1317,17 +1497,148 @@
layout="topleft"
left_pad="0"
name="server_weight"
- width="83"
+ width="130"
word_wrap="true">
Server: [SIM]
</text>
- <!-- ========== NOTE MESSAGE ========== -->
+ <!-- =========== Cost breakdown ======== -->
+ <panel
+ border="true"
+ top_pad="5"
+ layout="topleft"
+ left="6"
+ name="price_breakdown_panel"
+ width="120"
+ height="100">
+ <text
+ layout="topleft"
+ left="3">
+ Price Breakdown
+ </text>
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="0"
+ layout="topleft"
+ left="3"
+ name="price_breakdown_border"
+ top_pad="5"
+ width="110"/>
+ <text
+ height="80"
+ top_pad="5"
+ layout="topleft"
+ left="3"
+ name="price_breakdown_labels"
+ width="70"
+ word_wrap="false">
+Download:
+Physics:
+Instances:
+Textures:
+Model:
+ </text>
+ <text
+ height="80"
+ top_delta="0"
+ layout="topleft"
+ halign="right"
+ left_pad="0"
+ name="price_breakdown"
+ width="40"
+ word_wrap="false">
+[STREAMING]
+[PHYSICS]
+[INSTANCES]
+[TEXTURES]
+[MODEL]
+ </text>
+ </panel>
+ <!--
+ Streaming breakdown numbers are available but not fully understood
+ uncommenting the following sections will display the numbers for debugging purposes
<text
+ height="80"
+ top_delta="0"
+ layout="topleft"
+ left="130"
+ name="streaming_breakdown_labels"
+ width="65"
+ word_wrap="true">
+Streaming/Download:
+High:
+Medium:
+Low:
+Lowest:
+ </text>
+ <text
+ height="80"
+ top_delta="0"
+ layout="topleft"
+ left_pad="0"
+ name="streaming_breakdown"
+ width="95"
+ word_wrap="true">
+[STR_TOTAL]
+[STR_HIGH]
+[STR_MED]
+[STR_LOW]
+[STR_LOWEST]
+ </text>-->
+ <panel
+ border="true"
+ layout="topleft"
+ left_pad="265"
+ name="physics_costs_panel"
+ width="120"
+ height="100">
+ <text
+ layout="topleft"
+ left="3">
+ Physics Costs
+ </text>
+ <view_border
+ bevel_style="none"
+ follows="top|left"
+ height="0"
+ layout="topleft"
+ left="3"
+ name="price_breakdown_border"
+ top_pad="5"
+ width="110"/>
+ <text
+ height="80"
+ top_pad="5"
+ layout="topleft"
+ left="5"
+ name="physics_breakdown_labels"
+ width="65">
+Base Hull:
+Mesh:
+Analysed:
+ </text>
+ <text
+ height="80"
+ top_delta="0"
+ layout="topleft"
+ left_pad="0"
+ name="physics_breakdown"
+ width="40"
+ halign="right"
+ word_wrap="false"
+ visible="true">
+[PCH]
+[PM]
+[PHU]
+ </text>-->
+ </panel>
+ <!-- ========== NOTE MESSAGE ========== -->
+ <text
font="SansSerif"
layout="topleft"
left="6"
name="warning_title"
- top_pad="10"
+ top_pad="5"
text_color="DrYellow"
visible="false"
width="40">
@@ -1346,119 +1657,120 @@
visible="false">
You dont have rights to upload mesh models. [[VURL] Find out how] to get certified.
</text>
- <text text_color="Yellow" layout="topleft" top_delta="20" left="6" name="status">[STATUS]</text>
-
+ <text text_color="Yellow" layout="topleft" top_pad="-1" left="6" name="status">
+[STATUS]
+ </text>
</panel>
-</panel>
-
-<text
- follows="left|top"
- layout="topleft"
- left="640"
- name="lod_label"
- text_color="White"
- top="13"
- height="15"
- width="290">
- Preview:
- </text>
-<panel
- border="true"
- bevel_style="none"
- follows="top|left"
- name="preview_panel"
- top_pad="4"
- width="290"
- height="290"/>
-
-<panel
- follows="all"
- height="130"
- layout="topleft"
- name="right_panel"
- top_pad="5"
- width="340">
- <combo_box
- top_pad="3"
+ </panel>
+ <panel
+ follows="top|left|bottom|right"
+ name="right_panel"
+ top="0"
+ left="640"
+ width="375">
+ <text
follows="left|top"
- height="18"
layout="topleft"
- name="preview_lod_combo"
- width="150"
- tool_tip="LOD to view in preview render">
+ left="0"
+ name="lod_label"
+ text_color="White"
+ top="13"
+ height="15"
+ width="290">
+ Preview:
+ </text>
+ <panel
+ follows="top|left"
+ height="20"
+ name="right_upper_panel"
+ top="8"
+ left="60"
+ width="315">
+ <combo_box
+ top_pad="3"
+ follows="top|left"
+ height="18"
+ layout="topleft"
+ name="preview_lod_combo"
+ width="75"
+ tool_tip="LOD to view in preview render">
<combo_item name="high"> High </combo_item>
<combo_item name="medium"> Medium </combo_item>
<combo_item name="low"> Low </combo_item>
<combo_item name="lowest"> Lowest </combo_item>
- </combo_box>
- <text
- follows="top|left"
- layout="topleft"
- text_color="White"
- top="5"
- left_pad="20"
- name="label_display"
- width="50">
- Display...
- </text>
- <check_box
- follows="top|left"
- label="Edges"
+ </combo_box>
+ </panel>
+ </panel>
+ <panel
+ border="true"
+ bevel_style="none"
+ follows="top|left|right|bottom"
+ layout="topleft"
+ name="preview_panel"
+ top="30"
+ width="375"
+ height="525"/>
+
+ <panel
+ follows="left|right|bottom"
+ layout="topleft"
+ height="40"
+ name="lower_right_panel"
+ top_pad="5"
+ width="375">
+ <check_box
+ follows="right|bottom"
+ label="Edges"
label_text.text_color="White"
layout="topleft"
- left_delta="0"
name="show_edges"
- top_pad="8">
- </check_box>
+ width="70"
+ left="0"
+ top_pad="8"/>
<check_box
- follows="top|left"
+ follows="right|bottom"
+ left_pad="8"
label="Physics"
label_text.text_color="White"
- layout="topleft"
- name="show_physics"
- top_pad="8">
- </check_box>
+ name="show_physics"/>
<check_box
- follows="top|left"
+ follows="right|bottom"
label="Textures"
label_text.text_color="White"
layout="topleft"
name="show_textures"
- top_pad="8">
- </check_box>
+ left_pad="0"/>
<check_box
- follows="top|left"
- label="Skin weights"
+ follows="right|bottom"
+ label="Weights"
label_text.text_color="White"
layout="topleft"
name="show_skin_weight"
- top_pad="8">
- </check_box>
+ left_pad="0"/>
<check_box
- follows="top|left"
+ follows="right|bottom"
label="Joints"
label_text.text_color="White"
layout="topleft"
name="show_joint_positions"
- top_pad="8">
- </check_box>
+ left_pad="0"/>
<text
- follows="top|left"
+ follows="right|bottom"
layout="topleft"
left="2"
name="physics_explode_label"
- top="85"
width="150">
Preview Spread:
</text>
<slider
name="physics_explode"
- follows="top|left"
- top="100"
- left="0"
+ follows="right|bottom"
+ valign="center"
+ left="105"
+ top_delta="-3"
min_val="0.0"
max_val="3.0"
height="20"
- width="150"/>
-</panel>
+ width="120"/>
+ </panel>
</floater>