Ver Fonte

Documentation

Marko Pintera há 10 anos atrás
pai
commit
9beecec11b

+ 12 - 0
MBansheeEditor/ColorPicker.cs

@@ -90,6 +90,18 @@ namespace BansheeEditor
             return picker;
         }
 
+        public static ColorPicker Show(Color color, Action<bool, Color> closedCallback = null)
+        {
+            ColorPicker picker = new ColorPicker();
+            picker.colRed = color.r;
+            picker.colGreen = color.g;
+            picker.colBlue = color.b; 
+            picker.colAlpha = color.a;
+            picker.closedCallback = closedCallback;
+
+            return picker;
+        }
+
         protected ColorPicker()
             : base(false)
         { }

+ 5 - 0
MBansheeEditor/GUI/GUIColorField.cs

@@ -43,6 +43,11 @@ namespace BansheeEditor
                 OnChanged(newValue);
         }
 
+        private void DoOnClicked()
+        {
+            // TODO
+        }
+
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_CreateInstance(GUIColorField instance, GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);

+ 81 - 4
SBansheeEditor/Include/BsScriptDragDropManager.h

@@ -9,6 +9,10 @@ namespace BansheeEngine
 	class ScriptSceneObjectDragDropData;
 	class ScriptResourceDragDropData;
 
+	/**
+	 * @brief	Types of drag and drop operations supported
+	 *			by the managed drag and drop system.
+	 */
 	// Note: Must be equal to C# DragDropType enum
 	enum class ScriptDragDropType
 	{
@@ -17,6 +21,9 @@ namespace BansheeEngine
 		None
 	};
 
+	/**
+	 * @brief	Interop class between C++ & CLR for DragAndDropManager.
+	 */
 	class BS_SCR_BED_EXPORT ScriptDragDrop : public ScriptObject<ScriptDragDrop>
 	{
 	public:
@@ -25,9 +32,23 @@ namespace BansheeEngine
 	private:
 		ScriptDragDrop(MonoObject* instance);
 
+		/**
+		 * @brief	Triggered when the scene object drag and drop operation ends.
+		 *
+		 * @param	processed	True if the drop operations was accepted by some system.
+		 */
 		static void sceneObjectDragDropFinalize(bool processed);
+
+		/**
+		 * @brief	Triggered when the resource drag and drop operation ends.
+		 *
+		 * @param	processed	True if the drop operations was accepted by some system.
+		 */
 		static void resourceDragDropFinalize(bool processed);
 
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static bool internal_IsDragInProgress();
 		static bool internal_IsDropInProgress();
 		static MonoObject* internal_GetData();
@@ -36,55 +57,111 @@ namespace BansheeEngine
 		static void internal_StartResourceDrag(ScriptResourceDragDropData* dragData);
 	};
 
+	/**
+	 * @brief	Interop class between C++ & CLR for SceneObjectDragDropData. Contains
+	 *			a set of scene objects used during managed drag and drop operations.
+	 */
 	class BS_SCR_BED_EXPORT ScriptSceneObjectDragDropData : public ScriptObject<ScriptSceneObjectDragDropData>
 	{
 	public:
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "SceneObjectDragDropData");
 
+		/**
+		 * @brief	Creates a new managed instance of SceneObjectDragDropData containing
+		 *			the specified scene objects.
+		 */
 		static MonoObject* create(const Vector<HSceneObject>& sceneObjects);
 
+		/**
+		 * @brief	Returns the scene objects referenced by this object.
+		 */
 		const Vector<HSceneObject>& getSceneObjects() const { return mSceneObjects; }
 
 	private:
 		ScriptSceneObjectDragDropData(MonoObject* instance, const Vector<HSceneObject>& sceneObjects);
 
+		Vector<HSceneObject> mSceneObjects;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static void internal_CreateInstance(MonoObject* instance, MonoArray* objects);
 		static MonoArray* internal_GetObjects(ScriptSceneObjectDragDropData* instance);
-
-		Vector<HSceneObject> mSceneObjects;
 	};
 
+	/**
+	 * @brief	Interop class between C++ & CLR for ResourceDragDropData. Contains
+	 *			a set of resource paths used during managed drag and drop operations.
+	 */
 	class BS_SCR_BED_EXPORT ScriptResourceDragDropData : public ScriptObject < ScriptResourceDragDropData >
 	{
 	public:
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "ResourceDragDropData");
 
+		/**
+		 * @brief	Creates a new managed instance of ResourceDragDropData containing
+		 *			the specified resource paths.
+		 */
 		static MonoObject* create(const Vector<Path>& paths);
 
+		/**
+		 * @brief	Returns the resource paths referenced by this object.
+		 */
 		const Vector<Path>& getPaths() const { return mPaths; }
 
 	private:
 		ScriptResourceDragDropData(MonoObject* instance, const Vector<Path>& paths);
 
+		Vector<Path> mPaths;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static void internal_CreateInstance(MonoObject* instance, MonoArray* paths);
 		static MonoArray* internal_GetPaths(ScriptResourceDragDropData* instance);
-
-		Vector<Path> mPaths;
 	};
 
+	/**
+	 * @brief	Handles managed drag and drop operations. Wraps the existing
+	 *			functionality of DragAndDropManager. Essentially converts the
+	 *			callback nature of DragAndDropManager into a polling based system.
+	 */
 	class BS_SCR_BED_EXPORT ScriptDragDropManager : public Module<ScriptDragDropManager>
 	{
 	public:
 		ScriptDragDropManager();
 		~ScriptDragDropManager();
 
+		/**
+		 * @brief	Called every frame. Checks for changes in drag and drop operations.
+		 *
+		 * @note	Internal method.
+		 */
 		void update();
 
+		/**
+		 * @brief	Checks has the user performed a drop operation this frame. 
+		 */
 		bool isDropInProgress() const { return mIsDropInProgress; }
+
+		/**
+		 * @brief	Returns the managed representation of currently dragged data (e.g. SceneObjectDragDropData). 
+		 *			This will be null if drag or drop is not in progress or of unsupported type.
+		 */
 		MonoObject* getDropData() const;
+
+		/**
+		 * @brief	Checks the type of the current drag or drop operation.
+		 */
 		ScriptDragDropType getDragType() const;
 
 	private:
+		/**
+		 * @brief	Triggered when a native drag and drop operation ends.
+		 *
+		 * @param	evt				Pointer data regarding where the drop operation occurred.
+		 * @param	callbackInfo	Data whether the drop was processed or not.
+		 */
 		void onMouseDragEnded(const PointerEvent& evt, DragCallbackInfo& callbackInfo);
 
 		HEvent mDragEndedConn;

+ 53 - 8
SBansheeEditor/Include/BsScriptDropDownWindow.h

@@ -9,6 +9,9 @@ namespace BansheeEngine
 {
 	class ManagedDropDownWindow;
 
+	/**
+	 * @brief	Interop class between C++ & CLR for types deriving from DropDownWindow.
+	 */
 	class BS_SCR_BED_EXPORT ScriptDropDownWindow : public ScriptObject <ScriptDropDownWindow>
 	{
 	public:
@@ -21,22 +24,38 @@ namespace BansheeEngine
 
 		ScriptDropDownWindow(ManagedDropDownWindow* window);
 
-		static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* parentWindow, Vector2I position, int width, int height);
-		static void internal_Close(ScriptDropDownWindow* nativeInstance);
-		static void internal_SetWidth(ScriptDropDownWindow* nativeInstance, UINT32 value);
-		static void internal_SetHeight(ScriptDropDownWindow* nativeInstance, UINT32 value);
-		static void internal_ScreenToWindowPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* windowPos);
-		static void internal_WindowToScreenPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* screenPos);
-
+		/**
+		 * @brief	Triggered when the assembly refresh starts.
+		 */
 		void onAssemblyRefreshStarted();
+
+		/**
+		 * @brief	Triggered when the native DropDownWindow wrapped by this object
+		 *			gets closed.
+		 */
 		void notifyWindowClosed();
 
 		ManagedDropDownWindow* mDropDownWindow;
 		HEvent mOnAssemblyRefreshStartedConn;
 
 		static MonoField* guiPanelField;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, ScriptEditorWindow* parentWindow, Vector2I position, int width, int height);
+		static void internal_Close(ScriptDropDownWindow* nativeInstance);
+		static void internal_SetWidth(ScriptDropDownWindow* nativeInstance, UINT32 value);
+		static void internal_SetHeight(ScriptDropDownWindow* nativeInstance, UINT32 value);
+		static void internal_ScreenToWindowPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* windowPos);
+		static void internal_WindowToScreenPos(ScriptDropDownWindow* nativeInstance, Vector2I position, Vector2I* screenPos);
 	};
 
+	/**
+	 * @brief	Managed implementation of a DropDownWindow. All managed drop down windows
+	 *			are implemented using this class, and the managed instance contains the
+	 *			specifics of each implementation.
+	 */
 	class BS_SCR_BED_EXPORT ManagedDropDownWindow : public DropDownWindow
 	{
 	public:
@@ -44,14 +63,40 @@ namespace BansheeEngine
 			const Vector2I& position, MonoObject* managedInstance, UINT32 width, UINT32 height);
 		~ManagedDropDownWindow();
 
+		/**
+		 * @brief	Initializes the drop down window with the interop object that owns 
+		 *			the managed instance of this window
+		 */
 		void initialize(ScriptDropDownWindow* parent);
+
+		/**
+		 * @brief	Called every frame. Triggers OnEditorUpdate method on the managed object.
+		 */
 		void update() override;
-		void reloadMonoTypes(MonoClass* windowClass);
+
+		/**
+		 * @brief	Trigger the OnInitialize method on the managed object.
+		 */
 		void triggerOnInitialize();
+
+		/**
+		 * @brief	Trigger the OnDestroy method on the managed object.
+		 */
 		void triggerOnDestroy();
 
+		/**
+		 * @brief	Returns the managed instance of the drop down window implementation.
+		 */
 		MonoObject* getManagedInstance() const { return mManagedInstance; }
 
+		/**
+		 * @brief	Reloads all the managed types and methods. Usually called right after
+		 *			construction or after assembly reload.
+		 *
+		 * @param	windowClass	Managed class of the drop down window to retrieve the data for.
+		 */
+		void reloadMonoTypes(MonoClass* windowClass);
+
 	private:
 		friend class ScriptModalWindow;
 

+ 6 - 0
SBansheeEditor/Include/BsScriptEditorApplication.h

@@ -5,6 +5,9 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Interop class between C++ & CLR for EditorApplication.
+	 */
 	class BS_SCR_BED_EXPORT ScriptEditorApplication : public ScriptObject <ScriptEditorApplication>
 	{
 	public:
@@ -13,6 +16,9 @@ namespace BansheeEngine
 	private:
 		ScriptEditorApplication(MonoObject* instance);
 
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static MonoString* internal_GetProjectPath();
 		static MonoString* internal_GetProjectName();
 		static MonoString* internal_GetCompilerPath();

+ 8 - 2
SBansheeEditor/Include/BsScriptEditorBuiltin.h

@@ -5,12 +5,20 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Interop class between C++ & CLR for BuiltinEditorResources.
+	 */
 	class BS_SCR_BED_EXPORT ScriptEditorBuiltin : public ScriptObject <ScriptEditorBuiltin>
 	{
 	public:
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "EditorBuiltin")
 
 	private:
+		ScriptEditorBuiltin(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static MonoObject* internal_getFolderIcon();
 		static MonoObject* internal_getMeshIcon();
 		static MonoObject* internal_getFontIcon();
@@ -22,7 +30,5 @@ namespace BansheeEngine
 		static MonoObject* internal_getMaterialIcon();
 		static MonoObject* internal_getSpriteTextureIcon();
 		static MonoObject* internal_getPrefabIcon();
-
-		ScriptEditorBuiltin(MonoObject* instance);
 	};
 }

+ 6 - 0
SBansheeEditor/Include/BsScriptEditorSettings.h

@@ -5,6 +5,9 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Interop class between C++ & CLR for EditorSettings stored in EditorApplication.
+	 */
 	class BS_SCR_BED_EXPORT ScriptEditorSettings : public ScriptObject < ScriptEditorSettings >
 	{
 	public:
@@ -13,6 +16,9 @@ namespace BansheeEngine
 	private:
 		ScriptEditorSettings(MonoObject* instance);
 
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static bool internal_GetMoveHandleSnapActive();
 		static void internal_SetMoveHandleSnapActive(bool value);
 		static bool internal_GetRotateHandleSnapActive();

+ 0 - 1
TODO.txt

@@ -110,7 +110,6 @@ Other polish:
  - Handle seems to lag behind the selected mesh
  - ProjectLibrary seems to import some files on every start-up
  - Crash on shutdown in mono_gchandle_free
- - Add shortcut keys for view/move/rotate/scale
  - Add "focus on object" key (F) - animate it: rotate camera towards then speed towards while zooming in
  - Ortographic camera views (+ gizmo in scene view corner that shows camera orientation)
  - Drag to select in scene view