diff options
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/editor_node.cpp | 25 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 9 | ||||
-rw-r--r-- | tools/editor/editor_plugin.cpp | 19 | ||||
-rw-r--r-- | tools/editor/editor_plugin.h | 4 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 31 | ||||
-rw-r--r-- | tools/editor/plugins/shader_graph_editor_plugin.cpp | 2 |
6 files changed, 73 insertions, 17 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index dd84b30add..0e4a2fe30b 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -1217,6 +1217,7 @@ void EditorNode::_dialog_action(String p_file) { //_save_scene(p_file); _save_scene_with_preview(p_file); + _call_build(); _run(true); } } break; @@ -2636,6 +2637,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY: { _menu_option_confirm(RUN_STOP,true); + _call_build(); _run(false); } break; @@ -2671,6 +2673,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } break; case RUN_PLAY_SCENE: { _menu_option_confirm(RUN_STOP,true); + _call_build(); _run(true); } break; @@ -2682,6 +2685,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { } if (run_native->is_deploy_debug_remote_enabled()){ _menu_option_confirm(RUN_STOP,true); + _call_build(); emit_signal("play_pressed"); editor_run.run_native_notify(); } @@ -3012,7 +3016,7 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) { for(int i=0;i<singleton->main_editor_buttons.size();i++) { - if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_name()) { + if (p_editor->get_name()==singleton->main_editor_buttons[i]->get_text()) { memdelete( singleton->main_editor_buttons[i] ); singleton->main_editor_buttons.remove(i); @@ -4042,6 +4046,7 @@ void EditorNode::_quick_opened() { void EditorNode::_quick_run() { + _call_build(); _run(false,quick_run->get_selected()); } @@ -5244,6 +5249,24 @@ void EditorNode::add_plugin_init_callback(EditorPluginInitializeCallback p_callb EditorPluginInitializeCallback EditorNode::plugin_init_callbacks[EditorNode::MAX_INIT_CALLBACKS]; +int EditorNode::build_callback_count=0; + +void EditorNode::add_build_callback(EditorBuildCallback p_callback) { + + ERR_FAIL_COND(build_callback_count==MAX_INIT_CALLBACKS); + + build_callbacks[build_callback_count++]=p_callback; +} + +EditorPluginInitializeCallback EditorNode::build_callbacks[EditorNode::MAX_BUILD_CALLBACKS]; + +void EditorNode::_call_build() { + + for(int i=0;i<build_callback_count;i++) { + build_callbacks[i](); + } +} + void EditorNode::_bind_methods() { diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 96242a144d..2fae5daced 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -95,6 +95,7 @@ typedef void (*EditorNodeInitCallback)(); typedef void (*EditorPluginInitializeCallback)(); +typedef void (*EditorBuildCallback)(); class EditorPluginList; @@ -580,13 +581,18 @@ private: void _toggle_distraction_free_mode(); enum { - MAX_INIT_CALLBACKS=128 + MAX_INIT_CALLBACKS=128, + MAX_BUILD_CALLBACKS=128 }; static int plugin_init_callback_count; static EditorPluginInitializeCallback plugin_init_callbacks[MAX_INIT_CALLBACKS]; + + void _call_build(); + static int build_callback_count; + static EditorBuildCallback build_callbacks[MAX_BUILD_CALLBACKS]; protected: void _notification(int p_what); static void _bind_methods(); @@ -754,6 +760,7 @@ public: void get_singleton(const char* arg1, bool arg2); static void add_init_callback(EditorNodeInitCallback p_callback) { _init_callbacks.push_back(p_callback); } + static void add_build_callback(EditorBuildCallback p_callback); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 55f0e52c88..4b82d5e59c 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -71,6 +71,11 @@ void EditorPlugin::remove_control_from_bottom_panel(Control *p_control) { } +Control * EditorPlugin::get_editor_viewport() { + + return EditorNode::get_singleton()->get_viewport(); +} + void EditorPlugin::add_control_to_container(CustomControlContainer p_location,Control *p_control) { switch(p_location) { @@ -315,6 +320,16 @@ Control *EditorPlugin::get_base_control() { return EditorNode::get_singleton()->get_gui_base(); } +void EditorPlugin::make_bottom_panel_item_visible(Control * p_item) { + + EditorNode::get_singleton()->make_bottom_panel_item_visible(p_item); +} + +void EditorPlugin::hide_bottom_panel() { + + EditorNode::get_singleton()->hide_bottom_panel(); +} + void EditorPlugin::inspect_object(Object *p_obj,const String& p_for_property) { EditorNode::get_singleton()->push_item(p_obj,p_for_property); @@ -333,6 +348,7 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("remove_control_from_bottom_panel","control:Control"),&EditorPlugin::remove_control_from_bottom_panel); ObjectTypeDB::bind_method(_MD("add_custom_type","type","base","script:Script","icon:Texture"),&EditorPlugin::add_custom_type); ObjectTypeDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type); + ObjectTypeDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport); ObjectTypeDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin); ObjectTypeDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin); @@ -346,6 +362,9 @@ void EditorPlugin::_bind_methods() { ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String())); ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas); + ObjectTypeDB::bind_method(_MD("make_bottom_panel_item_visible","item:Control"), &EditorPlugin::make_bottom_panel_item_visible); + ObjectTypeDB::bind_method(_MD("hide_bottom_panel"), &EditorPlugin::hide_bottom_panel); + ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control); ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo); ObjectTypeDB::bind_method(_MD("get_selection:EditorSelection"),&EditorPlugin::get_selection); diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h index 5b944cc27a..2700c49a6c 100644 --- a/tools/editor/editor_plugin.h +++ b/tools/editor/editor_plugin.h @@ -100,6 +100,7 @@ public: void add_control_to_dock(DockSlot p_slot,Control *p_control); void remove_control_from_docks(Control *p_control); void remove_control_from_bottom_panel(Control *p_control); + Control* get_editor_viewport(); virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial); virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform, const InputEvent& p_event); @@ -130,6 +131,9 @@ public: Control *get_base_control(); + void make_bottom_panel_item_visible(Control *p_item); + void hide_bottom_panel(); + void add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); void remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 522ceba1dc..fd25843de9 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1362,10 +1362,8 @@ struct _ScriptEditorItemData { void ScriptEditor::_update_script_colors() { - bool enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); + bool script_temperature_enabled = EditorSettings::get_singleton()->get("text_editor/script_temperature_enabled"); bool highlight_current = EditorSettings::get_singleton()->get("text_editor/highlight_current_script"); - if (!enabled) - return; int hist_size = EditorSettings::get_singleton()->get("text_editor/script_temperature_history_size"); Color hot_color=EditorSettings::get_singleton()->get("text_editor/script_temperature_hot_color"); @@ -1379,22 +1377,25 @@ void ScriptEditor::_update_script_colors() { continue; script_list->set_item_custom_bg_color(i,Color(0,0,0,0)); - if (!n->has_meta("__editor_pass")) { - continue; - } - - int pass=n->get_meta("__editor_pass"); - int h = edit_pass - pass; - if (h>hist_size) { - continue; - } - int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; - float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); bool current = tab_container->get_current_tab() == c; if (current && highlight_current) { script_list->set_item_custom_bg_color(i, EditorSettings::get_singleton()->get("text_editor/current_script_background_color")); - } else { + + } else if (script_temperature_enabled) { + + if (!n->has_meta("__editor_pass")) { + continue; + } + + int pass=n->get_meta("__editor_pass"); + int h = edit_pass - pass; + if (h>hist_size) { + continue; + } + int non_zero_hist_size = ( hist_size == 0 ) ? 1 : hist_size; + float v = Math::ease((edit_pass-pass)/float(non_zero_hist_size),0.4); + script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v)); } } diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index aa66a2e0d9..3ab906f84e 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -2422,6 +2422,7 @@ void ShaderGraphView::_create_node(int p_id) { colors.push_back("Color"); colors.push_back("LightColor"); colors.push_back("Light"); + colors.push_back("ShadowColor"); colors.push_back("Diffuse"); colors.push_back("Specular"); colors.push_back("Emmision"); @@ -2434,6 +2435,7 @@ void ShaderGraphView::_create_node(int p_id) { reals.push_back("ShadeParam"); reals.push_back("SpecularExp"); reals.push_back("LightAlpha"); + reals.push_back("ShadowAlpha"); reals.push_back("PointSize"); reals.push_back("Discard"); |