4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2008 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
29 /** \file blender/editors/sculpt_paint/paint_intern.h
34 #ifndef ED_PAINT_INTERN_H
35 #define ED_PAINT_INTERN_H
51 struct wmOperatorType;
54 typedef int (*StrokeGetLocation)(struct bContext *C, struct PaintStroke *stroke, float location[3], float mouse[2]);
55 typedef int (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
56 typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke, struct PointerRNA *itemptr);
57 typedef void (*StrokeDone)(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_free(struct PaintStroke *stroke);
64 int paint_space_stroke_enabled(struct Brush *br);
66 int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
67 int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
68 struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);
69 void *paint_stroke_mode_data(struct PaintStroke *stroke);
70 void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data);
71 int paint_poll(struct bContext *C);
72 void paint_cursor_start(struct bContext *C, int (*poll)(struct bContext *C));
75 int weight_paint_poll(struct bContext *C);
76 int weight_paint_mode_poll(struct bContext *C);
77 int vertex_paint_poll(struct bContext *C);
78 int vertex_paint_mode_poll(struct bContext *C);
80 void vpaint_fill(struct Object *ob, unsigned int paintcol);
81 void wpaint_fill(struct VPaint *wp, struct Object *ob, float paintweight);
83 void PAINT_OT_weight_paint_toggle(struct wmOperatorType *ot);
84 void PAINT_OT_weight_paint(struct wmOperatorType *ot);
85 void PAINT_OT_weight_set(struct wmOperatorType *ot);
86 void PAINT_OT_weight_from_bones(struct wmOperatorType *ot);
88 void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot);
89 void PAINT_OT_vertex_paint(struct wmOperatorType *ot);
91 unsigned int vpaint_get_current_col(struct VPaint *vp);
94 int image_texture_paint_poll(struct bContext *C);
96 void PAINT_OT_image_paint(struct wmOperatorType *ot);
97 void PAINT_OT_grab_clone(struct wmOperatorType *ot);
98 void PAINT_OT_sample_color(struct wmOperatorType *ot);
99 void PAINT_OT_clone_cursor_set(struct wmOperatorType *ot);
100 void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot);
101 void PAINT_OT_project_image(struct wmOperatorType *ot);
102 void PAINT_OT_image_from_view(struct wmOperatorType *ot);
106 void projectf(struct bglMats *mats, const float v[3], float p[2]);
107 float paint_calc_object_space_radius(struct ViewContext *vc, float center[3], float pixel_radius);
108 float paint_get_tex_pixel(struct Brush* br, float u, float v);
109 int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index);
110 void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv);
112 void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
113 void BRUSH_OT_curve_preset(struct wmOperatorType *ot);
115 void PAINT_OT_face_select_linked(struct wmOperatorType *ot);
116 void PAINT_OT_face_select_linked_pick(struct wmOperatorType *ot);
117 void PAINT_OT_face_select_all(struct wmOperatorType *ot);
118 void PAINT_OT_face_select_inverse(struct wmOperatorType *ot);
119 void PAINT_OT_face_select_hide(struct wmOperatorType *ot);
120 void PAINT_OT_face_select_reveal(struct wmOperatorType *ot);
122 int facemask_paint_poll(struct bContext *C);
124 /* stroke operator */
125 typedef enum BrushStrokeMode {
132 typedef void (*UndoRestoreCb)(struct bContext *C, struct ListBase *lb);
133 typedef void (*UndoFreeCb)(struct ListBase *lb);
135 void undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free);
136 struct ListBase *undo_paint_push_get_list(int type);
137 void undo_paint_push_count_alloc(int type, int size);
138 void undo_paint_push_end(int type);
140 #endif /* ED_PAINT_INTERN_H */