Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/buttons_editing.c23
-rw-r--r--source/blender/src/editaction.c9
-rw-r--r--source/blender/src/poselib.c9
3 files changed, 36 insertions, 5 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 732d690ae7d..377555597cf 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -3864,6 +3864,7 @@ void do_armbuts(unsigned short event)
grp= MEM_callocN(sizeof(bActionGroup), "PoseGroup");
strcpy(grp->name, "Group");
BLI_addtail(&pose->agroups, grp);
+ BLI_uniquename(&pose->agroups, grp, "Group", offsetof(bActionGroup, name), 32);
pose->active_group= BLI_countlist(&pose->agroups);
@@ -5050,6 +5051,22 @@ char *get_vertexgroup_menustr(Object *ob)
return menustr;
}
+static void verify_poselib_posename(void *arg1, void *arg2)
+{
+ bAction *act= (bAction *)arg1;
+ TimeMarker *marker= (TimeMarker *)arg2;
+
+ BLI_uniquename(&act->markers, marker, "Pose", offsetof(TimeMarker, name), 64);
+}
+
+static void verify_posegroup_groupname(void *arg1, void *arg2)
+{
+ bPose *pose= (bPose *)arg1;
+ bActionGroup *grp= (bActionGroup *)arg2;
+
+ BLI_uniquename(&pose->agroups, grp, "Group", offsetof(bActionGroup, name), 32);
+}
+
static void editing_panel_links(Object *ob)
{
uiBlock *block;
@@ -5165,7 +5182,8 @@ static void editing_panel_links(Object *ob)
if (act->active_marker) {
TimeMarker *marker= poselib_get_active_pose(act);
- uiDefBut(block, TEX, REDRAWBUTSEDIT,"", xco+18,85,160-18-20,20, marker->name, 0, 63, 0, 0, "Displays current Pose Library Pose name. Click to change.");
+ but= uiDefBut(block, TEX, REDRAWBUTSEDIT,"", xco+18,85,160-18-20,20, marker->name, 0, 63, 0, 0, "Displays current Pose Library Pose name. Click to change.");
+ uiButSetFunc(but, verify_poselib_posename, act, marker);
uiDefIconBut(block, BUT, B_POSELIB_REMOVEP, VICON_X, xco+160-20, 85, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove this Pose Library Pose from Pose Library.");
}
}
@@ -5198,7 +5216,8 @@ static void editing_panel_links(Object *ob)
bActionGroup *grp= (bActionGroup *)BLI_findlink(&pose->agroups, pose->active_group-1);
/* active group */
- uiDefBut(block, TEX, REDRAWBUTSEDIT,"", xco+18,85,140-18-20,20, grp->name, 0, 63, 0, 0, "Displays current Pose Group name. Click to change.");
+ but= uiDefBut(block, TEX, REDRAWBUTSEDIT,"", xco+18,85,140-18-20,20, grp->name, 0, 63, 0, 0, "Displays current Pose Group name. Click to change.");
+ uiButSetFunc(but, verify_posegroup_groupname, pose, grp);
uiDefIconBut(block, BUT, B_POSEGRP_REMOVE, VICON_X, xco+140-20, 85, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove this Pose Group");
/* set custom color set */
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 45ae0a72ad1..cb436e8bff1 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -31,6 +31,7 @@
*/
#include <string.h>
+#include <stddef.h>
#include <math.h>
#include "MEM_guardedalloc.h"
@@ -947,6 +948,7 @@ void action_groups_group (short add_group)
sprintf(agrp->name, "Group");
BLI_addtail(&act->groups, agrp);
+ BLI_uniquename(&act->groups, agrp, "Group", offsetof(bActionGroup, name), 32);
set_active_actiongroup(act, agrp, 1);
@@ -2140,6 +2142,7 @@ static void numbuts_action ()
}
else if (agrp) {
strcpy(agrp->name, str);
+ BLI_uniquename(&( ((bAction *)data)->groups ), agrp, "Group", offsetof(bActionGroup, name), 32);
if (expand) agrp->flag |= AGRP_EXPANDED;
else agrp->flag &= ~AGRP_EXPANDED;
@@ -3724,6 +3727,9 @@ void action_add_localmarker (bAction *act, int frame)
BLI_addtail(&act->markers, marker);
}
+ /* validate the name */
+ BLI_uniquename(&act->markers, marker, "Pose", offsetof(TimeMarker, name), 64);
+
/* sets the newly added marker as the active one */
action_set_activemarker(act, marker, 1);
@@ -3758,8 +3764,9 @@ void action_rename_localmarker (bAction *act)
if (sbutton(name, 0, sizeof(name)-1, "Name: ") == 0)
return;
- /* copy name */
+ /* copy then validate name */
BLI_strncpy(marker->name, name, sizeof(marker->name));
+ BLI_uniquename(&act->markers, marker, "Pose", offsetof(TimeMarker, name), 64);
/* undo and update */
BIF_undo_push("Action Rename Marker");
diff --git a/source/blender/src/poselib.c b/source/blender/src/poselib.c
index 441ba0eab52..44277e17804 100644
--- a/source/blender/src/poselib.c
+++ b/source/blender/src/poselib.c
@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <stddef.h>
#include <string.h>
#include <math.h>
@@ -345,7 +346,7 @@ void poselib_add_current_pose (Object *ob, int val)
/* get/initialise poselib */
act= poselib_validate(ob);
- /* validate name and get frame */
+ /* get frame */
frame= poselib_get_free_index(act);
/* add pose to poselib - replaces any existing pose there */
@@ -363,6 +364,9 @@ void poselib_add_current_pose (Object *ob, int val)
BLI_addtail(&act->markers, marker);
}
+
+ /* validate name */
+ BLI_uniquename(&act->markers, marker, "Pose", offsetof(TimeMarker, name), 64);
}
/* loop through selected posechannels, keying their pose to the action */
@@ -504,8 +508,9 @@ void poselib_rename_pose (Object *ob)
if (sbutton(name, 0, sizeof(name)-1, "Name: ") == 0)
return;
- /* copy name */
+ /* copy name and validate it */
BLI_strncpy(marker->name, name, sizeof(marker->name));
+ BLI_uniquename(&act->markers, marker, "Pose", offsetof(TimeMarker, name), 64);
/* undo and update */
BIF_undo_push("PoseLib Rename Pose");