"New File" operator loads UI, even if explicitly told to not do so #72169

Closed
opened 2019-12-04 16:51:27 +01:00 by Tristan · 8 comments

System Information
Operating system: Linux-5.3.0-24-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash: 26bd5ebd42
Worked: (optional)

Short description of error
When executing "bpy.ops.wm.read_homefile" the parameter for "load_ui" is ignored. Extremely annoying for add-ons that need to create completely blank files.

Exact steps for others to reproduce the error
Open any .blend file.
Switch to 'Python Console'-Editor.
Enter the following:
bpy.ops.wm.read_homefile(load_ui=False)
User interface of saved default file will still be loaded. Blender should keep the UI from the previous file and only load non-UI data.

**System Information** Operating system: Linux-5.3.0-24-generic-x86_64-with-debian-buster-sid 64 Bits Graphics card: GeForce GTX 1070 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21 **Blender Version** Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-11-20 14:27, hash: `26bd5ebd42` Worked: (optional) **Short description of error** When executing "bpy.ops.wm.read_homefile" the parameter for "load_ui" is ignored. Extremely annoying for add-ons that need to create completely blank files. **Exact steps for others to reproduce the error** Open any .blend file. Switch to 'Python Console'-Editor. Enter the following: bpy.ops.wm.read_homefile(load_ui=False) User interface of saved default file will still be loaded. Blender should keep the UI from the previous file and only load non-UI data.
Author

Added subscriber: @Plyro

Added subscriber: @Plyro

Added subscriber: @rjg

Added subscriber: @rjg

This may be intentionally judging by the comment in the source code (wm_homefile_read_exec() in wm_files.c ):

/* This can be used when loading of a start-up file should only change
 * the scene content but keep the blender UI as it is. */
wm_open_init_load_ui(op, true);
SET_FLAG_FROM_TEST(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI);
This may be intentionally judging by the comment in the source code ([`wm_homefile_read_exec()` in `wm_files.c` ](https://developer.blender.org/diffusion/B/browse/master/source/blender/windowmanager/intern/wm_files.c$1907)): ``` /* This can be used when loading of a start-up file should only change * the scene content but keep the blender UI as it is. */ wm_open_init_load_ui(op, true); SET_FLAG_FROM_TEST(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI); ```

Added subscriber: @ideasman42

Added subscriber: @ideasman42

@ideasman42 You've added this in commit blender/blender-staging@dd54b721c6. I assume this is the way you've intended it to work?

@ideasman42 You've added this in commit blender/blender-staging@dd54b721c6. I assume this is the way you've intended it to work?
Author

In #72169#823711, @rjg wrote:
This may be intentionally judging by the comment in the source code (wm_homefile_read_exec() in wm_files.c ):

/* This can be used when loading of a start-up file should only change
 * the scene content but keep the blender UI as it is. */
wm_open_init_load_ui(op, true);
SET_FLAG_FROM_TEST(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI);

I read from this that it should work the way I described it. My description may not have been very clear.

bpy.ops.wm.read_homefile()

does load the homefile UI by default. Setting

load_ui=False

still loads the homefile's UI, although it shouldn't! The issue is that load_ui seems to be treated as True, even when set to False.

> In #72169#823711, @rjg wrote: > This may be intentionally judging by the comment in the source code ([`wm_homefile_read_exec()` in `wm_files.c` ](https://developer.blender.org/diffusion/B/browse/master/source/blender/windowmanager/intern/wm_files.c$1907)): > > > ``` > /* This can be used when loading of a start-up file should only change > * the scene content but keep the blender UI as it is. */ > wm_open_init_load_ui(op, true); > SET_FLAG_FROM_TEST(G.fileflags, !RNA_boolean_get(op->ptr, "load_ui"), G_FILE_NO_UI); > ``` I read from this that it **should** work the way I described it. My description may not have been very clear. ``` bpy.ops.wm.read_homefile() ``` **does** load the homefile UI by default. Setting ``` load_ui=False ``` **still** loads the homefile's UI, although it shouldn't! The issue is that **load_ui** seems to be treated as *True*, even when set to *False*.

This issue was referenced by 95ca3f6536

This issue was referenced by 95ca3f6536f1b756a0c87578f8d9d757ba9cd3a4

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Campbell Barton self-assigned this 2019-12-05 14:45:27 +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
4 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#72169
No description provided.