fix texture plane by importing nodegroup

master
florentin.luce 2024-06-13 11:58:41 +02:00
parent f89b4429fd
commit 129ecb72cf
1 changed files with 8 additions and 3 deletions

View File

@ -8,10 +8,11 @@ import time
from pathlib import Path
from mathutils import Vector, geometry
from pprint import pprint as pp
from ..constants import PREFIX, BGCOL, INIT_POS
from ..constants import PREFIX, BGCOL, INIT_POS, MODULE_DIR
from ..core import (create_cam, set_collection, get_image_infos_from_object, get_col,
import_image_as_gp_reference, create_image_plane, set_collection, get_image,
create_empty_image, create_plane_holder, create_plane_driver, reload_bg_list)
create_empty_image, create_plane_holder, create_plane_driver, reload_bg_list,
link_nodegroup)
def get_json_infos(json_path) -> tuple((list, tuple)):
@ -118,7 +119,11 @@ def import_planes(images, import_type='GPENCIL', mode='REPLACE', image_size=None
pack_image=False,
)
elif import_type == 'MESH':
bg_img = create_image_plane(image_path)
if not (texture_plane_ng := bpy.data.node_groups.get('texture_plane')):
blend = str(MODULE_DIR / 'texture_plane.blend')
texture_plane_ng = link_nodegroup(blend, 'texture_plane', link=False)
bg_img = create_image_plane(image_path, texture_plane_ng)
elif import_type == 'EMPTY':
bg_img = create_empty_image(image_path)