BearishSun 10 lat temu
rodzic
commit
eea035e168

+ 5 - 5
BansheeEditor/Include/BsHandleDrawManager.h

@@ -88,7 +88,7 @@ namespace BansheeEngine
 		void drawLine(const Vector3& start, const Vector3& end, float size = 1.0f);
 
 		/**
-		 * @brief	Draws a single-sided solid disc.
+		 * @brief	Draws a double-sided solid disc.
 		 *
 		 * @param	position	Center of the disc.
 		 * @param	normal		Orientation of the disc, pointing in the direction the disc is visible in.
@@ -98,7 +98,7 @@ namespace BansheeEngine
 		void drawDisc(const Vector3& position, const Vector3& normal, float radius, float size = 1.0f);
 
 		/**
-		 * @brief	Draws a single-sided wireframe disc.
+		 * @brief	Draws a wireframe disc.
 		 *
 		 * @param	position	Center of the disc.
 		 * @param	normal		Orientation of the disc, pointing in the direction the disc is visible in.
@@ -108,7 +108,7 @@ namespace BansheeEngine
 		void drawWireDisc(const Vector3& position, const Vector3& normal, float radius, float size = 1.0f);
 
 		/**
-		 * @brief	Draws a single-sided solid arc.
+		 * @brief	Draws a double-sided solid arc.
 		 *
 		 * @param	position	Center of the arc.
 		 * @param	normal		Orientation of the arc, pointing in the direction the arc is visible in.
@@ -120,7 +120,7 @@ namespace BansheeEngine
 		void drawArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f);
 
 		/**
-		 * @brief	Draws a single-sided wireframe arc.
+		 * @brief	Draws a wireframe arc.
 		 *
 		 * @param	position	Center of the arc.
 		 * @param	normal		Orientation of the arc, pointing in the direction the arc is visible in.
@@ -132,7 +132,7 @@ namespace BansheeEngine
 		void drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f);
 
 		/**
-		 * @brief	Draws a single-sided solid rectangle.
+		 * @brief	Draws a double-sided solid rectangle.
 		 *
 		 * @param	area		Position and size of the rectangle.
 		 * @param	size		Uniform scale of the object.

+ 0 - 1
BansheeEditor/Include/BsHandleSlider.h

@@ -87,7 +87,6 @@ namespace BansheeEngine
 		 */
 		void setScale(const Vector3& scale);
 
-
 		/**
 		 * @brief	Gets the world position of the slider.
 		 */

+ 2 - 4
BansheeEditor/Include/BsHandleSliderDisc.h

@@ -39,10 +39,8 @@ namespace BansheeEngine
 		 * @brief	Enables or disables a cut-off plane that can allow the disc to be intersected
 		 *			with only in an 180 degree arc.
 		 *
-		 * @param	angle	Angle at which to start the cut-off. (i.e. the plane will contain points
-		 *					on the disc at angle and (angle + pi) and anything between those two angles
-		 *					wont be interactable.
-		 *					
+		 * @param	angle	Angle at which to start the cut-off. Points on the dist at the specified angle and the next
+		 *					180 degrees won't be interactable.	
 		 */
 		void setCutoffPlane(Degree angle, bool enabled);
 

+ 2 - 2
BansheeEditor/Include/BsHandleSliderLine.h

@@ -10,8 +10,8 @@ namespace BansheeEngine
 	/**
 	 * @brief	Handle slider that returns a delta value as you drag the pointer
 	 *			along a line. For intersection purposes the line is internally 
-	 *			by a capsule and a sphere at its cap (assuming we'll use this for
-	 *			arrow-like handles).
+	 *			by a capsule and a sphere at its cap (assuming this will be used 
+	 *			for arrow-like handles).
 	 */
 	class BS_ED_EXPORT HandleSliderLine : public HandleSlider
 	{

+ 2 - 2
BansheeEditor/Include/BsHandleSliderPlane.h

@@ -20,9 +20,9 @@ namespace BansheeEngine
 		 *			direction vectors.
 		 *
 		 * @param	dir1		First direction of the plane. The x component of returned delta value will be in 
-		 *						this direction.
+		 *						this direction. Should be perpendicular to \p dir2.
 		 * @param	dir2		Second direction of the plane. The y component of returned delta value will be in 
-		 *						this direction.
+		 *						this direction. Should be perpendicular to \p dir1.
 		 * @param	length		Determines size of the plane. 
 		 * @param	fixedScale	If true the handle slider will always try to maintain the same visible
 		 *						area in the viewport regardless of distance from camera.

+ 2 - 2
BansheeEngine/Include/BsShapeMeshes3D.h

@@ -115,7 +115,7 @@ namespace BansheeEngine
 			const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset, UINT32 quality = 10);
 
 		/**
-		 * @brief	Fills the mesh data with vertices representing a solid arc.
+		 * @brief	Fills the mesh data with vertices representing a solid double-sided arc.
 		 *
 		 * @param	center			Center of the arc to generate geometry for.
 		 * @param	radius			Radius of the arc to generate geometry for.
@@ -164,7 +164,7 @@ namespace BansheeEngine
 			UINT32 vertexOffset, UINT32 indexOffset, UINT32 quality = 10);
 
 		/**
-		 * @brief	Fills the mesh data with vertices representing a solid disc.
+		 * @brief	Fills the mesh data with vertices representing a solid double-sided disc.
 		 *
 		 * @param	center			Center of the disc to generate geometry for.
 		 * @param	radius			Radius of the disc to generate geometry for.

+ 0 - 16
MBansheeEditor/DbgResource.cs

@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    public class DbgResource : ManagedResource
-    {
-        public int some;
-        public string test;
-        public float data;
-    }
-}

+ 0 - 77
MBansheeEditor/DebugWindow.cs

@@ -1,77 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    internal class DebugWindow : EditorWindow
-    {
-        private void OnInitialize()
-        {
-            GUIButton refreshAssembly = new GUIButton("Refresh assembly");
-            refreshAssembly.OnClick += RefreshAssembly_OnClick;
-
-            GUIButton compileGame = new GUIButton("Compile game assembly");
-            compileGame.OnClick += CompileGame_OnClick;
-
-            GUIButton openColorPicker = new GUIButton("Color picker");
-            openColorPicker.OnClick += OpenColorPicker;
-
-            GUILayout horzLayout = GUI.AddLayoutX();
-
-            horzLayout.AddElement(refreshAssembly);
-            horzLayout.AddElement(compileGame);
-            horzLayout.AddElement(openColorPicker);
-
-            GUIButton testExplicitBtn = new GUIButton("TESTING EXPLICIT");
-            testExplicitBtn.Bounds = compileGame.Bounds;
-            GUIPanel overlay = GUI.AddPanel(-1);
-            overlay.SetWidth(Width);
-            overlay.SetHeight(Height);
-            overlay.AddElement(testExplicitBtn);
-        }
-
-        void RefreshAssembly_OnClick()
-        {
-            Internal_RefreshAssembly();
-        }
-
-        void CompileGame_OnClick()
-        {
-            CompilerInstance ci = ScriptCompiler.CompileAsync(ScriptAssemblyType.Game, PlatformType.Windows, true, "D:\\AssemblyOutput");
-
-            while (!ci.IsDone)
-            {
-                Debug.Log("Compiling...");
-                Thread.Sleep(50);
-            }
-
-            Debug.Log("COMPILATION DONE!");
-
-            for(int i = 0; i < ci.ErrorMessages.Length; i++)
-                Debug.Log("ERROR: " + ci.ErrorMessages[i].file + ": " + ci.ErrorMessages[i].line + " - " + ci.ErrorMessages[i].message);
-
-            for (int i = 0; i < ci.WarningMessages.Length; i++)
-                Debug.Log("WARNING: " + ci.WarningMessages[i].file + ": " + ci.WarningMessages[i].line + " - " + ci.WarningMessages[i].message);
-        }
-
-        void OpenColorPicker()
-        {
-            ColorPicker.Show();
-        }
-
-        void OnEditorUpdate()
-        {
-            //if (debugSlowDown)
-            //    Thread.Sleep(5000);
-        }
-
-        [MethodImpl(MethodImplOptions.InternalCall)]
-        internal static extern void Internal_RefreshAssembly();
-    }
-}

+ 0 - 2
MBansheeEditor/MBansheeEditor.csproj

@@ -43,8 +43,6 @@
     <Compile Include="BuildManager.cs" />
     <Compile Include="CodeEditor.cs" />
     <Compile Include="ColorPicker.cs" />
-    <Compile Include="DbgResource.cs" />
-    <Compile Include="DebugWindow.cs" />
     <Compile Include="DialogBox.cs" />
     <Compile Include="DragDrop.cs" />
     <Compile Include="DropDownWindow.cs" />

+ 0 - 38
MBansheeEditor/Program.cs

@@ -11,24 +11,6 @@ namespace BansheeEditor
         static void OnInitialize()
         {
             app = new EditorApplication();
-
-            DbgResource testResource = ManagedResource.Create<DbgResource>();
-            //ProjectLibrary.Create(testResource, @"testResource");
-
-
-
-            // Starts main editor window with the specified width/height and render system
-            // (Window position and sizes are stored internally. Restored upon StartUp and saved upon ShutDown)
-            //EditorApplication.StartUp(RenderSystem.DX11, 1024, 800);
-
-            // TODO - A class to manipulate menu items
-
-            //ProjectSelectWindow window = new ProjectSelectWindow();
-
-            //GUIElementStateStyle dbgStyle = new GUIElementStateStyle();
-            //Color newColor = Color.red;
-
-            //dbgStyle.textColor = newColor;
         }
 
         static void OnEditorLoad()
@@ -50,24 +32,4 @@ namespace BansheeEditor
             app.OnEditorUpdate();
         }
     }
-
-    //class SceneView : EditorWindow
-    //{
-       // SceneView()
-    //    {
-            // GUI is a GUILayout that is initialized internally by EditorWindow
-            //GUI.AddButton("Some text");
-            //GUI.AddXLayout();
-            //GUI.CreateAreaFixed(100, 100, 400, 400); // GUIArea creating another GUIArea
-
-            // Add support for GUIContent
-            // Add support for GUILayoutOptions
-            // Add support for GUIElementStyle and GUISkin - For now ignore this as I need to deal with Fonts, Textures, SpriteTextures, etc.
-     //   }
-    //}
-
-    //class MyGUI : //GUIWidget // GUIWidget is automatically initialized with Game render window. Editor GUIWidgets are specially initialized 
-    //{
-        
-    //}
 }

+ 10 - 0
MBansheeEditor/Scene/CustomHandle.cs

@@ -1,12 +1,22 @@
 using System;
+using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Attribute that can be added to types deriving from <see cref="BansheeEditor.Handle"/>. That handle implementation
+    /// will then be used whenever a handle for the type specified in this attribute needs to be displayed.
+    /// </summary>
     [AttributeUsage(AttributeTargets.Class)]
     public sealed class CustomHandle : Attribute
     {
         private Type type;
 
+        /// <summary>
+        /// Creates a new custom handle attribute.
+        /// </summary>
+        /// <param name="type">Type deriving from <see cref="Component"/> for which the custom handle will be displayed.
+        ///                    </param>
         public CustomHandle(Type type)
         {
             this.type = type;

+ 13 - 15
MBansheeEditor/Scene/DefaultHandle.cs

@@ -2,38 +2,36 @@
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Base class for all the built-in handle types.
+    /// </summary>
     public abstract class DefaultHandle : Handle
     {
         protected Vector3 position;
         protected Quaternion rotation;
 
+        /// <summary>
+        /// World position of the handle.
+        /// </summary>
         public Vector3 Position
         {
             get { return position; }
             set { position = value; }
         }
 
+        /// <summary>
+        /// World rotation of the handle.
+        /// </summary>
         public Quaternion Rotation
         {
             get { return rotation; }
             set { rotation = value; }
         }
 
-        internal void DoPreInput()
-        {
-            PreInput();
-        }
-
-        internal void DoPostInput()
-        {
-            PostInput();
-        }
-
-        internal void DoDraw()
-        {
-            Draw();
-        }
-
+        /// <summary>
+        /// Checks is the handle currently being interacted with.
+        /// </summary>
+        /// <returns>True if the handle is being interacted with (i.e. dragged or clicked).</returns>
         internal abstract bool IsDragged();
     }
 }

+ 22 - 6
MBansheeEditor/Scene/DefaultHandleManager.cs

@@ -3,10 +3,23 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Manages the default set of built-in handles like move, rotate and scale. Handles switching between the three handle
+    /// types, as well as switching between coordinate and pivot modes, while tracking and updating active scene object
+    /// selection. Essentially it detects which handles need to be displayed and where, and then forwards the data
+    /// to the specific handle for processing.
+    /// </summary>
     internal sealed class DefaultHandleManager : Handle
     {
+        /// <summary>
+        /// Representation of a scene object currently being modified by a handle.
+        /// </summary>
         private struct HandledObject
         {
+            /// <summary>
+            /// Creates a new scene object representation by recording the current object transform.
+            /// </summary>
+            /// <param name="so">Scene object that is being modified by a handle.</param>
             public HandledObject(SceneObject so)
             {
                 this.so = so;
@@ -30,7 +43,8 @@ namespace BansheeEditor
         private Quaternion initialHandleRotation;
         private Vector3 initialHandleScale;
 
-        protected override void PreInput()
+        /// <inheritdoc/>
+        protected internal override void PreInput()
         {
             SceneObject[] selectedSceneObjects = Selection.sceneObjects;
 
@@ -96,11 +110,12 @@ namespace BansheeEditor
                 if (!isDragged)
                     initialHandleScale = selectedSceneObjects[0].Scale;
 
-                activeHandle.DoPreInput();
+                activeHandle.PreInput();
             }
         }
 
-        protected override void PostInput()
+        /// <inheritdoc/>
+        protected internal override void PostInput()
         {
             if (activeHandle != null)
             {
@@ -125,7 +140,7 @@ namespace BansheeEditor
                     activeSelection = null;
                 }
 
-                activeHandle.DoPostInput();
+                activeHandle.PostInput();
 
                 if (activeHandle.IsDragged())
                 {
@@ -201,10 +216,11 @@ namespace BansheeEditor
             }
         }
 
-        protected override void Draw()
+        /// <inheritdoc/>
+        protected internal override void Draw()
         {
             if (activeHandle != null)
-                activeHandle.DoDraw();
+                activeHandle.Draw();
         }
     }
 }

+ 20 - 2
MBansheeEditor/Scene/DrawGizmo.cs

@@ -1,21 +1,39 @@
 using System;
+using BansheeEngine;
 
 namespace BansheeEditor
 {
-    // Note: Must match the C++ enum DrawGizmoFlags
-    public enum DrawGizmoFlags
+    /// <summary>
+    /// Controls when a gizmo is displayed and whether it can be interacted with. These flags can be combined to achieve
+    /// different effect.
+    /// </summary>
+    public enum DrawGizmoFlags // Note: Must match the C++ enum DrawGizmoFlags
     {
+        /// <summary>Gizmo is only displayed when its scene object is selected.</summary>
         Selected = 0x01,
+        /// <summary>Gizmo is only displayed when its parent scene object is selected.</summary>
         ParentSelected = 0x02,
+        /// <summary>Gizmo is only displayed when its scene object is not selected.</summary>
         NotSelected = 0x04,
+        /// <summary>Gizmo can be clicked on (selected).</summary>
         Pickable = 0x08
     }
 
+    /// <summary>
+    /// Notifies the runtime that the method this attribute is specified on serves for gizmo drawing. All drawing in the 
+    /// method should be done using the <see cref="Gizmos"/> class. The method must be static and must accept a single
+    /// parameter of type deriving from <see cref="Component"/>. Type of the parameter determines for which objects will
+    /// the gizmo be drawn for.
+    /// </summary>
     [AttributeUsage(AttributeTargets.Method)]
     public sealed class DrawGizmo : Attribute
     {
         private DrawGizmoFlags flags;
 
+        /// <summary>
+        /// Creates a new draw gizmos attribute.
+        /// </summary>
+        /// <param name="flags">Flags that control how and when the gizmos is drawn.</param>
         public DrawGizmo(DrawGizmoFlags flags)
         {
             this.flags = flags;

+ 52 - 2
MBansheeEditor/Scene/Gizmos.cs

@@ -3,9 +3,16 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Provides functionality for drawing gizmos. This class should only be used in methods defined with 
+    /// <see cref="DrawGizmo"/> attribute.
+    /// </summary>
     public class Gizmos
     {
-        public static Color color
+        /// <summary>
+        /// Determines the color that will be used on any following draw method.
+        /// </summary>
+        public static Color Color
         {
             get
             {
@@ -20,7 +27,10 @@ namespace BansheeEditor
             }
         }
 
-        public static Matrix4 transform
+        /// <summary>
+        /// Determines the world transform that will be applied to any following draw method.
+        /// </summary>
+        public static Matrix4 Transform
         {
             get
             {
@@ -35,36 +45,76 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// Draws an axis aligned solid cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
         public static void DrawCube(Vector3 position, Vector3 extents)
         {
             Internal_DrawCube(position, extents);
         }
 
+        /// <summary>
+        /// Draws a solid sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
         public static void DrawSphere(Vector3 position, float radius)
         {
             Internal_DrawSphere(position, radius);
         }
 
+        /// <summary>
+        /// Draws an axis aligned wireframe cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
         public static void DrawWireCube(Vector3 position, Vector3 extents)
         {
             Internal_DrawWireCube(position, extents);
         }
 
+        /// <summary>
+        /// Draws a wireframe sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
         public static void DrawWireSphere(Vector3 position, float radius)
         {
             Internal_DrawWireSphere(position, radius);
         }
 
+        /// <summary>
+        /// Draws a 3D line.
+        /// </summary>
+        /// <param name="start">Starting point for the line.</param>
+        /// <param name="end">Ending point for the line.</param>
         public static void DrawLine(Vector3 start, Vector3 end)
         {
             Internal_DrawLine(start, end);
         }
 
+        /// <summary>
+        /// Draws a wireframe camera frustum.
+        /// </summary>
+        /// <param name="position">Origin of the frustum (place where the camera origin would normally be).</param>
+        /// <param name="aspect">Aspect radio (width/height).</param>
+        /// <param name="FOV">Horizontal field of view.</param>
+        /// <param name="near">Distance from the origin to the near plane.</param>
+        /// <param name="far">Distance from the origin to the far plane.</param>
         public static void DrawFrustum(Vector3 position, float aspect, Degree FOV, float near, float far)
         {
             Internal_DrawFrustum(position, aspect, FOV, near, far);
         }
 
+        /// <summary>
+        /// Draws a texture as a camera-facing quad at a specific position.
+        /// </summary>
+        /// <param name="position">World position of the center of the quad the texture will be drawn on.</param>
+        /// <param name="image">Texture to draw.</param>
+        /// <param name="fixedScale">If true the icon will remain consistent size regardless of distance from camera. 
+        ///                          If false normal perspective foreshortening effect will occurr.</param>
         public static void DrawIcon(Vector3 position, SpriteTexture image, bool fixedScale)
         {
             Internal_DrawIcon(position, image, fixedScale);

+ 15 - 3
MBansheeEditor/Scene/Handle.cs

@@ -3,19 +3,31 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Base class for handle implementations. Handles provide tools that the user can interact with in the scene view.
+    /// This includes traditional handles like move, rotate or scale, but also custom user defined handles. Custom handles
+    /// need to implement this class and also specify a <see cref="CustomHandle"/> attribute.
+    /// </summary>
     public abstract class Handle
     {
         private List<HandleSlider> sliders = new List<HandleSlider>();
 
-        protected abstract void PreInput();
-        protected abstract void PostInput();
-        protected abstract void Draw();
+        protected internal abstract void PreInput();
+        protected internal abstract void PostInput();
+        protected internal abstract void Draw();
 
+        /// <summary>
+        /// Registers a new handle slider used by this handle.
+        /// </summary>
+        /// <param name="slider">Slider used by the handle.</param>
         internal void RegisterSlider(HandleSlider slider)
         {
             sliders.Add(slider);
         }
 
+        /// <summary>
+        /// Destroys the handle, removing it from the scene.
+        /// </summary>
         public void Destroy()
         {
             foreach (var slider in sliders)

+ 100 - 4
MBansheeEditor/Scene/HandleDrawing.cs

@@ -3,68 +3,164 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Contains various method that can be used for drawing handles. These methods should only be called from 
+    /// <see cref="Handle.Draw"/> method or its overrides.
+    /// </summary>
     public sealed class HandleDrawing
     {
-        public static void SetColor(Color color)
+        /// <summary>
+        /// Determines the color that will be used on any following draw method.
+        /// </summary>
+        public static Color Color
         {
-            Internal_SetColor(color);    
+            set { Internal_SetColor(value); }
         }
 
-        public static void SetTransform(Matrix4 transform)
+        /// <summary>
+        /// Determines the world transform that will be applied to any following draw method.
+        /// </summary>
+        public static Matrix4 Transform
         {
-            Internal_SetTransform(transform);
+            set { Internal_SetTransform(value); }
         }
 
+        /// <summary>
+        /// Draws an axis aligned solid cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining 
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawCube(Vector3 position, Vector3 extents, float size = 1.0f)
         {
             Internal_DrawCube(position, extents, size);
         }
 
+        /// <summary>
+        /// Draws a solid sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawSphere(Vector3 position, float radius, float size = 1.0f)
         {
             Internal_DrawSphere(position, radius, size);
         }
 
+        /// <summary>
+        /// Draws an axis aligned wireframe cube.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the cube.</param>
+        /// <param name="extents">Extents defining the half-size of the cube in each dimension.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawWireCube(Vector3 position, Vector3 extents, float size = 1.0f)
         {
             Internal_DrawWireCube(position, extents, size);
         }
 
+        /// <summary>
+        /// Draws a wireframe sphere.
+        /// </summary>
+        /// <param name="position">World coordinates of the center of the sphere.</param>
+        /// <param name="radius">Sphere radius.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawWireSphere(Vector3 position, float radius, float size = 1.0f)
         {
             Internal_DrawWireSphere(position, radius, size);
         }
 
+        /// <summary>
+        /// Draws a solid cone.
+        /// </summary>
+        /// <param name="coneBase">Location of the cone base (center of the cone disc).</param>
+        /// <param name="normal">Normal pointing from the base to the cone point.</param>
+        /// <param name="height">Distance from the origin to the cone point.</param>
+        /// <param name="radius">Radius of the cone disc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawCone(Vector3 coneBase, Vector3 normal, float height, float radius, float size = 1.0f)
         {
             Internal_DrawCone(coneBase, normal, height, radius, size);
         }
 
+        /// <summary>
+        /// Draws a 3D line.
+        /// </summary>
+        /// <param name="start">Starting point for the line.</param>
+        /// <param name="end">Ending point for the line.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawLine(Vector3 start, Vector3 end, float size = 1.0f)
         {
             Internal_DrawLine(start, end, size);
         }
 
+        /// <summary>
+        /// Draws a solid double-sided disc.
+        /// </summary>
+        /// <param name="position">Center of the disc.</param>
+        /// <param name="normal">Normal towards which to orient the disc.</param>
+        /// <param name="radius">Radius of the disc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
         {
             Internal_DrawDisc(position, normal, radius, size);
         }
 
+        /// <summary>
+        /// Draws a wireframe disc.
+        /// </summary>
+        /// <param name="position">Center of the disc.</param>
+        /// <param name="normal">Normal towards which to orient the disc.</param>
+        /// <param name="radius">Radius of the disc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawWireDisc(Vector3 position, Vector3 normal, float radius, float size = 1.0f)
         {
             Internal_DrawWireDisc(position, normal, radius, size);
         }
 
+        /// <summary>
+        /// Draws a solid double-sided arc.
+        /// </summary>
+        /// <param name="position">Center of the disc out of which the arc is cut out of.</param>
+        /// <param name="normal">Normal towards which to orient the arc.</param>
+        /// <param name="radius">Radius of the  disc out of which the arc is cut out of.</param>
+        /// <param name="startAngle">Angle at which the arc starts.</param>
+        /// <param name="amountAngle">Length of the arc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
         {
             Internal_DrawArc(position, normal, radius, startAngle, amountAngle, size);
         }
 
+        /// <summary>
+        /// Draws a wireframe arc.
+        /// </summary>
+        /// <param name="position">Center of the disc out of which the arc is cut out of.</param>
+        /// <param name="normal">Normal towards which to orient the arc.</param>
+        /// <param name="radius">Radius of the  disc out of which the arc is cut out of.</param>
+        /// <param name="startAngle">Angle at which the arc starts.</param>
+        /// <param name="amountAngle">Length of the arc.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawWireArc(Vector3 position, Vector3 normal, float radius, Degree startAngle, Degree amountAngle, float size = 1.0f)
         {
             Internal_DrawWireArc(position, normal, radius, startAngle, amountAngle, size);
         }
 
+        /// <summary>
+        /// Draws a single-sided rectangle in 3D.
+        /// </summary>
+        /// <param name="area">Determines the position, orientation and size of the rectangle.</param>
+        /// <param name="size">Uniform scale to apply on top of the existing transform. Primarily used for maintaining
+        ///                    handle size regardless of distance from camera.</param>
         public static void DrawRect(Rect3 area, float size = 1.0f)
         {
             Internal_DrawRect(area.Center, area.AxisHorz, area.AxisVert, area.ExtentHorz, area.ExtentVert, size);

+ 31 - 0
MBansheeEditor/Scene/HandleSlider.cs

@@ -4,20 +4,39 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Base class for all handle sliders. A handle slider is geometry that the user can interact with by selecting or 
+    /// dragging (i.e. sliding) it while in scene view. Sliders generally output a one- or multi-dimensional delta value 
+    /// that signals the drag amount (and/or direction). Handle sliders are one of the building blocks for 
+    /// <see cref="Handle"/> implementations.
+    /// </summary>
     public class HandleSlider : ScriptObject
     {
+        /// <summary>
+        /// Possible states the slider can be in.
+        /// </summary>
         public enum StateType
         {
+            /// <summary>Slider is not being interacted with.</summary>
 	        Inactive,
+            /// <summary>Slider is clicked on and being dragged.</summary>
 	        Active,
+            /// <summary>Slider is being hovered over but isn't clicked on.</summary>
 	        Hover
         };
 
+        /// <summary>
+        /// Creates a new handle slider.
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
         public HandleSlider(Handle parentHandle)
         {
             parentHandle.RegisterSlider(this);
         }
 
+        /// <summary>
+        /// World position of the slider.
+        /// </summary>
         public Vector3 Position
         {
             get
@@ -33,6 +52,9 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// World rotation of the slider.
+        /// </summary>
         public Quaternion Rotation
         {
             get
@@ -48,6 +70,9 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// Scale of the slider.
+        /// </summary>
         public Vector3 Scale
         {
             get
@@ -63,6 +88,9 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// State the slider is currently in.
+        /// </summary>
         public StateType State
         {
             get
@@ -73,6 +101,9 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// Destroys the slider, removing it from the scene.
+        /// </summary>
         internal void Destroy()
         {
             Internal_Destroy(mCachedPtr);

+ 25 - 0
MBansheeEditor/Scene/HandleSliderDisc.cs

@@ -4,14 +4,30 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Handle slider that returns a delta value as you drag the pointer along a disc. For intersection purposes the disc 
+    /// is internally represented by a torus.
+    /// </summary>
     public sealed class HandleSliderDisc : HandleSlider
     {
+        /// <summary>
+        /// Creates a new disc handle slider.
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
+        /// <param name="normal">Normal that determines the orientation of the disc.</param>
+        /// <param name="radius">Radius of the disc.</param>
+        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the 
+        ///                          viewport regardless of distance from camera.</param>
         public HandleSliderDisc(Handle parentHandle, Vector3 normal, float radius, bool fixedScale = true)
             :base(parentHandle)
         {
             Internal_CreateInstance(this, normal, radius, fixedScale);
         }
 
+        /// <summary>
+        /// Returns a delta value that is the result of dragging/sliding the pointer along the disc. This changes every 
+        /// frame and will be zero unless the slider is active.
+        /// </summary>
         public Degree Delta
         {
             get
@@ -22,6 +38,9 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// Gets the initial angle at which the drag/slide operation started. This is only valid when the slider is active.
+        /// </summary>
         public Degree StartAngle
         {
             get
@@ -32,6 +51,12 @@ namespace BansheeEditor
             }
         }
 
+        /// <summary>
+        /// Enables or disables a cut-off plane that can allow the disc to be intersected with only in a 180 degree arc.
+        /// </summary>
+        /// <param name="angle">Angle at which to start the cut-off. Points on the dist at the specified angle and the next
+        ///                     180 degrees won't be interactable.</param>
+        /// <param name="enabled">Should the cutoff plane be enabled or disabled.</param>
         public void SetCutoffPlane(Degree angle, bool enabled)
         {
             Internal_SetCutoffPlane(mCachedPtr, angle.Degrees, enabled);

+ 17 - 1
MBansheeEditor/Scene/HandleSliderLine.cs

@@ -4,14 +4,30 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Handle slider that returns a delta value as you drag the pointer along a line. For intersection purposes the line 
+    /// is internally by a capsule and a sphere at its cap (assuming this will be used for arrow-like handles).
+    /// </summary>
     public sealed class HandleSliderLine : HandleSlider
     {
-        public HandleSliderLine(Handle parentHandle, Vector3 direction, float length,  bool fixedScale = true)
+        /// <summary>
+        /// Creates a new line handle slider. 
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
+        /// <param name="direction">Normalized direction towards which the line is pointing.</param>
+        /// <param name="length">Length of the line.</param>
+        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the
+        ///                          viewport regardless of distance from camera.</param>
+        public HandleSliderLine(Handle parentHandle, Vector3 direction, float length, bool fixedScale = true)
             :base(parentHandle)
         {
             Internal_CreateInstance(this, direction, length, fixedScale);
         }
 
+        /// <summary>
+        /// Returns a delta value that is the result of dragging/sliding the pointer along the line. This changes every 
+        /// frame and will be zero unless the slider is active.
+        /// </summary>
         public float Delta
         {
             get

+ 21 - 1
MBansheeEditor/Scene/HandleSliderPlane.cs

@@ -4,14 +4,34 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Handle slider that returns a delta value as you drag the pointer along a plane. For intersection purposes the line 
+    /// is internally by a quadrilateral (a bounded plane).
+    /// </summary>
     public sealed class HandleSliderPlane : HandleSlider
-    {
+    {        
+        /// <summary>
+        /// Creates a new plane handle slider. 
+        /// </summary>
+        /// <param name="parentHandle">Handle that the slider belongs to.</param>
+        /// <param name="dir1">First direction of the plane. The x component of returned delta value will be in this 
+        ///                    direction. Should be perpendicular to <see cref="dir2"/>.</param>
+        /// <param name="dir2">Second direction of the plane. The y component of returned delta value will be in this
+        ///                    direction. Should be perpendicular to <see cref="dir1"/>.</param>
+        /// <param name="length">Length of the quadrilateral in both directions.</param>
+        /// <param name="fixedScale">If true the handle slider will always try to maintain the same visible area in the
+        ///                          viewport regardless of distance from camera.</param>
         public HandleSliderPlane(Handle parentHandle, Vector3 dir1, Vector3 dir2, float length, bool fixedScale = true)
             :base(parentHandle)
         {
             Internal_CreateInstance(this, dir1, dir2, length, fixedScale);
         }
 
+        /// <summary>
+        /// Returns a delta value that is the result of dragging/sliding the pointer along the plane. Returned movement is 
+        /// in terms of the two directions originally provided when constructing the slider. This changes every frame and 
+        /// will be zero unless the slider is active.
+        /// </summary>
         public Vector2 Delta
         {
             get

+ 38 - 0
MBansheeEditor/Scene/Handles.cs

@@ -3,32 +3,57 @@ using BansheeEngine;
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Manages various global values relating to handles.
+    /// </summary>
     public sealed class Handles
     {
+        /// <summary>
+        /// Determines if snapping for move handle is active. When active the move handle can only be moved in increments
+        /// specified by <see cref="MoveSnapAmount"/>.
+        /// </summary>
         public static bool MoveHandleSnapActive
         {
             get { return EditorSettings.MoveHandleSnapActive; }
             set { EditorSettings.MoveHandleSnapActive = value; }
         }
 
+        /// <summary>
+        /// Determines if snapping for rotate handle is active. When active the rotate handle can only be rotated in 
+        /// increments specified by <see cref="RotateSnapAmount"/>.
+        /// </summary>
         public static bool RotateHandleSnapActive
         {
             get { return EditorSettings.RotateHandleSnapActive; }
             set { EditorSettings.RotateHandleSnapActive = value; }
         }
 
+        /// <summary>
+        /// Determines size of the increments the move handle can be moved when <see cref="MoveHandleSnapActive"/> is
+        /// active.
+        /// </summary>
         public static float MoveSnapAmount
         {
             get { return EditorSettings.MoveHandleSnapAmount; }
             set { EditorSettings.MoveHandleSnapAmount = value; }
         }
 
+        /// <summary>
+        /// Determines size of the increments the rotate handle can be moved when <see cref="RotateHandleSnapActive"/> is
+        /// active.
+        /// </summary>
         public static Degree RotateSnapAmount
         {
             get { return EditorSettings.RotateHandleSnapAmount; }
             set { EditorSettings.RotateHandleSnapAmount = value; }
         }
 
+        /// <summary>
+        /// Snaps a value to the specified increments.
+        /// </summary>
+        /// <param name="value">Value to snap.</param>
+        /// <param name="snapAmount">Increment to which to snap the value to.</param>
+        /// <returns>Value snapped to the provided increments.</returns>
         public static float SnapValue(float value, float snapAmount)
         {
             if (snapAmount > 0)
@@ -37,11 +62,24 @@ namespace BansheeEditor
             return value;
         }
 
+        /// <summary>
+        /// Snaps an angle value to the specified increments.
+        /// </summary>
+        /// <param name="value">Value to snap.</param>
+        /// <param name="snapAmount">Increment to which to snap the value to.</param>
+        /// <returns>Value snapped to the provided increments.</returns>
         public static Degree SnapValue(Degree value, Degree snapAmount)
         {
             return SnapValue(value.Degrees, snapAmount.Degrees);
         }
 
+        /// <summary>
+        /// Returns a scale that can be applied to a handle in order to keep it at constant size regardless of distance
+        /// from the provided camera.
+        /// </summary>
+        /// <param name="camera">Camera through which the handle is being viewed.</param>
+        /// <param name="position">Center of the handle.</param>
+        /// <returns>Uniform scale to apply to the handle.</returns>
         public static float GetHandleSize(Camera camera, Vector3 position)
         {
             Vector3 cameraPos = camera.SceneObject.Position;

+ 50 - 25
MBansheeEditor/Scene/MoveHandle.cs

@@ -2,6 +2,9 @@
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Handle that allows an object to be translated along the three primary axes.
+    /// </summary>
     public sealed class MoveHandle : DefaultHandle
     {
         private const float CONE_HEIGHT = 0.25f;
@@ -17,11 +20,15 @@ namespace BansheeEditor
         private HandleSliderPlane yzPlane;
         private HandleSliderPlane zxPlane;
 
+        /// <summary>
+        /// Returns the amount of translation since last frame. Only valid while the handle is being dragged.
+        /// </summary>
         public Vector3 Delta
         {
             get { return delta; }
         }
 
+        /// <inheritdoc/>
         internal override bool IsDragged()
         {
             return xAxis.State == HandleSlider.StateType.Active ||
@@ -32,6 +39,9 @@ namespace BansheeEditor
                     zxPlane.State == HandleSlider.StateType.Active;
         }
 
+        /// <summary>
+        /// Creates a new move handle.
+        /// </summary>
         public MoveHandle()
         {
             xAxis = new HandleSliderLine(this, Vector3.XAxis, 1.0f);
@@ -43,7 +53,8 @@ namespace BansheeEditor
             zxPlane = new HandleSliderPlane(this, Vector3.ZAxis, Vector3.XAxis, 0.3f);
         }
 
-        protected override void PreInput()
+        /// <inheritdoc/>
+        protected internal override void PreInput()
         {
             xAxis.Position = position;
             yAxis.Position = position;
@@ -62,7 +73,8 @@ namespace BansheeEditor
             zxPlane.Rotation = rotation;
         }
 
-        protected override void PostInput()
+        /// <inheritdoc/>
+        protected internal override void PostInput()
         {
             delta = Vector3.Zero;
 
@@ -94,40 +106,41 @@ namespace BansheeEditor
             }
         }
 
-        protected override void Draw()
+        /// <inheritdoc/>
+        protected internal override void Draw()
         {
-            HandleDrawing.SetTransform(Matrix4.TRS(Position, Rotation, Vector3.One));
+            HandleDrawing.Transform = Matrix4.TRS(Position, Rotation, Vector3.One);
             float handleSize = Handles.GetHandleSize(EditorApplication.SceneViewCamera, position);
 
             // Draw 1D arrows
             if (xAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if(xAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Red);
+                HandleDrawing.Color = Color.Red;
 
             Vector3 xConeStart = Vector3.XAxis*(1.0f - CONE_HEIGHT);
             HandleDrawing.DrawLine(Vector3.Zero, xConeStart, handleSize);
             HandleDrawing.DrawCone(xConeStart, Vector3.XAxis, CONE_HEIGHT, CONE_RADIUS, handleSize);
 
             if (yAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (yAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Green);
+                HandleDrawing.Color = Color.Green;
 
             Vector3 yConeStart = Vector3.YAxis * (1.0f - CONE_HEIGHT);
             HandleDrawing.DrawLine(Vector3.Zero, yConeStart, handleSize);
             HandleDrawing.DrawCone(yConeStart, Vector3.YAxis, CONE_HEIGHT, CONE_RADIUS, handleSize);
 
             if (zAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (zAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Blue);
+                HandleDrawing.Color = Color.Blue;
 
             Vector3 zConeStart = Vector3.ZAxis * (1.0f - CONE_HEIGHT);
             HandleDrawing.DrawLine(Vector3.Zero, zConeStart, handleSize);
@@ -143,17 +156,17 @@ namespace BansheeEditor
             Vector3 planeZOffset = Vector3.ZAxis * 0.3f;
 
             //// XY plane
-            HandleDrawing.SetColor(Color.Blue);
+            HandleDrawing.Color = Color.Blue;
 
             HandleDrawing.DrawLine(planeXOffset, planeXOffset + planeYOffset, handleSize);
             HandleDrawing.DrawLine(planeYOffset, planeYOffset + planeXOffset, handleSize);
 
             if (xyPlane.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.Blue * planeActive);
+                HandleDrawing.Color = Color.Blue * planeActive;
             else if (xyPlane.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.Blue * planeHover);
+                HandleDrawing.Color = Color.Blue * planeHover;
             else
-                HandleDrawing.SetColor(Color.Blue * planeNormal);
+                HandleDrawing.Color = Color.Blue * planeNormal;
 
             Rect3 xyPlaneArea = new Rect3(
                 (planeXOffset + planeYOffset) * 0.5f,
@@ -162,17 +175,17 @@ namespace BansheeEditor
             HandleDrawing.DrawRect(xyPlaneArea, handleSize);
 
             //// YZ plane
-            HandleDrawing.SetColor(Color.Red);
+            HandleDrawing.Color = Color.Red;
 
             HandleDrawing.DrawLine(planeYOffset, planeYOffset + planeZOffset, handleSize);
             HandleDrawing.DrawLine(planeZOffset, planeZOffset + planeYOffset, handleSize);
 
             if (yzPlane.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.Red * planeActive);
+                HandleDrawing.Color = Color.Red * planeActive;
             else if (yzPlane.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.Red * planeHover);
+                HandleDrawing.Color = Color.Red * planeHover;
             else
-                HandleDrawing.SetColor(Color.Red * planeNormal);
+                HandleDrawing.Color = Color.Red * planeNormal;
 
             Rect3 yzPlaneArea = new Rect3(
                 (planeYOffset + planeZOffset) * 0.5f,
@@ -182,17 +195,17 @@ namespace BansheeEditor
             HandleDrawing.DrawRect(yzPlaneArea, handleSize);
 
             //// ZX plane
-            HandleDrawing.SetColor(Color.Green);
+            HandleDrawing.Color = Color.Green;
 
             HandleDrawing.DrawLine(planeZOffset, planeZOffset + planeXOffset, handleSize);
             HandleDrawing.DrawLine(planeXOffset, planeXOffset + planeZOffset, handleSize);
 
             if (zxPlane.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.Green * planeActive);
+                HandleDrawing.Color = Color.Green * planeActive;
             else if (zxPlane.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.Green * planeHover);
+                HandleDrawing.Color = Color.Green * planeHover;
             else
-                HandleDrawing.SetColor(Color.Green * planeNormal);
+                HandleDrawing.Color = Color.Green * planeNormal;
 
             Rect3 zxPlaneArea = new Rect3(
                 (planeZOffset + planeXOffset) * 0.5f,
@@ -201,16 +214,28 @@ namespace BansheeEditor
             HandleDrawing.DrawRect(zxPlaneArea, handleSize);
         }
 
+        /// <summary>
+        /// Returns the direction of the handle's x axis in world space.
+        /// </summary>
+        /// <returns>Direction of the handle's x axis in world space</returns>
         private Vector3 GetXDir()
         {
              return rotation.Rotate(Vector3.XAxis);
         }
 
+        /// <summary>
+        /// Returns the direction of the handle's y axis in world space.
+        /// </summary>
+        /// <returns>Direction of the handle's y axis in world space</returns>
         private Vector3 GetYDir()
         {
             return rotation.Rotate(Vector3.YAxis);
         }
 
+        /// <summary>
+        /// Returns the direction of the handle's z axis in world space.
+        /// </summary>
+        /// <returns>Direction of the handle's z axis in world space</returns>
         private Vector3 GetZDir()
         {
             return rotation.Rotate(Vector3.ZAxis);

+ 65 - 21
MBansheeEditor/Scene/RotateHandle.cs

@@ -2,6 +2,10 @@
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Handle that allows an object to be rotated around the three primary axes, as well as a free axis currently
+    /// facing the camera.
+    /// </summary>
     public sealed class RotateHandle : DefaultHandle
     {
         private Quaternion delta;
@@ -15,11 +19,15 @@ namespace BansheeEditor
         private bool isDragged;
         private Quaternion dragStartRotation;
 
+        /// <summary>
+        /// Amount of rotation applied since the last frame. Only valid while the handle is being dragged.
+        /// </summary>
         public Quaternion Delta
         {
             get { return delta; }
         }
 
+        /// <inheritdoc/>
         internal override bool IsDragged()
         {
             return xAxis.State == HandleSlider.StateType.Active ||
@@ -28,6 +36,9 @@ namespace BansheeEditor
                     freeAxis.State == HandleSlider.StateType.Active;
         }
 
+        /// <summary>
+        /// Creates a new rotation handle.
+        /// </summary>
         public RotateHandle()
         {
             xAxis = new HandleSliderDisc(this, Vector3.XAxis, 1.0f);
@@ -36,7 +47,8 @@ namespace BansheeEditor
             freeAxis = new HandleSliderDisc(this, -Vector3.ZAxis, 1.2f);
         }
 
-        protected override void PreInput()
+        /// <inheritdoc/>
+        protected internal override void PreInput()
         {
             xAxis.Position = position;
             yAxis.Position = position;
@@ -54,7 +66,8 @@ namespace BansheeEditor
             zAxis.SetCutoffPlane(GetZStartAngle(isDragged), true);
         }
 
-        protected override void PostInput()
+        /// <inheritdoc/>
+        protected internal override void PostInput()
         {
             if (IsDragged())
             {
@@ -96,64 +109,65 @@ namespace BansheeEditor
             delta *= Quaternion.FromAxisAngle(cameraForward, freeAxisValue);
         }
 
-        protected override void Draw()
+        /// <inheritdoc/>
+        protected internal override void Draw()
         {
-            HandleDrawing.SetTransform(Matrix4.TRS(Position, Rotation, Vector3.One));
+            HandleDrawing.Transform = Matrix4.TRS(Position, Rotation, Vector3.One);
             float handleSize = Handles.GetHandleSize(EditorApplication.SceneViewCamera, position);
 
             // Draw arcs
             if (xAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if(xAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Red);
+                HandleDrawing.Color = Color.Red;
 
             HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.XAxis, 1.0f, GetXStartAngle(false), -180.0f, handleSize);
 
             if (yAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (yAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Green);
+                HandleDrawing.Color = Color.Green;
 
             HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.YAxis, 1.0f, GetYStartAngle(false), -180.0f, handleSize);
 
             if (zAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (zAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Blue);
+                HandleDrawing.Color = Color.Blue;
 
             HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.ZAxis, 1.0f, GetZStartAngle(false), -180.0f, handleSize);
 
             // Draw "bounds" and free handle
             Color gray = new Color(1.0f, 1.0f, 1.0f, 0.3f);
             Vector3 cameraNormal = EditorApplication.SceneViewCamera.SceneObject.Rotation.Rotate(Vector3.ZAxis);
-            HandleDrawing.SetTransform(Matrix4.TRS(Position, Quaternion.Identity, Vector3.One));
-            HandleDrawing.SetColor(gray);
+            HandleDrawing.Transform = Matrix4.TRS(Position, Quaternion.Identity, Vector3.One);
+            HandleDrawing.Color = gray;
 
             HandleDrawing.DrawWireDisc(cameraNormal * 0.1f, cameraNormal, 1.0f, handleSize);
 
             if (freeAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (freeAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(gray);
+                HandleDrawing.Color = gray;
 
             HandleDrawing.DrawWireDisc(Vector3.Zero, cameraNormal, 1.2f, handleSize);
 
             // Draw active rotation pie
-            HandleDrawing.SetColor(gray);
-            HandleDrawing.SetTransform(Matrix4.TRS(Position, EditorApplication.SceneViewCamera.SceneObject.Rotation, Vector3.One));
+            HandleDrawing.Color = gray;
+            HandleDrawing.Transform = Matrix4.TRS(Position, EditorApplication.SceneViewCamera.SceneObject.Rotation, Vector3.One);
 
             if (freeAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.DrawArc(Vector3.Zero, -Vector3.ZAxis, 1.2f, freeAxis.StartAngle, freeAxis.Delta, handleSize);
 
-            HandleDrawing.SetTransform(Matrix4.TRS(Position, dragStartRotation, Vector3.One));
+            HandleDrawing.Transform = Matrix4.TRS(Position, dragStartRotation, Vector3.One);
 
             if (xAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.DrawArc(Vector3.Zero, Vector3.XAxis, 1.0f, xAxis.StartAngle, xAxis.Delta, handleSize);
@@ -163,6 +177,14 @@ namespace BansheeEditor
                 HandleDrawing.DrawArc(Vector3.Zero, Vector3.ZAxis, 1.0f, zAxis.StartAngle, zAxis.Delta, handleSize);
         }
 
+        /// <summary>
+        /// The rotate handle only displays the 180 degree arc facing the camera and this method returns the angle at which 
+        /// the arc starts for the X axis.
+        /// </summary>
+        /// <param name="frozen">Determines should the local handle rotation be taken into account, or should it be frozen
+        ///                      to the value when handle drag started. This is useful because we do not want the visible
+        ///                      arc to change while the user is in the process of rotating the handle.</param>
+        /// <returns>Angle at which to display the visible arc for the X axis rotations.</returns>
         private Degree GetXStartAngle(bool frozen)
         {
             Quaternion handleRotation = frozen ? dragStartRotation : Rotation;
@@ -171,6 +193,14 @@ namespace BansheeEditor
             return PointOnCircleToAngle(Vector3.XAxis, xStartDir);
         }
 
+        /// <summary>
+        /// The rotate handle only displays the 180 degree arc facing the camera and this method returns the angle at which 
+        /// the arc starts for the Y axis.
+        /// </summary>
+        /// <param name="frozen">Determines should the local handle rotation be taken into account, or should it be frozen
+        ///                      to the value when handle drag started. This is useful because we do not want the visible
+        ///                      arc to change while the user is in the process of rotating the handle.</param>
+        /// <returns>Angle at which to display the visible arc for the Y axis rotations.</returns>
         private Degree GetYStartAngle(bool frozen)
         {
             Quaternion handleRotation = frozen ? dragStartRotation : Rotation;
@@ -179,6 +209,14 @@ namespace BansheeEditor
             return PointOnCircleToAngle(Vector3.YAxis, yStartDir);
         }
 
+        /// <summary>
+        /// The rotate handle only displays the 180 degree arc facing the camera and this method returns the angle at which 
+        /// the arc starts for the Z axis.
+        /// </summary>
+        /// <param name="frozen">Determines should the local handle rotation be taken into account, or should it be frozen
+        ///                      to the value when handle drag started. This is useful because we do not want the visible
+        ///                      arc to change while the user is in the process of rotating the handle.</param>
+        /// <returns>Angle at which to display the visible arc for the Z axis rotations.</returns>
         private Degree GetZStartAngle(bool frozen)
         {
             Quaternion handleRotation = frozen ? dragStartRotation : Rotation;
@@ -187,6 +225,12 @@ namespace BansheeEditor
             return PointOnCircleToAngle(Vector3.ZAxis, zStartDir);
         }
 
+        /// <summary>
+        /// Converts a point on the circle to an angle on the circle.
+        /// </summary>
+        /// <param name="up">Up vector determining the orientation of the circle.</param>
+        /// <param name="point">Point along a unit circle centered around the origin.</param>
+        /// <returns>Angle at which the provided point is located on the circle.</returns>
         private Degree PointOnCircleToAngle(Vector3 up, Vector3 point)
         {
             Quaternion rot = Quaternion.FromToRotation(up, Vector3.YAxis);

+ 42 - 16
MBansheeEditor/Scene/ScaleHandle.cs

@@ -2,6 +2,10 @@
 
 namespace BansheeEditor
 {
+    /// <summary>
+    /// Handle that allows an object to be scaled along the three primary axes, as well as a free axis currently
+    /// facing the camera.
+    /// </summary>
     public sealed class ScaleHandle : DefaultHandle
     {
         private const float SMALL_CUBE_SIZE = 0.175f;
@@ -15,11 +19,15 @@ namespace BansheeEditor
 
         private HandleSliderPlane freeAxis;
 
+        /// <summary>
+        /// Returns the amount of scaling applied since the last frame. Only valid while the handle is being dragged.
+        /// </summary>
         public Vector3 Delta
         {
             get { return delta; }
         }
 
+        /// <inheritdoc/>
         internal override bool IsDragged()
         {
             return xAxis.State == HandleSlider.StateType.Active ||
@@ -28,6 +36,9 @@ namespace BansheeEditor
                     freeAxis.State == HandleSlider.StateType.Active;
         }
 
+        /// <summary>
+        /// Creates a new scale handle.
+        /// </summary>
         public ScaleHandle()
         {
             xAxis = new HandleSliderLine(this, Vector3.XAxis, 1.0f);
@@ -37,7 +48,8 @@ namespace BansheeEditor
             freeAxis = new HandleSliderPlane(this, Vector3.XAxis, Vector3.YAxis, 0.4f);
         }
 
-        protected override void PreInput()
+        /// <inheritdoc/>
+        protected internal override void PreInput()
         {
             xAxis.Position = position;
             yAxis.Position = position;
@@ -53,7 +65,8 @@ namespace BansheeEditor
             freeAxis.Position = position + freeAxis.Rotation.Rotate(freeAxisOffset);
         }
 
-        protected override void PostInput()
+        /// <inheritdoc/>
+        protected internal override void PostInput()
         {
             delta = Vector3.Zero;
 
@@ -63,20 +76,21 @@ namespace BansheeEditor
             delta += (freeAxis.Delta.x + freeAxis.Delta.y) * Vector3.One * 0.1f;
         }
 
-        protected override void Draw()
+        /// <inheritdoc/>
+        protected internal override void Draw()
         {
-            HandleDrawing.SetTransform(Matrix4.TRS(Position, Rotation, Vector3.One));
+            HandleDrawing.Transform = Matrix4.TRS(Position, Rotation, Vector3.One);
             float handleSize = Handles.GetHandleSize(EditorApplication.SceneViewCamera, position);
 
             // Draw 1D sliders
             Vector3 smallCubeExtents = new Vector3(SMALL_CUBE_SIZE*0.5f, SMALL_CUBE_SIZE*0.5f, SMALL_CUBE_SIZE*0.5f);
 
             if (xAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (xAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Red);
+                HandleDrawing.Color = Color.Red;
 
             Vector3 xCubeOffset = Vector3.XAxis * SMALL_CUBE_SIZE * 0.5f;
             Vector3 xCubeStart = Vector3.XAxis - xCubeOffset;
@@ -85,11 +99,11 @@ namespace BansheeEditor
             HandleDrawing.DrawCube(xCubeStart + xCubeOffset, smallCubeExtents, handleSize);
 
             if (yAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (yAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Green);
+                HandleDrawing.Color = Color.Green;
 
             Vector3 yCubeOffset = Vector3.YAxis * SMALL_CUBE_SIZE * 0.5f;
             Vector3 yCubeStart = Vector3.YAxis - yCubeOffset;
@@ -98,11 +112,11 @@ namespace BansheeEditor
             HandleDrawing.DrawCube(yCubeStart + yCubeOffset, smallCubeExtents, handleSize);
 
             if (zAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (zAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.Blue);
+                HandleDrawing.Color = Color.Blue;
 
             Vector3 zCubeOffset = Vector3.ZAxis * SMALL_CUBE_SIZE * 0.5f;
             Vector3 zCubeStart = Vector3.ZAxis - zCubeOffset;
@@ -112,11 +126,11 @@ namespace BansheeEditor
 
             // Draw free scale handle
             if (freeAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
             else if (freeAxis.State == HandleSlider.StateType.Hover)
-                HandleDrawing.SetColor(Color.BansheeOrange);
+                HandleDrawing.Color = Color.BansheeOrange;
             else
-                HandleDrawing.SetColor(Color.White);
+                HandleDrawing.Color = Color.White;
 
             //// Rotate it so it always faces the camera, and move it forward a bit to always render in front
             Vector3 bottomLeft = -Vector3.XAxis * 0.2f - Vector3.YAxis * 0.2f;
@@ -138,16 +152,28 @@ namespace BansheeEditor
             HandleDrawing.DrawLine(bottomRight, topRight, handleSize);
         }
 
+        /// <summary>
+        /// Returns the direction of the handle's x axis in world space.
+        /// </summary>
+        /// <returns>Direction of the handle's x axis in world space</returns>
         private Vector3 GetXDir()
         {
             return rotation.Rotate(Vector3.XAxis);
         }
 
+        /// <summary>
+        /// Returns the direction of the handle's y axis in world space.
+        /// </summary>
+        /// <returns>Direction of the handle's y axis in world space</returns>
         private Vector3 GetYDir()
         {
             return rotation.Rotate(Vector3.YAxis);
         }
 
+        /// <summary>
+        /// Returns the direction of the handle's z axis in world space.
+        /// </summary>
+        /// <returns>Direction of the handle's z axis in world space</returns>
         private Vector3 GetZDir()
         {
             return rotation.Rotate(Vector3.ZAxis);

+ 4 - 9
TODO.txt

@@ -54,22 +54,16 @@ Polish
 
 Ribek use:
  - Hook up color picker to guicolor field
- - Camera, Renderable, Material, Texture inspector
  - Test release mode
- - Ability to create assets in Project view (At least Material)
- - (Optionally, needed for GUI editing) GUISkin resource inspector & a way to inspect and save the default editor skin
- - (Optionally) StringTable inspector
 
 Other polish:
- - C# inspectors for Point/Spot/Directional light, Sprite texture, Shader, Script code, Plain text
- - Prefab inspector (render something similar to SceneObject inspector?)
+ - Component inspectors for: Camera, Renderable, Point/Spot/Directional lights
+ - Resource inspectors for: Material, Texture, Mesh, Font, Shader, Script Code, Plain Text, Sprite Texture, GUISkin, StringTable, Prefab (render something similar to SceneObject inspector?)
  - C# interface for Font and SpriteTexture
- - Import option inspectors for Texture, Mesh, Font
  - Add menu items:
   - Edit: Undo/Redo, Cut/Copy/Paste/Duplicate/Delete(need to make sure it works in Hierarchy, with shortcuts), Frame Selected, Preferences, Play/Pause/Step, View/Move/rotate/scale
-  - Assets (also add to context): Create(Folder, Material, Shader, Script, Prefab, GUI Skin), Show in explorer
   - Game Object (also add to context): Create(Empty, Empty Child, Camera, Renderable, Point/Spot/Directional Light), Apply prefab, Break prefab, Revert prefab
-   - Possibly create helper objects: Cube, Sphere, Plane, Quad, Capsule, Cylinder
+   - Also create helper objects: Cube, Sphere, Plane, Quad, Capsule, Cylinder
   - Help - About, API Reference (link to site)
  - Add temporary icon textures too all icon buttons currently containing only text so that Ribek can modify them
  - When I expand inspector elements and them come back to that object it should remember the previous state
@@ -92,6 +86,7 @@ Stage 2 polish:
 Optional:
  - When starting drag from hierarchy tree view it tends to select another object (can't repro)
  - Handle seems to lag behind the selected mesh
+ - When resizing library window while docked, selection area appears
  - Move all the code files into subfolders so their hierarchy is similar to VS filters
  - Splash screen
  - Settings/Preferences window