BKE_key.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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_KEY_H__
  28. #define __BKE_KEY_H__
  29. /** \file BKE_key.h
  30. * \ingroup bke
  31. * \since March 2001
  32. * \author nzc
  33. */
  34. struct Key;
  35. struct KeyBlock;
  36. struct ID;
  37. struct ListBase;
  38. struct Curve;
  39. struct Object;
  40. struct Lattice;
  41. struct Main;
  42. struct Mesh;
  43. struct WeightsArrayCache;
  44. /* Kernel prototypes */
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. void BKE_key_free(struct Key *sc);
  49. void BKE_key_free_nolib(struct Key *key);
  50. struct Key *BKE_key_add(struct ID *id);
  51. struct Key *BKE_key_copy(struct Main *bmain, const struct Key *key);
  52. struct Key *BKE_key_copy_nolib(struct Key *key);
  53. void BKE_key_sort(struct Key *key);
  54. void key_curve_position_weights(float t, float data[4], int type);
  55. void key_curve_tangent_weights(float t, float data[4], int type);
  56. void key_curve_normal_weights(float t, float data[4], int type);
  57. float *BKE_key_evaluate_object_ex(
  58. struct Object *ob, int *r_totelem,
  59. float *arr, size_t arr_size);
  60. float *BKE_key_evaluate_object(
  61. struct Object *ob, int *r_totelem);
  62. struct Key **BKE_key_from_id_p(struct ID *id);
  63. struct Key *BKE_key_from_id(struct ID *id);
  64. struct Key **BKE_key_from_object_p(struct Object *ob);
  65. struct Key *BKE_key_from_object(struct Object *ob);
  66. struct KeyBlock *BKE_keyblock_from_object(struct Object *ob);
  67. struct KeyBlock *BKE_keyblock_from_object_reference(struct Object *ob);
  68. struct KeyBlock *BKE_keyblock_add(struct Key *key, const char *name);
  69. struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, const bool do_force);
  70. struct KeyBlock *BKE_keyblock_from_key(struct Key *key, int index);
  71. struct KeyBlock *BKE_keyblock_find_name(struct Key *key, const char name[]);
  72. void BKE_keyblock_copy_settings(struct KeyBlock *kb_dst, const struct KeyBlock *kb_src);
  73. char *BKE_keyblock_curval_rnapath_get(struct Key *key, struct KeyBlock *kb);
  74. // needed for the GE
  75. typedef struct WeightsArrayCache {
  76. int num_defgroup_weights;
  77. float **defgroup_weights;
  78. } WeightsArrayCache;
  79. float **BKE_keyblock_get_per_block_weights(struct Object *ob, struct Key *key, struct WeightsArrayCache *cache);
  80. void BKE_keyblock_free_per_block_weights(struct Key *key, float **per_keyblock_weights, struct WeightsArrayCache *cache);
  81. void BKE_key_evaluate_relative(const int start, int end, const int tot, char *basispoin, struct Key *key, struct KeyBlock *actkb,
  82. float **per_keyblock_weights, const int mode);
  83. /* conversion functions */
  84. /* Note: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
  85. void BKE_keyblock_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
  86. void BKE_keyblock_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
  87. void BKE_keyblock_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
  88. void BKE_keyblock_update_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
  89. void BKE_keyblock_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
  90. void BKE_keyblock_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
  91. void BKE_keyblock_update_from_mesh(struct Mesh *me, struct KeyBlock *kb);
  92. void BKE_keyblock_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb);
  93. void BKE_keyblock_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me);
  94. void BKE_keyblock_mesh_calc_normals(
  95. struct KeyBlock *kb, struct Mesh *mesh, float (*r_vertnors)[3], float (*r_polynors)[3], float (*r_loopnors)[3]);
  96. void BKE_keyblock_update_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
  97. void BKE_keyblock_convert_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
  98. float (*BKE_keyblock_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
  99. void BKE_keyblock_update_from_offset(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]);
  100. /* other management */
  101. bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index);
  102. bool BKE_keyblock_is_basis(struct Key *key, const int index);
  103. #ifdef __cplusplus
  104. };
  105. #endif
  106. #endif /* __BKE_KEY_H__ */