Cycles: Make Blender importer more forward compatible
Basically the idea is to make code robust against extending enum options in the future by falling back to a known safe default setting when RNA is set to something unknown. While this approach solves the issues similar to T47377, but it wouldn't really help when/if any of the RNA values gets ever deprecated and removed. There'll be no simple solution to that apart from defining explicit mapping from RNA value to Cycles one. Another part which isn't so great actually is that we now have to have some enum guards and give some explicit values to the enum items, but we can live with that perhaps. Reviewers: dingto, juicyfruit, lukasstockner97, brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D1785
This commit is contained in:
		@@ -827,7 +827,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object& b_ob,
 | 
			
		||||
 | 
			
		||||
	/* displacement method */
 | 
			
		||||
	if(cmesh.data) {
 | 
			
		||||
		const int method = get_enum(cmesh, "displacement_method");
 | 
			
		||||
		const int method = get_enum(cmesh,
 | 
			
		||||
		                            "displacement_method",
 | 
			
		||||
		                            Mesh::DISPLACE_NUM_METHODS,
 | 
			
		||||
		                            Mesh::DISPLACE_BUMP);
 | 
			
		||||
 | 
			
		||||
		if(method == 0 || !experimental)
 | 
			
		||||
			mesh->displacement_method = Mesh::DISPLACE_BUMP;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user