diff options
-rw-r--r-- | editor/editor_properties.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/animation_tree_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 51 | ||||
-rw-r--r-- | editor/plugins/material_editor_plugin.h | 28 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_cache.cpp | 10 | ||||
-rw-r--r-- | scene/2d/animated_sprite_2d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/sprite_3d.cpp | 2 |
8 files changed, 72 insertions, 27 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 8e8a290ebb..5280a8e7d3 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -3065,7 +3065,7 @@ void EditorPropertyResource::update_property() { if (res.is_valid() && get_edited_object()->editor_is_section_unfolded(get_edited_property())) { if (!sub_inspector) { sub_inspector = memnew(EditorInspector); - sub_inspector->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); + sub_inspector->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); sub_inspector->set_use_doc_hints(true); sub_inspector->set_sub_inspector(true); diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 258eb9005f..d65ed9cea2 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -226,7 +226,7 @@ AnimationTreeEditor::AnimationTreeEditor() { AnimationNodeAnimation::get_editable_animation_list = get_animation_list; path_edit = memnew(ScrollContainer); add_child(path_edit); - path_edit->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); + path_edit->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); path_hb = memnew(HBoxContainer); path_edit->add_child(path_hb); path_hb->add_child(memnew(Label(TTR("Path:")))); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 140d2952dd..f133d9d415 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -69,8 +69,24 @@ void MaterialEditor::edit(Ref<Material> p_material, const Ref<Environment> &p_en material = p_material; camera->set_environment(p_env); if (!material.is_null()) { - sphere_instance->set_material_override(material); - box_instance->set_material_override(material); + Shader::Mode mode = p_material->get_shader_mode(); + switch (mode) { + case Shader::MODE_CANVAS_ITEM: + layout_3d->hide(); + layout_2d->show(); + vc->hide(); + rect_instance->set_material(material); + break; + case Shader::MODE_SPATIAL: + layout_2d->hide(); + layout_3d->show(); + vc->show(); + sphere_instance->set_material_override(material); + box_instance->set_material_override(material); + break; + default: + break; + } } else { hide(); } @@ -106,6 +122,21 @@ void MaterialEditor::_bind_methods() { } MaterialEditor::MaterialEditor() { + // canvas item + + layout_2d = memnew(HBoxContainer); + layout_2d->set_alignment(BoxContainer::ALIGN_CENTER); + add_child(layout_2d); + layout_2d->set_anchors_and_offsets_preset(PRESET_WIDE); + + rect_instance = memnew(ColorRect); + layout_2d->add_child(rect_instance); + rect_instance->set_custom_minimum_size(Size2(150, 150) * EDSCALE); + + layout_2d->set_visible(false); + + // spatial + vc = memnew(SubViewportContainer); vc->set_stretch(true); add_child(vc); @@ -154,12 +185,12 @@ MaterialEditor::MaterialEditor() { set_custom_minimum_size(Size2(1, 150) * EDSCALE); - HBoxContainer *hb = memnew(HBoxContainer); - add_child(hb); - hb->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2); + layout_3d = memnew(HBoxContainer); + add_child(layout_3d); + layout_3d->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 2); VBoxContainer *vb_shape = memnew(VBoxContainer); - hb->add_child(vb_shape); + layout_3d->add_child(vb_shape); sphere_switch = memnew(TextureButton); sphere_switch->set_toggle_mode(true); @@ -173,10 +204,10 @@ MaterialEditor::MaterialEditor() { vb_shape->add_child(box_switch); box_switch->connect("pressed", callable_mp(this, &MaterialEditor::_button_pressed), varray(box_switch)); - hb->add_spacer(); + layout_3d->add_spacer(); VBoxContainer *vb_light = memnew(VBoxContainer); - hb->add_child(vb_light); + layout_3d->add_child(vb_light); light_1_switch = memnew(TextureButton); light_1_switch->set_toggle_mode(true); @@ -207,8 +238,8 @@ bool EditorInspectorPluginMaterial::can_handle(Object *p_object) { if (!material) { return false; } - - return material->get_shader_mode() == Shader::MODE_SPATIAL; + Shader::Mode mode = material->get_shader_mode(); + return mode == Shader::MODE_SPATIAL || mode == Shader::MODE_CANVAS_ITEM; } void EditorInspectorPluginMaterial::parse_begin(Object *p_object) { diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index 62549843f7..8262b8149d 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -39,6 +39,7 @@ #include "scene/3d/camera_3d.h" #include "scene/3d/light_3d.h" #include "scene/3d/mesh_instance_3d.h" +#include "scene/gui/color_rect.h" #include "scene/resources/material.h" class SubViewportContainer; @@ -46,22 +47,27 @@ class SubViewportContainer; class MaterialEditor : public Control { GDCLASS(MaterialEditor, Control); - SubViewportContainer *vc; - SubViewport *viewport; - MeshInstance3D *sphere_instance; - MeshInstance3D *box_instance; - DirectionalLight3D *light1; - DirectionalLight3D *light2; - Camera3D *camera; + HBoxContainer *layout_2d = nullptr; + ColorRect *rect_instance = nullptr; + + SubViewportContainer *vc = nullptr; + SubViewport *viewport = nullptr; + MeshInstance3D *sphere_instance = nullptr; + MeshInstance3D *box_instance = nullptr; + DirectionalLight3D *light1 = nullptr; + DirectionalLight3D *light2 = nullptr; + Camera3D *camera = nullptr; Ref<SphereMesh> sphere_mesh; Ref<BoxMesh> box_mesh; - TextureButton *sphere_switch; - TextureButton *box_switch; + HBoxContainer *layout_3d = nullptr; + + TextureButton *sphere_switch = nullptr; + TextureButton *box_switch = nullptr; - TextureButton *light_1_switch; - TextureButton *light_2_switch; + TextureButton *light_1_switch = nullptr; + TextureButton *light_2_switch = nullptr; Ref<Material> material; diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index f194e81438..660eb94cf5 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -2385,7 +2385,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { atlas_source_inspector = memnew(EditorInspector); atlas_source_inspector->set_undo_redo(undo_redo); - atlas_source_inspector->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); + atlas_source_inspector->set_vertical_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); atlas_source_inspector->edit(atlas_source_proxy_object); middle_vbox_container->add_child(atlas_source_inspector); diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp index bb0d9e9e9b..e99bcddeb7 100644 --- a/modules/gdscript/gdscript_cache.cpp +++ b/modules/gdscript/gdscript_cache.cpp @@ -192,7 +192,15 @@ Ref<GDScript> GDScriptCache::get_full_script(const String &p_path, Error &r_erro r_error = OK; if (singleton->full_gdscript_cache.has(p_path)) { - return singleton->full_gdscript_cache[p_path]; + Ref<GDScript> script = singleton->full_gdscript_cache[p_path]; +#ifdef TOOLS_ENABLED + uint64_t mt = FileAccess::get_modified_time(p_path); + if (script->get_last_modified_time() == mt) { + return script; + } +#else + return script; +#endif //TOOLS_ENABLED } Ref<GDScript> script = get_shallow_script(p_path); diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index fad4784d51..98aa2ad4cc 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -122,7 +122,7 @@ void AnimatedSprite2D::_validate_property(PropertyInfo &property) const { } property.hint_string += String(E->get()); - if (animation == E) { + if (animation == E->get()) { current_found = true; } } diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 197a5c0f27..3eabc6b562 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -998,7 +998,7 @@ void AnimatedSprite3D::_validate_property(PropertyInfo &property) const { } property.hint_string += String(E->get()); - if (animation == E) { + if (animation == E->get()) { current_found = true; } } |