OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Animation.cs
Go to the documentation of this file.
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 OpenSimulator 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 using System;
29 using OpenMetaverse;
30 using OpenMetaverse.StructuredData;
31 
32 namespace OpenSim.Framework
33 {
37  [Serializable]
38  public class Animation
39  {
40  private UUID animID;
41 
45  public UUID AnimID
46  {
47  get { return animID; }
48  set { animID = value; }
49  }
50 
51  private int sequenceNum;
52  public int SequenceNum
53  {
54  get { return sequenceNum; }
55  set { sequenceNum = value; }
56  }
57 
58  private UUID objectID;
59 
63  public UUID ObjectID
64  {
65  get { return objectID; }
66  set { objectID = value; }
67  }
68 
69  public Animation()
70  {
71  }
72 
79  public Animation(UUID animID, int sequenceNum, UUID objectID)
80  {
81  this.animID = animID;
82  this.sequenceNum = sequenceNum;
83  this.objectID = objectID;
84  }
85 
90  public Animation(OSDMap args)
91  {
92  UnpackUpdateMessage(args);
93  }
94 
95 
101  {
102  OSDMap anim = new OSDMap();
103  anim["animation"] = OSD.FromUUID(animID);
104  anim["object_id"] = OSD.FromUUID(objectID);
105  anim["seq_num"] = OSD.FromInteger(sequenceNum);
106  return anim;
107  }
108 
113  public void UnpackUpdateMessage(OSDMap args)
114  {
115  if (args["animation"] != null)
116  animID = args["animation"].AsUUID();
117  if (args["object_id"] != null)
118  objectID = args["object_id"].AsUUID();
119  if (args["seq_num"] != null)
120  sequenceNum = args["seq_num"].AsInteger();
121  }
122 
123  public override bool Equals(object obj)
124  {
125  Animation other = obj as Animation;
126  if (other != null)
127  {
128  return (other.AnimID.Equals(this.AnimID)
129  && other.SequenceNum == this.SequenceNum
130  && other.ObjectID.Equals(this.ObjectID) );
131  }
132  return base.Equals(obj);
133  }
134 
135  public override int GetHashCode()
136  {
137  return base.GetHashCode();
138  }
139 
140  public override string ToString()
141  {
142  return "AnimID=" + AnimID.ToString()
143  + "/seq=" + SequenceNum.ToString()
144  + "/objID=" + ObjectID.ToString();
145  }
146 
147  }
148 }
Information about an Animation
Definition: Animation.cs:38
OpenMetaverse.StructuredData.OSDMap OSDMap
UUID AnimID
ID of Animation
Definition: Animation.cs:46
void UnpackUpdateMessage(OSDMap args)
Fill object with data from OSDMap
Definition: Animation.cs:113
override bool Equals(object obj)
Definition: Animation.cs:123
Animation(UUID animID, int sequenceNum, UUID objectID)
Creates an Animation based on the data
Definition: Animation.cs:79
OpenSim.Framework.Animation Animation
override string ToString()
Definition: Animation.cs:140
OSDMap PackUpdateMessage()
Pack this object up as an OSDMap for transferring via LLSD XML or LLSD json
Definition: Animation.cs:100
Animation(OSDMap args)
Animation from OSDMap from LLSD XML or LLSD json
Definition: Animation.cs:90
override int GetHashCode()
Definition: Animation.cs:135