Hooks no longer working if some parts of the mesh are removed #48290

Closed
opened 2016-04-27 15:20:55 +02:00 by Dalai Felinto · 13 comments

System Information
Windows

Blender Version
Broken: 2.77

Short description of error
Hooks no longer work properly if I remove vertices created before the hooked vertices

Exact steps to reproduce the error
Open: hook-remove.blend

  • enter edit mode
  • delete selected vertices
  • leave edit mode
  • :(

How to reproduce from scratch
(aka, how to re-create the sample file)

  • open default blender scene
  • edit cube and add a new cube in the same mesh
  • select a few vertices of the new cube and add a hook (Ctrl+H)
  • move the empty driven the vertices (in object mode, naturally)
  • now reproduce the "Exact steps to reproduce the error" instructions
**System Information** Windows **Blender Version** Broken: 2.77 **Short description of error** Hooks no longer work properly if I remove vertices created before the hooked vertices **Exact steps to reproduce the error** Open: [hook-remove.blend](https://archive.blender.org/developer/F307279/hook-remove.blend) * enter edit mode * delete selected vertices * leave edit mode * :( **How to reproduce from scratch** (aka, how to re-create the sample file) * open default blender scene * edit cube and add a new cube in the same mesh * select a few vertices of the new cube and add a hook (Ctrl+H) * move the empty driven the vertices (in object mode, naturally) * now reproduce the "Exact steps to reproduce the error" instructions
Author
Owner

Changed status to: 'Open'

Changed status to: 'Open'
Author
Owner

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

My findings after a quick glance at the code (will investigate more, too):
The hook modifier stores vertex indices from the original mesh to determine what to effect, so when these change (which they do when some vertices are deleted), the modifier will act on different vertices :/
But here is a nice workaround [that is somewhat hidden to be honest]:
(1) assign the desired hook-vertices to a vertexgroup
(2) deselect all vertices
(3) select the vertexgroup created in (1), making it active
(4) add the hook

the hook modifier will now have a vertex group already assigned (its basically a shortcut for a hook on all vertices limited to the vertexgroup)
this way you can delete vertices as you wish and the hook stays intact :)
not sure if this helps -- will also look more into the modifier to see if the original problem can be solved better...

My findings after a quick glance at the code (will investigate more, too): The hook modifier stores vertex *indices* from the original mesh to determine what to effect, so when these change (which they do when some vertices are deleted), the modifier will act on different vertices :/ But here is a nice workaround [that is somewhat hidden to be honest]: (1) assign the desired hook-vertices to a vertexgroup (2) **deselect** all vertices (3) select the vertexgroup created in (1), making it active (4) add the hook the hook modifier will now have a vertex group already assigned (its basically a shortcut for a hook on _all_ vertices limited to the vertexgroup) this way you can delete vertices as you wish and the hook stays intact :) not sure if this helps -- will also look more into the modifier to see if the original problem can be solved better...
Author
Owner

That's an interering workaround, and it seems to work fine. Thanks @lichtwerk

That's an interering workaround, and it seems to work fine. Thanks @lichtwerk

Added subscriber: @gwentiv

Added subscriber: @gwentiv

Confirmed on 2.77a linux. It seems to work exactly like Philipp said.
I wonder what the solution is (I mean, to avoid using Vgroups).
I suppose each vertex has an ID (I guess it is the index used by the Build modifier for instance...)

So either the vertices need to be re-ordered so that the indices of the vertices concerned by the hook bindings are the same. But that won't work if you suppress more vertices whose indices are below the ones tied to a hook than you have vertices free ABOVE that index...

So the hooks tied to a particular mesh must be updated with new, updated sets of indices. Is that a difficult task ?

Confirmed on 2.77a linux. It seems to work exactly like Philipp said. I wonder what the solution is (I mean, to avoid using Vgroups). I suppose each vertex has an ID (I guess it is the index used by the Build modifier for instance...) So either the vertices need to be re-ordered so that the indices of the vertices concerned by the hook bindings are the same. But that won't work if you suppress more vertices whose indices are below the ones tied to a hook than you have vertices free ABOVE that index... So the hooks tied to a particular mesh must be updated with new, updated sets of indices. Is that a difficult task ?
Member

I could image it working on a pointer list instead of a index list, but that would need some further investigation (will do when time permits -- propably not before weekend though...)

I could image it working on a pointer list instead of a index list, but that would need some further investigation (will do when time permits -- propably not before weekend though...)

Added subscriber: @ideasman42

Added subscriber: @ideasman42

This can be supported by ensuring CD_SHAPE_KEYINDEX is added when there are hooks or vertex parents present.

Looked into this but would rather not do this in BM_mesh_bm_from_me which runs from modifiers.
This could run from ED_object_editmode_enter instead.

This can be supported by ensuring `CD_SHAPE_KEYINDEX` is added when there are hooks or vertex parents present. Looked into this but would rather not do this in `BM_mesh_bm_from_me` which runs from modifiers. This could run from `ED_object_editmode_enter` instead.
Campbell Barton was assigned by Bastien Montagne 2016-04-29 11:50:31 +02:00

Added subscriber: @mont29

Added subscriber: @mont29

This issue was referenced by 6d0cae56e8

This issue was referenced by 6d0cae56e84306ed64a51005c4fb1811a40822b7

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
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#48290
No description provided.