@ -16,7 +16,8 @@ __all__ = [
|
|||||||
'bl_metaball',
|
'bl_metaball',
|
||||||
'bl_lattice',
|
'bl_lattice',
|
||||||
'bl_lightprobe',
|
'bl_lightprobe',
|
||||||
'bl_speaker'
|
'bl_speaker',
|
||||||
|
'bl_particle'
|
||||||
] # Order here defines execution order
|
] # Order here defines execution order
|
||||||
|
|
||||||
from . import *
|
from . import *
|
||||||
|
@ -3,7 +3,7 @@ import mathutils
|
|||||||
|
|
||||||
from .. import utils
|
from .. import utils
|
||||||
from ..libs.replication.replication.data import ReplicatedDatablock
|
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
|
from ..libs import dump_anything
|
||||||
|
|
||||||
def dump_driver(driver):
|
def dump_driver(driver):
|
||||||
@ -75,7 +75,7 @@ class BlDatablock(ReplicatedDatablock):
|
|||||||
if self.pointer and hasattr(self.pointer, 'uuid'):
|
if self.pointer and hasattr(self.pointer, 'uuid'):
|
||||||
self.pointer.uuid = self.uuid
|
self.pointer.uuid = self.uuid
|
||||||
|
|
||||||
self.diff_method = DIFF_BINARY
|
self.diff_method = DIFF_JSON
|
||||||
|
|
||||||
def library_apply(self):
|
def library_apply(self):
|
||||||
"""Apply stored data
|
"""Apply stored data
|
||||||
|
@ -101,14 +101,19 @@ class BlObject(BlDatablock):
|
|||||||
|
|
||||||
for modifier in data['modifiers']:
|
for modifier in data['modifiers']:
|
||||||
target_modifier = target.modifiers.get(modifier)
|
target_modifier = target.modifiers.get(modifier)
|
||||||
|
|
||||||
if not target_modifier:
|
if not target_modifier:
|
||||||
target_modifier = target.modifiers.new(
|
target_modifier = target.modifiers.new(
|
||||||
data['modifiers'][modifier]['name'], data['modifiers'][modifier]['type'])
|
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(
|
utils.dump_anything.load(
|
||||||
target_modifier, data['modifiers'][modifier])
|
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
|
# Load constraints
|
||||||
# Object
|
# Object
|
||||||
if hasattr(target, 'constraints') and 'constraints' in data:
|
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]
|
target.data.shape_keys.key_blocks[key_block].relative_key = target.data.shape_keys.key_blocks[reference]
|
||||||
|
|
||||||
|
|
||||||
def dump_implementation(self, data, pointer=None):
|
def dump_implementation(self, data, pointer=None):
|
||||||
assert(pointer)
|
assert(pointer)
|
||||||
dumper = utils.dump_anything.Dumper()
|
dumper = utils.dump_anything.Dumper()
|
||||||
@ -219,9 +225,17 @@ class BlObject(BlDatablock):
|
|||||||
dumper.depth = 2
|
dumper.depth = 2
|
||||||
data["modifiers"] = {}
|
data["modifiers"] = {}
|
||||||
for index, modifier in enumerate(pointer.modifiers):
|
for index, modifier in enumerate(pointer.modifiers):
|
||||||
data["modifiers"][modifier.name] = dumper.dump(modifier)
|
modifier_data = {}
|
||||||
data["modifiers"][modifier.name]['m_index'] = index
|
|
||||||
|
|
||||||
|
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
|
# CONSTRAINTS
|
||||||
# OBJECT
|
# OBJECT
|
||||||
if hasattr(pointer, 'constraints'):
|
if hasattr(pointer, 'constraints'):
|
||||||
@ -334,9 +348,15 @@ class BlObject(BlDatablock):
|
|||||||
# Avoid Empty case
|
# Avoid Empty case
|
||||||
if self.pointer.data:
|
if self.pointer.data:
|
||||||
deps.append(self.pointer.data)
|
deps.append(self.pointer.data)
|
||||||
|
|
||||||
|
# Childred
|
||||||
if len(self.pointer.children) > 0:
|
if len(self.pointer.children) > 0:
|
||||||
deps.extend(list(self.pointer.children))
|
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:
|
if self.is_library:
|
||||||
deps.append(self.pointer.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