From 1d1482eeec3c26c1eb9c14eba6eb78462f704606 Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Wed, 22 Dec 2010 14:28:24 +0100
Subject: load unloaded-avatar-cloud particle system from LLSD file.
---
linden/indra/llmessage/llpartdata.cpp | 90 ++++++++++++++++++++++
linden/indra/llmessage/llpartdata.h | 3 +
linden/indra/newview/app_settings/cloud.xml | 88 +++++++++++++++++++++
linden/indra/newview/llviewermenu.cpp | 15 ++++
linden/indra/newview/llviewerobject.cpp | 2 +-
linden/indra/newview/llvoavatar.cpp | 45 ++++-------
linden/indra/newview/llvoavatar.h | 2 +
.../skins/default/xui/en-us/menu_viewer.xml | 7 ++
8 files changed, 223 insertions(+), 29 deletions(-)
create mode 100644 linden/indra/newview/app_settings/cloud.xml
(limited to 'linden')
diff --git a/linden/indra/llmessage/llpartdata.cpp b/linden/indra/llmessage/llpartdata.cpp
index 485bc6a..a2811ab 100644
--- a/linden/indra/llmessage/llpartdata.cpp
+++ b/linden/indra/llmessage/llpartdata.cpp
@@ -347,3 +347,93 @@ void LLPartSysData::setPartAccel(const LLVector3 &accel)
mPartAccel.mV[VY] = llclamp(accel.mV[VY], -100.f, 100.f);
mPartAccel.mV[VZ] = llclamp(accel.mV[VZ], -100.f, 100.f);
}
+
+LLSD LLPartSysData::asLLSD() const
+{
+ LLSD sd = LLSD();
+
+ sd["LL_PART_INTERP_COLOR_MASK"] = (LLPartData::LL_PART_INTERP_COLOR_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_INTERP_SCALE_MASK"] = (LLPartData::LL_PART_INTERP_SCALE_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_BOUNCE_MASK"] = (LLPartData::LL_PART_BOUNCE_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_WIND_MASK"] = (LLPartData::LL_PART_WIND_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_FOLLOW_SRC_MASK"] = (LLPartData::LL_PART_FOLLOW_SRC_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_FOLLOW_VELOCITY_MASK"] = (LLPartData::LL_PART_FOLLOW_VELOCITY_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_TARGET_POS_MASK"] = (LLPartData::LL_PART_TARGET_POS_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_TARGET_LINEAR_MASK"] = (LLPartData::LL_PART_TARGET_LINEAR_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_EMISSIVE_MASK"] = (LLPartData::LL_PART_EMISSIVE_MASK & mPartData.mFlags) ? 1 : 0;
+ sd["LL_PART_BEAM_MASK"] = (LLPartData::LL_PART_BEAM_MASK & mPartData.mFlags) ? 1 : 0;
+
+ sd["SourceMaxage"] = mPartData.mMaxAge;
+ sd["Startcolor"] = ll_sd_from_color4(mPartData.mStartColor);
+ sd["Endcolor"] = ll_sd_from_color4(mPartData.mEndColor);
+ sd["Startscale"] = ll_sd_from_vector2(mPartData.mStartScale);
+ sd["Endscale"] = ll_sd_from_vector2(mPartData.mEndScale);
+
+ sd["ParticleMaxAge"] = mMaxAge;
+ sd["ParticleStartAge"] = mStartAge;
+
+
+ sd["LL_PART_SRC_PATTERN_DROP"] = ( mPattern & LL_PART_SRC_PATTERN_DROP) ? 1 : 0;
+ sd["LL_PART_SRC_PATTERN_EXPLODE"] = ( mPattern & LL_PART_SRC_PATTERN_EXPLODE) ? 1 : 0;
+ sd["LL_PART_SRC_PATTERN_ANGLE"] = ( mPattern & LL_PART_SRC_PATTERN_ANGLE) ? 1 : 0;
+ sd["LL_PART_SRC_PATTERN_ANGLE_CONE"] = ( mPattern & LL_PART_SRC_PATTERN_ANGLE_CONE) ? 1 : 0 ;
+ sd["LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY"] = ( mPattern & LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY) ? 1 : 0;
+
+ sd["InnerAngle"] = mInnerAngle;
+ sd["OuterAngle"] = mOuterAngle;
+ sd["AngularVelocity"] = ll_sd_from_vector3(mAngularVelocity);
+ sd["BurstRate"] = mBurstRate;
+ sd["BurstPartCount"] = mBurstPartCount;
+ sd["BurstSpeedMin"] = mBurstSpeedMin;
+ sd["BurstSpeedMax"] = mBurstSpeedMax;
+ sd["BurstRadius"] = mBurstRadius;
+ sd["PartImageID"] = mPartImageID.asString();
+ sd["TargetId"] = mTargetUUID.asString();
+ return sd;
+}
+
+bool LLPartSysData::fromLLSD(LLSD& sd)
+{
+ mPartData.mFlags = 0;
+ if (sd["LL_PART_INTERP_COLOR_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_INTERP_COLOR_MASK;
+ if (sd["LL_PART_INTERP_SCALE_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_INTERP_SCALE_MASK;
+ if (sd["LL_PART_BOUNCE_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_BOUNCE_MASK;
+ if (sd["LL_PART_WIND_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_WIND_MASK;
+ if (sd["LL_PART_FOLLOW_SRC_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_FOLLOW_SRC_MASK;
+ if (sd["LL_PART_FOLLOW_VELOCITY_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_FOLLOW_VELOCITY_MASK;
+ if (sd["LL_PART_TARGET_POS_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_TARGET_POS_MASK;
+ if (sd["LL_PART_TARGET_LINEAR_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_TARGET_LINEAR_MASK;
+ if (sd["LL_PART_EMISSIVE_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_EMISSIVE_MASK;
+ if (sd["LL_PART_BEAM_MASK"]) mPartData.mFlags |= LLPartData::LL_PART_BEAM_MASK;
+
+ mPartData.mMaxAge = (F32)sd["SourceMaxage"].asReal();
+ mPartData.mStartColor = ll_color4_from_sd(sd["Startcolor"]);
+ mPartData.mEndColor = ll_color4_from_sd(sd["Endcolor"]);
+ mPartData.mStartScale = ll_vector2_from_sd(sd["Startscale"]);
+ mPartData.mEndScale = ll_vector2_from_sd(sd["Endscale"]);
+
+ mMaxAge = (F32)sd["ParticleMaxAge"].asReal();
+ mStartAge = (F32)sd["ParticleStartAge"].asReal();
+
+ mPattern = 0;
+ if (sd["LL_PART_SRC_PATTERN_DROP"]) mPattern |= LL_PART_SRC_PATTERN_DROP;
+ if (sd["LL_PART_SRC_PATTERN_EXPLODE"]) mPattern |= LL_PART_SRC_PATTERN_EXPLODE;
+ if (sd["LL_PART_SRC_PATTERN_ANGLE"]) mPattern |= LL_PART_SRC_PATTERN_ANGLE;
+ if (sd["LL_PART_SRC_PATTERN_ANGLE_CONE"]) mPattern |= LL_PART_SRC_PATTERN_ANGLE_CONE;
+ if (sd["LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY"]) mPattern |= LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY;
+
+ mInnerAngle = (F32)sd["InnerAngle"].asReal();
+ mOuterAngle = (F32)sd["OuterAngle"].asReal();
+ mAngularVelocity = ll_vector3_from_sd(sd["AngularVelocity"]);
+ mBurstRate = (F32)sd["BurstRate"].asReal();
+ int burst_part_count = sd["BurstPartCount"];
+ mBurstPartCount = (U8)burst_part_count;
+ mBurstSpeedMin = (F32)sd["BurstSpeedMin"].asReal();
+ mBurstSpeedMax = (F32)sd["BurstSpeedMax"].asReal();
+ mBurstRadius = (F32)sd["BurstRadius"].asReal();
+
+ mPartImageID = LLUUID(sd[("PartImageID")].asString());
+ mTargetUUID = LLUUID(sd["TargetId"].asString());
+
+ return true;
+}
\ No newline at end of file
diff --git a/linden/indra/llmessage/llpartdata.h b/linden/indra/llmessage/llpartdata.h
index 6dcb311..b7efa95 100644
--- a/linden/indra/llmessage/llpartdata.h
+++ b/linden/indra/llmessage/llpartdata.h
@@ -158,6 +158,9 @@ public:
BOOL unpackBlock(const S32 block_num);
BOOL packBlock();
+ LLSD asLLSD() const;
+ bool fromLLSD(LLSD& sd);
+
static BOOL packNull();
static BOOL isNullPS(const S32 block_num); // Returns FALSE if this is a "NULL" particle system (i.e. no system)
diff --git a/linden/indra/newview/app_settings/cloud.xml b/linden/indra/newview/app_settings/cloud.xml
new file mode 100644
index 0000000..ff9492b
--- /dev/null
+++ b/linden/indra/newview/app_settings/cloud.xml
@@ -0,0 +1,88 @@
+
+
+
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index 7f00382..c5d78d8 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -10666,6 +10666,20 @@ class LLAdvancedDumpAvatarLocalTextures : public view_listener_t
}
};
+///////////////////////////////////
+// Reload Avatar Cloud Particles //
+///////////////////////////////////
+
+
+class LLAdvancedReloadAvatarCloudParticle : public view_listener_t
+{
+ bool handleEvent(LLPointer event, const LLSD& userdata)
+ {
+ LLVOAvatar::initCloud();
+ return true;
+ }
+};
+
///////////
// Crash //
///////////
@@ -11453,6 +11467,7 @@ void initialize_menus()
addMenu(new LLAdvancedDumpAttachments(), "Advanced.DumpAttachments");
addMenu(new LLAdvancedDebugAvatarTextures(), "Advanced.DebugAvatarTextures");
addMenu(new LLAdvancedDumpAvatarLocalTextures(), "Advanced.DumpAvatarLocalTextures");
+ addMenu(new LLAdvancedReloadAvatarCloudParticle(), "Advanced.ReloadAvatarCloudParticle");
// Advanced > Crash
addMenu(new LLAdvancedCrash(), "Advanced.Crash");
diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp
index a2be26a..65c1d11 100644
--- a/linden/indra/newview/llviewerobject.cpp
+++ b/linden/indra/newview/llviewerobject.cpp
@@ -4206,7 +4206,7 @@ void LLViewerObject::setParticleSource(const LLPartSysData& particle_parameters,
LLViewerImage* image;
if (mPartSourcep->mPartSysData.mPartImageID == LLUUID::null)
{
- image = gImageList.getImageFromFile("pixiesmall.tga");
+ image = gImageList.getImageFromFile("pixiesmall.j2c");
}
else
{
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 6904bb2..35cabc1 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -1474,6 +1474,7 @@ void LLVOAvatar::initClass()
{
loadClientTags();
}
+ initCloud();
}
@@ -1489,6 +1490,21 @@ void LLVOAvatar::cleanupClass()
sXMLTree.cleanup();
}
+LLPartSysData LLVOAvatar::sCloud;
+void LLVOAvatar::initCloud()
+{
+ // fancy particle cloud designed by Brent
+
+ std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "cloud.xml");
+ LLSD cloud;
+ llifstream in_file(filename);
+ LLSDSerialize::fromXMLDocument(cloud, in_file);
+ sCloud.fromLLSD(cloud);
+ LLViewerImage* cloud_image = gImageList.getImageFromFile("cloud-particle.j2c");
+ sCloud.mPartImageID = cloud_image->getID();
+
+}
+
const LLVector3 LLVOAvatar::getRenderPosition() const
{
if (mDrawable.isNull() || mDrawable->getGeneration() < 0)
@@ -3070,34 +3086,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
}
else
{
- LLPartSysData particle_parameters;
-
- // fancy particle cloud designed by Brent
- particle_parameters.mPartData.mMaxAge = 4.f;
- particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
- particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
- particle_parameters.mPartData.mStartScale.mV[VY] = 1.0f;
- particle_parameters.mPartData.mEndScale.mV[VX] = 0.02f;
- particle_parameters.mPartData.mEndScale.mV[VY] = 0.02f;
- particle_parameters.mPartData.mStartColor = LLColor4(1, 1, 1, 0.5f);
- particle_parameters.mPartData.mEndColor = LLColor4(1, 1, 1, 0.0f);
- particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
- LLViewerImage* cloud = gImageList.getImageFromFile("cloud-particle.j2c");
- particle_parameters.mPartImageID = cloud->getID();
- particle_parameters.mMaxAge = 0.f;
- particle_parameters.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE;
- particle_parameters.mInnerAngle = 3.14159f;
- particle_parameters.mOuterAngle = 0.f;
- particle_parameters.mBurstRate = 0.02f;
- particle_parameters.mBurstRadius = 0.0f;
- particle_parameters.mBurstPartCount = 1;
- particle_parameters.mBurstSpeedMin = 0.1f;
- particle_parameters.mBurstSpeedMax = 1.f;
- particle_parameters.mPartData.mFlags = ( LLPartData::LL_PART_INTERP_COLOR_MASK | LLPartData::LL_PART_INTERP_SCALE_MASK |
- LLPartData::LL_PART_EMISSIVE_MASK | // LLPartData::LL_PART_FOLLOW_SRC_MASK |
- LLPartData::LL_PART_TARGET_POS_MASK );
-
- setParticleSource(particle_parameters, getID());
+ setParticleSource(sCloud, getID());
}
}
}
diff --git a/linden/indra/newview/llvoavatar.h b/linden/indra/newview/llvoavatar.h
index 548818d..a23a9df 100644
--- a/linden/indra/newview/llvoavatar.h
+++ b/linden/indra/newview/llvoavatar.h
@@ -97,6 +97,7 @@ public:
static void initClass(); // Initialize data that's only init'd once per class.
static void cleanupClass(); // Cleanup data that's only init'd once per class.
static BOOL parseSkeletonFile(const std::string& filename);
+ static void initCloud();
virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
void **user_data,
U32 block_num,
@@ -582,6 +583,7 @@ public:
static F32 sLODFactor; // user-settable LOD factor
static BOOL sJointDebug; // output total number of joints being touched for each avatar
static BOOL sDebugAvatarRotation;
+ static LLPartSysData sCloud;
static S32 sNumVisibleAvatars; // Number of instances of this class
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
index 31e730a..feeff0c 100644
--- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
@@ -1965,6 +1965,13 @@
+
+
+
--
cgit v1.1