mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 05:31:01 +00:00 
			
		
		
		
	Fix spatial shader conversion with texture
This commit is contained in:
		
							parent
							
								
									f52ab8d864
								
							
						
					
					
						commit
						3bd2a4c421
					
				
					 3 changed files with 21 additions and 2 deletions
				
			
		|  | @ -449,8 +449,16 @@ Ref<Resource> SpatialMaterialConversionPlugin::convert(const Ref<Resource> &p_re | |||
| 	VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), ¶ms); | ||||
| 
 | ||||
| 	for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) { | ||||
| 		Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name); | ||||
| 		smat->set_shader_param(E->get().name, value); | ||||
| 
 | ||||
| 		// Texture parameter has to be treated specially since SpatialMaterial saved it
 | ||||
| 		// as RID but ShaderMaterial needs Texture itself
 | ||||
| 		Ref<Texture> texture = mat->get_texture_by_name(E->get().name); | ||||
| 		if (texture.is_valid()) { | ||||
| 			smat->set_shader_param(E->get().name, texture); | ||||
| 		} else { | ||||
| 			Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name); | ||||
| 			smat->set_shader_param(E->get().name, value); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	smat->set_render_priority(mat->get_render_priority()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hiroshi Ogawa
						Hiroshi Ogawa