Browse Source

Documentation

Marko Pintera 10 years ago
parent
commit
060f7589a4

+ 47 - 10
BansheeEditor/Include/BsGUIColor.h

@@ -7,25 +7,59 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	GUI elements that displays the set color. RGB and alpha
+	 *			values are displayed separately.
+	 */
 	class GUIColor : public GUIElement
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new GUI color element.
+		 *
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIColor* create(const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI color element.
+		 *
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIColor* create(const GUIOptions& options, const String& styleName = StringUtil::BLANK);
 
-		virtual Vector2I _getOptimalSize() const;
+		/**
+		 * @copydoc	GUIElement::_getOptimalSize
+		 */
+		virtual Vector2I _getOptimalSize() const override;
 
+		/**
+		 * @brief	Sets the color to display.
+		 */
 		void setColor(const Color& color);
+
+		/**
+		 * @brief	Returns the currently displayed color.
+		 */
 		Color getColor() const { return mColor; }
 
 		/**
 		 * @copydoc	GUIElement::setTint
 		 */
-		virtual void setTint(const Color& color);
+		virtual void setTint(const Color& color) override;
 
-		Event<void(const Color&)> onValueChanged;
+		Event<void(const Color&)> onValueChanged; /**< Triggered when the displayed color value changes. */
 	protected:
 		GUIColor(const String& styleName, const GUIDimensions& dimensions);
 		virtual ~GUIColor();
@@ -33,35 +67,38 @@ namespace BansheeEngine
 		/**
 		 * @copydoc GUIElement::getNumRenderElements()
 		 */
-		virtual UINT32 _getNumRenderElements() const;
+		virtual UINT32 _getNumRenderElements() const override;
 
 		/**
 		 * @copydoc GUIElement::getMaterial()
 		 */
-		virtual const GUIMaterialInfo& _getMaterial(UINT32 renderElementIdx) const;
+		virtual const GUIMaterialInfo& _getMaterial(UINT32 renderElementIdx) const override;
 
 		/**
 		 * @copydoc GUIElement::getNumQuads()
 		 */
-		virtual UINT32 _getNumQuads(UINT32 renderElementIdx) const;
+		virtual UINT32 _getNumQuads(UINT32 renderElementIdx) const override;
 
 		/**
 		 * @copydoc GUIElement::fillBuffer()
 		 */
 		virtual void _fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, 
-			UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const;
+			UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const override;
 
 		/**
 		 * @copydoc GUIElement::updateRenderElementsInternal()
 		 */
-		virtual void updateRenderElementsInternal();
+		virtual void updateRenderElementsInternal() override;
 
 		/**
 		 * @copydoc GUIElement::updateBounds()
 		 */
-		virtual void updateClippedBounds();
+		virtual void updateClippedBounds() override;
 
-		virtual bool _mouseEvent(const GUIMouseEvent& ev);
+		/**
+		 * @copydoc GUIElement::_mouseEvent()
+		 */
+		virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
 
 	private:
 		static const float ALPHA_SPLIT_POSITION;

+ 33 - 4
BansheeEditor/Include/BsGUIColorField.h

@@ -6,30 +6,59 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	A composite GUI object representing an editor field. Editor fields are a combination
+	 *			of a label and an input field. Label is optional. This specific implementation
+	 *			displays a color input field.
+	 */
 	class BS_ED_EXPORT GUIColorField : public TGUIField<GUIColorField>
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
+
+		/**
+		 * Style type name for the internal color field.
+		 */
 		static const String& getColorInputStyleType();
 
 		GUIColorField(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
 			const String& style, const GUIDimensions& dimensions, bool withLabel);
 
+		/**
+		 * @brief	Returns the value of the field.
+		 */
 		Color getValue() const { return mValue; }
+
+		/**
+		 * @brief	Changes the value of the field.
+		 */
 		void setValue(const Color& value);
 
 		/**
 		 * @copydoc	GUIElement::setTint
 		 */
-		virtual void setTint(const Color& color);
+		virtual void setTint(const Color& color) override;
 
-		Vector2I _getOptimalSize() const;
+		/**
+		 * @copydoc	GUIElement::_getOptimalSize
+		 */
+		Vector2I _getOptimalSize() const override;
 
-		Event<void(const Color&)> onValueChanged;
+		Event<void(const Color&)> onValueChanged; /**< Triggered when the displayed color value changes. */
 	protected:
 		virtual ~GUIColorField();
 
-		void styleUpdated();
+		/**
+		 * @copydoc	GUIElement::styleUpdated
+		 */
+		void styleUpdated() override;
+
+		/**
+		 * @brief	Triggered when the child color input field's value changes.
+		 */
 		void valueChanged(const Color& newValue);
 
 		UINT32 mLabelWidth;

+ 59 - 6
BansheeEditor/Include/BsGUIComponentFoldout.h

@@ -5,45 +5,98 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	GUI element that serves as a title for a Component object. The foldout
+	 *			displays a certain label (e.g. component name) and can be expanded or collapsed.
+	 *
+	 * @note	It's up to the caller to actually hook up what expanding or collapsing the foldout means,
+	 *			internally it just toggles a button.
+	 */
 	class BS_ED_EXPORT GUIComponentFoldout : public GUIElementContainer
 	{
 		struct PrivatelyConstruct {};
 
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
+
+		/**
+		 * Returns the style type name of the internal toggle button.
+		 */
 		static const String& getFoldoutButtonStyleType();
 
+		/**
+		 * @brief	Creates a new GUI component foldout element.
+		 *
+		 * @param	label			Label to display in the foldout title.
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIComponentFoldout* create(const HString& label, const GUIOptions& options, const String& style = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI component foldout element.
+		 *
+		 * @param	label			Label to display in the foldout title.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIComponentFoldout* create(const HString& label, const String& style = StringUtil::BLANK);
 
 		GUIComponentFoldout(const PrivatelyConstruct& dummy, const HString& label, const String& style, const GUIDimensions& dimensions);
 
+		/**
+		 * @brief	Returns whether the foldout is currently expanded or collapsed.
+		 */
 		bool isExpanded() const { return mIsExpanded; }
+
+		/**
+		 * @brief	Expands or collapses the foldout.
+		 */
 		void setExpanded(bool expanded);
 
 		/**
-		 * Changes the label of the foldout.
+		 * Changes the label displayed on the foldout.
 		 */
 		void setContent(const GUIContent& content);
 
 		/**
 		 * @copydoc	GUIElement::setTint
 		 */
-		virtual void setTint(const Color& color);
+		virtual void setTint(const Color& color) override;
 
-		void _updateLayoutInternal(const GUILayoutData& data);
+		/**
+		 * @copydoc	GUIElement::_updateLayoutInternal
+		 */
+		void _updateLayoutInternal(const GUILayoutData& data) override;
 
-		Vector2I _getOptimalSize() const;
+		/**
+		 * @copydoc	GUIElement::_getOptimalSize
+		 */
+		Vector2I _getOptimalSize() const override;
 
 		Event<void(bool)> onStateChanged;
 	protected:
 		virtual ~GUIComponentFoldout();
 
+		/**
+		 * @brief	Triggered when the foldout is expanded or collapsed.
+		 *			True means expanded, false collapsed.
+		 */
 		void toggleTriggered(bool value);
-		void styleUpdated();
 
-		GUIToggle* mToggle;
+		/**
+		 * @copydoc	GUIElement::styleUpdated
+		 */
+		void styleUpdated() override;
 
+		GUIToggle* mToggle;
 		bool mIsExpanded;
 	};
 }

+ 38 - 3
BansheeEditor/Include/BsGUIDockSlider.h

@@ -7,19 +7,54 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	GUI element used by the dock manager to display a slider between
+	 *			two different dock containers. The slider can be vertical or horizontal
+	 *			and will process and report mouse drag events.
+	 *
+	 * @note	It's up to the caller to actually handle the drag events.
+	 */
 	class GUIDockSlider : public GUIButtonBase
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new GUI dock slider element.
+		 *
+		 * @param	horizontal		Should the slider be rendered horizontal or vertical.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIDockSlider* create(bool horizontal, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI dock slider element.
+		 *
+		 * @param	horizontal		Should the slider be rendered horizontal or vertical.
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIDockSlider* create(bool horizontal, const GUIOptions& options, const String& styleName = StringUtil::BLANK);
 
-		Event<void(const Vector2I&)> onDragged;
+		Event<void(const Vector2I&)> onDragged; /**< Triggered while the user is dragging the slider (pointer down and being moved) */
 	protected:
-		virtual bool _mouseEvent(const GUIMouseEvent& ev);
+		/**
+		 * @copydoc	GUIButtonBase::_mouseEvent
+		 */
+		virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
 
-		bool _hasCustomCursor(const Vector2I position, CursorType& type) const;
+		/**
+		 * @copydoc	GUIButtonBase::_hasCustomCursor
+		 */
+		bool _hasCustomCursor(const Vector2I position, CursorType& type) const override;
 	private:
 		Vector2I mLastDragPosition;
 		bool mHorizontal;

+ 37 - 3
BansheeEditor/Include/BsGUIDropButton.h

@@ -10,24 +10,58 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	GUI element that accepts a drag and drop operation of a specified type.
+	 *
+	 * @see		DragAndDropManager
+	 */
 	class BS_ED_EXPORT GUIDropButton : public GUIButtonBase
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new GUI drop button element.
+		 *
+		 * @param	dragType		Identifier of the drag operation to accept.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIDropButton* create(UINT32 dragType, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI drop button element.
+		 *
+		 * @param	dragType		Identifier of the drag operation to accept.
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIDropButton* create(UINT32 dragType, const GUIOptions& options, 
 			const String& styleName = StringUtil::BLANK);
 
-		Event<void(void*)> onDataDropped;
+		Event<void(void*)> onDataDropped; /**< Triggered when drag and drop operation finishes while over the button and is of the correct type. */
 	protected:
 		virtual ~GUIDropButton();
 
 	protected:
 		GUIDropButton(UINT32 dragType, const String& styleName, const GUIDimensions& dimensions);
 
-		virtual bool _mouseEvent(const GUIMouseEvent& ev);
-		virtual bool _acceptDragAndDrop(const Vector2I position, UINT32 typeId) const;
+		/**
+		 * @copydoc	GUIButtonBase::_mouseEvent
+		 */
+		virtual bool _mouseEvent(const GUIMouseEvent& ev) override;
+
+		/**
+		 * @copydoc	GUIButtonBase::_acceptDragAndDrop
+		 */
+		virtual bool _acceptDragAndDrop(const Vector2I position, UINT32 typeId) const override;
 
 		UINT32 mDragType;
 	};

+ 120 - 10
BansheeEditor/Include/BsGUIFieldBase.h

@@ -2,32 +2,48 @@
 
 #include "BsEditorPrerequisites.h"
 #include "BsGUIElementContainer.h"
+#include "BsGUIContent.h"
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Base class for all editor GUI fields. All fields are a combination of
+	 *			an optional label and an input field.
+	 */
 	class BS_ED_EXPORT GUIFieldBase : public GUIElementContainer
 	{
 	protected:
 		struct PrivatelyConstruct {};
 
 	public:
-		GUIFieldBase(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
-			const String& labelStyle, const GUIDimensions& dimensions, bool withLabel);
-
-		void _updateLayoutInternal(const GUILayoutData& data);
-
-		virtual Vector2I _getOptimalSize() const;
-
+		/**
+		 * @brief	Returns the style type name for the internal label element.
+		 */
 		static const String& getLabelStyleType()
 		{
 			static String LABEL_STYLE_TYPE = "EditorFieldLabel";
 			return LABEL_STYLE_TYPE;
 		}
 
+		GUIFieldBase(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
+			const String& labelStyle, const GUIDimensions& dimensions, bool withLabel);
+
+		/**
+		 * @copydoc	GUIElementContainer::_updateLayoutInternal
+		 */
+		void _updateLayoutInternal(const GUILayoutData& data) override;
+
+		/**
+		 * @copydoc	GUIElementContainer::_getOptimalSize
+		 */
+		virtual Vector2I _getOptimalSize() const override;
 	protected:
 		virtual ~GUIFieldBase() { }
 
-		virtual void styleUpdated();
+		/**
+		 * @copydoc	GUIElementContainer::styleUpdated
+		 */
+		virtual void styleUpdated() override;
 
 		static const UINT32 DEFAULT_LABEL_WIDTH;
 
@@ -35,10 +51,24 @@ namespace BansheeEngine
 		GUILabel* mLabel;
 	};
 
+	/**
+	 * @brief	Templated GUI field class that provides common methods needed for constructing an editor field.
+	 */
 	template <class T>
 	class TGUIField : public GUIFieldBase
 	{
 	public:
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelContent	Content to display in the editor field label.
+		 * @param	labelWidth		Width of the label in pixels.
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const GUIContent& labelContent, UINT32 labelWidth, const GUIOptions& options,
 			const String& style = StringUtil::BLANK)
 		{
@@ -50,6 +80,16 @@ namespace BansheeEngine
 				GUIDimensions::create(options), true);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelContent	Content to display in the editor field label.
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const GUIContent& labelContent, const GUIOptions& options,
 			const String& style = StringUtil::BLANK)
 		{
@@ -61,6 +101,17 @@ namespace BansheeEngine
 				GUIDimensions::create(options), true);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelText		String to display in the editor field label.
+		 * @param	labelWidth		Width of the label in pixels.
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const HString& labelText, UINT32 labelWidth, const GUIOptions& options,
 			const String& style = StringUtil::BLANK)
 		{
@@ -72,6 +123,16 @@ namespace BansheeEngine
 				GUIDimensions::create(options), true);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelText		String to display in the editor field label.
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const HString& labelText, const GUIOptions& options,
 			const String& style = StringUtil::BLANK)
 		{
@@ -83,6 +144,15 @@ namespace BansheeEngine
 				GUIDimensions::create(options), true);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field without a label.
+		 *
+		 * @param	options			Options that allow you to control how is the element positioned and sized.
+		 *							This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const GUIOptions& options, const String& style = StringUtil::BLANK)
 		{
 			const String* curStyle = &style;
@@ -93,6 +163,15 @@ namespace BansheeEngine
 				GUIDimensions::create(options), false);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelContent	Content to display in the editor field label.
+		 * @param	labelWidth		Width of the label in pixels.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const GUIContent& labelContent, UINT32 labelWidth,
 			const String& style = StringUtil::BLANK)
 		{
@@ -103,6 +182,14 @@ namespace BansheeEngine
 			return bs_new<T>(PrivatelyConstruct(), labelContent, labelWidth, *curStyle, GUIDimensions::create(), true);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelContent	Content to display in the editor field label.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const GUIContent& labelContent,
 			const String& style = StringUtil::BLANK)
 		{
@@ -114,6 +201,15 @@ namespace BansheeEngine
 				GUIDimensions::create(), true);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelText		String to display in the editor field label.
+		 * @param	labelWidth		Width of the label in pixels.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const HString& labelText, UINT32 labelWidth,
 			const String& style = StringUtil::BLANK)
 		{
@@ -125,8 +221,15 @@ namespace BansheeEngine
 				GUIDimensions::create(), true);
 		}
 
-		static T* create(const HString& labelText,
-			const String& style = StringUtil::BLANK)
+		/**
+		 * @brief	Creates a new GUI editor field with a label.
+		 *
+		 * @param	labelText		String to display in the editor field label.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
+		static T* create(const HString& labelText, const String& style = StringUtil::BLANK)
 		{
 			const String* curStyle = &style;
 			if (*curStyle == StringUtil::BLANK)
@@ -136,6 +239,13 @@ namespace BansheeEngine
 				GUIDimensions::create(), true);
 		}
 
+		/**
+		 * @brief	Creates a new GUI editor field without a label.
+		 *
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static T* create(const String& style = StringUtil::BLANK)
 		{
 			const String* curStyle = &style;

+ 1 - 0
TODO.txt

@@ -69,6 +69,7 @@ There's a large hang when doing certain operations like selecting a mesh in scen
 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)
 ProjectLibrary seems to import some files on every start-up
+Handles don't seem to move at the same speed at the selected mesh (mostly visible with move handle)
 
 First screenshot work:
 - Inspector change contents on selection (and make sure the selected object/component looks okay)