fix: gpencil load
This commit is contained in:
21
helpers.py
21
helpers.py
@ -10,8 +10,8 @@ from . import draw
|
|||||||
from .libs import dump_anything
|
from .libs import dump_anything
|
||||||
|
|
||||||
# TODO: replace hardcoded values...
|
# TODO: replace hardcoded values...
|
||||||
BPY_TYPES = {'GreasePencil': 'grease_pencils', 'Curve': 'curves', 'Collection': 'collections', 'Mesh': 'meshes', 'Object': 'objects', 'Material': 'materials',
|
BPY_TYPES = {'Texture': 'textures','Material': 'materials', 'GreasePencil': 'grease_pencils', 'Curve': 'curves', 'Collection': 'collections', 'Mesh': 'meshes', 'Object': 'objects',
|
||||||
'Texture': 'textures', 'Scene': 'scenes', 'Light': 'lights', 'SunLight': 'lights', 'SpotLight': 'lights', 'AreaLight': 'lights', 'PointLight': 'lights', 'Camera': 'cameras', 'Action': 'actions', 'Armature': 'armatures', 'Grease Pencil': 'grease_pencils'}
|
'Scene': 'scenes', 'Light': 'lights', 'SunLight': 'lights', 'SpotLight': 'lights', 'AreaLight': 'lights', 'PointLight': 'lights', 'Camera': 'cameras', 'Action': 'actions', 'Armature': 'armatures', 'Grease Pencil': 'grease_pencils'}
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
@ -72,6 +72,7 @@ def load(key, value):
|
|||||||
target = resolve_bpy_path(key)
|
target = resolve_bpy_path(key)
|
||||||
target_type = key.split('/')[0]
|
target_type = key.split('/')[0]
|
||||||
|
|
||||||
|
logger.info("load {}".format(key))
|
||||||
if value == "None":
|
if value == "None":
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -325,9 +326,19 @@ def load_collection(target=None, data=None, create=False):
|
|||||||
# Link childrens
|
# Link childrens
|
||||||
for collection in data["children"]:
|
for collection in data["children"]:
|
||||||
if collection not in target.children.keys():
|
if collection not in target.children.keys():
|
||||||
target.children.link(
|
if bpy.data.collections.find(collection) == -1:
|
||||||
|
target.children.link(
|
||||||
|
bpy.data.collections[collection])
|
||||||
|
else:
|
||||||
|
logger.info(target.name)
|
||||||
|
|
||||||
|
for collection in target.children.keys():
|
||||||
|
if collection not in data["children"]:
|
||||||
|
target.collection.children.unlink(
|
||||||
bpy.data.collections[collection])
|
bpy.data.collections[collection])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
target.id = data['id']
|
target.id = data['id']
|
||||||
|
|
||||||
client = bpy.context.window_manager.session.username
|
client = bpy.context.window_manager.session.username
|
||||||
@ -360,14 +371,14 @@ def load_scene(target=None, data=None, create=False):
|
|||||||
|
|
||||||
# load collections
|
# load collections
|
||||||
# TODO: Recursive link
|
# TODO: Recursive link
|
||||||
logger.info("check for new collections")
|
logger.info("check for scene childs")
|
||||||
for collection in data["collection"]["children"]:
|
for collection in data["collection"]["children"]:
|
||||||
logger.debug(collection)
|
logger.debug(collection)
|
||||||
if collection not in target.collection.children.keys():
|
if collection not in target.collection.children.keys():
|
||||||
target.collection.children.link(
|
target.collection.children.link(
|
||||||
bpy.data.collections[collection])
|
bpy.data.collections[collection])
|
||||||
|
|
||||||
logger.info("check for collection to remove")
|
logger.info("check for scene child to remove")
|
||||||
for collection in target.collection.children.keys():
|
for collection in target.collection.children.keys():
|
||||||
if collection not in data["collection"]["children"]:
|
if collection not in data["collection"]["children"]:
|
||||||
target.collection.children.unlink(
|
target.collection.children.unlink(
|
||||||
|
@ -394,7 +394,7 @@ classes = (
|
|||||||
def is_replicated(update):
|
def is_replicated(update):
|
||||||
# global client_keys
|
# global client_keys
|
||||||
# dickt = dict(client_keys)
|
# dickt = dict(client_keys)
|
||||||
object_type = update.id.bl_rna.name
|
object_type = update.id.bl_rna.__class__.__name__
|
||||||
object_name = update.id.name
|
object_name = update.id.name
|
||||||
|
|
||||||
#Master collection special cae
|
#Master collection special cae
|
||||||
|
Reference in New Issue
Block a user