diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-20 17:26:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-20 17:26:52 +0200 |
commit | d21b73779fb740ef8b08130a9b1f3f0cfdaa7be7 (patch) | |
tree | 5fcc2abc7cf4bc7b4d2897614e26286ceee2c54d | |
parent | 48db920f4ac2da60b23a2bddb8ebc5cbee35508b (diff) | |
parent | cf2ae78956c8ddc010062cf5eff38e40229a3665 (diff) |
Merge pull request #32180 from KoBeWi/nein_patsch_rekt
Fix region editor for NinePatchRect
-rw-r--r-- | doc/classes/NinePatchRect.xml | 2 | ||||
-rw-r--r-- | editor/plugins/texture_region_editor_plugin.cpp | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/classes/NinePatchRect.xml b/doc/classes/NinePatchRect.xml index f191b08d96..ce7a6ef54c 100644 --- a/doc/classes/NinePatchRect.xml +++ b/doc/classes/NinePatchRect.xml @@ -51,7 +51,7 @@ The height of the 9-slice's top row. </member> <member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect" default="Rect2( 0, 0, 0, 0 )"> - Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one. + Rectangular region of the texture to sample from. If you're working with an atlas, use this property to define the area the 9-slice should use. All other properties are relative to this one. If the rect is empty, NinePatchRect will use the whole texture. </member> <member name="texture" type="Texture" setter="set_texture" getter="get_texture"> The node's texture resource. diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 4d349f06b7..21eebf9ca2 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -625,9 +625,12 @@ void TextureRegionEditor::_update_rect() { rect = node_sprite->get_region_rect(); else if (node_sprite_3d) rect = node_sprite_3d->get_region_rect(); - else if (node_ninepatch) + else if (node_ninepatch) { rect = node_ninepatch->get_region_rect(); - else if (obj_styleBox.is_valid()) + if (rect == Rect2()) { + rect = Rect2(Vector2(), node_ninepatch->get_texture()->get_size()); + } + } else if (obj_styleBox.is_valid()) rect = obj_styleBox->get_region_rect(); else if (atlas_tex.is_valid()) rect = atlas_tex->get_region(); |