Outliner crash when selecting object being in armature editmode [modeswitch] #63066

Closed
opened 2019-03-28 23:42:37 +01:00 by Cliff King · 11 comments

{F6896675}System Information
Operating system: Windows-10-10.0.17134 64 Bits
Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 419.67

Blender Version
Broken: version: 2.80 (sub 52), branch: master, commit date: 2019-03-28 21:08, hash: 42dd888b98
Worked: (optional)

Short description of error
Blender 2.8 beta abruptly shuts down (ie. crashes) if you open attached model and click on pencil-mesh in Outliner!

{[F6896675](https://archive.blender.org/developer/F6896675/pencil-mesh.blend)}**System Information** Operating system: Windows-10-10.0.17134 64 Bits Graphics card: GeForce GTX 1070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 419.67 **Blender Version** Broken: version: 2.80 (sub 52), branch: master, commit date: 2019-03-28 21:08, hash: `42dd888b98` Worked: (optional) **Short description of error** Blender 2.8 beta abruptly shuts down (ie. crashes) if you open attached model and click on pencil-mesh in Outliner!
Author

Added subscriber: @Bartwynn

Added subscriber: @Bartwynn
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Confirmed, checking...

Confirmed, checking...
Member

Happens when you are in armature editmode (not in posemode) and click on another object (not object data).
This will switch to objectmode (thus editbones are not valid anymore).

  • works fine if you are in posemode [and switch to objectmode from there]
  • works fine if you are in editmode and select the pencil mesh datablock [still in editmode then]

got a bandaid fix (since in this case we can check for obedit later):
P944: T63066_snippet



diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 5ace2c291e0..faca9668db3 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -691,13 +691,16 @@ static void tree_element_active_ebone__sel(bContext *C, Object *obedit, bArmatur
 static eOLDrawState tree_element_active_ebone(
         bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive)
 {
-	Object *obedit = CTX_data_edit_object(C);
-	BLI_assert(obedit != NULL);
-	bArmature *arm = obedit->data;
 	EditBone *ebone = te->directdata;
 	eOLDrawState status = OL_DRAWSEL_NONE;
 
 	if (set != OL_SETSEL_NONE) {
+		/* obedit can be NULL if we just selected another object
+		 * (thus having switched to objecmode) */
+		Object *obedit = CTX_data_edit_object(C);
+		BLI_assert(obedit != NULL);
+		bArmature *arm = obedit->data;
+
 		if (set == OL_SETSEL_NORMAL) {
 			if (!(ebone->flag & BONE_HIDDEN_A)) {
 				ED_armature_edit_deselect_all(obedit);

But there are other glitches as well (after selecting the Pencil):

  • Armature goes completely invisible [will have to check why that is]
  • Bone still draws as active (with a circle around the icon) which should only be the the case if the Armature is really

Will check the two "works fine" cases mentioned above (and will also check if we rebuild the tree on mode changes...)

Happens when you are in armature editmode (not in posemode) and click on another object (not object data). This will switch to objectmode (thus editbones are not valid anymore). - works fine if you are in posemode [and switch to objectmode from there] - works fine if you are in editmode and select the pencil mesh datablock [still in editmode then] got a bandaid fix (since in this case we can check for obedit later): [P944: T63066_snippet](https://archive.blender.org/developer/P944.txt) ``` diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 5ace2c291e0..faca9668db3 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -691,13 +691,16 @@ static void tree_element_active_ebone__sel(bContext *C, Object *obedit, bArmatur static eOLDrawState tree_element_active_ebone( bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive) { - Object *obedit = CTX_data_edit_object(C); - BLI_assert(obedit != NULL); - bArmature *arm = obedit->data; EditBone *ebone = te->directdata; eOLDrawState status = OL_DRAWSEL_NONE; if (set != OL_SETSEL_NONE) { + /* obedit can be NULL if we just selected another object + * (thus having switched to objecmode) */ + Object *obedit = CTX_data_edit_object(C); + BLI_assert(obedit != NULL); + bArmature *arm = obedit->data; + if (set == OL_SETSEL_NORMAL) { if (!(ebone->flag & BONE_HIDDEN_A)) { ED_armature_edit_deselect_all(obedit); ``` But there are other glitches as well (after selecting the Pencil): - Armature goes completely invisible [will have to check why that is] - Bone still draws as active (with a circle around the icon) which should only be the the case if the Armature is really Will check the two "works fine" cases mentioned above (and will also check if we rebuild the tree on mode changes...)
Philipp Oeser changed title from Blender 2.8 Beta Crashes to Outliner crash when selecting object being in armature editmode [modeswitch] 2019-03-29 11:38:38 +01:00
Member

Hm, just found out about a01244cade, #55246 (needs another round of thinking...)

Hm, just found out about a01244cade, #55246 (needs another round of thinking...)
Campbell Barton was assigned by Philipp Oeser 2019-03-29 15:04:27 +01:00
Member

Added subscriber: @ideasman42

Added subscriber: @ideasman42
Member

Still confused actually.
There is also the case where tree_element_active_ebone (where the above assert happens) acts up in case of multi-armature select.
It just feels weird to use CTX_data_edit_object(C) here?
This will give us the active edit object, but in the file below this will be the same armature for all three selected armatures [which are all different].
This will lead to erratic selection behaviour, see:

#63066.blend

try slecting different bones in different armatures from the outliner here, only the active ["03"] armature will select/deselect correctly, if you are selecting bones in "01" or "02" selection will act up [bones not being deselected etc]

I had another go at this and tried to not rely on CTX_data_edit_object(C), but instead use the armature directly from tselem... getting the corresponding object is a bit weak, but...
This will prevent mentioned crash and also improves upon selection from the outliner (I've also made sure all bones from other armatures are deselected, matching selection in 3dview...)
P945: T63066_snippet_2



diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 5ace2c291e0..0fb2a3f9f87 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -23,6 +23,8 @@
 
 #include <stdlib.h>
 
+#include "MEM_guardedalloc.h"
+
 #include "DNA_armature_types.h"
 #include "DNA_collection_types.h"
 #include "DNA_light_types.h"
@@ -689,18 +691,36 @@ static void tree_element_active_ebone__sel(bContext *C, Object *obedit, bArmatur
 	WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, obedit);
 }
 static eOLDrawState tree_element_active_ebone(
-        bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive)
+        bContext *C, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive)
 {
-	Object *obedit = CTX_data_edit_object(C);
-	BLI_assert(obedit != NULL);
-	bArmature *arm = obedit->data;
+	bArmature *arm = (bArmature *)tselem->id;
+	ViewLayer *view_layer = CTX_data_view_layer(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	uint objects_len = 0;
+	Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, &objects_len);
+	Object *obedit = NULL;
+	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+		obedit = objects[ob_index];
+		if (obedit->data == arm) {
+			break;
+		}
+	}
+	MEM_freeN(objects);
+	if (obedit == NULL) {
+		printf("warning, still no obedit...\n");
+	};
+
 	EditBone *ebone = te->directdata;
 	eOLDrawState status = OL_DRAWSEL_NONE;
 
 	if (set != OL_SETSEL_NONE) {
 		if (set == OL_SETSEL_NORMAL) {
 			if (!(ebone->flag & BONE_HIDDEN_A)) {
-				ED_armature_edit_deselect_all(obedit);
+				uint bases_len = 0;
+				Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(view_layer, v3d, &bases_len);
+				ED_armature_edit_deselect_all_multi_ex(bases, bases_len);
+				MEM_freeN(bases);
+
 				tree_element_active_ebone__sel(C, obedit, arm, ebone, true);
 				status = OL_DRAWSEL_NORMAL;
 			}

I think this one is actually for @ideasman42 to check on?

Still confused actually. There is also the case where `tree_element_active_ebone` (where the above assert happens) acts up in case of multi-armature select. It just feels weird to use CTX_data_edit_object(C) here? This will give us the active edit object, but in the file below this will be the same armature for all three selected armatures [which are all different]. This will lead to erratic selection behaviour, see: [#63066.blend](https://archive.blender.org/developer/F6898537/T63066.blend) try slecting different bones in different armatures from the outliner here, only the active ["03"] armature will select/deselect correctly, if you are selecting bones in "01" or "02" selection will act up [bones not being deselected etc] I had another go at this and tried to not rely on CTX_data_edit_object(C), but instead use the armature directly from tselem... getting the corresponding object is a bit weak, but... This will prevent mentioned crash and also improves upon selection from the outliner (I've also made sure all bones from other armatures are deselected, matching selection in 3dview...) [P945: T63066_snippet_2](https://archive.blender.org/developer/P945.txt) ``` diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 5ace2c291e0..0fb2a3f9f87 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -23,6 +23,8 @@ #include <stdlib.h> +#include "MEM_guardedalloc.h" + #include "DNA_armature_types.h" #include "DNA_collection_types.h" #include "DNA_light_types.h" @@ -689,18 +691,36 @@ static void tree_element_active_ebone__sel(bContext *C, Object *obedit, bArmatur WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, obedit); } static eOLDrawState tree_element_active_ebone( - bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive) + bContext *C, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set, bool recursive) { - Object *obedit = CTX_data_edit_object(C); - BLI_assert(obedit != NULL); - bArmature *arm = obedit->data; + bArmature *arm = (bArmature *)tselem->id; + ViewLayer *view_layer = CTX_data_view_layer(C); + View3D *v3d = CTX_wm_view3d(C); + uint objects_len = 0; + Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, &objects_len); + Object *obedit = NULL; + for (uint ob_index = 0; ob_index < objects_len; ob_index++) { + obedit = objects[ob_index]; + if (obedit->data == arm) { + break; + } + } + MEM_freeN(objects); + if (obedit == NULL) { + printf("warning, still no obedit...\n"); + }; + EditBone *ebone = te->directdata; eOLDrawState status = OL_DRAWSEL_NONE; if (set != OL_SETSEL_NONE) { if (set == OL_SETSEL_NORMAL) { if (!(ebone->flag & BONE_HIDDEN_A)) { - ED_armature_edit_deselect_all(obedit); + uint bases_len = 0; + Base **bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(view_layer, v3d, &bases_len); + ED_armature_edit_deselect_all_multi_ex(bases, bases_len); + MEM_freeN(bases); + tree_element_active_ebone__sel(C, obedit, arm, ebone, true); status = OL_DRAWSEL_NORMAL; } ``` I think this one is actually for @ideasman42 to check on?

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Campbell Barton was unassigned by Dalai Felinto 2019-04-09 14:56:59 +02:00
Dalai Felinto self-assigned this 2019-04-09 14:56:59 +02:00

I fixed related issues, let's me take a look.

I fixed related issues, let's me take a look.

This issue was referenced by e6151bc4c1

This issue was referenced by e6151bc4c1f218d506ecc4b577d77e1f86955277

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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#63066
No description provided.