diff --git a/Mcblend Source/Data.py b/Mcblend Source/Data.py index 3b333174..bfe88c54 100644 --- a/Mcblend Source/Data.py +++ b/Mcblend Source/Data.py @@ -9,7 +9,7 @@ main_directory = os.path.dirname(os.path.realpath(__file__)) resource_packs_directory = os.path.join(main_directory, "Resource Packs") -materials_file_path = os.path.join(main_directory, "Materials", "Materials.blend") +nodes_file = os.path.join(main_directory, "Materials", "Nodes.blend") materials_folder = os.path.join(main_directory, "Materials") optimization_folder = os.path.join(main_directory, "Optimization") assets_directory = os.path.join(main_directory, "Assets") @@ -279,7 +279,7 @@ SSS_Materials = ["leaves", "grass", "tulip", "oxeye_daisy", "dandelion", "poppy", "blue_orchid", "torchflower", "lily_of_the_valley", "cornflower", "allium", "azure bluet"] -Translucent_Materials = ["leaves"] +Translucent_Materials = ["leaves", "glass"] Metal = ["iron", "gold", "copper", "diamond", "netherite", "minecart", "lantern", "chain", "anvil", "clock", "cauldron", "spyglass", "rail"] diff --git a/Mcblend Source/Materials/Materials.py b/Mcblend Source/Materials/Materials.py index b94bb842..4675746a 100644 --- a/Mcblend Source/Materials/Materials.py +++ b/Mcblend Source/Materials/Materials.py @@ -187,7 +187,7 @@ def fix_world(): if bfc_node == None: if "Backface Culling" not in bpy.data.node_groups: try: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = ["Backface Culling"] except: Absolute_Solver("004", "Materials", traceback.format_exc()) @@ -219,7 +219,7 @@ def fix_world(): if lbcf_node == None: if "Lazy Biome Color Fix" not in bpy.data.node_groups: try: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = ["Lazy Biome Color Fix"] except: Absolute_Solver("004", "Materials", traceback.format_exc()) @@ -293,7 +293,7 @@ def create_env(self=None): bpy.data.node_groups.remove(group) try: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.worlds = [world_material_name] appended_world_material = bpy.data.worlds.get(world_material_name) bpy.context.scene.world = appended_world_material @@ -368,7 +368,7 @@ def create_env(self=None): if scene.env_properties.create_sky: try: if world_material_name not in bpy.data.worlds: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.worlds = [world_material_name] appended_world_material = bpy.data.worlds.get(world_material_name) else: @@ -550,10 +550,10 @@ def animate_texture(texture_node, image_texture, new_image_texture_path, ITextur ITexture_Animator.node_tree = Current_node_tree else: if "Texture Animator" not in bpy.data.node_groups: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = ["Texture Animator"] - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = ["Texture Animator"] bpy.data.node_groups[f"Texture Animator.001"].name = f"Animated; {image_texture.replace('.png', '')}" @@ -595,7 +595,7 @@ def animate_texture(texture_node, image_texture, new_image_texture_path, ITextur if Texture_Animator is None: if "Texture Animator" not in bpy.data.node_groups: try: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = ["Texture Animator"] except: Absolute_Solver("004", "Materials", traceback.format_exc()) @@ -848,7 +848,7 @@ def animate_texture(texture_node, image_texture, new_image_texture_path, ITextur if LabPBR_s == None: if "LabPBR Specular" not in bpy.data.node_groups: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = ["LabPBR Specular"] LabPBR_s = material.node_tree.nodes.new("ShaderNodeGroup") @@ -1073,7 +1073,7 @@ def setproceduralpbr(): PNormals.location = (PBSDF.location.x - 200, PBSDF.location.y - 132) else: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = ["PNormals"] PNormals = material.node_tree.nodes.new(type='ShaderNodeGroup') @@ -1190,7 +1190,7 @@ def setproceduralpbr(): # BATGroup Import if BATGroup isn't in File if node_group == None: if BATGroup not in bpy.data.node_groups: - with bpy.data.libraries.load(materials_file_path, link=False) as (data_from, data_to): + with bpy.data.libraries.load(nodes_file, link=False) as (data_from, data_to): data_to.node_groups = [BATGroup] node_group = material.node_tree.nodes.new(type='ShaderNodeGroup') @@ -1257,7 +1257,7 @@ def setproceduralpbr(): material.node_tree.links.new(GetConnectedSocketTo("Base Color", PBSDF), proughness_node.inputs["Value"]) material.node_tree.links.new(proughness_node.outputs[0], PBSDF.inputs["Roughness"]) - elif PProperties.revert_proughness and proughness_node != None: + elif PProperties.pr_revert and proughness_node != None: material.node_tree.nodes.remove(proughness_node) if PProperties.pspecular: @@ -1276,7 +1276,7 @@ def setproceduralpbr(): material.node_tree.links.new(GetConnectedSocketTo("Base Color", PBSDF), pspecular_node.inputs["Value"]) material.node_tree.links.new(pspecular_node.outputs[0], PBSDF.inputs[PBSDF_compability("Specular IOR Level")]) - elif PProperties.revert_pspecular and pspecular_node != None: + elif PProperties.ps_revert and pspecular_node != None: material.node_tree.nodes.remove(pspecular_node) else: diff --git a/Mcblend Source/Materials/Materials.blend b/Mcblend Source/Materials/Nodes.blend similarity index 100% rename from Mcblend Source/Materials/Materials.blend rename to Mcblend Source/Materials/Nodes.blend diff --git a/Mcblend Source/Properties.py b/Mcblend Source/Properties.py index ed2206a7..cdf9d0ef 100644 --- a/Mcblend Source/Properties.py +++ b/Mcblend Source/Properties.py @@ -241,26 +241,12 @@ class PPBRProperties(PropertyGroup): description="" ) - revert_pspecular: BoolProperty( - name="Revert", - default=True, - description="" - ) - pspecular_settings: BoolProperty( name="Procedural Specular Settings", default=False, description="" ) - ps_dif: FloatProperty( - name="Difference", - default=0.0, - min=0.0, - max=1.0, - description="Value 1 will be Ignored" - ) - ps_interpolation: EnumProperty( items=[('LINEAR', 'Linear', ''), ('SMOOTHSTEP', 'Smooth Step', ''), @@ -269,14 +255,23 @@ class PPBRProperties(PropertyGroup): default='LINEAR' ) - proughness: BoolProperty( - name="Procedural Roughness", + ps_dif: FloatProperty( + name="Difference", + default=0.0, + min=0.0, + max=1.0, + description="Value 1 will be Ignored" + ) + + ps_revert: BoolProperty( + name="Revert", default=True, description="" ) + - revert_proughness: BoolProperty( - name="Revert", + proughness: BoolProperty( + name="Procedural Roughness", default=True, description="" ) @@ -287,6 +282,14 @@ class PPBRProperties(PropertyGroup): description="" ) + pr_interpolation: EnumProperty( + items=[('LINEAR', 'Linear', ''), + ('SMOOTHSTEP', 'Smooth Step', ''), + ('SMOOTHERSTEP', 'Smoother Step', '')], + name="Interpolation", + default='LINEAR' + ) + pr_dif: FloatProperty( name="Difference", default=0.6, @@ -294,13 +297,11 @@ class PPBRProperties(PropertyGroup): max=1.0, description="Value 1 will be Ignored" ) - - pr_interpolation: EnumProperty( - items=[('LINEAR', 'Linear', ''), - ('SMOOTHSTEP', 'Smooth Step', ''), - ('SMOOTHERSTEP', 'Smoother Step', '')], - name="Interpolation", - default='LINEAR' + + pr_revert: BoolProperty( + name="Revert", + default=True, + description="" ) advanced_settings: BoolProperty( diff --git a/Mcblend Source/__init__.py b/Mcblend Source/__init__.py index 1fa40720..b8e15f60 100644 --- a/Mcblend Source/__init__.py +++ b/Mcblend Source/__init__.py @@ -649,6 +649,9 @@ def draw(self, context): row = sbox.row() row.prop(scene.ppbr_properties, "ps_dif") + + row = sbox.row() + row.prop(scene.ppbr_properties, "ps_revert") row = box.row() row.prop(scene.ppbr_properties, "proughness") @@ -664,6 +667,9 @@ def draw(self, context): row = sbox.row() row.prop(scene.ppbr_properties, "pr_dif") + row = sbox.row() + row.prop(scene.ppbr_properties, "pr_revert") + row = box.row() row.prop(scene.ppbr_properties, "advanced_settings", toggle=True, text="Advanced Settings", icon=("TRIA_DOWN" if scene.ppbr_properties.advanced_settings else "TRIA_RIGHT")) if scene.ppbr_properties.advanced_settings: