@ -16,7 +16,8 @@ __all__ = [
|
||||
'bl_metaball',
|
||||
'bl_lattice',
|
||||
'bl_lightprobe',
|
||||
'bl_speaker'
|
||||
'bl_speaker',
|
||||
'bl_particle'
|
||||
] # Order here defines execution order
|
||||
|
||||
from . import *
|
||||
|
@ -3,7 +3,7 @@ import mathutils
|
||||
|
||||
from .. import utils
|
||||
from ..libs.replication.replication.data import ReplicatedDatablock
|
||||
from ..libs.replication.replication.constants import (UP, DIFF_BINARY)
|
||||
from ..libs.replication.replication.constants import (UP, DIFF_BINARY,DIFF_JSON)
|
||||
from ..libs import dump_anything
|
||||
|
||||
def dump_driver(driver):
|
||||
@ -75,7 +75,7 @@ class BlDatablock(ReplicatedDatablock):
|
||||
if self.pointer and hasattr(self.pointer, 'uuid'):
|
||||
self.pointer.uuid = self.uuid
|
||||
|
||||
self.diff_method = DIFF_BINARY
|
||||
self.diff_method = DIFF_JSON
|
||||
|
||||
def library_apply(self):
|
||||
"""Apply stored data
|
||||
|
@ -101,14 +101,19 @@ class BlObject(BlDatablock):
|
||||
|
||||
for modifier in data['modifiers']:
|
||||
target_modifier = target.modifiers.get(modifier)
|
||||
|
||||
if not target_modifier:
|
||||
target_modifier = target.modifiers.new(
|
||||
data['modifiers'][modifier]['name'], data['modifiers'][modifier]['type'])
|
||||
|
||||
if target_modifier.type == 'PARTICLE_SYSTEM':
|
||||
tmp_particle_system = target_modifier.particle_system.name
|
||||
|
||||
utils.dump_anything.load(
|
||||
target_modifier, data['modifiers'][modifier])
|
||||
|
||||
if target_modifier.type == 'PARTICLE_SYSTEM':
|
||||
target.particle_systems[data['modifiers'][modifier]['name']].settings = bpy.data.particles[data['modifiers'][modifier]['particle_system']]
|
||||
# bpy.data.particles.remove(tmp_particle_system)
|
||||
# Load constraints
|
||||
# Object
|
||||
if hasattr(target, 'constraints') and 'constraints' in data:
|
||||
@ -188,6 +193,7 @@ class BlObject(BlDatablock):
|
||||
|
||||
target.data.shape_keys.key_blocks[key_block].relative_key = target.data.shape_keys.key_blocks[reference]
|
||||
|
||||
|
||||
def dump_implementation(self, data, pointer=None):
|
||||
assert(pointer)
|
||||
dumper = utils.dump_anything.Dumper()
|
||||
@ -219,9 +225,17 @@ class BlObject(BlDatablock):
|
||||
dumper.depth = 2
|
||||
data["modifiers"] = {}
|
||||
for index, modifier in enumerate(pointer.modifiers):
|
||||
data["modifiers"][modifier.name] = dumper.dump(modifier)
|
||||
data["modifiers"][modifier.name]['m_index'] = index
|
||||
modifier_data = {}
|
||||
|
||||
if modifier.type == 'PARTICLE_SYSTEM':
|
||||
modifier_data['particle_system'] = modifier.particle_system.name
|
||||
dumper.depth = 1
|
||||
|
||||
modifier_data.update(dumper.dump(modifier))
|
||||
|
||||
modifier_data['m_index'] = index
|
||||
|
||||
data["modifiers"][modifier.name] = modifier_data
|
||||
# CONSTRAINTS
|
||||
# OBJECT
|
||||
if hasattr(pointer, 'constraints'):
|
||||
@ -334,9 +348,15 @@ class BlObject(BlDatablock):
|
||||
# Avoid Empty case
|
||||
if self.pointer.data:
|
||||
deps.append(self.pointer.data)
|
||||
|
||||
# Childred
|
||||
if len(self.pointer.children) > 0:
|
||||
deps.extend(list(self.pointer.children))
|
||||
|
||||
# Particle systems
|
||||
for particle_slot in self.pointer.particle_systems:
|
||||
deps.append(bpy.data.particles[particle_slot.name])
|
||||
|
||||
if self.is_library:
|
||||
deps.append(self.pointer.library)
|
||||
|
||||
|
32
multi_user/bl_types/bl_particle.py
Normal file
32
multi_user/bl_types/bl_particle.py
Normal file
@ -0,0 +1,32 @@
|
||||
import bpy
|
||||
import mathutils
|
||||
|
||||
from .. import utils
|
||||
from ..libs.replication.replication.constants import (DIFF_JSON)
|
||||
from .bl_datablock import BlDatablock
|
||||
|
||||
|
||||
class BlParticle(BlDatablock):
|
||||
bl_id = "particles"
|
||||
bl_class = bpy.types.ParticleSettings
|
||||
bl_delay_refresh = 1
|
||||
bl_delay_apply = 1
|
||||
bl_automatic_push = True
|
||||
bl_icon = 'PARTICLES'
|
||||
|
||||
diff_method = DIFF_JSON
|
||||
|
||||
def construct(self, data):
|
||||
return bpy.data.particles.new(data["name"])
|
||||
|
||||
def load_implementation(self, data, target):
|
||||
utils.dump_anything.load(target, data)
|
||||
|
||||
def dump_implementation(self, data, pointer=None):
|
||||
assert(pointer)
|
||||
|
||||
dumper = utils.dump_anything.Dumper()
|
||||
dumper.depth = 1
|
||||
data = dumper.dump(pointer)
|
||||
|
||||
return data
|
Reference in New Issue
Block a user