Merge pull request #2284 from QuantumCoderQC/TerrainTextureFix
Fix terrain export for Krom
This commit is contained in:
commit
1532a332ff
|
@ -131,10 +131,17 @@ class UniformsManager extends Trait{
|
||||||
uniformExist = true;
|
uniformExist = true;
|
||||||
var object = Scene.active.root; // Map default texture to scene root
|
var object = Scene.active.root; // Map default texture to scene root
|
||||||
|
|
||||||
iron.data.Data.getImage(texture.default_image_file, function(image: kha.Image) {
|
if(texture.default_image_file == null){
|
||||||
setTextureValue(material, object, texture.link, image);
|
setTextureValue(material, object, texture.link, null);
|
||||||
|
|
||||||
});
|
}
|
||||||
|
else{
|
||||||
|
iron.data.Data.getImage(texture.default_image_file, function(image: kha.Image) {
|
||||||
|
setTextureValue(material, object, texture.link, image);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
register(Texture);
|
register(Texture);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,11 +120,11 @@ def parse_tex_image(node: bpy.types.ShaderNodeTexImage, out_socket: bpy.types.No
|
||||||
if node.arm_material_param:
|
if node.arm_material_param:
|
||||||
tex_link = node.name
|
tex_link = node.name
|
||||||
is_arm_mat_param = True
|
is_arm_mat_param = True
|
||||||
if tex['file'] is not None:
|
|
||||||
tex_default_file = tex['file']
|
|
||||||
|
|
||||||
if tex is not None:
|
if tex is not None:
|
||||||
state.curshader.write_textures += 1
|
state.curshader.write_textures += 1
|
||||||
|
if node.arm_material_param and tex['file'] is not None:
|
||||||
|
tex_default_file = tex['file']
|
||||||
if use_color_out:
|
if use_color_out:
|
||||||
to_linear = node.image is not None and node.image.colorspace_settings.name == 'sRGB'
|
to_linear = node.image is not None and node.image.colorspace_settings.name == 'sRGB'
|
||||||
res = f'{c.texture_store(node, tex, tex_name, to_linear, tex_link=tex_link, default_value=tex_default_file, is_arm_mat_param=is_arm_mat_param)}.rgb'
|
res = f'{c.texture_store(node, tex, tex_name, to_linear, tex_link=tex_link, default_value=tex_default_file, is_arm_mat_param=is_arm_mat_param)}.rgb'
|
||||||
|
@ -140,8 +140,8 @@ def parse_tex_image(node: bpy.types.ShaderNodeTexImage, out_socket: bpy.types.No
|
||||||
'file': ''
|
'file': ''
|
||||||
}
|
}
|
||||||
if use_color_out:
|
if use_color_out:
|
||||||
return '{0}.rgb'.format(c.texture_store(node, tex, tex_name, to_linear=False, tex_link=tex_link))
|
return '{0}.rgb'.format(c.texture_store(node, tex, tex_name, to_linear=False, tex_link=tex_link, is_arm_mat_param=is_arm_mat_param))
|
||||||
return '{0}.a'.format(c.texture_store(node, tex, tex_name, to_linear=True, tex_link=tex_link))
|
return '{0}.a'.format(c.texture_store(node, tex, tex_name, to_linear=True, tex_link=tex_link, is_arm_mat_param=is_arm_mat_param))
|
||||||
|
|
||||||
# Pink color for missing texture
|
# Pink color for missing texture
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1923,7 +1923,7 @@ class ArmGenTerrainButton(bpy.types.Operator):
|
||||||
node.location = (-200, -200)
|
node.location = (-200, -200)
|
||||||
node.inputs[0].default_value = 5.0
|
node.inputs[0].default_value = 5.0
|
||||||
links.new(nodes['Bump'].inputs[2], nodes['_TerrainHeight'].outputs[0])
|
links.new(nodes['Bump'].inputs[2], nodes['_TerrainHeight'].outputs[0])
|
||||||
links.new(nodes['Principled BSDF'].inputs[17], nodes['Bump'].outputs[0])
|
links.new(nodes['Principled BSDF'].inputs[20], nodes['Bump'].outputs[0])
|
||||||
|
|
||||||
# Create sectors
|
# Create sectors
|
||||||
root_obj = bpy.data.objects.new("Terrain", None)
|
root_obj = bpy.data.objects.new("Terrain", None)
|
||||||
|
|
Loading…
Reference in a new issue