Manipulator: remove names
authorCampbell Barton <ideasman42@gmail.com>
Wed, 26 Jul 2017 21:43:15 +0000 (07:43 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 26 Jul 2017 21:43:15 +0000 (07:43 +1000)
They weren't used anywhere,
both C & Py manipulators better assign to vars (no lookup needed).

13 files changed:
source/blender/editors/mesh/editmesh_bisect.c
source/blender/editors/mesh/editmesh_extrude.c
source/blender/editors/space_node/node_manipulators.c
source/blender/editors/space_view3d/view3d_manipulators.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_manipulator2d.c
source/blender/makesrna/intern/rna_wm_manipulator.c
source/blender/windowmanager/manipulators/WM_manipulator_api.h
source/blender/windowmanager/manipulators/WM_manipulator_types.h
source/blender/windowmanager/manipulators/intern/wm_manipulator.c
source/blender/windowmanager/manipulators/intern/wm_manipulator_group.c
source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 9b6df11d4706314c01e58e6e8eed6cb35ce572df..9b97484c8d9207945971c18259c6bb6bea889521 100644 (file)
@@ -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);
index d5b2a3d3b8257bac60b94ae7cb1c11d43d328ae1..e7be66e02764d04f4fe06f91d9db892513e9e082 100644 (file)
@@ -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);
index 8b4ebd708744f8e500ce930063b59df9e812ebaf..7bc029ea660a70baa530debdfaa56cf22900d39d 100644 (file)
@@ -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);
index 3a12fc31ba27d47c6b541954f85a2b7d4b7c4f57..68d1fa8a51bdff7d50ea55cbb37d27ce1754dbaf 100644 (file)
@@ -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);
index 0258b228a71708390ec19da9845576dd4118a602..5b4eebc963ff3b0054d6acb011e753cfccd55e4d 100644 (file)
@@ -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;
 }
index 8a9e05af3f8ee89211f72e034fb6cb865d2c426e..dd6fe762423f7a0d35e444f667fed7d2655f7bae 100644 (file)
@@ -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;
 }
index 46d6dcc429ba8d390fc6611cc509ecdbbc5e1977..fc7dcdbe3cb5b3e8ee5e77be240fa2e3e1cde7dc 100644 (file)
@@ -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");
index 0d4e2866d6bdc6c94a828dc4322633e0e2f53c04..9211c3365c57caab1da70e6adbe0288b8fcfc484 100644 (file)
@@ -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);
index 57c6039f62c268d535eb0ca8f09f6b3814933353..9ba82031db9f8c191307d845708930dd8e71c5b8 100644 (file)
@@ -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;
 
index e61200fa67bd60548678e81804a7c45f52b0deeb..4936afde0c1f857e5de8fe680abb9e4dd40cbc43 100644 (file)
@@ -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);
 }
 
index 49e6192f163af975cdf975379df0bf2308f8d571..08dc9f2c8f97ab6fa604326ffa95ae0775c45ba3 100644 (file)
@@ -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;
 }
index 376cf6928bdd51c4e2bda2f9921fd9d2ee713ddd..9680b85f0c65b2b850b398765bc49074eb029624 100644 (file)
@@ -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);
                                }
                        }
                }
index 88ed87ec912dbef1fc522263830924741b9d2200..7016554a1b5aed87abb1ed3b5dd7aaaa9d885a07 100644 (file)
@@ -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