Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_image_proj.c
| Show First 20 Lines • Show All 5,449 Lines • ▼ Show 20 Lines | |||||
| static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) | static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Image *image; | Image *image; | ||||
| ImBuf *ibuf; | ImBuf *ibuf; | ||||
| char filename[FILE_MAX]; | char filename[FILE_MAX]; | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| WorkSpace *workspace = CTX_wm_workspace(C); | |||||
| SceneLayer *sl = CTX_data_scene_layer(C); | SceneLayer *sl = CTX_data_scene_layer(C); | ||||
| EvaluationContext eval_ctx; | EvaluationContext eval_ctx; | ||||
| ToolSettings *settings = scene->toolsettings; | ToolSettings *settings = scene->toolsettings; | ||||
| int w = settings->imapaint.screen_grab_size[0]; | int w = settings->imapaint.screen_grab_size[0]; | ||||
| int h = settings->imapaint.screen_grab_size[1]; | int h = settings->imapaint.screen_grab_size[1]; | ||||
| int maxsize; | int maxsize; | ||||
| char err_out[256] = "unknown"; | char err_out[256] = "unknown"; | ||||
| CTX_data_eval_ctx(C, &eval_ctx); | CTX_data_eval_ctx(C, &eval_ctx); | ||||
| RNA_string_get(op->ptr, "filepath", filename); | RNA_string_get(op->ptr, "filepath", filename); | ||||
| maxsize = GPU_max_texture_size(); | maxsize = GPU_max_texture_size(); | ||||
| if (w > maxsize) w = maxsize; | if (w > maxsize) w = maxsize; | ||||
| if (h > maxsize) h = maxsize; | if (h > maxsize) h = maxsize; | ||||
| ibuf = ED_view3d_draw_offscreen_imbuf( | ibuf = ED_view3d_draw_offscreen_imbuf( | ||||
| &eval_ctx, scene, sl, CTX_wm_view3d(C), CTX_wm_region(C), | &eval_ctx, scene, workspace, sl, CTX_wm_view3d(C), CTX_wm_region(C), | ||||
| w, h, IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, | w, h, IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, | ||||
| NULL, NULL, err_out); | NULL, NULL, err_out); | ||||
| if (!ibuf) { | if (!ibuf) { | ||||
| /* Mostly happens when OpenGL offscreen buffer was failed to create, */ | /* Mostly happens when OpenGL offscreen buffer was failed to create, */ | ||||
| /* but could be other reasons. Should be handled in the future. nazgul */ | /* but could be other reasons. Should be handled in the future. nazgul */ | ||||
| BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL off-screen buffer: %s", err_out); | BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL off-screen buffer: %s", err_out); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 479 Lines • Show Last 20 Lines | |||||