BKE_deform.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * ***** BEGIN GPL LICENSE BLOCK *****
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software Foundation,
  16. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. *
  18. * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  19. * All rights reserved.
  20. *
  21. * The Original Code is: all of this file.
  22. *
  23. * Contributor(s): none yet.
  24. *
  25. * ***** END GPL LICENSE BLOCK *****
  26. */
  27. #ifndef __BKE_DEFORM_H__
  28. #define __BKE_DEFORM_H__
  29. /** \file BKE_deform.h
  30. * \ingroup bke
  31. * \since June 2001
  32. * \author Reevan McKay et al
  33. * \brief support for deformation groups and hooks.
  34. */
  35. struct Object;
  36. struct ListBase;
  37. struct bDeformGroup;
  38. struct MDeformVert;
  39. struct MEdge;
  40. struct MLoop;
  41. struct MPoly;
  42. struct bDeformGroup *BKE_defgroup_new(struct Object *ob, const char *name);
  43. void defgroup_copy_list(struct ListBase *lb1, const struct ListBase *lb2);
  44. struct bDeformGroup *defgroup_duplicate(const struct bDeformGroup *ingroup);
  45. struct bDeformGroup *defgroup_find_name(struct Object *ob, const char *name);
  46. int *defgroup_flip_map(struct Object *ob, int *flip_map_len, const bool use_default);
  47. int *defgroup_flip_map_single(struct Object *ob, int *flip_map_len, const bool use_default, int defgroup);
  48. int defgroup_flip_index(struct Object *ob, int index, const bool use_default);
  49. int defgroup_name_index(struct Object *ob, const char *name);
  50. void defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob);
  51. struct MDeformWeight *defvert_find_index(const struct MDeformVert *dv, const int defgroup);
  52. struct MDeformWeight *defvert_verify_index(struct MDeformVert *dv, const int defgroup);
  53. void defvert_add_index_notest(struct MDeformVert *dv, int defgroup, const float weight);
  54. void defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw);
  55. void defvert_clear(struct MDeformVert *dvert);
  56. int defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
  57. bool defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot);
  58. void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert);
  59. void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert);
  60. void BKE_defvert_array_copy(struct MDeformVert *dst, const struct MDeformVert *src, int totvert);
  61. float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup);
  62. float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup);
  63. float BKE_defvert_multipaint_collective_weight(
  64. const struct MDeformVert *dv, int defbase_tot,
  65. const bool *defbase_sel, int defbase_tot_sel, bool do_autonormalize);
  66. void defvert_copy(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src);
  67. void defvert_copy_subset(
  68. struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src,
  69. const bool *vgroup_subset, const int vgroup_tot);
  70. void defvert_mirror_subset(
  71. struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src,
  72. const bool *vgroup_subset, const int vgroup_tot,
  73. const int *flip_map, const int flip_map_len);
  74. void defvert_copy_index(
  75. struct MDeformVert *dvert_dst, const int defgroup_dst,
  76. const struct MDeformVert *dvert_src, const int defgroup_src);
  77. void defvert_sync(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const bool use_verify);
  78. void defvert_sync_mapped(
  79. struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src,
  80. const int *flip_map, const int flip_map_len, const bool use_verify);
  81. void defvert_remap(struct MDeformVert *dvert, int *map, const int map_len);
  82. void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
  83. void defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
  84. void defvert_normalize(struct MDeformVert *dvert);
  85. void defvert_normalize_subset(
  86. struct MDeformVert *dvert,
  87. const bool *vgroup_subset, const int vgroup_tot);
  88. void defvert_normalize_lock_single(
  89. struct MDeformVert *dvert,
  90. const bool *vgroup_subset, const int vgroup_tot,
  91. const int def_nr_lock);
  92. void defvert_normalize_lock_map(
  93. struct MDeformVert *dvert,
  94. const bool *vgroup_subset, const int vgroup_tot,
  95. const bool *lock_flags, const int defbase_tot);
  96. /* Utilities to 'extract' a given vgroup into a simple float array, for verts, but also edges/polys/loops. */
  97. void BKE_defvert_extract_vgroup_to_vertweights(
  98. struct MDeformVert *dvert, const int defgroup, const int num_verts, float *r_weights, const bool invert_vgroup);
  99. void BKE_defvert_extract_vgroup_to_edgeweights(
  100. struct MDeformVert *dvert, const int defgroup, const int num_verts, struct MEdge *edges, const int num_edges,
  101. float *r_weights, const bool invert_vgroup);
  102. void BKE_defvert_extract_vgroup_to_loopweights(
  103. struct MDeformVert *dvert, const int defgroup, const int num_verts, struct MLoop *loops, const int num_loops,
  104. float *r_weights, const bool invert_vgroup);
  105. void BKE_defvert_extract_vgroup_to_polyweights(
  106. struct MDeformVert *dvert, const int defgroup, const int num_verts, struct MLoop *loops, const int num_loops,
  107. struct MPoly *polys, const int num_polys, float *r_weights, const bool invert_vgroup);
  108. #endif /* __BKE_DEFORM_H__ */