aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r--linden/indra/newview/llvoavatar.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp
index 41d1c88..d8b0994 100644
--- a/linden/indra/newview/llvoavatar.cpp
+++ b/linden/indra/newview/llvoavatar.cpp
@@ -1038,6 +1038,7 @@ LLVOAvatar::~LLVOAvatar()
1038 LL_DEBUGS("VOAvatar") << "Destructing Zombie from previous session." << LL_ENDL; 1038 LL_DEBUGS("VOAvatar") << "Destructing Zombie from previous session." << LL_ENDL;
1039 } 1039 }
1040 1040
1041
1041 mRoot.removeAllChildren(); 1042 mRoot.removeAllChildren();
1042 1043
1043 delete [] mSkeleton; 1044 delete [] mSkeleton;
@@ -1493,6 +1494,8 @@ void LLVOAvatar::cleanupClass()
1493} 1494}
1494 1495
1495LLPartSysData LLVOAvatar::sCloud; 1496LLPartSysData LLVOAvatar::sCloud;
1497bool LLVOAvatar::sHasCloud = false;
1498
1496void LLVOAvatar::initCloud() 1499void LLVOAvatar::initCloud()
1497{ 1500{
1498 // fancy particle cloud designed by Brent 1501 // fancy particle cloud designed by Brent
@@ -1506,12 +1509,43 @@ void LLVOAvatar::initCloud()
1506 filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "cloud.xml"); 1509 filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "cloud.xml");
1507 } 1510 }
1508 1511
1512 loadCloud(filename, sCloud);
1513 sHasCloud = true;
1514}
1515
1516
1517void LLVOAvatar::loadCloud(const std::string& filename, LLPartSysData& particles)
1518{
1509 LLSD cloud; 1519 LLSD cloud;
1510 llifstream in_file(filename); 1520 llifstream in_file(filename);
1511 LLSDSerialize::fromXMLDocument(cloud, in_file); 1521 LLSDSerialize::fromXMLDocument(cloud, in_file);
1512 sCloud.fromLLSD(cloud); 1522
1513 LLViewerImage* cloud_image = gImageList.getImageFromFile("cloud-particle.j2c"); 1523 particles.fromLLSD(cloud);
1514 sCloud.mPartImageID = cloud_image->getID(); 1524 if(particles.mPartImageID.isNull())
1525 {
1526 LLViewerImage* cloud_image = gImageList.getImageFromFile("cloud-particle.j2c");
1527 particles.mPartImageID = cloud_image->getID();
1528 }
1529}
1530
1531
1532void LLVOAvatar::saveCloud(const std::string& filename, LLPartSysData& particles)
1533{
1534 llofstream out(filename);
1535 if (!out.good())
1536 {
1537 llwarns << "Unable to open " << filename << " for output." << llendl;
1538 return;
1539 }
1540 LLSDSerialize::toXML(particles.asLLSD(), out);
1541 out.close();
1542
1543 // Imprudence: actually we could export any particle system with this,
1544 // though we don't have a clue about its creator (could be from a no mod script) :(
1545 // This is probably also not ok to export on open sim grids,
1546 // unless theiy either add a creator property to particle systems
1547 // or their terms of service make sure this sort of content is free and open.
1548 // Saving only the cloud for now, which only exists client side.
1515 1549
1516} 1550}
1517 1551