Explorar o código

Merge pull request #512 from marynate/PR-fix-texture-preview-not-update

Fixed #185 Setting a new Texture for a Sprite node does not update preview
reduz %!s(int64=11) %!d(string=hai) anos
pai
achega
59fd2c51f6
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      tools/editor/property_editor.cpp

+ 7 - 0
tools/editor/property_editor.cpp

@@ -1828,6 +1828,13 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
 			if (obj->get( p_name ).get_type() == Variant::NIL || obj->get( p_name ).operator RefPtr().is_null()) {
 			if (obj->get( p_name ).get_type() == Variant::NIL || obj->get( p_name ).operator RefPtr().is_null()) {
 				p_item->set_text(1,"<null>");
 				p_item->set_text(1,"<null>");
 
 
+				Dictionary d = p_item->get_metadata(0);
+				int hint=d.has("hint")?d["hint"].operator int():-1;
+				String hint_text=d.has("hint_text")?d["hint_text"]:"";
+				if (hint==PROPERTY_HINT_RESOURCE_TYPE && hint_text == "Texture") {
+					p_item->set_icon(1,NULL);
+				}
+
 			} else {
 			} else {
 				RES res = obj->get( p_name ).operator RefPtr();
 				RES res = obj->get( p_name ).operator RefPtr();
 				if (res->is_type("Texture")) {
 				if (res->is_type("Texture")) {