Manipulator: name setting function

Default name includes group-name,
we may want to set the name without a prefix.
This commit is contained in:
Campbell Barton 2017-06-26 13:16:25 +10:00
parent 3a1f77650d
commit a4f16c63a2
2 changed files with 11 additions and 0 deletions

View File

@ -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);

View File

@ -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.
*/