Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2008 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * 00022 * Contributor(s): Blender Foundation 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00032 #ifndef ED_PAINT_INTERN_H 00033 #define ED_PAINT_INTERN_H 00034 00035 struct ARegion; 00036 struct bContext; 00037 struct bglMats; 00038 struct Brush; 00039 struct ListBase; 00040 struct Mesh; 00041 struct Object; 00042 struct PaintStroke; 00043 struct PointerRNA; 00044 struct rcti; 00045 struct Scene; 00046 struct VPaint; 00047 struct ViewContext; 00048 struct wmEvent; 00049 struct wmOperator; 00050 struct wmOperatorType; 00051 00052 /* paint_stroke.c */ 00053 typedef int (*StrokeGetLocation)(struct bContext *C, struct PaintStroke *stroke, float location[3], float mouse[2]); 00054 typedef int (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, struct wmEvent *event); 00055 typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke, struct PointerRNA *itemptr); 00056 typedef void (*StrokeDone)(struct bContext *C, struct PaintStroke *stroke); 00057 00058 struct PaintStroke *paint_stroke_new(struct bContext *C, 00059 StrokeGetLocation get_location, StrokeTestStart test_start, 00060 StrokeUpdateStep update_step, StrokeDone done, int event_type); 00061 void paint_stroke_free(struct PaintStroke *stroke); 00062 00063 int paint_space_stroke_enabled(struct Brush *br); 00064 00065 int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event); 00066 int paint_stroke_exec(struct bContext *C, struct wmOperator *op); 00067 int paint_stroke_cancel(struct bContext *C, struct wmOperator *op); 00068 struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke); 00069 void *paint_stroke_mode_data(struct PaintStroke *stroke); 00070 void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data); 00071 int paint_poll(struct bContext *C); 00072 void paint_cursor_start(struct bContext *C, int (*poll)(struct bContext *C)); 00073 00074 /* paint_vertex.c */ 00075 int weight_paint_poll(struct bContext *C); 00076 int weight_paint_mode_poll(struct bContext *C); 00077 int vertex_paint_poll(struct bContext *C); 00078 int vertex_paint_mode_poll(struct bContext *C); 00079 00080 void vpaint_fill(struct Object *ob, unsigned int paintcol); 00081 void wpaint_fill(struct VPaint *wp, struct Object *ob, float paintweight); 00082 00083 void PAINT_OT_weight_paint_toggle(struct wmOperatorType *ot); 00084 void PAINT_OT_weight_paint(struct wmOperatorType *ot); 00085 void PAINT_OT_weight_set(struct wmOperatorType *ot); 00086 void PAINT_OT_weight_from_bones(struct wmOperatorType *ot); 00087 void PAINT_OT_weight_sample(struct wmOperatorType *ot); 00088 void PAINT_OT_weight_sample_group(struct wmOperatorType *ot); 00089 00090 void PAINT_OT_vertex_paint_toggle(struct wmOperatorType *ot); 00091 void PAINT_OT_vertex_paint(struct wmOperatorType *ot); 00092 00093 unsigned int vpaint_get_current_col(struct VPaint *vp); 00094 00095 /* paint_image.c */ 00096 int image_texture_paint_poll(struct bContext *C); 00097 00098 void PAINT_OT_image_paint(struct wmOperatorType *ot); 00099 void PAINT_OT_grab_clone(struct wmOperatorType *ot); 00100 void PAINT_OT_sample_color(struct wmOperatorType *ot); 00101 void PAINT_OT_clone_cursor_set(struct wmOperatorType *ot); 00102 void PAINT_OT_texture_paint_toggle(struct wmOperatorType *ot); 00103 void PAINT_OT_project_image(struct wmOperatorType *ot); 00104 void PAINT_OT_image_from_view(struct wmOperatorType *ot); 00105 00106 00107 /* paint_utils.c */ 00108 00109 /* Convert the object-space axis-aligned bounding box (expressed as 00110 its minimum and maximum corners) into a screen-space rectangle, 00111 returns zero if the result is empty */ 00112 int paint_convert_bb_to_rect(struct rcti *rect, 00113 const float bb_min[3], 00114 const float bb_max[3], 00115 const struct ARegion *ar, 00116 struct RegionView3D *rv3d, 00117 struct Object *ob); 00118 00119 /* Get four planes in object-space that describe the projection of 00120 screen_rect from screen into object-space (essentially converting a 00121 2D screens-space bounding box into four 3D planes) */ 00122 void paint_calc_redraw_planes(float planes[4][4], 00123 const struct ARegion *ar, 00124 struct RegionView3D *rv3d, 00125 struct Object *ob, 00126 const struct rcti *screen_rect); 00127 00128 void projectf(struct bglMats *mats, const float v[3], float p[2]); 00129 float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius); 00130 float paint_get_tex_pixel(struct Brush* br, float u, float v); 00131 int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, const int mval[2], unsigned int *index); 00132 void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]); 00133 00134 void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y); 00135 void BRUSH_OT_curve_preset(struct wmOperatorType *ot); 00136 00137 void PAINT_OT_face_select_linked(struct wmOperatorType *ot); 00138 void PAINT_OT_face_select_linked_pick(struct wmOperatorType *ot); 00139 void PAINT_OT_face_select_all(struct wmOperatorType *ot); 00140 void PAINT_OT_face_select_inverse(struct wmOperatorType *ot); 00141 void PAINT_OT_face_select_hide(struct wmOperatorType *ot); 00142 void PAINT_OT_face_select_reveal(struct wmOperatorType *ot); 00143 00144 void PAINT_OT_vert_select_all(struct wmOperatorType *ot); 00145 void PAINT_OT_vert_select_inverse(struct wmOperatorType *ot); 00146 int vert_paint_poll(struct bContext *C); 00147 int mask_paint_poll(struct bContext *C); 00148 00149 int facemask_paint_poll(struct bContext *C); 00150 00151 /* stroke operator */ 00152 typedef enum BrushStrokeMode { 00153 BRUSH_STROKE_NORMAL, 00154 BRUSH_STROKE_INVERT, 00155 BRUSH_STROKE_SMOOTH, 00156 } BrushStrokeMode; 00157 00158 /* paint_undo.c */ 00159 typedef void (*UndoRestoreCb)(struct bContext *C, struct ListBase *lb); 00160 typedef void (*UndoFreeCb)(struct ListBase *lb); 00161 00162 void undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free); 00163 struct ListBase *undo_paint_push_get_list(int type); 00164 void undo_paint_push_count_alloc(int type, int size); 00165 void undo_paint_push_end(int type); 00166 00167 #endif /* ED_PAINT_INTERN_H */ 00168