[Bf-blender-cvs] [a4f16c63a29] blender2.8: Manipulator: name setting function
Campbell Barton
noreply at git.blender.org
Mon Jun 26 05:11:07 CEST 2017
Commit: a4f16c63a29217d5636851a57d4bd714930d8fa4
Author: Campbell Barton
Date: Mon Jun 26 13:16:25 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBa4f16c63a29217d5636851a57d4bd714930d8fa4
Manipulator: name setting function
Default name includes group-name,
we may want to set the name without a prefix.
===================================================================
M source/blender/windowmanager/manipulators/WM_manipulator_api.h
M source/blender/windowmanager/manipulators/intern/wm_manipulator.c
===================================================================
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
index ecb0af818b2..50215e38847 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
@@ -67,6 +67,8 @@ void WM_manipulator_free(
ListBase *manipulatorlist, struct wmManipulatorMap *mmap, struct wmManipulator *mpr,
struct bContext *C);
+void WM_manipulator_name_set(struct wmManipulatorGroup *mgroup, struct wmManipulator *mpr, const char *name);
+
struct PointerRNA *WM_manipulator_set_operator(
struct wmManipulator *, struct wmOperatorType *ot, struct IDProperty *properties);
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
index d11defc4e98..d8d530a4db9 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
@@ -142,6 +142,15 @@ static void manipulator_unique_idname_set(wmManipulatorGroup *mgroup, wmManipula
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));
+}
+
/**
* Initialize default values and allocate needed memory for members.
*/
More information about the Bf-blender-cvs
mailing list