fix: particle system duplication

feat: update Readme
This commit is contained in:
Swann 2021-04-14 15:29:02 +02:00
parent eb631e2d4b
commit 8e606068f3
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
4 changed files with 58 additions and 41 deletions

View File

@ -30,21 +30,21 @@ See the [troubleshooting guide](https://slumber.gitlab.io/multi-user/getting_sta
Currently, not all data-block are supported for replication over the wire. The following list summarizes the status for each ones.
| Name | Status | Comment |
| -------------- | :----: | :--------------------------------------------------------------------------: |
| -------------- | :----: | :----------------------------------------------------------: |
| action | ✔️ | |
| armature | ❗ | Not stable |
| camera | ✔️ | |
| collection | ✔️ | |
| curve | ❗ | Nurbs surfaces not supported |
| gpencil | ✔️ | [Airbrush not supported](https://gitlab.com/slumber/multi-user/-/issues/123) |
| gpencil | ✔️ | |
| image | ✔️ | |
| mesh | ✔️ | |
| material | ✔️ | |
| node_groups | ❗ | Material only |
| node_groups | ❗ | Material & Geometry only |
| geometry nodes | ✔️ | |
| metaball | ✔️ | |
| object | ✔️ | |
| textures | ❗ | Supported for modifiers/materials only |
| textures | ❗ | Supported for modifiers/materials/geo nodes only |
| texts | ✔️ | |
| scene | ✔️ | |
| world | ✔️ | |
@ -53,7 +53,7 @@ Currently, not all data-block are supported for replication over the wire. The f
| texts | ❌ | [Planned](https://gitlab.com/slumber/multi-user/-/issues/81) |
| nla | ❌ | |
| volumes | ✔️ | |
| particles | ❌ | [On-going](https://gitlab.com/slumber/multi-user/-/issues/24) |
| particles | ❗ | The cache isn't syncing. |
| speakers | ❗ | [Partial](https://gitlab.com/slumber/multi-user/-/issues/65) |
| vse | ❗ | Mask and Clip not supported yet |
| physics | ❌ | [Planned](https://gitlab.com/slumber/multi-user/-/issues/45) |

View File

@ -439,12 +439,24 @@ class BlObject(BlDatablock):
mod for mod in target.modifiers if mod.type == 'PARTICLE_SYSTEM']
for mod in particles_modifiers:
loader.load(mod.particle_system, data['modifiers'][mod.name]['particle_system'])
# default_settings = mod.particle_system.settings
# mod.particle_system.settings = get_datablock_from_uuid(data['modifiers'][mod.name]['particle_system']['settings'], None)
default = mod.particle_system.settings.name
dumped_particles = data['modifiers'][mod.name]['particle_system']
loader.load(mod.particle_system, dumped_particles)
settings = get_datablock_from_uuid(dumped_particles['settings_uuid'], None)
if settings:
mod.particle_system.settings = settings
# Hack to remove the default generated particle settings
# bpy.data.particles.remove(default_settings)
for settings in bpy.data.particles:
if settings.users == 0:
bpy.data.particles.remove(settings)
phys_modifiers = [
mod for mod in target.modifiers if mod.type in ['SOFT_BODY', 'CLOTH']]
for mod in phys_modifiers:
loader.load(mod.settings, data['modifiers'][mod.name]['settings'])
# PHYSICS
load_physics(data, target)
@ -457,7 +469,6 @@ class BlObject(BlDatablock):
target.matrix_local = mathutils.Matrix(transform['matrix_local'])
def _dump_implementation(self, data, instance=None):
assert(instance)
@ -537,13 +548,17 @@ class BlObject(BlDatablock):
modifier)
dumped_modifier['inputs'] = dumped_inputs
if modifier.type == 'PARTICLE_SYSTEM':
elif modifier.type == 'PARTICLE_SYSTEM':
dumper.exclude_filter = [
"is_edited",
"is_editable",
"is_global_hair"
]
dumped_modifier['particle_system'] = dumper.dump(modifier.particle_system)
dumped_modifier['particle_system']['settings_uuid'] = modifier.particle_system.settings.uuid
elif modifier.type in ['SOFT_BODY', 'CLOTH']:
dumped_modifier['settings'] = dumper.dump(modifier.settings)
data["modifiers"][modifier.name] = dumped_modifier
@ -679,7 +694,7 @@ class BlObject(BlDatablock):
# Particle systems
for particle_slot in self.instance.particle_systems:
deps.append(bpy.data.particles[particle_slot.name])
deps.append(particle_slot.settings)
if self.is_library:
deps.append(self.instance.library)

View File

@ -45,7 +45,9 @@ class BlParticle(BlDatablock):
bl_reload_parent = False
def _construct(self, data):
return bpy.data.particles.new(data["name"])
instance = bpy.data.particles.new(data["name"])
instance.uuid = self.uuid
return instance
def _load_implementation(self, data, target):
dump_anything.load(target, data)

View File

@ -610,8 +610,8 @@ class Loader:
instance.write(bpy.data.fonts.get(dump))
elif isinstance(rna_property_type, T.Sound):
instance.write(bpy.data.sounds.get(dump))
elif isinstance(rna_property_type, T.ParticleSettings):
instance.write(bpy.data.particles.get(dump))
# elif isinstance(rna_property_type, T.ParticleSettings):
# instance.write(bpy.data.particles.get(dump))
def _load_matrix(self, matrix, dump):
matrix.write(mathutils.Matrix(dump))