refacto to use import_planes as a functions
This commit is contained in:
+8
-8
@@ -1,6 +1,6 @@
|
||||
import bpy
|
||||
from pathlib import Path
|
||||
from .. import fn
|
||||
from .. import core
|
||||
from .. constants import PREFIX
|
||||
from bpy.types import UIList, PropertyGroup, Menu
|
||||
from bpy.props import (PointerProperty,
|
||||
@@ -51,7 +51,7 @@ class BPM_UL_bg_list(UIList):
|
||||
|
||||
return
|
||||
|
||||
layercol = context.view_layer.layer_collection.children['Background'].children.get(fn.clean_image_name(item.plane.name[len(PREFIX):]))
|
||||
layercol = context.view_layer.layer_collection.children['Background'].children.get(core.clean_image_name(item.plane.name[len(PREFIX):]))
|
||||
if not layercol:
|
||||
layout.label(text=f'{item.plane.name} (problem with name)', icon='ERROR')
|
||||
return
|
||||
@@ -63,7 +63,7 @@ class BPM_UL_bg_list(UIList):
|
||||
layout.label(text=f'{item.plane.name} (No children)', icon='ERROR')
|
||||
|
||||
## Image preview
|
||||
image = fn.get_image(item.plane.children[0])
|
||||
image = core.get_image(item.plane.children[0])
|
||||
# layout.label(icon_value=image.preview_ensure().icon_id)
|
||||
# layout.template_icon(icon_value=image.preview_ensure().icon_id)
|
||||
|
||||
@@ -169,7 +169,7 @@ class BPM_UL_bg_list(UIList):
|
||||
## TODO: Find a better solution to get the collection
|
||||
## Get Collection from plane name -> problem: prefix "BG_" and suffix
|
||||
|
||||
layercol = context.view_layer.layer_collection.children['Background'].children.get(fn.clean_image_name(item.plane.name[len(PREFIX):]))
|
||||
layercol = context.view_layer.layer_collection.children['Background'].children.get(core.clean_image_name(item.plane.name[len(PREFIX):]))
|
||||
if not layercol:
|
||||
layout.label(text=f'{item.plane.name} (problem with name)', icon='ERROR')
|
||||
return
|
||||
@@ -181,7 +181,7 @@ class BPM_UL_bg_list(UIList):
|
||||
layout.label(text=f'{item.plane.name} (No children)', icon='ERROR')
|
||||
|
||||
## Image preview
|
||||
image = fn.get_image(item.plane.children[0])
|
||||
image = core.get_image(item.plane.children[0])
|
||||
# layout.label(icon_value=image.preview_ensure().icon_id)
|
||||
# layout.template_icon(icon_value=image.preview_ensure().icon_id)
|
||||
|
||||
@@ -270,7 +270,7 @@ def update_opacity(self, context):
|
||||
for ob in pool:
|
||||
if not ob or not ob.children:
|
||||
continue
|
||||
fn.set_opacity(ob.children[0], opacity=context.scene.bg_props.opacity)
|
||||
core.set_opacity(ob.children[0], opacity=context.scene.bg_props.opacity)
|
||||
|
||||
def update_on_index_change(self, context):
|
||||
# print('index change:', context.scene.bg_props.index)
|
||||
@@ -287,13 +287,13 @@ def update_on_index_change(self, context):
|
||||
plane = item.plane
|
||||
if not plane.children:
|
||||
return
|
||||
opacity = fn.get_opacity(plane.children[0])
|
||||
opacity = core.get_opacity(plane.children[0])
|
||||
if not opacity:
|
||||
return
|
||||
props['opacity'] = opacity
|
||||
|
||||
elif item.type == 'obj':
|
||||
fn.gp_transfer_mode(item.plane, context)
|
||||
core.gp_transfer_mode(item.plane, context)
|
||||
|
||||
|
||||
def update_select(self, context):
|
||||
|
||||
Reference in New Issue
Block a user