Maniphest T90087

data copy is ommitting vgroups
Closed, Resolved

Assigned To
Hans Goudey (HooglyBoogly)
Authored By
Em Eckx (masterxeon1001)
Jul 23 2021, 6:31 PM
Tags
  • BF Blender
  • Nodes & Physics
Subscribers
Adrian Rutkowski (rrtk)
Boris (BoraSI)
Em Eckx (masterxeon1001)
Hans Goudey (HooglyBoogly)
Manuel Hofmann (Pille)
Pratik Borhade (PratikPB2123)

Description

System Information
Operating system: Windows 10
Graphics card: 3090 / 3060 / 1050ti

Blender Version
Broken: (Current Builds) (3.0.0 hash: fafd21b14c23, master, 2021-07-22)
Worked: (2.93.1 hash: d6b1d35bf874, master, 2021-07-12)
Caused by rB3b6ee8cee708: Refactor: Move vertex group names to object data

Short description of error

Data copy is deleting vgroup data in 3.0 builds since the 12th.

Exact steps for others to reproduce the error

Running this script deletes the vertex group which began happening in 3.0 builds after the 12th.

import bpy

# all vertices belong to a single group

context = bpy.context
obj = context.object

#get evaluated object
obj_eval = obj.evaluated_get(context.evaluated_depsgraph_get())
print(obj_eval.vertex_groups[:]) #the evaluated object has groups

# and create new mesh from it
new_mesh = bpy.data.meshes.new_from_object(obj_eval)
print(new_mesh.vertices[0].groups[0].weight) # created mesh has groups and weight

# assign new mesh to the object
obj.data = new_mesh
print(obj.vertex_groups[:]) #vertex groups are gone

this example might be more linear

import bpy

context = bpy.context
obj = context.object
print(obj.vertex_groups[:])

# this piece used to preserve vertex groups but it doesn't
obj.data = bpy.data.meshes.new_from_object(obj)
print(obj.vertex_groups[:])

This is what happens in current 3.0 builds.

This is what was happening in 2.93.1LTS and 3.0.0 on the 12th and prior.

Vgroup data was also part of the copy which was expected behavior. The removal of the data is the issue attempting to be outlined.

Revisions and Commits

rB Blender
D12110

Related Objects

Mentioned In
T93896: Vertex group (memory access?) change after applying modifier
Mentioned Here
rB3b6ee8cee708: Refactor: Move vertex group names to object data
rBd6b1d35bf874: Cleanup: Use C++ float3 type, use prefix for return argument
rBfafd21b14c23: Animation: Generic Slider implementation

Event Timeline

Em Eckx (masterxeon1001) created this task.Jul 23 2021, 6:31 PM
Em Eckx (masterxeon1001) updated the task description.Jul 24 2021, 1:54 AM
Em Eckx (masterxeon1001) updated the task description.
Em Eckx (masterxeon1001) updated the task description.
Em Eckx (masterxeon1001) updated the task description.
Em Eckx (masterxeon1001) updated the task description.Jul 24 2021, 1:57 AM
Em Eckx (masterxeon1001) updated the task description.
Pratik Borhade (PratikPB2123) changed the task status from Needs Triage to Confirmed.Jul 24 2021, 3:45 AM
Pratik Borhade (PratikPB2123) added a project: Nodes & Physics.
Pratik Borhade (PratikPB2123) added a subscriber: Pratik Borhade (PratikPB2123).

Can confirm. Possibly the culprit commit is rB3b6ee8cee7080af200e25e944fe30d310240e138 but will double check.

Hans Goudey (HooglyBoogly) added a subscriber: Hans Goudey (HooglyBoogly).Jul 24 2021, 3:46 AM

It looks like this function implements mesh copying from scratch.
I don't have time to test right now, but a quick fix is probably adding these lines to BKE_mesh_nomain_to_mesh:

BKE_defgroup_copy_list(&mesh_dst->vertex_group_names, &mesh_src->vertex_group_names);
mesh_dst->vertex_group_active_index = mesh_src->vertex_group_active_index;
Pratik Borhade (PratikPB2123) triaged this task as High priority.Jul 24 2021, 6:49 AM

Caused by rB3b6ee8cee708: Refactor: Move vertex group names to object data. Recent regression so marking this a high priority issue.

@Hans Goudey (HooglyBoogly) , sorry did not check your message. Will let you know after testing the change.

Pratik Borhade (PratikPB2123) updated the task description.Jul 24 2021, 6:51 AM
Manuel Hofmann (Pille) added a subscriber: Manuel Hofmann (Pille).Jul 30 2021, 12:26 AM
Em Eckx (masterxeon1001) added a comment.Jul 31 2021, 4:25 PM

The issue persists in current builds.

Hans Goudey (HooglyBoogly) claimed this task.Aug 1 2021, 1:52 AM

Right, it hasn't been fixed yet. I will get to it tomorrow or Monday.

Adrian Rutkowski (rrtk) added a subscriber: Adrian Rutkowski (rrtk).Aug 2 2021, 10:35 PM
Boris (BoraSI) added a subscriber: Boris (BoraSI).Aug 4 2021, 10:01 PM

I have an issue too, projects that saved in 3.0 will lose their vertex group data if you try to open it in 2.93.X

Hans Goudey (HooglyBoogly) closed this task as Resolved by committing rB263fa406cd2b: Fix T90087: Assigning object data doesn't copy vertex groups.Aug 6 2021, 1:27 AM
Hans Goudey (HooglyBoogly) added a commit: rB263fa406cd2b: Fix T90087: Assigning object data doesn't copy vertex groups.