[Bf-committers] Change scene by python API

revuedelibre . revuedelibre at gmail.com
Thu Mar 24 10:22:27 CET 2011


Hello,

In my current .blend, there are 2 scenes : 'Scene' and 'NewScene'
If I am on 'Scene', and run following script (in a Text, then "Run Script" )

bpy.context.screen.scene = bpy.data.scene['NewScene']
> bpy.ops.mesh.primitive_cube_add()
>

The cube is added on 'Scene', not on 'NewScene'.

Except if I run each line, step by step, in console. In that case, the cube
is added in 'NewScene'.


Regards,

On Thu, Mar 24, 2011 at 8:51 AM, Felix Schlitter
<felixschlitter at gmail.com>wrote:

> Hmm..
>
> Did you already try changing the scene via bpy.context.screen.scene? That
> might work.
>
> Cheers
>
>
> On Thu, Mar 24, 2011 at 8:34 PM, revuedelibre . <revuedelibre at gmail.com
> >wrote:
>
> > Hello,
> >
> > Nobody to help me ?
> >
> > It is quite strange to have a different way to work in console and in a
> > script ...
> >
> > Regards,
> >
> > On Wed, Mar 23, 2011 at 8:28 AM, revuedelibre . <revuedelibre at gmail.com
> > >wrote:
> >
> > > Hello,
> > >
> > > Is there a solution to change Scene by python API ?
> > >
> > > I found that we can change it by screen.scene =
> > bpy.data.scene['NewScene'].
> > >
> > > Juste after that, bpy.ops.mesh.primitive_cube_add() have does :
> > >
> > > - add a cube in the new selected scene when these 2 actions are done
> step
> > > by step in python console
> > > - add a cube in previous selected scene when these 2 actions are in a
> > > script.
> > >
> > > --> Strange to have a difference in these 2 actions
> > >
> > >
> > > And what about background mode ( not tested ) ? It's quite strange to
> use
> > > "screen" for change scene in background mode ( no screen ! )
> > >
> > > Thanks & Regards,
> > >
> > > Ju
> > >
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> >
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list