Re-evaluate "Reset to Default Value" #47618

Closed
opened 2016-02-28 19:17:19 +01:00 by Julian Eisel · 16 comments
Member

Re-evaluate "Reset to Default Value"

Motivation

Users have the option to reset a property to its default vaule (in UI: {nav RMB Menu > Reset to Default Value}). However, this barely works, in the majority of cases it just sets it to its minimum value. So as it is, it can definitely be considered broken.

Keep it or wipe it out?

Just wiping it out would safe us some work, but IMHO this feature would be very useful - if it worked. It gives users some safety, since they don't need to be afraid of breaking something by playing around with values. (I personally wanted to use it all the time.)

How to solve?

First of, we need to ask what we define as the default value. AFAICS there are three potential default values:

  • RNA default value
  • Startup file value
  • User defined value

RNA default value:
RNA already supports default values, assigning one to a property is a one line fix. The issue is that it had to be done for all properties that miss it (quickly checked, more than 2000, maybe 3000 properties).
To solve this, I'd propose we add a maniphest task that lists all RNA files and ask people to submit patches that add default values for theses files. Think operator RNA properties could be neglected a bit.
Note that these default values should match the ones from the startup.blend, meaning they had to be kept in sync too.

Startup file value:
AFAIK it's possible to get the property value of a .blend using Python, so we could do this with the startup.blend.
Using this solution we wouldn't have to worry about keeping startup.blend and RNA defaults in sync.

User defined value:
This should work 'on top' of one of the other two solutions, and it's obviously the solution that would be the most configurable. It could be set in a popup that is invoked from the context menu (this popup could also allow resetting to non-user defined default).

# Re-evaluate "Reset to Default Value" ## Motivation Users have the option to reset a property to its default vaule (in UI: {nav RMB Menu > Reset to Default Value}). However, this barely works, in the majority of cases it just sets it to its minimum value. So as it is, it can definitely be considered broken. ## Keep it or wipe it out? Just wiping it out would safe us some work, but IMHO this feature would be very useful - if it worked. It gives users some safety, since they don't need to be afraid of breaking something by playing around with values. (I personally wanted to use it all the time.) ## How to solve? First of, we need to ask what we define as the default value. AFAICS there are three potential default values: * RNA default value * Startup file value * User defined value **RNA default value:** RNA already supports default values, assigning one to a property is a one line fix. The issue is that it had to be done for all properties that miss it (quickly checked, more than 2000, maybe 3000 properties). To solve this, I'd propose we add a maniphest task that lists all RNA files and ask people to submit patches that add default values for theses files. Think operator RNA properties could be neglected a bit. Note that these default values should match the ones from the startup.blend, meaning they had to be kept in sync too. **Startup file value:** AFAIK it's possible to get the property value of a .blend using Python, so we could do this with the startup.blend. Using this solution we wouldn't have to worry about keeping startup.blend and RNA defaults in sync. **User defined value:** This should work 'on top' of one of the other two solutions, and it's obviously the solution that would be the most configurable. It could be set in a popup that is invoked from the context menu (this popup could also allow resetting to non-user defined default).
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscribers: @JulianEisel, @ideasman42, @brecht

Added subscribers: @JulianEisel, @ideasman42, @brecht

#68299 was marked as duplicate of this issue

#68299 was marked as duplicate of this issue

#64086 was marked as duplicate of this issue

#64086 was marked as duplicate of this issue
Member

Added subscriber: @Blendify

Added subscriber: @Blendify
Member

If we take the RNA option I could make patches

If we take the RNA option I could make patches

There's actually 3 places with default values, in RNA, in the function that allocates the struct, and in the startup file. The startup file only contains a small subset of all data structures though.

If we want to avoid duplication, it's possible to make a function that sets RNA default values in structs when they are allocated. Something similar could be done for the startup.blend, though I'm not sure where that fits in exactly.

There's actually 3 places with default values, in RNA, in the function that allocates the struct, and in the startup file. The startup file only contains a small subset of all data structures though. If we want to avoid duplication, it's possible to make a function that sets RNA default values in structs when they are allocated. Something similar could be done for the startup.blend, though I'm not sure where that fits in exactly.

Added subscriber: @mont29

Added subscriber: @mont29

IMHO startup blend should be kept aside. First because people typically customize it, second because there are several things in it which shall not be set to default values (you do not want all your vertex coordinates to be (0,0,0), same for all your objects location/rotation/scale etc.). We could use a py script to ensure a reasonable subset of 'factory setting' matches the RNA default values, though, once we have unified defaults in code.

Which leaves C struct and RNA. I really like Brecht’s suggestion here, would enforce both real default values in RNA (as said, most of those are not set in current code), and greatly simplifies C struct initializations too.

IMHO startup blend should be kept aside. First because people typically customize it, second because there are several things in it which shall not be set to default values (you do not want all your vertex coordinates to be (0,0,0), same for all your objects location/rotation/scale etc.). We could use a py script to ensure a reasonable subset of 'factory setting' matches the RNA default values, though, once we have unified defaults in code. Which leaves C struct and RNA. I really like Brecht’s suggestion here, would enforce both real default values in RNA (as said, most of those are not set in current code), and greatly simplifies C struct initializations too.

Added subscriber: @JonathanWilliamson

Added subscriber: @JonathanWilliamson

Regarding "How To Solve" (if we want to).

A while back I wrote a script to report invalid defaults (comparing newly created data against RNA defaults).

You can run it with:

blender --background -noaudio --factory-startup --python tests/python/bl_rna_defaults.py 

Current output: bl_rna_default.txt

Regarding *"How To Solve"* (if we want to). A while back I wrote a script to report invalid defaults (comparing newly created data against RNA defaults). You can run it with: ``` blender --background -noaudio --factory-startup --python tests/python/bl_rna_defaults.py ``` Current output: [bl_rna_default.txt](https://archive.blender.org/developer/F286363/bl_rna_default.txt)

Added subscriber: @jonramos

Added subscriber: @jonramos

Propose to solve this via D4500: DNA Defaults

Propose to solve this via [D4500: DNA Defaults](https://archive.blender.org/developer/D4500)
Member
Added subscribers: @tintwotin, @lichtwerk, @ChristopherAnderssarian
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Julian Eisel self-assigned this 2020-02-20 11:25:39 +01:00
Author
Member

Thanks to the DNA defaults, this is finally solved in principle. We still need to add DNA defaults to more data structures, but that is something we can do during regular development.

Thanks to the DNA defaults, this is finally solved in principle. We still need to add DNA defaults to more data structures, but that is something we can do during regular development.
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
9 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#47618
No description provided.