diff options
| author | Juan Linietsky | 2015-11-19 19:34:50 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-11-19 19:34:50 -0300 |
| commit | dccbd3b4f8cc218f26909c188999f889b78375cc (patch) | |
| tree | fb1646f0f8508f90b31bf38d730995c16360290f /tools/editor/plugins/spatial_editor_plugin.cpp | |
| parent | 6127f17368d6fe6256848ee86de223fa26e53ffb (diff) | |
| parent | 6b0423b1914f68a67c523b2aee059e8ffeeeca11 (diff) | |
| download | godot-dccbd3b4f8cc218f26909c188999f889b78375cc.tar.gz godot-dccbd3b4f8cc218f26909c188999f889b78375cc.tar.zst godot-dccbd3b4f8cc218f26909c188999f889b78375cc.zip | |
Merge pull request #2831 from neikeq/select_menu_patch
Show select menu on button pressed (instead of released)
Diffstat (limited to 'tools/editor/plugins/spatial_editor_plugin.cpp')
| -rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index e2202214d..7816efe89 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -862,6 +862,57 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { //VisualServer::get_singleton()->instance_set_transform(cursor_instance,Transform(Matrix3(),cursor.cursor_pos)); } } + + if (b.mod.alt) { + + if (nav_scheme == NAVIGATION_MAYA) + break; + + _find_items_at_pos(Vector2( b.x, b.y ),clicked_includes_current,selection_results,b.mod.shift); + + clicked_wants_append=b.mod.shift; + + if (selection_results.size() == 1) { + + clicked=selection_results[0].item->get_instance_ID(); + selection_results.clear(); + + if (clicked) { + _select_clicked(clicked_wants_append,true); + clicked=0; + } + + } else if (!selection_results.empty()) { + + NodePath root_path = get_tree()->get_edited_scene_root()->get_path(); + StringName root_name = root_path.get_name(root_path.get_name_count()-1); + + for (int i = 0; i < selection_results.size(); i++) { + + Spatial *spat=selection_results[i].item; + + Ref<Texture> icon; + if (spat->has_meta("_editor_icon")) + icon=spat->get_meta("_editor_icon"); + else + icon=get_icon( has_icon(spat->get_type(),"EditorIcons")?spat->get_type():String("Object"),"EditorIcons"); + + String node_path="/"+root_name+"/"+root_path.rel_path_to(spat->get_path()); + + selection_menu->add_item(spat->get_name()); + selection_menu->set_item_icon(i, icon ); + selection_menu->set_item_metadata(i, node_path); + selection_menu->set_item_tooltip(i,String(spat->get_name())+ + "\nType: "+spat->get_type()+"\nPath: "+node_path); + } + + selection_menu->set_global_pos(Vector2( b.global_x, b.global_y )); + selection_menu->popup(); + selection_menu->call_deferred("grab_click_focus"); + + break; + } + } } if (_edit.mode!=TRANSFORM_NONE && b.pressed) { @@ -888,57 +939,6 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { //VisualServer::get_singleton()->poly_clear(indicators); set_message("Transform Aborted.",3); } - - if (!b.pressed && (spatial_editor->get_tool_mode()==SpatialEditor::TOOL_MODE_SELECT && b.mod.alt)) { - - if (nav_scheme == NAVIGATION_MAYA) - break; - - _find_items_at_pos(Vector2( b.x, b.y ),clicked_includes_current,selection_results,b.mod.shift); - - clicked_wants_append=b.mod.shift; - - if (selection_results.size() == 1) { - - clicked=selection_results[0].item->get_instance_ID(); - selection_results.clear(); - - if (clicked) { - _select_clicked(clicked_wants_append,true); - clicked=0; - } - - } else if (!selection_results.empty()) { - - NodePath root_path = get_tree()->get_edited_scene_root()->get_path(); - StringName root_name = root_path.get_name(root_path.get_name_count()-1); - - for (int i = 0; i < selection_results.size(); i++) { - - Spatial *spat=selection_results[i].item; - - Ref<Texture> icon; - if (spat->has_meta("_editor_icon")) - icon=spat->get_meta("_editor_icon"); - else - icon=get_icon( has_icon(spat->get_type(),"EditorIcons")?spat->get_type():String("Object"),"EditorIcons"); - - String node_path="/"+root_name+"/"+root_path.rel_path_to(spat->get_path()); - - selection_menu->add_item(spat->get_name()); - selection_menu->set_item_icon(i, icon ); - selection_menu->set_item_metadata(i, node_path); - selection_menu->set_item_tooltip(i,String(spat->get_name())+ - "\nType: "+spat->get_type()+"\nPath: "+node_path); - } - - selection_menu->set_global_pos(Vector2( b.global_x, b.global_y )); - selection_menu->popup(); - selection_menu->call_deferred("grab_click_focus"); - - break; - } - } } break; case BUTTON_MIDDLE: { |
