Skip to content

Commit

Permalink
Fixed get_linked_nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspirata committed Jul 15, 2024
1 parent 4983771 commit c9ef784
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
14 changes: 12 additions & 2 deletions Mcblend Source/Materials/Materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ def get_linked_nodes(node, input_name):
if input_name in node.inputs and node.inputs[input_name].is_linked:
for link in node.inputs[input_name].links:
linked_nodes.append(link.from_node)
linked_nodes.extend(get_all_linked_nodes(link.from_node))
return linked_nodes

def get_all_linked_nodes(node):
linked_nodes = []
for input_name, input_socket in node.inputs.items():
if input_socket.is_linked:
for link in input_socket.links:
linked_nodes.append(link.from_node)
linked_nodes.extend(get_all_linked_nodes(link.from_node))
return linked_nodes

def traverse_nodes(node, input_name, visited=None):
Expand Down Expand Up @@ -124,7 +134,7 @@ def fix_world():
PBSDF = node
connected_nodes = traverse_nodes(node, "Base Color")
for n in connected_nodes:
if n.type == "TEX_IMAGE":
if n.type == "TEX_IMAGE" and n.image:
image_texture_node = n
debugger(connected_nodes)

Expand Down Expand Up @@ -1094,7 +1104,7 @@ def setproceduralpbr():
PBSDF = node
connected_nodes = traverse_nodes(node, "Base Color")
for n in connected_nodes:
if n.type == "TEX_IMAGE":
if n.type == "TEX_IMAGE" and n.image:
image = n.image
debugger(connected_nodes)

Expand Down
33 changes: 12 additions & 21 deletions Mcblend Source/Resource_Packs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,18 @@ def find_mc():
print("MC instance not found")

if Preferences.dev_tools and Preferences.dev_packs_path:
dev_resource_packs_directory = Preferences.dev_packs_path
default_pack = "Bare Bones 1.21"
default_path = os.path.join(dev_resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (default_path),"type": "Texture", "enabled": False}

default_pack = "Better Emission"
default_path = os.path.join(dev_resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (default_path), "type": "PBR", "enabled": True}

default_pack = "Embrace Pixels PBR"
default_path = os.path.join(dev_resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (default_path), "type": "PBR", "enabled": True}
resource_packs_dir = Preferences.dev_packs_path
else:
default_pack = "Bare Bones 1.21"
default_path = os.path.join(resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (default_path),"type": "Texture", "enabled": False}
resource_packs_dir = resource_packs_directory

default_pack = "Bare Bones 1.21"
default_path = os.path.join(resource_packs_dir, default_pack)
resource_packs[default_pack] = {"path": (default_path),"type": "Texture", "enabled": False}

default_pack = "Better Emission"
default_path = os.path.join(resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (default_path), "type": "PBR", "enabled": True}
default_pack = "Better Emission"
default_path = os.path.join(resource_packs_dir, default_pack)
resource_packs[default_pack] = {"path": (default_path), "type": "PBR", "enabled": False}

default_pack = "Embrace Pixels PBR"
default_path = os.path.join(resource_packs_directory, default_pack)
resource_packs[default_pack] = {"path": (default_path), "type": "PBR", "enabled": True}
default_pack = "Embrace Pixels PBR"
default_path = os.path.join(resource_packs_dir, default_pack)
resource_packs[default_pack] = {"path": (default_path), "type": "PBR", "enabled": False}
Binary file modified Mcblend.blend
Binary file not shown.

0 comments on commit c9ef784

Please sign in to comment.