瀏覽代碼

Fix creating UI elements from the quick menu.

Lasse Öörni 12 年之前
父節點
當前提交
f3e44a22b1
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      Bin/Data/Scripts/Editor/EditorUI.as

+ 10 - 10
Bin/Data/Scripts/Editor/EditorUI.as

@@ -563,28 +563,28 @@ bool PickBuiltinObject()
     return true;
 }
 
-// When calling items from the quick menu, they have "Create" prepended for clarity. Strip that now to get the object name to create
-String GetActionName(const String&in name)
-{
-    if (name.StartsWith("Create"))
-        return name.Substring(7);
-    else
-        return name;
-}
-
 bool PickUIElement()
 {
     Menu@ menu = GetEventSender();
     if (menu is null)
         return false;
 
-    String action = menu.name;
+    String action = GetActionName(menu.name);
     if (action.empty)
         return false;
 
     return NewUIElement(action);
 }
 
+// When calling items from the quick menu, they have "Create" prepended for clarity. Strip that now to get the object name to create
+String GetActionName(const String&in name)
+{
+    if (name.StartsWith("Create"))
+        return name.Substring(7);
+    else
+        return name;
+}
+
 void HandleMenuSelected(StringHash eventType, VariantMap& eventData)
 {
     Menu@ menu = eventData["Element"].GetUIElement();