Make Vertex Parent - the constrained object shifts after parenting #59352

Closed
opened 2018-12-14 06:45:33 +01:00 by James Guilford · 15 comments

System Information
win10
GTX 1080

Blender Version
2018-12-13
7d4d9e9dbd

Short description of error
vertex parented object gets offset when returning to object mode

Exact steps for others to reproduce the error

  • With the default cube selected, go into edit mode and move the verts, leaving the origin at 0,0,0
  • Back in object mode, add a sphere, move it to the vertex you want as parent
  • Select the sphere, then the cube, go into edit mode
  • Select a vertex, ctrl-P to make parent
  • Return to object mode and the sphere shifts

Note: This happens when using make vertex parent in either object or edit modes

Oddly, it seems to work as expected when repeating the process a second time (first alt-P to remove parent and then make vertex parent again).

**System Information** win10 GTX 1080 **Blender Version** 2018-12-13 7d4d9e9dbd3 **Short description of error** vertex parented object gets offset when returning to object mode **Exact steps for others to reproduce the error** - With the default cube selected, go into edit mode and move the verts, leaving the origin at 0,0,0 - Back in object mode, add a sphere, move it to the vertex you want as parent - Select the sphere, then the cube, go into edit mode - Select a vertex, ctrl-P to make parent - Return to object mode and the sphere shifts Note: This happens when using make vertex parent in either object or edit modes Oddly, it seems to work as expected when repeating the process a second time (first alt-P to remove parent and then make vertex parent again).
Author

Added subscriber: @fjg3d

Added subscriber: @fjg3d
James Guilford changed title from Make Vertex Parent In Edit Mode, the constrained object shifts when returning to object mode to Make Vertex Parent - the constrained object shifts after parenting 2018-12-14 07:03:04 +01:00
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Philipp Oeser self-assigned this 2018-12-14 09:33:51 +01:00
Member

Can confirm, related to #59332, also checking on this one...

Can confirm, related to #59332, also checking on this one...

Added subscriber: @FrankMees

Added subscriber: @FrankMees

Added subscriber: @yorch

Added subscriber: @yorch
Member

coming back to this (sorry this has been lying around)

first note:

BLI_assert failed: /blender/source/blender/blenkernel/intern/DerivedMesh.c:2076, editbmesh_build_data(), at 'em->ob->id.tag & LIB_TAG_COPIED_ON_WRITE'

1  raise                                               0x7ffff466a53f 
2  abort                                               0x7ffff4654895 
3  editbmesh_build_data      DerivedMesh.c        2082 0x29ad9dd      
4  makeDerivedMesh           DerivedMesh.c        2153 0x29adc1f      
5  vertex_parent_set_exec    object_relations.c   162  0x215108d      
6  wm_operator_invoke        wm_event_system.c    1337 0x1c731fb      
7  wm_operator_call_internal wm_event_system.c    1534 0x1c73881      
8  WM_operator_name_call_ptr wm_event_system.c    1582 0x1c73aa4      
9  ui_apply_but_funcs_after  interface_handlers.c 769  0x1f86738      
10 ui_popup_handler          interface_handlers.c 9885 0x1f9e8f2      
11 wm_handler_ui_call        wm_event_system.c    573  0x1c711d4      
12 wm_handlers_do_intern     wm_event_system.c    2374 0x1c759fb      
13 wm_handlers_do            wm_event_system.c    2607 0x1c76314      
14 wm_event_do_handlers      wm_event_system.c    2997 0x1c775ed      
15 WM_main                   wm.c                 427  0x1c6ca5a      
16 main                      creator.c            521  0x1c67755
coming back to this (sorry this has been lying around) first note: BLI_assert failed: /blender/source/blender/blenkernel/intern/DerivedMesh.c:2076, editbmesh_build_data(), at 'em->ob->id.tag & LIB_TAG_COPIED_ON_WRITE' ``` 1 raise 0x7ffff466a53f 2 abort 0x7ffff4654895 3 editbmesh_build_data DerivedMesh.c 2082 0x29ad9dd 4 makeDerivedMesh DerivedMesh.c 2153 0x29adc1f 5 vertex_parent_set_exec object_relations.c 162 0x215108d 6 wm_operator_invoke wm_event_system.c 1337 0x1c731fb 7 wm_operator_call_internal wm_event_system.c 1534 0x1c73881 8 WM_operator_name_call_ptr wm_event_system.c 1582 0x1c73aa4 9 ui_apply_but_funcs_after interface_handlers.c 769 0x1f86738 10 ui_popup_handler interface_handlers.c 9885 0x1f9e8f2 11 wm_handler_ui_call wm_event_system.c 573 0x1c711d4 12 wm_handlers_do_intern wm_event_system.c 2374 0x1c759fb 13 wm_handlers_do wm_event_system.c 2607 0x1c76314 14 wm_event_do_handlers wm_event_system.c 2997 0x1c775ed 15 WM_main wm.c 427 0x1c6ca5a 16 main creator.c 521 0x1c67755 ```

Added subscriber: @WilliamReynish

Added subscriber: @WilliamReynish

Could be related to #60623 ?

Could be related to #60623 ?
Member

Puh, after almost thinking this is another timesink for me, I think I got it :)

Seems like the offset is actually caused by bc54823376
Problem with the commit is that the evaluated object seems to not have partype, par1, par2, par3 copied from the original

workob->partype = ob->partype;
workob->par1 = ob->par1;
workob->par2 = ob->par2;
workob->par3 = ob->par3;

If we use the original object instead, everything seems to work fine again.
Second part is the assert above, also have something working for that, will upload a diff with everything shortly...

and yes, @WilliamReynish , that also solves #60623 :)

Puh, after almost thinking this is another timesink for me, I think I got it :) Seems like the offset is actually caused by bc54823376 Problem with the commit is that the evaluated object seems to not have `partype`, `par1`, `par2`, `par3` copied from the original ``` workob->partype = ob->partype; workob->par1 = ob->par1; workob->par2 = ob->par2; workob->par3 = ob->par3; ``` If we use the original object instead, everything seems to work fine again. Second part is the assert above, also have something working for that, will upload a diff with everything shortly... and yes, @WilliamReynish , that also solves #60623 :)
Member

Added subscriber: @Sergey

Added subscriber: @Sergey
Member

For the offset, I think D4309 should do it...

regarding the assert, I would like to get @Sergey onboard...

Not exactly sure why dd204cb9f7 was neccessary, doing something like PXXX seems to survive even?:
P906: #59352 experimental



diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index b38da1e124b..8573ecb57ea 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -79,6 +79,7 @@
 #include "BKE_material.h"
 #include "BKE_mball.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_runtime.h"
 #include "BKE_modifier.h"
 #include "BKE_node.h"
 #include "BKE_object.h"
@@ -89,6 +90,7 @@
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -137,22 +139,10 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
 	/* we need 1 to 3 selected vertices */
 
 	if (obedit->type == OB_MESH) {
-		Mesh *me = obedit->data;
-		BMEditMesh *em;
 
-		EDBM_mesh_load(bmain, obedit);
-		EDBM_mesh_make(obedit, scene->toolsettings->selectmode, true);
-
-		DEG_id_tag_update(obedit->data, 0);
-
-		em = me->edit_btmesh;
-
-		EDBM_mesh_normals_update(em);
-		BKE_editmesh_tessface_calc(em);
-
-		/* derivedMesh might be needed for solving parenting,
-		 * so re-create it here */
-		makeDerivedMesh(depsgraph, scene, obedit, em, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX, false);
+		Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit);
+		Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, obedit_eval, CD_MASK_MESH);
+		BMEditMesh *em = me_eval->edit_btmesh;;
 
 		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
 			if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {

Not really sure what I am doing here though...

For the offset, I think [D4309](https://archive.blender.org/developer/D4309) should do it... regarding the assert, I would like to get @Sergey onboard... Not exactly sure why dd204cb9f7 was neccessary, doing something like PXXX seems to survive even?: [P906: #59352 experimental](https://archive.blender.org/developer/P906.txt) ``` diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index b38da1e124b..8573ecb57ea 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -79,6 +79,7 @@ #include "BKE_material.h" #include "BKE_mball.h" #include "BKE_mesh.h" +#include "BKE_mesh_runtime.h" #include "BKE_modifier.h" #include "BKE_node.h" #include "BKE_object.h" @@ -89,6 +90,7 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" +#include "DEG_depsgraph_query.h" #include "WM_api.h" #include "WM_types.h" @@ -137,22 +139,10 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) /* we need 1 to 3 selected vertices */ if (obedit->type == OB_MESH) { - Mesh *me = obedit->data; - BMEditMesh *em; - EDBM_mesh_load(bmain, obedit); - EDBM_mesh_make(obedit, scene->toolsettings->selectmode, true); - - DEG_id_tag_update(obedit->data, 0); - - em = me->edit_btmesh; - - EDBM_mesh_normals_update(em); - BKE_editmesh_tessface_calc(em); - - /* derivedMesh might be needed for solving parenting, - * so re-create it here */ - makeDerivedMesh(depsgraph, scene, obedit, em, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX, false); + Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit); + Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, obedit_eval, CD_MASK_MESH); + BMEditMesh *em = me_eval->edit_btmesh;; BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { ``` Not really sure what I am doing here though...
Philipp Oeser removed their assignment 2019-02-12 11:49:36 +01:00
Sergey Sharybin was assigned by Philipp Oeser 2019-02-12 11:49:36 +01:00
Member

Since D4309 doesnt seem to be the desired solution, I'll step down from this and put on @Sergey 's desk, sorry...

Since [D4309](https://archive.blender.org/developer/D4309) doesnt seem to be the desired solution, I'll step down from this and put on @Sergey 's desk, sorry...
Member

offset should be fixed (2894e75121), that leaves the assert to @Sergey to look at...

offset should be fixed (2894e75121), that leaves the assert to @Sergey to look at...

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Fixed in 15d6521de9. Thanks for the report, closing!

Fixed in 15d6521de9. Thanks for the report, closing!
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
6 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#59352
No description provided.