refactor: remove reparent mecanism

fix: empty camera background image
fix: object data reassignation
This commit is contained in:
Swann 2020-11-03 23:44:25 +01:00
parent 371d793a13
commit 17949003f7
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
4 changed files with 12 additions and 22 deletions

View File

@ -44,7 +44,7 @@ from . import environment
DEPENDENCIES = {
("replication", '0.1.7'),
("replication", '0.1.8'),
}

View File

@ -48,11 +48,14 @@ class BlCamera(BlDatablock):
background_images = data.get('background_images')
if background_images:
target.background_images.clear()
if background_images:
for img_name, img_data in background_images.items():
img_id = img_data.get('image')
if img_id:
target_img = target.background_images.new()
target_img.image = bpy.data.images[img_name]
target_img.image = bpy.data.images[img_id]
loader.load(target_img, img_data)
def _dump_implementation(self, data, instance=None):

View File

@ -24,7 +24,6 @@ from replication.exception import ContextError
from .bl_datablock import BlDatablock, get_datablock_from_uuid
from .dump_anything import Dumper, Loader
from replication.exception import ReparentException
def load_pose(target_bone, data):
@ -120,9 +119,7 @@ class BlObject(BlDatablock):
data_uuid = data.get("data_uuid")
data_id = data.get("data")
if target.type != data['type']:
raise ReparentException()
elif target.data and (target.data.name != data_id):
if target.data and (target.data.name != data_id):
target.data = get_datablock_from_uuid(data_uuid, find_data_from_name(data_id), ignore=['images'])
# vertex groups
@ -191,10 +188,10 @@ class BlObject(BlDatablock):
target_bone.bone_group = target.pose.bone_group[bone_data['bone_group_index']]
# TODO: find another way...
if target.type == 'EMPTY':
if target.empty_display_type == "IMAGE":
img_uuid = data.get('data_uuid')
if target.data is None and img_uuid:
target.data = get_datablock_from_uuid(img_uuid, None)#bpy.data.images.get(img_key, None)
target.data = get_datablock_from_uuid(img_uuid, None)
def _dump_implementation(self, data, instance=None):
assert(instance)

View File

@ -36,8 +36,7 @@ from replication.constants import (FETCHED,
STATE_ACTIVE,
STATE_SYNCING,
STATE_LOBBY,
STATE_SRV_SYNC,
REPARENT)
STATE_SRV_SYNC)
from replication.interface import session
from replication.exception import NonAuthorizedOperationError
@ -122,15 +121,6 @@ class ApplyTimer(Timer):
session.apply(node)
except Exception as e:
logging.error(f"Fail to apply {node_ref.uuid}: {e}")
elif node_ref.state == REPARENT:
# Reload the node
node_ref.remove_instance()
node_ref.resolve()
session.apply(node)
for parent in session._graph.find_parents(node):
logging.info(f"Applying parent {parent}")
session.apply(parent, force=True)
node_ref.state = UP
class DynamicRightSelectTimer(Timer):