diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2006-11-06 04:08:26 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2006-11-06 04:08:26 +0300 |
commit | 8e97a2955b2f99ec61189cb972c09676a013a60b (patch) | |
tree | 89e67578ceac5a670a309b72295156cbfc7f05c7 /source/blender/blenkernel | |
parent | 6feb2cc4f6d4c2131b959b77a8b87a5d7c9412a4 (diff) |
Merged Google Summer of Code sculptmode/multires/retopo tools.
From the tracker:
https://projects.blender.org/tracker/index.php?func=detail&aid=5018&group_id=9&atid=127
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_bad_level_calls.h | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_global.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/bad_level_call_stubs/stubs.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 25 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 10 |
6 files changed, 65 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_bad_level_calls.h b/source/blender/blenkernel/BKE_bad_level_calls.h index 0794e837977..a5ad16e752e 100644 --- a/source/blender/blenkernel/BKE_bad_level_calls.h +++ b/source/blender/blenkernel/BKE_bad_level_calls.h @@ -199,5 +199,14 @@ void post_layer_create(struct VLayer *vlayer); void post_layer_destroy(struct VLayer *vlayer); void post_server_add(void); +/* multires.c */ +struct MultiresLevel; +void multires_free(struct Mesh *me); +void multires_set_level(void *ob, void *me_v); +void multires_calc_level_maps(struct MultiresLevel *lvl); +/* sculptmode.c */ +void sculptmode_free_vertexusers(struct Scene *sce); +void sculptmode_init(struct Scene *sce); + #endif diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 0c20b545f1e..a7f36e74dcb 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -63,7 +63,6 @@ struct bSoundListener; struct BMF_Font; struct EditMesh; - typedef struct Global { /* active pointers */ @@ -190,6 +189,8 @@ typedef struct Global { #define G_DRAW_VERSE_DEBUG (1 << 27) /*#endif*/ +#define G_SCULPTMODE (1 << 28) + /* G.fileflags */ #define G_AUTOPACK (1 << 0) diff --git a/source/blender/blenkernel/bad_level_call_stubs/stubs.c b/source/blender/blenkernel/bad_level_call_stubs/stubs.c index e9df9584e30..173a130a25e 100644 --- a/source/blender/blenkernel/bad_level_call_stubs/stubs.c +++ b/source/blender/blenkernel/bad_level_call_stubs/stubs.c @@ -285,4 +285,9 @@ void post_geometry_free_constraint(struct VNode *vnode) {} void post_layer_create(struct VLayer *vlayer) {} void post_layer_destroy(struct VLayer *vlayer) {} void post_server_add(void) {} - + /* Multires/sculpt stubs */ +void multires_free(struct Mesh *me) {} +void multires_set_level(void *ob, void *me_v) {} +void multires_calc_level_maps(struct MultiresLevel *lvl) {} +void sculptmode_init(struct Scene *sce) {} +void sculptmode_free_all(struct Scene *sce) {} diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 4dacfdc85d8..308a32439d4 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -78,6 +78,8 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "multires.h" + // headers for fluidsim bobj meshes #include <stdlib.h> #include "LBM_fluidsim.h" @@ -3370,9 +3372,32 @@ DerivedMesh *mesh_get_derived_deform(Object *ob, int *needsFree_r) DerivedMesh *mesh_create_derived_render(Object *ob) { DerivedMesh *final; + Mesh *m= get_mesh(ob); + unsigned i; + + /* Goto the pin level for multires */ + if(m->mr) { + m->mr->newlvl= m->mr->pinlvl; + multires_set_level(ob,m); + } mesh_calc_modifiers(ob, NULL, NULL, &final, 1, 1, 0); + /* Propagate the changes to render level - fails if mesh topology changed */ + if(m->mr) { + if(final->getNumVerts(final) == m->totvert && + final->getNumFaces(final) == m->totface) { + for(i=0; i<m->totvert; ++i) + memcpy(&m->mvert[i], CustomData_get(&final->vertData, i, LAYERTYPE_MVERT), sizeof(MVert)); + + final->release(final); + + m->mr->newlvl= m->mr->renderlvl; + multires_set_level(ob,m); + final= getMeshDerivedMesh(m,ob,NULL); + } + } + return final; } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index c0741e7137a..088f5af7e07 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -55,6 +55,8 @@ #include "DNA_meshdata_types.h" #include "DNA_ipo_types.h" +#include "BDR_sculptmode.h" + #include "BKE_depsgraph.h" #include "BKE_main.h" #include "BKE_DerivedMesh.h" @@ -80,6 +82,8 @@ #include "BLI_editVert.h" #include "BLI_arithb.h" +#include "multires.h" + int update_realtime_texture(TFace *tface, double time) @@ -153,6 +157,14 @@ void free_mesh(Mesh *me) { unlink_mesh(me); + if(me->pv) { + if(me->pv->vert_map) MEM_freeN(me->pv->vert_map); + if(me->pv->edge_map) MEM_freeN(me->pv->edge_map); + if(me->pv->old_faces) MEM_freeN(me->pv->old_faces); + if(me->pv->old_edges) MEM_freeN(me->pv->old_edges); + MEM_freeN(me->pv); + } + if(me->mvert) MEM_freeN(me->mvert); if(me->medge) MEM_freeN(me->medge); if(me->mface) MEM_freeN(me->mface); @@ -166,6 +178,8 @@ void free_mesh(Mesh *me) if(me->bb) MEM_freeN(me->bb); if(me->mselect) MEM_freeN(me->mselect); + + if(me->mr) multires_free(me); } void copy_dverts(MDeformVert *dst, MDeformVert *src, int copycount) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 272bfd38b37..60632b33dae 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -56,6 +56,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_scriptlink_types.h" +#include "DNA_texture_types.h" #include "DNA_userdef_types.h" #include "BKE_action.h" @@ -76,6 +77,9 @@ #include "BKE_world.h" #include "BKE_utildefines.h" +#include "BIF_previewrender.h" +#include "BDR_sculptmode.h" + #include "BPY_extern.h" #include "BLI_arithb.h" #include "BLI_blenlib.h" @@ -162,6 +166,8 @@ void free_scene(Scene *sce) ntreeFreeTree(sce->nodetree); MEM_freeN(sce->nodetree); } + + sculptmode_free_all(sce); } Scene *add_scene(char *name) @@ -232,9 +238,11 @@ Scene *add_scene(char *name) strcpy(sce->r.backbuf, "//backbuf"); strcpy(sce->r.pic, U.renderdir); strcpy(sce->r.ftype, "//ftype"); - + BLI_init_rctf(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f); sce->r.osa= 8; + + sculptmode_init(sce); /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */ scene_add_render_layer(sce); |