0
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thank you! Sadly it didn't work. "Attribute not found" I updated my post with the node setup. $\endgroup$ – michaelh May 24 '16 at 21:53
  • $\begingroup$ Interestingly this doesn't produce an error within the node. But all nodes objects still have identical particle counts. In this thread [link]blender.stackexchange.com/questions/45985/… the author of the addon used modifiers["Array"].count $\endgroup$ – michaelh May 24 '16 at 22:20
  • $\begingroup$ Can you elaborate on that? $\endgroup$ – Todd McIntosh May 24 '16 at 22:22
  • $\begingroup$ You are replacing the 'ParticleSystem' string with the actual value in use correct? $\endgroup$ – Todd McIntosh May 24 '16 at 22:22
  • $\begingroup$ 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. $\endgroup$ – michaelh May 24 '16 at 22:26
1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.