mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 07:31:16 +00:00 
			
		
		
		
	Merge pull request #22771 from guilhermefelipecgs/fix_inspector_preview
Fix inspector preview
This commit is contained in:
		
						commit
						604810f611
					
				
					 4 changed files with 11 additions and 5 deletions
				
			
		| 
						 | 
					@ -2102,12 +2102,18 @@ void EditorPropertyResource::_menu_option(int p_which) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture> &p_preview, ObjectID p_obj) {
 | 
					void EditorPropertyResource::_resource_preview(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, ObjectID p_obj) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RES p = get_edited_object()->get(get_edited_property());
 | 
						RES p = get_edited_object()->get(get_edited_property());
 | 
				
			||||||
	if (p.is_valid() && p->get_instance_id() == p_obj) {
 | 
						if (p.is_valid() && p->get_instance_id() == p_obj) {
 | 
				
			||||||
		if (p_preview.is_valid()) {
 | 
					 | 
				
			||||||
		String type = p->get_class_name();
 | 
							String type = p->get_class_name();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (ClassDB::is_parent_class(type, "Script")) {
 | 
				
			||||||
 | 
								assign->set_text(p->get_path().get_file());
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (p_preview.is_valid()) {
 | 
				
			||||||
			preview->set_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_constant("hseparation", "Button"));
 | 
								preview->set_margin(MARGIN_LEFT, assign->get_icon()->get_width() + assign->get_stylebox("normal")->get_default_margin(MARGIN_LEFT) + get_constant("hseparation", "Button"));
 | 
				
			||||||
			if (type == "GradientTexture") {
 | 
								if (type == "GradientTexture") {
 | 
				
			||||||
				preview->set_stretch_mode(TextureRect::STRETCH_SCALE);
 | 
									preview->set_stretch_mode(TextureRect::STRETCH_SCALE);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -548,7 +548,7 @@ class EditorPropertyResource : public EditorProperty {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void _file_selected(const String &p_path);
 | 
						void _file_selected(const String &p_path);
 | 
				
			||||||
	void _menu_option(int p_which);
 | 
						void _menu_option(int p_which);
 | 
				
			||||||
	void _resource_preview(const String &p_path, const Ref<Texture> &p_preview, ObjectID p_obj);
 | 
						void _resource_preview(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, ObjectID p_obj);
 | 
				
			||||||
	void _resource_selected();
 | 
						void _resource_selected();
 | 
				
			||||||
	void _viewport_selected(const NodePath &p_path);
 | 
						void _viewport_selected(const NodePath &p_path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1940,7 +1940,7 @@ void VisualScriptEditor::_draw_color_over_button(Object *obj, Color p_color) {
 | 
				
			||||||
	button->draw_rect(Rect2(normal->get_offset(), button->get_size() - normal->get_minimum_size()), p_color);
 | 
						button->draw_rect(Rect2(normal->get_offset(), button->get_size() - normal->get_minimum_size()), p_color);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void VisualScriptEditor::_button_resource_previewed(const String &p_path, const Ref<Texture> &p_preview, Variant p_ud) {
 | 
					void VisualScriptEditor::_button_resource_previewed(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, Variant p_ud) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Array ud = p_ud;
 | 
						Array ud = p_ud;
 | 
				
			||||||
	ERR_FAIL_COND(ud.size() != 2);
 | 
						ERR_FAIL_COND(ud.size() != 2);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -237,7 +237,7 @@ class VisualScriptEditor : public ScriptEditorBase {
 | 
				
			||||||
	void _selected_method(const String &p_method, const String &p_type);
 | 
						void _selected_method(const String &p_method, const String &p_type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void _draw_color_over_button(Object *obj, Color p_color);
 | 
						void _draw_color_over_button(Object *obj, Color p_color);
 | 
				
			||||||
	void _button_resource_previewed(const String &p_path, const Ref<Texture> &p_preview, Variant p_ud);
 | 
						void _button_resource_previewed(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, Variant p_ud);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	VisualScriptNode::TypeGuess _guess_output_type(int p_port_action_node, int p_port_action_output, Set<int> &visited_nodes);
 | 
						VisualScriptNode::TypeGuess _guess_output_type(int p_port_action_node, int p_port_action_output, Set<int> &visited_nodes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue