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')
-rw-r--r--source/blender/editors/animation/anim_markers.c2
-rw-r--r--source/blender/editors/space_action/action_edit.c84
-rw-r--r--source/blender/editors/space_action/action_intern.h2
-rw-r--r--source/blender/editors/space_action/action_ops.c2
4 files changed, 88 insertions, 2 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 6aa8e010cc2..eaf7590f7dc 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -365,7 +365,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
}
#ifdef DURIAN_CAMERA_SWITCH
- if(marker->camera && marker->camera->restrictflag & OB_RESTRICT_RENDER) {
+ if(marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
float col[4];
glGetFloatv(GL_CURRENT_COLOR, col);
col[3]= 0.4;
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index 2c3a88c390e..4f7bddc5c40 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -121,7 +121,7 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op))
void ACTION_OT_new (wmOperatorType *ot)
{
/* identifiers */
- ot->name= "New";
+ ot->name= "New Action";
ot->idname= "ACTION_OT_new";
ot->description= "Create new action";
@@ -135,6 +135,88 @@ void ACTION_OT_new (wmOperatorType *ot)
}
/* ************************************************************************** */
+/* POSE MARKERS STUFF */
+
+/* *************************** Localise Markers ***************************** */
+
+/* ensure that there is:
+ * 1) an active action editor
+ * 2) that the mode will have an active action available
+ * 3) that the set of markers being shown are the scene markers, not the list we're merging
+ * 4) that there are some selected markers
+ */
+static int act_markers_make_local_poll(bContext *C)
+{
+ SpaceAction *sact = CTX_wm_space_action(C);
+
+ /* 1) */
+ if (sact == NULL)
+ return 0;
+
+ /* 2) */
+ if (ELEM(sact->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) == 0)
+ return 0;
+ if (sact->action == NULL)
+ return 0;
+
+ /* 3) */
+ if (sact->flag & SACTION_POSEMARKERS_SHOW)
+ return 0;
+
+ /* 4) */
+ return ED_markers_get_first_selected(ED_context_get_markers(C)) != NULL;
+}
+
+static int act_markers_make_local_exec (bContext *C, wmOperator *op)
+{
+ ListBase *markers = ED_context_get_markers(C);
+
+ SpaceAction *sact = CTX_wm_space_action(C);
+ bAction *act = (sact)? sact->action : NULL;
+
+ TimeMarker *marker, *markern=NULL;
+
+ /* sanity checks */
+ if (ELEM(NULL, markers, act))
+ return OPERATOR_CANCELLED;
+
+ /* migrate markers */
+ for (marker = markers->first; marker; marker = markern) {
+ markern = marker->next;
+
+ /* move if marker is selected */
+ if (marker->flag & SELECT) {
+ BLI_remlink(markers, marker);
+ BLI_addtail(&act->markers, marker);
+ }
+ }
+
+ /* now enable the "show posemarkers only" setting, so that we can see that something did happen */
+ sact->flag |= SACTION_POSEMARKERS_SHOW;
+
+ /* notifiers - both sets, as this change affects both */
+ WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void ACTION_OT_markers_make_local (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Make Markers Local";
+ ot->idname= "ACTION_OT_markers_make_local";
+ ot->description= "Move selected scene markers to the active Action as local 'pose' markers";
+
+ /* callbacks */
+ ot->exec = act_markers_make_local_exec;
+ ot->poll = act_markers_make_local_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/* ************************************************************************** */
/* KEYFRAME-RANGE STUFF */
/* *************************** Calculate Range ************************** */
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index feaf2c2d786..f9a5ac1093d 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -104,6 +104,8 @@ void ACTION_OT_mirror(struct wmOperatorType *ot);
void ACTION_OT_new(struct wmOperatorType *ot);
+void ACTION_OT_markers_make_local(struct wmOperatorType *ot);
+
/* defines for snap keyframes
* NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
*/
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index acb2fa09d04..e82c26488b5 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -79,6 +79,8 @@ void action_operatortypes(void)
WM_operatortype_append(ACTION_OT_previewrange_set);
WM_operatortype_append(ACTION_OT_view_all);
+
+ WM_operatortype_append(ACTION_OT_markers_make_local);
}
/* ************************** registration - keymaps **********************************/