diff --git a/MiBlend.blend b/MiBlend.blend index 5f529be5..496ff596 100644 Binary files a/MiBlend.blend and b/MiBlend.blend differ diff --git a/MiBlend_Source/Assets.py b/MiBlend_Source/Assets.py index 89b79ac1..4bfe3b57 100644 --- a/MiBlend_Source/Assets.py +++ b/MiBlend_Source/Assets.py @@ -33,8 +33,19 @@ def append_collection(asset_name, asset_collection, asset_path): def run_python_script(name, path): try: + script_dir = os.path.dirname(path) + + if script_dir not in sys.path: + sys.path.append(script_dir) + + properties = {} + + for index, asset in enumerate(bpy.context.scene.assetsproperties.asset_items): + if asset.get("Asset_name", "") == name: + properties = {key.replace('_property', ''): value for key, value in asset.items() if 'property' in key} + with open(path, 'r') as file: - exec(file.read()) + exec(file.read(), {}, properties) except: Absolute_Solver("009", name, traceback.print_exc()) @@ -208,7 +219,7 @@ def update_assets(): asset_info["Type"] = asset_tags[0] asset_info["File_path"] = asset_file_path - if any('property' in key.lower() for key in asset_info): + if any('property' in key for key in asset_info): asset_info["has_properties"] = True assets_list.append(asset_info) diff --git a/MiBlend_Source/Assets/Rigs/Story Mode Rig/Story Mode Rig.blend b/MiBlend_Source/Assets/Rigs/Story Mode Rig/Story Mode Rig.blend new file mode 100644 index 00000000..2554369d Binary files /dev/null and b/MiBlend_Source/Assets/Rigs/Story Mode Rig/Story Mode Rig.blend differ diff --git a/MiBlend_Source/Assets/Rigs/Story Mode Rig/Story Mode Rig.json b/MiBlend_Source/Assets/Rigs/Story Mode Rig/Story Mode Rig.json new file mode 100644 index 00000000..0d664d0f --- /dev/null +++ b/MiBlend_Source/Assets/Rigs/Story Mode Rig/Story Mode Rig.json @@ -0,0 +1,9 @@ +{ + "Format_version": "a008", + "Asset_name": "Story Mode Character Rig", + "Author": "Faizek, Aspirata", + "Blender_version": ">= 4.0.0", + "File_path": "Rigs\\Story Mode Rig\\Story Mode Rig", + "Collection_name": "Story Mode Character", + "Tags": ["Rig", "Story Mode"] +} \ No newline at end of file diff --git a/MiBlend_Source/Assets/Scripts/Beveler/Beveler.json b/MiBlend_Source/Assets/Scripts/Beveler/Beveler.json new file mode 100644 index 00000000..8af073e8 --- /dev/null +++ b/MiBlend_Source/Assets/Scripts/Beveler/Beveler.json @@ -0,0 +1,10 @@ +{ + "Format_version": "a008", + "Author": "Aspirata", + "Asset_name": "Beveler", + "File_path": "Scripts\\Beveler\\Beveler", + "Use Node_property": false, + "Amount_property": 0.01, + "Segments_property": 4, + "Tags": ["Script"] +} \ No newline at end of file diff --git a/MiBlend_Source/Assets/Scripts/Beveler/Beveler.py b/MiBlend_Source/Assets/Scripts/Beveler/Beveler.py new file mode 100644 index 00000000..ba5aa5a5 --- /dev/null +++ b/MiBlend_Source/Assets/Scripts/Beveler/Beveler.py @@ -0,0 +1,22 @@ +import bpy + +use_node = properties.get("Use Node") +amount = properties.get("Amount") +segments = properties.get("Segments") + +for selected_object in bpy.context.selected_objects: + if use_node: + if not selected_object.material_slots: + continue + + for material in selected_object.data.materials: + if material is None or not material.use_nodes: + continue + else: + if selected_object.modifiers.get("Bevel") == None: + bevel_modifier = selected_object.modifiers.new('Bevel', type='BEVEL') + else: + bevel_modifier = selected_object.modifiers.get("Bevel") + + bevel_modifier.width = amount + bevel_modifier.segments = segments \ No newline at end of file diff --git a/MiBlend_Source/Assets/Scripts/Contact Shadows/Contact Shadows.json b/MiBlend_Source/Assets/Scripts/Contact Shadows/Contact Shadows.json index 4093e94d..fbc565c7 100644 --- a/MiBlend_Source/Assets/Scripts/Contact Shadows/Contact Shadows.json +++ b/MiBlend_Source/Assets/Scripts/Contact Shadows/Contact Shadows.json @@ -4,7 +4,7 @@ "Asset_name": "Contact Shadows", "Author": "Aspirata", "File_path": "Scripts\\Contact Shadows\\Contact Shadows", - "Mode_property": 1, + "Only Selected Objects_property": false, "Distance_property": 0.2, "Bias_property": 0.03, "Thickness_property": 0.01, diff --git a/MiBlend_Source/Assets/Scripts/Convert DBSDF 2 PBSDF/Convert DBSDF 2 PBSDF.py b/MiBlend_Source/Assets/Scripts/Convert DBSDF 2 PBSDF/Convert DBSDF 2 PBSDF.py index e6906322..86225177 100644 --- a/MiBlend_Source/Assets/Scripts/Convert DBSDF 2 PBSDF/Convert DBSDF 2 PBSDF.py +++ b/MiBlend_Source/Assets/Scripts/Convert DBSDF 2 PBSDF/Convert DBSDF 2 PBSDF.py @@ -1,10 +1,5 @@ import bpy - -addon_dir = os.path.dirname(os.path.abspath(__file__)) -if addon_dir not in sys.path: - sys.path.append(addon_dir) - -from MCB_API import GetConnectedSocketTo +from MIB_API import GetConnectedSocketTo for selected_object in bpy.context.selected_objects: slot = 0 @@ -53,8 +48,4 @@ if DBSDF != None: material.node_tree.nodes.remove(DBSDF) - material.node_tree.links.new(PBSDF.outputs[0], Output.inputs[0]) - #else: - #Absolute_Solver("m002", slot) - #else: - #Absolute_Solver("m003", selected_object) \ No newline at end of file + material.node_tree.links.new(PBSDF.outputs[0], Output.inputs[0]) \ No newline at end of file diff --git a/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.json b/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.json index c14f81e9..2c8eb6ef 100644 --- a/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.json +++ b/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.json @@ -4,8 +4,8 @@ "Asset_name": "Jittered Shadows", "Author": "Aspirata", "File_path": "Scripts\\Jittered Shadows\\Jittered Shadows", - "Mode_property": 1, - "Overblur_property": 20.0, + "Only Selected Objects_property": false, "World Jitter_property": true, + "Overblur_property": 20.0, "Tags": ["Script"] } \ No newline at end of file diff --git a/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.py b/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.py index 28ae1137..29899284 100644 --- a/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.py +++ b/MiBlend_Source/Assets/Scripts/Jittered Shadows/Jittered Shadows.py @@ -1,26 +1,8 @@ -import bpy -import os -import json +mode = properties.get("Only Selected Objects", False) +overblur = clamp(0.0, properties.get("Overblur", 20.0), 100.0) +world_jitter = properties.get("World Jitter", False) -addon_dir = os.path.dirname(os.path.abspath(__file__)) - -current_index = bpy.context.scene.assetsproperties.asset_index -items = bpy.context.scene.assetsproperties.asset_items - -current_asset = items[current_index] - -json_file_path = os.path.join(addon_dir, "Assets", os.path.splitext(current_asset.get("File_path", ""))[0] + ".json") - -with open(json_file_path, 'r') as json_file: - asset_data = json.load(json_file) - -properties = {key.replace('_property', ''): value for key, value in current_asset.items() if 'property' in key.lower()} - -mode = properties.get("Mode", asset_data["Mode_property"]) -overblur = properties.get("Overblur", asset_data["Overblur_property"]) -world_jitter = properties.get("World Jitter", asset_data["World Jitter_property"]) - -if mode == 0: +if mode == False: for obj in bpy.context.selected_objects: try: obj.data.use_shadow_jitter = True diff --git a/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.blend b/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.blend index 6c42e435..eb635d40 100644 Binary files a/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.blend and b/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.blend differ diff --git a/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.py b/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.py index 2968cdb8..0c45ad77 100644 --- a/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.py +++ b/MiBlend_Source/Assets/Shader Nodes/Cracks/Cracks.py @@ -1,8 +1,4 @@ -import sys - -addon_dir = os.path.dirname(os.path.abspath(__file__)) -if addon_dir not in sys.path: - sys.path.append(addon_dir) +import bpy from MCB_API import GetConnectedSocketTo @@ -29,5 +25,8 @@ if GetConnectedSocketTo("Base Color", PBSDF).node != co_node: current_material.node_tree.links.new(GetConnectedSocketTo("Base Color", PBSDF), co_node.inputs["Color"]) - - current_material.node_tree.links.new(co_node.outputs[0], PBSDF.inputs["Base Color"]) \ No newline at end of file + current_material.node_tree.links.new(co_node.outputs["Color"], PBSDF.inputs["Base Color"]) + + if GetConnectedSocketTo("Alpha", PBSDF).node != co_node: + current_material.node_tree.links.new(GetConnectedSocketTo("Alpha", PBSDF), co_node.inputs["Alpha"]) + current_material.node_tree.links.new(co_node.outputs["Alpha"], PBSDF.inputs["Alpha"]) \ No newline at end of file diff --git a/MiBlend_Source/Data.py b/MiBlend_Source/Data.py index 5d9885f8..3cde762a 100644 --- a/MiBlend_Source/Data.py +++ b/MiBlend_Source/Data.py @@ -95,6 +95,16 @@ } } +Grass_Color = { + "Forest": "#79C05A", + "Taiga": "#8AB689", +} + +Foliage_Color = { + "Forest": "#59AE30", + "Taiga": "#6DA36B", +} + Emissive_Materials = { "Default": { diff --git a/MiBlend_Source/MIB_API.py b/MiBlend_Source/MIB_API.py index b6ef0a55..5122e52a 100644 --- a/MiBlend_Source/MIB_API.py +++ b/MiBlend_Source/MIB_API.py @@ -21,10 +21,20 @@ def PBSDF_compability(Input: str) -> str: }.get(Input, Input) return Input +def convert_hex_to_rgba(hex_code, alpha=1.0): + hex_code = hex_code.replace("#", "") + r = int(hex_code[0:2], 16) / 255.0 + g = int(hex_code[2:4], 16) / 255.0 + b = int(hex_code[4:6], 16) / 255.0 + a = alpha + return (r, g, b, a) + +def clamp(min, value, max): + return max(min(value, 100.0), 0.0) + def convert_to_linux(path): if sys.platform.startswith('linux'): return path.replace("\\", "/") - return path def MaterialIn(Array, material, mode="in"): diff --git a/MiBlend_Source/Materials/Clouds generator 3.6.blend b/MiBlend_Source/Materials/Clouds Generator 3.6.blend similarity index 100% rename from MiBlend_Source/Materials/Clouds generator 3.6.blend rename to MiBlend_Source/Materials/Clouds Generator 3.6.blend diff --git a/MiBlend_Source/Materials/Clouds generator 4.0.blend b/MiBlend_Source/Materials/Clouds Generator 4.0.blend similarity index 100% rename from MiBlend_Source/Materials/Clouds generator 4.0.blend rename to MiBlend_Source/Materials/Clouds Generator 4.0.blend diff --git a/MiBlend_Source/Materials/Materials.py b/MiBlend_Source/Materials/Materials.py index 82479684..a30b1afe 100644 --- a/MiBlend_Source/Materials/Materials.py +++ b/MiBlend_Source/Materials/Materials.py @@ -129,6 +129,7 @@ def fix_world(): PBSDF = None image_texture_node = None lbcf_node = None + Texture_Animator = None auvf_node = None scene = bpy.context.scene WProperties = scene.world_properties @@ -236,12 +237,26 @@ def fix_world(): material.node_tree.links.new(lbcf_node.outputs[0], PBSDF.inputs["Base Color"]) - if "water" in texture_parts: + # Simple Biomes Support + if "oak" in texture_parts: + biome = "Forest" + elif "fern" or "spruce" in texture_parts: + biome = "Taiga" + elif "birch" in texture_parts: + biome = "Birch" + + if "grass" in texture_parts: lbcf_node.inputs["Mode"].default_value = 2 - if "redstone" in texture_parts: + elif "water" in texture_parts: lbcf_node.inputs["Mode"].default_value = 3 + elif "redstone" in texture_parts: + lbcf_node.inputs["Mode"].default_value = 4 + + lbcf_node.inputs["Grass Color"].default_value = convert_hex_to_rgba(Grass_Color.get(biome)) + lbcf_node.inputs["Foliage Color"].default_value = convert_hex_to_rgba(Foliage_Color.get(biome)) + elif lbcf_node is not None: material.node_tree.links.new(GetConnectedSocketTo(0, lbcf_node), PBSDF.inputs["Base Color"]) material.node_tree.nodes.remove(lbcf_node) diff --git a/MiBlend_Source/Materials/Nodes.blend b/MiBlend_Source/Materials/Nodes.blend index 32b1416e..55e67768 100644 Binary files a/MiBlend_Source/Materials/Nodes.blend and b/MiBlend_Source/Materials/Nodes.blend differ diff --git a/MiBlend_Source/Preferences.py b/MiBlend_Source/Preferences.py index 33a81eda..7b073e3d 100644 --- a/MiBlend_Source/Preferences.py +++ b/MiBlend_Source/Preferences.py @@ -1,3 +1,4 @@ +import sys from bpy.types import AddonPreferences from .MIB_API import blender_version from bpy.props import (IntProperty, BoolProperty, FloatProperty, EnumProperty, StringProperty) @@ -145,8 +146,9 @@ def draw(self, context): row = box.row() row.prop(self, "experimental_features", toggle=True) - row = box.row() - row.prop(self, "open_console_on_start", toggle=True) + if not sys.platform.startswith('linux'): + row = box.row() + row.prop(self, "open_console_on_start", toggle=True) row = box.row() row.prop(self, "dev_packs_path") diff --git a/MiBlend_Source/Properties.py b/MiBlend_Source/Properties.py index 23a4fc8f..3949a20a 100644 --- a/MiBlend_Source/Properties.py +++ b/MiBlend_Source/Properties.py @@ -781,6 +781,11 @@ def get_tags(self): tags: bpy.props.CollectionProperty(type=AssetTagItem) + properties_toggle: BoolProperty( + name="Properties Toggle", + description="", + default=True + ) tags_mode: EnumProperty( items=[("and", "And", ""), ("or", "Or", "")], diff --git a/MiBlend_Source/UI.py b/MiBlend_Source/UI.py index 8944e883..e8eef9e5 100644 --- a/MiBlend_Source/UI.py +++ b/MiBlend_Source/UI.py @@ -796,20 +796,23 @@ def draw(self, context): current_asset = items[current_index] if current_asset.get("has_properties", False): - properties = {key.replace('_property', ''): value for key, value in current_asset.items() if 'property' in key.lower()} + properties = {key.replace('_property', ''): value for key, value in current_asset.items() if 'property' in key} sbox = box.box() row = sbox.row() row.label(text="Properties:") - for key, value in properties.items(): - row = sbox.row() - if isinstance(value, (bool, int, float, str)): - row.prop(current_asset, f'["{key}_property"]', text=key) - else: - row.label(text=f"{key}: {value}") - - row = sbox.row() - row.operator("assets.save_properties") + row.prop(assets_props, "properties_toggle", icon=("TRIA_DOWN" if assets_props.properties_toggle else "TRIA_LEFT"), icon_only=True) + if assets_props.properties_toggle: + for key, value in properties.items(): + row = sbox.row() + if isinstance(value, (bool, int, float, str)): + row.prop(current_asset, f'["{key}_property"]', text=key) + else: + row.label(text=f"{key}: {value}") + + if Preferences.dev_tools and Preferences.experimental_features: + row = sbox.row() + row.operator("assets.save_properties") # Filters row = box.row() @@ -818,7 +821,7 @@ def draw(self, context): if assets_props.filters: sbox = box.box() primary_tags = {"Rig", "Script", "Shader Node", "Geo Node", "Compositor Node", "Model", "Material"} - secondary_tags = {"Vanilla", "Realistic", "Node", "Particles"} + secondary_tags = {"Simple", "Realistic", "Node", "Particles"} row = sbox.row() row.label(text="Tags:") @@ -889,4 +892,4 @@ def filter_items(self, context, data, property): else: flt_flags.append(0) - return flt_flags, [] \ No newline at end of file + return flt_flags, [] diff --git a/MiBlend_Source/__init__.py b/MiBlend_Source/__init__.py index a2cd0a53..4e011b3d 100644 --- a/MiBlend_Source/__init__.py +++ b/MiBlend_Source/__init__.py @@ -46,7 +46,7 @@ def InitOnStart(): update_assets() - if bpy.context.preferences.addons[__package__].preferences.dev_tools and bpy.context.preferences.addons[__package__].preferences.open_console_on_start: + if bpy.context.preferences.addons[__package__].preferences.dev_tools and bpy.context.preferences.addons[__package__].preferences.open_console_on_start and not sys.platform.startswith('linux'): bpy.ops.wm.console_toggle() @persistent diff --git a/README.md b/README.md index 7fddcade..a032bff0 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,13 @@ Links: Links: - https://modrinth.com/resourcepack/embrace-pixels +### Faizek - Story Mode Character Rig + +Links: +- https://x.com/fluffy_aizek +- https://t.me/fluffyaizekmedia +- https://vk.com/fluffy_aizek + ## Special Thanks: ### jabady - Active Testing And Bug Reporting