Changes to a PropertyGroup in the preferences of an addon do not trigger the flag indicating changes to save #71593

Open
opened 2019-11-15 00:57:21 +01:00 by Robert Moats · 16 comments

System Information
Operating system: Windows-10-10.0.17763 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 418.81

Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 13:50, hash: 06312c6d2d
Worked: (optional)

Short description of error
User preferences and add-on preferences are normally auto-saved when Blender exits, and it is triggered when the user modifies preferences data through the UI.
But there appears to be a bug that prevents this from happening when the preference data is defined inside of a property group.
2020-01-08 16-39-50.mp4

Exact steps for others to reproduce the error

  • Install the simplified addon attached - (simple script that adds/draws two preference variables for an add-on: One directly inside of a class derived from bpy.types.AddonPreferences, and one inside of a class derived from bpy.types.PropertyGroup)
  • In the addon UI, modify any the group preferences - (neither value will be saved on exit)
  • In the addon UI, modify the root preference - (dirty flag or auto-save will be triggered)
    A similar issue occurs when preference values are programmatically altered (auto-save is not triggered), but I'm not sure if this is a bug, or lack of a feature.
    user_pref_addon.py
**System Information** Operating system: Windows-10-10.0.17763 64 Bits Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 418.81 **Blender Version** Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-11 13:50, hash: `06312c6d2d` Worked: (optional) **Short description of error** User preferences and add-on preferences are normally auto-saved when Blender exits, and it is triggered when the user modifies preferences data through the UI. But there appears to be a bug that prevents this from happening when the preference data is defined inside of a property group. [2020-01-08 16-39-50.mp4](https://archive.blender.org/developer/F8266158/2020-01-08_16-39-50.mp4) **Exact steps for others to reproduce the error** - Install the simplified addon attached - (simple script that adds/draws two preference variables for an add-on: One directly inside of a class derived from `bpy.types.AddonPreferences`, and one inside of a class derived from `bpy.types.PropertyGroup`) - In the addon UI, modify any the group preferences - (neither value will be saved on exit) - In the addon UI, modify the root preference - (dirty flag or auto-save will be triggered) A similar issue occurs when preference values are programmatically altered (auto-save is not triggered), but I'm not sure if this is a bug, or lack of a feature. [user_pref_addon.py](https://archive.blender.org/developer/F8266157/user_pref_addon.py)
Author

Added subscriber: @CodeRunner

Added subscriber: @CodeRunner

#86964 was marked as duplicate of this issue

#86964 was marked as duplicate of this issue

blender/blender-addons#81165 was marked as duplicate of this issue

blender/blender-addons#81165 was marked as duplicate of this issue

#66303 was marked as duplicate of this issue

#66303 was marked as duplicate of this issue

Added subscriber: @mano-wii

Added subscriber: @mano-wii

It is probably related to the problem described in #66303
Could you provide a blend file or script demonstrating the problem?

It is probably related to the problem described in #66303 Could you provide a blend file or script demonstrating the problem?
Author

I'm very new to Python and Blender development, so I'm probably not the best person to throw one together. But it should be simple to do so for someone who knows what they're doing. It would be even easier to modify a copy of an existing add-on, which would only involve moving some preferences properties from the primary preferences structure to a child property group derived class. There may even already be some add-ons setup this way - I will try to find one. If needed, I can try to throw something together, or make a slight modification to one of the built-in add-ons.

I'm very new to Python and Blender development, so I'm probably not the best person to throw one together. But it should be simple to do so for someone who knows what they're doing. It would be even easier to modify a copy of an existing add-on, which would only involve moving some preferences properties from the primary preferences structure to a child property group derived class. There may even already be some add-ons setup this way - I will try to find one. If needed, I can try to throw something together, or make a slight modification to one of the built-in add-ons.
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

I can reproduce the issue with the following small addon.

user_pref_addon.py

2020-01-08 16-39-50.mp4

@mano-wii good catch that this is probably the same issue. Will merge them.

I can reproduce the issue with the following small addon. [user_pref_addon.py](https://archive.blender.org/developer/F8266157/user_pref_addon.py) [2020-01-08 16-39-50.mp4](https://archive.blender.org/developer/F8266158/2020-01-08_16-39-50.mp4) @mano-wii good catch that this is probably the same issue. Will merge them.
Member

Added subscribers: @GavinScott, @ZedDB, @brecht

Added subscribers: @GavinScott, @ZedDB, @brecht

Added subscriber: @funksy

Added subscriber: @funksy

Added subscriber: @ckohl_art

Added subscriber: @ckohl_art
Germano Cavalcante changed title from Preferences Modification Auto-Save Bug to Changes to a PropertyGroup in the preferences of an addon do not trigger save 2021-03-30 20:34:42 +02:00

Added subscribers: @Sergey, @JulianEisel

Added subscribers: @Sergey, @JulianEisel
Germano Cavalcante changed title from Changes to a PropertyGroup in the preferences of an addon do not trigger save to Changes to a PropertyGroup in the preferences of an addon do not trigger the flag indicating changes to save 2021-03-30 20:41:09 +02:00
Member

Problem is that this function doesn't cover this case: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_handlers.c$622-640.
Ideally this could just walk up the RNA path of the property to see if any parent is of a preferences RNA type. But we can't get that path there unfortunately, not sure if there's a way to get it.
Alternatively, when registering custom properties, BPY could flag them as "inside a preferences struct". But this would break when nesting a property group inside a property group inside the add-on preferences...

This works, and although a bit odd at first, it does make sense to do this on second thought - at least to me:

@@ -10,3 +10,3 @@ from bpy.props import *
 
-class TestPropertyGroup(bpy.types.PropertyGroup):
+class TestPropertyGroup(bpy.types.PropertyGroup, bpy.types.AddonPreferences):
     prop2: IntProperty(name="Prop 2")

Problem is that this function doesn't cover this case: https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_handlers.c$622-640. Ideally this could just walk up the RNA path of the property to see if any parent is of a preferences RNA type. But we can't get that path there unfortunately, not sure if there's a way to get it. Alternatively, when registering custom properties, BPY could flag them as "inside a preferences struct". But this would break when nesting a property group inside a property group inside the add-on preferences... This works, and although a bit odd at first, it does make sense to do this on second thought - at least to me: ``` @@ -10,3 +10,3 @@ from bpy.props import * -class TestPropertyGroup(bpy.types.PropertyGroup): +class TestPropertyGroup(bpy.types.PropertyGroup, bpy.types.AddonPreferences): prop2: IntProperty(name="Prop 2") ```

Added subscriber: @timodriaan

Added subscriber: @timodriaan
Philipp Oeser removed the
Interest
Python API
label 2023-02-10 09:04:43 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#71593
No description provided.