def test_a_texture_without_an_image_filepath_is_not_supported(self): obj = bpy.data.materials.new("Material") obj.use_nodes = True bsdf = obj.node_tree.nodes["Principled BSDF"] node = obj.node_tree.nodes.new(type="ShaderNodeTexImage") obj.node_tree.links.new(bsdf.inputs["Base Color"], node.outputs["Color"]) assert subject.can_support_texture_style(obj) is False
def test_the_texture_needs_to_connect_to_the_bsdf(self): obj = bpy.data.materials.new("Material") obj.use_nodes = True bsdf = obj.node_tree.nodes["Principled BSDF"] node = obj.node_tree.nodes.new(type="ShaderNodeTexImage") cwd = os.path.dirname(os.path.realpath(__file__)) image_path = os.path.join(cwd, "..", "files", "image.jpg") node.image = bpy.data.images.load(image_path) assert subject.can_support_texture_style(obj) is False
def test_we_need_at_least_one_image_connected_to_a_bsdf(self): obj = bpy.data.materials.new("Material") obj.use_nodes = True bsdf = obj.node_tree.nodes["Principled BSDF"] node = obj.node_tree.nodes.new(type="ShaderNodeTexImage") cwd = os.path.dirname(os.path.realpath(__file__)) image_path = os.path.join(cwd, "..", "files", "image.jpg") node.image = bpy.data.images.load(image_path) obj.node_tree.links.new(bsdf.inputs["Base Color"], node.outputs["Color"]) assert subject.can_support_texture_style(obj) is True
def test_without_nodes_we_do_not_support_textures(self): obj = bpy.data.materials.new("Material") obj.use_nodes = False assert subject.can_support_texture_style(obj) is False