I think it looks real cool!
One thing that will not work is your use of the the context in line # 455 and other places in the script.
bpy.context.scene.objects.link(ob)
While it will work during GUI operations (i.e. under the MainThread) it will fail when you try to render an animation sequence (in a Dummy thread) or with Yafaray.
Rewrite the line like this…
bpy.data.scenes[0].objects.link(ob)
The fall out of this re-write is that you will be operating upon scene #0 explicitly. If you have multiple scenes in your project, the animated objects must reside in scene #0 for them to render.
That is what def returnScene is all about.
def returnScene (passedIndex = 0):
try:
return bpy.data.scenes[passedIndex]
except:
return None
myScene = returnScene() #Note: I could pass an alternate index here.
if myScene != None:
myScene.objects.link(ob)
else:
# I am probably rendering.
pass
By making all your scene references via returnScene, you can simply alter the pass index in one place (or forward it from a custom property in your object) to render animated objects that reside in difference scenes.
NOTE: The frameChange addon is actually a two part script. The AddOn portion installs the frame change processing script. So you can use the context in the AddOn portion of the script (i.e. initial object creation), but you can not use the context in the runtime frame change portion. Any code that resides in the doc portion of the code def of the AddOn.