From 8af226efd89b2f2190555ce578d4e7f1cde99f32 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 9 Nov 2009 17:36:58 -0700 Subject: Updated primbackup from latest meerkat svn (r246) --- linden/indra/newview/primbackup.cpp | 659 +++++++++++++++++++++++++++++++++--- linden/indra/newview/primbackup.h | 9 +- 2 files changed, 616 insertions(+), 52 deletions(-) (limited to 'linden') diff --git a/linden/indra/newview/primbackup.cpp b/linden/indra/newview/primbackup.cpp index 8dbf1df..8af8cd3 100644 --- a/linden/indra/newview/primbackup.cpp +++ b/linden/indra/newview/primbackup.cpp @@ -154,7 +154,7 @@ class importResponder: public LLNewAgentInventoryResponder }; - +/* class CacheReadResponder : public LLTextureCache::ReadResponder { @@ -197,7 +197,32 @@ class CacheReadResponder : public LLTextureCache::ReadResponder std::string name; mID.toString(name); - llinfos << "Saving to "<<(primbackup::getInstance()->getfolder()+"//"+name)<getfolder()+"//"+name)< image_tga = new LLImageTGA; + LLPointer raw = new LLImageRaw; + + mFormattedImage->decode(raw, 0); + + if( !image_tga->encode( raw ) ) + { + LLStringUtil::format_map_t args; + args["[FILE]"] = name; + gViewerWindow->alertXml("CannotEncodeFile", args); + } + else if( !image_tga->save( primbackup::getInstance()->getfolder()+"//textures//"+name + ".tga" ) ) + { + LLStringUtil::format_map_t args; + args["[FILE]"] = name; + gViewerWindow->alertXml("CannotWriteFile", args); + } + +//////////////////////////////////////// + + if(!mFormattedImage->save(primbackup::getInstance()->getfolder()+"//"+name)) { llinfos << "FAIL saving texture "<getDirName(file_name); - export_state=EXPORT_INIT; - gIdleCallbacks.addFunction(exportworker, NULL); +// export_state=EXPORT_INIT; + //gIdleCallbacks.addFunction(exportworker, NULL); } @@ -362,40 +389,43 @@ bool primbackup::check_perms( LLSelectNode* node ) } +/* void primbackup::exportworker(void *userdata) { primbackup::getInstance()->updateexportnumbers(); switch(primbackup::getInstance()->export_state) { - case EXPORT_INIT: { - primbackup::getInstance()->show(); - LLSelectMgr::getInstance()->getSelection()->ref(); - - struct ff : public LLSelectedNodeFunctor + case EXPORT_INIT: { - virtual bool apply(LLSelectNode* node) + primbackup::getInstance()->show(); + LLSelectMgr::getInstance()->getSelection()->ref(); + + struct ff : public LLSelectedNodeFunctor + { + virtual bool apply(LLSelectNode* node) + { + return primbackup::check_perms( node ); + } + } func; + + if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func,false)) + primbackup::getInstance()->export_state=EXPORT_STRUCTURE; + else { - return primbackup::check_perms( node ); - } - } func; + llwarns<<"Incorrect permission to export"<export_state=EXPORT_DONE; + primbackup::getInstance()->close(); + gIdleCallbacks.deleteFunction(exportworker); + LLSelectMgr::getInstance()->getSelection()->unref(); - if(LLSelectMgr::getInstance()->getSelection()->applyToNodes(&func,false)) - { - primbackup::getInstance()->export_state=EXPORT_STRUCTURE; - } - else - { - llwarns << "Incorrect permission to export" << llendl; - primbackup::getInstance()->export_state=EXPORT_DONE; - primbackup::getInstance()->close(); - gIdleCallbacks.deleteFunction(exportworker); - LLSelectMgr::getInstance()->getSelection()->unref(); + } + break; } - break; - } - case EXPORT_STRUCTURE: { + break; + case EXPORT_STRUCTURE: + { struct ff : public LLSelectedObjectFunctor { virtual bool apply(LLViewerObject* object) @@ -403,12 +433,46 @@ void primbackup::exportworker(void *userdata) object->boostTexturePriority(TRUE); LLViewerObject::child_list_t children = object->getChildren(); children.push_front(object); //push root onto list - LLSD prim_llsd=primbackup::getInstance()->prims_to_llsd(children); +#if 0 + LLSD prim_llsd=primbackup::getInstance()->prims_to_llsd(children); LLSD stuff; stuff["root_position"] = object->getPosition().getValue(); stuff["root_rotation"] = ll_sd_from_quaternion(object->getRotation()); stuff["group_body"] = prim_llsd; primbackup::getInstance()->llsd["data"].append(stuff); +#endif + + + //primbackup::getInstance()->xml->createChild("root_position", FALSE)->setValue(object->getPosition().getValue()); + //primbackup::getInstance()->xml->createChild("root_rotation", FALSE)->setValue(ll_sd_from_quaternion(object->getRotation())); + + LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); + + LLXMLNodePtr max_xml = primbackup::getInstance()->xml->createChild("max", FALSE); + LLVector3 max = object->getPosition(); + max_xml->createChild("x", TRUE)->setValue(llformat("%.5f", max.mV[VX])); + max_xml->createChild("y", TRUE)->setValue(llformat("%.5f", max.mV[VY])); + max_xml->createChild("z", TRUE)->setValue(llformat("%.5f", max.mV[VZ])); + + LLXMLNodePtr min_xml = primbackup::getInstance()->xml->createChild("min", FALSE); + LLVector3 min = object->getPosition(); + min_xml->createChild("x", TRUE)->setValue(llformat("%.5f", min.mV[VX])); + min_xml->createChild("y", TRUE)->setValue(llformat("%.5f", min.mV[VY])); + min_xml->createChild("z", TRUE)->setValue(llformat("%.5f", min.mV[VZ])); + + LLXMLNodePtr center_xml = primbackup::getInstance()->xml->createChild("center", FALSE); + LLVector3 center = object->getPosition(); + center_xml->createChild("x", TRUE)->setValue(llformat("%.5f", center.mV[VX])); + center_xml->createChild("y", TRUE)->setValue(llformat("%.5f", center.mV[VY])); + center_xml->createChild("z", TRUE)->setValue(llformat("%.5f", center.mV[VZ])); + + + //primbackup::getInstance()->xml->createChild("max", FALSE)->setValue(object->getPosition().getValue()); + //primbackup::getInstance()->xml->createChild("min", FALSE)->setValue(object->getPosition().getValue()); + //primbackup::getInstance()->xml->createChild("center", FALSE)->setValue(object->getPosition().getValue()); + + + primbackup::getInstance()->xml->addChild(primbackup::getInstance()->prims_to_xml(children)); return true; } } func; @@ -419,8 +483,7 @@ void primbackup::exportworker(void *userdata) break; } - - case EXPORT_TEXTURES: { + case EXPORT_TEXTURES: if(primbackup::getInstance()->m_nexttextureready==false) return; @@ -434,26 +497,524 @@ void primbackup::exportworker(void *userdata) } primbackup::getInstance()->export_next_texture(); - break; + break; + + case EXPORT_LLSD: + { + // Create a file stream and write to it + llofstream export_file(primbackup::getInstance()->file_name); + LLSDSerialize::toPrettyXML(primbackup::getInstance()->llsd, export_file); + export_file.close(); + +#if 1 +//-Patrick Sapinski (Thursday, September 17, 2009) + + llofstream out(primbackup::getInstance()->file_name); + + if (!out.good()) + { + llwarns << "Unable to open for output." << llendl; } - case EXPORT_LLSD: { - // Create a file stream and write to it - llofstream export_file(primbackup::getInstance()->file_name); - LLSDSerialize::toPrettyXML(primbackup::getInstance()->llsd, export_file); - export_file.close(); - primbackup::getInstance()->m_nexttextureready=true; - primbackup::getInstance()->export_state=EXPORT_TEXTURES; + out << "\n"; + + + LLXMLNode *temp_xml = new LLXMLNode("project", FALSE); + + temp_xml->createChild("schema", FALSE)->setValue("1.0"); + temp_xml->createChild("name", FALSE)->setValue(primbackup::getInstance()->file_name); + temp_xml->createChild("date", FALSE)->setValue("test"); + temp_xml->createChild("sotware", FALSE)->setValue("Meerkat 0.3.0"); + temp_xml->createChild("platform", FALSE)->setValue("Second Life"); + temp_xml->createChild("grid", FALSE)->setValue("test"); + + temp_xml->addChild(primbackup::getInstance()->xml); + + /* + 1.0 + TextureTest + 7/8/2009 12:46 AM + Maxproxy 1.3.2 + 3b520582-1d15-41c6-8849-afdd1b2528bd + OpenSim + unknown + *//* + + + temp_xml->writeToOstream(out); + out.close(); + /////////////////////////////////////////////// +#endif + + primbackup::getInstance()->m_nexttextureready=true; + primbackup::getInstance()->export_state=EXPORT_TEXTURES; + } break; + case EXPORT_DONE: + llinfos<<"Backup complete"<close(); + break; + } +} + +LLXMLNode *primbackup::prims_to_xml(LLViewerObject::child_list_t child_list) +{ + + LLViewerObject* object; + LLXMLNode *xml = new LLXMLNode("linkset", FALSE); + + char localid[16]; + + for (LLViewerObject::child_list_t::iterator i = child_list.begin(); i != child_list.end(); ++i) + { + object=(*i); + LLUUID id = object->getID(); + + llinfos << "Exporting prim " << object->getID().asString() << llendl; + + std::string selected_item = "box"; + F32 scale_x=1.f, scale_y=1.f; + + const LLVolumeParams &volume_params = object->getVolume()->getParams(); + + // Volume type + U8 path = volume_params.getPathParams().getCurveType(); + U8 profile_and_hole = volume_params.getProfileParams().getCurveType(); + U8 profile = profile_and_hole & LL_PCODE_PROFILE_MASK; + U8 hole = profile_and_hole & LL_PCODE_HOLE_MASK; + + // Scale goes first so we can differentiate between a sphere and a torus, + // which have the same profile and path types. + + // Scale + scale_x = volume_params.getRatioX(); + scale_y = volume_params.getRatioY(); + + BOOL linear_path = (path == LL_PCODE_PATH_LINE) || (path == LL_PCODE_PATH_FLEXIBLE); + if ( linear_path && profile == LL_PCODE_PROFILE_CIRCLE ) + { + selected_item = "cylinder"; + } + else if ( linear_path && profile == LL_PCODE_PROFILE_SQUARE ) + { + selected_item = "box"; + } + else if ( linear_path && profile == LL_PCODE_PROFILE_ISOTRI ) + { + selected_item = "prism"; + } + else if ( linear_path && profile == LL_PCODE_PROFILE_EQUALTRI ) + { + selected_item = "prism"; + } + else if ( linear_path && profile == LL_PCODE_PROFILE_RIGHTTRI ) + { + selected_item = "prism"; + } + else if (path == LL_PCODE_PATH_FLEXIBLE) // shouldn't happen + { + selected_item = "cylinder"; // reasonable default + } + else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE && scale_y > 0.75f) + { + selected_item = "sphere"; + } + else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE && scale_y <= 0.75f) + { + selected_item = "torus"; + } + else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_CIRCLE_HALF) + { + selected_item = "sphere"; + } + else if ( path == LL_PCODE_PATH_CIRCLE2 && profile == LL_PCODE_PROFILE_CIRCLE ) + { + // Spirals aren't supported. Make it into a sphere. JC + selected_item = "sphere"; + } + else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_EQUALTRI ) + { + selected_item = "ring"; + } + else if ( path == LL_PCODE_PATH_CIRCLE && profile == LL_PCODE_PROFILE_SQUARE && scale_y <= 0.75f) + { + selected_item = "tube"; + } + else + { + llinfos << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << llendl; + selected_item = "box"; } - case EXPORT_DONE: { - llinfos << "Backup complete" << llendl; - gIdleCallbacks.deleteFunction(exportworker); - primbackup::getInstance()->close(); - break; + if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + { + selected_item = "sculpt"; + } + + // Create an LLSD object that represents this prim. It will be injected in to the overall LLSD + // tree structure + LLXMLNode *prim_xml = new LLXMLNode(selected_item.c_str(), FALSE); + + if (!object->isRoot()) + { + + // Parent id + snprintf(localid, sizeof(localid), "%u", object->getSubParent()->getLocalID()); + prim_xml->createChild("uuid", FALSE)->setValue(localid); + } + + + LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->findNode(object); + if (node) + { + prim_xml->createChild("name", FALSE)->setValue("mName + "]]>"); + prim_xml->createChild("description", FALSE)->setValue("mDescription + "]]>"); + } + + // Transforms + LLXMLNodePtr position_xml = prim_xml->createChild("position", FALSE); + LLVector3 position; + position.setVec(object->getPositionRegion()); + position_xml->createChild("x", TRUE)->setValue(llformat("%.5f", position.mV[VX])); + position_xml->createChild("y", TRUE)->setValue(llformat("%.5f", position.mV[VY])); + position_xml->createChild("z", TRUE)->setValue(llformat("%.5f", position.mV[VZ])); + + LLXMLNodePtr scale_xml = prim_xml->createChild("size", FALSE); + LLVector3 scale = object->getScale(); + scale_xml->createChild("x", TRUE)->setValue(llformat("%.5f", scale.mV[VX])); + scale_xml->createChild("y", TRUE)->setValue(llformat("%.5f", scale.mV[VY])); + scale_xml->createChild("z", TRUE)->setValue(llformat("%.5f", scale.mV[VZ])); + + LLXMLNodePtr rotation_xml = prim_xml->createChild("rotation", FALSE); + LLQuaternion rotation = object->getRotationEdit(); + rotation_xml->createChild("x", TRUE)->setValue(llformat("%.5f", rotation.mQ[VX])); + rotation_xml->createChild("y", TRUE)->setValue(llformat("%.5f", rotation.mQ[VY])); + rotation_xml->createChild("z", TRUE)->setValue(llformat("%.5f", rotation.mQ[VZ])); + rotation_xml->createChild("w", TRUE)->setValue(llformat("%.5f", rotation.mQ[VW])); + + // Flags + if(object->flagPhantom()) + { + LLXMLNodePtr shadow_xml = prim_xml->createChild("phantom", FALSE); + shadow_xml->createChild("val", TRUE)->setValue("true"); + } + + if(object->mFlags & FLAGS_USE_PHYSICS) + { + LLXMLNodePtr shadow_xml = prim_xml->createChild("physical", FALSE); + shadow_xml->createChild("val", TRUE)->setValue("true"); + } + + // Grab S path + F32 begin_s = volume_params.getBeginS(); + F32 end_s = volume_params.getEndS(); + + // Compute cut and advanced cut from S and T + F32 begin_t = volume_params.getBeginT(); + F32 end_t = volume_params.getEndT(); + + // Hollowness + F32 hollow = volume_params.getHollow(); + + // Twist + F32 twist = volume_params.getTwist() * 180.0; + F32 twist_begin = volume_params.getTwistBegin() * 180.0; + + // Cut interpretation varies based on base object type + F32 cut_begin, cut_end, adv_cut_begin, adv_cut_end; + + if ( selected_item == "sphere" || selected_item == "torus" || + selected_item == "tube" || selected_item == "ring" ) + { + cut_begin = begin_t; + cut_end = end_t; + adv_cut_begin = begin_s; + adv_cut_end = end_s; } + else + { + cut_begin = begin_s; + cut_end = end_s; + adv_cut_begin = begin_t; + adv_cut_end = end_t; + } + + if (selected_item != "sphere") + { + // Shear + // + F32 shear_x = volume_params.getShearX(); + F32 shear_y = volume_params.getShearY(); + LLXMLNodePtr shear_xml = prim_xml->createChild("top_shear", FALSE); + shear_xml->createChild("x", TRUE)->setValue(llformat("%.5f", shear_x)); + shear_xml->createChild("y", TRUE)->setValue(llformat("%.5f", shear_y)); + + + } + + if (selected_item == "box" || selected_item == "cylinder" || selected_item == "prism") + { + // Taper + // + F32 taper_x = 1.f - volume_params.getRatioX(); + F32 taper_y = 1.f - volume_params.getRatioY(); + LLXMLNodePtr taper_xml = prim_xml->createChild("taper", FALSE); + taper_xml->createChild("x", TRUE)->setValue(llformat("%.5f", taper_x)); + taper_xml->createChild("y", TRUE)->setValue(llformat("%.5f", taper_y)); + } + else if (selected_item == "torus" || selected_item == "tube" || selected_item == "ring") + { + // Taper + // + F32 taper_x = volume_params.getTaperX(); + F32 taper_y = volume_params.getTaperY(); + LLXMLNodePtr taper_xml = prim_xml->createChild("taper", FALSE); + taper_xml->createChild("x", TRUE)->setValue(llformat("%.5f", taper_x)); + taper_xml->createChild("y", TRUE)->setValue(llformat("%.5f", taper_y)); + + + //Hole Size + // + F32 hole_size_x = volume_params.getRatioX(); + F32 hole_size_y = volume_params.getRatioY(); + LLXMLNodePtr hole_size_xml = prim_xml->createChild("hole_size", FALSE); + hole_size_xml->createChild("x", TRUE)->setValue(llformat("%.5f", hole_size_x)); + hole_size_xml->createChild("y", TRUE)->setValue(llformat("%.5f", hole_size_y)); + + + //Advanced cut + // + LLXMLNodePtr profile_cut_xml = prim_xml->createChild("profile_cut", FALSE); + profile_cut_xml->createChild("begin", TRUE)->setValue(llformat("%.5f", adv_cut_begin)); + profile_cut_xml->createChild("end", TRUE)->setValue(llformat("%.5f", adv_cut_end)); + + + } + + // + LLXMLNodePtr path_cut_xml = prim_xml->createChild("path_cut", FALSE); + path_cut_xml->createChild("begin", TRUE)->setValue(llformat("%.5f", cut_begin)); + path_cut_xml->createChild("end", TRUE)->setValue(llformat("%.5f", cut_end)); + + // + LLXMLNodePtr twist_xml = prim_xml->createChild("twist", FALSE); + twist_xml->createChild("begin", TRUE)->setValue(llformat("%.5f", twist_begin)); + twist_xml->createChild("end", TRUE)->setValue(llformat("%.5f", twist)); + + + // All hollow objects allow a shape to be selected. + if (hollow > 0.f) + { + const char *selected_hole = "1"; + + switch (hole) + { + case LL_PCODE_HOLE_CIRCLE: + selected_hole = "3"; + break; + case LL_PCODE_HOLE_SQUARE: + selected_hole = "2"; + break; + case LL_PCODE_HOLE_TRIANGLE: + selected_hole = "4"; + break; + case LL_PCODE_HOLE_SAME: + default: + selected_hole = "1"; + break; + } + + // + LLXMLNodePtr hollow_xml = prim_xml->createChild("hollow", FALSE); + hollow_xml->createChild("amount", TRUE)->setValue(llformat("%.5f", hollow * 100.0)); + hollow_xml->createChild("shape", TRUE)->setValue(llformat("%s", selected_hole)); + } + + // Extra params // b6fab961-af18-77f8-cf08-f021377a7244 + + // Flexible + if (object->isFlexible()) + { //FIXME + LLFlexibleObjectData* flex = (LLFlexibleObjectData*)object->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + prim_xml->createChild("flexible", FALSE)->setValue(flex->asLLSD()); + } + + // Light + if (object->getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT)) + { + LLLightParams* light = (LLLightParams*)object->getParameterEntry(LLNetworkData::PARAMS_LIGHT); + + // + LLXMLNodePtr light_xml = prim_xml->createChild("light", FALSE); + + // + LLXMLNodePtr color_xml = light_xml->createChild("color", FALSE); + LLColor4 color = light->getColor(); + color_xml->createChild("r", TRUE)->setValue(llformat("%u", color.mV[VRED])); + color_xml->createChild("g", TRUE)->setValue(llformat("%u", color.mV[VGREEN])); + color_xml->createChild("b", TRUE)->setValue(llformat("%u", color.mV[VBLUE])); + + // + LLXMLNodePtr intensity_xml = light_xml->createChild("intensity", FALSE); + intensity_xml->createChild("val", TRUE)->setValue(llformat("%.5f", color.mV[VALPHA])); + + // + LLXMLNodePtr radius_xml = light_xml->createChild("radius", FALSE); + radius_xml->createChild("val", TRUE)->setValue(llformat("%.5f", light->getRadius())); + + // + LLXMLNodePtr falloff_xml = light_xml->createChild("falloff", FALSE); + falloff_xml->createChild("val", TRUE)->setValue(llformat("%.5f", light->getFalloff())); + + //return light->getCutoff(); wtf is this? + } + + // Sculpt + if (object->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + { + LLSculptParams* sculpt = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + + // + LLXMLNodePtr topology_xml = prim_xml->createChild("topology", FALSE); + topology_xml->createChild("val", TRUE)->setValue(llformat("%u", sculpt->getSculptType())); + + //1e366544-c287-4fff-ba3e-5fafdba10272 + //apple_map.tga + //FIXME png/tga/j2c selection itt. + prim_xml->createChild("sculptmap_file", FALSE)->setValue(llformat("%s", "testing")); + prim_xml->createChild("sculptmap_uuid", FALSE)->setValue(llformat("%s", "testing")); + + //prim_xml->createChild("sculptmap_file", FALSE)->setValue(llformat("%s", sculpt->getSculptTexture())); + //prim_xml->createChild("sculptmap_uuid", FALSE)->setValue(llformat("%s", sculpt->getSculptTexture())); + + LLUUID sculpt_texture=sculpt->getSculptTexture(); + bool alreadyseen=false; + std::list::iterator iter; + for(iter = textures.begin(); iter != textures.end() ; iter++) + { + if( (*iter)==sculpt_texture) + alreadyseen=true; + } + if(alreadyseen==false) + { + llinfos << "Found a sculpt texture, adding to list "< + LLXMLNodePtr texture_xml = prim_xml->createChild("texture", FALSE); + + // Textures + LLSD te_llsd; + U8 te_count = object->getNumTEs(); + for (U8 i = 0; i < te_count; i++) + { + bool alreadyseen=false; + te_llsd.append(object->getTE(i)->asLLSD()); + std::list::iterator iter; + for(iter = textures.begin(); iter != textures.end() ; iter++) + { + if( (*iter)==object->getTE(i)->getID()) + alreadyseen=true; + } + + // + LLXMLNodePtr face_xml = texture_xml->createChild("face", FALSE); + //This may be a hack, but it's ok since we're not using id in this code. We set id differently because for whatever reason + //llxmlnode filters a few parameters including ID. -Patrick Sapinski (Friday, September 25, 2009) + face_xml->mID = llformat("%d", i); + + // + //object->getTE(face)->mScaleS + //object->getTE(face)->mScaleT + LLXMLNodePtr tile_xml = face_xml->createChild("tile", FALSE); + tile_xml->createChild("u", TRUE)->setValue(llformat("%.5f", object->getTE(i)->mScaleS)); + tile_xml->createChild("v", TRUE)->setValue(llformat("%.5f", object->getTE(i)->mScaleT)); + + // + //object->getTE(face)->mOffsetS + //object->getTE(face)->mOffsetT + LLXMLNodePtr offset_xml = face_xml->createChild("offset", FALSE); + offset_xml->createChild("u", TRUE)->setValue(llformat("%.5f", object->getTE(i)->mOffsetS)); + offset_xml->createChild("v", TRUE)->setValue(llformat("%.5f", object->getTE(i)->mOffsetT)); + + + // + //object->getTE(face)->mRotation + LLXMLNodePtr rotation_xml = face_xml->createChild("rotation", FALSE); + rotation_xml->createChild("w", TRUE)->setValue(llformat("%.5f", object->getTE(i)->mRotation)); + + + // + //76a0319a-e963-44b0-9f25-127815226d71 + LLUUID texture = object->getTE(i)->getID(); + std::string uuid_string; + object->getTE(i)->getID().toString(uuid_string); + + face_xml->createChild("image_file", FALSE)->setValue(""); + face_xml->createChild("image_uuid", FALSE)->setValue(uuid_string); + + + // + LLXMLNodePtr color_xml = face_xml->createChild("color", FALSE); + LLColor4 color = object->getTE(i)->getColor(); + color_xml->createChild("r", TRUE)->setValue(llformat("%.5f", color.mV[VRED])); + color_xml->createChild("g", TRUE)->setValue(llformat("%.5f", color.mV[VGREEN])); + color_xml->createChild("b", TRUE)->setValue(llformat("%.5f", color.mV[VBLUE])); + + // + LLXMLNodePtr transparency_xml = face_xml->createChild("transparency", FALSE); + transparency_xml->createChild("val", TRUE)->setValue(llformat("%.5f", color.mV[VALPHA])); + + // + //object->getTE(face)->getGlow() + LLXMLNodePtr glow_xml = face_xml->createChild("glow", FALSE); + glow_xml->createChild("val", TRUE)->setValue(llformat("%.5f", object->getTE(i)->getGlow())); + + // + //object->getTE(face)->getFullbright() + if(object->getTE(i)->getFullbright()) + { + LLXMLNodePtr fullbright_xml = face_xml->createChild("fullbright", FALSE); + fullbright_xml->createChild("val", TRUE)->setValue("true"); + } + + // + //object->getTE(face)->getShiny() + if (object->getTE(i)->getShiny()) + { + LLXMLNodePtr shine_xml = face_xml->createChild("shine", FALSE); + shine_xml->createChild("val", TRUE)->setValue("1"); + } + + // + //object->getTE(face)->getBumpmap() + if (object->getTE(i)->getBumpmap()) + { + LLXMLNodePtr bumpmap_xml = face_xml->createChild("bumpmap", FALSE); + bumpmap_xml->createChild("val", TRUE)->setValue("1"); + } + + // + + if(alreadyseen==false) + textures.push_back(object->getTE(i)->getID()); + } + + // The keys in the primitive maps do not have to be localids, they can be any + // string. We simply use localids because they are a unique identifier + snprintf(localid, sizeof(localid), "%u", object->getLocalID()); + //put prim_xml inside of xml? -Patrick Sapinski (Thursday, September 17, 2009) + //llsd[(const char*)localid] = prim_llsd; + xml->addChild(prim_xml); + } + + updateexportnumbers(); + + return xml; } LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list) @@ -560,7 +1121,7 @@ LLSD primbackup::prims_to_llsd(LLViewerObject::child_list_t child_list) return llsd; } - +/* void primbackup::export_next_texture() { if(textures.empty()) @@ -613,7 +1174,7 @@ void primbackup::export_next_texture() LLAppViewer::getTextureCache()->readFromCache(id,LLWorkerThread::PRIORITY_HIGH,0,999999,responder); } - +*/ void primbackup::import_object(bool upload) { @@ -733,7 +1294,7 @@ void primbackup::rez_agent_offset(LLVector3 offset) LLToolPlacer* mPlacer = new LLToolPlacer(); mPlacer->setObjectType(LL_PCODE_CUBE); //LLVector3 pos=offset_agent(offset); - mPlacer->placeObject((S32)(offset.mV[0]), (S32)(offset.mV[1]), 0); + mPlacer->placeObject((S32)offset.mV[0], (S32)offset.mV[1],(S32)offset.mV[2]); } void primbackup::import_object1a() @@ -1068,7 +1629,7 @@ void primbackup::upload_next_asset() // gen a new transaction ID for this asset tid.generate(); uuid = tid.makeAssetID(gAgent.getSecureSessionID()); - +/* S32 file_size; apr_file_t* fp = ll_apr_file_open(filename, LL_APR_RB, &file_size); if (fp) @@ -1089,7 +1650,7 @@ void primbackup::upload_next_asset() llwarns<<"Unable to access output file "<