I try to display a custom property of a 3D object belonging to scene A in a panel that only appears in scene B.
At the time of the initialization : The scene A (that will be set by the user) it's not defined yet. So the panel shouldn't be shown. Also, when no object is active in the scene A, the panel should be hidden.
So far, here's my code :
class tags_panel(bpy.types.Panel):
bl_space_type = "SEQUENCE_EDITOR"
bl_region_type = "UI"
bl_label = "zebra"
@classmethod
def poll(cls, context):
if bpy.context.screen.scene.name == 'B':
return
def draw(self, context):
global main_scene
try:
self.layout.prop(main_scene.objects.active, "my_prop")
except NameError:
print("something wrong...")
For now the panel is not showing.
Can someone explain me the use of poll() and how I can manage to display the panel only if all conditions are met ? Thank you so much !