[Bf-python] Blender -b and Scenes
Willian Padovani Germano
wgermano at superig.com.br
Wed Mar 22 04:37:38 CET 2006
Hi Campbell,
Yes, you have a point, indeed many py functions may rely on G.scene, I
didn't consider that in my previous reply. We still need to check the
pointers (good practices, not just for bg mode), but creating a scene
iff G.scene is NULL AND we're in bg mode may be a good solution in this
case (others here: opinions?).
Anyway, please don't commit it before you email bf-committers about your
intention. Ton and others may have important comments about this. I'd
also suggest, if it gets accepted, that you print a msg to the console,
informing the user that a scene was created, something like: "No scene
available, creating an empty one.". Checking that the scene was actually
created and assigned to G.scene is a must too, of course.
Campbell Barton wrote:
> Hey Willian,
>
> thaught of just adding checks, and while its okay for functions that
> directly use G.scene, there are functions that python calls that use
> G.scene
> Also, if you cover all cases, its adds up to a fair few checks.
>
> Just seems a simpler option to add a scene when importing Blender
> keep in mind this only effects blender when running in background mode.
>
> would be somthing like
> if (!G.scene)
> add_scene("Scene");
>
> This would save us adding checks to World, Mesh, Scene? and others for
> this 1 rare case.
> It also seems logical that when you start blender and run a script in
> User mode you have a empty scene. so why not have 1 in background mode?
> - Cam
--
Willian
More information about the Bf-python
mailing list