Hi.
I’m having an strange info answer between python console inside blender and in the ubuntu terminal during execution of a script.
It’s about getting scene context, when creating a new scene with this code for example.
import bpy
print(bpy.context.screen.scene)
bpy.ops.scene.new(type="EMPTY")
print(bpy.context.scene)
print()
If you run this and look last print and scene indicator in blender you see wath i mean
Am i missing some update line in the script to read scene context or maybe it’s a bug issue from the operator??
If you type in the console command by command the new scene becomes active and i’m able to rename correctly.
Buy the operator, runned with alt-p doesn’t actuallice the scene active and remains aplying “.001” to names.
An aproximate code for my script is to be able to create a list of scenes, like:
import bpy
print(bpy.context.scene.name)
def createscene(nombre):
if nombre in bpy.data.scenes.keys():
print()
print("Exist: "+nombre)
bpy.context.screen.scene=bpy.data.scenes[nombre]
else:
bpy.ops.scene.new(type="EMPTY")
bpy.context.scene.name=nombre
print()
print("no existia: "+bpy.context.scene.name)
print("creado: "+bpy.context.scene.name)
lista=["uno","dos","dos","tres","tres"]
print("---------------------------------------------------")
for i in lista:
createscene(i)
print()
print("current scene: ")
print(bpy.context.scene.name)
thanks