Ok, what I'm asking could not be so mainstream. I'm writing an addon for blender that will add a better particle system, and I am in the process of reating an operator that spawns particles and animates them during time. Untill now I've used this procedure to create a particle object:
- I created a plane,
- Merged it at the center
- removed doubles
So That I would have only a vertex. And then to add datas like particle age, the frame it was born, etc, I used object Custom Properties.
the problem is that Blender struggles to keep upp with thousands of different objects to the point where it doesn't even play the animation at all or just crashes.
But I noticed that it could hold more than 20000 particles at a time without any problem. I want to state that I know python but not so much C++ or C, so excuse me if the following argument is wrong, but I think that blender cannot hold so many object cause they have much more to them than a single particle, for example an objects has Material Slot, Particle Systems, Location, And Much More and It's also treated in a completely different way than a particle which on the other side only has few properties.
given the Argument is true (Escuse me if it isn't) could I create a simple class in a c++ file like this:
And create instead of a normal object a better_particle object to represent each particle, and also important draw that better_particle Class into the viewport using for example a Rectagle (Like For Example blender's Default Particle)?
I think this is possible modifying the Blender source code to fit my needs, but I want to keep it a Blender addon and not just a custom Build.
So is this possible?
EDIT: I Cannot use Animation Nodes as it hasn't the flexibility of an addon, and The Tree as long as I know it's executed each frame, so particle will not be able to spawn or move in subframes and this would lead to lagging streaks of particles. The same problem that there's in blender by default.
WHAT I'm TRYING TO ACHIEVE:
I've Written this simple Python Code:
created_particles = 
for f in range(0,40): #For each of 40 Frames
for i in range(0, 30): # Create 30 Particle
pp = particle() ##Create New Particle Object
pp.location = (0,0,0) #Add location variable
pp.spawn_frame = f
As you can see it just creates some particle object ad assign them some variables. Now I need to Create the particle class in c++ with something like the lines up above and then in Python do something like:
p = bpy.ops.add_particle()
p.location = (0,0,0)
and the Last Thing I need to do it's to create a drawing function in c++ do display these particle objects.