فهرست منبع

Return handled when animation button is clicked as the button is deleted in the callback, updating widget remove child guard to ensure proper parent, guarding captured widget for multitouch

Josh Engebretson 9 سال پیش
والد
کامیت
dcbc95e616
2فایلهای تغییر یافته به همراه25 افزوده شده و 4 حذف شده
  1. 3 0
      Script/AtomicEditor/ui/frames/inspector/InspectorWidget.ts
  2. 22 4
      Source/ThirdParty/TurboBadger/tb_widgets.cpp

+ 3 - 0
Script/AtomicEditor/ui/frames/inspector/InspectorWidget.ts

@@ -165,6 +165,9 @@ class InspectorWidget extends ScriptWidget {
 
         button.onClick = function () {
             this.onPreviewAnimation(asset);
+            // button is deleted in callback, so make sure we return
+            // that we're handled
+            return true;
         }.bind(this);
 
         return button;

+ 22 - 4
Source/ThirdParty/TurboBadger/tb_widgets.cpp

@@ -359,9 +359,15 @@ void TBWidget::AddChildRelative(TBWidget *child, WIDGET_Z_REL z, TBWidget *refer
 
 void TBWidget::RemoveChild(TBWidget *child, WIDGET_INVOKE_INFO info)
 {
-    if (!child->m_parent)
+
+// ATOMIC BEGIN
+
+    // this was an assert(child->m_parent)
+    if (child->m_parent != this)
         return;
 
+// ATOMIC END
+
     if (info == WIDGET_INVOKE_INFO_NORMAL)
     {
         // If we're not being deleted and delete the focused widget, try
@@ -1409,12 +1415,24 @@ void TBWidget::InvokePointerUp(int x, int y, MODIFIER_KEYS modifierkeys, bool to
         TBWidgetEvent ev_up(EVENT_TYPE_POINTER_UP, x, y, touch, modifierkeys);
         TBWidgetEvent ev_click(EVENT_TYPE_CLICK, x, y, touch, modifierkeys);
         captured_widget->OnCaptureChanged(false);
+
+        // ATOMIC BEGIN
+
+        // Atomic's TurboBadger multitouch support is a hack, TurboBadger has since added better support
+        // https://github.com/AtomicGameEngine/AtomicGameEngine/issues/1206
+
         captured_widget->InvokeEvent(ev_up);
-        if (!cancel_click && captured_widget->GetHitStatus(x, y))
+
+        if (!cancel_click && captured_widget && captured_widget->GetHitStatus(x, y))
         {
-            captured_widget->InvokeEvent(ev_click);
+            if (captured_widget)
+                captured_widget->InvokeEvent(ev_click);
         }
-        captured_widget->ReleaseCapture();
+
+        if (captured_widget)
+            captured_widget->ReleaseCapture();
+
+        // ATOMIC END
     }
     //restore x and y coords, to use with down_widget
     x = ox;