diff options
| author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2023-05-03 20:07:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-03 20:07:00 +0200 |
| commit | 2816825e44218fbf35c57b1d771edcc474f3db27 (patch) | |
| tree | 1498d6da3ba66a2a92d80cd0d76346d82fc032fb | |
| parent | f0080279d31acec4d67904d20192d6d6a67287ad (diff) | |
| parent | d3792a237331f56efdb36b1753f171ddc99629db (diff) | |
| download | redot-engine-2816825e44218fbf35c57b1d771edcc474f3db27.tar.gz | |
Merge pull request #76555 from Tetane/master
Fix 2D shader preview draws over uniform
| -rw-r--r-- | editor/plugins/material_editor_plugin.cpp | 12 | ||||
| -rw-r--r-- | editor/plugins/material_editor_plugin.h | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 2fdebc7c7f..404711e074 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -164,9 +164,19 @@ void MaterialEditor::_button_pressed(Node *p_button) { MaterialEditor::MaterialEditor() { // canvas item + vc_2d = memnew(SubViewportContainer); + vc_2d->set_stretch(true); + add_child(vc_2d); + vc_2d->set_anchors_and_offsets_preset(PRESET_FULL_RECT); + + viewport_2d = memnew(SubViewport); + vc_2d->add_child(viewport_2d); + viewport_2d->set_disable_input(true); + viewport_2d->set_transparent_background(true); + layout_2d = memnew(HBoxContainer); layout_2d->set_alignment(BoxContainer::ALIGNMENT_CENTER); - add_child(layout_2d); + viewport_2d->add_child(layout_2d); layout_2d->set_anchors_and_offsets_preset(PRESET_FULL_RECT); rect_instance = memnew(ColorRect); diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h index deb1211c54..ac81bdc7c7 100644 --- a/editor/plugins/material_editor_plugin.h +++ b/editor/plugins/material_editor_plugin.h @@ -51,6 +51,8 @@ class MaterialEditor : public Control { Vector2 rot; + SubViewportContainer *vc_2d = nullptr; + SubViewport *viewport_2d = nullptr; HBoxContainer *layout_2d = nullptr; ColorRect *rect_instance = nullptr; |
