Add ED_paint.h, split out ED_sculpt.h

also rename some functions to match our convention
This commit is contained in:
Campbell Barton 2014-06-23 21:59:34 +10:00
parent 414c70435d
commit 7df2717727
18 changed files with 87 additions and 53 deletions

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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;

View File

@ -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"

View File

@ -38,7 +38,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "ED_sculpt.h"
#include "ED_paint.h"
#include "paint_intern.h"

View File

@ -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;

View File

@ -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"

View File

@ -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"

View File

@ -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 *********************/

View File

@ -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;
}

View File

@ -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 {

View File

@ -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);

View File

@ -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

View File

@ -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"

View File

@ -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"