本文整理匯總了C++中ED_region_tag_redraw函數的典型用法代碼示例。如果您正苦於以下問題:C++ ED_region_tag_redraw函數的具體用法?C++ ED_region_tag_redraw怎麽用?C++ ED_region_tag_redraw使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ED_region_tag_redraw函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: datadropper_id_sample_pt
/**
* \brief get the ID from the screen.
*
*/
static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int my, ID **r_id)
{
/* we could use some clever */
wmWindow *win = CTX_wm_window(C);
ScrArea *sa;
ScrArea *area_prev = CTX_wm_area(C);
ARegion *ar_prev = CTX_wm_region(C);
ddr->name[0] = '\0';
for (sa = win->screen->areabase.first; sa; sa = sa->next) {
if (BLI_rcti_isect_pt(&sa->totrct, mx, my)) {
if (sa->spacetype == SPACE_VIEW3D) {
ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
int mval[2] = {mx - ar->winrct.xmin,
my - ar->winrct.ymin};
Base *base;
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* grr, always draw else we leave stale text */
ED_region_tag_redraw(ar);
base = ED_view3d_give_base_under_cursor(C, mval);
if (base) {
Object *ob = base->object;
ID *id = NULL;
if (ddr->idcode == ID_OB) {
id = (ID *)ob;
}
else if (ob->data) {
if (GS(((ID *)ob->data)->name) == ddr->idcode) {
id = (ID *)ob->data;
}
else {
BLI_snprintf(ddr->name, sizeof(ddr->name), "Incompatible, expected a %s",
ddr->idcode_name);
}
}
if (id) {
BLI_snprintf(ddr->name, sizeof(ddr->name), "%s: %s",
ddr->idcode_name, id->name + 2);
*r_id = id;
}
break;
}
}
}
}
}
CTX_wm_area_set(C, area_prev);
CTX_wm_region_set(C, ar_prev);
}
示例2: depthdropper_depth_sample_pt
/**
* \brief get the ID from the screen.
*/
static void depthdropper_depth_sample_pt(
bContext *C, DepthDropper *ddr, int mx, int my, float *r_depth)
{
/* we could use some clever */
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, mx, my);
Scene *scene = CTX_data_scene(C);
ScrArea *area_prev = CTX_wm_area(C);
ARegion *ar_prev = CTX_wm_region(C);
ddr->name[0] = '\0';
if (sa) {
if (sa->spacetype == SPACE_VIEW3D) {
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
if (ar) {
struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
View3D *v3d = sa->spacedata.first;
RegionView3D *rv3d = ar->regiondata;
/* weak, we could pass in some reference point */
const float *view_co = v3d->camera ? v3d->camera->obmat[3] : rv3d->viewinv[3];
const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
float co[3];
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* grr, always draw else we leave stale text */
ED_region_tag_redraw(ar);
view3d_operator_needs_opengl(C);
if (ED_view3d_autodist(depsgraph, ar, v3d, mval, co, true, NULL)) {
const float mval_center_fl[2] = {(float)ar->winx / 2, (float)ar->winy / 2};
float co_align[3];
/* quick way to get view-center aligned point */
ED_view3d_win_to_3d(v3d, ar, co, mval_center_fl, co_align);
*r_depth = len_v3v3(view_co, co_align);
bUnit_AsString2(ddr->name,
sizeof(ddr->name),
(double)*r_depth,
4,
B_UNIT_LENGTH,
&scene->unit,
false);
}
else {
BLI_strncpy(ddr->name, "Nothing under cursor", sizeof(ddr->name));
}
}
}
}
CTX_wm_area_set(C, area_prev);
CTX_wm_region_set(C, ar_prev);
}
示例3: clip_view_ndof_invoke
static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
if (event->type != NDOF_MOTION)
return OPERATOR_CANCELLED;
else {
SpaceClip *sc = CTX_wm_space_clip(C);
ARegion *ar = CTX_wm_region(C);
float pan_vec[3];
const wmNDOFMotionData *ndof = event->customdata;
const float speed = NDOF_PIXELS_PER_SECOND;
WM_event_ndof_pan_get(ndof, pan_vec, true);
mul_v2_fl(pan_vec, (speed * ndof->dt) / sc->zoom);
pan_vec[2] *= -ndof->dt;
sclip_zoom_set_factor(C, 1.0f + pan_vec[2], NULL);
sc->xof += pan_vec[0];
sc->yof += pan_vec[1];
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
}
示例4: face_select_reveal_exec
static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
paintface_reveal(ob);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
示例5: snode_bg_viewmove_modal
static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
ARegion *ar = CTX_wm_region(C);
NodeViewMove *nvm = op->customdata;
switch (event->type) {
case MOUSEMOVE:
snode->xof -= (nvm->mvalo[0] - event->mval[0]);
snode->yof -= (nvm->mvalo[1] - event->mval[1]);
nvm->mvalo[0] = event->mval[0];
nvm->mvalo[1] = event->mval[1];
/* prevent dragging image outside of the window and losing it! */
CLAMP(snode->xof, nvm->xmin, nvm->xmax);
CLAMP(snode->yof, nvm->ymin, nvm->ymax);
ED_region_tag_redraw(ar);
WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL);
break;
case LEFTMOUSE:
case MIDDLEMOUSE:
case RIGHTMOUSE:
MEM_freeN(nvm);
op->customdata = NULL;
return OPERATOR_FINISHED;
}
return OPERATOR_RUNNING_MODAL;
}
示例6: view_zoom_modal
static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
ViewZoomData *vpd = op->customdata;
float delta, factor;
switch (event->type) {
case MOUSEMOVE:
delta = event->x - vpd->x + event->y - vpd->y;
if (U.uiflag & USER_ZOOM_INVERT)
delta *= -1;
factor = 1.0f + delta / 300.0f;
RNA_float_set(op->ptr, "factor", factor);
sclip_zoom_set(C, vpd->zoom * factor, vpd->location);
ED_region_tag_redraw(CTX_wm_region(C));
break;
default:
if (event->type == vpd->event_type && event->val == KM_RELEASE) {
view_zoom_exit(C, op, 0);
return OPERATOR_FINISHED;
}
break;
}
return OPERATOR_RUNNING_MODAL;
}
示例7: face_select_all_exec
static int face_select_all_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
paintface_deselect_all_visible(ob, RNA_enum_get(op->ptr, "action"), true);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
示例8: dopesheet_view_all_exec
static int dopesheet_view_all_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceClip *sc = CTX_wm_space_clip(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
MovieTrackingDopesheetChannel *channel;
int frame_min = INT_MAX, frame_max = INT_MIN;
for (channel = dopesheet->channels.first; channel; channel = channel->next) {
frame_min = min_ii(frame_min, channel->segments[0]);
frame_max = max_ii(frame_max, channel->segments[channel->tot_segment]);
}
if (frame_min < frame_max) {
float extra;
v2d->cur.xmin = frame_min;
v2d->cur.xmax = frame_max;
/* we need an extra "buffer" factor on either side so that the endpoints are visible */
extra = 0.01f * BLI_rctf_size_x(&v2d->cur);
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
ED_region_tag_redraw(ar);
}
return OPERATOR_FINISHED;
}
示例9: face_select_hide_exec
static int face_select_hide_exec(bContext *C, wmOperator *op)
{
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
Object *ob = CTX_data_active_object(C);
paintface_hide(ob, unselected);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
示例10: paint_select_linked_pick_invoke
static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
const bool select = !RNA_boolean_get(op->ptr, "deselect");
view3d_operator_needs_opengl(C);
paintface_select_linked(C, CTX_data_active_object(C), event->mval, select);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
示例11: wm_tag_redraw_overlay
void wm_tag_redraw_overlay(wmWindow *win, ARegion *ar)
{
/* for draw triple gestures, paint cursors don't need region redraw */
if (ar && win) {
if (wm_automatic_draw_method(win) != USER_DRAW_TRIPLE)
ED_region_tag_redraw(ar);
win->screen->do_draw_paintcursor = true;
}
}
示例12: do_item_rename
/* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// */
static void do_item_rename(ARegion *ar, LiveDbTreeElement *te, ReportList *reports)
{
if (TE_GET_TYPE(te->item->type) != MAT_LDB_TREE_ITEM_TYPE_MATERIAL)
BKE_report(reports, RPT_WARNING, "Can edit only the material names.");
else {
*te->flag |= TE_TEXTBUT;
ED_region_tag_redraw(ar);
}
} /* do_item_rename() */
示例13: datadropper_id_sample_pt
/**
* \brief get the ID from the screen.
*/
static void datadropper_id_sample_pt(bContext *C, DataDropper *ddr, int mx, int my, ID **r_id)
{
/* we could use some clever */
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = BKE_screen_find_area_xy(screen, -1, mx, my);
ScrArea *area_prev = CTX_wm_area(C);
ARegion *ar_prev = CTX_wm_region(C);
ddr->name[0] = '\0';
if (sa) {
if (sa->spacetype == SPACE_VIEW3D) {
ARegion *ar = BKE_area_find_region_xy(sa, RGN_TYPE_WINDOW, mx, my);
if (ar) {
const int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin};
Base *base;
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* grr, always draw else we leave stale text */
ED_region_tag_redraw(ar);
base = ED_view3d_give_base_under_cursor(C, mval);
if (base) {
Object *ob = base->object;
ID *id = NULL;
if (ddr->idcode == ID_OB) {
id = (ID *)ob;
}
else if (ob->data) {
if (GS(((ID *)ob->data)->name) == ddr->idcode) {
id = (ID *)ob->data;
}
else {
BLI_snprintf(
ddr->name, sizeof(ddr->name), "Incompatible, expected a %s", ddr->idcode_name);
}
}
PointerRNA idptr;
RNA_id_pointer_create(id, &idptr);
if (id && RNA_property_pointer_poll(&ddr->ptr, ddr->prop, &idptr)) {
BLI_snprintf(ddr->name, sizeof(ddr->name), "%s: %s", ddr->idcode_name, id->name + 2);
*r_id = id;
}
}
}
}
}
CTX_wm_area_set(C, area_prev);
CTX_wm_region_set(C, ar_prev);
}
示例14: vertex_color_set_exec
static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
unsigned int paintcol = vpaint_get_current_col(scene->toolsettings->vpaint);
vpaint_fill(obact, paintcol);
ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views
return OPERATOR_FINISHED;
}
示例15: center_current_frame_exec
static int center_current_frame_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C);
ED_clip_graph_center_current_frame(scene, ar);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}