summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/connections_dialog.cpp2
-rw-r--r--tools/editor/create_dialog.cpp4
-rw-r--r--tools/editor/editor_node.cpp16
-rw-r--r--tools/editor/editor_node.h12
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp36
-rw-r--r--tools/editor/plugins/script_editor_plugin.h3
-rw-r--r--tools/editor/plugins/script_text_editor.cpp7
-rw-r--r--tools/editor/plugins/script_text_editor.h4
-rw-r--r--tools/editor/property_editor.cpp4
-rw-r--r--tools/editor/scene_tree_dock.cpp17
-rw-r--r--tools/editor/scene_tree_dock.h1
-rw-r--r--tools/editor/script_create_dialog.cpp16
-rw-r--r--tools/editor/script_editor_debugger.cpp3
14 files changed, 112 insertions, 15 deletions
diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp
index bdc420c70f..c4f2435675 100644
--- a/tools/editor/connections_dialog.cpp
+++ b/tools/editor/connections_dialog.cpp
@@ -674,7 +674,7 @@ void ConnectionsDock::update_tree() {
tname=Variant::get_type_name(pi.type);
}
signaldesc+=tname+" "+(pi.name==""?String("arg "+itos(i)):pi.name);
- argnames.push_back(pi.name);
+ argnames.push_back(pi.name+":"+tname);
}
signaldesc+=" ";
diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp
index 3ab2e35242..b0cdd79798 100644
--- a/tools/editor/create_dialog.cpp
+++ b/tools/editor/create_dialog.cpp
@@ -292,9 +292,12 @@ String CreateDialog::get_selected_type() {
Object *CreateDialog::instance_selected() {
TreeItem *selected = search_options->get_selected();
+
if (selected) {
String custom = selected->get_metadata(0);
+
+
if (custom!=String()) {
if (EditorNode::get_editor_data().get_custom_types().has(custom)) {
@@ -323,6 +326,7 @@ Object *CreateDialog::instance_selected() {
}
}
+
return NULL;
}
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 6f70eedcb3..85c560bf9d 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -5220,6 +5220,17 @@ void EditorNode::reload_scene(const String& p_path) {
_scene_tab_changed(current_tab);
}
+int EditorNode::plugin_init_callback_count=0;
+
+void EditorNode::add_plugin_init_callback(EditorPluginInitializeCallback p_callback) {
+
+ ERR_FAIL_COND(plugin_init_callback_count==MAX_INIT_CALLBACKS);
+
+ plugin_init_callbacks[plugin_init_callback_count++]=p_callback;
+}
+
+EditorPluginInitializeCallback EditorNode::plugin_init_callbacks[EditorNode::MAX_INIT_CALLBACKS];
+
void EditorNode::_bind_methods() {
@@ -6499,6 +6510,9 @@ EditorNode::EditorNode() {
for(int i=0;i<EditorPlugins::get_plugin_count();i++)
add_editor_plugin( EditorPlugins::create(i,this) );
+ for(int i=0;i<plugin_init_callback_count;i++) {
+ plugin_init_callbacks[i]();
+ }
resource_preview->add_preview_generator( Ref<EditorTexturePreviewPlugin>( memnew(EditorTexturePreviewPlugin )));
resource_preview->add_preview_generator( Ref<EditorPackedScenePreviewPlugin>( memnew(EditorPackedScenePreviewPlugin )));
@@ -6508,6 +6522,8 @@ EditorNode::EditorNode() {
resource_preview->add_preview_generator( Ref<EditorMeshPreviewPlugin>( memnew(EditorMeshPreviewPlugin )));
resource_preview->add_preview_generator( Ref<EditorBitmapPreviewPlugin>( memnew(EditorBitmapPreviewPlugin )));
+
+
circle_step_msec=OS::get_singleton()->get_ticks_msec();
circle_step_frame=OS::get_singleton()->get_frames_drawn();
circle_step=0;
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 09c42c6cd0..e6119cf577 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -94,6 +94,7 @@
typedef void (*EditorNodeInitCallback)();
+typedef void (*EditorPluginInitializeCallback)();
class EditorPluginList;
@@ -575,11 +576,20 @@ private:
static void _file_access_close_error_notify(const String& p_str);
+
+ enum {
+ MAX_INIT_CALLBACKS=128
+ };
+
+ static int plugin_init_callback_count;
+ static EditorPluginInitializeCallback plugin_init_callbacks[MAX_INIT_CALLBACKS];
protected:
void _notification(int p_what);
static void _bind_methods();
public:
+ static void add_plugin_init_callback(EditorPluginInitializeCallback p_callback);
+
enum EditorTable {
EDITOR_2D = 0,
EDITOR_3D,
@@ -741,6 +751,8 @@ public:
static void add_init_callback(EditorNodeInitCallback p_callback) { _init_callbacks.push_back(p_callback); }
+
+
};
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 9dcf71e256..582462aa19 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -945,6 +945,8 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
cf->set_value(theme_section, "word_highlighted_color", ((Color)get("text_editor/word_highlighted_color")).to_html());
cf->set_value(theme_section, "search_result_color", ((Color)get("text_editor/search_result_color")).to_html());
cf->set_value(theme_section, "search_result_border_color", ((Color)get("text_editor/search_result_border_color")).to_html());
+
+
Error err = cf->save(p_file);
if (err == OK) {
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 376c0daa68..74c8ac9766 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -285,6 +285,17 @@ void ScriptEditor::_breaked(bool p_breaked,bool p_can_debug) {
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_BREAK), p_breaked );
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_CONTINUE), !p_breaked );
+ for(int i=0;i<tab_container->get_child_count();i++) {
+
+ ScriptEditorBase *se = tab_container->get_child(i)->cast_to<ScriptEditorBase>();
+ if (!se) {
+
+ continue;
+ }
+
+ se->set_debugger_active(p_breaked);
+ }
+
}
void ScriptEditor::_show_debugger(bool p_show) {
@@ -315,7 +326,16 @@ void ScriptEditor::_goto_script_line(REF p_script,int p_line) {
editor->push_item(p_script.ptr());
- _goto_script_line2(p_line);
+
+ int selected = tab_container->get_current_tab();
+ if (selected<0 || selected>=tab_container->get_child_count())
+ return;
+
+ ScriptEditorBase *current = tab_container->get_child(selected)->cast_to<ScriptEditorBase>();
+ if (!current)
+ return;
+
+ current->goto_line(p_line,true);
}
@@ -1133,6 +1153,7 @@ void ScriptEditor::clear() {
void ScriptEditor::get_breakpoints(List<String> *p_breakpoints) {
+
for(int i=0;i<tab_container->get_child_count();i++) {
ScriptEditorBase *se = tab_container->get_child(i)->cast_to<ScriptEditorBase>();
@@ -1500,6 +1521,8 @@ void ScriptEditor::save_all_scripts() {
}
+ _update_script_names();
+
}
void ScriptEditor::apply_scripts() const {
@@ -1536,6 +1559,17 @@ void ScriptEditor::_editor_stop() {
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_STEP), true );
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_BREAK), true );
debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_CONTINUE), true );
+
+ for(int i=0;i<tab_container->get_child_count();i++) {
+
+ ScriptEditorBase *se = tab_container->get_child(i)->cast_to<ScriptEditorBase>();
+ if (!se) {
+
+ continue;
+ }
+
+ se->set_debugger_active(false);
+ }
}
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 03176545ac..5cb70e13d7 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -91,7 +91,7 @@ public:
virtual bool is_unsaved()=0;
virtual Variant get_edit_state()=0;
virtual void set_edit_state(const Variant& p_state)=0;
- virtual void goto_line(int p_line)=0;
+ virtual void goto_line(int p_line,bool p_with_error=false)=0;
virtual void trim_trailing_whitespace()=0;
virtual void ensure_focus()=0;
virtual void tag_saved_version()=0;
@@ -100,6 +100,7 @@ public:
virtual bool goto_method(const String& p_method)=0;
virtual void add_callback(const String& p_function,StringArray p_args)=0;
virtual void update_settings()=0;
+ virtual void set_debugger_active(bool p_active)=0;
virtual void set_tooltip_request_func(String p_method,Object* p_obj)=0;
virtual Control *get_edit_menu()=0;
diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp
index 92f1148435..57cf8cbea3 100644
--- a/tools/editor/plugins/script_text_editor.cpp
+++ b/tools/editor/plugins/script_text_editor.cpp
@@ -312,7 +312,7 @@ void ScriptTextEditor::tag_saved_version() {
code_editor->get_text_edit()->tag_saved_version();
}
-void ScriptTextEditor::goto_line(int p_line) {
+void ScriptTextEditor::goto_line(int p_line, bool p_with_error) {
code_editor->get_text_edit()->cursor_set_line(p_line);
}
@@ -952,6 +952,11 @@ void ScriptTextEditor::set_tooltip_request_func(String p_method,Object* p_obj) {
code_editor->get_text_edit()->set_tooltip_request_func(p_obj,p_method,this);
}
+void ScriptTextEditor::set_debugger_active(bool p_active) {
+
+
+}
+
ScriptTextEditor::ScriptTextEditor() {
code_editor = memnew( CodeTextEditor );
diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h
index ad927c5725..247fd97e81 100644
--- a/tools/editor/plugins/script_text_editor.h
+++ b/tools/editor/plugins/script_text_editor.h
@@ -115,7 +115,7 @@ public:
virtual void trim_trailing_whitespace();
virtual void tag_saved_version();
- virtual void goto_line(int p_line);
+ virtual void goto_line(int p_line,bool p_with_error=false);
virtual void reload(bool p_soft);
virtual void get_breakpoints(List<int> *p_breakpoints);
@@ -126,6 +126,8 @@ public:
virtual void set_tooltip_request_func(String p_method,Object* p_obj);
+ virtual void set_debugger_active(bool p_active);
+
Control *get_edit_menu();
static void register_editor();
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index f66cdd7cae..0518018e5a 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -211,6 +211,10 @@ void CustomPropertyEditor::_menu_option(int p_which) {
ERR_BREAK( !obj );
Resource *res=obj->cast_to<Resource>();
ERR_BREAK( !res );
+ if (owner && hint==PROPERTY_HINT_RESOURCE_TYPE && hint_text=="Script") {
+ //make visual script the right type
+ res->call("set_instance_base_type",owner->get_type());
+ }
v=Ref<Resource>(res).get_ref_ptr();
emit_signal("variant_changed");
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index c4718a19a1..94587456f1 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -683,6 +683,8 @@ void SceneTreeDock::_notification(int p_what) {
}
button_add->set_icon(get_icon("Add","EditorIcons"));
button_instance->set_icon(get_icon("Instance","EditorIcons"));
+ button_create_script->set_icon(get_icon("Script","EditorIcons"));
+
filter_icon->set_texture(get_icon("Zoom","EditorIcons"));
@@ -1302,11 +1304,18 @@ void SceneTreeDock::_delete_confirm() {
void SceneTreeDock::_selection_changed() {
- if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size()>1) {
+ int selection_size = EditorNode::get_singleton()->get_editor_selection()->get_selection().size();
+ if (selection_size>1) {
//automatically turn on multi-edit
_tool_selected(TOOL_MULTI_EDIT);
}
+ if (selection_size==1 && EditorNode::get_singleton()->get_editor_selection()->get_selection().front()->key()->get_script().is_null()) {
+ button_create_script->show();
+ } else {
+ button_create_script->hide();
+ }
+
//tool_buttons[TOOL_MULTI_EDIT]->set_disabled(EditorNode::get_singleton()->get_editor_selection()->get_selection().size()<2);
}
@@ -1899,6 +1908,12 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
filter->connect("text_changed",this,"_filter_changed");
+ tb = memnew( ToolButton );
+ tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_SCRIPT, false));
+ tb->set_tooltip(TTR("Create a new script for the selected node."));
+ tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_script"));
+ filter_hbc->add_child(tb);
+ button_create_script=tb;
scene_tree = memnew( SceneTreeEditor(false,true,true ));
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index bcf7ff7173..af612cbc77 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -78,6 +78,7 @@ class SceneTreeDock : public VBoxContainer {
ToolButton *button_add;
ToolButton *button_instance;
+ ToolButton *button_create_script;
SceneTreeEditor *scene_tree;
diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp
index e93a40efbc..749198314a 100644
--- a/tools/editor/script_create_dialog.cpp
+++ b/tools/editor/script_create_dialog.cpp
@@ -117,20 +117,20 @@ void ScriptCreateDialog::ok_pressed() {
- String text = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text());
- Script *script = ScriptServer::get_language( language_menu->get_selected() )->create_script();
- script->set_source_code(text);
- if (cname!="")
- script->set_name(cname);
+ Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text());
+ //scr->set_source_code(text);
+
+
+ if (cname!="")
+ scr->set_name(cname);
- Ref<Script> scr(script);
if (!internal->is_pressed()) {
String lpath = Globals::get_singleton()->localize_path(file_path->get_text());
- script->set_path(lpath);
+ scr->set_path(lpath);
if (!path_valid) {
alert->set_text(TTR("Invalid path!"));
@@ -145,7 +145,7 @@ void ScriptCreateDialog::ok_pressed() {
alert->popup_centered_minsize();
return;
}
- scr->set_path(lpath);
+ //scr->set_path(lpath);
//EditorFileSystem::get_singleton()->update_file(lpath,scr->get_type());
diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp
index b6390e5aae..da42f54095 100644
--- a/tools/editor/script_editor_debugger.cpp
+++ b/tools/editor/script_editor_debugger.cpp
@@ -220,6 +220,7 @@ void ScriptEditorDebugger::debug_continue() {
msg.push_back("continue");
ppeer->put_var(msg);
+
}
void ScriptEditorDebugger::_scene_tree_folded(Object* obj) {
@@ -360,7 +361,7 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat
forward->set_disabled(true);
dobreak->set_disabled(false);
docontinue->set_disabled(true);
- emit_signal("breaked",false,false);
+ emit_signal("breaked",false,false,Variant());
//tabs->set_current_tab(0);
profiler->set_enabled(true);
profiler->disable_seeking();