aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-17 16:25:52 +0000
committerJustin Clark-Casey (justincc)2009-11-17 16:25:52 +0000
commitda255be05a451ba9a48efd6f167849228a54273b (patch)
tree51ac540e825d14dffc8426313c21304f0e9bd163 /OpenSim/Region/Framework
parentminor: remove mono compiler warning due to unreachable code in GroupsModule (diff)
downloadopensim-SC_OLD-da255be05a451ba9a48efd6f167849228a54273b.zip
opensim-SC_OLD-da255be05a451ba9a48efd6f167849228a54273b.tar.gz
opensim-SC_OLD-da255be05a451ba9a48efd6f167849228a54273b.tar.bz2
opensim-SC_OLD-da255be05a451ba9a48efd6f167849228a54273b.tar.xz
refactor: move AvatarAnimations, BinBVHAnimation
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs (renamed from OpenSim/Region/Framework/Scenes/AvatarAnimations.cs)2
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs (renamed from OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs)2
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs59
4 files changed, 62 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
index 72d599a..659c3a5 100644
--- a/OpenSim/Region/Framework/Scenes/AvatarAnimations.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs
@@ -29,7 +29,7 @@ using System.Collections.Generic;
29using System.Xml; 29using System.Xml;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Framework.Scenes 32namespace OpenSim.Region.Framework.Scenes.Animation
33{ 33{
34 public class AvatarAnimations 34 public class AvatarAnimations
35 { 35 {
diff --git a/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs
index 5f2eb0d..3afc87f 100644
--- a/OpenSim/Region/Framework/Scenes/BinBVHAnimation.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/BinBVHAnimation.cs
@@ -29,7 +29,7 @@ using System;
29using System.IO; 29using System.IO;
30using OpenMetaverse; 30using OpenMetaverse;
31 31
32namespace OpenSim.Region.Framework.Scenes 32namespace OpenSim.Region.Framework.Scenes.Animation
33{ 33{
34 /// <summary> 34 /// <summary>
35 /// Written to decode and encode a binary animation asset. 35 /// Written to decode and encode a binary animation asset.
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index d22e24a..cbe4118 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
@@ -331,6 +332,65 @@ namespace OpenSim.Region.Framework.Scenes.Animation
331 UUID[] objectIDs; 332 UUID[] objectIDs;
332 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); 333 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
333 return animIDs; 334 return animIDs;
335 }
336
337 public BinBVHAnimation GenerateRandomAnimation()
338 {
339 int rnditerations = 3;
340 BinBVHAnimation anim = new BinBVHAnimation();
341 List<string> parts = new List<string>();
342 parts.Add("mPelvis");parts.Add("mHead");parts.Add("mTorso");
343 parts.Add("mHipLeft");parts.Add("mHipRight");parts.Add("mHipLeft");parts.Add("mKneeLeft");
344 parts.Add("mKneeRight");parts.Add("mCollarLeft");parts.Add("mCollarRight");parts.Add("mNeck");
345 parts.Add("mElbowLeft");parts.Add("mElbowRight");parts.Add("mWristLeft");parts.Add("mWristRight");
346 parts.Add("mShoulderLeft");parts.Add("mShoulderRight");parts.Add("mAnkleLeft");parts.Add("mAnkleRight");
347 parts.Add("mEyeRight");parts.Add("mChest");parts.Add("mToeLeft");parts.Add("mToeRight");
348 parts.Add("mFootLeft");parts.Add("mFootRight");parts.Add("mEyeLeft");
349 anim.HandPose = 1;
350 anim.InPoint = 0;
351 anim.OutPoint = (rnditerations * .10f);
352 anim.Priority = 7;
353 anim.Loop = false;
354 anim.Length = (rnditerations * .10f);
355 anim.ExpressionName = "afraid";
356 anim.EaseInTime = 0;
357 anim.EaseOutTime = 0;
358
359 string[] strjoints = parts.ToArray();
360 anim.Joints = new binBVHJoint[strjoints.Length];
361 for (int j = 0; j < strjoints.Length; j++)
362 {
363 anim.Joints[j] = new binBVHJoint();
364 anim.Joints[j].Name = strjoints[j];
365 anim.Joints[j].Priority = 7;
366 anim.Joints[j].positionkeys = new binBVHJointKey[rnditerations];
367 anim.Joints[j].rotationkeys = new binBVHJointKey[rnditerations];
368 Random rnd = new Random();
369 for (int i = 0; i < rnditerations; i++)
370 {
371 anim.Joints[j].rotationkeys[i] = new binBVHJointKey();
372 anim.Joints[j].rotationkeys[i].time = (i*.10f);
373 anim.Joints[j].rotationkeys[i].key_element.X = ((float) rnd.NextDouble()*2 - 1);
374 anim.Joints[j].rotationkeys[i].key_element.Y = ((float) rnd.NextDouble()*2 - 1);
375 anim.Joints[j].rotationkeys[i].key_element.Z = ((float) rnd.NextDouble()*2 - 1);
376 anim.Joints[j].positionkeys[i] = new binBVHJointKey();
377 anim.Joints[j].positionkeys[i].time = (i*.10f);
378 anim.Joints[j].positionkeys[i].key_element.X = 0;
379 anim.Joints[j].positionkeys[i].key_element.Y = 0;
380 anim.Joints[j].positionkeys[i].key_element.Z = 0;
381 }
382 }
383
384 AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation);
385 Animasset.Data = anim.ToBytes();
386 Animasset.Temporary = true;
387 Animasset.Local = true;
388 Animasset.Description = "dance";
389 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);
390
391 m_scenePresence.Scene.AssetService.Store(Animasset);
392 AddAnimation(Animasset.FullID, m_scenePresence.UUID);
393 return anim;
334 } 394 }
335 395
336 /// <summary> 396 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 33c1932..1917ec4 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1871,65 +1871,6 @@ namespace OpenSim.Region.Framework.Scenes
1871 PhysicsActor.SetAlwaysRun = pSetAlwaysRun; 1871 PhysicsActor.SetAlwaysRun = pSetAlwaysRun;
1872 } 1872 }
1873 } 1873 }
1874
1875 public BinBVHAnimation GenerateRandomAnimation()
1876 {
1877 int rnditerations = 3;
1878 BinBVHAnimation anim = new BinBVHAnimation();
1879 List<string> parts = new List<string>();
1880 parts.Add("mPelvis");parts.Add("mHead");parts.Add("mTorso");
1881 parts.Add("mHipLeft");parts.Add("mHipRight");parts.Add("mHipLeft");parts.Add("mKneeLeft");
1882 parts.Add("mKneeRight");parts.Add("mCollarLeft");parts.Add("mCollarRight");parts.Add("mNeck");
1883 parts.Add("mElbowLeft");parts.Add("mElbowRight");parts.Add("mWristLeft");parts.Add("mWristRight");
1884 parts.Add("mShoulderLeft");parts.Add("mShoulderRight");parts.Add("mAnkleLeft");parts.Add("mAnkleRight");
1885 parts.Add("mEyeRight");parts.Add("mChest");parts.Add("mToeLeft");parts.Add("mToeRight");
1886 parts.Add("mFootLeft");parts.Add("mFootRight");parts.Add("mEyeLeft");
1887 anim.HandPose = 1;
1888 anim.InPoint = 0;
1889 anim.OutPoint = (rnditerations * .10f);
1890 anim.Priority = 7;
1891 anim.Loop = false;
1892 anim.Length = (rnditerations * .10f);
1893 anim.ExpressionName = "afraid";
1894 anim.EaseInTime = 0;
1895 anim.EaseOutTime = 0;
1896
1897 string[] strjoints = parts.ToArray();
1898 anim.Joints = new binBVHJoint[strjoints.Length];
1899 for (int j = 0; j < strjoints.Length; j++)
1900 {
1901 anim.Joints[j] = new binBVHJoint();
1902 anim.Joints[j].Name = strjoints[j];
1903 anim.Joints[j].Priority = 7;
1904 anim.Joints[j].positionkeys = new binBVHJointKey[rnditerations];
1905 anim.Joints[j].rotationkeys = new binBVHJointKey[rnditerations];
1906 Random rnd = new Random();
1907 for (int i = 0; i < rnditerations; i++)
1908 {
1909 anim.Joints[j].rotationkeys[i] = new binBVHJointKey();
1910 anim.Joints[j].rotationkeys[i].time = (i*.10f);
1911 anim.Joints[j].rotationkeys[i].key_element.X = ((float) rnd.NextDouble()*2 - 1);
1912 anim.Joints[j].rotationkeys[i].key_element.Y = ((float) rnd.NextDouble()*2 - 1);
1913 anim.Joints[j].rotationkeys[i].key_element.Z = ((float) rnd.NextDouble()*2 - 1);
1914 anim.Joints[j].positionkeys[i] = new binBVHJointKey();
1915 anim.Joints[j].positionkeys[i].time = (i*.10f);
1916 anim.Joints[j].positionkeys[i].key_element.X = 0;
1917 anim.Joints[j].positionkeys[i].key_element.Y = 0;
1918 anim.Joints[j].positionkeys[i].key_element.Z = 0;
1919 }
1920 }
1921
1922 AssetBase Animasset = new AssetBase(UUID.Random(), "Random Animation", (sbyte)AssetType.Animation);
1923 Animasset.Data = anim.ToBytes();
1924 Animasset.Temporary = true;
1925 Animasset.Local = true;
1926 Animasset.Description = "dance";
1927 //BinBVHAnimation bbvhanim = new BinBVHAnimation(Animasset.Data);
1928
1929 m_scene.AssetService.Store(Animasset);
1930 Animator.AddAnimation(Animasset.FullID, UUID);
1931 return anim;
1932 }
1933 1874
1934 public void HandleStartAnim(IClientAPI remoteClient, UUID animID) 1875 public void HandleStartAnim(IClientAPI remoteClient, UUID animID)
1935 { 1876 {