Galaxy simulation issue with full render

I am working on a galaxy simulation. If I run the script, and then scrub the timeline it works prefect. If I run the script and then do an opengl animation render, it renders perfectly.

But if I run the script, and then do a real render, it keeps adding galaxy.001, galaxy.002 objects continuously while it builds the scene.

Does anyone have any idea why this happens. Here is the main handler, I can post all the other functions, or a blend if need be. Thanks in advance.

edit: previous code is junk

I’m just at a loss. There’s nothing wrong with the code, I mean, no compile or runt time errors, no warnings, it works in viewport.

No problem here. Script runs on my machine fine and renders fine. If I’m running the same file as you, it can only be your gpu? That’s a question, sorry. Can’t think of much else it could be. Good luck in your search. It looks like a great script.

Thanks for your response. I still get the same issue running as CPU. Tried under 2.73, and 2.74a. Win 7 pro, i5, 16 mb, gtx780 pny.

Edit: just updated my nvidia driver to latest release 353.06, and downloaded 2.75 rc1, same issue. :frowning:

I’m just puzzled. What os and blender version are you using? Thank you.

ross_m, I had another person run the files on their machine and they have the same issue that I do. My gut feeling is that, the first few frames will look pretty normal, but as the objects pile up you start to see the duplicates.

I may just have to refactor the code and move to bmesh for everything. It just sucks, it works perfect in viewport and opengl.

Hi Photox,
I get this image at Frame 46, renders fine on a Linux Debian OS, does it should look like this?

DEBLENDER, thank you very much for taking the time to run the test. At the moment the simulation only moves forward in time, so even if you scrub the timeline backwards every frame change moves the simulation forward in time one step. If you only render one single frame (any frame number) it will look correct. The problem is when you try to render multiple frames for an animation. That’s when the multiple objects start spawning, and so instead of a galaxy in motion it looks kind of like shooting stars.

On that blend if you do this:

  1. Change end frame to 150
  2. run script
  3. render menu (up top) opengl render animation
    You get this which is 100% correct

But if you do this:

  1. change end frame to 75
  2. run script
  3. click ‘animation’ button from render tab (render active scene)

You get this, with old objects spawned: still processing…

Maybe I could approach it in a different way. Instead of clicking ‘render animation’ maybe I could just make a render call directly from the script. Is it possible to have a script make a render, finish and write the image to disk, and then continue on with the script?