Merge pull request #6788 from Hinsbart/region_refresh
Refresh TextureRegionEditor when region has been changed externally.
This commit is contained in:
commit
12843167ca
2 changed files with 9 additions and 0 deletions
|
@ -653,6 +653,7 @@ void TextureRegionEditor::edit(Object *p_obj)
|
||||||
} else {
|
} else {
|
||||||
p_obj->connect("texture_changed",this,"_edit_region");
|
p_obj->connect("texture_changed",this,"_edit_region");
|
||||||
}
|
}
|
||||||
|
p_obj->add_change_receptor(this);
|
||||||
p_obj->connect("exit_tree",this,"_node_removed",varray(p_obj),CONNECT_ONESHOT);
|
p_obj->connect("exit_tree",this,"_node_removed",varray(p_obj),CONNECT_ONESHOT);
|
||||||
_edit_region();
|
_edit_region();
|
||||||
} else {
|
} else {
|
||||||
|
@ -673,6 +674,12 @@ void TextureRegionEditor::edit(Object *p_obj)
|
||||||
edit_draw->update();
|
edit_draw->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_prop) {
|
||||||
|
if ((String)p_prop == "region_rect") {
|
||||||
|
_edit_region();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TextureRegionEditor::_edit_region()
|
void TextureRegionEditor::_edit_region()
|
||||||
{
|
{
|
||||||
Ref<Texture> texture = NULL;
|
Ref<Texture> texture = NULL;
|
||||||
|
|
|
@ -116,6 +116,8 @@ protected:
|
||||||
|
|
||||||
Vector2 snap_point(Vector2 p_target) const;
|
Vector2 snap_point(Vector2 p_target) const;
|
||||||
|
|
||||||
|
virtual void _changed_callback(Object *p_changed, const char *p_prop);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void _edit_region();
|
void _edit_region();
|
||||||
|
|
Loading…
Reference in a new issue