diff options
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 18 | ||||
-rw-r--r-- | drivers/gles2/shaders/material.glsl | 10 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 14 | ||||
-rw-r--r-- | scene/gui/file_dialog.h | 3 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 5 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 139 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 2 | ||||
-rw-r--r-- | scene/resources/baked_light.cpp | 46 | ||||
-rw-r--r-- | scene/resources/baked_light.h | 9 | ||||
-rw-r--r-- | scene/resources/shader_graph.cpp | 18 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 4 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 60 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 9 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 8 | ||||
-rw-r--r-- | servers/visual_server.h | 9 | ||||
-rw-r--r-- | tools/editor/editor_file_dialog.cpp | 12 | ||||
-rw-r--r-- | tools/editor/editor_file_dialog.h | 3 | ||||
-rw-r--r-- | tools/editor/editor_settings.cpp | 3 | ||||
-rw-r--r-- | tools/editor/editor_sub_scene.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/particles_2d_editor_plugin.cpp | 28 | ||||
-rw-r--r-- | tools/editor/plugins/particles_2d_editor_plugin.h | 6 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 2 |
22 files changed, 291 insertions, 119 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index e43487d719..1568d93af7 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -6561,8 +6561,19 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_LIGHTMAP,false); material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_DP_SAMPLER,false); + material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_COLOR, false); + + if (material->flags[VS::MATERIAL_FLAG_UNSHADED] == false && current_debug != VS::SCENARIO_DEBUG_SHADELESS) { + if (baked_light != NULL) { + if (baked_light->realtime_color_enabled) { + float realtime_energy = baked_light->realtime_energy; + material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_COLOR, true); + material_shader.set_uniform(MaterialShaderGLES2::AMBIENT_COLOR, Vector3(baked_light->realtime_color.r*realtime_energy, baked_light->realtime_color.g*realtime_energy, baked_light->realtime_color.b*realtime_energy)); + } + } + if (e->instance->sampled_light.is_valid()) { SampledLight *sl = sampled_light_owner.get(e->instance->sampled_light); @@ -10769,9 +10780,16 @@ bool RasterizerGLES2::_test_depth_shadow_buffer() { void RasterizerGLES2::init() { + if (OS::get_singleton()->is_stdout_verbose()) { + print_line("Using GLES2 video driver"); + } + #ifdef GLEW_ENABLED GLuint res = glewInit(); ERR_FAIL_COND(res!=GLEW_OK); + if (OS::get_singleton()->is_stdout_verbose()) { + print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION)); + } #endif diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index ccd80bf2f0..e68949b056 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -618,6 +618,12 @@ uniform float ambient_dp_sampler_multiplier; #endif +#ifdef ENABLE_AMBIENT_COLOR + +uniform vec3 ambient_color; + +#endif + FRAGMENT_SHADER_GLOBALS @@ -1262,7 +1268,9 @@ LIGHT_SHADER_CODE #if defined(ENABLE_AMBIENT_OCTREE) || defined(ENABLE_AMBIENT_LIGHTMAP) || defined(ENABLE_AMBIENT_DP_SAMPLER) - +#if defined(ENABLE_AMBIENT_COLOR) + ambientmap_color*=ambient_color; +#endif diffuse.rgb+=ambientmap_color; #endif diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index b8b8c99c39..64fdfdfefe 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -181,12 +181,10 @@ void FileDialog::_action_pressed() { String f=dir_access->get_current_dir().plus_file(file->get_text()); - if (mode==MODE_OPEN_FILE && dir_access->file_exists(f)) { + if ((mode==MODE_OPEN_ANY || mode==MODE_OPEN_FILE) && dir_access->file_exists(f)) { emit_signal("file_selected",f); hide(); - } - - if (mode==MODE_OPEN_DIR) { + }else if (mode==MODE_OPEN_ANY || mode==MODE_OPEN_DIR) { String path=dir_access->get_current_dir(); @@ -304,7 +302,7 @@ void FileDialog::_tree_dc_selected() { if (d["dir"]) { dir_access->change_dir(d["name"]); - if (mode==MODE_OPEN_FILE || mode==MODE_OPEN_FILES || mode==MODE_OPEN_DIR) + if (mode==MODE_OPEN_FILE || mode==MODE_OPEN_FILES || mode==MODE_OPEN_DIR || mode==MODE_OPEN_ANY) file->set_text(""); call_deferred("_update_file_list"); call_deferred("_update_dir"); @@ -552,8 +550,9 @@ void FileDialog::set_mode(Mode p_mode) { case MODE_OPEN_FILE: get_ok()->set_text("Open"); set_title("Open a File"); makedir->hide(); break; case MODE_OPEN_FILES: get_ok()->set_text("Open"); set_title("Open File(s)"); makedir->hide(); break; - case MODE_SAVE_FILE: get_ok()->set_text("Save"); set_title("Save a File"); makedir->show(); break; case MODE_OPEN_DIR: get_ok()->set_text("Open"); set_title("Open a Directory"); makedir->show(); break; + case MODE_OPEN_ANY: get_ok()->set_text("Open"); set_title("Open a File or Directory"); makedir->show(); break; + case MODE_SAVE_FILE: get_ok()->set_text("Save"); set_title("Save a File"); makedir->show(); break; } if (mode==MODE_OPEN_FILES) { @@ -710,6 +709,8 @@ void FileDialog::_bind_methods() { BIND_CONSTANT( MODE_OPEN_FILE ); BIND_CONSTANT( MODE_OPEN_FILES ); BIND_CONSTANT( MODE_OPEN_DIR ); + BIND_CONSTANT( MODE_OPEN_ANY ); + BIND_CONSTANT( MODE_SAVE_FILE ); BIND_CONSTANT( ACCESS_RESOURCES ); @@ -877,3 +878,4 @@ LineEditFileChooser::LineEditFileChooser() { dialog->connect("files_selected",this,"_chosen"); } + diff --git a/scene/gui/file_dialog.h b/scene/gui/file_dialog.h index 2042adbc20..1fcf8387ce 100644 --- a/scene/gui/file_dialog.h +++ b/scene/gui/file_dialog.h @@ -57,7 +57,8 @@ public: MODE_OPEN_FILE, MODE_OPEN_FILES, MODE_OPEN_DIR, - MODE_SAVE_FILE, + MODE_OPEN_ANY, + MODE_SAVE_FILE }; typedef Ref<Texture> (*GetIconFunc)(const String&); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 3953ef06a5..21dee62b38 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -274,6 +274,11 @@ void LineEdit::_input_event(InputEvent p_event) { } break; case KEY_DELETE: { + if (k.mod.shift && !k.mod.command && !k.mod.alt && editable) { + cut_text(); + break; + } + if (editable) { undo_text = text; if (selection.enabled) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 05e49a5104..b80597560d 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1957,6 +1957,12 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { if (readonly) break; + + if (k.mod.shift && !k.mod.command && !k.mod.alt) { + cut(); + break; + } + int curline_len = text[cursor.line].length(); if (cursor.line==text.size()-1 && cursor.column==curline_len) @@ -2169,35 +2175,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { break; } - if (!selection.active){ - - String clipboard = text[cursor.line]; - OS::get_singleton()->set_clipboard(clipboard); - cursor_set_line(cursor.line); - cursor_set_column(0); - _remove_text(cursor.line,0,cursor.line,text[cursor.line].length()); - - backspace_at_cursor(); - update(); - cursor_set_line(cursor.line+1); - cut_copy_line = true; - - } - else - { - - String clipboard = _base_get_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - OS::get_singleton()->set_clipboard(clipboard); - - cursor_set_line(selection.from_line); - cursor_set_column(selection.from_column); - - _remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - selection.active=false; - selection.selecting_mode=Selection::MODE_NONE; - update(); - cut_copy_line = false; - } + cut(); } break; case KEY_C: { @@ -2207,16 +2185,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { break; } - if (!selection.active){ - String clipboard = _base_get_text(cursor.line,0,cursor.line,text[cursor.line].length()); - OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = true; - } - else{ - String clipboard = _base_get_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - OS::get_singleton()->set_clipboard(clipboard); - cut_copy_line = false; - } + copy(); + } break; case KEY_Z: { @@ -2237,25 +2207,8 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { break; } - String clipboard = OS::get_singleton()->get_clipboard(); - - if (selection.active) { - selection.active=false; - _remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - cursor_set_line(selection.from_line); - cursor_set_column(selection.from_column); - - } - else if (cut_copy_line) - { - cursor_set_column(0); - String ins="\n"; - clipboard += ins; - } - - _insert_text_at_cursor(clipboard); + paste(); - update(); } break; case KEY_SPACE: { #ifdef OSX_ENABLED @@ -3028,20 +2981,33 @@ void TextEdit::set_auto_indent(bool p_auto_indent) { void TextEdit::cut() { - if (!selection.active) - return; + if (!selection.active) { - String clipboard = _base_get_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - OS::get_singleton()->set_clipboard(clipboard); + String clipboard = text[cursor.line]; + OS::get_singleton()->set_clipboard(clipboard); + cursor_set_line(cursor.line); + cursor_set_column(0); + _remove_text(cursor.line,0,cursor.line,text[cursor.line].length()); - cursor_set_line(selection.from_line); - cursor_set_column(selection.from_column); + backspace_at_cursor(); + update(); + cursor_set_line(cursor.line+1); + cut_copy_line = true; - _remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - selection.active=false; - selection.selecting_mode=Selection::MODE_NONE; - update(); + } else { + + String clipboard = _base_get_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); + OS::get_singleton()->set_clipboard(clipboard); + + cursor_set_line(selection.from_line); + cursor_set_column(selection.from_column); + _remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); + selection.active=false; + selection.selecting_mode=Selection::MODE_NONE; + update(); + cut_copy_line = false; + } } void TextEdit::copy() { @@ -3049,32 +3015,38 @@ void TextEdit::copy() { if (!selection.active) return; - print_line("from line: "+itos(selection.from_line)); - print_line("from column: "+itos(selection.from_column)); - print_line("to line: "+itos(selection.to_line)); - print_line("to column: "+itos(selection.to_column)); - - String clipboard = _base_get_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - OS::get_singleton()->set_clipboard(clipboard); - + if (!selection.active) { + String clipboard = _base_get_text(cursor.line,0,cursor.line,text[cursor.line].length()); + OS::get_singleton()->set_clipboard(clipboard); + cut_copy_line = true; + } else { + String clipboard = _base_get_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); + OS::get_singleton()->set_clipboard(clipboard); + cut_copy_line = false; + } } + void TextEdit::paste() { + String clipboard = OS::get_singleton()->get_clipboard(); + if (selection.active) { + selection.active=false; + selection.selecting_mode=Selection::MODE_NONE; + _remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); cursor_set_line(selection.from_line); cursor_set_column(selection.from_column); - _remove_text(selection.from_line,selection.from_column,selection.to_line,selection.to_column); - selection.active=false; - selection.selecting_mode=Selection::MODE_NONE; + } else if (cut_copy_line) { + cursor_set_column(0); + String ins="\n"; + clipboard += ins; } - String clipboard = OS::get_singleton()->get_clipboard(); _insert_text_at_cursor(clipboard); update(); - } void TextEdit::select_all() { @@ -3507,6 +3479,13 @@ void TextEdit::_push_current_op() { } +void TextEdit::set_tab_size(const int p_size) { + ERR_FAIL_COND(p_size <= 0); + tab_size = p_size; + text.set_tab_size(p_size); + update(); +} + void TextEdit::set_draw_tabs(bool p_draw) { draw_tabs=p_draw; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 207d6eb131..d38c57804d 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -379,7 +379,7 @@ public: void redo(); void clear_undo_history(); - + void set_tab_size(const int p_size); void set_draw_tabs(bool p_draw); bool is_drawing_tabs() const; diff --git a/scene/resources/baked_light.cpp b/scene/resources/baked_light.cpp index 31282a0274..aa4aae03cb 100644 --- a/scene/resources/baked_light.cpp +++ b/scene/resources/baked_light.cpp @@ -256,6 +256,38 @@ float BakedLight::get_ao_strength() const { return ao_strength; } +void BakedLight::set_realtime_color_enabled(const bool p_realtime_color_enabled) { + + VS::get_singleton()->baked_light_set_realtime_color_enabled(baked_light, p_realtime_color_enabled); +} + +bool BakedLight::get_realtime_color_enabled() const { + + return VS::get_singleton()->baked_light_get_realtime_color_enabled(baked_light); +} + + +void BakedLight::set_realtime_color(const Color &p_realtime_color) { + + VS::get_singleton()->baked_light_set_realtime_color(baked_light, p_realtime_color); +} + +Color BakedLight::get_realtime_color() const { + + return VS::get_singleton()->baked_light_get_realtime_color(baked_light); +} + +void BakedLight::set_realtime_energy(const float p_realtime_energy) { + + VS::get_singleton()->baked_light_set_realtime_energy(baked_light, p_realtime_energy); +} + +float BakedLight::get_realtime_energy() const { + + return VS::get_singleton()->baked_light_get_realtime_energy(baked_light); +} + + void BakedLight::set_energy_multiplier(float p_multiplier){ @@ -434,6 +466,15 @@ void BakedLight::_bind_methods(){ ObjectTypeDB::bind_method(_MD("set_ao_strength","ao_strength"),&BakedLight::set_ao_strength); ObjectTypeDB::bind_method(_MD("get_ao_strength"),&BakedLight::get_ao_strength); + ObjectTypeDB::bind_method(_MD("set_realtime_color_enabled", "enabled"), &BakedLight::set_realtime_color_enabled); + ObjectTypeDB::bind_method(_MD("get_realtime_color_enabled"), &BakedLight::get_realtime_color_enabled); + + ObjectTypeDB::bind_method(_MD("set_realtime_color", "tint"), &BakedLight::set_realtime_color); + ObjectTypeDB::bind_method(_MD("get_realtime_color"), &BakedLight::get_realtime_color); + + ObjectTypeDB::bind_method(_MD("set_realtime_energy", "energy"), &BakedLight::set_realtime_energy); + ObjectTypeDB::bind_method(_MD("get_realtime_energy"), &BakedLight::get_realtime_energy); + ObjectTypeDB::bind_method(_MD("set_format","format"),&BakedLight::set_format); ObjectTypeDB::bind_method(_MD("get_format"),&BakedLight::get_format); @@ -480,6 +521,11 @@ void BakedLight::_bind_methods(){ ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/ao_radius",PROPERTY_HINT_RANGE,"0.0,16.0,0.01"),_SCS("set_ao_radius"),_SCS("get_ao_radius")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"advanced/ao_strength",PROPERTY_HINT_RANGE,"0.0,1.0,0.01"),_SCS("set_ao_strength"),_SCS("get_ao_strength")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "realtime/enabled"), _SCS("set_realtime_color_enabled"), _SCS("get_realtime_color_enabled")); + ADD_PROPERTY(PropertyInfo(Variant::COLOR, "realtime/color", PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_realtime_color"), _SCS("get_realtime_color")); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "realtime/energy", PROPERTY_HINT_RANGE, "0.01,4096.0,0.01"), _SCS("set_realtime_energy"), _SCS("get_realtime_energy")); + + BIND_CONSTANT( MODE_OCTREE ); BIND_CONSTANT( MODE_LIGHTMAPS ); diff --git a/scene/resources/baked_light.h b/scene/resources/baked_light.h index 41e1e5f9e0..f9a1368e8d 100644 --- a/scene/resources/baked_light.h +++ b/scene/resources/baked_light.h @@ -116,6 +116,15 @@ public: void set_ao_strength(float p_ao_strength); float get_ao_strength() const; + void set_realtime_color_enabled(const bool p_enabled); + bool get_realtime_color_enabled() const; + + void set_realtime_color(const Color& p_realtime_color); + Color get_realtime_color() const; + + void set_realtime_energy(const float p_realtime_energy); + float get_realtime_energy() const; + void set_bake_flag(BakeFlags p_flags,bool p_enable); bool get_bake_flag(BakeFlags p_flags) const; diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index eabc84c41e..40ae26ba5d 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -1351,13 +1351,21 @@ ShaderGraph::ShaderGraph(Mode p_mode) : Shader(p_mode) { //shader = VisualServer::get_singleton()->shader_create(); _pending_update_shader=false; - Node out; - out.id=0; - out.pos=Vector2(250,20); - out.type=NODE_OUTPUT; + + Node input; + input.id=1; + input.pos=Vector2(50,40); + input.type=NODE_INPUT; + + Node output; + output.id=0; + output.pos=Vector2(350,40); + output.type=NODE_OUTPUT; + for(int i=0;i<3;i++) { - shader[i].node_map.insert(0,out); + shader[i].node_map.insert(0,output); + shader[i].node_map.insert(1,input); } } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 194df9596a..e2de20785a 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -528,6 +528,10 @@ public: int octree_steps; Vector2 octree_tex_pixel_size; Vector2 light_tex_pixel_size; + + bool realtime_color_enabled; + Color realtime_color; + float realtime_energy; }; struct InstanceData { diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 6d293f0ce8..1db7971d3b 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -1081,6 +1081,9 @@ RID VisualServerRaster::baked_light_create() { baked_light->data.octree_lattice_divide=0; baked_light->data.octree_steps=1; baked_light->data.lightmap_multiplier=1.0; + baked_light->data.realtime_color_enabled=false; + baked_light->data.realtime_color=Color(1.0, 1.0, 1.0); + baked_light->data.realtime_energy = 1.0; return baked_light_owner.make_rid( baked_light ); @@ -1326,6 +1329,63 @@ void VisualServerRaster::baked_light_clear_lightmaps(RID p_baked_light){ } +void VisualServerRaster::baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled) { + + VS_CHANGED; + BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND(!baked_light); + + baked_light->data.realtime_color_enabled = p_enabled; + +} + +bool VisualServerRaster::baked_light_get_realtime_color_enabled(RID p_baked_light) const{ + + const BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND_V(!baked_light, false); + + return baked_light->data.realtime_color_enabled; + +} + +void VisualServerRaster::baked_light_set_realtime_color(RID p_baked_light, const Color& p_color) { + + VS_CHANGED; + BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND(!baked_light); + + baked_light->data.realtime_color = p_color; + +} + +Color VisualServerRaster::baked_light_get_realtime_color(RID p_baked_light) const{ + + const BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND_V(!baked_light, Color(1.0, 1.0, 1.0)); + + return baked_light->data.realtime_color; + +} + +void VisualServerRaster::baked_light_set_realtime_energy(RID p_baked_light, const float p_energy) { + + VS_CHANGED; + BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND(!baked_light); + + baked_light->data.realtime_energy = p_energy; + +} + +float VisualServerRaster::baked_light_get_realtime_energy(RID p_baked_light) const{ + + const BakedLight *baked_light = baked_light_owner.get(p_baked_light); + ERR_FAIL_COND_V(!baked_light, 1.0f); + + return baked_light->data.realtime_energy; + +} + /* BAKED LIGHT SAMPLER */ diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 06501d1b81..2b72b0b900 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -949,6 +949,15 @@ public: virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id); virtual void baked_light_clear_lightmaps(RID p_baked_light); + virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled); + virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const; + + virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color); + virtual Color baked_light_get_realtime_color(RID p_baked_light) const; + + virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy); + virtual float baked_light_get_realtime_energy(RID p_baked_light) const; + /* BAKED LIGHT SAMPLER */ virtual RID baked_light_sampler_create(); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 52e38c8438..b6018f1c25 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -391,6 +391,14 @@ public: FUNC3(baked_light_add_lightmap,RID,RID,int); FUNC1(baked_light_clear_lightmaps,RID); + FUNC2(baked_light_set_realtime_color_enabled, RID, const bool); + FUNC1RC(bool, baked_light_get_realtime_color_enabled, RID); + + FUNC2(baked_light_set_realtime_color, RID, const Color&); + FUNC1RC(Color, baked_light_get_realtime_color, RID); + + FUNC2(baked_light_set_realtime_energy, RID, const float); + FUNC1RC(float, baked_light_get_realtime_energy, RID); FUNC0R(RID,baked_light_sampler_create); diff --git a/servers/visual_server.h b/servers/visual_server.h index 3a5b3d8d37..c70a72ef2a 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -626,6 +626,15 @@ public: virtual void baked_light_add_lightmap(RID p_baked_light,const RID p_texture,int p_id)=0; virtual void baked_light_clear_lightmaps(RID p_baked_light)=0; + virtual void baked_light_set_realtime_color_enabled(RID p_baked_light, const bool p_enabled)=0; + virtual bool baked_light_get_realtime_color_enabled(RID p_baked_light) const=0; + + virtual void baked_light_set_realtime_color(RID p_baked_light, const Color& p_color)=0; + virtual Color baked_light_get_realtime_color(RID p_baked_light) const=0; + + virtual void baked_light_set_realtime_energy(RID p_baked_light, const float p_energy) = 0; + virtual float baked_light_get_realtime_energy(RID p_baked_light) const = 0; + /* BAKED LIGHT SAMPLER */ virtual RID baked_light_sampler_create()=0; diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 0e6cf3277a..8e83726f96 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -273,13 +273,11 @@ void EditorFileDialog::_action_pressed() { String f=dir_access->get_current_dir().plus_file(file->get_text()); - if (mode==MODE_OPEN_FILE && dir_access->file_exists(f)) { + if ((mode==MODE_OPEN_ANY || mode==MODE_OPEN_FILE) && dir_access->file_exists(f)) { _save_to_recent(); emit_signal("file_selected",f); hide(); - } - - if (mode==MODE_OPEN_DIR) { + }else if (mode==MODE_OPEN_ANY || mode==MODE_OPEN_DIR) { String path=dir_access->get_current_dir(); @@ -413,7 +411,7 @@ void EditorFileDialog::_item_dc_selected(int p_item) { //print_line("change dir: "+String(d["name"])); dir_access->change_dir(d["name"]); - if (mode==MODE_OPEN_FILE || mode==MODE_OPEN_FILES || mode==MODE_OPEN_DIR) + if (mode==MODE_OPEN_FILE || mode==MODE_OPEN_FILES || mode==MODE_OPEN_DIR || MODE_OPEN_ANY) file->set_text(""); call_deferred("_update_file_list"); call_deferred("_update_dir"); @@ -771,8 +769,9 @@ void EditorFileDialog::set_mode(Mode p_mode) { case MODE_OPEN_FILE: get_ok()->set_text("Open"); set_title("Open a File"); makedir->hide(); break; case MODE_OPEN_FILES: get_ok()->set_text("Open"); set_title("Open File(s)"); makedir->hide(); break; - case MODE_SAVE_FILE: get_ok()->set_text("Save"); set_title("Save a File"); makedir->show(); break; case MODE_OPEN_DIR: get_ok()->set_text("Open"); set_title("Open a Directory"); makedir->show(); break; + case MODE_OPEN_ANY: get_ok()->set_text("Open"); set_title("Open a File or Directory"); makedir->show(); break; + case MODE_SAVE_FILE: get_ok()->set_text("Save"); set_title("Save a File"); makedir->show(); break; } if (mode==MODE_OPEN_FILES) { @@ -1149,6 +1148,7 @@ void EditorFileDialog::_bind_methods() { BIND_CONSTANT( MODE_OPEN_FILE ); BIND_CONSTANT( MODE_OPEN_FILES ); BIND_CONSTANT( MODE_OPEN_DIR ); + BIND_CONSTANT( MODE_OPEN_ANY ); BIND_CONSTANT( MODE_SAVE_FILE ); BIND_CONSTANT( ACCESS_RESOURCES ); diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index 3590964a51..d37856e556 100644 --- a/tools/editor/editor_file_dialog.h +++ b/tools/editor/editor_file_dialog.h @@ -66,7 +66,8 @@ public: MODE_OPEN_FILE, MODE_OPEN_FILES, MODE_OPEN_DIR, - MODE_SAVE_FILE, + MODE_OPEN_ANY, + MODE_SAVE_FILE }; typedef Ref<Texture> (*GetIconFunc)(const String&); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index fda51423d2..1133acb48c 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -406,6 +406,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/scroll_past_end_of_file", false); + set("text_editor/tab_size", 4); + hints["text_editor/tab_size"]=PropertyInfo(Variant::INT,"text_editor/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes. + set("text_editor/idle_parse_delay",2); set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_secs",0); diff --git a/tools/editor/editor_sub_scene.cpp b/tools/editor/editor_sub_scene.cpp index a1a881bec5..c5a4f6d58b 100644 --- a/tools/editor/editor_sub_scene.cpp +++ b/tools/editor/editor_sub_scene.cpp @@ -219,7 +219,7 @@ EditorSubScene::EditorSubScene() { tree = memnew( Tree ); tree->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_margin_child("Import From Node:",tree,true); - tree->connect("item_activated",this,"_ok"); + tree->connect("item_activated",this,"_ok",make_binds(),CONNECT_DEFERRED); file_dialog = memnew( EditorFileDialog ); List<String> extensions; diff --git a/tools/editor/plugins/particles_2d_editor_plugin.cpp b/tools/editor/plugins/particles_2d_editor_plugin.cpp index 2488c4cdd9..297145f408 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.cpp +++ b/tools/editor/plugins/particles_2d_editor_plugin.cpp @@ -26,10 +26,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "particles_2d_editor_plugin.h" #include "canvas_item_editor_plugin.h" #include "io/image_loader.h" - +#include "scene/gui/separator.h" void Particles2DEditorPlugin::edit(Object *p_object) { @@ -49,12 +50,10 @@ void Particles2DEditorPlugin::make_visible(bool p_visible) { if (p_visible) { - sep->show(); - menu->show(); + toolbar->show(); } else { - menu->hide(); - sep->hide(); + toolbar->hide(); } } @@ -164,35 +163,36 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) { particles=NULL; editor=p_node; undo_redo=editor->get_undo_redo(); - sep = memnew( VSeparator ); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(sep); - sep->hide(); + + toolbar = memnew( HBoxContainer ); + add_control_to_container(CONTAINER_CANVAS_EDITOR_MENU, toolbar); + toolbar->hide(); + + toolbar->add_child( memnew( VSeparator ) ); menu = memnew( MenuButton ); menu->get_popup()->add_item("Load Emission Mask",MENU_LOAD_EMISSION_MASK); menu->get_popup()->add_item("Clear Emission Mask",MENU_CLEAR_EMISSION_MASK); menu->set_text("Particles"); + toolbar->add_child(menu); - file = memnew(EditorFileDialog); - add_child(file); + file = memnew( EditorFileDialog ); List<String> ext; ImageLoader::get_recognized_extensions(&ext); for(List<String>::Element *E=ext.front();E;E=E->next()) { file->add_filter("*."+E->get()+"; "+E->get().to_upper()); } file->set_mode(EditorFileDialog::MODE_OPEN_FILE); - CanvasItemEditor::get_singleton()->add_control_to_menu_panel(menu); + toolbar->add_child(file); + epoints = memnew( SpinBox ); epoints->set_min(1); epoints->set_max(8192); epoints->set_step(1); epoints->set_val(512); file->get_vbox()->add_margin_child("Generated Point Count:",epoints); - menu->hide(); - } - Particles2DEditorPlugin::~Particles2DEditorPlugin() { } diff --git a/tools/editor/plugins/particles_2d_editor_plugin.h b/tools/editor/plugins/particles_2d_editor_plugin.h index f70a0e7b76..ce2056b482 100644 --- a/tools/editor/plugins/particles_2d_editor_plugin.h +++ b/tools/editor/plugins/particles_2d_editor_plugin.h @@ -33,7 +33,7 @@ #include "tools/editor/editor_node.h" #include "scene/2d/collision_polygon_2d.h" -#include "scene/gui/separator.h" +#include "scene/gui/box_container.h" #include "scene/gui/file_dialog.h" #include "scene/2d/particles_2d.h" @@ -47,14 +47,14 @@ class Particles2DEditorPlugin : public EditorPlugin { MENU_CLEAR_EMISSION_MASK }; + Particles2D *particles; EditorFileDialog *file; EditorNode *editor; + HBoxContainer *toolbar; MenuButton *menu; - VSeparator *sep; - Particles2D *particles; SpinBox *epoints; UndoRedo *undo_redo; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 76c64beb61..03db293959 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1930,6 +1930,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { ste->get_text_edit()->set_tooltip_request_func(this,"_get_debug_tooltip",ste); ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); + ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); ste->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); @@ -2067,6 +2068,7 @@ void ScriptEditor::_editor_settings_changed() { ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); + ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); } } |