public ISceneEntity CreateEntity( ISceneEntity baseEntity, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) { if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0) { MainConsole.Instance.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name); return(null); } ISceneChildEntity rootPart = baseEntity.GetChildPart(baseEntity.UUID); // if grass or tree, make phantom //rootPart.TrimPermissions(); rootPart.AddFlag(PrimFlags.Phantom); if (rootPart.Shape.PCode != (byte)PCode.Grass) { AdaptTree(ref shape); } m_scene.SceneGraph.AddPrimToScene(baseEntity); baseEntity.SetGroup(groupID, ownerID, true); baseEntity.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate); return(baseEntity); }
public ISceneEntity CreateEntity( ISceneEntity sceneObject, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) { if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0) { MainConsole.Instance.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name); return(null); } ISceneChildEntity rootPart = sceneObject.GetChildPart(sceneObject.UUID); rootPart.AddFlag(PrimFlags.Phantom); if (rootPart.Shape.PCode != (byte)PCode.Grass) { // Tree size has to be adapted depending on its type switch ((Tree)rootPart.Shape.State) { case Tree.Cypress1: case Tree.Cypress2: case Tree.Palm1: case Tree.Palm2: case Tree.WinterAspen: rootPart.Scale = new Vector3(4, 4, 10); break; case Tree.WinterPine1: case Tree.WinterPine2: rootPart.Scale = new Vector3(4, 4, 20); break; case Tree.Dogwood: rootPart.Scale = new Vector3(6.5f, 6.5f, 6.5f); break; // case... other tree types // tree.Scale = new Vector3(?, ?, ?); // break; default: rootPart.Scale = new Vector3(4, 4, 4); break; } } sceneObject.SetGroup(groupID, UUID.Zero, false); m_scene.SceneGraph.AddPrimToScene(sceneObject); sceneObject.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate); return(sceneObject); }
public ISceneEntity CreateEntity( ISceneEntity baseEntity, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) { if (Array.IndexOf(creationCapabilities, (PCode) shape.PCode) < 0) { MainConsole.Instance.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name); return null; } ISceneChildEntity rootPart = baseEntity.GetChildPart(baseEntity.UUID); // if grass or tree, make phantom //rootPart.TrimPermissions(); rootPart.AddFlag(PrimFlags.Phantom); if (rootPart.Shape.PCode != (byte) PCode.Grass) AdaptTree(ref shape); m_scene.SceneGraph.AddPrimToScene(baseEntity); baseEntity.SetGroup(groupID, ownerID, true); baseEntity.ScheduleGroupUpdate(PrimUpdateFlags.ForcedFullUpdate); return baseEntity; }
public ISceneEntity GetRezReadySceneObject(TaskInventoryItem item) { byte[] rezAsset = m_part.ParentGroup.Scene.AssetService.GetData(item.AssetID.ToString()); if (null == rezAsset) { MainConsole.Instance.WarnFormat( "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", item.AssetID, item.Name, m_part.Name); return(null); } string xmlData = Utils.BytesToString(rezAsset); ISceneEntity group = SceneEntitySerializer.SceneObjectSerializer.FromOriginalXmlFormat(xmlData, m_part.ParentGroup .Scene); if (group == null) { return(null); } group.IsDeleted = false; foreach (ISceneChildEntity part in group.ChildrenEntities()) { part.IsLoading = false; } //Reset IDs, etc m_part.ParentGroup.Scene.SceneGraph.PrepPrimForAdditionToScene(group); ISceneChildEntity rootPart = group.GetChildPart(group.UUID); // Since renaming the item in the inventory does not affect the name stored // in the serialization, transfer the correct name from the inventory to the // object itself before we rez. rootPart.Name = item.Name; rootPart.Description = item.Description; List <ISceneChildEntity> partList = group.ChildrenEntities(); group.SetGroup(m_part.GroupID, group.OwnerID, false); if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) { if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) { foreach (ISceneChildEntity part in partList) { part.EveryoneMask = item.EveryonePermissions; part.NextOwnerMask = item.NextPermissions; } group.ApplyNextOwnerPermissions(); } } foreach (ISceneChildEntity part in partList) { if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) { part.LastOwnerID = part.OwnerID; part.OwnerID = item.OwnerID; part.Inventory.ChangeInventoryOwner(item.OwnerID); } part.EveryoneMask = item.EveryonePermissions; part.NextOwnerMask = item.NextPermissions; } rootPart.TrimPermissions(); return(group); }
/// <summary> /// Create a tree entity /// </summary> /// <param name="sceneObject">Scene object.</param> /// <param name="ownerID"></param> /// <param name="groupID"></param> /// <param name="pos"></param> /// <param name="rot"></param> /// <param name="shape"></param> /// <returns>The tree entity created, or null if the creation failed</returns> public ISceneEntity CreateEntity( ISceneEntity sceneObject, UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) { if ( Array.IndexOf( creationCapabilities, ( PCode)shape.PCode ) < 0 ) { MainConsole.Instance.Debug ( "[VEGETATION]: PCode " + shape.PCode + " not handled by "+ Name ); return null; } ISceneChildEntity rootPart = sceneObject.GetChildPart(sceneObject.UUID); rootPart.AddFlag(PrimFlags.Phantom); if ( rootPart.Shape.PCode != (byte)PCode.Grass ) { // Tree size has to be adapted depending on its type switch ( (Tree)rootPart.Shape.State ) { case Tree.Cypress1: case Tree.Cypress2: case Tree.Palm1: case Tree.Palm2: case Tree.WinterAspen: rootPart.Scale = new Vector3(4, 4, 10); break; case Tree.WinterPine1: case Tree.WinterPine2: rootPart.Scale = new Vector3(4, 4, 20); break; case Tree.Dogwood: rootPart.Scale = new Vector3(6.5f, 6.5f, 6.5f); break; // case... other tree types // tree.Scale = new Vector3(?, ?, ?); // break; default: rootPart.Scale = new Vector3(4, 4, 4); break; } } sceneObject.SetGroup( groupID, UUID.Zero, false ); m_scene.SceneGraph.AddPrimToScene( sceneObject ); sceneObject.ScheduleGroupUpdate( PrimUpdateFlags.ForcedFullUpdate ); return sceneObject; }