Fix #141948: No error on arbitrary assignments to PropertyGroup

Declare `__slots__` to prevent arbitrary assignment.
This commit is contained in:
Campbell Barton
2025-07-16 06:58:45 +00:00
parent a2cba25b14
commit 19ee3932c3
6 changed files with 26 additions and 2 deletions

View File

@@ -673,8 +673,7 @@ def cli_extension(argv):
class BlExtDummyGroup(bpy.types.PropertyGroup):
# Dummy.
pass
__slots__ = ()
# -----------------------------------------------------------------------------

View File

@@ -2113,6 +2113,8 @@ def import_panel_user_extension(context, layout):
class GLTF2_filter_action(bpy.types.PropertyGroup):
__slots__ = ()
keep: bpy.props.BoolProperty(name="Keep Animation")
action: bpy.props.PointerProperty(type=bpy.types.Action)

View File

@@ -25,10 +25,14 @@ from bpy.props import (
class SelectionEntry(PropertyGroup):
__slots__ = ()
name: StringProperty(name="Bone Name", override={'LIBRARY_OVERRIDABLE'})
class SelectionSet(PropertyGroup):
__slots__ = ()
name: StringProperty(name="Set Name", override={'LIBRARY_OVERRIDABLE'})
bone_ids: CollectionProperty(
type=SelectionEntry,

View File

@@ -29,6 +29,8 @@ from bpy.app.translations import (
class NodeSetting(PropertyGroup):
__slots__ = ()
value: StringProperty(
name="Value",
description="Python expression to be evaluated "

View File

@@ -2665,6 +2665,8 @@ class WM_OT_toolbar_prompt(Operator):
class BatchRenameAction(bpy.types.PropertyGroup):
__slots__ = ()
# category: StringProperty()
type: EnumProperty(
name="Operation",