diff options
-rw-r--r-- | indra/newview/llpanelobject.cpp | 119 | ||||
-rw-r--r-- | indra/newview/llpanelobject.h | 17 | ||||
-rw-r--r-- | indra/newview/llpanelvolume.cpp | 134 | ||||
-rw-r--r-- | indra/newview/llpanelvolume.h | 15 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_tools.xml | 192 |
5 files changed, 249 insertions, 228 deletions
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 05e185dcfd..f135fcbed6 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -67,7 +67,6 @@ #include "pipeline.h" #include "llviewercontrol.h" #include "lluictrlfactory.h" -#include "llmeshrepository.h" //#include "llfirstuse.h" #include "lldrawpool.h" @@ -132,27 +131,7 @@ BOOL LLPanelObject::postBuild() // Phantom checkbox mCheckPhantom = getChild<LLCheckBoxCtrl>("Phantom Checkbox Ctrl"); childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this); - - // PhysicsShapeType combobox - mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl"); - mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType)); - - // PhysicsGravity - mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity"); - mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsGravity, this, _1, mSpinPhysicsGravity)); - - // PhysicsFriction - mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction"); - mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsFriction, this, _1, mSpinPhysicsFriction)); - - // PhysicsDensity - mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density"); - mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsDensity, this, _1, mSpinPhysicsDensity)); - - // PhysicsRestitution - mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution"); - mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution)); - + // Position mLabelPosition = getChild<LLTextBox>("label position"); @@ -541,19 +520,7 @@ void LLPanelObject::getState( ) mCheckPhantom->set( mIsPhantom ); mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible ); - - mSpinPhysicsGravity->set(objectp->getPhysicsGravity()); - mSpinPhysicsGravity->setEnabled(editable); - - mSpinPhysicsFriction->set(objectp->getPhysicsFriction()); - mSpinPhysicsFriction->setEnabled(editable); - - mSpinPhysicsDensity->set(objectp->getPhysicsDensity()); - mSpinPhysicsDensity->setEnabled(editable); - - mSpinPhysicsRestitution->set(objectp->getPhysicsRestitution()); - mSpinPhysicsRestitution->setEnabled(editable); - + #if 0 // 1.9.2 mCastShadows = root_objectp->flagCastShadows(); mCheckCastShadows->set( mCastShadows ); @@ -1132,17 +1099,13 @@ void LLPanelObject::getState( ) mCtrlSculptInvert->setVisible(sculpt_texture_visible); - // update the physics shape combo to include allowed physics shapes - mComboPhysicsShapeType->removeall(); - mComboPhysicsShapeType->add(getString("None"), LLSD(1)); - // sculpt texture if (selected_item == MI_SCULPT) { - LLUUID id; + LLUUID id; LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); @@ -1203,27 +1166,6 @@ void LLPanelObject::getState( ) mSculptTextureRevert = LLUUID::null; } - if(isMesh && objectp) - { - const LLVolumeParams &volume_params = objectp->getVolume()->getParams(); - LLUUID mesh_id = volume_params.getSculptID(); - if(gMeshRepo.hasPhysicsShape(mesh_id)) - { - // if a mesh contains an uploaded or decomposed physics mesh, - // allow 'Prim' - mComboPhysicsShapeType->add(getString("Prim"), LLSD(0)); - } - } - else - { - // simple prims always allow physics shape prim - mComboPhysicsShapeType->add(getString("Prim"), LLSD(0)); - } - mComboPhysicsShapeType->add(getString("Convex Hull"), LLSD(2)); - mComboPhysicsShapeType->setValue(LLSD(objectp->getPhysicsShapeType())); - mComboPhysicsShapeType->setEnabled(editable); - - //---------------------------------------------------------------------------- mObject = objectp; @@ -1286,48 +1228,6 @@ void LLPanelObject::sendIsPhantom() } } -void LLPanelObject::sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata) -{ - U8 type = ctrl->getValue().asInteger(); - LLSelectMgr::getInstance()->selectionSetPhysicsType(type); - - refreshCost(); -} - -void LLPanelObject::sendPhysicsGravity(LLUICtrl* ctrl, void* userdata) -{ - F32 val = ctrl->getValue().asReal(); - LLSelectMgr::getInstance()->selectionSetGravity(val); -} - -void LLPanelObject::sendPhysicsFriction(LLUICtrl* ctrl, void* userdata) -{ - F32 val = ctrl->getValue().asReal(); - LLSelectMgr::getInstance()->selectionSetFriction(val); -} - -void LLPanelObject::sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata) -{ - F32 val = ctrl->getValue().asReal(); - LLSelectMgr::getInstance()->selectionSetRestitution(val); -} - -void LLPanelObject::sendPhysicsDensity(LLUICtrl* ctrl, void* userdata) -{ - F32 val = ctrl->getValue().asReal(); - LLSelectMgr::getInstance()->selectionSetDensity(val); -} - -void LLPanelObject::refreshCost() -{ - LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); - - if (obj) - { - obj->getObjectCost(); - } -} - void LLPanelObject::sendCastShadows() { BOOL value = mCheckCastShadows->get(); @@ -1931,14 +1831,6 @@ void LLPanelObject::refresh() gAgent.getRegion() && !gAgent.getRegion()->getCapability("GetMesh").empty(); - getChildView("label physicsshapetype")->setVisible(enable_mesh); - getChildView("Physics Shape Type Combo Ctrl")->setVisible(enable_mesh); - getChildView("Physics Gravity")->setVisible(enable_mesh); - getChildView("Physics Material Override")->setVisible(enable_mesh); - getChildView("Physics Friction")->setVisible(enable_mesh); - getChildView("Physics Density")->setVisible(enable_mesh); - getChildView("Physics Restitution")->setVisible(enable_mesh); - F32 max_scale = get_default_max_prim_scale(LLPickInfo::isFlora(mObject)); getChild<LLSpinCtrl>("Scale X")->setMaxValue(max_scale); @@ -2041,11 +1933,6 @@ void LLPanelObject::clearCtrls() mCheckPhantom ->set(FALSE); mCheckPhantom ->setEnabled( FALSE ); - mSpinPhysicsGravity->setEnabled(FALSE); - mSpinPhysicsFriction->setEnabled(FALSE); - mSpinPhysicsDensity->setEnabled(FALSE); - mSpinPhysicsRestitution->setEnabled(FALSE); - #if 0 // 1.9.2 mCheckCastShadows->set(FALSE); mCheckCastShadows->setEnabled( FALSE ); diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 54bb5df8bf..e2f2a4400d 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -62,15 +62,14 @@ public: static void onCommitPosition( LLUICtrl* ctrl, void* userdata); static void onCommitScale( LLUICtrl* ctrl, void* userdata); static void onCommitRotation( LLUICtrl* ctrl, void* userdata); - static void onCommitPhysics( LLUICtrl* ctrl, void* userdata); static void onCommitTemporary( LLUICtrl* ctrl, void* userdata); static void onCommitPhantom( LLUICtrl* ctrl, void* userdata); - static void onCommitPhysicsParam( LLUICtrl* ctrl, void* userdata); static void onCommitCastShadows( LLUICtrl* ctrl, void* userdata); + static void onCommitPhysics( LLUICtrl* ctrl, void* userdata); + static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); static void onCommitParametric(LLUICtrl* ctrl, void* userdata); - static void onCommitMaterial( LLUICtrl* ctrl, void* userdata); void onCommitSculpt(const LLSD& data); void onCancelSculpt(const LLSD& data); @@ -81,7 +80,6 @@ public: protected: void getState(); - void refreshCost(); void sendRotation(BOOL btn_down); void sendScale(BOOL btn_down); @@ -89,11 +87,6 @@ protected: void sendIsPhysical(); void sendIsTemporary(); void sendIsPhantom(); - void sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata); - void sendPhysicsGravity(LLUICtrl* ctrl, void* userdata); - void sendPhysicsFriction(LLUICtrl* ctrl, void* userdata); - void sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata); - void sendPhysicsDensity(LLUICtrl* ctrl, void* userdata); void sendCastShadows(); void sendSculpt(); @@ -167,12 +160,6 @@ protected: LLCheckBoxCtrl *mCheckPhantom; LLCheckBoxCtrl *mCheckCastShadows; - LLComboBox* mComboPhysicsShapeType; - LLSpinCtrl* mSpinPhysicsGravity; - LLSpinCtrl* mSpinPhysicsFriction; - LLSpinCtrl* mSpinPhysicsDensity; - LLSpinCtrl* mSpinPhysicsRestitution; - LLTextureCtrl *mCtrlSculptTexture; LLTextBox *mLabelSculptType; LLComboBox *mCtrlSculptType; diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 065c4d0b92..c443814c89 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -71,6 +71,11 @@ #include "lldrawpool.h" #include "lluictrlfactory.h" +// For mesh physics +#include "llagent.h" +#include "llviewercontrol.h" +#include "llmeshrepository.h" + // "Features" Tab BOOL LLPanelVolume::postBuild() @@ -129,6 +134,29 @@ BOOL LLPanelVolume::postBuild() getChild<LLUICtrl>("Light Ambiance")->setValidateBeforeCommit( precommitValidate); } + // PHYSICS Parameters + { + // PhysicsShapeType combobox + mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl"); + mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType)); + + // PhysicsGravity + mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity"); + mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsGravity, this, _1, mSpinPhysicsGravity)); + + // PhysicsFriction + mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction"); + mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsFriction, this, _1, mSpinPhysicsFriction)); + + // PhysicsDensity + mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density"); + mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsDensity, this, _1, mSpinPhysicsDensity)); + + // PhysicsRestitution + mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution"); + mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelVolume::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution)); + } + // Start with everyone disabled clearCtrls(); @@ -351,6 +379,54 @@ void LLPanelVolume::getState( ) getChildView("FlexForceZ")->setEnabled(false); } + // Physics properties + + mSpinPhysicsGravity->set(objectp->getPhysicsGravity()); + mSpinPhysicsGravity->setEnabled(editable); + + mSpinPhysicsFriction->set(objectp->getPhysicsFriction()); + mSpinPhysicsFriction->setEnabled(editable); + + mSpinPhysicsDensity->set(objectp->getPhysicsDensity()); + mSpinPhysicsDensity->setEnabled(editable); + + mSpinPhysicsRestitution->set(objectp->getPhysicsRestitution()); + mSpinPhysicsRestitution->setEnabled(editable); + + // update the physics shape combo to include allowed physics shapes + mComboPhysicsShapeType->removeall(); + mComboPhysicsShapeType->add(getString("None"), LLSD(1)); + + BOOL isMesh = FALSE; + LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + if (sculpt_params) + { + U8 sculpt_type = sculpt_params->getSculptType(); + U8 sculpt_stitching = sculpt_type & LL_SCULPT_TYPE_MASK; + isMesh = (sculpt_stitching == LL_SCULPT_TYPE_MESH); + } + + if(isMesh && objectp) + { + const LLVolumeParams &volume_params = objectp->getVolume()->getParams(); + LLUUID mesh_id = volume_params.getSculptID(); + if(gMeshRepo.hasPhysicsShape(mesh_id)) + { + // if a mesh contains an uploaded or decomposed physics mesh, + // allow 'Prim' + mComboPhysicsShapeType->add(getString("Prim"), LLSD(0)); + } + } + else + { + // simple prims always allow physics shape prim + mComboPhysicsShapeType->add(getString("Prim"), LLSD(0)); + } + + mComboPhysicsShapeType->add(getString("Convex Hull"), LLSD(2)); + mComboPhysicsShapeType->setValue(LLSD(objectp->getPhysicsShapeType())); + mComboPhysicsShapeType->setEnabled(editable); + mObject = objectp; mRootObject = root_objectp; } @@ -384,6 +460,17 @@ void LLPanelVolume::refresh() getChildView("Light Ambiance")->setVisible( visible); getChildView("light texture control")->setVisible( visible); + bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") && + gAgent.getRegion() && + !gAgent.getRegion()->getCapability("GetMesh").empty(); + + getChildView("label physicsshapetype")->setVisible(enable_mesh); + getChildView("Physics Shape Type Combo Ctrl")->setVisible(enable_mesh); + getChildView("Physics Gravity")->setVisible(enable_mesh); + getChildView("Physics Material Override")->setVisible(enable_mesh); + getChildView("Physics Friction")->setVisible(enable_mesh); + getChildView("Physics Density")->setVisible(enable_mesh); + getChildView("Physics Restitution")->setVisible(enable_mesh); } @@ -430,6 +517,11 @@ void LLPanelVolume::clearCtrls() getChildView("FlexForceX")->setEnabled(false); getChildView("FlexForceY")->setEnabled(false); getChildView("FlexForceZ")->setEnabled(false); + + mSpinPhysicsGravity->setEnabled(FALSE); + mSpinPhysicsFriction->setEnabled(FALSE); + mSpinPhysicsDensity->setEnabled(FALSE); + mSpinPhysicsRestitution->setEnabled(FALSE); } // @@ -482,6 +574,48 @@ void LLPanelVolume::sendIsFlexible() llinfos << "update flexible sent" << llendl; } +void LLPanelVolume::sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata) +{ + U8 type = ctrl->getValue().asInteger(); + LLSelectMgr::getInstance()->selectionSetPhysicsType(type); + + refreshCost(); +} + +void LLPanelVolume::sendPhysicsGravity(LLUICtrl* ctrl, void* userdata) +{ + F32 val = ctrl->getValue().asReal(); + LLSelectMgr::getInstance()->selectionSetGravity(val); +} + +void LLPanelVolume::sendPhysicsFriction(LLUICtrl* ctrl, void* userdata) +{ + F32 val = ctrl->getValue().asReal(); + LLSelectMgr::getInstance()->selectionSetFriction(val); +} + +void LLPanelVolume::sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata) +{ + F32 val = ctrl->getValue().asReal(); + LLSelectMgr::getInstance()->selectionSetRestitution(val); +} + +void LLPanelVolume::sendPhysicsDensity(LLUICtrl* ctrl, void* userdata) +{ + F32 val = ctrl->getValue().asReal(); + LLSelectMgr::getInstance()->selectionSetDensity(val); +} + +void LLPanelVolume::refreshCost() +{ + LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); + + if (obj) + { + obj->getObjectCost(); + } +} + void LLPanelVolume::onLightCancelColor(const LLSD& data) { LLColorSwatchCtrl* LightColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch"); diff --git a/indra/newview/llpanelvolume.h b/indra/newview/llpanelvolume.h index 90a2abda25..776a2c1f4a 100644 --- a/indra/newview/llpanelvolume.h +++ b/indra/newview/llpanelvolume.h @@ -64,6 +64,8 @@ public: static void onCommitIsFlexible( LLUICtrl* ctrl, void* userdata); static void onCommitFlexible( LLUICtrl* ctrl, void* userdata); + static void onCommitPhysicsParam( LLUICtrl* ctrl, void* userdata); + void onLightCancelColor(const LLSD& data); void onLightSelectColor(const LLSD& data); @@ -73,8 +75,15 @@ public: protected: void getState(); + void refreshCost(); protected: + void sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata); + void sendPhysicsGravity(LLUICtrl* ctrl, void* userdata); + void sendPhysicsFriction(LLUICtrl* ctrl, void* userdata); + void sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata); + void sendPhysicsDensity(LLUICtrl* ctrl, void* userdata); + /* LLTextBox* mLabelSelectSingleMessage; // Light @@ -99,6 +108,12 @@ protected: LLUUID mLightSavedTexture; LLPointer<LLViewerObject> mObject; LLPointer<LLViewerObject> mRootObject; + + LLComboBox* mComboPhysicsShapeType; + LLSpinCtrl* mSpinPhysicsGravity; + LLSpinCtrl* mSpinPhysicsFriction; + LLSpinCtrl* mSpinPhysicsDensity; + LLSpinCtrl* mSpinPhysicsRestitution; }; #endif diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index a0a370dc12..abd3704736 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1350,9 +1350,6 @@ even though the user gets a free copy. name="Object" top="16" width="295"> - <panel.string name="None">None</panel.string> - <panel.string name="Prim">Prim</panel.string> - <panel.string name="Convex Hull">Convex Hull</panel.string> <check_box height="19" label="Locked" @@ -1559,100 +1556,6 @@ even though the user gets a free copy. text_enabled_color="1 1 1 1" top_pad="3" width="87" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left_delta="0" - name="label physicsshapetype" - top_pad="50" - width="121"> - Physics Shape Type: - </text> - <combo_box - height="23" - top_delta="-5" - layout="topleft" - follows="left|top" - name="Physics Shape Type Combo Ctrl" - tool_tip="Choose the physics shape type" - left_pad="5" - width="108"/> - - <spinner - follows="left|top" - height="19" - increment="1" - initial_value="1" - label="Gravity" - label_width="70" - layout="topleft" - left="10" - min_val="-1" - max_val="28" - name="Physics Gravity" - top_pad="10" - width="132" /> - - <check_box - height="19" - label="Override material" - layout="topleft" - left_delta="0" - name="Physics Material Override" - tool_tip="Override Material" - top_pad="10" - width="132" /> - - <spinner - follows="left|top" - height="19" - increment="0.1" - initial_value="0" - label="Friction" - label_width="70" - layout="topleft" - left_delta="0" - max_val="255" - min_val="0" - name="Physics Friction" - top_pad="4" - width="132" /> - - <spinner - follows="left|top" - height="19" - increment="0.1" - initial_value="0" - label="Density" - label_width="70" - layout="topleft" - left_delta="0" - max_val="22587" - min_val="1" - name="Physics Density" - top_pad="4" - width="132" /> - - <spinner - follows="left|top" - height="19" - increment="0.01" - initial_value="0" - label="Restitution" - label_width="70" - layout="topleft" - left_delta="0" - max_val="1" - min_val="0" - name="Physics Restitution" - top_pad="4" - width="132" /> - - - <!-- <text type="string" length="1" @@ -2248,6 +2151,9 @@ even though the user gets a free copy. name="Features" top_delta="0" width="295"> + <panel.string name="None">None</panel.string> + <panel.string name="Prim">Prim</panel.string> + <panel.string name="Convex Hull">Convex Hull</panel.string> <text type="string" length="1" @@ -2390,6 +2296,7 @@ even though the user gets a free copy. name="FlexForceZ" top_pad="4" width="128" /> + <check_box height="16" label="Light" @@ -2500,6 +2407,97 @@ even though the user gets a free copy. mouse_opaque="true" name="Light Ambiance" width="120" /> + <text + type="string" + length="1" + follows="left|top" + height="10" + layout="topleft" + left="0" + name="label physicsshapetype" + top_pad="50" + width="121"> + Physics Shape Type: + </text> + <combo_box + height="23" + top_delta="-5" + layout="topleft" + follows="left|top" + name="Physics Shape Type Combo Ctrl" + tool_tip="Choose the physics shape type" + left_pad="5" + width="108"/> + + <spinner + follows="left|top" + height="19" + increment="1" + initial_value="1" + label="Gravity" + label_width="70" + layout="topleft" + left="10" + min_val="-1" + max_val="28" + name="Physics Gravity" + top_pad="10" + width="132" /> + + <check_box + height="19" + label="Override material" + layout="topleft" + left_delta="0" + name="Physics Material Override" + tool_tip="Override Material" + top_pad="10" + width="132" /> + + <spinner + follows="left|top" + height="19" + increment="0.1" + initial_value="0" + label="Friction" + label_width="70" + layout="topleft" + left_delta="0" + max_val="255" + min_val="0" + name="Physics Friction" + top_pad="4" + width="132" /> + + <spinner + follows="left|top" + height="19" + increment="0.1" + initial_value="0" + label="Density" + label_width="70" + layout="topleft" + left_delta="0" + max_val="22587" + min_val="1" + name="Physics Density" + top_pad="4" + width="132" /> + + <spinner + follows="left|top" + height="19" + increment="0.01" + initial_value="0" + label="Restitution" + label_width="70" + layout="topleft" + left_delta="0" + max_val="1" + min_val="0" + name="Physics Restitution" + top_pad="4" + width="132" /> </panel> <panel border="false" |