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:
authorCampbell Barton <ideasman42@gmail.com>2011-01-06 07:35:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-06 07:35:57 +0300
commitbba20eb5ae5e20a1ce4dcf74fa50bf6971315423 (patch)
tree0b7bd85c4f5246ab469def624f97be60771857b2 /source/blender/editors/animation
parent68b931b03f8ed0e082850192478f79513063dd62 (diff)
use ED_markers_get_first_selected() where possible, simplify ed_marker_rename_exec
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_markers.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 924cd346865..4e77e15b282 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -1192,29 +1192,19 @@ static void MARKER_OT_delete(wmOperatorType *ot)
/* rename first selected TimeMarker */
static int ed_marker_rename_exec(bContext *C, wmOperator *op)
{
- ListBase *markers= context_get_markers(C);
- TimeMarker *marker;
- short changed= 0;
-
- if (markers == NULL)
- return OPERATOR_CANCELLED;
-
- for (marker= markers->first; marker; marker= marker->next) {
- if (marker->flag & SELECT) {
- /* directly get new name */
- RNA_string_get(op->ptr, "name", marker->name);
-
- changed= 1;
- break;
- }
- }
-
- if (changed) {
+ TimeMarker *marker= ED_markers_get_first_selected(context_get_markers(C));
+
+ if(marker) {
+ RNA_string_get(op->ptr, "name", marker->name);
+
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
+
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
}
-
- return OPERATOR_FINISHED;
}
static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
@@ -1244,7 +1234,7 @@ static void MARKER_OT_rename(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- ot->prop = RNA_def_string(ot->srna, "name", "RenamedMarker", 64, "Name", "New name for marker");
+ ot->prop = RNA_def_string(ot->srna, "name", "RenamedMarker", sizeof(((TimeMarker *)NULL)->name), "Name", "New name for marker");
//RNA_def_boolean(ot->srna, "ensure_unique", 0, "Ensure Unique", "Ensure that new name is unique within collection of markers");
}