Blender  V2.59
sculpt_intern.h
Go to the documentation of this file.
00001 /*
00002  * $Id: sculpt_intern.h 36485 2011-05-04 13:15:42Z 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) 2006 by Nicholas Bishop
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 
00035 #ifndef BDR_SCULPTMODE_H
00036 #define BDR_SCULPTMODE_H
00037 
00038 #include "DNA_listBase.h"
00039 #include "DNA_vec_types.h"
00040 #include "DNA_key_types.h"
00041 
00042 #include "BLI_pbvh.h"
00043 
00044 struct bContext;
00045 struct Brush;
00046 struct KeyBlock;
00047 struct Mesh;
00048 struct MultiresModifierData;
00049 struct Object;
00050 struct Scene;
00051 struct Sculpt;
00052 struct SculptStroke;
00053 
00054 /* Interface */
00055 void sculptmode_selectbrush_menu(void);
00056 void sculptmode_draw_mesh(int);
00057 void sculpt_paint_brush(char clear);
00058 void sculpt_stroke_draw(struct SculptStroke *);
00059 void sculpt_radialcontrol_start(int mode);
00060 struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct Object *ob);
00061 
00062 struct Brush *sculptmode_brush(void);
00063 
00064 void sculpt(Sculpt *sd);
00065 
00066 int sculpt_poll(struct bContext *C);
00067 void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_fmap);
00068 
00069 /* Deformed mesh sculpt */
00070 void sculpt_free_deformMats(struct SculptSession *ss);
00071 
00072 /* Stroke */
00073 struct SculptStroke *sculpt_stroke_new(const int max);
00074 void sculpt_stroke_free(struct SculptStroke *);
00075 void sculpt_stroke_add_point(struct SculptStroke *, const short x, const short y);
00076 void sculpt_stroke_apply(struct Sculpt *sd, struct SculptStroke *);
00077 void sculpt_stroke_apply_all(struct Sculpt *sd, struct SculptStroke *);
00078 int sculpt_stroke_get_location(bContext *C, struct PaintStroke *stroke, float out[3], float mouse[2]);
00079 
00080 /* Undo */
00081 
00082 typedef struct SculptUndoNode {
00083         struct SculptUndoNode *next, *prev;
00084 
00085         char idname[MAX_ID_NAME];       /* name instead of pointer*/
00086         void *node;                                     /* only during push, not valid afterwards! */
00087 
00088         float (*co)[3];
00089         float (*orig_co)[3];
00090         short (*no)[3];
00091         int totvert;
00092 
00093         /* non-multires */
00094         int maxvert;                            /* to verify if totvert it still the same */
00095         int *index;                                     /* to restore into right location */
00096 
00097         /* multires */
00098         int maxgrid;                            /* same for grid */
00099         int gridsize;                           /* same for grid */
00100         int totgrid;                            /* to restore into right location */
00101         int *grids;                                     /* to restore into right location */
00102 
00103         /* layer brush */
00104         float *layer_disp;
00105 
00106         /* shape keys */
00107         char shapeName[sizeof(((KeyBlock *)0))->name];
00108 } SculptUndoNode;
00109 
00110 SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node);
00111 SculptUndoNode *sculpt_undo_get_node(PBVHNode *node);
00112 void sculpt_undo_push_begin(const char *name);
00113 void sculpt_undo_push_end(void);
00114 
00115 void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]);
00116 
00117 #endif