I'm currently udpating some 2.7x script for 2.8. Everything is going fine except for one thing:
Currently the script uses a class to store some properties like so:
class MySettings(PropertyGroup):
lockHead = BoolProperty(
name="Enable or Disable",
description="Lock the head position of the bone",
default = False
)
which is registered in the registration part:
def register():
bpy.types.Scene.my_tool = PointerProperty(type=MySettings)
def unregister():
del bpy.types.Scene.my_tool
The issue is, Blender 2.8 doesn't want to register it in the Scene
. I try to register it in the Window
like so :
def register():
bpy.types.Window.my_tool = PointerProperty(type=MySettings)
def unregister():
del bpy.types.Window.my_tool
But then I can't get the property elsewhere (if I get it with context.window.my_tool
I just have some weird tuple and can't reach the property itself). Here's an example where I try to get them in a separate UI class:
def draw (self, context):
layout = self.layout
mytool = context.window.my_tool
rows = 2
row = layout.row(align=True)
row.prop(mytool, "lockHead", icon='NDOF_DOM', text="Head")
So the question is, where can I register the PropertyGroup
class so I can access the properties inside in an other class? Or am I doing something commpletly wrong?
And side question, since the classes are no longer stored in the bpy.types
"class", how can I get them?