← All ideas
  • Published 21 Dec 2018

Quick Scattering !

Hello

i really think that particles take a long time to set up !

i think it could be amazing to handle them quickly with a shortcut, the selected object are the particles of the active object, like this :

g|690x484 gg|690x484

code: only work in 2.8

import bpy

context = bpy.context
scene = context.scene
A = context.object

def find_collection(context, item):
    collections = item.users_collection
    if len(collections) > 0:
        return collections[0]
    return context.scene.collection

def make_collection(collection_name, parent_collection):
    if collection_name in bpy.data.collections:
        return bpy.data.collections[collection_name]
    else:
        new_collection = bpy.data.collections.new(collection_name)
        parent_collection.children.link(new_collection)
        return new_collection

i = 1
pref = "%s Particle " % A.name

name = "%s%d" % (pref, i)
while A.modifiers.get(name):    
    i += 1
    name = "%s%d" % (pref, i)

A.select_set(state=False)

for o in bpy.context.selected_objects:
    o_collection = find_collection(bpy.context, o)
    new_collection = make_collection(name , o_collection)
    new_collection.objects.link(o)
    o_collection.objects.unlink(o)

A.select_set(state=True)

m = A.modifiers.new(name, type='PARTICLE_SYSTEM')
ps = m.particle_system
ps.name = name
ps.settings.name = name
ps.settings.type = 'HAIR'
ps.settings.render_type = 'COLLECTION'
ps.settings.instance_collection = bpy.data.collections[name]
ps.settings.particle_size = 0.25

thanks to everyone on blender stack exchange for the help, i couln't do it witouth them, i learned code one week ago

100%

Development Status: Open

Upvote 16 Downvote 0
DB3D
21 Dec 2018

5 Comments

dpdpforlife

This is like the quick fur, quick explode and quick fluid that we have now. I don't see this as being a big hurdle for the devs, but as a way to quickly automate a common process that doesn't require any coding from the user. I fully support this. Please add it to Blender.

jason

How does this differ from just using Dupliverts or Duplifaces?

DB3D Author

@Jason van Gumster: because its a particlle system, already set up to hair, ,autorotation, collection , and create automatically a collection with the selected object , also rename the modifier, the particle layer, and the collection automatically

1
thejopetoons

Amazing!

Yury_Ziankoyuski

Good idea. Grasswald is a good example of how simple scattering should be. Current implementation we have though hair system have a lot of unnesecary and lacking features.