undo changes the active scene #43424

Closed
opened 2015-01-27 06:04:53 +01:00 by Nahuel Belich · 16 comments

System Information
Win 7x64
Nvidia 460

Blender Version
Broken: from 2.72a official(at least) up to Hash:59e2f91

Short description of error
Working with mutliple scenes, undo some action and the scene its change if it is not the original.
Example,
Three scenes A B C, working in scene C do undo and blender switch automatically to scene A

Exact steps for others to reproduce the error
1-open file undo_escenes_bug.blend
2-go to the window that has the ico spheres
3-move an sphere, to have something to undo
4-Ctrl+z undo
5- you should be watching monkeys on that window too

**System Information** Win 7x64 Nvidia 460 **Blender Version** Broken: from 2.72a official(at least) up to Hash:59e2f91 **Short description of error** Working with mutliple scenes, undo some action and the scene its change if it is not the original. Example, Three scenes A B C, working in scene C do undo and blender switch automatically to scene A **Exact steps for others to reproduce the error** 1-open file [undo_escenes_bug.blend](https://archive.blender.org/developer/F139546/undo_escenes_bug.blend) 2-go to the window that has the ico spheres 3-move an sphere, to have something to undo 4-Ctrl+z undo 5- you should be watching monkeys on that window too
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @NahuelBelich

Added subscriber: @NahuelBelich

Added subscriber: @Sergey

Added subscriber: @Sergey

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel

@JulianEisel, would guess it's a nice puzzle for you? :)

@JulianEisel, would guess it's a nice puzzle for you? :)
Author

just came up with a different situation but same bug,
on the step 1-fille above.
2-create a lamp
3-Ctrl+G to add the lamp to a group
4-F6 to access last operator options
5-change the name of the group
6-Accept the change using the key intro on the keyboard
7-switch to the original scene, just as the undo

just came up with a different situation but same bug, on the step 1-fille above. 2-create a lamp 3-Ctrl+G to add the lamp to a group 4-F6 to access last operator options 5-change the name of the group 6-Accept the change using the key intro on the keyboard 7-switch to the original scene, just as the undo
Member

Added subscriber: @ideasman42

Added subscriber: @ideasman42
Member

This diff should fix the issue:
P195: Possible fix for #43424

diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index fb02af1..5ad66d3 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -236,7 +236,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
                /* we re-use current screen */
                curscreen = CTX_wm_screen(C);
                /* but use new Scene pointer */
-               curscene = bfd->curscene;
+               curscene = curscreen ? curscreen->scene : bfd->curscene;
                if (curscene == NULL) curscene = bfd->main->scene.first;
                /* empty file, we add a scene to make Blender work */
                if (curscene == NULL) curscene = BKE_scene_add(bfd->main, "Empty");

@ideasman42, would like to get your permission on this. Do you see anything against this?

This diff should fix the issue: [P195: Possible fix for #43424](https://archive.blender.org/developer/P195.txt) ``` diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index fb02af1..5ad66d3 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -236,7 +236,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath /* we re-use current screen */ curscreen = CTX_wm_screen(C); /* but use new Scene pointer */ - curscene = bfd->curscene; + curscene = curscreen ? curscreen->scene : bfd->curscene; if (curscene == NULL) curscene = bfd->main->scene.first; /* empty file, we add a scene to make Blender work */ if (curscene == NULL) curscene = BKE_scene_add(bfd->main, "Empty"); ``` @ideasman42, would like to get your permission on this. Do you see anything against this?
Julian Eisel self-assigned this 2015-02-09 18:26:29 +01:00

Is it guaranteed screen uses an updated pointer? For example: remove scene, undo, redo might make some scene pointers invalid.

Is it guaranteed screen uses an updated pointer? For example: remove scene, undo, redo might make some scene pointers invalid.

This issue was referenced by 31e26bb83b

This issue was referenced by 31e26bb83bd0a538c76fd8bb6ebce65027dde94c

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 31e26bb83b.

Closed by commit 31e26bb83b.

@JulianEisel, the problem with this patch (aside from sergey's point which is also a problem) is you don't always wan't the scene to remain unchanged,
If you keep the current scene the user may have performed actions in a different scene and undo operations without being able to view them.

Fix needed to be a bit more involved because undo wasn't using the active window to define bfd->curscene
See comments from commit.

@JulianEisel, the problem with this patch (aside from sergey's point which is also a problem) is you don't *always* wan't the scene to remain unchanged, If you keep the current scene the user may have performed actions in a different scene and undo operations without being able to view them. Fix needed to be a bit more involved because undo wasn't using the active window to define `bfd->curscene` See comments from commit.
Member

Yeah, saw the commit and it totally makes sense (well of course it does ;) ). I got some crashes for the reason @Sergey mentioned and didn't found a good solution, but your patch seems to handle this well.

There is one issue I noticed with the commit: Add new scene, undo -> camera isn't active anymore. Not sure where the connection is...

Yeah, saw the commit and it totally makes sense (well of course it does ;) ). I got some crashes for the reason @Sergey mentioned and didn't found a good solution, but your patch seems to handle this well. There is one issue I noticed with the commit: Add new scene, undo -> camera isn't active anymore. Not sure where the connection is...

@JulianEisel, the issue with the camera is crashing here. Seems my fix wasnt fine... think I know the cause ... investigating.

@JulianEisel, the issue with the camera is crashing here. Seems my fix *wasnt* fine... think I know the cause ... investigating.

Corrected 7f47cd9b17

Corrected 7f47cd9b17
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
5 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#43424
No description provided.