Cleanup: Remove object vgroup functions to proper header

These functions were declared in the editors/mesh module but
defined in the editors/object module. This commit moves them to
a separate header associated with the object editors module.
This commit is contained in:
Hans Goudey
2024-03-26 21:51:09 -04:00
parent 32db305899
commit 436c0a773e
14 changed files with 98 additions and 72 deletions

View File

@@ -34,6 +34,7 @@
#include "ED_armature.hh"
#include "ED_mesh.hh"
#include "ED_object_vgroup.hh"
#include "ANIM_bone_collections.hh"

View File

@@ -31,6 +31,7 @@
#include "ED_armature.hh"
#include "ED_mesh.hh"
#include "ED_object_vgroup.hh"
#include "eigen_capi.h"

View File

@@ -41,6 +41,7 @@
#include "ED_keyframing.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "ED_outliner.hh"
#include "ED_screen.hh"
#include "ED_select_utils.hh"

View File

@@ -45,6 +45,7 @@
#include "ED_gpencil_legacy.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "ANIM_bone_collections.hh"

View File

@@ -441,78 +441,6 @@ void ED_mesh_mirrtopo_init(BMEditMesh *em,
bool skip_em_vert_array_init);
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
/* `object_vgroup.cc` */
#define WEIGHT_REPLACE 1
#define WEIGHT_ADD 2
#define WEIGHT_SUBTRACT 3
bool ED_vgroup_sync_from_pose(Object *ob);
void ED_vgroup_select_by_name(Object *ob, const char *name);
/**
* Removes out of range #MDeformWeights
*/
void ED_vgroup_data_clamp_range(ID *id, int total);
/**
* Matching index only.
*/
bool ED_vgroup_array_copy(Object *ob, Object *ob_from);
bool ED_vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, bool use_vert_sel);
/**
* For use with tools that use ED_vgroup_parray_alloc with \a use_vert_sel == true.
* This finds the unselected mirror deform verts and copies the weights to them from the selected.
*
* \note \a dvert_array has mirrored weights filled in,
* in case cleanup operations are needed on both.
*/
void ED_vgroup_parray_mirror_sync(Object *ob,
MDeformVert **dvert_array,
int dvert_tot,
const bool *vgroup_validmap,
int vgroup_tot);
/**
* Fill in the pointers for mirror verts (as if all mirror verts were selected too).
*
* similar to #ED_vgroup_parray_mirror_sync but only fill in mirror points.
*/
void ED_vgroup_parray_mirror_assign(Object *ob, MDeformVert **dvert_array, int dvert_tot);
void ED_vgroup_parray_remove_zero(MDeformVert **dvert_array,
int dvert_tot,
const bool *vgroup_validmap,
int vgroup_tot,
float epsilon,
bool keep_single);
void ED_vgroup_parray_to_weight_array(const MDeformVert **dvert_array,
int dvert_tot,
float *dvert_weights,
int def_nr);
void ED_vgroup_parray_from_weight_array(MDeformVert **dvert_array,
int dvert_tot,
const float *dvert_weights,
int def_nr,
bool remove_zero);
void ED_vgroup_mirror(Object *ob,
bool mirror_weights,
bool flip_vgroups,
bool all_vgroups,
bool use_topology,
int *r_totmirr,
int *r_totfail);
/**
* Called while not in editmode.
*/
void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode);
/**
* Mesh object mode, lattice can be in edit-mode.
*/
void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum);
float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum);
/**
* Use when adjusting the active vertex weight and apply to mirror vertices.
*/
void ED_vgroup_vert_active_mirror(Object *ob, int def_nr);
/* `mesh_data.cc` */
void ED_mesh_verts_add(Mesh *mesh, ReportList *reports, int count);

View File

@@ -0,0 +1,86 @@
/* SPDX-FileCopyrightText: 2008 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup editors
*/
#pragma once
#include "BLI_compiler_attrs.h"
struct bDeformGroup;
struct ID;
struct MDeformVert;
struct Object;
#define WEIGHT_REPLACE 1
#define WEIGHT_ADD 2
#define WEIGHT_SUBTRACT 3
bool ED_vgroup_sync_from_pose(Object *ob);
void ED_vgroup_select_by_name(Object *ob, const char *name);
/**
* Removes out of range #MDeformWeights
*/
void ED_vgroup_data_clamp_range(ID *id, int total);
/**
* Matching index only.
*/
bool ED_vgroup_array_copy(Object *ob, Object *ob_from);
bool ED_vgroup_parray_alloc(ID *id, MDeformVert ***dvert_arr, int *dvert_tot, bool use_vert_sel);
/**
* For use with tools that use ED_vgroup_parray_alloc with \a use_vert_sel == true.
* This finds the unselected mirror deform verts and copies the weights to them from the selected.
*
* \note \a dvert_array has mirrored weights filled in,
* in case cleanup operations are needed on both.
*/
void ED_vgroup_parray_mirror_sync(Object *ob,
MDeformVert **dvert_array,
int dvert_tot,
const bool *vgroup_validmap,
int vgroup_tot);
/**
* Fill in the pointers for mirror verts (as if all mirror verts were selected too).
*
* similar to #ED_vgroup_parray_mirror_sync but only fill in mirror points.
*/
void ED_vgroup_parray_mirror_assign(Object *ob, MDeformVert **dvert_array, int dvert_tot);
void ED_vgroup_parray_remove_zero(MDeformVert **dvert_array,
int dvert_tot,
const bool *vgroup_validmap,
int vgroup_tot,
float epsilon,
bool keep_single);
void ED_vgroup_parray_to_weight_array(const MDeformVert **dvert_array,
int dvert_tot,
float *dvert_weights,
int def_nr);
void ED_vgroup_parray_from_weight_array(MDeformVert **dvert_array,
int dvert_tot,
const float *dvert_weights,
int def_nr,
bool remove_zero);
void ED_vgroup_mirror(Object *ob,
bool mirror_weights,
bool flip_vgroups,
bool all_vgroups,
bool use_topology,
int *r_totmirr,
int *r_totfail);
/**
* Called while not in editmode.
*/
void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight, int assignmode);
/**
* Mesh object mode, lattice can be in edit-mode.
*/
void ED_vgroup_vert_remove(Object *ob, bDeformGroup *dg, int vertnum);
float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum);
/**
* Use when adjusting the active vertex weight and apply to mirror vertices.
*/
void ED_vgroup_vert_active_mirror(Object *ob, int def_nr);

View File

@@ -92,6 +92,7 @@
#include "ED_armature.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "ED_screen.hh"
#include "ED_sculpt.hh"

View File

@@ -58,6 +58,7 @@
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "ED_screen.hh"
#include "UI_resources.hh"

View File

@@ -61,6 +61,7 @@
#include "ED_image.hh"
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "ED_screen.hh"
#include "ED_view3d.hh"

View File

@@ -57,6 +57,7 @@
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "ED_screen.hh"
#include "ANIM_bone_collections.hh"

View File

@@ -67,6 +67,7 @@ set(SRC
../include/ED_node_preview.hh
../include/ED_numinput.hh
../include/ED_object.hh
../include/ED_object_vgroup.hh
../include/ED_outliner.hh
../include/ED_paint.hh
../include/ED_particle.hh

View File

@@ -30,6 +30,7 @@
#include "ED_mesh.hh"
#include "ED_object.hh"
#include "ED_object_vgroup.hh"
#include "SkinInfo.h"
#include "collada_utils.h"

View File

@@ -40,6 +40,7 @@
#include "ED_armature.hh"
#include "ED_mesh.hh"
#include "ED_object_vgroup.hh"
#include "ANIM_animdata.hh"
#include "ANIM_fcurve.hh"

View File

@@ -47,6 +47,7 @@
#include "BLI_sys_types.h" /* needed for intptr_t used in ED_mesh.hh */
#include "ED_mesh.hh"
#include "ED_object_vgroup.hh"
#include "WM_api.hh"
#include "WM_types.hh"