From d023c4104cb642c839d5868411a3b719f3528421 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Sep 2020 14:45:42 +1000 Subject: Cleanup: spelling, correct comments --- source/blender/editors/curve/editcurve.c | 9 ++++----- source/blender/editors/object/object_constraint.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 2b3df79476a..e6815582a04 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3640,9 +3640,8 @@ static void subdividenurb(Object *obedit, View3D *v3d, int number_cuts) * degree of the functions used to build the NURB. The * expression * - * degree = #knots - #controlpoints + 1 (J Walter piece) - * degree = #knots - #controlpoints (Blender - * implementation) + * `degree = knots - controlpoints + 1` (J Walter piece) + * `degree = knots - controlpoints` (Blender implementation) * ( this is confusing.... what is true? Another concern * is that the JW piece allows the curve to become * explicitly 1st order derivative discontinuous, while @@ -3651,12 +3650,12 @@ static void subdividenurb(Object *obedit, View3D *v3d, int number_cuts) * is an invariant for a single NURB curve. Raising the degree * of the NURB is done elsewhere; the degree is assumed * constant during this operation. Degree is a property shared - * by all controlpoints in a curve (even though it is stored + * by all control-points in a curve (even though it is stored * per control point - this can be misleading). * Adding a knot is done by searching for the place in the * knot vector where a certain knot value must be inserted, or * by picking an appropriate knot value between two existing - * ones. The number of controlpoints that is influenced by the + * ones. The number of control-points that is influenced by the * insertion depends on the order of the curve. A certain * minimum number of knots is needed to form high-order * curves, as can be seen from the equation above. In Blender, diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 8b10a865a68..85522209e29 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -80,8 +80,10 @@ /** \name Constraint Data Accessors * \{ */ -/* If object is in posemode, return active bone constraints, else object constraints. No - * constraints are returned for a bone on an inactive bonelayer. */ +/** + * If object is in pose-mode, return active bone constraints, else object constraints. + * No constraints are returned for a bone on an inactive bone-layer. + */ ListBase *ED_object_constraint_active_list(Object *ob) { if (ob == NULL) { @@ -103,8 +105,10 @@ ListBase *ED_object_constraint_active_list(Object *ob) return NULL; } -/* Get the constraints for the active pose bone. Bone may be on an inactive bonelayer (unlike - * ED_object_constraint_active_list, such constraints are not excluded here). */ +/** + * Get the constraints for the active pose bone. Bone may be on an inactive bone-layer + * (unlike #ED_object_constraint_active_list, such constraints are not excluded here). + */ ListBase *ED_object_pose_constraint_list(const bContext *C) { bPoseChannel *pose_bone = CTX_data_pointer_get(C, "active_pose_bone").data; -- cgit v1.2.3 From d6525e8d133b787655bdb2c2fcef218591a457c3 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 11 Sep 2020 07:59:48 +0200 Subject: Use DrawManager for Image/UV Editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This project moves the current UV/Image editor drawing to the draw manager. Why would we do this: **Performance**: Current implementation would draw each texel per time. Multiple texels could be drawn per pixel what would overwrite the previous result. You can notice this when working with large textures. Repeat image drawing made this visible by drawing for a small period of time and stop drawing the rest. Now the rendering is fast and all repeated images are drawn. **Alpha drawing**: Current implementation would draw directly in display space. Giving incorrect results when displaying alpha transparent images. This addresses {T52680}, {T74709}, {T79518} The image editor now can show emission only colors. See {D8234} for examples. **Current Limitations** Using images that are larger than supported by your GPU are resized (eg larger than 16000x16000 are resized to 8k). This leaves some blurring artifacts. It is a low priority to add support back of displaying individual pixels of huge images. There is a design task {T80113} with more detail. **Implementation overview** Introduced an Image Engine in the draw module. this engine is responsible for drawing the texture in the main area of the UV/Image editor. The overlay engine has a edit_uv overlay which is responsible to draw the UV's, shadows and overlays specifically for the UV Image editor. The background + checker pattern is drawn by the overlay_background. The patch will allow us to share overlays between the 3d viewport and UV/Image editor more easily. In most cases we just need to switch the `pos` with the `u` attribute in the vertex shader. The project can be activated in the user preferences as experimental features. In a later commit this will be reversed. Reviewed By: ClĂ©ment Foucault Differential Revision: https://developer.blender.org/D8234 --- source/blender/editors/render/render_internal.c | 1 + source/blender/editors/space_image/image_draw.c | 31 ++++++--- source/blender/editors/space_image/image_intern.h | 1 + source/blender/editors/space_image/space_image.c | 77 +++++++++++++---------- 4 files changed, 67 insertions(+), 43 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 25b4ddc15fd..509097c7a70 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -604,6 +604,7 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL) { image_buffer_rect_update(rj, rr, ibuf, &rj->iuser, renrect, viewname); } + ima->gpuflag |= IMA_GPU_REFRESH; /* make jobs timer to send notifier */ *(rj->do_update) = true; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 058436a46bf..85d153feb4c 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -865,7 +865,7 @@ void draw_image_main(const bContext *C, ARegion *region) Image *ima; ImBuf *ibuf; float zoomx, zoomy; - bool show_viewer, show_render, show_paint, show_stereo3d, show_multilayer; + bool show_viewer, show_stereo3d, show_multilayer; void *lock; /* XXX can we do this in refresh? */ @@ -898,9 +898,6 @@ void draw_image_main(const bContext *C, ARegion *region) } show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0; - show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0; - show_paint = (ima && (sima->mode == SI_MODE_PAINT) && (show_viewer == false) && - (show_render == false)); show_stereo3d = (ima && BKE_image_is_stereo(ima) && (sima->iuser.flag & IMA_SHOW_STEREO)); show_multilayer = ima && BKE_image_is_multilayer(ima); @@ -998,16 +995,32 @@ void draw_image_main(const bContext *C, ARegion *region) } draw_udim_tile_grids(region, sima, ima); - - /* paint helpers */ - if (show_paint) { - draw_image_paint_helpers(C, region, scene, zoomx, zoomy); - } + draw_image_main_helpers(C, region); if (show_viewer) { BLI_thread_unlock(LOCK_DRAW_IMAGE); } +} + +void draw_image_main_helpers(const bContext *C, ARegion *region) +{ + SpaceImage *sima = CTX_wm_space_image(C); + Scene *scene = CTX_data_scene(C); + Image *ima; + float zoomx, zoomy; + bool show_viewer, show_render, show_paint; + ima = ED_space_image(sima); + ED_space_image_get_zoom(sima, region, &zoomx, &zoomy); + + show_viewer = (ima && ima->source == IMA_SRC_VIEWER) != 0; + show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT) != 0; + show_paint = (ima && (sima->mode == SI_MODE_PAINT) && (show_viewer == false) && + (show_render == false)); + /* paint helpers */ + if (show_paint) { + draw_image_paint_helpers(C, region, scene, zoomx, zoomy); + } /* render info */ if (ima && show_render) { draw_render_info(C, sima->iuser.scene, ima, region, zoomx, zoomy); diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index e6f5988aed8..100556ad29a 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -37,6 +37,7 @@ extern const char *image_context_dir[]; /* doc access */ /* image_draw.c */ void draw_image_main(const struct bContext *C, struct ARegion *region); +void draw_image_main_helpers(const struct bContext *C, struct ARegion *region); void draw_image_cache(const struct bContext *C, struct ARegion *region); void draw_image_grease_pencil(struct bContext *C, bool onlyv2d); void draw_image_sample_line(struct SpaceImage *sima); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index aa3f6446d51..032196b33bd 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -76,6 +76,7 @@ #include "GPU_framebuffer.h" #include "GPU_viewport.h" +#include "DRW_engine.h" #include "DRW_engine_types.h" #include "image_intern.h" @@ -638,8 +639,6 @@ static void image_main_region_draw(const bContext *C, ARegion *region) Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); View2D *v2d = ®ion->v2d; - // View2DScrollers *scrollers; - float col[3]; GPUViewport *viewport = WM_draw_region_get_viewport(region); GPUFrameBuffer *framebuffer_default, *framebuffer_overlay; @@ -647,35 +646,14 @@ static void image_main_region_draw(const bContext *C, ARegion *region) framebuffer_default = GPU_viewport_framebuffer_default_get(viewport); framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport); - GPU_framebuffer_bind(framebuffer_default); - GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f); - - GPU_framebuffer_bind(framebuffer_overlay); - /* XXX not supported yet, disabling for now */ scene->r.scemode &= ~R_COMP_CROP; - /* clear and setup matrix */ - UI_GetThemeColor3fv(TH_BACK, col); - srgb_to_linearrgb_v3_v3(col, col); - GPU_clear_color(col[0], col[1], col[2], 1.0f); - GPU_depth_test(GPU_DEPTH_NONE); - image_user_refresh_scene(C, sima); /* we set view2d from own zoom and offset each time */ image_main_region_set_view2d(sima, region); - /* we draw image in pixelspace */ - draw_image_main(C, region); - - /* and uvs in 0.0-1.0 space */ - UI_view2d_view_ortho(v2d); - - ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); - - ED_uvedit_draw_main(sima, scene, view_layer, obedit, obact, depsgraph); - /* check for mask (delay draw) */ if (ED_space_image_show_uvedit(sima, obedit)) { show_uvedit = true; @@ -687,21 +665,52 @@ static void image_main_region_draw(const bContext *C, ARegion *region) show_curve = true; } - ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); + /* we draw image in pixelspace */ + if (U.experimental.use_drw_image_editor) { + DRW_draw_view(C); + draw_image_main_helpers(C, region); - if (sima->flag & SI_SHOW_GPENCIL) { - /* Grease Pencil too (in addition to UV's) */ - draw_image_grease_pencil((bContext *)C, true); + /* sample line */ + UI_view2d_view_ortho(v2d); + draw_image_sample_line(sima); + UI_view2d_view_restore(C); } + else { + GPU_framebuffer_bind(framebuffer_default); + GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f); + + GPU_framebuffer_bind(framebuffer_overlay); + + float col[3]; + /* clear and setup matrix */ + UI_GetThemeColor3fv(TH_BACK, col); + srgb_to_linearrgb_v3_v3(col, col); + GPU_clear_color(col[0], col[1], col[2], 1.0f); + GPU_depth_test(GPU_DEPTH_NONE); + draw_image_main(C, region); + + /* and uvs in 0.0-1.0 space */ + UI_view2d_view_ortho(v2d); + + ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); - /* sample line */ - draw_image_sample_line(sima); + ED_uvedit_draw_main(sima, scene, view_layer, obedit, obact, depsgraph); - UI_view2d_view_restore(C); + ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_VIEW); - if (sima->flag & SI_SHOW_GPENCIL) { - /* draw Grease Pencil - screen space only */ - draw_image_grease_pencil((bContext *)C, false); + if (sima->flag & SI_SHOW_GPENCIL) { + /* Grease Pencil too (in addition to UV's) */ + draw_image_grease_pencil((bContext *)C, true); + } + /* sample line */ + draw_image_sample_line(sima); + + UI_view2d_view_restore(C); + + if (sima->flag & SI_SHOW_GPENCIL) { + /* draw Grease Pencil - screen space only */ + draw_image_grease_pencil((bContext *)C, false); + } } if (mask) { @@ -741,7 +750,7 @@ static void image_main_region_draw(const bContext *C, ARegion *region) C); } - if (show_uvedit || mask || show_curve) { + if ((show_uvedit || mask || show_curve) && !U.experimental.use_drw_image_editor) { UI_view2d_view_ortho(v2d); ED_image_draw_cursor(region, sima->cursor); UI_view2d_view_restore(C); -- cgit v1.2.3 From 4212b6528afb07d9b2962566ae9c4251282d387f Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 11 Sep 2020 08:35:05 +0200 Subject: Image Editor: Enable New Drawing This patch reverses use draw manager for image editor the experimental feature. Now the new drawing is enabled by default. Inside the experimental tab in the user preferences there is now an option to revert back to the old drawing method. Using this option we can easilly check if all drawing features have been migrated over. The plan is to remove the legacy drawing before BCon 3. --- source/blender/editors/space_image/space_image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 032196b33bd..f1becd5f027 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -666,7 +666,7 @@ static void image_main_region_draw(const bContext *C, ARegion *region) } /* we draw image in pixelspace */ - if (U.experimental.use_drw_image_editor) { + if (!U.experimental.use_image_editor_legacy_drawing) { DRW_draw_view(C); draw_image_main_helpers(C, region); @@ -750,7 +750,7 @@ static void image_main_region_draw(const bContext *C, ARegion *region) C); } - if ((show_uvedit || mask || show_curve) && !U.experimental.use_drw_image_editor) { + if ((show_uvedit || mask || show_curve) && U.experimental.use_image_editor_legacy_drawing) { UI_view2d_view_ortho(v2d); ED_image_draw_cursor(region, sima->cursor); UI_view2d_view_restore(C); -- cgit v1.2.3 From d96b141666c17ab2aaba750286b3affc9bef0288 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Sep 2020 19:50:38 +1000 Subject: Fix T79464: Crash adding objects without an active screen Running add-objects operator without an active screen would crash as CTX_data_edit_object would return NULL in this case. This could happen when adding objects from frame-change handlers for e.g. In the case of adding new objects there is no need for a context lookup, pass this directly to ED_object_editmode_exit_ex. --- source/blender/editors/curve/editcurve_add.c | 7 ++++-- source/blender/editors/mesh/editmesh_add.c | 2 +- source/blender/editors/object/object_add.c | 32 +++++++++++++++++++--------- source/blender/editors/object/object_edit.c | 31 +++++++++++++++------------ 4 files changed, 45 insertions(+), 27 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c index 19b05f0af0c..4d72e90b89b 100644 --- a/source/blender/editors/curve/editcurve_add.c +++ b/source/blender/editors/curve/editcurve_add.c @@ -508,7 +508,10 @@ Nurb *ED_curve_add_nurbs_primitive( static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) { - Object *obedit = CTX_data_edit_object(C); + struct Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); ListBase *editnurb; Nurb *nu; bool newob = false; @@ -565,7 +568,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf) /* userdef */ if (newob && !enter_editmode) { - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA); } WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 3c426e5d2b1..b7bf6230f22 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -104,7 +104,7 @@ static void make_prim_finish(bContext *C, /* userdef */ if (exit_editmode) { - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit_ex(CTX_data_main(C), CTX_data_scene(C), obedit, EM_FREEDATA); } WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 4de48fba494..fa1d147dc5e 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -529,9 +529,12 @@ Object *ED_object_add_type_with_obdata(bContext *C, ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob; - /* for as long scene has editmode... */ - if (CTX_data_edit_object(C)) { - ED_object_editmode_exit(C, EM_FREEDATA); + /* For as long scene has editmode... */ + { + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + if (obedit != NULL) { + ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA); + } } /* deselects all, sets active object */ @@ -778,18 +781,20 @@ static int effector_add_exec(bContext *C, wmOperator *op) dia = RNA_float_get(op->ptr, "radius"); if (type == PFIELD_GUIDE) { + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); Curve *cu; ob = ED_object_add_type( C, OB_CURVE, get_effector_defname(type), loc, rot, false, local_view_bits); cu = ob->data; cu->flag |= CU_PATH | CU_3D; - ED_object_editmode_enter(C, 0); + ED_object_editmode_enter_ex(bmain, scene, ob, 0); ED_object_new_primitive_matrix(C, ob, loc, rot, mat); BLI_addtail(&cu->editnurb->nurbs, ED_curve_add_nurbs_primitive(C, ob, mat, CU_NURBS | CU_PRIM_PATH, dia)); if (!enter_editmode) { - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA); } } else { @@ -900,7 +905,10 @@ void OBJECT_OT_camera_add(wmOperatorType *ot) static int object_metaball_add_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); bool newob = false; bool enter_editmode; ushort local_view_bits; @@ -931,7 +939,7 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op) /* userdef */ if (newob && !enter_editmode) { - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA); } WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); @@ -1017,7 +1025,11 @@ void OBJECT_OT_text_add(wmOperatorType *ot) static int object_armature_add_exec(bContext *C, wmOperator *op) { - Object *obedit = CTX_data_edit_object(C); + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + RegionView3D *rv3d = CTX_wm_region_view3d(C); bool newob = false; bool enter_editmode; @@ -1032,7 +1044,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op) } if ((obedit == NULL) || (obedit->type != OB_ARMATURE)) { obedit = ED_object_add_type(C, OB_ARMATURE, NULL, loc, rot, true, local_view_bits); - ED_object_editmode_enter(C, 0); + ED_object_editmode_enter_ex(bmain, scene, obedit, 0); newob = true; } else { @@ -1049,7 +1061,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op) /* userdef */ if (newob && !enter_editmode) { - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA); } WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 966aeed75ab..7e0df736228 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -769,14 +769,14 @@ bool ED_object_editmode_enter(bContext *C, int flag) static int editmode_toggle_exec(bContext *C, wmOperator *op) { - struct wmMsgBus *mbus = CTX_wm_message_bus(C); - const int mode_flag = OB_MODE_EDIT; - const bool is_mode_set = (CTX_data_edit_object(C) != NULL); Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); + ViewLayer *view_layer = CTX_data_view_layer(C); Object *obact = OBACT(view_layer); + const int mode_flag = OB_MODE_EDIT; + const bool is_mode_set = (obact->mode & mode_flag) != 0; + struct wmMsgBus *mbus = CTX_wm_message_bus(C); if (!is_mode_set) { if (!ED_object_mode_compat_set(C, obact, mode_flag, op->reports)) { @@ -785,7 +785,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op) } if (!is_mode_set) { - ED_object_editmode_enter(C, 0); + ED_object_editmode_enter_ex(bmain, scene, obact, 0); if (obact->mode & mode_flag) { FOREACH_SELECTED_OBJECT_BEGIN (view_layer, v3d, ob) { if ((ob != obact) && (ob->type == obact->type)) { @@ -796,7 +796,8 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op) } } else { - ED_object_editmode_exit(C, EM_FREEDATA); + ED_object_editmode_exit_ex(bmain, scene, obact, EM_FREEDATA); + if ((obact->mode & mode_flag) == 0) { FOREACH_OBJECT_BEGIN (view_layer, ob) { if ((ob != obact) && (ob->type == obact->type)) { @@ -859,6 +860,9 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot) static int posemode_exec(bContext *C, wmOperator *op) { struct wmMsgBus *mbus = CTX_wm_message_bus(C); + struct Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); Base *base = CTX_data_active_base(C); /* If the base is NULL it means we have an active object, but the object itself is hidden. */ @@ -880,16 +884,17 @@ static int posemode_exec(bContext *C, wmOperator *op) return OPERATOR_PASS_THROUGH; } - if (obact == CTX_data_edit_object(C)) { - ED_object_editmode_exit(C, EM_FREEDATA); - is_mode_set = false; + { + Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer); + if (obact == obedit) { + ED_object_editmode_exit_ex(bmain, scene, obedit, EM_FREEDATA); + is_mode_set = false; + } } if (is_mode_set) { bool ok = ED_object_posemode_exit(C, obact); if (ok) { - struct Main *bmain = CTX_data_main(C); - ViewLayer *view_layer = CTX_data_view_layer(C); FOREACH_OBJECT_BEGIN (view_layer, ob) { if ((ob != obact) && (ob->type == OB_ARMATURE) && (ob->mode & mode_flag)) { ED_object_posemode_exit_ex(bmain, ob); @@ -901,9 +906,7 @@ static int posemode_exec(bContext *C, wmOperator *op) else { bool ok = ED_object_posemode_enter(C, obact); if (ok) { - struct Main *bmain = CTX_data_main(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - View3D *v3d = CTX_wm_view3d(C); + const View3D *v3d = CTX_wm_view3d(C); FOREACH_SELECTED_OBJECT_BEGIN (view_layer, v3d, ob) { if ((ob != obact) && (ob->type == OB_ARMATURE) && (ob->mode == OB_MODE_OBJECT) && (!ID_IS_LINKED(ob))) { -- cgit v1.2.3 From 28f13a5697c7197616a3d1f9fb4ad02e2a78ad94 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 11 Sep 2020 12:14:27 -0500 Subject: Property Search: Use button groups instead of button pointers --- source/blender/editors/include/UI_interface.h | 5 +- .../blender/editors/interface/interface_intern.h | 8 - .../blender/editors/interface/interface_layout.c | 237 ++++++++++----------- .../editors/interface/interface_templates.c | 2 +- source/blender/editors/space_graph/graph_buttons.c | 16 +- 5 files changed, 118 insertions(+), 150 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 86275ce4d39..d5d489b1742 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -2362,10 +2362,7 @@ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout) void uiItemL(uiLayout *layout, const char *name, int icon); /* label */ void uiItemL_ex( uiLayout *layout, const char *name, int icon, const bool highlight, const bool redalert); -uiBut *uiItemL_respect_property_split(uiLayout *layout, - const char *text, - int icon, - uiLayout **r_layout); +uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon); /* label icon for dragging */ void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); /* menu */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index fe0d9fda44b..4661d0816ae 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -270,14 +270,6 @@ struct uiBut { uiButPushedStateFunc pushed_state_func; void *pushed_state_arg; - /** - * Used for property search, so that a button's label and decorator can be filtered and - * unfiltered along with it. Due to the sometimes arbitrary nature of which button to choose - * for these values, they aren't always filled. - */ - uiBut *label_but; - uiBut *decorator_but; - /* pointer back */ uiBlock *block; }; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 4bfd058eb07..4cf2953153e 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -80,12 +80,25 @@ /* uiLayoutRoot */ +/** + * A group of button references, used by property search to keep track of sets of buttons that + * should be searched together. For example, in property split layouts number buttons and their + * labels (and even their decorators) are separate buttons, but they must be searched and + * highlighted together. + */ +typedef struct uiButtonGroup { + uiButtonGroup *next, *prev; + ListBase *buttons; +} uiButtonGroup; + typedef struct uiLayoutRoot { struct uiLayoutRoot *next, *prev; int type; int opcontext; + ListBase button_groups; /* #uiButtonGroup. */ + int emw, emh; int padding; @@ -220,8 +233,6 @@ typedef struct uiLayoutItemRoot { /** \} */ -static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon); - /* -------------------------------------------------------------------- */ /** \name Item * \{ */ @@ -497,8 +508,7 @@ static void ui_item_array(uiLayout *layout, int toggle, bool icon_only, bool compact, - bool show_text, - uiBut *label_but) + bool show_text) { const uiStyle *style = layout->root->style; uiBut *but; @@ -663,10 +673,7 @@ static void ui_item_array(uiLayout *layout, /* special case, boolean array in a menu, this could be used in a more generic way too */ if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand && ELEM(len, 3, 4)) { - but = uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y); - if (label_but != NULL) { - but->label_but = label_but; - } + uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y); } else { bool *boolarr = NULL; @@ -717,13 +724,6 @@ static void ui_item_array(uiLayout *layout, if ((a == 0) && (subtype == PROP_AXISANGLE)) { UI_but_unit_type_set(but, PROP_UNIT_ROTATION); } - - /* Set the label button for the array item. */ - if (label_but != NULL) { - but->label_but = label_but; - label_but = label_but->next; - BLI_assert(label_but != NULL); - } } if (boolarr) { @@ -766,8 +766,7 @@ static void ui_item_enum_expand_elem_exec(uiLayout *layout, const eButType but_type, const bool icon_only, const EnumPropertyItem *item, - const bool is_first, - uiBut *label_but) + const bool is_first) { const char *name = (!uiname || uiname[0]) ? item->name : ""; const int icon = item->icon; @@ -806,10 +805,6 @@ static void ui_item_enum_expand_elem_exec(uiLayout *layout, if (but_type == UI_BTYPE_TAB) { but->flag |= UI_BUT_DRAG_LOCK; } - - if (label_but != NULL) { - but->label_but = label_but; - } } static void ui_item_enum_expand_exec(uiLayout *layout, @@ -819,8 +814,7 @@ static void ui_item_enum_expand_exec(uiLayout *layout, const char *uiname, const int h, const eButType but_type, - const bool icon_only, - uiBut *label_but) + const bool icon_only) { /* XXX: The way this function currently handles uiname parameter * is insane and inconsistent with general UI API: @@ -896,7 +890,7 @@ static void ui_item_enum_expand_exec(uiLayout *layout, } ui_item_enum_expand_elem_exec( - layout, block, ptr, prop, uiname, h, but_type, icon_only, item, is_first, label_but); + layout, block, ptr, prop, uiname, h, but_type, icon_only, item, is_first); } UI_block_layout_set_current(block, layout); @@ -911,11 +905,9 @@ static void ui_item_enum_expand(uiLayout *layout, PropertyRNA *prop, const char *uiname, const int h, - const bool icon_only, - uiBut *label_but) + const bool icon_only) { - ui_item_enum_expand_exec( - layout, block, ptr, prop, uiname, h, UI_BTYPE_ROW, icon_only, label_but); + ui_item_enum_expand_exec(layout, block, ptr, prop, uiname, h, UI_BTYPE_ROW, icon_only); } static void ui_item_enum_expand_tabs(uiLayout *layout, bContext *C, @@ -928,7 +920,7 @@ static void ui_item_enum_expand_tabs(uiLayout *layout, { uiBut *last = block->buttons.last; - ui_item_enum_expand_exec(layout, block, ptr, prop, uiname, h, UI_BTYPE_TAB, icon_only, NULL); + ui_item_enum_expand_exec(layout, block, ptr, prop, uiname, h, UI_BTYPE_TAB, icon_only); BLI_assert(last != block->buttons.last); for (uiBut *tab = last ? last->next : block->buttons.first; tab; tab = tab->next) { UI_but_drawflag_enable(tab, ui_but_align_opposite_to_area_align_get(CTX_wm_region(C))); @@ -967,12 +959,10 @@ static uiBut *ui_item_with_label(uiLayout *layout, { uiLayout *sub = layout; uiBut *but = NULL; - uiBut *label_but = NULL; PropertyType type; PropertySubType subtype; int prop_but_width = w_hint; #ifdef UI_PROP_DECORATE - uiBut *decorator_but = NULL; uiLayout *layout_prop_decorate = NULL; const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); const bool use_prop_decorate = use_prop_sep && (layout->item.flag & UI_ITEM_PROP_DECORATE) && @@ -993,7 +983,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, #ifdef UI_PROP_DECORATE if (name[0]) { if (use_prop_sep) { - label_but = uiItemL_respect_property_split(layout, name, 0, &layout_prop_decorate); + layout_prop_decorate = uiItemL_respect_property_split(layout, name, 0); } else #endif @@ -1009,8 +999,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, else { w_label = w_hint / 3; } - label_but = uiDefBut( - block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, ""); + uiDefBut(block, UI_BTYPE_LABEL, 0, name, x, y, w_label, h, NULL, 0.0, 0.0, 0, 0, ""); } } @@ -1088,15 +1077,10 @@ static uiBut *ui_item_with_label(uiLayout *layout, #ifdef UI_PROP_DECORATE /* Only for alignment. */ if (use_prop_decorate) { /* Note that sep flag may have been unset meanwhile. */ - decorator_but = uiItemL_(layout_prop_decorate ? layout_prop_decorate : sub, NULL, ICON_BLANK1); + uiItemL(layout_prop_decorate ? layout_prop_decorate : sub, NULL, ICON_BLANK1); } #endif /* UI_PROP_DECORATE */ - /* Set the button's label and decorator even if they are NULL. They can be changed - * further with the return value of this function anyway. */ - but->label_but = label_but; - but->decorator_but = decorator_but; - UI_block_layout_set_current(block, layout); return but; } @@ -1935,34 +1919,28 @@ static uiLayout *ui_layout_heading_find(uiLayout *cur_layout) return NULL; } -/** - * \return The label button added. - */ -static uiBut *ui_layout_heading_label_add(uiLayout *layout, - uiLayout *heading_layout, - bool right_align, - bool respect_prop_split) +static void ui_layout_heading_label_add(uiLayout *layout, + uiLayout *heading_layout, + bool right_align, + bool respect_prop_split) { const int prev_alignment = layout->alignment; - uiBut *label_but = NULL; if (right_align) { uiLayoutSetAlignment(layout, UI_LAYOUT_ALIGN_RIGHT); } if (respect_prop_split) { - label_but = uiItemL_respect_property_split(layout, heading_layout->heading, ICON_NONE, NULL); + uiItemL_respect_property_split(layout, heading_layout->heading, ICON_NONE); } else { - label_but = uiItemL_(layout, heading_layout->heading, ICON_NONE); + uiItemL(layout, heading_layout->heading, ICON_NONE); } /* After adding the heading label, we have to mark it somehow as added, so it's not added again * for other items in this layout. For now just clear it. */ heading_layout->heading[0] = '\0'; layout->alignment = prev_alignment; - - return label_but; } /** @@ -2023,6 +2001,7 @@ void uiItemFullR(uiLayout *layout, #endif /* UI_PROP_DECORATE */ UI_block_layout_set_current(block, layout); + layout_root_new_button_group(layout->root); /* retrieve info */ const PropertyType type = RNA_property_type(prop); @@ -2144,10 +2123,6 @@ void uiItemFullR(uiLayout *layout, } uiBut *but = NULL; - /* Store the label to assign it to the button afterwards. This is the first - * label button if the item is an array and there are a series of buttons. - * Decorators are assigned as they are built later on. */ - uiBut *label_but = NULL; /* Split the label / property. */ uiLayout *layout_parent = layout; @@ -2167,7 +2142,7 @@ void uiItemFullR(uiLayout *layout, layout = uiLayoutColumn(layout_row ? layout_row : layout, true); layout->space = 0; if (heading_layout) { - label_but = ui_layout_heading_label_add(layout, heading_layout, false, false); + ui_layout_heading_label_add(layout, heading_layout, false, false); } } else { @@ -2194,43 +2169,39 @@ void uiItemFullR(uiLayout *layout, *s++ = str[0]; *s++ = '\0'; } - uiBut *new_label = uiDefBut(block, - UI_BTYPE_LABEL, - 0, - use_prefix ? name_with_suffix : str, - 0, - 0, - w, - UI_UNIT_Y, - NULL, - 0.0, - 0.0, - 0, - 0, - ""); - new_label->drawflag |= UI_BUT_TEXT_RIGHT; - new_label->drawflag &= ~UI_BUT_TEXT_LEFT; - - if (a == 0) { - label_but = new_label; - } + but = uiDefBut(block, + UI_BTYPE_LABEL, + 0, + use_prefix ? name_with_suffix : str, + 0, + 0, + w, + UI_UNIT_Y, + NULL, + 0.0, + 0.0, + 0, + 0, + ""); + but->drawflag |= UI_BUT_TEXT_RIGHT; + but->drawflag &= ~UI_BUT_TEXT_LEFT; + label_added = true; } } else { if (name) { - label_but = uiDefBut( + but = uiDefBut( block, UI_BTYPE_LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); - label_but->drawflag |= UI_BUT_TEXT_RIGHT; - label_but->drawflag &= ~UI_BUT_TEXT_LEFT; + but->drawflag |= UI_BUT_TEXT_RIGHT; + but->drawflag &= ~UI_BUT_TEXT_LEFT; label_added = true; } } if (!label_added && heading_layout) { - label_but = ui_layout_heading_label_add(layout_sub, heading_layout, true, false); - label_added = true; + ui_layout_heading_label_add(layout_sub, heading_layout, true, false); } layout_split = ui_item_prop_split_layout_hack(layout_parent, layout_split); @@ -2273,7 +2244,7 @@ void uiItemFullR(uiLayout *layout, else if (heading_layout) { /* Could not add heading to split layout, fallback to inserting it to the layout with the * heading itself. */ - label_but = ui_layout_heading_label_add(heading_layout, heading_layout, false, false); + ui_layout_heading_label_add(heading_layout, heading_layout, false, false); } /* array property */ @@ -2300,29 +2271,26 @@ void uiItemFullR(uiLayout *layout, toggle, icon_only, compact, - !use_prop_sep_split_label, - label_but); + !use_prop_sep_split_label); } /* enum item */ else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) { if (icon && name[0] && !icon_only) { - but = uiDefIconTextButR_prop( + uiDefIconTextButR_prop( block, UI_BTYPE_ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); } else if (icon) { - but = uiDefIconButR_prop( + uiDefIconButR_prop( block, UI_BTYPE_ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); } else { - but = uiDefButR_prop( + uiDefButR_prop( block, UI_BTYPE_ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL); } - BLI_assert(but != NULL); - but->label_but = label_but; } /* expanded enum */ else if (type == PROP_ENUM && expand) { - ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only, label_but); + ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only); } /* property with separate label */ else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) { @@ -2336,8 +2304,6 @@ void uiItemFullR(uiLayout *layout, if (layout->activate_init) { UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); } - BLI_assert(but != NULL); - but->label_but = label_but; } /* single button */ else { @@ -2371,8 +2337,6 @@ void uiItemFullR(uiLayout *layout, if (layout->activate_init) { UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); } - - but->label_but = label_but; } /* The resulting button may have the icon set since boolean button drawing @@ -2408,16 +2372,13 @@ void uiItemFullR(uiLayout *layout, /* The icons are set in 'ui_but_anim_flag' */ uiItemDecoratorR_prop(layout_col, ptr_dec, prop_dec, but_decorate->rnaindex); - uiBut *decorator = block->buttons.last; - but_decorate->decorator_but = decorator; + but = block->buttons.last; /* Order the decorator after the button we decorate, this is used so we can always * do a quick lookup. */ - BLI_remlink(&block->buttons, decorator); - BLI_insertlinkafter(&block->buttons, but_decorate, decorator); - - /* Assign decorator to the property's button so that they can be filtered together. */ - but_decorate = decorator->next; + BLI_remlink(&block->buttons, but); + BLI_insertlinkafter(&block->buttons, but_decorate, but); + but_decorate = but->next; } BLI_assert(ELEM(i, 1, ui_decorate.len)); @@ -2791,6 +2752,8 @@ void uiItemPointerR_prop(uiLayout *layout, char namestr[UI_MAX_NAME_STR]; const bool use_prop_sep = ((layout->item.flag & UI_ITEM_PROP_SEP) != 0); + layout_root_new_button_group(layout->root); + type = RNA_property_type(prop); if (!ELEM(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) { RNA_warning("Property %s.%s must be a pointer, string or enum", @@ -3246,42 +3209,29 @@ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout) return split_wrapper; } -/** +/* * Helper to add a label and creates a property split layout if needed. - * - * \param r_layout: Returns a column to put decorators in if property separate is on, otherwise - * returns the original layout. */ -uiBut *uiItemL_respect_property_split(uiLayout *layout, - const char *text, - int icon, - uiLayout **r_layout) +uiLayout *uiItemL_respect_property_split(uiLayout *layout, const char *text, int icon) { - uiBut *label_but; if (layout->item.flag & UI_ITEM_PROP_SEP) { uiBlock *block = uiLayoutGetBlock(layout); const uiPropertySplitWrapper split_wrapper = uiItemPropertySplitWrapperCreate(layout); /* Further items added to 'layout' will automatically be added to split_wrapper.property_row */ - label_but = uiItemL_(split_wrapper.label_column, text, icon); + uiItemL_(split_wrapper.label_column, text, icon); UI_block_layout_set_current(block, split_wrapper.property_row); - if (r_layout != NULL) { - *r_layout = split_wrapper.decorate_column; - } + return split_wrapper.decorate_column; } - else { - char namestr[UI_MAX_NAME_STR]; - if (text) { - text = ui_item_name_add_colon(text, namestr); - } - label_but = uiItemL_(layout, text, icon); - if (r_layout != NULL) { - *r_layout = layout; - } + char namestr[UI_MAX_NAME_STR]; + if (text) { + text = ui_item_name_add_colon(text, namestr); } - return label_but; + uiItemL_(layout, text, icon); + + return layout; } void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon) @@ -5341,6 +5291,33 @@ static void ui_layout_free(uiLayout *layout) MEM_freeN(layout); } +static void layout_root_free(uiLayoutRoot *root) +{ + BLI_freelistN(&root->button_groups); + ui_layout_free(root->layout); + MEM_freeN(root); +} + +/** + * Every function that adds a set of buttons must create another group, + * then #ui_def_but adds buttons to the current group (the last). + */ +static void layout_root_new_button_group(uiLayoutRoot *root) +{ + uiButtonGroup *new_group = MEM_mallocN(sizeof(uiButtonGroup), __func__); + BLI_listbase_clear(&new_group->buttons); + BLI_addtail(&root->button_groups, new_group); +} + +static void button_group_add_but(uiLayoutRoot *root, const uiBut *but) +{ + uiButtonGroup *current_button_group = root->button_groups.last; + + BLI_assert(current_button_group != NULL); + + BLI_addtail(¤t_button_group->buttons, but); +} + static void ui_layout_add_padding_button(uiLayoutRoot *root) { if (root->padding) { @@ -5375,6 +5352,8 @@ uiLayout *UI_block_layout(uiBlock *block, root->padding = padding; root->opcontext = WM_OP_INVOKE_REGION_WIN; + BLI_listbase_clear(&root->button_groups); + layout = MEM_callocN(sizeof(uiLayout), "uiLayout"); layout->item.type = (type == UI_LAYOUT_VERT_BAR) ? ITEM_LAYOUT_COLUMN : ITEM_LAYOUT_ROOT; @@ -5459,6 +5438,8 @@ void ui_layout_add_but(uiLayout *layout, uiBut *but) if (layout->emboss != UI_EMBOSS_UNDEFINED) { but->emboss = layout->emboss; } + + button_group_add_but(layout->root, but); } bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, uiBut *new_but) @@ -5524,16 +5505,14 @@ void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y) block->curlayout = NULL; - LISTBASE_FOREACH (uiLayoutRoot *, root, &block->layouts) { + LISTBASE_FOREACH_MUTABLE (uiLayoutRoot *, root, &block->layouts) { ui_layout_add_padding_button(root); /* NULL in advance so we don't interfere when adding button */ ui_layout_end(block, root->layout, r_x, r_y); - ui_layout_free(root->layout); + layout_root_free(root); } - BLI_freelistN(&block->layouts); - /* XXX silly trick, interface_templates.c doesn't get linked * because it's not used by other files in this module? */ { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 9141a46499e..77a9d9f549a 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -897,7 +897,7 @@ static void template_ID(const bContext *C, if (text) { /* Add label resepecting the separated layout property split state. */ - uiItemL_respect_property_split(layout, text, ICON_NONE, NULL); + uiItemL_respect_property_split(layout, text, ICON_NONE); } if (flag & UI_ID_BROWSE) { diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index ba3ed620ff1..47f910402fe 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -423,7 +423,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) col = uiLayoutColumn(layout, true); /* keyframe itself */ { - uiItemL_respect_property_split(col, IFACE_("Key Frame"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Key Frame"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, @@ -441,7 +441,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) 0, NULL); - uiItemL_respect_property_split(col, IFACE_("Value"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Value"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, @@ -468,7 +468,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) if ((prevbezt) && (prevbezt->ipo == BEZT_IPO_BEZ)) { col = uiLayoutColumn(layout, true); - uiItemL_respect_property_split(col, IFACE_("Left Handle Type"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Left Handle Type"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_MENU, B_REDR, @@ -487,7 +487,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) "Type of left handle"); UI_but_func_set(but, graphedit_activekey_handles_cb, fcu, bezt); - uiItemL_respect_property_split(col, IFACE_("Frame"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Frame"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, @@ -506,7 +506,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) NULL); UI_but_func_set(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt); - uiItemL_respect_property_split(col, IFACE_("Value"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Value"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, @@ -532,7 +532,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) /* NOTE: special update callbacks are needed on the coords here due to T39911 */ col = uiLayoutColumn(layout, true); - uiItemL_respect_property_split(col, IFACE_("Right Handle Type"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Right Handle Type"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_MENU, B_REDR, @@ -551,7 +551,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) "Type of right handle"); UI_but_func_set(but, graphedit_activekey_handles_cb, fcu, bezt); - uiItemL_respect_property_split(col, IFACE_("Frame"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Frame"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, @@ -570,7 +570,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel) NULL); UI_but_func_set(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt); - uiItemL_respect_property_split(col, IFACE_("Value"), ICON_NONE, NULL); + uiItemL_respect_property_split(col, IFACE_("Value"), ICON_NONE); but = uiDefButR(block, UI_BTYPE_NUM, B_REDR, -- cgit v1.2.3 From 68a5d4c56da022d9b54c878c1d139bec8ccd405d Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 11 Sep 2020 12:36:22 -0500 Subject: Property Search: Code to use new button group structs --- .../blender/editors/interface/interface_layout.c | 49 ++++++++++++---------- 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 470075ead9d..c1d87421ee1 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -5170,39 +5170,44 @@ static bool button_matches_search_filter(uiBut *but, const char *search_filter) } /** - * Apply the search filter, tagging all buttons with whether they match or not. + * Test for a search result within the block. Tag every button + * in the group as a search match if any button matches. + * + * \return Whether the group has a match. */ -static bool block_search_filter_tag_buttons(uiBlock *block) +static bool button_group_tag_search_matches(uiButtonGroup *button_group, const char *search_filter) { bool has_result = false; - LISTBASE_FOREACH (uiBut *, but, &block->buttons) { - /* First match regular buttons. */ - if (!ELEM(but->type, UI_BTYPE_LABEL) && - button_matches_search_filter(but, block->search_filter)) { + LISTBASE_FOREACH (uiBut *, but, &button_group->buttons) { + if (button_matches_search_filter(but, search_filter)) { has_result = true; - but->flag |= UI_SEARCH_FILTER_MATCHES; + break; } - /* Then match their labels. */ - if (but->label_but != NULL && - button_matches_search_filter(but->label_but, block->search_filter)) { - has_result = true; + } + if (has_result) { + LISTBASE_FOREACH (uiBut *, but, &button_group->buttons) { but->flag |= UI_SEARCH_FILTER_MATCHES; } } - /* Remove filter from labels and decorators that correspond to un-filtered buttons. */ - LISTBASE_FOREACH (uiBut *, but, &block->buttons) { - if (but->flag & UI_SEARCH_FILTER_MATCHES) { - if (but->label_but != NULL) { - but->label_but->flag |= UI_SEARCH_FILTER_MATCHES; - } - if (but->decorator_but != NULL) { - but->decorator_but->flag |= UI_SEARCH_FILTER_MATCHES; + return has_result; +} + +/** + * Apply the search filter, tagging all buttons with whether they match or not. + * + * \return Whether the block has any search results. + */ +static bool block_search_filter_tag_buttons(uiBlock *block) +{ + LISTBASE_FOREACH (uiLayoutRoot *, root, &block->layouts) { + LISTBASE_FOREACH (uiButtonGroup *, button_group, &root->button_groups) { + if (button_group_tag_search_matches(button_group, block->search_filter)) { + return true; } } } - - return has_result; + return false; } static void block_search_deactivate_buttons(uiBlock *block) @@ -5502,7 +5507,7 @@ static void layout_root_new_button_group(uiLayoutRoot *root) BLI_addtail(&root->button_groups, new_group); } -static void button_group_add_but(uiLayoutRoot *root, const uiBut *but) +static void button_group_add_but(uiLayoutRoot *root, uiBut *but) { uiButtonGroup *current_button_group = root->button_groups.last; -- cgit v1.2.3 From e22e30283714d03d0b57ebfa3a4dcda35c808c86 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Fri, 11 Sep 2020 15:39:33 -0300 Subject: Fix T80623: Correct Face Attributes affecting modes not listed Some transform modes (such as Mirror) are not listed to have UV corrected during the transformation. It messed up the UV of all of these. --- source/blender/editors/transform/transform_convert_mesh.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/editors') diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 7ad54a56545..06ab60d992c 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1296,6 +1296,9 @@ void mesh_customdatacorrect_init(TransInfo *t) use_merge_group = (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT_KEEP_CONNECTED) != 0; } } + else { + return; + } FOREACH_TRANS_DATA_CONTAINER (t, tc) { mesh_customdatacorrect_init_container(tc, use_merge_group); -- cgit v1.2.3 From 245cb6e972ddf10b1edd9cbe33e7d5bf60deda83 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 11 Sep 2020 13:58:08 -0500 Subject: Property Search: Fixes for button group --- .../blender/editors/interface/interface_layout.c | 68 ++++++++++++++-------- 1 file changed, 44 insertions(+), 24 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 4cf2953153e..53ed60fa357 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -87,8 +87,8 @@ * highlighted together. */ typedef struct uiButtonGroup { - uiButtonGroup *next, *prev; - ListBase *buttons; + void *next, *prev; + ListBase buttons; } uiButtonGroup; typedef struct uiLayoutRoot { @@ -427,6 +427,32 @@ static void ui_item_move(uiItem *item, int delta_xmin, int delta_xmax) /** \} */ +/* -------------------------------------------------------------------- */ +/** \name Button Groups + * \{ */ + +/** + * Every function that adds a set of buttons must create another group, + * then #ui_def_but adds buttons to the current group (the last). + */ +static void layout_root_new_button_group(uiLayoutRoot *root) +{ + uiButtonGroup *new_group = MEM_mallocN(sizeof(uiButtonGroup), __func__); + BLI_listbase_clear(&new_group->buttons); + BLI_addtail(&root->button_groups, new_group); +} + +static void button_group_add_but(uiLayoutRoot *root, uiBut *but) +{ + uiButtonGroup *current_button_group = root->button_groups.last; + + BLI_assert(current_button_group != NULL); + + BLI_addtail(¤t_button_group->buttons, but); +} + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Special RNA Items * \{ */ @@ -2859,6 +2885,7 @@ static uiBut *ui_item_menu(uiLayout *layout, int w, h; UI_block_layout_set_current(block, layout); + layout_root_new_button_group(layout->root); if (!name) { name = ""; @@ -3126,6 +3153,7 @@ static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon) int w; UI_block_layout_set_current(block, layout); + layout_root_new_button_group(layout->root); if (!name) { name = ""; @@ -5298,26 +5326,6 @@ static void layout_root_free(uiLayoutRoot *root) MEM_freeN(root); } -/** - * Every function that adds a set of buttons must create another group, - * then #ui_def_but adds buttons to the current group (the last). - */ -static void layout_root_new_button_group(uiLayoutRoot *root) -{ - uiButtonGroup *new_group = MEM_mallocN(sizeof(uiButtonGroup), __func__); - BLI_listbase_clear(&new_group->buttons); - BLI_addtail(&root->button_groups, new_group); -} - -static void button_group_add_but(uiLayoutRoot *root, const uiBut *but) -{ - uiButtonGroup *current_button_group = root->button_groups.last; - - BLI_assert(current_button_group != NULL); - - BLI_addtail(¤t_button_group->buttons, but); -} - static void ui_layout_add_padding_button(uiLayoutRoot *root) { if (root->padding) { @@ -5353,6 +5361,7 @@ uiLayout *UI_block_layout(uiBlock *block, root->opcontext = WM_OP_INVOKE_REGION_WIN; BLI_listbase_clear(&root->button_groups); + layout_root_new_button_group(root); layout = MEM_callocN(sizeof(uiLayout), "uiLayout"); layout->item.type = (type == UI_LAYOUT_VERT_BAR) ? ITEM_LAYOUT_COLUMN : ITEM_LAYOUT_ROOT; @@ -5505,14 +5514,25 @@ void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y) block->curlayout = NULL; - LISTBASE_FOREACH_MUTABLE (uiLayoutRoot *, root, &block->layouts) { + LISTBASE_FOREACH (uiLayoutRoot *, root, &block->layouts) { ui_layout_add_padding_button(root); /* NULL in advance so we don't interfere when adding button */ ui_layout_end(block, root->layout, r_x, r_y); - layout_root_free(root); + ui_layout_free(root->layout); } + BLI_freelistN(&block->layouts); + // LISTBASE_FOREACH_MUTABLE (uiLayoutRoot *, root, &block->layouts) { + // ui_layout_add_padding_button(root); + + // /* NULL in advance so we don't interfere when adding button */ + // ui_layout_end(block, root->layout, r_x, r_y); + // layout_root_free(root); + // } + + // BLI_listbase_clear(&block->layouts); + /* XXX silly trick, interface_templates.c doesn't get linked * because it's not used by other files in this module? */ { -- cgit v1.2.3 From a55093711644f1a87eb058d2bed20d530a4de155 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 11 Sep 2020 14:08:38 -0500 Subject: UI: Use operator to set property editor's pinned data-block This commit removes the custom callback that's currently used to set the property editor's pinned data, replacing it with an operator. This means "pin" button doesn't have to be defined in C. Differential Revision: https://developer.blender.org/D8376 --- .../editors/space_buttons/buttons_context.c | 27 ++++---------- .../blender/editors/space_buttons/buttons_intern.h | 1 + source/blender/editors/space_buttons/buttons_ops.c | 41 ++++++++++++++++++++++ .../blender/editors/space_buttons/space_buttons.c | 1 + 4 files changed, 50 insertions(+), 20 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index e0a5158e510..9228853ed19 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1133,7 +1133,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) { SpaceProperties *sbuts = CTX_wm_space_properties(C); ButsContextPath *path = sbuts->path; - uiLayout *row; + uiLayout *row, *sub; uiBlock *block; uiBut *but; PointerRNA *ptr; @@ -1199,25 +1199,12 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) uiItemSpacer(row); - block = uiLayoutGetBlock(row); - UI_block_emboss_set(block, UI_EMBOSS_NONE); - but = uiDefIconButBitC(block, - UI_BTYPE_ICON_TOGGLE, - SB_PIN_CONTEXT, - 0, - ICON_UNPINNED, - 0, - 0, - UI_UNIT_X, - UI_UNIT_Y, - &sbuts->flag, - 0, - 0, - 0, - 0, - TIP_("Follow context or keep fixed data-block displayed")); - UI_but_flag_disable(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - UI_but_func_set(but, pin_cb, NULL, NULL); + sub = uiLayoutRow(row, false); + uiLayoutSetEmboss(sub, UI_EMBOSS_NONE); + uiItemO(sub, + "", + (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED, + "BUTTONS_OT_toggle_pin"); } #ifdef USE_HEADER_CONTEXT_PATH diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 911cf4526bb..a1e2b9e9aaf 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -93,6 +93,7 @@ extern const char *buttons_context_dir[]; /* doc access */ void buttons_texture_context_compute(const struct bContext *C, struct SpaceProperties *sbuts); /* buttons_ops.c */ +void BUTTONS_OT_toggle_pin(struct wmOperatorType *ot); void BUTTONS_OT_file_browse(struct wmOperatorType *ot); void BUTTONS_OT_directory_browse(struct wmOperatorType *ot); void BUTTONS_OT_context_menu(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index a062b178fc8..2e6ad82ef08 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -52,6 +52,47 @@ #include "buttons_intern.h" /* own include */ +/* -------------------------------------------------------------------- */ +/** \name Pin ID Operator + * \{ */ + +static int toggle_pin_exec(bContext *C, wmOperator *UNUSED(op)) +{ + SpaceProperties *sbuts = CTX_wm_space_properties(C); + + sbuts->flag ^= SB_PIN_CONTEXT; + + /* Create the properties space pointer. */ + PointerRNA sbuts_ptr; + bScreen *screen = CTX_wm_screen(C); + RNA_pointer_create(&screen->id, &RNA_SpaceProperties, sbuts, &sbuts_ptr); + + /* Create the new ID pointer and set the the pin ID with RNA + * so we can use the property's RNA update functionality. */ + ID *new_id = (sbuts->flag & SB_PIN_CONTEXT) ? buttons_context_id_path(C) : NULL; + PointerRNA new_id_ptr; + RNA_id_pointer_create(new_id, &new_id_ptr); + RNA_pointer_set(&sbuts_ptr, "pin_id", new_id_ptr); + + ED_area_tag_redraw(CTX_wm_area(C)); + + return OPERATOR_FINISHED; +} + +void BUTTONS_OT_toggle_pin(wmOperatorType *ot) +{ + /* Identifiers. */ + ot->name = "Toggle Pin ID"; + ot->description = "Keep the current data-block displayed"; + ot->idname = "BUTTONS_OT_toggle_pin"; + + /* Callbacks. */ + ot->exec = toggle_pin_exec; + ot->poll = ED_operator_buttons_active; +} + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Context Menu Operator * \{ */ diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index fd713e7094a..3b7fe45f9c8 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -328,6 +328,7 @@ static void buttons_main_region_listener(wmWindow *UNUSED(win), static void buttons_operatortypes(void) { + WM_operatortype_append(BUTTONS_OT_toggle_pin); WM_operatortype_append(BUTTONS_OT_context_menu); WM_operatortype_append(BUTTONS_OT_file_browse); WM_operatortype_append(BUTTONS_OT_directory_browse); -- cgit v1.2.3 From a69ddea29d50baef08380faed087483725c2bc1a Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 11 Sep 2020 14:26:05 -0500 Subject: Cleanup: Remove unused variables and function Somehow these changes were lost while pulling the previous commit from the property-search-ui-v2 branch. --- source/blender/editors/space_buttons/buttons_context.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 9228853ed19..84a020a9ed7 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1115,27 +1115,11 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r /************************* Drawing the Path ************************/ -static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) -{ - SpaceProperties *sbuts = CTX_wm_space_properties(C); - - if (sbuts->flag & SB_PIN_CONTEXT) { - sbuts->pinid = buttons_context_id_path(C); - } - else { - sbuts->pinid = NULL; - } - - ED_area_tag_redraw(CTX_wm_area(C)); -} - void buttons_context_draw(const bContext *C, uiLayout *layout) { SpaceProperties *sbuts = CTX_wm_space_properties(C); ButsContextPath *path = sbuts->path; uiLayout *row, *sub; - uiBlock *block; - uiBut *but; PointerRNA *ptr; char namebuf[128], *name; int a, icon; -- cgit v1.2.3 From b00820c04d2f06bd483b41d07d195b3bfc2f60ba Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Fri, 11 Sep 2020 13:38:14 -0600 Subject: Cleanup: Fix build warning with MSVC MSVC warns on MEM_freeN being fed a const pointer --- source/blender/editors/interface/interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 0bd4934dd0f..10650da4b0e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -6676,7 +6676,7 @@ static void operator_enum_search_update_fn(const struct bContext *C, } } - MEM_freeN(filtered_items); + MEM_freeN((void *)filtered_items); BLI_string_search_free(search); if (do_free) { -- cgit v1.2.3 From 4eda60c2d82de0d7f7ded8ddf1036aea040e9c0d Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Fri, 11 Sep 2020 22:59:21 -0300 Subject: Fix T80677: Absolute grid snapping doesn't work with constraints Regression introduced in rB546b900194f0 --- .../editors/transform/transform_constraints.c | 51 +++---------- .../transform/transform_mode_edge_seq_slide.c | 27 ++++--- .../editors/transform/transform_mode_translate.c | 61 ++++++++------- source/blender/editors/transform/transform_snap.c | 87 ++++++---------------- 4 files changed, 85 insertions(+), 141 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 84eac3bbf8f..0eaae7f17cd 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -163,41 +163,6 @@ void constraintNumInput(TransInfo *t, float vec[3]) } } -static void postConstraintChecks(TransInfo *t, float vec[3]) -{ - mul_m3_v3(t->spacemtx_inv, vec); - - transform_snap_increment(t, vec); - - if (t->flag & T_NULL_ONE) { - if (!(t->con.mode & CON_AXIS0)) { - vec[0] = 1.0f; - } - - if (!(t->con.mode & CON_AXIS1)) { - vec[1] = 1.0f; - } - - if (!(t->con.mode & CON_AXIS2)) { - vec[2] = 1.0f; - } - } - - if (applyNumInput(&t->num, vec)) { - constraintNumInput(t, vec); - removeAspectRatio(t, vec); - } - - /* If `t->values` is operator param, use that directly but not if snapping is forced */ - if (t->flag & T_INPUT_IS_VALUES_FINAL && (t->tsnap.status & SNAP_FORCED) == 0) { - copy_v3_v3(vec, t->values); - constraintValuesFinal(t, vec); - /* inverse transformation at the end */ - } - - mul_m3_v3(t->spacemtx, vec); -} - static void viewAxisCorrectCenter(const TransInfo *t, float t_con_center[3]) { if (t->spacetype == SPACE_VIEW3D) { @@ -432,15 +397,22 @@ static void applyAxisConstraintVec( { copy_v3_v3(out, in); if (!td && t->con.mode & CON_APPLY) { + bool is_snap_to_point = false, is_snap_to_edge = false, is_snap_to_face = false; mul_m3_v3(t->con.pmtx, out); - bool is_snap_to_edge = false, is_snap_to_face = false; + if (activeSnap(t)) { - is_snap_to_edge = (t->tsnap.snapElem & SCE_SNAP_MODE_EDGE) != 0; - is_snap_to_face = (t->tsnap.snapElem & SCE_SNAP_MODE_FACE) != 0; + if (validSnap(t)) { + is_snap_to_point = (t->tsnap.snapElem & SCE_SNAP_MODE_VERTEX) != 0; + is_snap_to_edge = (t->tsnap.snapElem & SCE_SNAP_MODE_EDGE) != 0; + is_snap_to_face = (t->tsnap.snapElem & SCE_SNAP_MODE_FACE) != 0; + } + else if (t->tsnap.snapElem & SCE_SNAP_MODE_GRID) { + is_snap_to_point = true; + } } /* With snap points, a projection is alright, no adjustments needed. */ - if (!validSnap(t) || is_snap_to_edge || is_snap_to_face) { + if (!is_snap_to_point || is_snap_to_edge || is_snap_to_face) { const int dims = getConstraintSpaceDimension(t); if (dims == 2) { if (!is_zero_v3(out)) { @@ -486,7 +458,6 @@ static void applyAxisConstraintVec( } } } - postConstraintChecks(t, out); } } diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c b/source/blender/editors/transform/transform_mode_edge_seq_slide.c index 141f9acdeb4..d2474d78387 100644 --- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c @@ -93,22 +93,29 @@ static void applySeqSlideValue(TransInfo *t, const float val[2]) static void applySeqSlide(TransInfo *t, const int mval[2]) { char str[UI_MAX_DRAW_STR]; + float values_final[3]; snapSequenceBounds(t, mval); - - if (t->con.mode & CON_APPLY) { - float tvec[3]; - t->con.applyVec(t, NULL, NULL, t->values, tvec); - copy_v3_v3(t->values_final, tvec); + if (applyNumInput(&t->num, values_final)) { + if (t->con.mode & CON_APPLY) { + if (t->con.mode & CON_AXIS0) { + /* Do nothing. */ + } + else { + mul_v2_v2fl(values_final, t->spacemtx[1], values_final[0]); + } + } + } + else if (t->con.mode & CON_APPLY) { + t->con.applyVec(t, NULL, NULL, t->values, values_final); } else { - // transform_snap_increment(t, t->values); - applyNumInput(&t->num, t->values); - copy_v3_v3(t->values_final, t->values); + copy_v2_v2(values_final, t->values); } - t->values_final[0] = floorf(t->values_final[0] + 0.5f); - t->values_final[1] = floorf(t->values_final[1] + 0.5f); + values_final[0] = floorf(values_final[0] + 0.5f); + values_final[1] = floorf(values_final[1] + 0.5f); + copy_v2_v2(t->values_final, values_final); headerSeqSlide(t, t->values_final, str); applySeqSlideValue(t, t->values_final); diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c index 866b9d921c8..758a6d04f11 100644 --- a/source/blender/editors/transform/transform_mode_translate.c +++ b/source/blender/editors/transform/transform_mode_translate.c @@ -360,42 +360,49 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2])) if (t->flag & T_INPUT_IS_VALUES_FINAL) { mul_v3_m3v3(global_dir, t->spacemtx, t->values); } + else if (applyNumInput(&t->num, global_dir)) { + if (t->con.mode & CON_APPLY) { + if (t->con.mode & CON_AXIS0) { + /* Do nothing. */ + } + else if (t->con.mode & CON_AXIS1) { + mul_v3_v3fl(global_dir, t->spacemtx[1], global_dir[0]); + } + else if (t->con.mode & CON_AXIS2) { + mul_v3_v3fl(global_dir, t->spacemtx[2], global_dir[0]); + } + } + } else { copy_v3_v3(global_dir, t->values); - if (applyNumInput(&t->num, global_dir)) { - removeAspectRatio(t, global_dir); + + t->tsnap.snapElem = 0; + applySnapping(t, global_dir); + transform_snap_grid(t, global_dir); + + if (t->con.mode & CON_APPLY) { + float in[3]; + copy_v3_v3(in, global_dir); + t->con.applyVec(t, NULL, NULL, in, global_dir); } - else { - applySnapping(t, global_dir); - if (!validSnap(t) && !(t->con.mode & CON_APPLY)) { - float dist_sq = FLT_MAX; - if (transform_snap_grid(t, global_dir)) { - dist_sq = len_squared_v3v3(t->values, global_dir); - } + float incr_dir[3]; + mul_v3_m3v3(incr_dir, t->spacemtx_inv, global_dir); + if (transform_snap_increment(t, incr_dir)) { + mul_v3_m3v3(incr_dir, t->spacemtx, incr_dir); - /* Check the snap distance to the initial value to work with mixed snap. */ - float increment_loc[3]; - copy_v3_v3(increment_loc, t->values); - if (transform_snap_increment(t, increment_loc)) { - if ((dist_sq == FLT_MAX) || (len_squared_v3v3(t->values, increment_loc) < dist_sq)) { - copy_v3_v3(global_dir, increment_loc); - } - } + /* Test for mixed snap with grid. */ + float snap_dist_sq = FLT_MAX; + if (t->tsnap.snapElem != 0) { + snap_dist_sq = len_squared_v3v3(t->values, global_dir); + } + if ((snap_dist_sq == FLT_MAX) || (len_squared_v3v3(global_dir, incr_dir) < snap_dist_sq)) { + copy_v3_v3(global_dir, incr_dir); } } } - if (t->con.mode & CON_APPLY) { - float in[3]; - copy_v3_v3(in, global_dir); - t->con.applyVec(t, NULL, NULL, in, global_dir); - headerTranslation(t, global_dir, str); - } - else { - headerTranslation(t, global_dir, str); - } - + headerTranslation(t, global_dir, str); applyTranslationValue(t, global_dir); /* evil hack - redo translation if clipping needed */ diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 1813acadb9e..c45148691b0 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -464,6 +464,7 @@ void applySnapping(TransInfo *t, float *vec) void resetSnapping(TransInfo *t) { t->tsnap.status = 0; + t->tsnap.snapElem = 0; t->tsnap.align = false; t->tsnap.project = 0; t->tsnap.mode = 0; @@ -1412,12 +1413,12 @@ void snapSequenceBounds(TransInfo *t, const int mval[2]) t->values[0] = frame_near - frame_snap; } -static void snap_grid_apply_ex( +static void snap_grid_apply( TransInfo *t, const int max_index, const float grid_dist, const float loc[3], float r_out[3]) { + BLI_assert(max_index <= 2); const float *center_global = t->center_global; const float *asp = t->aspect; - bool use_local_axis = false; /* use a fallback for cursor selection, * this isn't useful as a global center for absolute grid snapping @@ -1427,74 +1428,27 @@ static void snap_grid_apply_ex( center_global = cd->global; } - if (t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2)) { - use_local_axis = true; + float in[3]; + if (t->con.mode & CON_APPLY) { + BLI_assert(t->tsnap.snapElem == 0); + t->con.applyVec(t, NULL, NULL, loc, in); + } + else { + copy_v3_v3(in, loc); } for (int i = 0; i <= max_index; i++) { - /* do not let unconstrained axis jump to absolute grid increments */ - if (!(t->con.mode & CON_APPLY) || t->con.mode & (CON_AXIS0 << i)) { - const float iter_fac = grid_dist * asp[i]; - - if (use_local_axis) { - float local_axis[3]; - float pos_on_axis[3]; - - copy_v3_v3(local_axis, t->spacemtx[i]); - copy_v3_v3(pos_on_axis, t->spacemtx[i]); - - /* amount of movement on axis from initial pos */ - mul_v3_fl(pos_on_axis, loc[i]); - - /* actual global position on axis */ - add_v3_v3(pos_on_axis, center_global); - - float min_dist = INFINITY; - for (int j = 0; j < 3; j++) { - if (fabs(local_axis[j]) < 0.01f) { - /* Ignore very small (normalized) axis changes */ - continue; - } - - /* closest point on grid */ - float grid_p = iter_fac * roundf(pos_on_axis[j] / iter_fac); - float dist_p = fabs((grid_p - pos_on_axis[j]) / local_axis[j]); - - /* The amount of distance needed to travel along the - * local axis to snap to the closest grid point */ - /* in the global j axis direction */ - float move_dist = (grid_p - center_global[j]) / local_axis[j]; - - if (dist_p < min_dist) { - min_dist = dist_p; - r_out[i] = move_dist; - } - } - } - else { - r_out[i] = iter_fac * roundf((loc[i] + center_global[i]) / iter_fac) - center_global[i]; - } - } + const float iter_fac = grid_dist * asp[i]; + r_out[i] = iter_fac * roundf((in[i] + center_global[i]) / iter_fac) - center_global[i]; } } -static void snap_grid_apply(TransInfo *t, int max_index, const float grid_dist, float *r_val) +bool transform_snap_grid(TransInfo *t, float *val) { - BLI_assert(t->tsnap.mode & SCE_SNAP_MODE_GRID); - BLI_assert(max_index <= 2); - - /* Early bailing out if no need to snap */ - if (grid_dist == 0.0f) { - return; + if (!activeSnap(t)) { + return false; } - /* absolute snapping on grid based on global center. - * for now only 3d view (others can be added if we want) */ - snap_grid_apply_ex(t, max_index, grid_dist, r_val, r_val); -} - -bool transform_snap_grid(TransInfo *t, float *val) -{ if ((!(t->tsnap.mode & SCE_SNAP_MODE_GRID)) || validSnap(t)) { /* Don't do grid snapping if there is a valid snap point. */ return false; @@ -1508,10 +1462,15 @@ bool transform_snap_grid(TransInfo *t, float *val) return false; } - float grid_dist = activeSnap(t) ? (t->modifiers & MOD_PRECISION) ? t->snap[2] : t->snap[1] : - t->snap[0]; + float grid_dist = (t->modifiers & MOD_PRECISION) ? t->snap[2] : t->snap[1]; + + /* Early bailing out if no need to snap */ + if (grid_dist == 0.0f) { + return; + } - snap_grid_apply(t, t->idx_max, grid_dist, val); + snap_grid_apply(t, t->idx_max, grid_dist, val, val); + t->tsnap.snapElem = SCE_SNAP_MODE_GRID; return true; } -- cgit v1.2.3 From 77f6d9dbc999f87fc1dcb4974659bb3be75be639 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Sep 2020 13:42:12 +1000 Subject: Fix missing return value in fix for T80677 --- source/blender/editors/transform/transform_snap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index c45148691b0..a546aabd095 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -1466,7 +1466,7 @@ bool transform_snap_grid(TransInfo *t, float *val) /* Early bailing out if no need to snap */ if (grid_dist == 0.0f) { - return; + return false; } snap_grid_apply(t, t->idx_max, grid_dist, val, val); -- cgit v1.2.3 From ad5f1d02318a30c545196f124e30504615294416 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Sep 2020 13:38:12 +1000 Subject: Fix T71605: Crash toggling dynamic topology in background mode Support toggling without an undo stack in background mode. --- .../blender/editors/sculpt_paint/sculpt_dyntopo.c | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c index f07d22ed639..9b4b5b8d1e2 100644 --- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c +++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c @@ -36,6 +36,7 @@ #include "BKE_brush.h" #include "BKE_context.h" +#include "BKE_global.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" @@ -58,6 +59,7 @@ #include "ED_object.h" #include "ED_screen.h" #include "ED_sculpt.h" +#include "ED_undo.h" #include "ED_view3d.h" #include "paint_intern.h" #include "sculpt_intern.h" @@ -285,11 +287,17 @@ void sculpt_dynamic_topology_disable_with_undo(Main *bmain, Object *ob) { SculptSession *ss = ob->sculpt; - if (ss->bm) { - SCULPT_undo_push_begin("Dynamic topology disable"); - SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END); + if (ss->bm != NULL) { + /* May be false in background mode. */ + const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true; + if (use_undo) { + SCULPT_undo_push_begin("Dynamic topology disable"); + SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END); + } SCULPT_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, NULL); - SCULPT_undo_push_end(); + if (use_undo) { + SCULPT_undo_push_end(); + } } } @@ -300,10 +308,16 @@ static void sculpt_dynamic_topology_enable_with_undo(Main *bmain, { SculptSession *ss = ob->sculpt; if (ss->bm == NULL) { - SCULPT_undo_push_begin("Dynamic topology enable"); + /* May be false in background mode. */ + const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true; + if (use_undo) { + SCULPT_undo_push_begin("Dynamic topology enable"); + } SCULPT_dynamic_topology_enable_ex(bmain, depsgraph, scene, ob); - SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN); - SCULPT_undo_push_end(); + if (use_undo) { + SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN); + SCULPT_undo_push_end(); + } } } -- cgit v1.2.3 From 29af082e4a0f46659f9c54b435ade36f999baa4b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Sep 2020 17:55:36 +1000 Subject: Fix T70255: Setting file browser bookmark from Python crashes Support setting bookmarks even when the file browser isn't the active space. --- source/blender/editors/include/ED_fileselect.h | 1 + source/blender/editors/space_file/file_intern.h | 7 +++-- source/blender/editors/space_file/file_ops.c | 39 ++++++++++++++++--------- source/blender/editors/space_file/filesel.c | 29 ++++++++++++++---- 4 files changed, 53 insertions(+), 23 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 47b8eb543f4..341f97943a5 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -150,6 +150,7 @@ int ED_file_extension_icon(const char *path); void ED_file_read_bookmarks(void); +void ED_file_change_dir_ex(struct bContext *C, struct bScreen *screen, struct ScrArea *area); void ED_file_change_dir(struct bContext *C); void ED_file_path_button(struct bScreen *screen, diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 44131693628..b459c02d9e5 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -39,6 +39,7 @@ struct View2D; void file_calc_previews(const bContext *C, ARegion *region); void file_draw_list(const bContext *C, ARegion *region); +void file_draw_check_ex(bContext *C, struct ScrArea *area); void file_draw_check(bContext *C); void file_draw_check_cb(bContext *C, void *arg1, void *arg2); bool file_draw_check_exists(SpaceFile *sfile); @@ -80,13 +81,13 @@ void file_filename_enter_handle(bContext *C, void *arg_unused, void *arg_but); int file_highlight_set(struct SpaceFile *sfile, struct ARegion *region, int mx, int my); void file_sfile_filepath_set(struct SpaceFile *sfile, const char *filepath); -void file_sfile_to_operator_ex(bContext *C, +void file_sfile_to_operator_ex(struct Main *bmain, struct wmOperator *op, struct SpaceFile *sfile, char *filepath); -void file_sfile_to_operator(bContext *C, struct wmOperator *op, struct SpaceFile *sfile); +void file_sfile_to_operator(struct Main *bmain, struct wmOperator *op, struct SpaceFile *sfile); -void file_operator_to_sfile(bContext *C, struct SpaceFile *sfile, struct wmOperator *op); +void file_operator_to_sfile(struct Main *bmain, struct SpaceFile *sfile, struct wmOperator *op); /* filesel.c */ void fileselect_file_set(SpaceFile *sfile, const int index); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 8c4b2a1b8a6..b3587fc7f97 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1432,9 +1432,8 @@ void FILE_OT_cancel(struct wmOperatorType *ot) /** \name Operator Utilities * \{ */ -void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, char *filepath) +void file_sfile_to_operator_ex(Main *bmain, wmOperator *op, SpaceFile *sfile, char *filepath) { - Main *bmain = CTX_data_main(C); PropertyRNA *prop; /* XXX, not real length */ @@ -1507,16 +1506,15 @@ void file_sfile_to_operator_ex(bContext *C, wmOperator *op, SpaceFile *sfile, ch } } } -void file_sfile_to_operator(bContext *C, wmOperator *op, SpaceFile *sfile) +void file_sfile_to_operator(Main *bmain, wmOperator *op, SpaceFile *sfile) { - char filepath[FILE_MAX]; + char filepath_dummy[FILE_MAX]; - file_sfile_to_operator_ex(C, op, sfile, filepath); + file_sfile_to_operator_ex(bmain, op, sfile, filepath_dummy); } -void file_operator_to_sfile(bContext *C, SpaceFile *sfile, wmOperator *op) +void file_operator_to_sfile(Main *bmain, SpaceFile *sfile, wmOperator *op) { - Main *bmain = CTX_data_main(C); PropertyRNA *prop; /* If neither of the above are set, split the filepath back */ @@ -1569,25 +1567,37 @@ void file_sfile_filepath_set(SpaceFile *sfile, const char *filepath) } } -void file_draw_check(bContext *C) +void file_draw_check_ex(bContext *C, ScrArea *area) { - SpaceFile *sfile = CTX_wm_space_file(C); + /* May happen when manipulating non-active spaces. */ + if (UNLIKELY(area->spacetype != SPACE_FILE)) { + return; + } + SpaceFile *sfile = area->spacedata.first; wmOperator *op = sfile->op; if (op) { /* fail on reload */ if (op->type->check) { - file_sfile_to_operator(C, op, sfile); + Main *bmain = CTX_data_main(C); + file_sfile_to_operator(bmain, op, sfile); /* redraw */ if (op->type->check(C, op)) { - file_operator_to_sfile(C, sfile, op); + file_operator_to_sfile(bmain, sfile, op); /* redraw, else the changed settings wont get updated */ - ED_area_tag_redraw(CTX_wm_area(C)); + ED_area_tag_redraw(area); } } } } +void file_draw_check(bContext *C) +{ + SpaceFile *sfile = CTX_wm_space_file(C); + ScrArea *area = CTX_wm_area(C); + file_draw_check_ex(C, area); +} + /* for use with; UI_block_func_set */ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) { @@ -1675,7 +1685,7 @@ static int file_exec(bContext *C, wmOperator *exec_op) sfile->op = NULL; - file_sfile_to_operator_ex(C, op, sfile, filepath); + file_sfile_to_operator_ex(bmain, op, sfile, filepath); if (BLI_exists(sfile->params->dir)) { fsmenu_insert_entry(ED_fsmenu_get(), @@ -2091,6 +2101,7 @@ void FILE_OT_smoothscroll(wmOperatorType *ot) static int filepath_drop_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); SpaceFile *sfile = CTX_wm_space_file(C); if (sfile) { @@ -2105,7 +2116,7 @@ static int filepath_drop_exec(bContext *C, wmOperator *op) file_sfile_filepath_set(sfile, filepath); if (sfile->op) { - file_sfile_to_operator(C, sfile->op, sfile); + file_sfile_to_operator(bmain, sfile->op, sfile); file_draw_check(C); } diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 306d6cba50e..9fc4e8936f4 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -828,13 +828,23 @@ FileLayout *ED_fileselect_get_layout(struct SpaceFile *sfile, ARegion *region) return sfile->layout; } -void ED_file_change_dir(bContext *C) +/** + * Support updating the directory even when this isn't the active space + * needed so RNA properties update function isn't context sensitive, see T70255. + */ +void ED_file_change_dir_ex(bContext *C, bScreen *screen, ScrArea *area) { - wmWindowManager *wm = CTX_wm_manager(C); - SpaceFile *sfile = CTX_wm_space_file(C); - + /* May happen when manipulating non-active spaces. */ + if (UNLIKELY(area->spacetype != SPACE_FILE)) { + return; + } + SpaceFile *sfile = area->spacedata.first; if (sfile->params) { - ED_fileselect_clear(wm, CTX_data_scene(C), sfile); + wmWindowManager *wm = CTX_wm_manager(C); + Scene *scene = WM_windows_scene_get_from_screen(wm, screen); + if (LIKELY(scene != NULL)) { + ED_fileselect_clear(wm, scene, sfile); + } /* Clear search string, it is very rare to want to keep that filter while changing dir, * and usually very annoying to keep it actually! */ @@ -853,10 +863,17 @@ void ED_file_change_dir(bContext *C) folderlist_pushdir(sfile->folders_prev, sfile->params->dir); - file_draw_check(C); + file_draw_check_ex(C, area); } } +void ED_file_change_dir(bContext *C) +{ + bScreen *screen = CTX_wm_screen(C); + ScrArea *area = CTX_wm_area(C); + ED_file_change_dir_ex(C, screen, area); +} + int file_select_match(struct SpaceFile *sfile, const char *pattern, char *matched_file) { int match = 0; -- cgit v1.2.3 From 6432fa488a8a8ac43f340d492da4fbca0f94e085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 12 Sep 2020 15:49:53 +0200 Subject: Cleanup: Remove GLEW dependencies outside of GL module --- source/blender/editors/animation/CMakeLists.txt | 4 ---- source/blender/editors/armature/CMakeLists.txt | 5 ----- source/blender/editors/curve/CMakeLists.txt | 5 ----- source/blender/editors/gizmo_library/CMakeLists.txt | 5 ----- source/blender/editors/gpencil/CMakeLists.txt | 5 ----- source/blender/editors/interface/CMakeLists.txt | 5 ----- source/blender/editors/mask/CMakeLists.txt | 5 ----- source/blender/editors/mesh/CMakeLists.txt | 5 ----- source/blender/editors/object/CMakeLists.txt | 5 ----- source/blender/editors/physics/CMakeLists.txt | 5 ----- source/blender/editors/render/CMakeLists.txt | 5 ----- source/blender/editors/screen/CMakeLists.txt | 5 ----- source/blender/editors/sculpt_paint/CMakeLists.txt | 5 ----- source/blender/editors/space_action/CMakeLists.txt | 5 ----- source/blender/editors/space_buttons/CMakeLists.txt | 5 ----- source/blender/editors/space_clip/CMakeLists.txt | 5 ----- source/blender/editors/space_console/CMakeLists.txt | 5 ----- source/blender/editors/space_file/CMakeLists.txt | 5 ----- source/blender/editors/space_graph/CMakeLists.txt | 5 ----- source/blender/editors/space_image/CMakeLists.txt | 5 ----- source/blender/editors/space_info/CMakeLists.txt | 5 ----- source/blender/editors/space_nla/CMakeLists.txt | 4 ---- source/blender/editors/space_node/CMakeLists.txt | 4 ---- source/blender/editors/space_outliner/CMakeLists.txt | 4 ---- source/blender/editors/space_script/CMakeLists.txt | 4 ---- source/blender/editors/space_sequencer/CMakeLists.txt | 4 ---- source/blender/editors/space_statusbar/CMakeLists.txt | 4 ---- source/blender/editors/space_text/CMakeLists.txt | 4 ---- source/blender/editors/space_topbar/CMakeLists.txt | 4 ---- source/blender/editors/space_view3d/CMakeLists.txt | 4 ---- source/blender/editors/transform/CMakeLists.txt | 4 ---- source/blender/editors/util/CMakeLists.txt | 4 ---- source/blender/editors/uvedit/CMakeLists.txt | 4 ---- 33 files changed, 152 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index ce6778a1ff9..1ca9a844feb 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -30,9 +30,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC anim_channels_defines.c @@ -69,6 +66,5 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt index 71c7febe192..98c050950be 100644 --- a/source/blender/editors/armature/CMakeLists.txt +++ b/source/blender/editors/armature/CMakeLists.txt @@ -31,10 +31,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC armature_add.c armature_edit.c @@ -67,6 +63,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/curve/CMakeLists.txt b/source/blender/editors/curve/CMakeLists.txt index ff80c47baa8..877c2d99102 100644 --- a/source/blender/editors/curve/CMakeLists.txt +++ b/source/blender/editors/curve/CMakeLists.txt @@ -31,10 +31,6 @@ set(INC ../../../../extern/curve_fit_nd ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC curve_ops.c editcurve.c @@ -59,6 +55,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_curve "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/gizmo_library/CMakeLists.txt b/source/blender/editors/gizmo_library/CMakeLists.txt index 1f3edf31b19..eeb1e60166b 100644 --- a/source/blender/editors/gizmo_library/CMakeLists.txt +++ b/source/blender/editors/gizmo_library/CMakeLists.txt @@ -32,10 +32,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC gizmo_draw_utils.c gizmo_geometry.h @@ -59,6 +55,5 @@ set(SRC set(LIB ) -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_gizmo_library "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt index 735ad8bc039..20408327105 100644 --- a/source/blender/editors/gpencil/CMakeLists.txt +++ b/source/blender/editors/gpencil/CMakeLists.txt @@ -31,10 +31,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC annotate_draw.c annotate_paint.c @@ -75,6 +71,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index e4fb0631f06..680cf3ea01a 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -34,10 +34,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC interface.c interface_align.c @@ -113,6 +109,5 @@ if(WIN32) endif() endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_interface "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/mask/CMakeLists.txt b/source/blender/editors/mask/CMakeLists.txt index 66c055d9426..dd04732a814 100644 --- a/source/blender/editors/mask/CMakeLists.txt +++ b/source/blender/editors/mask/CMakeLists.txt @@ -30,10 +30,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC mask_add.c mask_draw.c @@ -51,6 +47,5 @@ set(SRC set(LIB ) -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_mask "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 589b51ce942..035af772a55 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -35,10 +35,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC editface.c editmesh_add.c @@ -97,6 +93,5 @@ if(WITH_GMP) add_definitions(-DWITH_GMP) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_mesh "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 953ef8114f9..be6c0658b1f 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -39,10 +39,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC object_add.c object_bake.c @@ -81,7 +77,6 @@ set(LIB bf_windowmanager ) -add_definitions(${GL_DEFINITIONS}) if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) diff --git a/source/blender/editors/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 0998280c381..2b9d9aaa0e1 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -30,10 +30,6 @@ set(INC ../../../../intern/mantaflow/extern ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC dynamicpaint_ops.c particle_boids.c @@ -74,6 +70,5 @@ if(WITH_BULLET) add_definitions(-DWITH_BULLET) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_physics "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 7f7748bf52f..642e92592f1 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -34,10 +34,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC render_internal.c render_opengl.c @@ -61,7 +57,6 @@ else() ) endif() -add_definitions(${GL_DEFINITIONS}) if(WITH_FREESTYLE) list(APPEND INC diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt index dc355148ad3..1de5ad729c5 100644 --- a/source/blender/editors/screen/CMakeLists.txt +++ b/source/blender/editors/screen/CMakeLists.txt @@ -33,10 +33,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC area.c area_query.c @@ -64,6 +60,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 51cfb912722..930f9890dd9 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -36,10 +36,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC paint_cursor.c paint_curve.c @@ -90,6 +86,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_sculpt_paint "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_action/CMakeLists.txt b/source/blender/editors/space_action/CMakeLists.txt index 6c43f8b9549..10dcc77fc24 100644 --- a/source/blender/editors/space_action/CMakeLists.txt +++ b/source/blender/editors/space_action/CMakeLists.txt @@ -28,10 +28,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC action_buttons.c action_data.c @@ -49,6 +45,5 @@ set(LIB bf_blenlib ) -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt index 75d91174470..ce0787dbdb9 100644 --- a/source/blender/editors/space_buttons/CMakeLists.txt +++ b/source/blender/editors/space_buttons/CMakeLists.txt @@ -28,10 +28,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC buttons_context.c buttons_ops.c @@ -48,7 +44,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) diff --git a/source/blender/editors/space_clip/CMakeLists.txt b/source/blender/editors/space_clip/CMakeLists.txt index 2ea4bc97d18..8c7f59d61dd 100644 --- a/source/blender/editors/space_clip/CMakeLists.txt +++ b/source/blender/editors/space_clip/CMakeLists.txt @@ -33,10 +33,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC clip_buttons.c clip_dopesheet_draw.c @@ -68,7 +64,6 @@ set(LIB bf_blenlib ) -add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) diff --git a/source/blender/editors/space_console/CMakeLists.txt b/source/blender/editors/space_console/CMakeLists.txt index 33934832ccc..e5aedd0d0de 100644 --- a/source/blender/editors/space_console/CMakeLists.txt +++ b/source/blender/editors/space_console/CMakeLists.txt @@ -28,10 +28,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC console_draw.c console_ops.c @@ -49,6 +45,5 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_console "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index 84df11ea39c..dcacf5e2504 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -33,10 +33,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC file_draw.c file_ops.c @@ -95,7 +91,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt index 8170c920990..fd5c5863608 100644 --- a/source/blender/editors/space_graph/CMakeLists.txt +++ b/source/blender/editors/space_graph/CMakeLists.txt @@ -29,10 +29,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC graph_buttons.c graph_draw.c @@ -67,6 +63,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 24ec7a89397..96aab8b5d1a 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -35,10 +35,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC image_buttons.c image_draw.c @@ -81,6 +77,5 @@ if(WITH_IMAGE_CINEON) add_definitions(-DWITH_CINEON) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_image "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt index ad410e0aade..b6df07eec4e 100644 --- a/source/blender/editors/space_info/CMakeLists.txt +++ b/source/blender/editors/space_info/CMakeLists.txt @@ -33,10 +33,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) - set(SRC info_draw.c info_ops.c @@ -56,6 +52,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index 60152bffaf4..9a94d28c604 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -29,9 +29,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC nla_buttons.c @@ -54,6 +51,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index f8c30f9a688..fc831bf8490 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -34,9 +34,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC drawnode.c @@ -75,6 +72,5 @@ if(WITH_OPENIMAGEDENOISE) add_definitions(-DWITH_OPENIMAGEDENOISE) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt index 616915dbc2c..db38839f959 100644 --- a/source/blender/editors/space_outliner/CMakeLists.txt +++ b/source/blender/editors/space_outliner/CMakeLists.txt @@ -30,9 +30,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC outliner_collections.c @@ -60,6 +57,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt index 0bd2a01a151..f2dd39ea13d 100644 --- a/source/blender/editors/space_script/CMakeLists.txt +++ b/source/blender/editors/space_script/CMakeLists.txt @@ -27,9 +27,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC script_edit.c @@ -49,6 +46,5 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_script "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt index 8105891e157..caf75349454 100644 --- a/source/blender/editors/space_sequencer/CMakeLists.txt +++ b/source/blender/editors/space_sequencer/CMakeLists.txt @@ -32,9 +32,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC sequencer_add.c @@ -73,6 +70,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_sequencer "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_statusbar/CMakeLists.txt b/source/blender/editors/space_statusbar/CMakeLists.txt index ad4c060a1f6..a0f3afecaf9 100644 --- a/source/blender/editors/space_statusbar/CMakeLists.txt +++ b/source/blender/editors/space_statusbar/CMakeLists.txt @@ -29,9 +29,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC space_statusbar.c @@ -42,6 +39,5 @@ set(LIB bf_blenlib ) -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_statusbar "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index 740fc9948ef..abd7620ea2b 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -29,9 +29,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC space_text.c @@ -56,7 +53,6 @@ set(LIB bf_blenlib ) -add_definitions(${GL_DEFINITIONS}) if(WITH_PYTHON) list(APPEND INC diff --git a/source/blender/editors/space_topbar/CMakeLists.txt b/source/blender/editors/space_topbar/CMakeLists.txt index d56e1da334d..15e71e2296d 100644 --- a/source/blender/editors/space_topbar/CMakeLists.txt +++ b/source/blender/editors/space_topbar/CMakeLists.txt @@ -29,9 +29,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC space_topbar.c @@ -40,6 +37,5 @@ set(SRC set(LIB ) -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_space_topbar "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index f2536cfac62..f4d6f7e322c 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -38,9 +38,6 @@ set(INC ${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC drawobject.c @@ -85,7 +82,6 @@ if(WITH_PYTHON) add_definitions(-DWITH_PYTHON) endif() -add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index b284ba0af2d..f905e96dbdd 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -33,9 +33,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC transform.c @@ -125,6 +122,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index 207606c2dcd..e05d1fedf6d 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -33,9 +33,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC ed_transverts.c @@ -106,7 +103,6 @@ set(SRC set(LIB ) -add_definitions(${GL_DEFINITIONS}) if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index a39234561c2..f1751ef8d27 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -31,9 +31,6 @@ set(INC ../../../../intern/guardedalloc ) -set(INC_SYS - ${GLEW_INCLUDE_PATH} -) set(SRC uvedit_buttons.c @@ -58,6 +55,5 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -add_definitions(${GL_DEFINITIONS}) blender_add_lib(bf_editor_uvedit "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") -- cgit v1.2.3 From bf3f4da9472516be12dcc69740fa69b6d72f1274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 12 Sep 2020 17:29:37 +0200 Subject: GPU: Fix wrong state before python callbacks This was caused by a missing state apply. We force the GPUState to be set after the callbacks to avoid desync between our state tracker and the real gl state. This fixes some issues but a better general fix for all BGL would be better. This fix T80297 2.91 texture alpha is not transparent --- source/blender/editors/space_api/CMakeLists.txt | 1 + source/blender/editors/space_api/spacetypes.c | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt index d948d84f1c3..573afb76f0e 100644 --- a/source/blender/editors/space_api/CMakeLists.txt +++ b/source/blender/editors/space_api/CMakeLists.txt @@ -20,6 +20,7 @@ set(INC ../io ../../blenkernel ../../blenlib + ../../gpu ../../makesdna ../../makesrna ../../windowmanager diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 29ad314cd65..2a18ffafc6c 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -33,6 +33,8 @@ #include "BKE_context.h" #include "BKE_screen.h" +#include "GPU_state.h" + #include "UI_interface.h" #include "UI_view2d.h" @@ -269,12 +271,18 @@ void ED_region_draw_cb_exit(ARegionType *art, void *handle) void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type) { RegionDrawCB *rdc; + bool has_drawn_something = false; for (rdc = region->type->drawcalls.first; rdc; rdc = rdc->next) { if (rdc->type == type) { rdc->draw(C, region, rdc->customdata); + has_drawn_something = true; } } + if (has_drawn_something) { + /* This is needed until we get rid of BGL which can change the states we are tracking. */ + GPU_force_state(); + } } /* ********************* space template *********************** */ -- cgit v1.2.3 From 2e4569abbc6aa19d166ed083c04e046fdc19fce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 12 Sep 2020 19:48:52 +0200 Subject: Fix remaining GL calls/type preventing from building due to recent cleanup --- source/blender/editors/interface/interface_icons.c | 4 ++-- source/blender/editors/sculpt_paint/paint_cursor.c | 20 ++++++++++---------- source/blender/editors/space_image/image_draw.c | 6 ++++-- source/blender/editors/space_view3d/view3d_draw.c | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index c91b4d826a7..d22ddb5f2b7 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -256,7 +256,7 @@ static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc) /* Utilities */ -static void viconutil_set_point(GLint pt[2], int x, int y) +static void viconutil_set_point(int pt[2], int x, int y) { pt[0] = x; pt[1] = y; @@ -264,7 +264,7 @@ static void viconutil_set_point(GLint pt[2], int x, int y) static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha) { - GLint pts[3][2]; + int pts[3][2]; const int cx = x + w / 2 - 4; const int cy = y + w / 2; const int d = w / 5, d2 = w / 7; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 3d8c718c8a9..55abb269660 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -142,7 +142,7 @@ typedef struct LoadTexData { ViewContext *vc; MTex *mtex; - GLubyte *buffer; + uchar *buffer; bool col; struct ImagePool *pool; @@ -160,7 +160,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata, ViewContext *vc = data->vc; MTex *mtex = data->mtex; - GLubyte *buffer = data->buffer; + uchar *buffer = data->buffer; const bool col = data->col; struct ImagePool *pool = data->pool; @@ -230,7 +230,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata, /* Clamp to avoid precision overflow. */ CLAMP(avg, 0.0f, 1.0f); - buffer[index] = 255 - (GLubyte)(255 * avg); + buffer[index] = 255 - (uchar)(255 * avg); } } else { @@ -254,7 +254,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima MTex *mtex = (primary) ? &br->mtex : &br->mask_mtex; ePaintOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags(); - GLubyte *buffer = NULL; + uchar *buffer = NULL; int size; bool refresh; @@ -309,10 +309,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima target->old_col = col; } if (col) { - buffer = MEM_mallocN(sizeof(GLubyte) * size * size * 4, "load_tex"); + buffer = MEM_mallocN(sizeof(uchar) * size * size * 4, "load_tex"); } else { - buffer = MEM_mallocN(sizeof(GLubyte) * size * size, "load_tex"); + buffer = MEM_mallocN(sizeof(uchar) * size * size, "load_tex"); } pool = BKE_image_pool_new(); @@ -381,7 +381,7 @@ static void load_tex_cursor_task_cb(void *__restrict userdata, LoadTexData *data = userdata; Brush *br = data->br; - GLubyte *buffer = data->buffer; + uchar *buffer = data->buffer; const int size = data->size; @@ -398,7 +398,7 @@ static void load_tex_cursor_task_cb(void *__restrict userdata, /* Falloff curve. */ float avg = BKE_brush_curve_strength_clamped(br, len, 1.0f); - buffer[index] = (GLubyte)(255 * avg); + buffer[index] = (uchar)(255 * avg); } else { buffer[index] = 0; @@ -411,7 +411,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) bool init; ePaintOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags(); - GLubyte *buffer = NULL; + uchar *buffer = NULL; int size; const bool refresh = !cursor_snap.overlay_texture || @@ -452,7 +452,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) cursor_snap.size = size; } - buffer = MEM_mallocN(sizeof(GLubyte) * size * size, "load_tex"); + buffer = MEM_mallocN(sizeof(uchar) * size * size, "load_tex"); BKE_curvemapping_init(br->curve); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 85d153feb4c..60dd134646d 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -55,6 +55,7 @@ #include "BIF_glutil.h" +#include "GPU_framebuffer.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" @@ -570,7 +571,8 @@ static void draw_image_buffer(const bContext *C, float zoomy) { /* Image are still drawn in display space. */ - glDisable(GL_FRAMEBUFFER_SRGB); + GPUFrameBuffer *fb = GPU_framebuffer_active_get(); + GPU_framebuffer_bind_no_srgb(fb); int x, y; int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf); @@ -660,7 +662,7 @@ static void draw_image_buffer(const bContext *C, } } - glEnable(GL_FRAMEBUFFER_SRGB); + GPU_framebuffer_bind(fb); } static void draw_image_buffer_repeated(const bContext *C, diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index f3300f21628..0b5daece556 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1065,7 +1065,7 @@ static void draw_rotation_guide(const RegionView3D *rv3d) float o[3]; /* center of rotation */ float end[3]; /* endpoints for drawing */ - GLubyte color[4] = {0, 108, 255, 255}; /* bright blue so it matches device LEDs */ + uchar color[4] = {0, 108, 255, 255}; /* bright blue so it matches device LEDs */ negate_v3_v3(o, rv3d->ofs); -- cgit v1.2.3 From b57cd0e3596d02f2a33a049ea4a9ef1da2c8cdf0 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Sat, 12 Sep 2020 11:30:46 -0500 Subject: Property Search: Use LinkData instead of button for group --- .../blender/editors/interface/interface_layout.c | 37 ++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 53ed60fa357..983c3e5ebd3 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -88,7 +88,7 @@ */ typedef struct uiButtonGroup { void *next, *prev; - ListBase buttons; + ListBase buttons; /* #LinkData with #uiBut data field. */ } uiButtonGroup; typedef struct uiLayoutRoot { @@ -444,11 +444,22 @@ static void layout_root_new_button_group(uiLayoutRoot *root) static void button_group_add_but(uiLayoutRoot *root, uiBut *but) { - uiButtonGroup *current_button_group = root->button_groups.last; + BLI_assert(root != NULL); + uiButtonGroup *current_button_group = root->button_groups.last; BLI_assert(current_button_group != NULL); - BLI_addtail(¤t_button_group->buttons, but); + /* We can't use the button directly because adding it to + * this list would mess with its prev and next pointers. */ + LinkData *button_link = MEM_mallocN(sizeof(LinkData), __func__); + button_link->data = but; + BLI_addtail(¤t_button_group->buttons, button_link); +} + +static void button_group_free(uiButtonGroup *button_group) +{ + BLI_freelistN(&button_group->buttons); + MEM_freeN(button_group); } /** \} */ @@ -5321,8 +5332,11 @@ static void ui_layout_free(uiLayout *layout) static void layout_root_free(uiLayoutRoot *root) { - BLI_freelistN(&root->button_groups); ui_layout_free(root->layout); + + LISTBASE_FOREACH_MUTABLE (uiButtonGroup *, button_group, &root->button_groups) { + button_group_free(button_group); + } MEM_freeN(root); } @@ -5514,24 +5528,15 @@ void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y) block->curlayout = NULL; - LISTBASE_FOREACH (uiLayoutRoot *, root, &block->layouts) { + LISTBASE_FOREACH_MUTABLE (uiLayoutRoot *, root, &block->layouts) { ui_layout_add_padding_button(root); /* NULL in advance so we don't interfere when adding button */ ui_layout_end(block, root->layout, r_x, r_y); - ui_layout_free(root->layout); + layout_root_free(root); } - BLI_freelistN(&block->layouts); - // LISTBASE_FOREACH_MUTABLE (uiLayoutRoot *, root, &block->layouts) { - // ui_layout_add_padding_button(root); - - // /* NULL in advance so we don't interfere when adding button */ - // ui_layout_end(block, root->layout, r_x, r_y); - // layout_root_free(root); - // } - - // BLI_listbase_clear(&block->layouts); + BLI_listbase_clear(&block->layouts); /* XXX silly trick, interface_templates.c doesn't get linked * because it's not used by other files in this module? */ -- cgit v1.2.3