vertex group re-appears, after it was previously removed via the API #101804

Open
opened 2022-10-13 17:56:59 +02:00 by MACHIN3 · 8 comments

System Information
Operating system: Linux-4.15.0-175-generic-x86_64-with-glibc2.27 64 Bits
Graphics card: NVIDIA GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.103.01

Blender Version
Broken: version: 3.3.1, branch: master, commit date: 2022-10-04 18:35, hash: b292cfe5a9
Worked: (newest version of Blender that worked as expected)

Short description of error
I have an object with 2 bevel modifiers. Each one uses it's own vertex group to control the beveling.
I have a script that applies the first mod in the stack, and then removes its vertex group as well.
If you run this script 2 times, both mods, and both vertex groups should be removed.
Curiously, while the modifiers are both removed successfully, the first vgroup will reappear after the second run of the script, so after the 2nd mod and vgroup have been removed.

To workaround this, you can toggle into edit mode and back into object mode at the beginning of the script.

Possibly related to the commits mentioned here: https://developer.blender.org/T93896 ?

video demo
bevel_vgroups.blend

Exact steps for others to reproduce the error

  • open the attached blend file
  • verify how each bevel mod is related to a vertex group sharing its name
  • run the script two times, and notice how the first vgroup reappears at the end
**System Information** Operating system: Linux-4.15.0-175-generic-x86_64-with-glibc2.27 64 Bits Graphics card: NVIDIA GeForce GTX 1050/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.103.01 **Blender Version** Broken: version: 3.3.1, branch: master, commit date: 2022-10-04 18:35, hash: `b292cfe5a9` Worked: (newest version of Blender that worked as expected) **Short description of error** I have an object with 2 bevel modifiers. Each one uses it's own vertex group to control the beveling. I have a script that applies the first mod in the stack, and then removes its vertex group as well. If you run this script 2 times, both mods, and both vertex groups should be removed. Curiously, while the modifiers are both removed successfully, the first vgroup will reappear after the second run of the script, so after the 2nd mod and vgroup have been removed. To workaround this, you can toggle into edit mode and back into object mode at the beginning of the script. Possibly related to the commits mentioned here: https://developer.blender.org/T93896 ? [video demo ](https://youtu.be/BNwfPiyczdg) [bevel_vgroups.blend](https://archive.blender.org/developer/F13673807/bevel_vgroups.blend) **Exact steps for others to reproduce the error** * open the attached blend file * verify how each bevel mod is related to a vertex group sharing its name * run the script two times, and notice how the first vgroup reappears at the end
Author

Added subscriber: @MACHIN3

Added subscriber: @MACHIN3

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

I was able to confirm the problem and further simplify the file and script to just these lines:

import bpy

obj = bpy.context.active_object
obj.vertex_groups.remove(obj.vertex_groups.get("A"))
bpy.ops.object.modifier_apply(modifier="EdgeBevel")

vgroup_remove_fail.blend

Analyzing the code I could see that the Vertex Group is removed from ob->data but the Vertex Groups from ob_eval->runtime->data_orig are kept and copied when applying modifiers.

I'm not sure why ob->data is different from ob_eval->runtime->data_orig, but it doesn't feel right to keep the vertex group and restore when it's not even used anymore.

So I'm confirming it as a bug.

I was able to confirm the problem and further simplify the file and script to just these lines: ``` import bpy obj = bpy.context.active_object obj.vertex_groups.remove(obj.vertex_groups.get("A")) bpy.ops.object.modifier_apply(modifier="EdgeBevel") ``` [vgroup_remove_fail.blend](https://archive.blender.org/developer/F13674845/vgroup_remove_fail.blend) Analyzing the code I could see that the Vertex Group is removed from `ob->data` but the Vertex Groups from `ob_eval->runtime->data_orig` are kept and copied when applying modifiers. I'm not sure why `ob->data` is different from `ob_eval->runtime->data_orig`, but it doesn't feel right to keep the vertex group and restore when it's not even used anymore. So I'm confirming it as a bug.
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

Not sure, but I'm guessing that removing a vertex group doesn't properly tag the object for reevaluation. Then the vertex group would still be on the evaluated mesh when it is applied.
Edit: Looked at this a bit more, my guess was wrong unfortunately.

Not sure, but I'm guessing that removing a vertex group doesn't properly tag the object for reevaluation. Then the vertex group would still be on the evaluated mesh when it is applied. Edit: Looked at this a bit more, my guess was wrong unfortunately.
Author

Any update on this?

Any update on this?
Author

In #101804#1432176, @mano-wii wrote:
I was able to confirm the problem and further simplify the file and script to just these lines:

import bpy

obj = bpy.context.active_object
obj.vertex_groups.remove(obj.vertex_groups.get("A"))
bpy.ops.object.modifier_apply(modifier="EdgeBevel")

vgroup_remove_fail.blend

Analyzing the code I could see that the Vertex Group is removed from ob->data but the Vertex Groups from ob_eval->runtime->data_orig are kept and copied when applying modifiers.

I'm not sure why ob->data is different from ob_eval->runtime->data_orig, but it doesn't feel right to keep the vertex group and restore when it's not even used anymore.

So I'm confirming it as a bug.

Note that in a real world example, you would definitely want to apply the mod first, and then remove the vertex group afterwards, as otherwise you would get a very different result.
I'm not sure how that affects the bug you exposed, but I wanted to mention it, in case it becomes a different issue then.

> In #101804#1432176, @mano-wii wrote: > I was able to confirm the problem and further simplify the file and script to just these lines: > > ``` > import bpy > > obj = bpy.context.active_object > obj.vertex_groups.remove(obj.vertex_groups.get("A")) > bpy.ops.object.modifier_apply(modifier="EdgeBevel") > ``` > [vgroup_remove_fail.blend](https://archive.blender.org/developer/F13674845/vgroup_remove_fail.blend) > > Analyzing the code I could see that the Vertex Group is removed from `ob->data` but the Vertex Groups from `ob_eval->runtime->data_orig` are kept and copied when applying modifiers. > > I'm not sure why `ob->data` is different from `ob_eval->runtime->data_orig`, but it doesn't feel right to keep the vertex group and restore when it's not even used anymore. > > So I'm confirming it as a bug. Note that in a real world example, you would definitely want to apply the mod first, and then remove the vertex group afterwards, as otherwise you would get a very different result. I'm not sure how that affects the bug you exposed, but I wanted to mention it, in case it becomes a different issue then.
Philipp Oeser removed the
Interest
Modeling
label 2023-02-09 15:27:11 +01:00
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
3 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#101804
No description provided.