I need to keep unique boolean properties attached to screen area (view 3d) which may have at the same time different states depending on the context view area, like propertie lock camera to view or use local camera can have different state in different 3d view areas.
For now I managed to declare a variable but which reacts globally, it changes state in all views.
import bpy
from bpy.props import StringProperty, BoolProperty
from bpy.types import PropertyGroup, Panel, Scene
from bpy.utils import register_class, unregister_class
class MyPropertyGroup(PropertyGroup):
My_Bool : BoolProperty()
class PANEL_PT_panel(Panel):
bl_label = "Boolean relative to 3d view area"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "View"
def draw(self, context):
scene = bpy.context.scene
layout = self.layout
row = layout.row(align=True)
col = row.column()
col.prop(scene.mybool, 'My_Bool', text="My Bool")
classes = (MyPropertyGroup, PANEL_PT_panel)
def register():
for i in classes:
register_class(i)
bpy.types.Scene.mybool = bpy.props.PointerProperty(type=MyPropertyGroup)
def unregister():
for i in classes:
unregister_class(i)
del bpy.types.Scene.mybool
if __name__ == "__main__":
register()
how can I "contextualize" his state ?
there is a specific way to register it ?