Manipulator: remove names
They weren't used anywhere, both C & Py manipulators better assign to vars (no lookup needed).
This commit is contained in:
parent
1f15c61ce1
commit
b01d38ef7d
|
@ -615,9 +615,9 @@ static void manipulator_mesh_bisect_setup(const bContext *C, wmManipulatorGroup
|
|||
const wmManipulatorType *wt_grab = WM_manipulatortype_find("MANIPULATOR_WT_grab_3d", true);
|
||||
const wmManipulatorType *wt_dial = WM_manipulatortype_find("MANIPULATOR_WT_dial_3d", true);
|
||||
|
||||
man->translate_z = WM_manipulator_new_ptr(wt_arrow, mgroup, "translate_z", NULL);
|
||||
man->translate_c = WM_manipulator_new_ptr(wt_grab, mgroup, "translate_c", NULL);
|
||||
man->rotate_c = WM_manipulator_new_ptr(wt_dial, mgroup, "rotate_c", NULL);
|
||||
man->translate_z = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
|
||||
man->translate_c = WM_manipulator_new_ptr(wt_grab, mgroup, NULL);
|
||||
man->rotate_c = WM_manipulator_new_ptr(wt_dial, mgroup, NULL);
|
||||
|
||||
RNA_enum_set(man->translate_z->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
RNA_enum_set(man->translate_c->ptr, "draw_style", ED_MANIPULATOR_GRAB_STYLE_RING);
|
||||
|
|
|
@ -1078,10 +1078,10 @@ static void manipulator_mesh_spin_setup(const bContext *C, wmManipulatorGroup *m
|
|||
const wmManipulatorType *wt_grab = WM_manipulatortype_find("MANIPULATOR_WT_grab_3d", true);
|
||||
const wmManipulatorType *wt_dial = WM_manipulatortype_find("MANIPULATOR_WT_dial_3d", true);
|
||||
|
||||
man->translate_z = WM_manipulator_new_ptr(wt_arrow, mgroup, "translate_z", NULL);
|
||||
man->translate_c = WM_manipulator_new_ptr(wt_grab, mgroup, "translate_c", NULL);
|
||||
man->rotate_c = WM_manipulator_new_ptr(wt_dial, mgroup, "rotate_c", NULL);
|
||||
man->angle_z = WM_manipulator_new_ptr(wt_dial, mgroup, "angle_z", NULL);
|
||||
man->translate_z = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
|
||||
man->translate_c = WM_manipulator_new_ptr(wt_grab, mgroup, NULL);
|
||||
man->rotate_c = WM_manipulator_new_ptr(wt_dial, mgroup, NULL);
|
||||
man->angle_z = WM_manipulator_new_ptr(wt_dial, mgroup, NULL);
|
||||
|
||||
RNA_enum_set(man->translate_z->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
RNA_enum_set(man->translate_c->ptr, "draw_style", ED_MANIPULATOR_GRAB_STYLE_RING);
|
||||
|
|
|
@ -63,7 +63,7 @@ static void WIDGETGROUP_node_transform_setup(const bContext *UNUSED(C), wmManipu
|
|||
{
|
||||
wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__);
|
||||
|
||||
wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_cage_2d", mgroup, "backdrop_cage", NULL);
|
||||
wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_cage_2d", mgroup, NULL);
|
||||
|
||||
RNA_enum_set(wwrapper->manipulator->ptr, "transform",
|
||||
ED_MANIPULATOR_RECT_TRANSFORM_FLAG_TRANSLATE | ED_MANIPULATOR_RECT_TRANSFORM_FLAG_SCALE_UNIFORM);
|
||||
|
|
|
@ -71,14 +71,12 @@ static bool WIDGETGROUP_lamp_poll(const bContext *C, wmManipulatorGroupType *UNU
|
|||
|
||||
static void WIDGETGROUP_lamp_setup(const bContext *UNUSED(C), wmManipulatorGroup *mgroup)
|
||||
{
|
||||
const char *propname = "spot_size";
|
||||
|
||||
const float color[4] = {0.5f, 0.5f, 1.0f, 1.0f};
|
||||
const float color_hi[4] = {0.8f, 0.8f, 0.45f, 1.0f};
|
||||
|
||||
wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__);
|
||||
|
||||
wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, propname, NULL);
|
||||
wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, NULL);
|
||||
RNA_enum_set(wwrapper->manipulator->ptr, "draw_options", ED_MANIPULATOR_ARROW_STYLE_INVERTED);
|
||||
|
||||
mgroup->customdata = wwrapper;
|
||||
|
@ -184,7 +182,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro
|
|||
const float color[4] = {1.0f, 0.3f, 0.0f, 1.0f};
|
||||
const float color_hi[4] = {1.0f, 0.3f, 0.0f, 1.0f};
|
||||
|
||||
camgroup->dop_dist = WM_manipulator_new_ptr(wt_arrow, mgroup, "dof_distance", NULL);
|
||||
camgroup->dop_dist = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
|
||||
RNA_enum_set(camgroup->dop_dist->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_CROSS);
|
||||
WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_DRAW_HOVER, true);
|
||||
WM_manipulator_set_color(camgroup->dop_dist, color);
|
||||
|
@ -197,7 +195,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro
|
|||
const float color[4] = {1.0f, 1.0, 0.27f, 0.5f};
|
||||
const float color_hi[4] = {1.0f, 1.0, 0.27f, 1.0f};
|
||||
|
||||
camgroup->focal_len = WM_manipulator_new_ptr(wt_arrow, mgroup, "focal_len", NULL);
|
||||
camgroup->focal_len = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
|
||||
RNA_enum_set(camgroup->focal_len->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_CONE);
|
||||
RNA_enum_set(camgroup->focal_len->ptr, "draw_options", ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED);
|
||||
|
||||
|
@ -205,7 +203,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro
|
|||
WM_manipulator_set_color_highlight(camgroup->focal_len, color_hi);
|
||||
cameragroup_property_setup(camgroup->focal_len, ob, ca, false);
|
||||
|
||||
camgroup->ortho_scale = WM_manipulator_new_ptr(wt_arrow, mgroup, "ortho_scale", NULL);
|
||||
camgroup->ortho_scale = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
|
||||
RNA_enum_set(camgroup->ortho_scale->ptr, "draw_style", ED_MANIPULATOR_ARROW_STYLE_CONE);
|
||||
RNA_enum_set(camgroup->ortho_scale->ptr, "draw_options", ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED);
|
||||
|
||||
|
@ -325,7 +323,7 @@ static void WIDGETGROUP_forcefield_setup(const bContext *UNUSED(C), wmManipulato
|
|||
wmManipulatorWrapper *wwrapper = MEM_mallocN(sizeof(wmManipulatorWrapper), __func__);
|
||||
mgroup->customdata = wwrapper;
|
||||
|
||||
wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, "field_strength", NULL);
|
||||
wwrapper->manipulator = WM_manipulator_new("MANIPULATOR_WT_arrow_3d", mgroup, NULL);
|
||||
RNA_enum_set(wwrapper->manipulator->ptr, "draw_options", ED_MANIPULATOR_ARROW_STYLE_CONSTRAINED);
|
||||
ED_manipulator_arrow3d_set_ui_range(wwrapper->manipulator, -200.0f, 200.0f);
|
||||
ED_manipulator_arrow3d_set_range_fac(wwrapper->manipulator, 6.0f);
|
||||
|
|
|
@ -1090,48 +1090,48 @@ static ManipulatorGroup *manipulatorgroup_init(wmManipulatorGroup *mgroup)
|
|||
const wmManipulatorType *wt_dial = WM_manipulatortype_find("MANIPULATOR_WT_dial_3d", true);
|
||||
const wmManipulatorType *wt_prim = WM_manipulatortype_find("MANIPULATOR_WT_primitive_3d", true);
|
||||
|
||||
#define MANIPULATOR_NEW_ARROW(v, name, draw_style) { \
|
||||
v = WM_manipulator_new_ptr(wt_arrow, mgroup, name, NULL); \
|
||||
#define MANIPULATOR_NEW_ARROW(v, draw_style) { \
|
||||
v = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL); \
|
||||
RNA_enum_set((v)->ptr, "draw_style", draw_style); \
|
||||
} ((void)0)
|
||||
#define MANIPULATOR_NEW_DIAL(v, name, draw_options) { \
|
||||
v = WM_manipulator_new_ptr(wt_dial, mgroup, name, NULL); \
|
||||
#define MANIPULATOR_NEW_DIAL(v, draw_options) { \
|
||||
v = WM_manipulator_new_ptr(wt_dial, mgroup, NULL); \
|
||||
RNA_enum_set((v)->ptr, "draw_options", draw_options); \
|
||||
} ((void)0)
|
||||
#define MANIPULATOR_NEW_PRIM(v, name, draw_style) { \
|
||||
v = WM_manipulator_new_ptr(wt_prim, mgroup, name, NULL); \
|
||||
#define MANIPULATOR_NEW_PRIM(v, draw_style) { \
|
||||
v = WM_manipulator_new_ptr(wt_prim, mgroup, NULL); \
|
||||
RNA_enum_set((v)->ptr, "draw_style", draw_style); \
|
||||
} ((void)0)
|
||||
|
||||
/* add/init widgets - order matters! */
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_t, "rotate_t", ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL);
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_t, ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL);
|
||||
|
||||
MANIPULATOR_NEW_DIAL(man->scale_c, "scale_c", ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP);
|
||||
MANIPULATOR_NEW_DIAL(man->scale_c, ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP);
|
||||
|
||||
MANIPULATOR_NEW_ARROW(man->scale_x, "scale_x", ED_MANIPULATOR_ARROW_STYLE_BOX);
|
||||
MANIPULATOR_NEW_ARROW(man->scale_y, "scale_y", ED_MANIPULATOR_ARROW_STYLE_BOX);
|
||||
MANIPULATOR_NEW_ARROW(man->scale_z, "scale_z", ED_MANIPULATOR_ARROW_STYLE_BOX);
|
||||
MANIPULATOR_NEW_ARROW(man->scale_x, ED_MANIPULATOR_ARROW_STYLE_BOX);
|
||||
MANIPULATOR_NEW_ARROW(man->scale_y, ED_MANIPULATOR_ARROW_STYLE_BOX);
|
||||
MANIPULATOR_NEW_ARROW(man->scale_z, ED_MANIPULATOR_ARROW_STYLE_BOX);
|
||||
|
||||
MANIPULATOR_NEW_PRIM(man->scale_xy, "scale_xy", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->scale_yz, "scale_yz", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->scale_zx, "scale_zx", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->scale_xy, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->scale_yz, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->scale_zx, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_x, "rotate_x", ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP);
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_y, "rotate_y", ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP);
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_z, "rotate_z", ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP);
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_x, ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP);
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_y, ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP);
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_z, ED_MANIPULATOR_DIAL_DRAW_FLAG_CLIP);
|
||||
|
||||
/* init screen aligned widget last here, looks better, behaves better */
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_c, "rotate_c", ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP);
|
||||
MANIPULATOR_NEW_DIAL(man->rotate_c, ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP);
|
||||
|
||||
MANIPULATOR_NEW_DIAL(man->translate_c, "translate_c", ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP);
|
||||
MANIPULATOR_NEW_DIAL(man->translate_c, ED_MANIPULATOR_DIAL_DRAW_FLAG_NOP);
|
||||
|
||||
MANIPULATOR_NEW_ARROW(man->translate_x, "translate_x", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
MANIPULATOR_NEW_ARROW(man->translate_y, "translate_y", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
MANIPULATOR_NEW_ARROW(man->translate_z, "translate_z", ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
MANIPULATOR_NEW_ARROW(man->translate_x, ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
MANIPULATOR_NEW_ARROW(man->translate_y, ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
MANIPULATOR_NEW_ARROW(man->translate_z, ED_MANIPULATOR_ARROW_STYLE_NORMAL);
|
||||
|
||||
MANIPULATOR_NEW_PRIM(man->translate_xy, "translate_xy", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->translate_yz, "translate_yz", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->translate_zx, "translate_zx", ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->translate_xy, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->translate_yz, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
MANIPULATOR_NEW_PRIM(man->translate_zx, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
|
||||
|
||||
return man;
|
||||
}
|
||||
|
|
|
@ -134,8 +134,8 @@ static ManipulatorGroup2D *manipulatorgroup2d_init(wmManipulatorGroup *mgroup)
|
|||
|
||||
ManipulatorGroup2D *man = MEM_callocN(sizeof(ManipulatorGroup2D), __func__);
|
||||
|
||||
man->translate_x = WM_manipulator_new_ptr(wt_arrow, mgroup, "translate_x", NULL);
|
||||
man->translate_y = WM_manipulator_new_ptr(wt_arrow, mgroup, "translate_y", NULL);
|
||||
man->translate_x = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
|
||||
man->translate_y = WM_manipulator_new_ptr(wt_arrow, mgroup, NULL);
|
||||
|
||||
return man;
|
||||
}
|
||||
|
|
|
@ -382,24 +382,6 @@ static void rna_Manipulator_state_select_set(struct PointerRNA *ptr, int value)
|
|||
WM_manipulator_select_set(mgroup->parent_mmap, mpr, value);
|
||||
}
|
||||
|
||||
static void rna_Manipulator_name_get(PointerRNA *ptr, char *value)
|
||||
{
|
||||
wmManipulator *mpr = ptr->data;
|
||||
strcpy(value, mpr->name);
|
||||
}
|
||||
|
||||
static void rna_Manipulator_name_set(PointerRNA *ptr, const char *value)
|
||||
{
|
||||
wmManipulator *mpr = ptr->data;
|
||||
WM_manipulator_name_set(mpr->parent_mgroup, mpr, value);
|
||||
}
|
||||
|
||||
static int rna_Manipulator_name_length(PointerRNA *ptr)
|
||||
{
|
||||
wmManipulator *mpr = ptr->data;
|
||||
return strlen(mpr->name);
|
||||
}
|
||||
|
||||
static PointerRNA rna_Manipulator_group_get(PointerRNA *ptr)
|
||||
{
|
||||
wmManipulator *mpr = ptr->data;
|
||||
|
@ -526,14 +508,14 @@ static StructRNA *rna_Manipulator_refine(PointerRNA *mnp_ptr)
|
|||
* \{ */
|
||||
|
||||
static wmManipulator *rna_ManipulatorGroup_manipulator_new(
|
||||
wmManipulatorGroup *mgroup, ReportList *reports, const char *idname, const char *name)
|
||||
wmManipulatorGroup *mgroup, ReportList *reports, const char *idname)
|
||||
{
|
||||
const wmManipulatorType *wt = WM_manipulatortype_find(idname, true);
|
||||
if (wt == NULL) {
|
||||
BKE_reportf(reports, RPT_ERROR, "ManipulatorType '%s' not known", idname);
|
||||
return NULL;
|
||||
}
|
||||
wmManipulator *mpr = WM_manipulator_new_ptr(wt, mgroup, name, NULL);
|
||||
wmManipulator *mpr = WM_manipulator_new_ptr(wt, mgroup, NULL);
|
||||
return mpr;
|
||||
}
|
||||
|
||||
|
@ -848,7 +830,6 @@ static void rna_def_manipulators(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
RNA_def_function_ui_description(func, "Add manipulator");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_string(func, "type", "Type", 0, "", "Manipulator identifier"); /* optional */
|
||||
RNA_def_string(func, "name", "Name", 0, "", "Manipulator name"); /* optional */
|
||||
parm = RNA_def_pointer(func, "manipulator", "Manipulator", "", "New manipulator");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
|
@ -990,13 +971,6 @@ static void rna_def_manipulator(BlenderRNA *brna, PropertyRNA *cprop)
|
|||
/* -------------------------------------------------------------------- */
|
||||
/* Instance Variables */
|
||||
|
||||
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
||||
RNA_def_property_string_funcs(
|
||||
prop, "rna_Manipulator_name_get", "rna_Manipulator_name_length", "rna_Manipulator_name_set");
|
||||
RNA_def_property_ui_text(prop, "Name", "");
|
||||
RNA_def_struct_name_property(srna, prop);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_struct_type(prop, "ManipulatorGroup");
|
||||
|
|
|
@ -59,10 +59,10 @@ struct wmManipulatorMapType_Params;
|
|||
|
||||
struct wmManipulator *WM_manipulator_new_ptr(
|
||||
const struct wmManipulatorType *wt, struct wmManipulatorGroup *mgroup,
|
||||
const char *name, struct PointerRNA *properties);
|
||||
struct PointerRNA *properties);
|
||||
struct wmManipulator *WM_manipulator_new(
|
||||
const char *idname, struct wmManipulatorGroup *mgroup,
|
||||
const char *name, struct PointerRNA *properties);
|
||||
struct PointerRNA *properties);
|
||||
void WM_manipulator_free(
|
||||
ListBase *manipulatorlist, struct wmManipulatorMap *mmap, struct wmManipulator *mpr,
|
||||
struct bContext *C);
|
||||
|
|
|
@ -129,8 +129,6 @@ typedef enum {
|
|||
struct wmManipulator {
|
||||
struct wmManipulator *next, *prev;
|
||||
|
||||
char name[64 + 4]; /* MAX_NAME + 4 for unique '.001', '.002', etc suffix */
|
||||
|
||||
/* While we don't have a real type, use this to put type-like vars. */
|
||||
const struct wmManipulatorType *type;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
#include "wm_manipulator_intern.h"
|
||||
|
||||
static void wm_manipulator_register(
|
||||
wmManipulatorGroup *mgroup, wmManipulator *mpr, const char *name);
|
||||
wmManipulatorGroup *mgroup, wmManipulator *mpr);
|
||||
|
||||
/**
|
||||
* \note Follow #wm_operator_create convention.
|
||||
|
@ -102,11 +102,11 @@ static wmManipulator *wm_manipulator_create(
|
|||
|
||||
wmManipulator *WM_manipulator_new_ptr(
|
||||
const wmManipulatorType *wt, wmManipulatorGroup *mgroup,
|
||||
const char *name, PointerRNA *properties)
|
||||
PointerRNA *properties)
|
||||
{
|
||||
wmManipulator *mpr = wm_manipulator_create(wt, properties);
|
||||
|
||||
wm_manipulator_register(mgroup, mpr, name);
|
||||
wm_manipulator_register(mgroup, mpr);
|
||||
|
||||
if (mpr->type->setup != NULL) {
|
||||
mpr->type->setup(mpr);
|
||||
|
@ -122,33 +122,10 @@ wmManipulator *WM_manipulator_new_ptr(
|
|||
*/
|
||||
wmManipulator *WM_manipulator_new(
|
||||
const char *idname, wmManipulatorGroup *mgroup,
|
||||
const char *name, PointerRNA *properties)
|
||||
PointerRNA *properties)
|
||||
{
|
||||
const wmManipulatorType *wt = WM_manipulatortype_find(idname, false);
|
||||
return WM_manipulator_new_ptr(wt, mgroup, name, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign an idname that is unique in \a mgroup to \a manipulator.
|
||||
*
|
||||
* \param rawname: Name used as basis to define final unique idname.
|
||||
*/
|
||||
static void manipulator_unique_idname_set(wmManipulatorGroup *mgroup, wmManipulator *mpr, const char *rawname)
|
||||
{
|
||||
BLI_snprintf(mpr->name, sizeof(mpr->name), "%s_%s", mgroup->type->idname, rawname);
|
||||
|
||||
/* ensure name is unique, append '.001', '.002', etc if not */
|
||||
BLI_uniquename(&mgroup->manipulators, mpr, "Manipulator", '.',
|
||||
offsetof(wmManipulator, name), sizeof(mpr->name));
|
||||
}
|
||||
|
||||
void WM_manipulator_name_set(wmManipulatorGroup *mgroup, wmManipulator *mpr, const char *name)
|
||||
{
|
||||
BLI_strncpy(mpr->name, name, sizeof(mpr->name));
|
||||
|
||||
/* ensure name is unique, append '.001', '.002', etc if not */
|
||||
BLI_uniquename(&mgroup->manipulators, mpr, "Manipulator", '.',
|
||||
offsetof(wmManipulator, name), sizeof(mpr->name));
|
||||
return WM_manipulator_new_ptr(wt, mgroup, properties);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,10 +150,9 @@ static void manipulator_init(wmManipulator *mpr)
|
|||
*
|
||||
* \note Not to be confused with type registration from RNA.
|
||||
*/
|
||||
static void wm_manipulator_register(wmManipulatorGroup *mgroup, wmManipulator *mpr, const char *name)
|
||||
static void wm_manipulator_register(wmManipulatorGroup *mgroup, wmManipulator *mpr)
|
||||
{
|
||||
manipulator_init(mpr);
|
||||
manipulator_unique_idname_set(mgroup, mpr, name);
|
||||
wm_manipulatorgroup_manipulator_register(mgroup, mpr);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ void wm_manipulatorgroup_free(bContext *C, wmManipulatorGroup *mgroup)
|
|||
*/
|
||||
void wm_manipulatorgroup_manipulator_register(wmManipulatorGroup *mgroup, wmManipulator *mpr)
|
||||
{
|
||||
BLI_assert(!BLI_findstring(&mgroup->manipulators, mpr->name, offsetof(wmManipulator, name)));
|
||||
BLI_assert(BLI_findindex(&mgroup->manipulators, mpr) == -1);
|
||||
BLI_addtail(&mgroup->manipulators, mpr);
|
||||
mpr->parent_mgroup = mgroup;
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ static GHash *WM_manipulatormap_manipulator_hash_new(
|
|||
bool (*poll)(const wmManipulator *, void *),
|
||||
void *data, const bool include_hidden)
|
||||
{
|
||||
GHash *hash = BLI_ghash_str_new(__func__);
|
||||
GHash *hash = BLI_ghash_ptr_new(__func__);
|
||||
|
||||
/* collect manipulators */
|
||||
for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
|
||||
|
@ -248,7 +248,7 @@ static GHash *WM_manipulatormap_manipulator_hash_new(
|
|||
if ((include_hidden || (mpr->flag & WM_MANIPULATOR_HIDDEN) == 0) &&
|
||||
(!poll || poll(mpr, data)))
|
||||
{
|
||||
BLI_ghash_insert(hash, mpr->name, mpr);
|
||||
BLI_ghash_insert(hash, mpr, mpr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ void BPY_RNA_manipulator_wrapper(struct wmManipulatorType *wgt, void *userdata)
|
|||
PointerRNA *WM_manipulator_set_operator(struct wmManipulator *mpr, struct wmOperatorType *ot, struct IDProperty *properties) RET_NULL
|
||||
const struct wmManipulatorPropertyType *WM_manipulatortype_target_property_find(const struct wmManipulatorType *wt, const char *idname) RET_NULL
|
||||
const struct wmManipulatorType *WM_manipulatortype_find(const char *idname, bool quiet) RET_NULL
|
||||
struct wmManipulator *WM_manipulator_new_ptr(const struct wmManipulatorType *wt, struct wmManipulatorGroup *mgroup, const char *name, struct PointerRNA *properties) RET_NULL
|
||||
struct wmManipulator *WM_manipulator_new_ptr(const struct wmManipulatorType *wt, struct wmManipulatorGroup *mgroup, struct PointerRNA *properties) RET_NULL
|
||||
struct wmManipulatorGroupType *WM_manipulatorgrouptype_append_ptr(void (*mnpfunc)(struct wmManipulatorGroupType *, void *), void *userdata) RET_NULL
|
||||
struct wmManipulatorGroupType *WM_manipulatorgrouptype_find(const char *idname, bool quiet) RET_NULL
|
||||
void WM_manipulator_free(ListBase *manipulatorlist, struct wmManipulatorMap *mmap, struct wmManipulator *mpr, struct bContext *C) RET_NONE
|
||||
|
|
Loading…
Reference in New Issue