aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs
diff options
context:
space:
mode:
authorDr Scofield2009-02-10 13:10:57 +0000
committerDr Scofield2009-02-10 13:10:57 +0000
commit180be7de07014aa33bc6066f12a0819b731c1c9d (patch)
tree3aa13af3cda4b808fa9453655875327699b61311 /OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs
parentStopgap measure: To use gridlaunch, or GUI, start opensim with (diff)
downloadopensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.zip
opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.gz
opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.bz2
opensim-SC-180be7de07014aa33bc6066f12a0819b731c1c9d.tar.xz
this is step 2 of 2 of the OpenSim.Region.Environment refactor.
NOTHING has been deleted or moved off to forge at this point. what has happened is that OpenSim.Region.Environment.Modules has been split in two: - OpenSim.Region.CoreModules: all those modules that are either directly or indirectly referenced from other OpenSim packages, or that provide functionality that the OpenSim developer community considers core functionality: CoreModules/Agent/AssetTransaction CoreModules/Agent/Capabilities CoreModules/Agent/TextureDownload CoreModules/Agent/TextureSender CoreModules/Agent/TextureSender/Tests CoreModules/Agent/Xfer CoreModules/Avatar/AvatarFactory CoreModules/Avatar/Chat/ChatModule CoreModules/Avatar/Combat CoreModules/Avatar/Currency/SampleMoney CoreModules/Avatar/Dialog CoreModules/Avatar/Friends CoreModules/Avatar/Gestures CoreModules/Avatar/Groups CoreModules/Avatar/InstantMessage CoreModules/Avatar/Inventory CoreModules/Avatar/Inventory/Archiver CoreModules/Avatar/Inventory/Transfer CoreModules/Avatar/Lure CoreModules/Avatar/ObjectCaps CoreModules/Avatar/Profiles CoreModules/Communications/Local CoreModules/Communications/REST CoreModules/Framework/EventQueue CoreModules/Framework/InterfaceCommander CoreModules/Hypergrid CoreModules/InterGrid CoreModules/Scripting/DynamicTexture CoreModules/Scripting/EMailModules CoreModules/Scripting/HttpRequest CoreModules/Scripting/LoadImageURL CoreModules/Scripting/VectorRender CoreModules/Scripting/WorldComm CoreModules/Scripting/XMLRPC CoreModules/World/Archiver CoreModules/World/Archiver/Tests CoreModules/World/Estate CoreModules/World/Land CoreModules/World/Permissions CoreModules/World/Serialiser CoreModules/World/Sound CoreModules/World/Sun CoreModules/World/Terrain CoreModules/World/Terrain/DefaultEffects CoreModules/World/Terrain/DefaultEffects/bin CoreModules/World/Terrain/DefaultEffects/bin/Debug CoreModules/World/Terrain/Effects CoreModules/World/Terrain/FileLoaders CoreModules/World/Terrain/FloodBrushes CoreModules/World/Terrain/PaintBrushes CoreModules/World/Terrain/Tests CoreModules/World/Vegetation CoreModules/World/Wind CoreModules/World/WorldMap - OpenSim.Region.OptionalModules: all those modules that are not core modules: OptionalModules/Avatar/Chat/IRC-stuff OptionalModules/Avatar/Concierge OptionalModules/Avatar/Voice/AsterixVoice OptionalModules/Avatar/Voice/SIPVoice OptionalModules/ContentManagementSystem OptionalModules/Grid/Interregion OptionalModules/Python OptionalModules/SvnSerialiser OptionalModules/World/NPC OptionalModules/World/TreePopulator
Diffstat (limited to 'OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs274
1 files changed, 0 insertions, 274 deletions
diff --git a/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs
deleted file mode 100644
index c8f8c2f..0000000
--- a/OpenSim/Region/Environment/Modules/ContentManagementSystem/MetaEntity.cs
+++ /dev/null
@@ -1,274 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#region Header
29
30// MetaEntity.cs
31// User: bongiojp
32//
33// TODO:
34// Create a physics manager to the meta object if there isn't one or the object knows of no scene but the user wants physics enabled.
35
36#endregion Header
37
38using System;
39using System.Collections.Generic;
40using System.Drawing;
41
42using OpenMetaverse;
43
44using Nini.Config;
45
46using OpenSim.Framework;
47using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Physics.Manager;
50
51using log4net;
52
53namespace OpenSim.Region.Environment.Modules.ContentManagement
54{
55 public class MetaEntity
56 {
57 #region Constants
58
59 public const float INVISIBLE = .95f;
60
61 // Settings for transparency of metaentity
62 public const float NONE = 0f;
63 public const float TRANSLUCENT = .5f;
64
65 #endregion Constants
66
67 #region Static Fields
68
69 protected static readonly ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
70
71 #endregion Static Fields
72
73 #region Fields
74
75 protected SceneObjectGroup m_Entity = null; // The scene object group that represents this meta entity.
76 protected uint m_metaLocalid;
77
78 #endregion Fields
79
80 #region Constructors
81
82 public MetaEntity()
83 {
84 }
85
86 /// <summary>
87 /// Makes a new meta entity by copying the given scene object group.
88 /// The physics boolean is just a stub right now.
89 /// </summary>
90 public MetaEntity(SceneObjectGroup orig, bool physics)
91 {
92 m_Entity = orig.Copy(orig.RootPart.OwnerID, orig.RootPart.GroupID, false);
93 Initialize(physics);
94 }
95
96 /// <summary>
97 /// Takes an XML description of a scene object group and converts it to a meta entity.
98 /// </summary>
99 public MetaEntity(string objectXML, Scene scene, bool physics)
100 {
101 m_Entity = new SceneObjectGroup(objectXML);
102 m_Entity.SetScene(scene);
103 Initialize(physics);
104 }
105
106 #endregion Constructors
107
108 #region Public Properties
109
110 public Dictionary<UUID, SceneObjectPart> Children
111 {
112 get { return m_Entity.Children; }
113 set { m_Entity.Children = value; }
114 }
115
116 public uint LocalId
117 {
118 get { return m_Entity.LocalId; }
119 set { m_Entity.LocalId = value; }
120 }
121
122 public SceneObjectGroup ObjectGroup
123 {
124 get { return m_Entity; }
125 }
126
127 public int PrimCount
128 {
129 get { return m_Entity.PrimCount; }
130 }
131
132 public SceneObjectPart RootPart
133 {
134 get { return m_Entity.RootPart; }
135 }
136
137 public Scene Scene
138 {
139 get { return m_Entity.Scene; }
140 }
141
142 public UUID UUID
143 {
144 get { return m_Entity.UUID; }
145 set { m_Entity.UUID = value; }
146 }
147
148 #endregion Public Properties
149
150 #region Protected Methods
151
152 // The metaentity objectgroup must have unique localids as well as unique uuids.
153 // localids are used by the client to refer to parts.
154 // uuids are sent to the client and back to the server to identify parts on the server side.
155 /// <summary>
156 /// Changes localids and uuids of m_Entity.
157 /// </summary>
158 protected void Initialize(bool physics)
159 {
160 //make new uuids
161 Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>();
162 foreach (SceneObjectPart part in m_Entity.Children.Values)
163 {
164 part.ResetIDs(part.LinkNum);
165 parts.Add(part.UUID, part);
166 }
167
168 //finalize
169 m_Entity.RootPart.PhysActor = null;
170 m_Entity.Children = parts;
171 }
172
173 #endregion Protected Methods
174
175 #region Public Methods
176
177 /// <summary>
178 /// Hides the metaentity from a single client.
179 /// </summary>
180 public virtual void Hide(IClientAPI client)
181 {
182 //This deletes the group without removing from any databases.
183 //This is important because we are not IN any database.
184 //m_Entity.FakeDeleteGroup();
185 foreach (SceneObjectPart part in m_Entity.Children.Values)
186 client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
187 }
188
189 /// <summary>
190 /// Sends a kill object message to all clients, effectively "hiding" the metaentity even though it's still on the server.
191 /// </summary>
192 public virtual void HideFromAll()
193 {
194 foreach (SceneObjectPart part in m_Entity.Children.Values)
195 m_Entity.Scene.ClientManager.ForEachClient(delegate(IClientAPI controller)
196 { controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); }
197 );
198 }
199
200 public void SendFullUpdate(IClientAPI client)
201 {
202 // Not sure what clientFlags should be but 0 seems to work
203 SendFullUpdate(client, 0);
204 }
205
206 public void SendFullUpdate(IClientAPI client, uint clientFlags)
207 {
208 m_Entity.SendFullUpdateToClient(client);
209 }
210
211 public void SendFullUpdateToAll()
212 {
213 m_Entity.Scene.ClientManager.ForEachClient(delegate(IClientAPI controller)
214 { m_Entity.SendFullUpdateToClient(controller); }
215 );
216 }
217
218 /// <summary>
219 /// Makes a single SceneObjectPart see through.
220 /// </summary>
221 /// <param name="part">
222 /// A <see cref="SceneObjectPart"/>
223 /// The part to make see through
224 /// </param>
225 /// <param name="transparencyAmount">
226 /// A <see cref="System.Single"/>
227 /// The degree of transparency to imbue the part with, 0f being solid and .95f being invisible.
228 /// </param>
229 public static void SetPartTransparency(SceneObjectPart part, float transparencyAmount)
230 {
231 Primitive.TextureEntry tex = null;
232 Color4 texcolor;
233 try
234 {
235 tex = part.Shape.Textures;
236 texcolor = new Color4();
237 }
238 catch(Exception)
239 {
240 //m_log.ErrorFormat("[Content Management]: Exception thrown while accessing textures of scene object: " + e);
241 return;
242 }
243
244 for (uint i = 0; i < tex.FaceTextures.Length; i++)
245 {
246 try {
247 if (tex.FaceTextures[i] != null)
248 {
249 texcolor = tex.FaceTextures[i].RGBA;
250 texcolor.A = transparencyAmount;
251 tex.FaceTextures[i].RGBA = texcolor;
252 }
253 }
254 catch (Exception)
255 {
256 //m_log.ErrorFormat("[Content Management]: Exception thrown while accessing different face textures of object: " + e);
257 continue;
258 }
259 }
260 try {
261 texcolor = tex.DefaultTexture.RGBA;
262 texcolor.A = transparencyAmount;
263 tex.DefaultTexture.RGBA = texcolor;
264 part.Shape.TextureEntry = tex.ToBytes();
265 }
266 catch (Exception)
267 {
268 //m_log.Info("[Content Management]: Exception thrown while accessing default face texture of object: " + e);
269 }
270 }
271
272 #endregion Public Methods
273 }
274}