diff options
author | UbitUmarov | 2012-08-30 00:15:46 +0100 |
---|---|---|
committer | UbitUmarov | 2012-08-30 00:15:46 +0100 |
commit | c821153a4fcc0a0d806d2c9be63cf48494e4dd06 (patch) | |
tree | 5ec352041b9388f46fc621ba16661b3581bd7cd1 /OpenSim/Region/Framework | |
parent | A few more changes to keyframes (diff) | |
download | opensim-SC-c821153a4fcc0a0d806d2c9be63cf48494e4dd06.zip opensim-SC-c821153a4fcc0a0d806d2c9be63cf48494e4dd06.tar.gz opensim-SC-c821153a4fcc0a0d806d2c9be63cf48494e4dd06.tar.bz2 opensim-SC-c821153a4fcc0a0d806d2c9be63cf48494e4dd06.tar.xz |
[possible still bad] make use of keyframemotion.copy on sop.copy, replacing
fromdata(seralize). for now its called with null group since sop.copy()
hasn't usable new group information, so for copied keyframes be fully operational UpdateSceneObject(newgroup) needs to be called on them.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 |
3 files changed, 38 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index 42e3860..e4e6f2c 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs | |||
@@ -112,20 +112,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
112 | public bool Selected | 112 | public bool Selected |
113 | { | 113 | { |
114 | set | 114 | set |
115 | { | 115 | { |
116 | if (!value) | 116 | if (m_group != null) |
117 | { | ||
118 | // Once we're let go, recompute positions | ||
119 | if (m_selected) | ||
120 | UpdateSceneObject(m_group); | ||
121 | } | ||
122 | else | ||
123 | { | 117 | { |
124 | // Save selection position in case we get moved | 118 | if (!value) |
125 | if (!m_selected) | ||
126 | { | 119 | { |
127 | StopTimer(); | 120 | // Once we're let go, recompute positions |
128 | m_serializedPosition = m_group.AbsolutePosition; | 121 | if (m_selected) |
122 | UpdateSceneObject(m_group); | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | // Save selection position in case we get moved | ||
127 | if (!m_selected) | ||
128 | { | ||
129 | StopTimer(); | ||
130 | m_serializedPosition = m_group.AbsolutePosition; | ||
131 | } | ||
129 | } | 132 | } |
130 | } | 133 | } |
131 | m_isCrossing = false; | 134 | m_isCrossing = false; |
@@ -199,6 +202,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
199 | m_waitingCrossing = false; | 202 | m_waitingCrossing = false; |
200 | StopTimer(); | 203 | StopTimer(); |
201 | 204 | ||
205 | if (grp == null) | ||
206 | return; | ||
207 | |||
202 | m_group = grp; | 208 | m_group = grp; |
203 | Vector3 grppos = grp.AbsolutePosition; | 209 | Vector3 grppos = grp.AbsolutePosition; |
204 | Vector3 offset = grppos - m_serializedPosition; | 210 | Vector3 offset = grppos - m_serializedPosition; |
@@ -228,14 +234,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
228 | m_mode = mode; | 234 | m_mode = mode; |
229 | m_data = data; | 235 | m_data = data; |
230 | 236 | ||
231 | m_onTimerLock = new object(); | ||
232 | |||
233 | m_group = grp; | 237 | m_group = grp; |
234 | if (grp != null) | 238 | if (grp != null) |
235 | { | 239 | { |
236 | m_basePosition = grp.AbsolutePosition; | 240 | m_basePosition = grp.AbsolutePosition; |
237 | m_baseRotation = grp.GroupRotation; | 241 | m_baseRotation = grp.GroupRotation; |
238 | } | 242 | } |
243 | |||
244 | m_onTimerLock = new object(); | ||
245 | m_timerStopped = true; | ||
246 | m_inOnTimer = false; | ||
239 | m_isCrossing = false; | 247 | m_isCrossing = false; |
240 | m_waitingCrossing = false; | 248 | m_waitingCrossing = false; |
241 | } | 249 | } |
@@ -249,18 +257,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
249 | { | 257 | { |
250 | StopTimer(); | 258 | StopTimer(); |
251 | 259 | ||
252 | KeyframeMotion newmotion = new KeyframeMotion(newgrp, m_mode, m_data); | 260 | KeyframeMotion newmotion = new KeyframeMotion(null, m_mode, m_data); |
253 | 261 | ||
254 | if (newgrp != null && newgrp.IsSelected) | 262 | newmotion.m_group = newgrp; |
255 | newmotion.m_selected = true; | ||
256 | 263 | ||
257 | if (m_keyframes != null) | 264 | if (m_keyframes != null) |
265 | { | ||
266 | newmotion.m_keyframes = new Keyframe[m_keyframes.Length]; | ||
258 | m_keyframes.CopyTo(newmotion.m_keyframes, 0); | 267 | m_keyframes.CopyTo(newmotion.m_keyframes, 0); |
268 | } | ||
259 | 269 | ||
260 | newmotion.m_frames = new List<Keyframe>(m_frames); | 270 | newmotion.m_frames = new List<Keyframe>(m_frames); |
271 | |||
272 | newmotion.m_basePosition = m_basePosition; | ||
273 | newmotion.m_baseRotation = m_baseRotation; | ||
274 | |||
261 | newmotion.m_currentFrame = m_currentFrame; | 275 | newmotion.m_currentFrame = m_currentFrame; |
262 | 276 | ||
263 | newmotion.m_nextPosition = m_nextPosition; | ||
264 | if (m_selected) | 277 | if (m_selected) |
265 | newmotion.m_serializedPosition = m_serializedPosition; | 278 | newmotion.m_serializedPosition = m_serializedPosition; |
266 | else | 279 | else |
@@ -272,12 +285,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
272 | } | 285 | } |
273 | 286 | ||
274 | newmotion.m_iterations = m_iterations; | 287 | newmotion.m_iterations = m_iterations; |
275 | 288 | newmotion.m_running = m_running; | |
276 | newmotion.m_onTimerLock = new object(); | ||
277 | newmotion.m_timerStopped = false; | ||
278 | newmotion.m_inOnTimer = false; | ||
279 | newmotion.m_isCrossing = false; | ||
280 | newmotion.m_waitingCrossing = false; | ||
281 | 289 | ||
282 | if (m_running && !m_waitingCrossing) | 290 | if (m_running && !m_waitingCrossing) |
283 | StartTimer(); | 291 | StartTimer(); |
@@ -299,7 +307,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
299 | { | 307 | { |
300 | m_isCrossing = false; | 308 | m_isCrossing = false; |
301 | m_waitingCrossing = false; | 309 | m_waitingCrossing = false; |
302 | if (m_keyframes.Length > 0) | 310 | if (m_keyframes != null && m_group != null && m_keyframes.Length > 0) |
303 | { | 311 | { |
304 | if (m_timer == null) | 312 | if (m_timer == null) |
305 | { | 313 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 834d27b..fe34ad4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2062,6 +2062,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2062 | HasGroupChangedDueToDelink = false; | 2062 | HasGroupChangedDueToDelink = false; |
2063 | 2063 | ||
2064 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); | 2064 | m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); |
2065 | /* | ||
2065 | backup_group.ForEachPart(delegate(SceneObjectPart part) | 2066 | backup_group.ForEachPart(delegate(SceneObjectPart part) |
2066 | { | 2067 | { |
2067 | if (part.KeyframeMotion != null) | 2068 | if (part.KeyframeMotion != null) |
@@ -2070,7 +2071,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2070 | // part.KeyframeMotion.UpdateSceneObject(this); | 2071 | // part.KeyframeMotion.UpdateSceneObject(this); |
2071 | } | 2072 | } |
2072 | }); | 2073 | }); |
2073 | 2074 | */ | |
2074 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); | 2075 | datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); |
2075 | 2076 | ||
2076 | backup_group.ForEachPart(delegate(SceneObjectPart part) | 2077 | backup_group.ForEachPart(delegate(SceneObjectPart part) |
@@ -4415,15 +4416,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4415 | public virtual ISceneObject CloneForNewScene() | 4416 | public virtual ISceneObject CloneForNewScene() |
4416 | { | 4417 | { |
4417 | SceneObjectGroup sog = Copy(false); | 4418 | SceneObjectGroup sog = Copy(false); |
4418 | sog.ForEachPart(delegate(SceneObjectPart part) | ||
4419 | { | ||
4420 | if (part.KeyframeMotion != null) | ||
4421 | { | ||
4422 | part.KeyframeMotion = KeyframeMotion.FromData(sog, part.KeyframeMotion.Serialize()); | ||
4423 | // this is called later | ||
4424 | // part.KeyframeMotion.UpdateSceneObject(this); | ||
4425 | } | ||
4426 | }); | ||
4427 | sog.IsDeleted = false; | 4419 | sog.IsDeleted = false; |
4428 | return sog; | 4420 | return sog; |
4429 | } | 4421 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bf5fc99..4788a24 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2110,6 +2110,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2110 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); | 2110 | Array.Copy(Shape.ExtraParams, extraP, extraP.Length); |
2111 | dupe.Shape.ExtraParams = extraP; | 2111 | dupe.Shape.ExtraParams = extraP; |
2112 | 2112 | ||
2113 | if (KeyframeMotion != null) | ||
2114 | dupe.KeyframeMotion = KeyframeMotion.Copy(null); | ||
2115 | |||
2113 | if (userExposed) | 2116 | if (userExposed) |
2114 | { | 2117 | { |
2115 | if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) | 2118 | if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero) |