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