Marko Pintera před 10 roky
rodič
revize
652eab59a3

+ 21 - 2
BansheeEditor/Include/BsCmdEditPlainFieldGO.h

@@ -7,6 +7,11 @@
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
 	// TODO - This is only valid for plain field types. Add something similar for pointers and/or arrays?
 	// TODO - This is only valid for plain field types. Add something similar for pointers and/or arrays?
+	/**
+	 * @brief	A command used for undo/redo purposes. It records a value of a single RTTI field and
+	 *			using the provided interface allows you to commit a change to that field, or restore
+	 *			it to the original value.
+	 */
 	template<class T>
 	template<class T>
 	class CmdEditPlainFieldGO : public EditorCommand
 	class CmdEditPlainFieldGO : public EditorCommand
 	{
 	{
@@ -20,6 +25,14 @@ namespace BansheeEngine
 				bs_free(mOldData);
 				bs_free(mOldData);
 		}
 		}
 
 
+		/**
+		 * @brief	Creates and executes the command on the provided object and field.
+		 *			Automatically registers the command with undo/redo system.
+		 *
+		 * @param	gameObject	Game object to search for the field.
+		 * @param	fieldName	RTTI name of the field.
+		 * @param	fieldValue	New value for the field.
+		 */
 		static void execute(const GameObjectHandleBase& gameObject, const String& fieldName, const T& fieldValue)
 		static void execute(const GameObjectHandleBase& gameObject, const String& fieldName, const T& fieldValue)
 		{
 		{
 			// Register command and commit it
 			// Register command and commit it
@@ -28,7 +41,10 @@ namespace BansheeEngine
 			command->commit();
 			command->commit();
 		}
 		}
 
 
-		void commit()
+		/**
+		 * @copydoc	EditorCommand::commit
+		 */
+		void commit() override
 		{
 		{
 			if(mGameObject.isDestroyed())
 			if(mGameObject.isDestroyed())
 				return;
 				return;
@@ -40,7 +56,10 @@ namespace BansheeEngine
 			rtti->setPlainValue(mGameObject.get(), mFieldName, fieldValue);
 			rtti->setPlainValue(mGameObject.get(), mFieldName, fieldValue);
 		}
 		}
 
 
-		void revert()
+		/**
+		 * @copydoc	EditorCommand::revert
+		 */
+		void revert() override
 		{
 		{
 			if(mGameObject.isDestroyed())
 			if(mGameObject.isDestroyed())
 				return;
 				return;

+ 20 - 2
BansheeEditor/Include/BsCmdInputFieldValueChange.h

@@ -6,10 +6,22 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	A command used for undo/redo purposes. It records a value of a GUI input field
+	 *			(specified by template type) and allows you to apply or revert a change to that field
+	 *			as needed.
+	 */
 	template <class InputFieldType, class ValueType>
 	template <class InputFieldType, class ValueType>
 	class CmdInputFieldValueChange : public EditorCommand
 	class CmdInputFieldValueChange : public EditorCommand
 	{
 	{
 	public:
 	public:
+		/**
+		 * @brief	Creates and executes the command on the provided object and field.
+		 *			Automatically registers the command with undo/redo system.
+		 *
+		 * @param	inputField	Input field to modify the value on.
+		 * @param	value		New value for the field.
+		 */
 		static void execute(InputFieldType* inputField, const ValueType& value)
 		static void execute(InputFieldType* inputField, const ValueType& value)
 		{
 		{
 			CmdInputFieldValueChange* command = new (bs_alloc<CmdInputFieldValueChange>()) CmdInputFieldValueChange(inputField, value);
 			CmdInputFieldValueChange* command = new (bs_alloc<CmdInputFieldValueChange>()) CmdInputFieldValueChange(inputField, value);
@@ -17,12 +29,18 @@ namespace BansheeEngine
 			command->commit();
 			command->commit();
 		}
 		}
 
 
-		void commit()
+		/**
+		 * @copydoc	EditorCommand::commit
+		 */
+		void commit() override
 		{
 		{
 			mInputField->setValue(mNewValue);
 			mInputField->setValue(mNewValue);
 		}
 		}
 
 
-		void revert()
+		/**
+		 * @copydoc	EditorCommand::revert
+		 */
+		void revert() override
 		{
 		{
 			mInputField->setValue(mOldValue);
 			mInputField->setValue(mOldValue);
 		}
 		}

+ 52 - 2
BansheeEditor/Include/BsCmdRecordSO.h

@@ -6,8 +6,21 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	A command used for undo/redo purposes. It records a state of the entire
+	 *			scene object at a specific point and allows you to restore it to its
+	 *			original values as needed.
+	 */
 	class CmdRecordSO : public EditorCommand
 	class CmdRecordSO : public EditorCommand
 	{
 	{
+		/**
+		 * @brief	Contains stored information about stored scene object instance data,
+		 *			including all of its children and components.
+		 *
+		 * @note	When object is serialized it will receive new instance data (as if it was a new
+		 *			object). But we want to restore the original object completely (including any references
+		 *			other objects might have to it) so we need store the instance data.
+		 */
 		struct SceneObjProxy
 		struct SceneObjProxy
 		{
 		{
 			GameObjectInstanceDataPtr instanceData;
 			GameObjectInstanceDataPtr instanceData;
@@ -19,18 +32,55 @@ namespace BansheeEngine
 	public:
 	public:
 		~CmdRecordSO();
 		~CmdRecordSO();
 
 
+		/**
+		 * @brief	Creates and executes the command on the provided scene object.
+		 *			Automatically registers the command with undo/redo system.
+		 *
+		 * @param	inputField	Input field to modify the value on.
+		 * @param	value		New value for the field.
+		 */
 		static void execute(const HSceneObject& sceneObject);
 		static void execute(const HSceneObject& sceneObject);
 
 
-		void commit();
-		void revert();
+		/**
+		 * @copydoc	EditorCommand::commit
+		 */
+		void commit() override;
+
+		/**
+		 * @copydoc	EditorCommand::revert
+		 */
+		void revert() override;
 
 
 	private:
 	private:
 		friend class UndoRedo;
 		friend class UndoRedo;
 
 
 		CmdRecordSO(const HSceneObject& sceneObject);
 		CmdRecordSO(const HSceneObject& sceneObject);
+
+		/**
+		 * @brief	Saves the state of the specified object, all of its children
+		 *			and components. Make sure to call "clear" when you no longer need
+		 *			the data, or wish to call this method again.
+		 */
 		void recordSO(const HSceneObject& sceneObject);
 		void recordSO(const HSceneObject& sceneObject);
+
+		/**
+		 * @brief	Clears all the stored data and frees memory.
+		 */
 		void clear();
 		void clear();
+
+		/**
+		 * @brief	Parses the scene object hierarchy and components and generates a
+		 *			hierarchy of instance data required to restore the object identities.
+		 *
+		 * @see		SceneObjProxy
+		 */
 		SceneObjProxy createProxy(const HSceneObject& sceneObject);
 		SceneObjProxy createProxy(const HSceneObject& sceneObject);
+
+		/**
+		 * @brief	Restores original object instance data after deserialization.
+		 *
+		 * @see		SceneObjProxy
+		 */
 		void restoreIds(const HSceneObject& restored);
 		void restoreIds(const HSceneObject& restored);
 
 
 		HSceneObject mSceneObject;
 		HSceneObject mSceneObject;

+ 21 - 2
BansheeEditor/Include/BsCmdReparentSO.h

@@ -6,13 +6,32 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	A command used for undo/redo purposes. It records a scene object
+	 *			parent change operations. It allows you to apply the parent change
+	 *			or revert the object to its original parent as needed.
+	 */
 	class CmdReparentSO : public EditorCommand
 	class CmdReparentSO : public EditorCommand
 	{
 	{
 	public:
 	public:
+		/**
+		 * @brief	Creates and executes the command on the provided scene object.
+		 *			Automatically registers the command with undo/redo system.
+		 *
+		 * @param	sceneObjects	Object(s) to change the parent for.
+		 * @param	newParent		New parent for the provided objects.
+		 */
 		static void execute(const Vector<HSceneObject>& sceneObjects, const HSceneObject& newParent);
 		static void execute(const Vector<HSceneObject>& sceneObjects, const HSceneObject& newParent);
 
 
-		void commit();
-		void revert();
+		/**
+		 * @copydoc	EditorCommand::commit
+		 */
+		void commit() override;
+
+		/**
+		 * @copydoc	EditorCommand::revert
+		 */
+		void revert() override;
 
 
 	private:
 	private:
 		friend class UndoRedo;
 		friend class UndoRedo;

+ 15 - 0
BansheeEditor/Include/BsEditorCommand.h

@@ -4,14 +4,29 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	A command used for undo/redo purposes. It records a change occurring on
+	 *			some object and allows you to apply or revert that change as needed.
+	 */
 	class EditorCommand
 	class EditorCommand
 	{
 	{
 	public:
 	public:
 		virtual ~EditorCommand() { }
 		virtual ~EditorCommand() { }
 
 
+		/**
+		 * @brief	Applies the command, commiting the change.
+		 */
 		virtual void commit() { }
 		virtual void commit() { }
+
+		/**
+		 * @brief	Reverts the command, reverting the change previously
+		 *			done with "commit".
+		 */
 		virtual void revert() { }
 		virtual void revert() { }
 
 
+		/**
+		 * @brief	Deletes the command.
+		 */
 		static void destroy(EditorCommand* command);
 		static void destroy(EditorCommand* command);
 	};
 	};
 }
 }

+ 14 - 25
TODO.txt

@@ -37,6 +37,8 @@ Add "dirty object" system to C#. Each ScriptResource and ScriptGameObject should
   - An object or component is removed from the scene
   - An object or component is removed from the scene
   - An object is reparented
   - An object is reparented
   - When component or resource is modified from inspector
   - When component or resource is modified from inspector
+ - Record all portions where objects & components get modified so I can mark them dirty, will likely need
+    to use those some points for undo/redo
 
 
 TODO - Later - When building level for release make sure to clear all prefab diffs (possibly store them elsewhere in the first place)
 TODO - Later - When building level for release make sure to clear all prefab diffs (possibly store them elsewhere in the first place)
        - And all prefab instances should have updateFromPrefab called on them.
        - And all prefab instances should have updateFromPrefab called on them.
@@ -57,26 +59,19 @@ Code quality improvements:
 Polish stage 1
 Polish stage 1
 
 
 Handles:
 Handles:
-Setting rotation to an SO and then adding a child to it will incorrectly transform the child (scaling/skewing it)
+In some cases it's really hard to rotate or the rotation twitches
+When rotating the handle (and sometimes immediately in global mode) the rotation direction is opposite of move movement
 Move plane handles could be more precise
 Move plane handles could be more precise
-Rotations around center incorrectly move and rotate the rotation gizmos
-Investigate rotation local/global (also move, I don't think its implemented properly, I seem to be modifying only Position)
-Investigate scale
+Investigate scale and its issues
 Check multi-select move/Rotate/scale
 Check multi-select move/Rotate/scale
-Rotation disc normals are wrong on one side (likely it's double-sided)
 Free rotation handle doesn't seem to be implemented
 Free rotation handle doesn't seem to be implemented
 
 
-There's a large hang when doing certain operations like selecting a mesh in scene, or switching from center to pivot mode
+There's a large hang when doing certain operations like selecting a mesh in scene, or switching from center to pivot mode (possibly GC?)
 Crash on shutdown in mono_gchandle_free
 Crash on shutdown in mono_gchandle_free
 When selecting an gizmo icon the selection seems delayed and its gizmos flash for a frame before hiding (Can't reproduce atm but I saw it)
 When selecting an gizmo icon the selection seems delayed and its gizmos flash for a frame before hiding (Can't reproduce atm but I saw it)
-Decent looking default layout
 ProjectLibrary seems to import some files on every start-up
 ProjectLibrary seems to import some files on every start-up
 Selection rendering seems to be delayed 1 frame (noticeable when rotating/moving)
 Selection rendering seems to be delayed 1 frame (noticeable when rotating/moving)
 
 
-Fix handles
- - Some handle functionality is unfinished
- - Moving around XZ plane seems to be wrong (it doesn't move as fast as the mouse)
-
 SceneTreeView
 SceneTreeView
  - Hook up ping effect so it triggers when I select a resource or sceneobject
  - Hook up ping effect so it triggers when I select a resource or sceneobject
  - See if it needs other enhancements (rename, delete all work properly? etc.)
  - See if it needs other enhancements (rename, delete all work properly? etc.)
@@ -94,25 +89,19 @@ Need a way to add scene objects and components (and remove them)
 Add shortcut keys for view/move/rotate/scale
 Add shortcut keys for view/move/rotate/scale
 Add "focus on object" key (F)
 Add "focus on object" key (F)
 
 
-For later: I could record undo/redo per-property using the new diff system
-Remember: Record all portions where objects & components get modified so I can mark them dirty, will likely need
- to use those some points for undo/redo
-
-UndoRedo reminders:
- - When breaking or reverting a scene object
-
-When building game make sure to go over texture resources and ensure they are saved in the valid format
-as we don't want to do format conversion at runtime (Not cruical, but it should be done eventually)
- - This should something similar to Unity where when changing the platform all resources get reimported
-
-Later:
- - Save the default editor layout somewhere and make sure its used on initial startup when no layout exists
-
 Will need a status bar:
 Will need a status bar:
  - Displays last error message
  - Displays last error message
  - Opens up console on click
  - Opens up console on click
  - Indicator when compiling
  - Indicator when compiling
 
 
+Later:
+ - I could record undo/redo per-property using the new diff system
+ - When building game make sure to go over texture resources and ensure they are saved in the valid format
+   as we don't want to do format conversion at runtime (Not cruical, but it should be done eventually)
+   - This should something similar to Unity where when changing the platform all resources get reimported
+ - Save the default editor layout somewhere and make sure its used on initial startup when no layout exists
+ - Undo/Redo when breaking or reverting a scene object
+
 ----------------------------------------------------------------------
 ----------------------------------------------------------------------
 Project window
 Project window