44#include "RNA_prototypes.hh"
66 int *index, nr, indexar_num = 0;
73 if (indexar_num == 0) {
77 *r_indexar = index =
static_cast<int *
>(
MEM_mallocN(4 * indexar_num,
"hook indexar"));
78 *r_indexar_num = indexar_num;
91 mul_v3_fl(r_cent, 1.0f /
float(indexar_num));
99 const int cd_dvert_offset = active_index ?
103 if (cd_dvert_offset != -1) {
104 const int defgrp_index = active_index - 1;
124 mul_v3_fl(r_cent, 1.0f /
float(indexar_num));
135 BMEditMesh *em = mesh->runtime->edit_mesh.get();
138 int index = 0, nr = 0;
145 if (nr == hmd->
indexar[index]) {
147 if (index < hmd->indexar_num - 1) {
164 int *index, nr, indexar_num = 0, a;
178 if (indexar_num == 0) {
182 *r_indexar = index =
static_cast<int *
>(
MEM_mallocN(4 * indexar_num,
"hook indexar"));
183 *r_indexar_num = indexar_num;
201 mul_v3_fl(r_cent, 1.0f /
float(indexar_num));
210 int index = 0, nr = 0, a;
214 a = editlt->
pntsu * editlt->pntsv * editlt->pntsw;
217 if (hmd->
indexar[index] == nr) {
219 if (index < hmd->indexar_num - 1) {
236 int *index, a, nr, indexar_num = 0;
257 a = nu->pntsu * nu->pntsv;
266 if (indexar_num == 0) {
270 *r_indexar = index =
static_cast<int *
>(
271 MEM_mallocN(
sizeof(*index) * indexar_num,
"hook indexar"));
272 *r_indexar_num = indexar_num;
304 a = nu->pntsu * nu->pntsv;
317 mul_v3_fl(r_cent, 1.0f /
float(indexar_num));
330 *r_indexar =
nullptr;
334 switch (obedit->
type) {
343 BMEditMesh *em = mesh->runtime->edit_mesh.get();
372 int index = 0, a, nr = 0;
379 if (nr == hmd->
indexar[index]) {
381 if (index < hmd->indexar_num - 1) {
386 if (nr == hmd->
indexar[index]) {
388 if (index < hmd->indexar_num - 1) {
393 if (nr == hmd->
indexar[index]) {
395 if (index < hmd->indexar_num - 1) {
406 a = nu->pntsu * nu->pntsv;
408 if (nr == hmd->
indexar[index]) {
410 if (index < hmd->indexar_num - 1) {
504 view_layer->
basact = basedit;
523 float pose_mat[4][4];
524 int indexar_num, ok, *indexar;
568 mul_v3_m4v3(cent, obedit->world_to_object().ptr(), ob->object_to_world().location());
583 mul_v3_m4v3(cent, obedit->world_to_object().ptr(), cent);
602 invert_m4_m4(object_eval->
runtime->world_to_object.ptr(), object_eval->object_to_world().ptr());
606 object_eval->world_to_object().ptr(),
607 obedit->object_to_world().ptr());
653 ot->
name =
"Hook to Selected Object";
654 ot->
description =
"Hook selected vertices to the first selected object";
655 ot->
idname =
"OBJECT_OT_hook_add_selob";
668 "Assign the hook to the hook object's active bone");
693 ot->
name =
"Hook to New Object";
694 ot->
description =
"Hook selected vertices to a newly created object";
695 ot->
idname =
"OBJECT_OT_hook_add_newob";
747 tmp.
icon = ICON_HOOK;
766 ot->
idname =
"OBJECT_OT_hook_remove";
795 if (hmd ==
nullptr) {
814 ot->
description =
"Recalculate and clear offset transformation";
815 ot->
idname =
"OBJECT_OT_hook_reset";
830 "Modifier number to assign to");
842 float bmat[3][3], imat[3][3];
845 if (hmd ==
nullptr) {
851 copy_m3_m4(bmat, ob->object_to_world().ptr());
854 sub_v3_v3v3(hmd->
cent, scene->cursor.location, ob->object_to_world().location());
868 ot->
name =
"Recenter Hook";
870 ot->
idname =
"OBJECT_OT_hook_recenter";
885 "Modifier number to assign to");
900 int *indexar, indexar_num;
903 if (hmd ==
nullptr) {
933 ot->
name =
"Assign to Hook";
935 ot->
idname =
"OBJECT_OT_hook_assign";
952 "Modifier number to assign to");
965 if (hmd ==
nullptr) {
986 ot->
idname =
"OBJECT_OT_hook_select";
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_active_if_bonecoll_visible(Object *ob) ATTR_WARN_UNUSED_RESULT
#define CTX_DATA_BEGIN(C, Type, instance, member)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
void BKE_editmesh_looptris_and_normals_calc(BMEditMesh *em)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
void BKE_modifiers_persistent_uid_init(const Object &object, ModifierData &md)
void BKE_modifier_unique_name(ListBase *modifiers, ModifierData *md)
void BKE_modifier_free(ModifierData *md)
void BKE_modifier_remove_from_list(Object *ob, ModifierData *md)
ModifierData * BKE_modifier_new(int type)
General operations, lookup, etc. for blender objects.
Object * BKE_object_add(Main *bmain, Scene *scene, ViewLayer *view_layer, int type, const char *name) ATTR_NONNULL(1
void BKE_object_modifier_hook_reset(Object *ob, HookModifierData *hmd)
void BKE_object_where_is_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void mul_m3_v3(const float M[3][3], float r[3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void unit_m4(float m[4][4])
#define mul_m4_series(...)
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
#define STRNCPY(dst, src)
#define SNPRINTF(dst, format,...)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
Object is a sort of wrapper for general info.
void EDBM_mesh_make(Object *ob, int select_mode, bool add_key_index)
void EDBM_mesh_load(Main *bmain, Object *ob)
void EDBM_select_flush(BMEditMesh *em)
bool ED_operator_editsurfcurve(bContext *C)
bool ED_operator_editlattice(bContext *C)
bool ED_operator_editmesh(bContext *C)
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
const Depsgraph * depsgraph
void ED_curve_editnurb_make(Object *obedit)
ListBase * object_editcurve_get(Object *ob)
void ED_curve_editnurb_load(Main *bmain, Object *obedit)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void OBJECT_OT_hook_select(wmOperatorType *ot)
static int return_editmesh_indexar(BMEditMesh *em, int *r_indexar_num, int **r_indexar, float r_cent[3])
static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
static int object_hook_remove_exec(bContext *C, wmOperator *op)
static int return_editcurve_indexar(Object *obedit, int **r_indexar, int *r_indexar_num, float r_cent[3])
static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name, float r_cent[3])
static Object * add_hook_object_new(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *obedit)
static int object_hook_assign_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem * hook_mod_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
void OBJECT_OT_hook_remove(wmOperatorType *ot)
static int object_hook_recenter_exec(bContext *C, wmOperator *op)
static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
void OBJECT_OT_hook_add_selob(wmOperatorType *ot)
static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
@ OBJECT_ADDHOOK_SELOB_BONE
static int return_editlattice_indexar(Lattice *editlatt, int **r_indexar, int *r_indexar_num, float r_cent[3])
static int add_hook_object(const bContext *C, Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, Object *obedit, Object *ob, int mode, ReportList *reports)
void OBJECT_OT_hook_add_newob(wmOperatorType *ot)
static int object_hook_select_exec(bContext *C, wmOperator *op)
static void object_hook_select(Object *ob, HookModifierData *hmd)
static bool hook_op_edit_poll(bContext *C)
static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
void OBJECT_OT_hook_assign(wmOperatorType *ot)
static void object_hook_from_context(bContext *C, PointerRNA *ptr, const int num, Object **r_ob, HookModifierData **r_hmd)
static int object_hook_reset_exec(bContext *C, wmOperator *op)
void OBJECT_OT_hook_recenter(wmOperatorType *ot)
void OBJECT_OT_hook_reset(wmOperatorType *ot)
static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
static bool object_hook_index_array(Main *bmain, Scene *scene, Object *obedit, int **r_indexar, int *r_indexar_num, char *r_name, float r_cent[3])
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
unsigned short local_view_bits
struct EditLatt * editlatt
struct ModifierData * next
ObjectRuntimeHandle * runtime
unsigned short local_view_uid
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)