From 3bad8786508d584e47ff5b8c9d3e255770184caa Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Mon, 26 Jul 2021 13:48:44 +0200 Subject: [PATCH 1/3] Add exception for null data --- Sources/armory/trait/internal/UniformsManager.hx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/armory/trait/internal/UniformsManager.hx b/Sources/armory/trait/internal/UniformsManager.hx index b33624d9..e559fc89 100644 --- a/Sources/armory/trait/internal/UniformsManager.hx +++ b/Sources/armory/trait/internal/UniformsManager.hx @@ -131,10 +131,17 @@ class UniformsManager extends Trait{ uniformExist = true; var object = Scene.active.root; // Map default texture to scene root - iron.data.Data.getImage(texture.default_image_file, function(image: kha.Image) { - setTextureValue(material, object, texture.link, image); - - }); + if(texture.default_image_file == null){ + 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); } From 9ec425f6aec1dfa5afecef2399a84bffad993e65 Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Mon, 26 Jul 2021 13:50:52 +0200 Subject: [PATCH 2/3] get file name only if specifiedin node --- blender/arm/material/cycles_nodes/nodes_texture.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blender/arm/material/cycles_nodes/nodes_texture.py b/blender/arm/material/cycles_nodes/nodes_texture.py index 9952a0cb..379d4ca1 100644 --- a/blender/arm/material/cycles_nodes/nodes_texture.py +++ b/blender/arm/material/cycles_nodes/nodes_texture.py @@ -120,11 +120,11 @@ def parse_tex_image(node: bpy.types.ShaderNodeTexImage, out_socket: bpy.types.No if node.arm_material_param: tex_link = node.name is_arm_mat_param = True - if tex['file'] is not None: - tex_default_file = tex['file'] if tex is not None: 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: 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' @@ -140,8 +140,8 @@ def parse_tex_image(node: bpy.types.ShaderNodeTexImage, out_socket: bpy.types.No 'file': '' } if use_color_out: - return '{0}.rgb'.format(c.texture_store(node, tex, tex_name, to_linear=False, tex_link=tex_link)) - return '{0}.a'.format(c.texture_store(node, tex, tex_name, to_linear=True, 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, is_arm_mat_param=is_arm_mat_param)) # Pink color for missing texture else: From 9f7af6a1cda8f7ce3e47cdd4992f3454d5732877 Mon Sep 17 00:00:00 2001 From: QuantumCoderQC Date: Mon, 26 Jul 2021 18:02:23 +0200 Subject: [PATCH 3/3] Change terrain material bump output to normal --- blender/arm/props_ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blender/arm/props_ui.py b/blender/arm/props_ui.py index e368dcc2..4a37b470 100644 --- a/blender/arm/props_ui.py +++ b/blender/arm/props_ui.py @@ -1923,7 +1923,7 @@ class ArmGenTerrainButton(bpy.types.Operator): node.location = (-200, -200) node.inputs[0].default_value = 5.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 root_obj = bpy.data.objects.new("Terrain", None)