0

I am currently trying to drive the particle count of various instances of an object (containing a particleSystem) dynamically for each instance.

I'm using a loop subprogram with an Object Attribute Output node.

The one thing I can't seem to get right is how to point to the particle count in the Attribute Output node.

What I need is basically a one-line version of this:

bpy.data.objects['Plane'].modifiers['ParticleSystem 1']
bpy.data.particles['ParticleSettings'].count = value

Any help would be much appreciated.

Update with Node-Setup:

enter image description here

Todd McIntosh
  • 9,421
  • 25
  • 50
michaelh
  • 1,939
  • 10
  • 21

2 Answers2

1

after some research and tests this code works for me:

modifiers["name"].particle_system.settings.count

where "name" is the text string used in the modifiers tab

IMPORTANT You must set an input in the value slot otherwise it gives an error "Value has a wrong type"

enter image description here

Recho
  • 11
  • 1
1

The full python line to read that setting is:

bpy.data.objects['Plane'].particle_systems['ParticleSystem'].settings.count

According to the Animation Nodes documentation the attribute field of the Object Attribute Output node is relative to the object which would mean you would use:

particle_systems['ParticleSystem'].settings.count

or alternatively:

modifiers['ParticleSystem'].particle_system.settings.count

Whether this actually works is dependant on how the developer wrote the Animation Nodes addon.

Todd McIntosh
  • 9,421
  • 25
  • 50
  • Thank you! Sadly it didn't work. "Attribute not found" I updated my post with the node setup. – michaelh May 24 '16 at 21:53
  • Interestingly this doesn't produce an error within the node. But all nodes objects still have identical particle counts. In this thread [link]http://blender.stackexchange.com/questions/45985/animation-nodes-is-it-possible-to-instance-nested-instances the author of the addon used modifiers["Array"].count – michaelh May 24 '16 at 22:20
  • Can you elaborate on that? – Todd McIntosh May 24 '16 at 22:22
  • You are replacing the 'ParticleSystem' string with the actual value in use correct? – Todd McIntosh May 24 '16 at 22:22
  • sorry, I hit "Enter" a little too early - still have to get used to that. - Yes, I tried it with "ParticleSystem 1" which is the actual name. I also tried modifiers['ParticleSystem 1'].settings.count which also returns an error. – michaelh May 24 '16 at 22:26
  • You can only have one particle count for the 'ParticleSystem' particle system. If all the object nodes are pointing to the one particle system, the count will be the same. – Todd McIntosh May 24 '16 at 22:27
  • Your alternate syntax should read: modifiers['ParticleSystem 1'].particle_system.settings.count but I'm not sure that's your issue if all your object references are pointing to the same particle system and you want them to have different particle counts. – Todd McIntosh May 24 '16 at 22:30
  • Oh you are right!! The instancer node only creates new instances of the object, but uses the same particle system. Duh! It felt so close! ^^ Thanks for pointing this out! – michaelh May 24 '16 at 22:33
  • Then your answer is totally right. Only now I have to find the right question to ask. Thanks for your help. – michaelh May 24 '16 at 22:37