Browse Source

Merge pull request #1179 from AtomicGameEngine/JME-ATOMIC-1166

Misc enhancements including fix for focusing skeletal models
JoshEngebretson 9 years ago
parent
commit
fdc2c97172

+ 3 - 1
Script/AtomicEditor/ui/frames/HierarchyFrame.ts

@@ -73,6 +73,8 @@ class HierarchyFrame extends Atomic.UIWidget {
         this.subscribeToEvent(EditorEvents.EditorResourceClose, (data) => this.handleEditorResourceClosed(data));
         this.subscribeToEvent(EditorEvents.EditorResourceClose, (data) => this.handleEditorResourceClosed(data));
         this.subscribeToEvent(EditorEvents.ActiveSceneEditorChange, (data) => this.handleActiveSceneEditorChanged(data));
         this.subscribeToEvent(EditorEvents.ActiveSceneEditorChange, (data) => this.handleActiveSceneEditorChanged(data));
 
 
+        this.searchEdit.subscribeToEvent(this.searchEdit, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+
         // on mouse up clear the list's drag object
         // on mouse up clear the list's drag object
         this.subscribeToEvent("MouseButtonUp", () => {
         this.subscribeToEvent("MouseButtonUp", () => {
             // handle dropping on hierarchy, moving node, dropping prefabs, etc
             // handle dropping on hierarchy, moving node, dropping prefabs, etc
@@ -457,7 +459,7 @@ class HierarchyFrame extends Atomic.UIWidget {
 
 
         } else if (data.type == Atomic.UI_EVENT_TYPE_CLICK) {
         } else if (data.type == Atomic.UI_EVENT_TYPE_CLICK) {
 
 
-            if (this.menu.handleNodeContextMenu(data.target, data.refid)) {
+            if (this.menu.handleNodeContextMenu(data.target, data.refid, this.sceneEditor)) {
                 return true;
                 return true;
             }
             }
 
 

+ 2 - 0
Script/AtomicEditor/ui/frames/ProjectFrame.ts

@@ -77,6 +77,8 @@ class ProjectFrame extends ScriptWidget {
         this.subscribeToEvent("AssetRenamed", (ev: ToolCore.AssetRenamedEvent) => this.handleAssetRenamed(ev));
         this.subscribeToEvent("AssetRenamed", (ev: ToolCore.AssetRenamedEvent) => this.handleAssetRenamed(ev));
         this.subscribeToEvent(EditorEvents.InspectorProjectReference, (ev: EditorEvents.InspectorProjectReferenceEvent) => { this.handleInspectorProjectReferenceHighlight(ev.path); });
         this.subscribeToEvent(EditorEvents.InspectorProjectReference, (ev: EditorEvents.InspectorProjectReferenceEvent) => { this.handleInspectorProjectReferenceHighlight(ev.path); });
 
 
+        this.searchEdit.subscribeToEvent(this.searchEdit, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+
         folderList.subscribeToEvent("UIListViewSelectionChanged", (event: Atomic.UIListViewSelectionChangedEvent) => this.handleFolderListSelectionChangedEvent(event));
         folderList.subscribeToEvent("UIListViewSelectionChanged", (event: Atomic.UIListViewSelectionChangedEvent) => this.handleFolderListSelectionChangedEvent(event));
 
 
         // this.subscribeToEvent(EditorEvents.ResourceFolderCreated, (ev: EditorEvents.ResourceFolderCreatedEvent) => this.handleResourceFolderCreated(ev));
         // this.subscribeToEvent(EditorEvents.ResourceFolderCreated, (ev: EditorEvents.ResourceFolderCreatedEvent) => this.handleResourceFolderCreated(ev));

+ 3 - 1
Script/AtomicEditor/ui/frames/menus/HierarchyFrameMenu.ts

@@ -85,7 +85,7 @@ class HierarchyFrameMenus extends Atomic.ScriptObject {
 
 
     }
     }
 
 
-    handleNodeContextMenu(target: Atomic.UIWidget, refid: string): boolean {
+    handleNodeContextMenu(target: Atomic.UIWidget, refid: string, editor: Editor.SceneEditor3D): boolean {
 
 
         if (target.id == "node context menu") {
         if (target.id == "node context menu") {
 
 
@@ -106,6 +106,8 @@ class HierarchyFrameMenus extends Atomic.ScriptObject {
                 node.remove();
                 node.remove();
                 scene.sendEvent("SceneEditAddRemoveNodes", { end: true });
                 scene.sendEvent("SceneEditAddRemoveNodes", { end: true });
 
 
+                editor.selection.delete();
+
                 return true;
                 return true;
 
 
             } else if (refid == "duplicate_node") {
             } else if (refid == "duplicate_node") {

+ 2 - 0
Script/AtomicEditor/ui/modal/ResourceSelection.ts

@@ -52,6 +52,8 @@ class ResourceSelection extends ModalWindow {
         this.setSize(800, 600);
         this.setSize(800, 600);
         this.center();
         this.center();
 
 
+        this.searchEdit.subscribeToEvent(this.searchEdit, "WidgetEvent", (data) => this.handleWidgetEvent(data));
+
     }
     }
 
 
     //adjusted to delete current folderlist and replace with search list if search is activated
     //adjusted to delete current folderlist and replace with search list if search is activated

+ 9 - 1
Source/Atomic/Graphics/AnimatedModel.cpp

@@ -1044,7 +1044,15 @@ void AnimatedModel::OnWorldBoundingBoxUpdate()
     if (isMaster_)
     if (isMaster_)
     {
     {
         // Note: do not update bone bounding box here, instead do it in either of the threaded updates
         // Note: do not update bone bounding box here, instead do it in either of the threaded updates
-        worldBoundingBox_ = boneBoundingBox_.Transformed(node_->GetWorldTransform());
+
+        // ATOMIC BEGIN
+        // We don't create bones in the editor currently, so use model instead of bone bounds
+        // https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1178
+        if (context_->GetEditorContext())
+            worldBoundingBox_ = boundingBox_.Transformed(node_->GetWorldTransform());
+        else
+            worldBoundingBox_ = boneBoundingBox_.Transformed(node_->GetWorldTransform());
+        // ATOMIC END
     }
     }
     else
     else
     {
     {

+ 16 - 1
Source/ThirdParty/TurboBadger/tb_widgets.cpp

@@ -66,6 +66,7 @@ TBWidget::PaintProps::PaintProps()
 TBWidget::TBWidget()
 TBWidget::TBWidget()
     : m_parent(nullptr)
     : m_parent(nullptr)
     , m_opacity(1.f)
     , m_opacity(1.f)
+    , m_disabledOpacity(-1.0f)
     , m_state(WIDGET_STATE_NONE)
     , m_state(WIDGET_STATE_NONE)
     , m_gravity(WIDGET_GRAVITY_DEFAULT)
     , m_gravity(WIDGET_GRAVITY_DEFAULT)
     , m_layout_params(nullptr)
     , m_layout_params(nullptr)
@@ -259,6 +260,17 @@ void TBWidget::SetOpacity(float opacity)
     Invalidate();
     Invalidate();
 }
 }
 
 
+void TBWidget::SetDisabledOpacity(float opacity)
+{
+    opacity = Clamp(opacity, -1.f, 1.f);
+    if (m_disabledOpacity == opacity)
+        return;
+    if (opacity == 0) // Invalidate after setting opacity 0 will do nothing.
+        Invalidate();
+    m_disabledOpacity = opacity;
+    Invalidate();
+}
+
 void TBWidget::SetVisibilility(WIDGET_VISIBILITY vis)
 void TBWidget::SetVisibilility(WIDGET_VISIBILITY vis)
 {
 {
     if (m_packed.visibility == vis)
     if (m_packed.visibility == vis)
@@ -1161,7 +1173,10 @@ float TBWidget::CalculateOpacityInternal(WIDGET_STATE state, TBSkinElement *skin
     if (skin_element)
     if (skin_element)
         opacity *= skin_element->opacity;
         opacity *= skin_element->opacity;
     if (state & WIDGET_STATE_DISABLED)
     if (state & WIDGET_STATE_DISABLED)
-        opacity *= g_tb_skin->GetDefaultDisabledOpacity();
+        if (m_disabledOpacity < 0.0f)
+            opacity *= g_tb_skin->GetDefaultDisabledOpacity();
+        else
+            opacity *= m_disabledOpacity;
     return opacity;
     return opacity;
 }
 }
 
 

+ 7 - 0
Source/ThirdParty/TurboBadger/tb_widgets.h

@@ -461,6 +461,12 @@ public:
     void SetOpacity(float opacity);
     void SetOpacity(float opacity);
     float GetOpacity() const { return m_opacity; }
     float GetOpacity() const { return m_opacity; }
 
 
+    /** Set opacity for this widget and its children from 0.0 - 1.0 when in WIDGET_STATE_DISABLED.
+    If disabled opacity is < 0, default skin opacity will be used.
+    If opacity is 0 (invisible), the widget won't receive any input. */
+    void SetDisabledOpacity(float opacity);
+    float GetDisabledOpacity() const { return m_disabledOpacity; }
+
     /** Set visibility for this widget and its children.
     /** Set visibility for this widget and its children.
         If visibility is not WIDGET_VISIBILITY_VISIBLE, the widget won't receive any input. */
         If visibility is not WIDGET_VISIBILITY_VISIBLE, the widget won't receive any input. */
     void SetVisibilility(WIDGET_VISIBILITY vis);
     void SetVisibilility(WIDGET_VISIBILITY vis);
@@ -1020,6 +1026,7 @@ private:
     TBWidgetValueConnection m_connection; ///< TBWidget value connection
     TBWidgetValueConnection m_connection; ///< TBWidget value connection
     TBLinkListOf<TBWidgetListener> m_listeners;	///< List of listeners
     TBLinkListOf<TBWidgetListener> m_listeners;	///< List of listeners
     float m_opacity;				///< Opacity 0-1. See SetOpacity.
     float m_opacity;				///< Opacity 0-1. See SetOpacity.
+    float m_disabledOpacity;		///< Opacity 0-1. See SetDisabledOpacity.
     WIDGET_STATE m_state;			///< The widget state (excluding any auto states)
     WIDGET_STATE m_state;			///< The widget state (excluding any auto states)
     WIDGET_GRAVITY m_gravity;		///< The layout gravity setting.
     WIDGET_GRAVITY m_gravity;		///< The layout gravity setting.
     TBFontDescription m_font_desc;	///< The font description.
     TBFontDescription m_font_desc;	///< The font description.

+ 2 - 0
Source/ThirdParty/TurboBadger/tb_widgets_reader.cpp

@@ -42,6 +42,8 @@ void TBWidget::OnInflate(const INFLATE_INFO &info)
 
 
     SetOpacity(info.node->GetValueFloat("opacity", GetOpacity()));
     SetOpacity(info.node->GetValueFloat("opacity", GetOpacity()));
 
 
+    SetDisabledOpacity(info.node->GetValueFloat("disabled-Opacity", GetDisabledOpacity()));
+
     if (const char *text = info.node->GetValueString("text", nullptr))
     if (const char *text = info.node->GetValueString("text", nullptr))
         SetText(text);
         SetText(text);
 
 

+ 26 - 25
Source/ThirdParty/TurboBadger/tb_widgets_reader.h

@@ -105,31 +105,32 @@ public:
 
 
     Resource name:		TBWidget property:			Values:
     Resource name:		TBWidget property:			Values:
 
 
-    id					TBWidget::m_id				TBID (string or int)
-    group-id			TBWidget::m_group_id		TBID (string or int)
-    value				TBWidget::SetValue			integer
-    data				TBWidget::m_data			integer
-    is-group-root		TBWidget::SetIsGroupRoot	boolean
-    is-focusable		TBWidget::SetIsFocusable	boolean
-    want-long-click		TBWidget::SetWantLongClick	boolean
-    ignore-input		TBWidget::SetIgnoreInput	boolean
-    opacity				TBWidget::SetOpacity		float (0 - 1)
-    text				TBWidget::SetText			string
-    connection			TBWidget::Connect			string
-    axis				TBWidget::SetAxis			x or y
-    gravity				TBWidget::SetGravity		string (combination of left, top, right, bottom, or all)
-    visibility			TBWidget::SetVisibility		string (visible, invisible, gone)
-    state				TBWidget::SetState			string (disabled)
-    skin				TBWidget::SetSkinBg			TBID (string or int)
-    rect				TBWidget::SetRect			4 integers (x, y, width, height)
-    lp>width			TBWidget::SetLayoutParams	dimension
-    lp>min-width		TBWidget::SetLayoutParams	dimension
-    lp>max-width		TBWidget::SetLayoutParams	dimension
-    lp>pref-width		TBWidget::SetLayoutParams	dimension
-    lp>height			TBWidget::SetLayoutParams	dimension
-    lp>min-height		TBWidget::SetLayoutParams	dimension
-    lp>max-height		TBWidget::SetLayoutParams	dimension
-    lp>pref-height		TBWidget::SetLayoutParams	dimension
+    id					TBWidget::m_id					TBID (string or int)
+    group-id			TBWidget::m_group_id			TBID (string or int)
+    value				TBWidget::SetValue				integer
+    data				TBWidget::m_data				integer
+    is-group-root		TBWidget::SetIsGroupRoot		boolean
+    is-focusable		TBWidget::SetIsFocusable		boolean
+    want-long-click		TBWidget::SetWantLongClick		boolean
+    ignore-input		TBWidget::SetIgnoreInput		boolean
+    opacity				TBWidget::SetOpacity			float (0 - 1)
+    disabledOpacity		TBWidget::SetDisabledOpacity	float (0 - 1)
+    text				TBWidget::SetText				string
+    connection			TBWidget::Connect				string
+    axis				TBWidget::SetAxis				x or y
+    gravity				TBWidget::SetGravity			string (combination of left, top, right, bottom, or all)
+    visibility			TBWidget::SetVisibility			string (visible, invisible, gone)
+    state				TBWidget::SetState				string (disabled)
+    skin				TBWidget::SetSkinBg				TBID (string or int)
+    rect				TBWidget::SetRect				4 integers (x, y, width, height)
+    lp>width			TBWidget::SetLayoutParams		dimension
+    lp>min-width		TBWidget::SetLayoutParams		dimension
+    lp>max-width		TBWidget::SetLayoutParams		dimension
+    lp>pref-width		TBWidget::SetLayoutParams		dimension
+    lp>height			TBWidget::SetLayoutParams		dimension
+    lp>min-height		TBWidget::SetLayoutParams		dimension
+    lp>max-height		TBWidget::SetLayoutParams		dimension
+    lp>pref-height		TBWidget::SetLayoutParams		dimension
     autofocus			The TBWidget will be focused automatically the first time its TBWindow is activated.
     autofocus			The TBWidget will be focused automatically the first time its TBWindow is activated.
     font>name			Font name
     font>name			Font name
     font>size			Font size
     font>size			Font size