SKkeeper icon indicating copy to clipboard operation
SKkeeper copied to clipboard

error when applying mirror modifier

Open Rorozilla opened this issue 2 years ago • 6 comments

I have narrowed down this issue with shape keys that may be affecting the symmetry line, However there is no reliable way to fix a shape key once the error starts showing up, specifically on complex meshes. Removing the problem shape keys from the object will allow the plugin to function properly.

Python: Traceback (most recent call last):
  File "C:\Users\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\SKkeeper\__init__.py", line 433, in execute
    receiver.data.shape_keys.key_blocks[i].name = sk_names[i]
IndexError: bpy_prop_collection[index]: index 6 out of range, size 6

The result of this error will create two objects, one with the prefix shapekey! and one named sk_receiver

image

To reproduce: 1- create a sphere. 2- cut the sphere in half on the Y axis 3- add a mirror modifier using the Y axis 4- soft select and drag any vertices in a way that tampers with the symmetry line. 5- apply all modifiers (keep shape keys) 6- notice the error message and additional mesh in the scene. 7- on a simple mesh, it is possible to salvage the shape key by re-positioning all the vertices on the symmetry line. However complex meshes are not as straightforward and I have had no luck methodically trying to fix mine.

Any leads on how to clean up my mesh without losing the shape keys would be very appreciated!
Cheers.

Rorozilla avatar Mar 02 '23 03:03 Rorozilla

It seems to be the image By any chance you were using the merge funtion of the mirror modifier?

JordanRO2 avatar Apr 23 '23 00:04 JordanRO2

Can confirm that not merging can resolve the issue - but it's not a solution if it means your mesh will have tears down the center line

@smokejohn are there any plans to fix this? This has been an issue for as long as I've used the SKkeeper - drives me fucking nuts

JWBWork avatar May 07 '23 21:05 JWBWork

I've found a workaround for this!

Uncheck merge, use the add-on, then in edit mode you can use Mesh > Clean Up > Merge by Distance. That will merge overlapping vertices

@smokejohn I managed to implement this via a script - possibly could be implemented for Mirror modifiers?

def remove_duplicates():
    target = get_target_object()
    target.select_set(True)
    bpy.ops.object.editmode_toggle()
    bpy.ops.mesh.select_all(action='SELECT')
    bpy.ops.mesh.remove_doubles()
    bpy.ops.object.editmode_toggle()

JWBWork avatar May 08 '23 01:05 JWBWork

Hi, The addon will have problems if the vertex numbers get changed when applying modifiers. Blender can't figure out which weights of the skin and blendshapes go to which vertex number if that happens.

Now if your mirror modifier changes the amount of vertices in your model, because you don't have your vertices aligned within the merging threshold of your mirror modifier or merge vertices by mistake because your threshold is too large that is not a problem of the plugin but just shoddy work on your part.

You should have removed doubles and checked your mirror modifiers not merging vertices you don't want them to merge BEFORE you even started to skin your model to a rig or created blendshapes. That is just basic 3D modelling workflow best practise and not a problem with the addon.

Granted the code shouldn't crash, but supply an error message. But in the end i think this is a user error not a problem with the script itself.

smokejohn avatar Nov 21 '23 13:11 smokejohn

Hi, The addon will have problems if the vertex numbers get changed when applying modifiers. Blender can't figure out which weights of the skin and blendshapes go to which vertex number if that happens.

Now if your mirror modifier changes the amount of vertices in your model, because you don't have your vertices aligned within the merging threshold of your mirror modifier or merge vertices by mistake because your threshold is too large that is not a problem of the plugin but just shoddy work on your part.

You should have removed doubles and checked your mirror modifiers not merging vertices you don't want them to merge BEFORE you even started to skin your model to a rig or created blendshapes. That is just basic 3D modelling workflow best practise and not a problem with the addon.

Granted the code shouldn't crash, but supply an error message. But in the end i think this is a user error not a problem with the script itself.

This isn't the case because I used the addon on a version of my model that it previously worked on and it suddenly started giving the same error

Sam2443 avatar Nov 25 '23 13:11 Sam2443

That is highly unlikely. Something has to have changed in between those 2 calls to the addon. Same input will always lead to the same output.

smokejohn avatar Nov 25 '23 17:11 smokejohn

no update / duplicate of #10

smokejohn avatar Dec 23 '24 18:12 smokejohn