diff options
author | MW | 2007-03-31 15:54:16 +0000 |
---|---|---|
committer | MW | 2007-03-31 15:54:16 +0000 |
commit | af93263a3bf033188a18f0f49050393a612d2831 (patch) | |
tree | 74c0e035bd10d2dc5a0695038a7c329078c9c7d9 /OpenSim.Framework | |
parent | * fixed some Framework refs (diff) | |
download | opensim-SC-af93263a3bf033188a18f0f49050393a612d2831.zip opensim-SC-af93263a3bf033188a18f0f49050393a612d2831.tar.gz opensim-SC-af93263a3bf033188a18f0f49050393a612d2831.tar.bz2 opensim-SC-af93263a3bf033188a18f0f49050393a612d2831.tar.xz |
Can now Rez and DeRez objects (take to and from inventory).
Very much a work in progress and likely to be a number of bugs.
Diffstat (limited to 'OpenSim.Framework')
-rw-r--r-- | OpenSim.Framework/AgentInventory.cs | 21 | ||||
-rw-r--r-- | OpenSim.Framework/PrimData.cs | 121 |
2 files changed, 141 insertions, 1 deletions
diff --git a/OpenSim.Framework/AgentInventory.cs b/OpenSim.Framework/AgentInventory.cs index f1f5847..5c57020 100644 --- a/OpenSim.Framework/AgentInventory.cs +++ b/OpenSim.Framework/AgentInventory.cs | |||
@@ -157,6 +157,27 @@ namespace OpenSim.Framework.Inventory | |||
157 | return (null); | 157 | return (null); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | |||
161 | public bool DeleteFromInventory(LLUUID itemID) | ||
162 | { | ||
163 | bool res = false; | ||
164 | if (this.InventoryItems.ContainsKey(itemID)) | ||
165 | { | ||
166 | InventoryItem item = this.InventoryItems[itemID]; | ||
167 | this.InventoryItems.Remove(itemID); | ||
168 | foreach (InventoryFolder fold in InventoryFolders.Values) | ||
169 | { | ||
170 | if (fold.Items.Contains(item)) | ||
171 | { | ||
172 | fold.Items.Remove(item); | ||
173 | break; | ||
174 | } | ||
175 | } | ||
176 | res = true; | ||
177 | |||
178 | } | ||
179 | return res; | ||
180 | } | ||
160 | } | 181 | } |
161 | 182 | ||
162 | public class InventoryFolder | 183 | public class InventoryFolder |
diff --git a/OpenSim.Framework/PrimData.cs b/OpenSim.Framework/PrimData.cs index 175a014..ce53c28 100644 --- a/OpenSim.Framework/PrimData.cs +++ b/OpenSim.Framework/PrimData.cs | |||
@@ -7,6 +7,8 @@ namespace OpenSim.Framework.Assets | |||
7 | { | 7 | { |
8 | public class PrimData | 8 | public class PrimData |
9 | { | 9 | { |
10 | private const uint FULL_MASK_PERMISSIONS = 2147483647; | ||
11 | |||
10 | public LLUUID OwnerID; | 12 | public LLUUID OwnerID; |
11 | public byte PCode; | 13 | public byte PCode; |
12 | public byte PathBegin; | 14 | public byte PathBegin; |
@@ -30,10 +32,18 @@ namespace OpenSim.Framework.Assets | |||
30 | public sbyte PathTwist; | 32 | public sbyte PathTwist; |
31 | public sbyte PathTwistBegin; | 33 | public sbyte PathTwistBegin; |
32 | public byte[] Texture; | 34 | public byte[] Texture; |
35 | |||
36 | |||
37 | public Int32 CreationDate; | ||
38 | public uint OwnerMask = FULL_MASK_PERMISSIONS; | ||
39 | public uint NextOwnerMask = FULL_MASK_PERMISSIONS; | ||
40 | public uint GroupMask = FULL_MASK_PERMISSIONS; | ||
41 | public uint EveryoneMask = FULL_MASK_PERMISSIONS; | ||
42 | public uint BaseMask = FULL_MASK_PERMISSIONS; | ||
33 | 43 | ||
34 | //following only used during prim storage | 44 | //following only used during prim storage |
35 | public LLVector3 Position; | 45 | public LLVector3 Position; |
36 | public LLQuaternion Rotation; | 46 | public LLQuaternion Rotation = new LLQuaternion(0,1,0,0); |
37 | public uint LocalID; | 47 | public uint LocalID; |
38 | public LLUUID FullID; | 48 | public LLUUID FullID; |
39 | 49 | ||
@@ -41,5 +51,114 @@ namespace OpenSim.Framework.Assets | |||
41 | { | 51 | { |
42 | 52 | ||
43 | } | 53 | } |
54 | |||
55 | public PrimData(byte[] data) | ||
56 | { | ||
57 | int i =0; | ||
58 | |||
59 | this.OwnerID = new LLUUID(data, i); i += 16; | ||
60 | this.PCode = data[i++]; | ||
61 | this.PathBegin = data[i++]; | ||
62 | this.PathEnd = data[i++]; | ||
63 | this.PathScaleX = data[i++]; | ||
64 | this.PathScaleY = data[i++]; | ||
65 | this.PathShearX = data[i++]; | ||
66 | this.PathShearY = data[i++]; | ||
67 | this.PathSkew = (sbyte)data[i++]; | ||
68 | this.ProfileBegin = data[i++]; | ||
69 | this.ProfileEnd = data[i++]; | ||
70 | this.Scale = new LLVector3(data, i); i += 12; | ||
71 | this.PathCurve = data[i++]; | ||
72 | this.ProfileCurve = data[i++]; | ||
73 | this.ParentID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
74 | this.ProfileHollow = data[i++]; | ||
75 | this.PathRadiusOffset = (sbyte)data[i++]; | ||
76 | this.PathRevolutions = data[i++]; | ||
77 | this.PathTaperX = (sbyte)data[i++]; | ||
78 | this.PathTaperY =(sbyte) data[i++]; | ||
79 | this.PathTwist = (sbyte) data[i++]; | ||
80 | this.PathTwistBegin = (sbyte) data[i++]; | ||
81 | ushort length = (ushort)(data[i++] + (data[i++] << 8)); | ||
82 | this.Texture = new byte[length]; | ||
83 | Array.Copy(data, i, Texture, 0, length); i += length; | ||
84 | this.CreationDate = (Int32)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
85 | this.OwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
86 | this.NextOwnerMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
87 | this.GroupMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
88 | this.EveryoneMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
89 | this.BaseMask = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
90 | this.Position = new LLVector3(data, i); i += 12; | ||
91 | this.Rotation = new LLQuaternion(data,i, true); i += 12; | ||
92 | this.LocalID = (uint)(data[i++] + (data[i++] << 8) + (data[i++] << 16) + (data[i++] << 24)); | ||
93 | this.FullID = new LLUUID(data, i); i += 16; | ||
94 | |||
95 | } | ||
96 | |||
97 | public byte[] ToBytes() | ||
98 | { | ||
99 | int i = 0; | ||
100 | byte[] bytes = new byte[121 + Texture.Length]; | ||
101 | Array.Copy(OwnerID.GetBytes(), 0, bytes, i, 16); i += 16; | ||
102 | bytes[i++] = this.PCode; | ||
103 | bytes[i++] = this.PathBegin; | ||
104 | bytes[i++] = this.PathEnd; | ||
105 | bytes[i++] = this.PathScaleX; | ||
106 | bytes[i++] = this.PathScaleY; | ||
107 | bytes[i++] = this.PathShearX; | ||
108 | bytes[i++] = this.PathShearY; | ||
109 | bytes[i++] = (byte)this.PathSkew; | ||
110 | bytes[i++] = this.ProfileBegin; | ||
111 | bytes[i++] = this.ProfileEnd; | ||
112 | Array.Copy(Scale.GetBytes(), 0, bytes, i, 12); i += 12; | ||
113 | bytes[i++] = this.PathCurve; | ||
114 | bytes[i++] = this.ProfileCurve; | ||
115 | bytes[i++] = (byte)(ParentID % 256); | ||
116 | bytes[i++] = (byte)((ParentID >> 8) % 256); | ||
117 | bytes[i++] = (byte)((ParentID >> 16) % 256); | ||
118 | bytes[i++] = (byte)((ParentID >> 24) % 256); | ||
119 | bytes[i++] = this.ProfileHollow; | ||
120 | bytes[i++] = ((byte)this.PathRadiusOffset); | ||
121 | bytes[i++] = this.PathRevolutions; | ||
122 | bytes[i++] = ((byte) this.PathTaperX); | ||
123 | bytes[i++] = ((byte) this.PathTaperY); | ||
124 | bytes[i++] = ((byte) this.PathTwist); | ||
125 | bytes[i++] = ((byte) this.PathTwistBegin); | ||
126 | bytes[i++] = (byte)(Texture.Length % 256); | ||
127 | bytes[i++] = (byte)((Texture.Length >> 8) % 256); | ||
128 | Array.Copy(Texture, 0, bytes, i, Texture.Length); i += Texture.Length; | ||
129 | bytes[i++] = (byte)(this.CreationDate % 256); | ||
130 | bytes[i++] = (byte)((this.CreationDate >> 8) % 256); | ||
131 | bytes[i++] = (byte)((this.CreationDate >> 16) % 256); | ||
132 | bytes[i++] = (byte)((this.CreationDate >> 24) % 256); | ||
133 | bytes[i++] = (byte)(this.OwnerMask % 256); | ||
134 | bytes[i++] = (byte)((this.OwnerMask >> 8) % 256); | ||
135 | bytes[i++] = (byte)((this.OwnerMask >> 16) % 256); | ||
136 | bytes[i++] = (byte)((this.OwnerMask >> 24) % 256); | ||
137 | bytes[i++] = (byte)(this.NextOwnerMask % 256); | ||
138 | bytes[i++] = (byte)((this.NextOwnerMask >> 8) % 256); | ||
139 | bytes[i++] = (byte)((this.NextOwnerMask >> 16) % 256); | ||
140 | bytes[i++] = (byte)((this.NextOwnerMask >> 24) % 256); | ||
141 | bytes[i++] = (byte)(this.GroupMask % 256); | ||
142 | bytes[i++] = (byte)((this.GroupMask >> 8) % 256); | ||
143 | bytes[i++] = (byte)((this.GroupMask >> 16) % 256); | ||
144 | bytes[i++] = (byte)((this.GroupMask >> 24) % 256); | ||
145 | bytes[i++] = (byte)(this.EveryoneMask % 256); | ||
146 | bytes[i++] = (byte)((this.EveryoneMask >> 8) % 256); | ||
147 | bytes[i++] = (byte)((this.EveryoneMask >> 16) % 256); | ||
148 | bytes[i++] = (byte)((this.EveryoneMask >> 24) % 256); | ||
149 | bytes[i++] = (byte)(this.BaseMask % 256); | ||
150 | bytes[i++] = (byte)((this.BaseMask >> 8) % 256); | ||
151 | bytes[i++] = (byte)((this.BaseMask >> 16) % 256); | ||
152 | bytes[i++] = (byte)((this.BaseMask >> 24) % 256); | ||
153 | Array.Copy(this.Position.GetBytes(), 0, bytes, i, 12); i += 12; | ||
154 | Array.Copy(this.Rotation.GetBytes(), 0, bytes, i, 12); i += 12; | ||
155 | bytes[i++] = (byte)(this.LocalID % 256); | ||
156 | bytes[i++] = (byte)((this.LocalID >> 8) % 256); | ||
157 | bytes[i++] = (byte)((this.LocalID >> 16) % 256); | ||
158 | bytes[i++] = (byte)((this.LocalID >> 24) % 256); | ||
159 | Array.Copy(FullID.GetBytes(), 0, bytes, i, 16); i += 16; | ||
160 | |||
161 | return bytes; | ||
162 | } | ||
44 | } | 163 | } |
45 | } | 164 | } |