[Bf-python] Blender -b and Scenes

Campbell Barton cbarton at metavr.com
Wed Mar 22 02:03:44 CET 2006


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 Padovani Germano wrote:
> Hi Campbell,
>
> Creating automatically a new scene seems a little too much. IMO, 
> better just check for it wherever it's needed (we should anyway never 
> take for granted that a pointer is valid) and return a runtime error 
> if G.scene is NULL.
>
> Campbell Barton wrote:
>> Blender running in backgroud mode dosent start with a scene.
>> there have been 2 bugs reported recently that exist because the 
>> python API can run when blender has no Scene.
>>
>> Why not check for G.scene==NULL and make a new Scene on importing 
>> Blender?
>> Any objections?
>>
>> - Cam
>
> -- 
> Willian
>


-- 
Campbell J Barton

133 Hope Street
Geelong West, Victoria 3218 Australia

URL:    http://www.metavr.com
e-mail: cbarton at metavr.com
phone: AU (03) 5229 0241



More information about the Bf-python mailing list