From 92257b55a405f3625cbbcf07357b3ca929a04882 Mon Sep 17 00:00:00 2001 From: "Matthew Breindel (Falcon)" Date: Fri, 26 Mar 2010 18:23:05 -0700 Subject: DEV-47845 Fix to work with TCP/LLSD message. This checkin is experimental, so if it breaks a build, just revert to the previous changeset. --- indra/newview/llpanelobject.cpp | 34 ++++++++++++ indra/newview/llpanelobject.h | 6 ++- indra/newview/llselectmgr.cpp | 23 ++++++++- indra/newview/llselectmgr.h | 1 + indra/newview/llviewerobject.cpp | 60 ++++++++++++++++++++++ indra/newview/llviewerobject.h | 6 +++ .../newview/skins/default/xui/en/floater_tools.xml | 33 ++++++++++++ 7 files changed, 161 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 30221da12a..991e97b767 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -137,6 +137,10 @@ BOOL LLPanelObject::postBuild() // Phantom checkbox mCheckPhantom = getChild("Phantom Checkbox Ctrl"); childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this); + + // PhysicsRep combobox + mComboPhysicsRep = getChild("Physics Rep Combo Ctrl"); + childSetCommitCallback("Physics Rep Combo Ctrl", onCommitPhysicsRep,this); // Position mLabelPosition = getChild("label position"); @@ -320,6 +324,7 @@ LLPanelObject::LLPanelObject() mIsPhysical(FALSE), mIsTemporary(FALSE), mIsPhantom(FALSE), + mPhysicsRep(0), mCastShadows(TRUE), mSelectedType(MI_BOX), mSculptTextureRevert(LLUUID::null), @@ -527,6 +532,10 @@ void LLPanelObject::getState( ) mCheckPhantom->set( mIsPhantom ); mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible ); + mPhysicsRep = objectp->getPhysicsRep(); + mComboPhysicsRep->setCurrentByIndex(mPhysicsRep); + mComboPhysicsRep->setEnabled(editable); + #if 0 // 1.9.2 mCastShadows = root_objectp->flagCastShadows(); mCheckCastShadows->set( mCastShadows ); @@ -1232,6 +1241,22 @@ void LLPanelObject::sendIsPhantom() } } +void LLPanelObject::sendPhysicsRep() +{ + U8 value = (U8)mComboPhysicsRep->getCurrentIndex(); + if (mPhysicsRep != value) + { + LLSelectMgr::getInstance()->selectionUpdatePhysicsRep(value); + mPhysicsRep = value; + + llinfos << "update physicsrep sent" << llendl; + } + else + { + llinfos << "update physicstep not changed" << llendl; + } +} + void LLPanelObject::sendCastShadows() { BOOL value = mCheckCastShadows->get(); @@ -1905,6 +1930,8 @@ void LLPanelObject::clearCtrls() mCheckTemporary ->setEnabled( FALSE ); mCheckPhantom ->set(FALSE); mCheckPhantom ->setEnabled( FALSE ); + mComboPhysicsRep->setCurrentByIndex(0); + mComboPhysicsRep->setEnabled(FALSE); #if 0 // 1.9.2 mCheckCastShadows->set(FALSE); mCheckCastShadows->setEnabled( FALSE ); @@ -1999,6 +2026,13 @@ void LLPanelObject::onCommitPhantom( LLUICtrl* ctrl, void* userdata ) self->sendIsPhantom(); } +// static +void LLPanelObject::onCommitPhysicsRep(LLUICtrl* ctrl, void* userdata ) +{ + LLPanelObject* self = (LLPanelObject*) userdata; + self->sendPhysicsRep(); +} + // static void LLPanelObject::onCommitCastShadows( LLUICtrl* ctrl, void* userdata ) { diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h index 58d9fe9b76..fbc0902141 100644 --- a/indra/newview/llpanelobject.h +++ b/indra/newview/llpanelobject.h @@ -71,6 +71,7 @@ public: static void onCommitPhysics( LLUICtrl* ctrl, void* userdata); static void onCommitTemporary( LLUICtrl* ctrl, void* userdata); static void onCommitPhantom( LLUICtrl* ctrl, void* userdata); + static void onCommitPhysicsRep( LLUICtrl* ctrl, void* userdata); static void onCommitCastShadows( LLUICtrl* ctrl, void* userdata); static void onCommitParametric(LLUICtrl* ctrl, void* userdata); @@ -93,6 +94,7 @@ protected: void sendIsPhysical(); void sendIsTemporary(); void sendIsPhantom(); + void sendPhysicsRep(); void sendCastShadows(); void sendSculpt(); @@ -165,8 +167,9 @@ protected: LLCheckBoxCtrl *mCheckPhysics; LLCheckBoxCtrl *mCheckTemporary; LLCheckBoxCtrl *mCheckPhantom; + LLComboBox *mComboPhysicsRep; LLCheckBoxCtrl *mCheckCastShadows; - + LLTextureCtrl *mCtrlSculptTexture; LLTextBox *mLabelSculptType; LLComboBox *mCtrlSculptType; @@ -177,6 +180,7 @@ protected: BOOL mIsPhysical; // to avoid sending "physical" when not changed BOOL mIsTemporary; // to avoid sending "temporary" when not changed BOOL mIsPhantom; // to avoid sending "phantom" when not changed + U8 mPhysicsRep; // to avoid sending "physics rep spec" when not changed BOOL mCastShadows; // to avoid sending "cast shadows" when not changed S32 mSelectedType; // So we know what selected type we last were diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index f45abca246..9d1893b68a 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -3930,6 +3930,28 @@ void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows) getSelection()->applyToObjects(&func); } +struct LLSelectMgrApplyPhysicsRep : public LLSelectedObjectFunctor +{ + LLSelectMgrApplyPhysicsRep(U8 value) : mValue(value) {} + U8 mValue; + virtual bool apply(LLViewerObject* object) + { + if ( object->permModify() ) // preemptive permissions check + { + object->setPhysicsRep( mValue ); + object->updateFlags(); + } + return true; + } +}; + + +void LLSelectMgr::selectionUpdatePhysicsRep(U8 rep) +{ + llwarns << "physics rep ->" << (U32)rep << llendl; + LLSelectMgrApplyPhysicsRep func(rep); + getSelection()->applyToObjects(&func); +} //---------------------------------------------------------------------- // Helpful packing functions for sendObjectMessage() @@ -4619,7 +4641,6 @@ void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**) LLSelectMgr::getInstance()->highlightObjectAndFamily(objects); } - extern LLGLdouble gGLModelView[16]; void LLSelectMgr::updateSilhouettes() diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 60b151f1c6..f14136c275 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -484,6 +484,7 @@ public: void selectionUpdatePhysics(BOOL use_physics); void selectionUpdateTemporary(BOOL is_temporary); void selectionUpdatePhantom(BOOL is_ghost); + void selectionUpdatePhysicsRep(U8 rep); void selectionUpdateCastShadows(BOOL cast_shadows); void selectionDump(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 8dea60cc87..1ee30b49bf 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -189,6 +189,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mGLName(0), mbCanSelect(TRUE), mFlags(0), + mPhysicsRep(0), mDrawable(), mCreateSelected(FALSE), mRenderMedia(FALSE), @@ -4952,7 +4953,14 @@ void LLViewerObject::updateFlags() gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() ); gMessageSystem->addBOOL("IsPhantom", flagPhantom() ); gMessageSystem->addBOOL("CastsShadows", flagCastShadows() ); + gMessageSystem->nextBlock("ExtraPhysics"); + gMessageSystem->addU8("PhysicsRep", getPhysicsRep() ); gMessageSystem->sendReliable( regionp->getHost() ); + + if (getPhysicsRep() != 0) + { + llwarns << "sent non default physics rep" << llendl; + } } BOOL LLViewerObject::setFlags(U32 flags, BOOL state) @@ -4984,6 +4992,12 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state) return setit; } +void LLViewerObject::setPhysicsRep(U8 rep) +{ + mPhysicsRep = rep; + updateFlags(); +} + void LLViewerObject::applyAngularVelocity(F32 dt) { //do target omega here @@ -5194,4 +5208,50 @@ void LLViewerObject::resetChildrenPosition(const LLVector3& offset, BOOL simplif return ; } +#include "../llcommon/llsdserialize.h" +class ObjectPhysicsProperties : public LLHTTPNode +{ +public: + virtual void post( + ResponsePtr responder, + const LLSD& context, + const LLSD& input) const + { + LLSD objectData = input["body"]["ObjectData"]; + S32 numEntries = objectData.size(); + + for ( S32 i = 0; i < numEntries; i++ ) + { + U32 localID = objectData[i]["LocalID"].asInteger(); + + std::ostringstream string; + LLSDSerialize::serialize( input, string, LLSDSerialize::LLSD_XML, LLSDFormatter::OPTIONS_PRETTY); + llinfos << string.str() << llendl; + + // Iterate through nodes at end, since it can be on both the regular AND hover list + struct f : public LLSelectedNodeFunctor + { + U32 mID; + f(const U32& id) : mID(id) {} + virtual bool apply(LLSelectNode* node) + { + return (node->getObject() && node->getObject()->mLocalID == mID ); + } + } func(localID); + + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func); + + U8 physicsRepSpec = (U8)objectData[i]["PhysicsRepSpec"].asInteger(); + + if (node) + { + node->getObject()->setPhysicsRep(physicsRepSpec); + } + } + + }; +}; + +LLHTTPRegistration + gHTTPRegistrationObjectPhysicsProperties("/message/ObjectPhysicsProperties"); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index bf5e0b6656..da7e4002f5 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -460,6 +460,8 @@ public: inline BOOL flagCameraDecoupled() const { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); } inline BOOL flagObjectMove() const { return ((mFlags & FLAGS_OBJECT_MOVE) != 0); } + inline U8 getPhysicsRep() const { return mPhysicsRep; } + bool getIncludeInSearch() const; void setIncludeInSearch(bool include_in_search); @@ -475,6 +477,7 @@ public: void updateFlags(); BOOL setFlags(U32 flag, BOOL state); + void setPhysicsRep(U8 rep); virtual void dump() const; static U32 getNumZombieObjects() { return sNumZombieObjects; } @@ -554,6 +557,9 @@ public: // Grabbed from UPDATE_FLAGS U32 mFlags; + // Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties + U8 mPhysicsRep; + // Pipeline classes LLPointer mDrawable; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index aec03b8053..26c08bdf7c 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -1419,6 +1419,39 @@ even though the user gets a free copy. text_enabled_color="1 1 1 1" top_pad="3" width="87" /> + + Physics Rep: + + + + + +