diff --git a/source/blender/editors/include/ED_paint.h b/source/blender/editors/include/ED_paint.h new file mode 100644 index 00000000000..d7e84d8f50d --- /dev/null +++ b/source/blender/editors/include/ED_paint.h @@ -0,0 +1,61 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file ED_paint.h + * \ingroup editors + */ + +#ifndef __ED_PAINT_H__ +#define __ED_PAINT_H__ + +struct bContext; +struct RegionView3D; +struct wmKeyConfig; + +/* paint_ops.c */ +void ED_operatortypes_paint(void); +void ED_keymap_paint(struct wmKeyConfig *keyconf); + +/* paint_undo.c */ +enum { + UNDO_PAINT_IMAGE = 0, + UNDO_PAINT_MESH = 1, +}; + +typedef void (*UndoRestoreCb)(struct bContext *C, struct ListBase *lb); +typedef void (*UndoFreeCb)(struct ListBase *lb); + +int ED_undo_paint_step(struct bContext *C, int type, int step, const char *name); +void ED_undo_paint_step_num(struct bContext *C, int type, int num); +const char *ED_undo_paint_get_name(struct bContext *C, int type, int nr, int *active); +void ED_undo_paint_free(void); +int ED_undo_paint_valid(int type, const char *name); +bool ED_undo_paint_empty(int type); +void ED_undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free); +void ED_undo_paint_push_end(int type); + +/* paint_image.c */ +/* image painting specific undo */ +void ED_image_undo_restore(struct bContext *C, struct ListBase *lb); +void ED_image_undo_free(struct ListBase *lb); +void ED_imapaint_clear_partial_redraw(void); +void ED_imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h); + +#endif /* __ED_PAINT_H__ */ diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index 2e092f7e7fe..85ff9b5d246 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -32,47 +32,17 @@ struct ARegion; struct bContext; -struct MultiresModifierData; struct Object; struct RegionView3D; -struct wmKeyConfig; -struct wmWindowManager; struct ViewContext; struct rcti; /* sculpt.c */ void ED_operatortypes_sculpt(void); -void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar, - struct RegionView3D *rv3d, struct Object *ob); -void ED_sculpt_get_average_stroke(struct Object *ob, float stroke[3]); +void ED_sculpt_redraw_planes_get(float planes[4][4], struct ARegion *ar, + struct RegionView3D *rv3d, struct Object *ob); +void ED_sculpt_stroke_get_average(struct Object *ob, float stroke[3]); bool ED_sculpt_minmax(struct bContext *C, float min[3], float max[3]); -int do_sculpt_mask_box_select(struct bContext *C, struct ViewContext *vc, struct rcti *rect, bool select, bool extend); +int ED_sculpt_mask_box_select(struct bContext *C, struct ViewContext *vc, const struct rcti *rect, bool select, bool extend); -/* paint_ops.c */ -void ED_operatortypes_paint(void); -void ED_keymap_paint(struct wmKeyConfig *keyconf); - -/* paint_undo.c */ -#define UNDO_PAINT_IMAGE 0 -#define UNDO_PAINT_MESH 1 - -typedef void (*UndoRestoreCb)(struct bContext *C, struct ListBase *lb); -typedef void (*UndoFreeCb)(struct ListBase *lb); - -int ED_undo_paint_step(struct bContext *C, int type, int step, const char *name); -void ED_undo_paint_step_num(struct bContext *C, int type, int num); -const char *ED_undo_paint_get_name(struct bContext *C, int type, int nr, int *active); -void ED_undo_paint_free(void); -int ED_undo_paint_valid(int type, const char *name); -bool ED_undo_paint_empty(int type); -void ED_undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free); -void ED_undo_paint_push_end(int type); - -/* image painting specific undo */ -void ED_image_undo_restore(struct bContext *C, struct ListBase *lb); -void ED_image_undo_free(struct ListBase *lb); -void ED_imapaint_clear_partial_redraw(void); -void ED_imapaint_dirty_region(struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h); - - -#endif +#endif /* __ED_SCULPT_H__ */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index d0def6b07d6..34232c51ff7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -69,8 +69,8 @@ #include "ED_image.h" #include "ED_object.h" +#include "ED_paint.h" #include "ED_screen.h" -#include "ED_sculpt.h" #include "ED_view3d.h" #include "WM_api.h" diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 667b487d4b1..4f67fc9cc87 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -46,8 +46,8 @@ #include "BKE_paint.h" #include "BKE_report.h" +#include "ED_paint.h" #include "ED_screen.h" -#include "ED_sculpt.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index cb2a94a0530..399b5044a05 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -73,8 +73,8 @@ #include "UI_view2d.h" +#include "ED_paint.h" #include "ED_screen.h" -#include "ED_sculpt.h" #include "ED_uvedit.h" #include "ED_view3d.h" diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 9363542ba05..364ebac42a7 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -184,7 +184,7 @@ static void flip_plane(float out[4], const float in[4], const char symm) out[3] = in[3]; } -int do_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, rcti *rect, bool select, bool UNUSED(extend)) +int ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *rect, bool select, bool UNUSED(extend)) { Sculpt *sd = vc->scene->toolsettings->sculpt; BoundBox bb; diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 543463cd5f3..9021581d47f 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -40,7 +40,7 @@ #include "BKE_paint.h" #include "BKE_main.h" -#include "ED_sculpt.h" +#include "ED_paint.h" #include "ED_screen.h" #include "ED_image.h" #include "UI_resources.h" diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c index 5bd6526c270..c5c747dbab4 100644 --- a/source/blender/editors/sculpt_paint/paint_undo.c +++ b/source/blender/editors/sculpt_paint/paint_undo.c @@ -38,7 +38,7 @@ #include "BKE_context.h" #include "BKE_global.h" -#include "ED_sculpt.h" +#include "ED_paint.h" #include "paint_intern.h" diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index b2927c83ad7..3f39dc7b6ec 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -115,7 +115,7 @@ static int system_physical_thread_count(void) } #endif /* __APPLE__ */ -void ED_sculpt_get_average_stroke(Object *ob, float stroke[3]) +void ED_sculpt_stroke_get_average(Object *ob, float stroke[3]) { if (ob->sculpt->last_stroke_valid && ob->sculpt->average_stroke_counter > 0) { float fac = 1.0f / ob->sculpt->average_stroke_counter; @@ -489,8 +489,8 @@ static bool sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, return 1; } -void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, - RegionView3D *rv3d, Object *ob) +void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *ar, + RegionView3D *rv3d, Object *ob) { PBVH *pbvh = ob->sculpt->pbvh; /* copy here, original will be used below */ @@ -4483,7 +4483,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str /* update last stroke position */ ob->sculpt->last_stroke_valid = 1; - ED_sculpt_get_average_stroke(ob, ob->sculpt->last_stroke); + ED_sculpt_stroke_get_average(ob, ob->sculpt->last_stroke); sculpt_cache_free(ss->cache); ss->cache = NULL; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 71bd42f4fc4..0d49049c78e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -62,7 +62,8 @@ #include "GPU_buffers.h" -#include "ED_sculpt.h" +#include "ED_paint.h" + #include "bmesh.h" #include "paint_intern.h" #include "sculpt_intern.h" diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 83040a26480..7a74a58c69d 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -53,6 +53,7 @@ #include "ED_mesh.h" #include "ED_node.h" #include "ED_object.h" +#include "ED_paint.h" #include "ED_physics.h" #include "ED_render.h" #include "ED_screen.h" diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index cb2da0c13d2..902398fb6d2 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -72,6 +72,7 @@ #include "RNA_enum_types.h" #include "ED_image.h" +#include "ED_paint.h" #include "ED_render.h" #include "ED_screen.h" #include "ED_space_api.h" @@ -88,7 +89,6 @@ #include "PIL_time.h" #include "image_intern.h" -#include "ED_sculpt.h" /******************** view navigation utilities *********************/ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index a0f6d0d5372..0e010eff94d 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3750,7 +3750,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if (ob->sculpt->partial_redraw) { if (ar->do_draw & RGN_DRAW_PARTIAL) { - sculpt_get_redraw_planes(planes, ar, rv3d, ob); + ED_sculpt_redraw_planes_get(planes, ar, rv3d, ob); fpl = planes; ob->sculpt->partial_redraw = 0; } @@ -3848,7 +3848,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if (ob->sculpt->partial_redraw) { if (ar->do_draw & RGN_DRAW_PARTIAL) { - sculpt_get_redraw_planes(planes, ar, rv3d, ob); + ED_sculpt_redraw_planes_get(planes, ar, rv3d, ob); fpl = planes; ob->sculpt->partial_redraw = 0; } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 98a0d548096..26ede27bb08 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -558,7 +558,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3]) */ if (ob->mode & OB_MODE_SCULPT) { float stroke[3]; - ED_sculpt_get_average_stroke(ob, stroke); + ED_sculpt_stroke_get_average(ob, stroke); copy_v3_v3(lastofs, stroke); } else { diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 1f1317bde2c..32f063d6154 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -2128,7 +2128,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) } else { /* no editmode, unified for bones and objects */ if (vc.obact && vc.obact->mode & OB_MODE_SCULPT) { - ret = do_sculpt_mask_box_select(C, &vc, &rect, select, extend); + ret = ED_sculpt_mask_box_select(C, &vc, &rect, select, extend); } else if (vc.obact && BKE_paint_select_face_test(vc.obact)) { ret = do_paintface_box_select(&vc, &rect, select, extend); diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index 3c051586282..4400870f1b8 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -67,6 +67,7 @@ set(SRC ../include/ED_node.h ../include/ED_numinput.h ../include/ED_object.h + ../include/ED_paint.h ../include/ED_particle.h ../include/ED_physics.h ../include/ED_render.h diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 4dfaed98aab..c27e0b80b02 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -61,7 +61,7 @@ #include "ED_image.h" #include "ED_mesh.h" #include "ED_object.h" -#include "ED_sculpt.h" +#include "ED_paint.h" #include "ED_space_api.h" #include "ED_util.h" diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 458b6e1b481..9461010f49f 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -58,7 +58,7 @@ #include "ED_object.h" #include "ED_render.h" #include "ED_screen.h" -#include "ED_sculpt.h" +#include "ED_paint.h" #include "ED_util.h" #include "ED_text.h"