summaryrefslogtreecommitdiff
path: root/editor/plugins/texture_region_editor_plugin.h
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-05-24 00:35:01 +0200
committerreduz <reduzio@gmail.com>2022-05-24 09:42:49 +0200
commit4044cc7d5753e44b586b63271f2a80f7a5fa05f9 (patch)
tree32dec6e752e3e7936595ae4cfb1753c9413b177e /editor/plugins/texture_region_editor_plugin.h
parent56dbfcdcbadf2c958d9656e4e3b7443b9bb11be1 (diff)
Reorganize Region Rect Editor
Problem: * Region rect was pretty much a hidden editor. Because it was annoying for it to pop up automatically, it did not. * Because it did not, most users have no idea it even exists. * But because it is a transient editor, it would steal focus of other editor and annoy users. Solution: * Editor has been moved to a window. * Regions that can be edited add a button below the region which can be pressed to open the editor. This required a slight change in EditorInspectorPlugin to allow custom editors to be below others.
Diffstat (limited to 'editor/plugins/texture_region_editor_plugin.h')
-rw-r--r--editor/plugins/texture_region_editor_plugin.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 2c4ab72743..dd92f6e3eb 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -41,8 +41,8 @@
class ViewPanner;
-class TextureRegionEditor : public VBoxContainer {
- GDCLASS(TextureRegionEditor, VBoxContainer);
+class TextureRegionEditor : public AcceptDialog {
+ GDCLASS(TextureRegionEditor, AcceptDialog);
enum SnapMode {
SNAP_NONE,
@@ -142,26 +142,27 @@ public:
TextureRegionEditor();
};
-class TextureRegionEditorPlugin : public EditorPlugin {
- GDCLASS(TextureRegionEditorPlugin, EditorPlugin);
+//
- bool manually_hidden;
- Button *texture_region_button = nullptr;
- TextureRegionEditor *region_editor = nullptr;
+class EditorInspectorPluginTextureRegion : public EditorInspectorPlugin {
+ GDCLASS(EditorInspectorPluginTextureRegion, EditorInspectorPlugin);
-protected:
- static void _bind_methods();
+ TextureRegionEditor *texture_region_editor = nullptr;
+
+ void _region_edit(Object *p_object);
- void _editor_visiblity_changed();
+public:
+ virtual bool can_handle(Object *p_object) override;
+ virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide) override;
+
+ EditorInspectorPluginTextureRegion();
+};
+
+class TextureRegionEditorPlugin : public EditorPlugin {
+ GDCLASS(TextureRegionEditorPlugin, EditorPlugin);
public:
virtual String get_name() const override { return "TextureRegion"; }
- bool has_main_screen() const override { return false; }
- virtual void edit(Object *p_object) override;
- virtual bool handles(Object *p_object) const override;
- virtual void make_visible(bool p_visible) override;
- void set_state(const Dictionary &p_state) override;
- Dictionary get_state() const override;
TextureRegionEditorPlugin();
};