From 9890c1d2ca76dc936e23f5263a4fd296bfc68996 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 6 Aug 2016 19:00:54 -0300 Subject: Likely with bugs and with some features are missing, as well as profiler support, but VisualScript should be more or less done! --- tools/editor/connections_dialog.cpp | 2 +- tools/editor/editor_node.cpp | 16 ++++++++++++ tools/editor/editor_node.h | 12 +++++++++ tools/editor/editor_settings.cpp | 5 ---- tools/editor/plugins/script_editor_plugin.cpp | 36 ++++++++++++++++++++++++++- tools/editor/plugins/script_editor_plugin.h | 3 ++- tools/editor/plugins/script_text_editor.cpp | 7 +++++- tools/editor/plugins/script_text_editor.h | 4 ++- tools/editor/script_editor_debugger.cpp | 3 ++- 9 files changed, 77 insertions(+), 11 deletions(-) (limited to 'tools/editor') 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/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;iadd_preview_generator( Ref( memnew(EditorTexturePreviewPlugin ))); resource_preview->add_preview_generator( Ref( memnew(EditorPackedScenePreviewPlugin ))); @@ -6508,6 +6522,8 @@ EditorNode::EditorNode() { resource_preview->add_preview_generator( Ref( memnew(EditorMeshPreviewPlugin ))); resource_preview->add_preview_generator( Ref( 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 11402c64e9..582462aa19 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -647,11 +647,6 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { set("import/automatic_reimport_on_sources_changed",true); - set("visual_script/color_functions",Color(1,0.9,0.9)); - set("visual_script/color_data",Color(0.9,1.0,0.9)); - set("visual_script/color_operators",Color(0.9,0.9,1.0)); - set("visual_script/color_flow_control",Color(1.0,1.0,0.8)); - if (p_extra_config.is_valid()) { if (p_extra_config->has_section("init_projects") && p_extra_config->has_section_key("init_projects", "list")) { 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;iget_child_count();i++) { + + ScriptEditorBase *se = tab_container->get_child(i)->cast_to(); + 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(); + if (!current) + return; + + current->goto_line(p_line,true); } @@ -1133,6 +1153,7 @@ void ScriptEditor::clear() { void ScriptEditor::get_breakpoints(List *p_breakpoints) { + for(int i=0;iget_child_count();i++) { ScriptEditorBase *se = tab_container->get_child(i)->cast_to(); @@ -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;iget_child_count();i++) { + + ScriptEditorBase *se = tab_container->get_child(i)->cast_to(); + 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 *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/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(); -- cgit v1.2.3