示例#1
0
/* Set the new frame number */
static void change_frame_apply(bContext *C, wmOperator *op)
{
  Main *bmain = CTX_data_main(C);
  Scene *scene = CTX_data_scene(C);
  float frame = RNA_float_get(op->ptr, "frame");
  bool do_snap = RNA_boolean_get(op->ptr, "snap");

  if (do_snap) {
    if (CTX_wm_space_seq(C)) {
      frame = BKE_sequencer_find_next_prev_edit(scene, frame, SEQ_SIDE_BOTH, true, false, false);
    }
    else {
      frame = BKE_scene_frame_snap_by_seconds(scene, 1.0, frame);
    }
  }

  /* set the new frame number */
  if (scene->r.flag & SCER_SHOW_SUBFRAME) {
    CFRA = (int)frame;
    SUBFRA = frame - (int)frame;
  }
  else {
    CFRA = round_fl_to_int(frame);
    SUBFRA = 0.0f;
  }
  FRAMENUMBER_MIN_CLAMP(CFRA);

  /* do updates */
  BKE_sound_seek_scene(bmain, scene);
  WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}
示例#2
0
文件: anim_ops.c 项目: UPBGE/blender
/* Set the new frame number */
static void change_frame_apply(bContext *C, wmOperator *op)
{
	Main *bmain = CTX_data_main(C);
	Scene *scene = CTX_data_scene(C);
	int frame = RNA_int_get(op->ptr, "frame");
	bool do_snap = RNA_boolean_get(op->ptr, "snap");

	if (do_snap && CTX_wm_space_seq(C)) {
		frame = BKE_sequencer_find_next_prev_edit(scene, frame, SEQ_SIDE_BOTH, true, false, false);
	}

	/* set the new frame number */
	CFRA = frame;
	FRAMENUMBER_MIN_CLAMP(CFRA);
	SUBFRA = 0.0f;
	
	/* do updates */
	BKE_sound_seek_scene(bmain, scene);
	WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
}