mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	[3.2] Fix port previews for uniforms in visual shaders
This commit is contained in:
		
							parent
							
								
									e6a8235682
								
							
						
					
					
						commit
						44817dbe6b
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		|  | @ -3348,11 +3348,17 @@ void VisualShaderNodePortPreview::_shader_changed() { | ||||||
| 
 | 
 | ||||||
| 	for (int i = EditorNode::get_singleton()->get_editor_history()->get_path_size() - 1; i >= 0; i--) { | 	for (int i = EditorNode::get_singleton()->get_editor_history()->get_path_size() - 1; i >= 0; i--) { | ||||||
| 		Object *object = ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_history()->get_path_object(i)); | 		Object *object = ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_history()->get_path_object(i)); | ||||||
|  | 		ShaderMaterial *src_mat; | ||||||
| 		if (!object) | 		if (!object) | ||||||
| 			continue; | 			continue; | ||||||
| 		ShaderMaterial *src_mat = Object::cast_to<ShaderMaterial>(object); | 		if (object->has_method("get_material_override")) { // trying getting material from MeshInstance
 | ||||||
|  | 			src_mat = Object::cast_to<ShaderMaterial>(object->call("get_material_override")); | ||||||
|  | 		} else if (object->has_method("get_material")) { // from CanvasItem/Node2D
 | ||||||
|  | 			src_mat = Object::cast_to<ShaderMaterial>(object->call("get_material")); | ||||||
|  | 		} else { | ||||||
|  | 			src_mat = Object::cast_to<ShaderMaterial>(object); | ||||||
|  | 		} | ||||||
| 		if (src_mat && src_mat->get_shader().is_valid()) { | 		if (src_mat && src_mat->get_shader().is_valid()) { | ||||||
| 
 |  | ||||||
| 			List<PropertyInfo> params; | 			List<PropertyInfo> params; | ||||||
| 			src_mat->get_shader()->get_param_list(¶ms); | 			src_mat->get_shader()->get_param_list(¶ms); | ||||||
| 			for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) { | 			for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yuri Roubinsky
						Yuri Roubinsky