Added physics settings to object features panel. Brought in mesh 'prim cost' fetching and now display cost in edit floater if mesh is enabled.
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
#include "lldrawable.h"
|
||||
#include "llface.h"
|
||||
#include "llfloaterproperties.h"
|
||||
#include "llfloatertools.h"
|
||||
#include "llfollowcam.h"
|
||||
#include "llselectmgr.h"
|
||||
#include "llrendersphere.h"
|
||||
@@ -178,6 +179,13 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
|
||||
mGLName(0),
|
||||
mbCanSelect(TRUE),
|
||||
mFlags(0),
|
||||
#if MESH_ENABLED
|
||||
mPhysicsShapeType(0),
|
||||
mPhysicsGravity(0),
|
||||
mPhysicsFriction(0),
|
||||
mPhysicsDensity(0),
|
||||
mPhysicsRestitution(0),
|
||||
#endif //MESH_ENABLED
|
||||
mDrawable(),
|
||||
mCreateSelected(FALSE),
|
||||
mRenderMedia(FALSE),
|
||||
@@ -210,6 +218,14 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
|
||||
mState(0),
|
||||
mMedia(NULL),
|
||||
mClickAction(0),
|
||||
#if MESH_ENABLED
|
||||
mObjectCost(0),
|
||||
mLinksetCost(0),
|
||||
mPhysicsCost(0),
|
||||
mLinksetPhysicsCost(0.f),
|
||||
mCostStale(true),
|
||||
mPhysicsShapeUnknown(true),
|
||||
#endif //MESH_ENABLED
|
||||
mAttachmentItemID(LLUUID::null),
|
||||
mLastUpdateType(OUT_UNKNOWN),
|
||||
mLastUpdateCached(FALSE)
|
||||
@@ -791,6 +807,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
||||
#ifdef DEBUG_UPDATE_TYPE
|
||||
llinfos << "Full:" << getID() << llendl;
|
||||
#endif
|
||||
#if MESH_ENABLED
|
||||
//clear cost and linkset cost
|
||||
mCostStale = true;
|
||||
if (isSelected())
|
||||
{
|
||||
gFloaterTools->dirty();
|
||||
}
|
||||
#endif //MESH_ENABLED
|
||||
LLUUID audio_uuid;
|
||||
LLUUID owner_id; // only valid if audio_uuid or particle system is not null
|
||||
F32 gain;
|
||||
@@ -1389,6 +1413,15 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
||||
#ifdef DEBUG_UPDATE_TYPE
|
||||
llinfos << "CompFull:" << getID() << llendl;
|
||||
#endif
|
||||
|
||||
#if MESH_ENABLED
|
||||
mCostStale = true;
|
||||
|
||||
if (isSelected())
|
||||
{
|
||||
gFloaterTools->dirty();
|
||||
}
|
||||
#endif //MESH_ENABLED
|
||||
dp->unpackU32(crc, "CRC");
|
||||
mTotalCRC = crc;
|
||||
dp->unpackU8(material, "Material");
|
||||
@@ -2912,6 +2945,108 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped)
|
||||
}
|
||||
}
|
||||
|
||||
#if MESH_ENABLED
|
||||
void LLViewerObject::setObjectCost(F32 cost)
|
||||
{
|
||||
mObjectCost = cost;
|
||||
mCostStale = false;
|
||||
|
||||
if (isSelected())
|
||||
{
|
||||
gFloaterTools->dirty();
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::setLinksetCost(F32 cost)
|
||||
{
|
||||
mLinksetCost = cost;
|
||||
mCostStale = false;
|
||||
|
||||
if (isSelected())
|
||||
{
|
||||
gFloaterTools->dirty();
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::setPhysicsCost(F32 cost)
|
||||
{
|
||||
mPhysicsCost = cost;
|
||||
mCostStale = false;
|
||||
|
||||
if (isSelected())
|
||||
{
|
||||
gFloaterTools->dirty();
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::setLinksetPhysicsCost(F32 cost)
|
||||
{
|
||||
mLinksetPhysicsCost = cost;
|
||||
mCostStale = false;
|
||||
|
||||
if (isSelected())
|
||||
{
|
||||
gFloaterTools->dirty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
F32 LLViewerObject::getObjectCost()
|
||||
{
|
||||
if (mCostStale)
|
||||
{
|
||||
gObjectList.updateObjectCost(this);
|
||||
}
|
||||
|
||||
return mObjectCost;
|
||||
}
|
||||
|
||||
F32 LLViewerObject::getLinksetCost()
|
||||
{
|
||||
if (mCostStale)
|
||||
{
|
||||
gObjectList.updateObjectCost(this);
|
||||
}
|
||||
|
||||
return mLinksetCost;
|
||||
}
|
||||
|
||||
F32 LLViewerObject::getPhysicsCost()
|
||||
{
|
||||
if (mCostStale)
|
||||
{
|
||||
gObjectList.updateObjectCost(this);
|
||||
}
|
||||
|
||||
return mPhysicsCost;
|
||||
}
|
||||
|
||||
F32 LLViewerObject::getLinksetPhysicsCost()
|
||||
{
|
||||
if (mCostStale)
|
||||
{
|
||||
gObjectList.updateObjectCost(this);
|
||||
}
|
||||
|
||||
return mLinksetPhysicsCost;
|
||||
}
|
||||
|
||||
F32 LLViewerObject::getStreamingCost(S32* bytes, S32* visible_bytes)
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
U32 LLViewerObject::getTriangleCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
U32 LLViewerObject::getHighLODTriangleCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif //MESH_ENABLED
|
||||
|
||||
void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
|
||||
{
|
||||
if(mDrawable.isNull())
|
||||
@@ -5060,7 +5195,7 @@ bool LLViewerObject::specialHoverCursor() const
|
||||
|| (mClickAction != 0);
|
||||
}
|
||||
|
||||
void LLViewerObject::updateFlags()
|
||||
void LLViewerObject::updateFlags(BOOL physics_changed)
|
||||
{
|
||||
LLViewerRegion* regionp = getRegion();
|
||||
if(!regionp) return;
|
||||
@@ -5073,6 +5208,17 @@ void LLViewerObject::updateFlags()
|
||||
gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() );
|
||||
gMessageSystem->addBOOL("IsPhantom", flagPhantom() );
|
||||
gMessageSystem->addBOOL("CastsShadows", flagCastShadows() );
|
||||
#if MESH_ENABLED
|
||||
if (physics_changed)
|
||||
{
|
||||
gMessageSystem->nextBlock("ExtraPhysics");
|
||||
gMessageSystem->addU8("PhysicsShapeType", getPhysicsShapeType() );
|
||||
gMessageSystem->addF32("Density", getPhysicsDensity() );
|
||||
gMessageSystem->addF32("Friction", getPhysicsFriction() );
|
||||
gMessageSystem->addF32("Restitution", getPhysicsRestitution() );
|
||||
gMessageSystem->addF32("GravityMultiplier", getPhysicsGravity() );
|
||||
}
|
||||
#endif //MESH_ENABLED
|
||||
gMessageSystem->sendReliable( regionp->getHost() );
|
||||
}
|
||||
|
||||
@@ -5105,6 +5251,46 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state)
|
||||
return setit;
|
||||
}
|
||||
|
||||
#if MESH_ENABLED
|
||||
void LLViewerObject::setPhysicsShapeType(U8 type)
|
||||
{
|
||||
mPhysicsShapeUnknown = false;
|
||||
mPhysicsShapeType = type;
|
||||
mCostStale = true;
|
||||
}
|
||||
|
||||
void LLViewerObject::setPhysicsGravity(F32 gravity)
|
||||
{
|
||||
mPhysicsGravity = gravity;
|
||||
}
|
||||
|
||||
void LLViewerObject::setPhysicsFriction(F32 friction)
|
||||
{
|
||||
mPhysicsFriction = friction;
|
||||
}
|
||||
|
||||
void LLViewerObject::setPhysicsDensity(F32 density)
|
||||
{
|
||||
mPhysicsDensity = density;
|
||||
}
|
||||
|
||||
void LLViewerObject::setPhysicsRestitution(F32 restitution)
|
||||
{
|
||||
mPhysicsRestitution = restitution;
|
||||
}
|
||||
|
||||
U8 LLViewerObject::getPhysicsShapeType() const
|
||||
{
|
||||
if (mPhysicsShapeUnknown)
|
||||
{
|
||||
mPhysicsShapeUnknown = false;
|
||||
gObjectList.updatePhysicsFlags(this);
|
||||
}
|
||||
|
||||
return mPhysicsShapeType;
|
||||
}
|
||||
#endif //MESH_ENABLED
|
||||
|
||||
void LLViewerObject::applyAngularVelocity(F32 dt)
|
||||
{
|
||||
//do target omega here
|
||||
@@ -5386,3 +5572,65 @@ LLVOAvatar* LLViewerObject::getAvatar() const
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if MESH_ENABLED
|
||||
class ObjectPhysicsProperties : public LLHTTPNode
|
||||
{
|
||||
public:
|
||||
virtual void post(
|
||||
ResponsePtr responder,
|
||||
const LLSD& context,
|
||||
const LLSD& input) const
|
||||
{
|
||||
LLSD object_data = input["body"]["ObjectData"];
|
||||
S32 num_entries = object_data.size();
|
||||
|
||||
for ( S32 i = 0; i < num_entries; i++ )
|
||||
{
|
||||
LLSD& curr_object_data = object_data[i];
|
||||
U32 local_id = curr_object_data["LocalID"].asInteger();
|
||||
|
||||
// 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(local_id);
|
||||
|
||||
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
|
||||
|
||||
if (node)
|
||||
{
|
||||
// The LLSD message builder doesn't know how to handle U8, so we need to send as S8 and cast
|
||||
U8 type = (U8)curr_object_data["PhysicsShapeType"].asInteger();
|
||||
F32 density = (F32)curr_object_data["Density"].asReal();
|
||||
F32 friction = (F32)curr_object_data["Friction"].asReal();
|
||||
F32 restitution = (F32)curr_object_data["Restitution"].asReal();
|
||||
F32 gravity = (F32)curr_object_data["GravityMultiplier"].asReal();
|
||||
|
||||
node->getObject()->setPhysicsShapeType(type);
|
||||
node->getObject()->setPhysicsGravity(gravity);
|
||||
node->getObject()->setPhysicsFriction(friction);
|
||||
node->getObject()->setPhysicsDensity(density);
|
||||
node->getObject()->setPhysicsRestitution(restitution);
|
||||
}
|
||||
}
|
||||
|
||||
dialog_refresh_all();
|
||||
};
|
||||
};
|
||||
|
||||
LLHTTPRegistration<ObjectPhysicsProperties>
|
||||
gHTTPRegistrationObjectPhysicsProperties("/message/ObjectPhysicsProperties");
|
||||
|
||||
|
||||
void LLViewerObject::updateQuota( const SelectionQuota& quota )
|
||||
{
|
||||
//update quotas
|
||||
mSelectionQuota = quota;
|
||||
}
|
||||
#endif //MESH_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user