2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2008 Blender Foundation.
19 * All rights reserved.
22 * Contributor(s): Blender Foundation
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file blender/editors/sculpt_paint/paint_intern.h
32 #ifndef __PAINT_INTERN_H__
33 #define __PAINT_INTERN_H__
51 struct wmOperatorType;
54 typedef int (*StrokeGetLocation)(struct bContext *C, float location[3], float mouse[2]);
55 typedef int (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, const float mouse[2]);
56 typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke, struct PointerRNA *itemptr);
57 typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke);
59 struct PaintStroke *paint_stroke_new(struct bContext *C,
60 StrokeGetLocation get_location, StrokeTestStart test_start,
61 StrokeUpdateStep update_step, StrokeDone done, int event_type);
62 void paint_stroke_data_free(struct wmOperator *op);
64 int paint_space_stroke_enabled(struct Brush *br);
66 struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
67 int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
68 int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
69 int paint_stroke_cancel(struct bContext *C, struct wmOperator *op);
70 struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);
71 void *paint_stroke_mode_data(struct PaintStroke *stroke);
72 void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data);
73 int paint_poll(struct bContext *C);
74 void paint_cursor_start(struct bContext *C, int (*poll)(struct bContext *C));
77 int weight_paint_poll(struct bContext *C);
78 int weight_paint_mode_poll(struct bContext *C);
79 int vertex_paint_poll(struct bContext *C);
80 int vertex_paint_mode_poll(struct bContext *C);
82 void vpaint_fill(struct Object *ob, unsigned int paintcol);
83 void wpaint_fill(struct VPaint *wp, struct Object *ob, float paintweight);
85 void PAINT_OT_weight_paint_toggle(struct wmOperatorType *ot);
86 void PAINT_OT_weight_paint(struct wmOperatorType *ot);
87 void PAINT_OT_weight_set(struct wmOperatorType *ot);
88 void PAINT_OT_weight_from_bones(struct wmOperatorType *ot);
89 void PAINT_OT_weight_sample(struct wmOperatorType *ot);
90 void PAINT_OT_weight_sample_group(struct wmOperatorType *ot);
92 void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
93 void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
95 unsigned int vpaint_get_current_col(struct VPaint *vp);
98 int image_texture_paint_poll(struct bContext *C);
100 void PAINT_OT_image_paint(struct wmOperatorType *ot);
101 void PAINT_OT_grab_clone(struct wmOperatorType *ot);
102 void PAINT_OT_sample_color(struct wmOperatorType *ot);
103 void PAINT_OT_clone_cursor_set(struct wmOperatorType *ot);
104 void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot);
105 void PAINT_OT_project_image(struct wmOperatorType *ot);
106 void PAINT_OT_image_from_view(struct wmOperatorType *ot);
109 int uv_sculpt_poll(struct bContext *C);
111 void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
115 /* Convert the object-space axis-aligned bounding box (expressed as
116 * its minimum and maximum corners) into a screen-space rectangle,
117 * returns zero if the result is empty */
118 int paint_convert_bb_to_rect(struct rcti *rect,
119 const float bb_min[3],
120 const float bb_max[3],
121 const struct ARegion *ar,
122 struct RegionView3D *rv3d,
125 /* Get four planes in object-space that describe the projection of
126 * screen_rect from screen into object-space (essentially converting a
127 * 2D screens-space bounding box into four 3D planes) */
128 void paint_calc_redraw_planes(float planes[4][4],
129 const struct ARegion *ar,
130 struct RegionView3D *rv3d,
132 const struct rcti *screen_rect);
134 void projectf(struct bglMats *mats, const float v[3], float p[2]);
135 float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
136 float paint_get_tex_pixel(struct Brush *br, float u, float v);
137 int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface);
138 void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
140 void paint_sample_color(const struct bContext *C, struct ARegion *ar, int x, int y);
141 void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
143 void PAINT_OT_face_select_linked(struct wmOperatorType *ot);
144 void PAINT_OT_face_select_linked_pick(struct wmOperatorType *ot);
145 void PAINT_OT_face_select_all(struct wmOperatorType *ot);
146 void PAINT_OT_face_select_inverse(struct wmOperatorType *ot);
147 void PAINT_OT_face_select_hide(struct wmOperatorType *ot);
148 void PAINT_OT_face_select_reveal(struct wmOperatorType *ot);
150 void PAINT_OT_vert_select_all(struct wmOperatorType *ot);
151 void PAINT_OT_vert_select_inverse(struct wmOperatorType *ot);
152 int vert_paint_poll(struct bContext *C);
153 int mask_paint_poll(struct bContext *C);
155 int facemask_paint_poll(struct bContext *C);
157 /* stroke operator */
158 typedef enum BrushStrokeMode {
165 typedef void (*UndoRestoreCb)(struct bContext *C, struct ListBase *lb);
166 typedef void (*UndoFreeCb)(struct ListBase *lb);
168 void undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free);
169 struct ListBase *undo_paint_push_get_list(int type);
170 void undo_paint_push_count_alloc(int type, int size);
171 void undo_paint_push_end(int type);
187 void PAINT_OT_hide_show(struct wmOperatorType *ot);
192 PAINT_MASK_FLOOD_VALUE,
194 } PaintMaskFloodMode;
196 void PAINT_OT_mask_flood_fill(struct wmOperatorType *ot);
198 #endif /* __PAINT_INTERN_H__ */