fix: join component cause missing

feat: extract mesh from node
This commit is contained in:
2024-09-13 16:42:18 +08:00
parent 80da400891
commit 133702619e
11 changed files with 194 additions and 48 deletions

View File

@@ -2,7 +2,7 @@ from ast import literal_eval
from pathlib import Path
import bpy
from ..constants import NODE_LIB_DIRPATH, VERSIONS
from ..constants import LATEST_NODE_LIB_PATH, NODE_LIB_DIRPATH, VERSIONS
from ..utils import get_cache_dir
@@ -244,7 +244,7 @@ def get_node_lib_path(node_version):
def local_lib_not_updated():
addon_version = VERSIONS[0]["node_version"]
addon_lib_path = get_node_lib_path(addon_version)
addon_lib_path = LATEST_NODE_LIB_PATH
use_local = False
for node_group in bpy.data.node_groups:
@@ -258,3 +258,12 @@ def local_lib_not_updated():
not_update = get_node_version() != addon_version
return use_local and not_update
def get_output_node(node_group):
try:
output_node = get_nodes_by_type(node_group,
'NodeGroupOutput')[0]
except:
output_node = node_group.nodes.new("NodeGroupOutput")
return output_node

View File

@@ -8,7 +8,7 @@ from mathutils import Matrix, Vector
from .layer import Layer, layer_to_obj, obj_to_layer
from .common import (get_container_layer_objs,
get_layer_prop_value,
get_nodes_by_type,
get_nodes_by_type, get_output_node,
move_node_to_node)
from .node import add_node_to_graph
from ..utils import get_use_link
@@ -82,11 +82,7 @@ def add_layers(layers: list[Layer],
cache_dir: str):
node_group = container_obj.modifiers[0].node_group
try:
output_node = get_nodes_by_type(node_group,
'NodeGroupOutput')[0]
except:
output_node = node_group.nodes.new("NodeGroupOutput")
output_node = get_output_node(node_group)
for i, layer in enumerate(layers):
layer_obj = layer_to_obj(layer, container_obj, cache_dir)

View File

@@ -4,7 +4,7 @@ import bpy
from .common import get_file_prop, get_node_lib_path, set_file_prop
from ..exceptions import Incompatible, NoFound
from ..constants import VERSIONS
from ..constants import LATEST_NODE_LIB_PATH, VERSIONS
def get_node_group(node_type: str, use_link=True):
@@ -14,7 +14,7 @@ def get_node_group(node_type: str, use_link=True):
# added node is always from latest node version
addon_version = VERSIONS[0]["node_version"]
addon_lib_path = get_node_lib_path(addon_version)
addon_lib_path = LATEST_NODE_LIB_PATH
if get_file_prop("node_version") is None:
set_file_prop("node_version", addon_version)