I am trying to make a modifier that messes with vertex groups. To do what I am thinking about I have to add new v groups. I tried a view thinks but if it is compiling I always get one of two results.
1.) Everything seams fine but the modifier doesn’t seam to have created the v group I thought it should.
2.) If I try to apply the modifier it just states “Modifier returned error, skipping apply” but I am unable to get more information about it.
So now my a view questions to that topic:
-
How is it Intendet to add, remove, edit vgroups on meshes in C and is there documentation on that topic other then searching through rnd/dna types.
-
How to get more information about that what kind of error that Modifier returned and why?
-
Is there documentation for modifier related types and so on other than source code comments.?
-
Is something wrong with MOD_vertex_regroup.c? I mean yeah obviously but is that you can see at one glimpse that I missed?
here is MOD_vertex_regroup.c
#include “BKE_modifier.h”
#include “DNA_mesh_types.h”
#include “BKE_object_deform.h”
static Mesh *vertex_regroup_applyModifier( struct ModifierData *md,
const struct ModifierEvalContext *ctx,
struct Mesh *mesh
)
{
Mesh *result = mesh;
result = BKE_object_defgroup_add_name(mesh, “myName”);
//DEG_relations_tag_update(mesh);
//WM_main_add_notifier(NC_OBJECT | ND_DRAW, mesh);
return result;
}
ModifierTypeInfo modifierType_Vertex_regroup = {
/* name / “Vertex regroup”,
/ structName / “VertexRegroupModifierData”,
/ structSize / sizeof(VertexRegroupModifierData),
/ type / eModifierTypeType_None,
/ flags */ eModifierTypeFlag_AcceptsMesh,
/* copyData */ NULL,
/* deformVerts */ NULL,
/* deformMatrices */ NULL,
/* deformVertsEM */ NULL,
/* deformMatrices EM */ NULL,
/* applyModifier */ vertex_regroup_applyModifier,
/* initData */ NULL,
/* requiredDataMask */ NULL,
/* freeData */ NULL,
/* isDisable */ NULL,
/* updateDepsgraph */ NULL,
/* dependsOnTime */ NULL,
/* dependsOnNormals */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ NULL,
/* foreachTextLink */ NULL,
/* freeRuntimeData */ NULL,
};
ok seams like that just does not work since a modifier is not allowed to modify that kind of data 
I would look at the Vertex Weight Edit/Mix modifiers for reference. They are able to edit existing vgroups so it should be possible.
I am don’t think you can to add or remove vgroups with a modfiier.
1 Like