diff options
Diffstat (limited to 'tools/editor/editor_data.cpp')
-rw-r--r-- | tools/editor/editor_data.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp index c872b1c3ca..f78ab93c30 100644 --- a/tools/editor/editor_data.cpp +++ b/tools/editor/editor_data.cpp @@ -261,13 +261,13 @@ EditorPlugin* EditorData::get_subeditor(Object *p_object) { } EditorPlugin* EditorData::get_editor(String p_name) { - + for(int i=0;i<editor_plugins.size();i++) { - + if (editor_plugins[i]->get_name()==p_name) return editor_plugins[i]; } - + return NULL; } @@ -422,6 +422,14 @@ void EditorData::add_editor_plugin(EditorPlugin *p_plugin) { editor_plugins.push_back(p_plugin); } +int EditorData::get_editor_plugin_count() const { + return editor_plugins.size(); +} +EditorPlugin *EditorData::get_editor_plugin(int p_idx) { + + ERR_FAIL_INDEX_V(p_idx,editor_plugins.size(),NULL); + return editor_plugins[p_idx]; +} void EditorData::add_custom_type(const String& p_type, const String& p_inherits,const Ref<Script>& p_script,const Ref<Texture>& p_icon ) { @@ -791,6 +799,8 @@ void EditorSelection::_node_removed(Node *p_node) { void EditorSelection::add_node(Node *p_node) { + ERR_FAIL_NULL(p_node); + if (selection.has(p_node)) return; @@ -814,6 +824,8 @@ void EditorSelection::add_node(Node *p_node) { void EditorSelection::remove_node(Node *p_node) { + ERR_FAIL_NULL(p_node); + if (!selection.has(p_node)) return; @@ -832,12 +844,25 @@ bool EditorSelection::is_selected(Node * p_node) const { } +Array EditorSelection::_get_selected_nodes() { + + Array ret; + + for (List<Node*>::Element *E=selected_node_list.front();E;E=E->next()) { + + ret.push_back(E->get()); + } + + return ret; +} void EditorSelection::_bind_methods() { ObjectTypeDB::bind_method(_MD("_node_removed"),&EditorSelection::_node_removed); ObjectTypeDB::bind_method(_MD("clear"),&EditorSelection::clear); - ObjectTypeDB::bind_method(_MD("add_node"),&EditorSelection::add_node); + ObjectTypeDB::bind_method(_MD("add_node","node:Node"),&EditorSelection::add_node); + ObjectTypeDB::bind_method(_MD("remove_node","node:Node"),&EditorSelection::remove_node); + ObjectTypeDB::bind_method(_MD("get_selected_nodes"),&EditorSelection::_get_selected_nodes); ADD_SIGNAL( MethodInfo("selection_changed") ); } |