void ImportTracker::send_image(LLSD& prim) { LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectImage); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger()); msg->addStringFast(_PREHASH_MediaURL, NULL); LLPrimitive obj; LLSD tes = prim["textures"]; obj.setNumTEs(U8(tes.size())); for (int i = 0; i < tes.size(); i++) { LLTextureEntry tex; tex.fromLLSD(tes[i]); obj.setTE(U8(i), tex); } obj.packTEMessage(gMessageSystem); msg->sendReliable(gAgent.getRegion()->getHost()); }
void llprimitive_object_t::test<4>() { set_test_name("Test Static llprimitive constructor and initer."); LLPCode code = 1; LLPrimitive * primitive = LLPrimitive::createPrimitive(code); ensure(primitive != NULL); ensure_equals(primitive->getPCode(), code); }
void llprimitive_object_t::test<3>() { set_test_name("Test llprimitive constructor and initer."); LLPCode code = 1; LLPrimitive primitive; primitive.init_primitive(code); ensure_equals(primitive.getPCode(), code); }
void llprimitive_object_t::test<2>() { set_test_name("Test LLPrimitive PCode setter and getter."); LLPrimitive test; ensure_equals(test.getPCode(), 0); LLPCode code = 1; test.setPCode(code); ensure_equals(test.getPCode(), code); }
//=============================================================== // static LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code) { LLPrimitive *retval = new LLPrimitive(); if (retval) { retval->init_primitive(p_code); } else { LL_ERRS() << "primitive allocation failed" << LL_ENDL; } return retval; }
//=============================================================== // static LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code) { LLMemType m1(LLMemType::MTYPE_PRIMITIVE); LLPrimitive *retval = new LLPrimitive(); if (retval) { retval->init_primitive(p_code); } else { llerrs << "primitive allocation failed" << llendl; } return retval; }
void llprimitive_object_t::test<6>() { set_test_name("Test setVolume creation of new NOT-unique volume."); LLPrimitive primitive; LLVolumeParams params; // Make sure volume starts off null ensure(primitive.getVolume() == NULL); // Make sure we have no texture entries before setting the volume ensure_equals(primitive.getNumTEs(), 0); // Test that GEOMETRY has not been flagged as changed. ensure(!primitive.isChanged(LLXform::GEOMETRY)); // Make sure setVolume returns true ensure(primitive.setVolume(params, 0, false) == TRUE); LLVolume* new_volume = primitive.getVolume(); // make sure new volume was actually created ensure(new_volume != NULL); // Make sure that now that we've set the volume we have texture entries ensure_not_equals(primitive.getNumTEs(), 0); // Make sure that the number of texture entries equals the number of faces in the volume (should be 6) ensure_equals(new_volume->getNumFaces(), 6); ensure_equals(primitive.getNumTEs(), new_volume->getNumFaces()); // Test that GEOMETRY has been flagged as changed. ensure(primitive.isChanged(LLXform::GEOMETRY)); // Run it twice to make sure it doesn't create a different one if params are the same ensure(primitive.setVolume(params, 0, false) == FALSE); ensure(new_volume == primitive.getVolume()); // Change the param definition and try setting it again. params.setRevolutions(4); ensure(primitive.setVolume(params, 0, false) == TRUE); // Ensure that we now have a different volume ensure(new_volume != primitive.getVolume()); }
void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) { switch (state) { //lgg crap to change remaining prim parameters from the ascent system build preferences subtab case WAND: if(justCreated && createSelected) { numberExpected--; if(numberExpected<=0) state=IDLE; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectImage); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addStringFast(_PREHASH_MediaURL, NULL); //sets texture stuff LLPrimitive obj; obj.setNumTEs(U8(10)); S32 shinnyLevel = 0; static LLCachedControl<std::string> sshinystr(gSavedSettings, "EmeraldBuildPrefs_Shiny"); std::string shinystr = sshinystr; //if(shinystr == "None") shinnyLevel = 0; //We're already 0. if(shinystr == "Low") shinnyLevel = 1; else if(shinystr == "Medium") shinnyLevel = 2; else if(shinystr == "High") shinnyLevel = 3; for (int i = 0; i < 10; i++) { LLTextureEntry tex = LLTextureEntry(LLUUID(gSavedSettings.getString("EmeraldBuildPrefs_Texture"))); tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color")); tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0)); tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow")); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright")) { tex.setFullbright(TEM_FULLBRIGHT_MASK); } tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK); obj.setTE(U8(i), tex); } obj.packTEMessage(gMessageSystem); msg->sendReliable(gAgent.getRegion()->getHost()); //sets some object parameters msg->newMessage("ObjectFlagUpdate"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid ); msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical")); msg->addBOOLFast(_PREHASH_IsTemporary, gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary")); msg->addBOOLFast(_PREHASH_IsPhantom, gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") ); msg->addBOOL("CastsShadows", false ); msg->sendReliable(gAgent.getRegion()->getHost()); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem")) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedPerAccountSettings.getString("EmeraldBuildPrefs_Item")); LLViewerObject* objectp = find((U32)newid); if(objectp) if(item) { if(item->getType()==LLAssetType::AT_LSL_TEXT) { LLToolDragAndDrop::dropScript(objectp, item, TRUE, LLToolDragAndDrop::SOURCE_AGENT, gAgent.getID()); }else { LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); } } } msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, FALSE); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); msg->addU8Fast(_PREHASH_Set, PERM_SET_TRUE); U32 flags = 0; if ( gSavedSettings.getBOOL("NextOwnerCopy") ) { flags |= PERM_COPY; } if ( gSavedSettings.getBOOL("NextOwnerModify") ) { flags |= PERM_MODIFY; } bool next_owner_trans; if ( next_owner_trans = gSavedSettings.getBOOL("NextOwnerTransfer") ) { flags |= PERM_TRANSFER; } msg->addU32Fast(_PREHASH_Mask, flags); msg->sendReliable(gAgent.getRegion()->getHost()); if (!next_owner_trans) // Workaround transfer being true by default. { msg->newMessageFast(_PREHASH_ObjectPermissions); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgentID); msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_HeaderData); msg->addBOOLFast(_PREHASH_Override, false); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER); msg->addU8Fast(_PREHASH_Set, PERM_SET_FALSE); msg->addU32Fast(_PREHASH_Mask, PERM_TRANSFER); msg->sendReliable(gAgent.getRegion()->getHost()); } //llinfos << "LGG SENDING CUBE TEXTURE.." << llendl; } break; /* case BUILDING: if (justCreated && (int)localids.size() < linkset.size()) { localids.push_back(newid); localids.sort(); localids.unique(); linkset[localids.size() -1]["LocalID"] = newid; LLSD prim = linkset[localids.size() -1]; //MAKERIGHT if (!(prim).has("Updated")) { ++updated; send_shape(prim); send_image(prim); send_extras(prim); send_namedesc(prim); send_vectors(prim,updated); send_properties(prim, updated); send_inventory(prim); (prim)["Updated"] = true; } if ((int)localids.size() < linkset.size()) { plywood_above_head(); return; } else { if (updated >= linkset.size()) { updated=0; llinfos << "FINISHED BUILDING, LINKING.." << llendl; state = LINKING; link(); } } } break; case LINKING: link(); break;*/ } }
void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected) { switch (state) { //lgg crap case WAND: if(justCreated && createSelected) { numberExpected--; if(numberExpected<=0) state=IDLE; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ObjectImage); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid); msg->addStringFast(_PREHASH_MediaURL, NULL); LLPrimitive obj; obj.setNumTEs(U8(10)); S32 shinnyLevel = 0; static std::string* shinystr = rebind_llcontrol<std::string>("EmeraldBuildPrefs_Shiny", &gSavedSettings, true); if(*shinystr == "None") shinnyLevel = 0; if(*shinystr == "Low") shinnyLevel = 1; if(*shinystr == "Medium") shinnyLevel = 2; if(*shinystr == "High") shinnyLevel = 3; for (int i = 0; i < 10; i++) { static std::string* buildpreftex = rebind_llcontrol<std::string>("EmeraldBuildPrefs_Texture", &gSavedSettings, true); LLTextureEntry tex = LLTextureEntry(LLUUID(*buildpreftex)); tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color")); tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0)); tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow")); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright")) { tex.setFullbright(TEM_FULLBRIGHT_MASK); } tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK); obj.setTE(U8(i), tex); } obj.packTEMessage(gMessageSystem); msg->sendReliable(gAgent.getRegion()->getHost()); msg->newMessage("ObjectFlagUpdate"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid ); msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical")); msg->addBOOL("IsTemporary", gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary")); msg->addBOOL("IsPhantom", gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") ); msg->addBOOL("CastsShadows", true ); msg->sendReliable(gAgent.getRegion()->getHost()); if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem")) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item")); LLViewerObject* objectp = find((U32)newid); if(objectp) if(item) { if(item->getType()==LLAssetType::AT_LSL_TEXT) { LLToolDragAndDrop::dropScript(objectp, item, TRUE, LLToolDragAndDrop::SOURCE_AGENT, gAgent.getID()); }else { LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID()); } } } //llinfos << "LGG SENDING CUBE TEXTURE.." << llendl; } break; case BUILDING: if (justCreated && (int)localids.size() < linkset.size()) { localids.push_back(newid); localids.sort(); localids.unique(); linkset[localids.size() -1]["LocalID"] = newid; LLSD prim = linkset[localids.size() -1]; //MAKERIGHT if (!(prim).has("Updated")) { ++updated; send_shape(prim); send_image(prim); send_extras(prim); send_namedesc(prim); send_vectors(prim,updated); send_properties(prim, updated); send_inventory(prim); (prim)["Updated"] = true; } if ((int)localids.size() < linkset.size()) { plywood_above_head(); return; } else { if (updated >= linkset.size()) { updated=0; llinfos << "FINISHED BUILDING, LINKING.." << llendl; state = LINKING; link(); } } } break; case LINKING: link(); break; } }