Marko Pintera 10 gadi atpakaļ
vecāks
revīzija
8f1f75bd91

+ 6 - 0
SBansheeEditor/Include/BsScriptHandleDrawing.h

@@ -9,12 +9,18 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleDrawManager.
+	 */
 	class BS_SCR_BED_EXPORT ScriptHandleDrawing : public ScriptObject <ScriptHandleDrawing>
 	class BS_SCR_BED_EXPORT ScriptHandleDrawing : public ScriptObject <ScriptHandleDrawing>
 	{
 	{
 	public:
 	public:
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleDrawing")
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleDrawing")
 
 
 	private:
 	private:
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static void internal_SetColor(Color color);
 		static void internal_SetColor(Color color);
 		static void internal_SetTransform(Matrix4 transform);
 		static void internal_SetTransform(Matrix4 transform);
 
 

+ 71 - 3
SBansheeEditor/Include/BsScriptHandleManager.h

@@ -6,8 +6,17 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Renders, updates and manipulates handles declared in managed code.
+	 *			Managed code handles have a [CustomHandle] attribute and must implement
+	 *			BansheeEditor.Handle.
+	 */
 	class BS_SCR_BED_EXPORT ScriptHandleManager : public HandleManager
 	class BS_SCR_BED_EXPORT ScriptHandleManager : public HandleManager
 	{
 	{
+		/**
+		 * @brief	Contains data about a manage type that draws and handles
+		 *			interaction with a custom handle.
+		 */
 		struct CustomHandleData
 		struct CustomHandleData
 		{
 		{
 			MonoClass* handleType;
 			MonoClass* handleType;
@@ -15,12 +24,23 @@ namespace BansheeEngine
 			MonoMethod* ctor;
 			MonoMethod* ctor;
 		};
 		};
 
 
+		/**
+		 * @brief	Data about an active instance of a managed custom handle object.
+		 *			Active handle means its scene object is currently selected and the
+		 *			handle is displayed and can be interacted with.
+		 */
 		struct ActiveCustomHandleData
 		struct ActiveCustomHandleData
 		{
 		{
 			MonoObject* object;
 			MonoObject* object;
 			uint32_t gcHandle;
 			uint32_t gcHandle;
 		};
 		};
 
 
+		/**
+		 * @brief	Data about all active managed custom handle objects
+		 *			for a specific scene object. Active handle means its 
+		 *			scene object is currently selected and the handle is displayed 
+		 *			and can be interacted with.
+		 */
 		struct ActiveCustomHandles
 		struct ActiveCustomHandles
 		{
 		{
 			HSceneObject selectedObject;
 			HSceneObject selectedObject;
@@ -32,16 +52,64 @@ namespace BansheeEngine
 		~ScriptHandleManager();
 		~ScriptHandleManager();
 
 
 	protected:
 	protected:
-		void refreshHandles();
-		void triggerHandles();
-		void queueDrawCommands();
+		/**
+		 * @copydoc	HandleManager::refreshHandles
+		 */
+		void refreshHandles() override;
 
 
+		/**
+		 * @copydoc	HandleManager::triggerHandles
+		 */
+		void triggerHandles() override;
+
+		/**
+		 * @copydoc	HandleManager::queueDrawCommands
+		 */
+		void queueDrawCommands() override;
+
+		/**
+		 * @brief	Reloads internal managed assembly types and finds all custom handle classes.
+		 *			Must be called after construction and after assembly reload.
+		 */
 		void reloadAssemblyData();
 		void reloadAssemblyData();
+
+		/**
+		 * @brief	Checks is the provided type a valid custom handle class. Custom handles
+		 *			must have a [CustomHandle] attribute and must implement BansheeEditor.Handle.
+		 *
+		 * @param	type			Type to check.
+		 * @param	componentType	Component type for which the handle should be displayed for. Handle will not
+		 *							be displayed unless a component of this type is selected. Only valid if method returns true.
+		 * @param	ctor			Constructor method for the handle type. Only valid if method returns true.
+		 *
+		 * @return	True if the type is a valid custom handle type.
+		 */
 		bool isValidHandleType(MonoClass* type, MonoClass*& componentType, MonoMethod*& ctor);
 		bool isValidHandleType(MonoClass* type, MonoClass*& componentType, MonoMethod*& ctor);
 
 
+		/**
+		 * @brief	Triggers the PreInput method on the provided Handle object. Pre
+		 *			input happens before any handles are selected or moved and allows you
+		 *			to position the handles or prepare them in some other way.
+		 */
 		void callPreInput(MonoObject* instance);
 		void callPreInput(MonoObject* instance);
+
+		/**
+		 * @brief	Triggers the PostInput method on the provided Handle object.
+		 *			Post input happens after we know in what way has the user interacted
+		 *			with the handles this frame.
+		 */
 		void callPostInput(MonoObject* instance);
 		void callPostInput(MonoObject* instance);
+
+		/**
+		 * @brief	Triggers the Draw method on the provided Handle object. Draw allows
+		 *			you to draw the visual representation of the handles. Called after PostInput.
+		 */
 		void callDraw(MonoObject* instance);
 		void callDraw(MonoObject* instance);
+
+		/**
+		 * @brief	Triggers the Destroy method on the provided Handle object. Destroy
+		 *			is called when the handle is no longer being displayed.
+		 */
 		void callDestroy(MonoObject* instance);
 		void callDestroy(MonoObject* instance);
 
 
 		ScriptAssemblyManager& mScriptObjectManager;
 		ScriptAssemblyManager& mScriptObjectManager;

+ 22 - 2
SBansheeEditor/Include/BsScriptHandleSlider.h

@@ -8,28 +8,50 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Base class for all C++/CLR interop objects that deal with handle sliders.
+	 */
 	class BS_SCR_BED_EXPORT ScriptHandleSliderBase : public ScriptObjectBase
 	class BS_SCR_BED_EXPORT ScriptHandleSliderBase : public ScriptObjectBase
 	{
 	{
 	public:
 	public:
 		ScriptHandleSliderBase(MonoObject* managedInstance);
 		ScriptHandleSliderBase(MonoObject* managedInstance);
 		virtual ~ScriptHandleSliderBase() { }
 		virtual ~ScriptHandleSliderBase() { }
 
 
+		/**
+		 * @brief	Returns the internal native handle slider.
+		 */
 		virtual HandleSlider* getSlider() const = 0;
 		virtual HandleSlider* getSlider() const = 0;
 
 
 	protected:
 	protected:
 		friend class ScriptHandleSlider;
 		friend class ScriptHandleSlider;
 		friend class ScriptHandleSliderManager;
 		friend class ScriptHandleSliderManager;
 
 
+		/**
+		 * @brief	Destroys the internal native handle slider and unregisters it with
+		 *			with handle manager.
+		 */
 		void destroy();
 		void destroy();
+
+		/**
+		 * @brief	Destroys the internal native handle slider.
+		 */
 		virtual void destroyInternal() = 0;
 		virtual void destroyInternal() = 0;
 	};
 	};
 
 
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleSlider.
+	 */
 	class BS_SCR_BED_EXPORT ScriptHandleSlider : public ScriptObject <ScriptHandleSlider>
 	class BS_SCR_BED_EXPORT ScriptHandleSlider : public ScriptObject <ScriptHandleSlider>
 	{
 	{
 	public:
 	public:
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSlider")
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSlider")
 
 
 	private:
 	private:
+		ScriptHandleSlider(MonoObject* instance);
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
 		static void internal_Destroy(ScriptHandleSliderBase* nativeInstance);
 		static void internal_Destroy(ScriptHandleSliderBase* nativeInstance);
 		static void internal_GetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value);
 		static void internal_GetPosition(ScriptHandleSliderBase* nativeInstance, Vector3* value);
 		static void internal_SetPosition(ScriptHandleSliderBase* nativeInstance, Vector3 value);
 		static void internal_SetPosition(ScriptHandleSliderBase* nativeInstance, Vector3 value);
@@ -38,7 +60,5 @@ namespace BansheeEngine
 		static void internal_GetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value);
 		static void internal_GetScale(ScriptHandleSliderBase* nativeInstance, Vector3* value);
 		static void internal_SetScale(ScriptHandleSliderBase* nativeInstance, Vector3 value);
 		static void internal_SetScale(ScriptHandleSliderBase* nativeInstance, Vector3 value);
 		static void internal_GetState(ScriptHandleSliderBase* nativeInstance, HandleSlider::State* value);
 		static void internal_GetState(ScriptHandleSliderBase* nativeInstance, HandleSlider::State* value);
-
-		ScriptHandleSlider(MonoObject* instance);
 	};
 	};
 }
 }

+ 20 - 7
SBansheeEditor/Include/BsScriptHandleSliderDisc.h

@@ -8,24 +8,37 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleSliderDisc.
+	 */
 	class BS_SCR_BED_EXPORT ScriptHandleSliderDisc : public ScriptObject <ScriptHandleSliderDisc, ScriptHandleSliderBase>
 	class BS_SCR_BED_EXPORT ScriptHandleSliderDisc : public ScriptObject <ScriptHandleSliderDisc, ScriptHandleSliderBase>
 	{
 	{
 	public:
 	public:
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderDisc")
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderDisc")
 
 
 	protected:
 	protected:
-		virtual HandleSlider* getSlider() const { return mSlider; }
-		virtual void destroyInternal();
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual HandleSlider* getSlider() const override { return mSlider; }
 
 
-	private:
-		static void internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale);
-		static void internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value);
-		static void internal_GetStartAngle(ScriptHandleSliderDisc* nativeInstance, float* value);
-		static void internal_SetCutoffPlane(ScriptHandleSliderDisc* nativeInstance, float value, bool enabled);
+		/**
+		 * @copydoc	ScriptHandleSliderBase::destroyInternal
+		 */
+		virtual void destroyInternal() override;
 
 
+	private:
 		ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale);
 		ScriptHandleSliderDisc(MonoObject* instance, const Vector3& normal, float radius, bool fixedScale);
 		~ScriptHandleSliderDisc();
 		~ScriptHandleSliderDisc();
 
 
 		HandleSliderDisc* mSlider;
 		HandleSliderDisc* mSlider;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, Vector3 normal, float radius, bool fixedScale);
+		static void internal_GetDelta(ScriptHandleSliderDisc* nativeInstance, float* value);
+		static void internal_GetStartAngle(ScriptHandleSliderDisc* nativeInstance, float* value);
+		static void internal_SetCutoffPlane(ScriptHandleSliderDisc* nativeInstance, float value, bool enabled);
 	};
 	};
 }
 }

+ 18 - 5
SBansheeEditor/Include/BsScriptHandleSliderLine.h

@@ -8,22 +8,35 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Interop class between C++ & CLR for HandleSliderLine.
+	 */
 	class BS_SCR_BED_EXPORT ScriptHandleSliderLine : public ScriptObject <ScriptHandleSliderLine, ScriptHandleSliderBase>
 	class BS_SCR_BED_EXPORT ScriptHandleSliderLine : public ScriptObject <ScriptHandleSliderLine, ScriptHandleSliderBase>
 	{
 	{
 	public:
 	public:
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderLine")
 		SCRIPT_OBJ(EDITOR_ASSEMBLY, "BansheeEditor", "HandleSliderLine")
 
 
 	protected:
 	protected:
-		virtual HandleSlider* getSlider() const { return mSlider; }
-		virtual void destroyInternal();
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual HandleSlider* getSlider() const override { return mSlider; }
 
 
-	private:
-		static void internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale);
-		static void internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value);
+		/**
+		 * @copydoc	ScriptHandleSliderBase::getSlider
+		 */
+		virtual void destroyInternal() override;
 
 
+	private:
 		ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale);
 		ScriptHandleSliderLine(MonoObject* instance, const Vector3& direction, float length, bool fixedScale);
 		~ScriptHandleSliderLine();
 		~ScriptHandleSliderLine();
 
 
 		HandleSliderLine* mSlider;
 		HandleSliderLine* mSlider;
+
+		/************************************************************************/
+		/* 								CLR HOOKS						   		*/
+		/************************************************************************/
+		static void internal_CreateInstance(MonoObject* instance, Vector3 direction, float length, bool fixedScale);
+		static void internal_GetDelta(ScriptHandleSliderLine* nativeInstance, float* value);
 	};
 	};
 }
 }

+ 0 - 1
TODO.txt

@@ -69,7 +69,6 @@ Ribek use:
  - Test release mode
  - Test release mode
  - Ability to create assets in Project view (At least Material)
  - 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, needed for GUI editing) GUISkin resource inspector & a way to inspect and save the default editor skin
-   - Will need C# wrapper for GUISkin (and a way to assign the current skin to a window)
 
 
 First screenshot:
 First screenshot:
  - Additional menu bar items: 
  - Additional menu bar items: