Maniphest T59352

Make Vertex Parent - the constrained object shifts after parenting
Closed, Resolved

Assigned To
Sergey Sharybin (sergey)
Authored By
James Guilford (fjg3d)
Dec 14 2018, 6:45 AM
Tags
  • BF Blender
Subscribers
Frank Mees (fmees)
James Guilford (fjg3d)
Jorge Vásquez Pérez (yorch)
Philipp Oeser (lichtwerk)
Sergey Sharybin (sergey)
William Reynish (billreynish)

Description

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).

Revisions and Commits

Related Objects

Mentioned In
rB2894e75121d7: Fix parenting objects to bones/vertices causes offset
D4309: Fix parenting objects to bones/vertices causes offset
T60622: weird behavior of vert triangle child
T59332: Vertex Parenting parents to the wrong vertex
Mentioned Here
rB15d6521de94c: Fix assert on vertex parent
rB2894e75121d7: Fix parenting objects to bones/vertices causes offset
D4309: Fix parenting objects to bones/vertices causes offset
P906 T59352 experimental
rBdd204cb9f73a: Fix for add hook/vertex parent for meshes
rBbc5482337669: Fix T55244: Parenting object(s) to curve crashes blender
T60623: Parenting objects to bones causes offset
T59332: Vertex Parenting parents to the wrong vertex
rB7d4d9e9dbd36: Cleanup: style

Event Timeline

James Guilford (fjg3d) created this task.Dec 14 2018, 6:45 AM
James Guilford (fjg3d) updated the task description.Dec 14 2018, 6:53 AM
James Guilford (fjg3d) updated the task description.
James Guilford (fjg3d) updated the task description.Dec 14 2018, 7:00 AM
James Guilford (fjg3d) renamed this task 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.Dec 14 2018, 7:03 AM
James Guilford (fjg3d) updated the task description.
Philipp Oeser (lichtwerk) claimed this task.Dec 14 2018, 9:33 AM
Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 50.
Philipp Oeser (lichtwerk) added a subscriber: Philipp Oeser (lichtwerk).

Can confirm, related to T59332, also checking on this one...

Brecht Van Lommel (brecht) edited projects, added BF Blender; removed BF Blender: 2.8.Dec 17 2018, 11:45 AM
Frank Mees (fmees) added a subscriber: Frank Mees (fmees).Dec 17 2018, 4:29 PM
Jorge Vásquez Pérez (yorch) added a subscriber: Jorge Vásquez Pérez (yorch).Dec 18 2018, 8:20 PM
Philipp Oeser (lichtwerk) added a comment.Feb 4 2019, 1:51 PM

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
William Reynish (billreynish) added a subscriber: William Reynish (billreynish).Feb 4 2019, 2:02 PM

Could be related to T60623 ?

Philipp Oeser (lichtwerk) added a comment.Feb 5 2019, 3:29 PM

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

Seems like the offset is actually caused by rBbc5482337669
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, @William Reynish (billreynish) , that also solves T60623 :)

Philipp Oeser (lichtwerk) added a subscriber: Sergey Sharybin (sergey).Feb 5 2019, 4:07 PM

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

regarding the assert, I would like to get @Sergey Sharybin (sergey) onboard...

Not exactly sure why rBdd204cb9f73a was neccessary, doing something like PXXX seems to survive even?:

1
2
3diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
4index b38da1e124b..8573ecb57ea 100644
5--- a/source/blender/editors/object/object_relations.c
6+++ b/source/blender/editors/object/object_relations.c
7@@ -79,6 +79,7 @@
8 #include "BKE_material.h"
9 #include "BKE_mball.h"
10 #include "BKE_mesh.h"
11+#include "BKE_mesh_runtime.h"
12 #include "BKE_modifier.h"
13 #include "BKE_node.h"
14 #include "BKE_object.h"
15@@ -89,6 +90,7 @@
16
17 #include "DEG_depsgraph.h"
18 #include "DEG_depsgraph_build.h"
19+#include "DEG_depsgraph_query.h"
20
21 #include "WM_api.h"
22 #include "WM_types.h"
23@@ -137,22 +139,10 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
24 /* we need 1 to 3 selected vertices */
25
26 if (obedit->type == OB_MESH) {
27- Mesh *me = obedit->data;
28- BMEditMesh *em;
29
30- EDBM_mesh_load(bmain, obedit);
31- EDBM_mesh_make(obedit, scene->toolsettings->selectmode, true);
32-
33- DEG_id_tag_update(obedit->data, 0);
34-
35- em = me->edit_btmesh;
36-
37- EDBM_mesh_normals_update(em);
38- BKE_editmesh_tessface_calc(em);
39-
40- /* derivedMesh might be needed for solving parenting,
41- * so re-create it here */
42- makeDerivedMesh(depsgraph, scene, obedit, em, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX, false);
43+ Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit);
44+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, obedit_eval, CD_MASK_MESH);
45+ BMEditMesh *em = me_eval->edit_btmesh;;
46
47 BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
48 if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {

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

Philipp Oeser (lichtwerk) reassigned this task from Philipp Oeser (lichtwerk) to Sergey Sharybin (sergey).Feb 12 2019, 11:49 AM

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

Philipp Oeser (lichtwerk) mentioned this in rB2894e75121d7: Fix parenting objects to bones/vertices causes offset.Mar 5 2019, 1:16 PM
Philipp Oeser (lichtwerk) added a comment.Mar 5 2019, 1:39 PM

offset should be fixed (rB2894e75121d7), that leaves the assert to @Sergey Sharybin (sergey) to look at...

Sergey Sharybin (sergey) changed the task status from Unknown Status to Resolved.Mar 20 2019, 5:20 PM

Fixed in rB15d6521de94. Thanks for the report, closing!