44 #include "RNA_prototypes.h"
64 int *index, nr, indexar_num = 0;
71 if (indexar_num == 0) {
75 *r_indexar = index =
MEM_mallocN(4 * indexar_num,
"hook indexar");
76 *r_indexar_num = indexar_num;
89 mul_v3_fl(r_cent, 1.0f / (
float)indexar_num);
97 const int cd_dvert_offset = active_index ?
101 if (cd_dvert_offset != -1) {
102 const int defgrp_index = active_index - 1;
122 mul_v3_fl(r_cent, 1.0f / (
float)indexar_num);
136 int index = 0, nr = 0;
143 if (nr == hmd->
indexar[index]) {
145 if (index < hmd->indexar_num - 1) {
162 int *index, nr, indexar_num = 0,
a;
176 if (indexar_num == 0) {
180 *r_indexar = index =
MEM_mallocN(4 * indexar_num,
"hook indexar");
181 *r_indexar_num = indexar_num;
199 mul_v3_fl(r_cent, 1.0f / (
float)indexar_num);
208 int index = 0, nr = 0,
a;
212 a = editlt->pntsu * editlt->pntsv * editlt->pntsw;
215 if (hmd->
indexar[index] == nr) {
217 if (index < hmd->indexar_num - 1) {
234 int *index,
a, nr, indexar_num = 0;
255 a = nu->pntsu * nu->pntsv;
264 if (indexar_num == 0) {
268 *r_indexar = index =
MEM_mallocN(
sizeof(*index) * indexar_num,
"hook indexar");
269 *r_indexar_num = indexar_num;
301 a = nu->pntsu * nu->pntsv;
314 mul_v3_fl(r_cent, 1.0f / (
float)indexar_num);
331 switch (obedit->
type) {
371 int index = 0,
a, nr = 0;
378 if (nr == hmd->
indexar[index]) {
380 if (index < hmd->indexar_num - 1) {
385 if (nr == hmd->
indexar[index]) {
387 if (index < hmd->indexar_num - 1) {
392 if (nr == hmd->
indexar[index]) {
394 if (index < hmd->indexar_num - 1) {
405 a = nu->pntsu * nu->pntsv;
407 if (nr == hmd->
indexar[index]) {
409 if (index < hmd->indexar_num - 1) {
503 view_layer->
basact = basedit;
522 float pose_mat[4][4];
523 int indexar_num, ok, *indexar;
645 ot->
name =
"Hook to Selected Object";
646 ot->
description =
"Hook selected vertices to the first selected object";
647 ot->
idname =
"OBJECT_OT_hook_add_selob";
660 "Assign the hook to the hook objects active bone");
684 ot->
name =
"Hook to New Object";
685 ot->
description =
"Hook selected vertices to a newly created object";
686 ot->
idname =
"OBJECT_OT_hook_add_newob";
737 tmp.
icon = ICON_HOOK;
756 ot->
idname =
"OBJECT_OT_hook_remove";
804 ot->
description =
"Recalculate and clear offset transformation";
805 ot->
idname =
"OBJECT_OT_hook_reset";
828 float bmat[3][3], imat[3][3];
854 ot->
name =
"Recenter Hook";
856 ot->
idname =
"OBJECT_OT_hook_recenter";
882 int *indexar, indexar_num;
915 ot->
name =
"Assign to Hook";
917 ot->
idname =
"OBJECT_OT_hook_assign";
964 ot->
idname =
"OBJECT_OT_hook_select";
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_active_if_layer_visible(struct Object *ob)
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
#define CTX_DATA_BEGIN(C, Type, instance, member)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
int CustomData_get_offset(const struct CustomData *data, int type)
void BKE_editmesh_looptri_and_normals_calc(BMEditMesh *em)
struct Base * BKE_view_layer_base_find(struct ViewLayer *view_layer, struct Object *ob)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
void BKE_modifier_free(struct ModifierData *md)
void BKE_modifier_remove_from_list(struct Object *ob, struct ModifierData *md)
struct ModifierData * BKE_modifier_new(int type)
@ eModifierTypeType_OnlyDeform
bool BKE_modifier_unique_name(struct ListBase *modifiers, struct ModifierData *md)
General operations, lookup, etc. for blender objects.
void BKE_object_where_is_calc(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
void BKE_object_modifier_hook_reset(struct Object *ob, struct HookModifierData *hmd)
struct Object * BKE_object_add(struct Main *bmain, struct ViewLayer *view_layer, int type, const char *name) ATTR_NONNULL(1
void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define LISTBASE_FOREACH(type, var, list)
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT 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])
void unit_m4(float m[4][4])
bool invert_m4_m4(float R[4][4], const float A[4][4])
#define mul_m4_series(...)
bool invert_m3_m3(float R[3][3], const float A[3][3])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
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])
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
Object is a sort of wrapper for general info.
void EDBM_mesh_load(struct Main *bmain, struct Object *ob)
void EDBM_select_flush(struct BMEditMesh *em)
void EDBM_mesh_make(struct Object *ob, int select_mode, bool add_key_index)
bool ED_operator_editsurfcurve(struct bContext *C)
bool ED_operator_editlattice(struct bContext *C)
bool ED_operator_editmesh(struct 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
ListBase * object_editcurve_get(Object *ob)
void ED_curve_editnurb_make(Object *obedit)
void ED_curve_editnurb_load(Main *bmain, Object *obedit)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
void OBJECT_OT_hook_add_newob(wmOperatorType *ot)
static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
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_recenter(wmOperatorType *ot)
static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
void OBJECT_OT_hook_assign(wmOperatorType *ot)
static int object_add_hook_newob_exec(bContext *C, wmOperator *op)
static int object_hook_select_exec(bContext *C, wmOperator *op)
static Object * add_hook_object_new(Main *bmain, ViewLayer *view_layer, View3D *v3d, Object *obedit)
void OBJECT_OT_hook_select(wmOperatorType *ot)
static int return_editlattice_indexar(Lattice *editlatt, int **r_indexar, int *r_indexar_num, float r_cent[3])
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_reset(wmOperatorType *ot)
static int object_hook_assign_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem * hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
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)
void OBJECT_OT_hook_add_selob(wmOperatorType *ot)
static void object_hook_select(Object *ob, HookModifierData *hmd)
static int return_editcurve_indexar(Object *obedit, int **r_indexar, int *r_indexar_num, float r_cent[3])
void OBJECT_OT_hook_remove(wmOperatorType *ot)
static bool hook_op_edit_poll(bContext *C)
static int object_hook_remove_exec(bContext *C, wmOperator *op)
static int object_hook_recenter_exec(bContext *C, wmOperator *op)
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])
static bool return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *r_name, float r_cent[3])
@ OBJECT_ADDHOOK_SELOB_BONE
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool 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)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem DummyRNA_NULL_items[]
unsigned short local_view_bits
struct EditLatt * editlatt
struct BMEditMesh * edit_mesh
struct ModifierData * next
struct ToolSettings * toolsettings
unsigned short local_view_uuid
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) 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 *UNUSED(event))