本文整理汇总了C++中ED_context_get_markers函数的典型用法代码示例。如果您正苦于以下问题:C++ ED_context_get_markers函数的具体用法?C++ ED_context_get_markers怎么用?C++ ED_context_get_markers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ED_context_get_markers函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: draw_markers_time
/* Draw Scene-Markers in time window */
void draw_markers_time(const bContext *C, int flag)
{
ListBase *markers = ED_context_get_markers(C);
View2D *v2d;
TimeMarker *marker;
Scene *scene;
if (markers == NULL)
return;
scene = CTX_data_scene(C);
v2d = UI_view2d_fromcontext(C);
/* unselected markers are drawn at the first time */
for (marker = markers->first; marker; marker = marker->next) {
if ((marker->flag & SELECT) == 0) {
draw_marker(v2d, marker, scene->r.cfra, flag);
}
}
/* selected markers are drawn later */
for (marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
draw_marker(v2d, marker, scene->r.cfra, flag);
}
}
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:28,代码来源:anim_markers.c
示例2: ed_marker_make_links_scene_exec
static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
{
ListBase *markers = ED_context_get_markers(C);
Scene *scene_to = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
TimeMarker *marker, *marker_new;
if (scene_to == NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
if (scene_to == CTX_data_scene(C)) {
BKE_report(op->reports, RPT_ERROR, "Cannot re-link markers into the same scene");
return OPERATOR_CANCELLED;
}
/* copy markers */
for (marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
marker_new = MEM_dupallocN(marker);
marker_new->prev = marker_new->next = NULL;
BLI_addtail(&scene_to->markers, marker_new);
}
}
return OPERATOR_FINISHED;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:28,代码来源:anim_markers.c
示例3: ed_marker_add
/* add TimeMarker at curent frame */
static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
{
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker;
int frame = CTX_data_scene(C)->r.cfra;
if (markers == NULL)
return OPERATOR_CANCELLED;
/* prefer not having 2 markers at the same place,
* though the user can move them to overlap once added */
for (marker = markers->first; marker; marker = marker->next) {
if (marker->frame == frame)
return OPERATOR_CANCELLED;
}
/* deselect all */
for (marker = markers->first; marker; marker = marker->next)
marker->flag &= ~SELECT;
marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
marker->flag = SELECT;
marker->frame = frame;
BLI_snprintf(marker->name, sizeof(marker->name), "F_%02d", frame); // XXX - temp code only
BLI_addtail(markers, marker);
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
return OPERATOR_FINISHED;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:32,代码来源:anim_markers.c
示例4: ed_marker_select_all_exec
static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
{
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker;
int action = RNA_enum_get(op->ptr, "action");
if (markers == NULL)
return OPERATOR_CANCELLED;
if (action == SEL_TOGGLE) {
action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
}
for (marker = markers->first; marker; marker = marker->next) {
switch (action) {
case SEL_SELECT:
marker->flag |= SELECT;
break;
case SEL_DESELECT:
marker->flag &= ~SELECT;
break;
case SEL_INVERT:
marker->flag ^= SELECT;
break;
}
}
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
return OPERATOR_FINISHED;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:32,代码来源:anim_markers.c
示例5: ed_marker_move_init
/* return 0 if not OK */
static int ed_marker_move_init(bContext *C, wmOperator *op)
{
ListBase *markers = ED_context_get_markers(C);
MarkerMove *mm;
TimeMarker *marker;
int totmark = 0;
int a;
if (markers == NULL) return 0;
for (marker = markers->first; marker; marker = marker->next)
if (marker->flag & SELECT) totmark++;
if (totmark == 0) return 0;
op->customdata = mm = MEM_callocN(sizeof(MarkerMove), "Markermove");
mm->slink = CTX_wm_space_data(C);
mm->markers = markers;
mm->oldframe = MEM_callocN(totmark * sizeof(int), "MarkerMove oldframe");
initNumInput(&mm->num);
mm->num.idx_max = 0; /* one axis */
mm->num.flag |= NUM_NO_FRACTION;
mm->num.increment = 1.0f;
for (a = 0, marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
mm->oldframe[a] = marker->frame;
a++;
}
}
return 1;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:35,代码来源:anim_markers.c
示例6: ED_markers_draw
/* Draw Scene-Markers in time window */
void ED_markers_draw(const bContext *C, int flag)
{
ListBase *markers = ED_context_get_markers(C);
View2D *v2d;
TimeMarker *marker;
Scene *scene;
int select_pass;
int v2d_clip_range_x[2];
float font_width_max;
/* cache values */
float ypixels, xscale, yscale;
if (markers == NULL || BLI_listbase_is_empty(markers)) {
return;
}
scene = CTX_data_scene(C);
v2d = UI_view2d_fromcontext(C);
if (flag & DRAW_MARKERS_MARGIN) {
const unsigned char shade[4] = {0, 0, 0, 16};
glColor4ubv(shade);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glRectf(v2d->cur.xmin, 0, v2d->cur.xmax, UI_MARKER_MARGIN_Y);
glDisable(GL_BLEND);
}
/* no time correction for framelen! space is drawn with old values */
ypixels = BLI_rcti_size_y(&v2d->mask);
UI_view2d_scale_get(v2d, &xscale, &yscale);
glScalef(1.0f / xscale, 1.0f, 1.0f);
/* x-bounds with offset for text (adjust for long string, avoid checking string width) */
font_width_max = (10 * UI_DPI_FAC) / xscale;
v2d_clip_range_x[0] = v2d->cur.xmin - (sizeof(marker->name) * font_width_max);
v2d_clip_range_x[1] = v2d->cur.xmax + font_width_max;
/* loop [unselected, selected] */
for (select_pass = 0; select_pass <= SELECT; select_pass += SELECT) {
/* unselected markers are drawn at the first time */
for (marker = markers->first; marker; marker = marker->next) {
if ((marker->flag & SELECT) == select_pass) {
/* bounds check */
if ((marker->frame >= v2d_clip_range_x[0]) &&
(marker->frame <= v2d_clip_range_x[1]))
{
draw_marker(v2d, marker, scene->r.cfra, flag,
ypixels, xscale, yscale);
}
}
}
}
glScalef(xscale, 1.0f, 1.0f);
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:61,代码来源:anim_markers.c
示例7: ed_marker_duplicate_apply
/* duplicate selected TimeMarkers */
static void ed_marker_duplicate_apply(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker, *newmarker;
if (markers == NULL)
return;
/* go through the list of markers, duplicate selected markers and add duplicated copies
* to the beginning of the list (unselect original markers)
*/
for (marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
/* unselect selected marker */
marker->flag &= ~SELECT;
/* create and set up new marker */
newmarker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
newmarker->flag = SELECT;
newmarker->frame = marker->frame;
BLI_strncpy(newmarker->name, marker->name, sizeof(marker->name));
#ifdef DURIAN_CAMERA_SWITCH
newmarker->camera = marker->camera;
#endif
/* new marker is added to the beginning of list */
// FIXME: bad ordering!
BLI_addhead(markers, newmarker);
}
}
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:33,代码来源:anim_markers.c
示例8: ed_marker_rename_invoke_wrapper
static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
{
/* must initialize the marker name first if there is a marker selected */
TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C));
if (marker)
RNA_string_set(op->ptr, "name", marker->name);
/* now see if the operator is usable */
return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup);
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:10,代码来源:anim_markers.c
示例9: ed_markers_poll_selected_markers
/* special poll() which checks if there are selected markers first */
static int ed_markers_poll_selected_markers(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
/* first things first: markers can only exist in timeline views */
if (ED_operator_animview_active(C) == 0)
return 0;
/* check if some marker is selected */
return ED_markers_get_first_selected(markers) != NULL;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:12,代码来源:anim_markers.c
示例10: ed_markers_poll_markers_exist
/* special poll() which checks if there are any markers at all first */
static int ed_markers_poll_markers_exist(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
/* first things first: markers can only exist in timeline views */
if (ED_operator_animview_active(C) == 0)
return 0;
/* list of markers must exist, as well as some markers in it! */
return (markers && markers->first);
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:12,代码来源:anim_markers.c
示例11: ed_marker_rename_exec
/* rename first selected TimeMarker */
static int ed_marker_rename_exec(bContext *C, wmOperator *op)
{
TimeMarker *marker = ED_markers_get_first_selected(ED_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;
}
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:17,代码来源:anim_markers.c
示例12: ed_marker_move_init
/* return 0 if not OK */
static bool ed_marker_move_init(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
ListBase *markers = ED_context_get_markers(C);
MarkerMove *mm;
TimeMarker *marker;
int a, totmark;
if (markers == NULL) {
return false;
}
for (totmark = 0, marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
totmark++;
}
}
if (totmark == 0) {
return false;
}
op->customdata = mm = MEM_callocN(sizeof(MarkerMove), "Markermove");
mm->slink = CTX_wm_space_data(C);
mm->markers = markers;
mm->oldframe = MEM_callocN(totmark * sizeof(int), "MarkerMove oldframe");
initNumInput(&mm->num);
mm->num.idx_max = 0; /* one axis */
mm->num.val_flag[0] |= NUM_NO_FRACTION;
mm->num.unit_sys = scene->unit.system;
/* No time unit supporting frames currently... */
mm->num.unit_type[0] = ed_marker_move_use_time(mm) ? B_UNIT_TIME : B_UNIT_NONE;
for (a = 0, marker = markers->first; marker; marker = marker->next) {
if (marker->flag & SELECT) {
mm->oldframe[a] = marker->frame;
a++;
}
}
return true;
}
开发者ID:caomw,项目名称:blender-ui,代码行数:44,代码来源:anim_markers.c
示例13: ed_marker_border_select_exec
static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
{
View2D *v2d = UI_view2d_fromcontext(C);
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker;
int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
bool extend = RNA_boolean_get(op->ptr, "extend");
rctf rect;
WM_operator_properties_border_to_rctf(op, &rect);
UI_view2d_region_to_view_rctf(v2d, &rect, &rect);
if (markers == NULL)
return 0;
/* XXX marker context */
for (marker = markers->first; marker; marker = marker->next) {
if (BLI_rctf_isect_x(&rect, marker->frame)) {
switch (gesture_mode) {
case GESTURE_MODAL_SELECT:
marker->flag |= SELECT;
break;
case GESTURE_MODAL_DESELECT:
marker->flag &= ~SELECT;
break;
}
}
else if (!extend) {
marker->flag &= ~SELECT;
}
}
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
return 1;
}
开发者ID:caomw,项目名称:blender-ui,代码行数:37,代码来源:anim_markers.c
示例14: ed_marker_delete_exec
/* remove selected TimeMarkers */
static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker, *nmarker;
short changed = 0;
if (markers == NULL)
return OPERATOR_CANCELLED;
for (marker = markers->first; marker; marker = nmarker) {
nmarker = marker->next;
if (marker->flag & SELECT) {
BLI_freelinkN(markers, marker);
changed = 1;
}
}
if (changed) {
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
}
return OPERATOR_FINISHED;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:25,代码来源:anim_markers.c
示例15: ed_marker_camera_bind_exec
static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
{
bScreen *sc = CTX_wm_screen(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
ListBase *markers = ED_context_get_markers(C);
TimeMarker *marker;
marker = ED_markers_get_first_selected(markers);
if (marker == NULL)
return OPERATOR_CANCELLED;
marker->camera = ob;
/* camera may have changes */
BKE_scene_camera_switch_update(scene);
BKE_screen_view3d_scene_sync(sc);
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene); /* so we get view3d redraws */
return OPERATOR_FINISHED;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:24,代码来源:anim_markers.c
示例16: ed_marker_select
static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool camera)
{
ListBase *markers = ED_context_get_markers(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = UI_view2d_fromcontext(C);
float viewx;
int x, y, cfra;
if (markers == NULL)
return OPERATOR_PASS_THROUGH;
x = event->x - ar->winrct.xmin;
y = event->y - ar->winrct.ymin;
UI_view2d_region_to_view(v2d, x, y, &viewx, NULL);
cfra = ED_markers_find_nearest_marker_time(markers, viewx);
if (extend)
select_timeline_marker_frame(markers, cfra, 1);
else
select_timeline_marker_frame(markers, cfra, 0);
#ifdef DURIAN_CAMERA_SWITCH
if (camera) {
Scene *scene = CTX_data_scene(C);
Base *base;
TimeMarker *marker;
int sel = 0;
if (!extend)
BKE_scene_base_deselect_all(scene);
for (marker = markers->first; marker; marker = marker->next) {
if (marker->frame == cfra) {
sel = (marker->flag & SELECT);
break;
}
}
for (marker = markers->first; marker; marker = marker->next) {
if (marker->camera) {
if (marker->frame == cfra) {
base = BKE_scene_base_find(scene, marker->camera);
if (base) {
ED_base_object_select(base, sel);
if (sel)
ED_base_object_activate(C, base);
}
}
}
}
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
#else
(void)camera;
#endif
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
/* allowing tweaks, but needs OPERATOR_FINISHED, otherwise renaming fails... [#25987] */
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
开发者ID:JasonWilkins,项目名称:blender-wayland,代码行数:66,代码来源:anim_markers.c
注:本文中的ED_context_get_markers函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论