/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/Bone.cs
ViewVC logotype

Diff of /trunk/gr2lib/core/coretypes/implementation/Bone.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/gr2lib/core/coretypes/implementation/Bone.cs	2010/07/29 07:47:50	197
+++ trunk/gr2lib/core/coretypes/implementation/Bone.cs	2010/07/29 08:12:27	198
@@ -16,6 +16,17 @@
     /// </summary>
     public class Bone : IBone
     {
+        #region default IComparable Support
+        /// <summary>
+        /// IComparable Support
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public int CompareTo(object obj)
+        {
+            return this.Index.CompareTo((obj as Bone).Index);
+        }
+        #endregion
         /// <summary>
         /// Gets the string representation of this instance
         /// </summary>
@@ -51,17 +62,17 @@
         {
             try
             {
-            if (pointer == IntPtr.Zero) return null;
-            native.Bone native = Helpers.ReadFromMemory<native.Bone>(pointer);
-            Bone managed = Bone.ReadFromNative(native);
-            managed.NativePointer = pointer;
-            return managed;
+                if (pointer == IntPtr.Zero) return null;
+                native.Bone native = Helpers.ReadFromMemory<native.Bone>(pointer);
+                Bone managed = Bone.ReadFromNative(native);
+                managed.NativePointer = pointer;
+                return managed;
             }
             catch (Exception ex)
             {
                 StackTrace st = new StackTrace(true);
 #if  ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
-                Granny2ExceptionWriter.WriteToConsole(ex,st);
+                Granny2ExceptionWriter.WriteToConsole(ex, st);
 #endif
                 return default(Bone);
             }
@@ -71,24 +82,30 @@
         {
             try
             {
-            Bone managed = new Bone();
-            managed.BoneName = string.IsNullOrEmpty(native.Name) ? "{null}" : native.Name;
-            managed.ParentIndex = native.ParentIndex;
-            managed.Transform = Transform.ReadFromNative(native.Transform);
-            //managed.InverseWorldTransformNode.Matrix = new Geom.Matrix44(native.InverseWorldTransform);
-            //managed.InverseWorldTransform = managed.Transform.Matrix;
-            managed.LodError = native.LodError;
-            managed.LightInfo = LightInfo.ReadFromMemory(native.LightInfo);
-            managed.CameraInfo = CameraInfo.ReadFromMemory(native.CameraInfo);
-            //managed.ExtendedData = native.ExtendedData;
+                Bone managed = new Bone();
+                managed.BoneName = string.IsNullOrEmpty(native.Name) ? "{null}" : native.Name;
+                managed.ParentIndex = native.ParentIndex;
+                managed.Transform = Transform.ReadFromNative(native.Transform);
+                //managed.InverseWorldTransformNode.Matrix = new Geom.Matrix44(native.InverseWorldTransform);
+                //managed.InverseWorldTransform = managed.Transform.Matrix;
+                managed.LodError = native.LodError;
+                managed.LightInfo = LightInfo.ReadFromMemory(native.LightInfo);
+                managed.CameraInfo = CameraInfo.ReadFromMemory(native.CameraInfo);
+                //managed.ExtendedData = native.ExtendedData;
+
+                // BOne property data
+                managed.BonePropertyData = new GrannyBonePropertyData();
+                managed.BonePropertyData.BoneColor = System.Drawing.Color.LimeGreen;
+                managed.BonePropertyData.BoneJointColor = System.Drawing.Color.White;
+
 
-            return managed;
+                return managed;
             }
             catch (Exception ex)
             {
                 StackTrace st = new StackTrace(true);
 #if  ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
-                Granny2ExceptionWriter.WriteToConsole(ex,st);
+                Granny2ExceptionWriter.WriteToConsole(ex, st);
 #endif
                 return default(Bone);
             }
@@ -146,10 +163,10 @@
 
 
 
-         private GrannyBonePropertyData _BonePropertyData;
-         /// <summary>
-         /// Extra Bone Property Data, Not Used by Granny2
-         /// </summary>
+        private GrannyBonePropertyData _BonePropertyData;
+        /// <summary>
+        /// Extra Bone Property Data, Not Used by Granny2
+        /// </summary>
         [RefreshPropertiesAttribute(RefreshProperties.All)]
         public GrannyBonePropertyData BonePropertyData { get { return _BonePropertyData; } set { _BonePropertyData = value; } }
         #endregion
@@ -173,7 +190,7 @@
         #region IResource Members
         private int _index;
         [RefreshPropertiesAttribute(RefreshProperties.All)]
-        internal int Index { get { return _index; } set { _index = value; } }
+        public int Index { get { return _index; } set { _index = value; } }
         #endregion
         #region IEmbeddedResource Members
         [RefreshPropertiesAttribute(RefreshProperties.All)]

 

  ViewVC Help
Powered by ViewVC 1.1.22