diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-20 11:57:26 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-20 11:57:26 +0400 |
commit | a462d69bbf771e49d2fa49589608c375376b42ed (patch) | |
tree | 60d85d4131399a0a39dbc582e30a7144b14edc18 /source/blender/blenkernel | |
parent | d433cd65f7127d60e17d05a824290423ad226eae (diff) |
Another big patch set by Bastien Montagne, thanks a lot!
* Made Freestyle optional (turned on by default).
* Fix for missing bpath.c updates in the previous merge of trunk changes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_linestyle.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/SConscript | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/bpath.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idcode.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 8 |
13 files changed, 104 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index 3cbf3454f0b..e077cd998c9 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -27,11 +27,14 @@ #ifndef __BKE_LINESTYLE_H__ #define __BKE_LINESTYLE_H__ + /** \file BKE_linestyle.h * \ingroup bke * \brief Blender kernel freestyle line style functionality. */ +#ifdef WITH_FREESTYLE + #include "DNA_linestyle_types.h" #define LS_MODIFIER_TYPE_COLOR 1 @@ -71,4 +74,6 @@ char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *c void FRS_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob); -#endif +#endif /* WITH_FREESTYLE */ + +#endif /* __BKE_LINESTYLE_H__ */ diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index cb8f1a7d682..ec465502ca0 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -88,7 +88,9 @@ typedef struct Main { ListBase gpencil; ListBase movieclip; ListBase mask; +#ifdef WITH_FREESTYLE ListBase linestyle; +#endif char id_tag_update[256]; } Main; diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 70a3f927b23..7a11bdb1f39 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -28,7 +28,6 @@ set(INC ../blenfont ../blenlib ../blenloader - ../freestyle ../gpu ../ikplugin ../imbuf @@ -103,7 +102,6 @@ set(SRC intern/lamp.c intern/lattice.c intern/library.c - intern/linestyle.c intern/mask.c intern/mask_evaluate.c intern/mask_rasterize.c @@ -198,7 +196,6 @@ set(SRC BKE_lamp.h BKE_lattice.h BKE_library.h - BKE_linestyle.h BKE_main.h BKE_mask.h BKE_material.h @@ -418,6 +415,17 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_FREESTYLE) + list(APPEND SRC + intern/linestyle.c + BKE_linestyle.h + ) + list(APPEND INC + ../freestyle + ) + add_definitions(-DWITH_FREESTYLE) +endif() + ## Warnings as errors, this is too strict! #if(MSVC) # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index ccb21b209ea..2998da824ef 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -39,7 +39,7 @@ incs = '. #/intern/guardedalloc #/intern/memutil' incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager' incs += ' ../render/extern/include ../makesrna' incs += ' ../imbuf ../ikplugin ../avi #/intern/elbeem/extern ../nodes ../modifiers' -incs += ' #/intern/iksolver/extern ../blenloader ../freestyle' +incs += ' #/intern/iksolver/extern ../blenloader' incs += ' #/extern/bullet2/src' incs += ' #/intern/opennl/extern #/intern/bsp/extern' incs += ' ../gpu #/extern/glew/include' @@ -147,6 +147,12 @@ if env['WITH_BF_FFTW3']: if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') +if env['WITH_BF_FREESTYLE']: + defs.append('WITH_FREESTYLE') + incs += ' ../freestyle' +else: + sources.remove(os.path.join('intern', 'linestyle.c')) + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs += ' ' + env['BF_PTHREADS_INC'] diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 838cf3b8542..aecf6e5e437 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -86,7 +86,9 @@ short id_type_can_have_animdata(ID *id) case ID_PA: case ID_MA: case ID_TE: case ID_NT: case ID_LA: case ID_CA: case ID_WO: +#ifdef WITH_FREESTYLE case ID_LS: +#endif case ID_SPK: case ID_SCE: case ID_MC: @@ -828,9 +830,11 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u /* scenes */ ANIMDATA_NODETREE_IDS_CB(mainptr->scene.first, Scene); - + +#ifdef WITH_FREESTYLE /* line styles */ ANIMDATA_IDS_CB(mainptr->linestyle.first); +#endif } /* Fix all RNA-Paths throughout the database (directly access the Global.main version) @@ -916,8 +920,10 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha /* worlds */ RENAMEFIX_ANIM_NODETREE_IDS(mainptr->world.first, World); +#ifdef WITH_FREESTYLE /* linestyles */ RENAMEFIX_ANIM_IDS(mainptr->linestyle.first); +#endif /* scenes */ RENAMEFIX_ANIM_NODETREE_IDS(mainptr->scene.first, Scene); @@ -2404,8 +2410,10 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime) /* movie clips */ EVAL_ANIM_IDS(main->movieclip.first, ADT_RECALC_ANIM); +#ifdef WITH_FREESTYLE /* linestyles */ EVAL_ANIM_IDS(main->linestyle.first, ADT_RECALC_ANIM); +#endif /* objects */ /* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index 24b13b062f3..e10a078c2f7 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -70,6 +70,9 @@ #include "DNA_vfont_types.h" #include "DNA_scene_types.h" #include "DNA_smoke_types.h" +#ifdef WITH_FREESTYLE +# include "DNA_freestyle_types.h" +#endif #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -575,6 +578,18 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int } SEQ_END } +#ifdef WITH_FREESTYLE + { + SceneRenderLayer *srl = scene->r.layers.first; + + for(; srl; srl = srl->next) { + FreestyleModuleConfig* module = srl->freestyleConfig.modules.first; + for (; module; module = module->next) { + rewrite_path_fixed(module->module_path, visit_cb, absbase, bpath_user_data); + } + } + } +#endif break; } case ID_ME: diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index d3545cd2720..fda7dfb046e 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -79,7 +79,6 @@ void BKE_group_unlink(Group *group) Object *ob; Scene *sce; SceneRenderLayer *srl; - FreestyleLineSet *lineset; ParticleSystem *psys; for (ma = bmain->mat.first; ma; ma = ma->id.next) { @@ -105,10 +104,15 @@ void BKE_group_unlink(Group *group) if (srl->light_override == group) srl->light_override = NULL; - for(lineset= srl->freestyleConfig.linesets.first; lineset; lineset= lineset->next) { - if (lineset->group == group) - lineset->group= NULL; +#ifdef WITH_FREESTYLE + { + FreestyleLineSet *lineset; + for(lineset = srl->freestyleConfig.linesets.first; lineset; lineset= lineset->next) { + if (lineset->group == group) + lineset->group = NULL; + } } +#endif } } diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 75c22d06042..8fab0f2d4df 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -62,7 +62,9 @@ static IDType idtypes[] = { { ID_KE, "Key", "shape_keys", 0 }, { ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE }, { ID_LI, "Library", "libraries", 0 }, +#ifdef WITH_FREESTYLE { ID_LS, "FreestyleLineStyle", "linestyles", IDTYPE_FLAGS_ISLINKABLE }, +#endif { ID_LT, "Lattice", "lattices", IDTYPE_FLAGS_ISLINKABLE }, { ID_MA, "Material", "materials", IDTYPE_FLAGS_ISLINKABLE }, { ID_MB, "Metaball", "metaballs", IDTYPE_FLAGS_ISLINKABLE }, diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index d21a12b9e6a..2192d2862c8 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -109,7 +109,9 @@ #include "BKE_speaker.h" #include "BKE_movieclip.h" #include "BKE_mask.h" -#include "BKE_linestyle.h" +#ifdef WITH_FREESTYLE +# include "BKE_linestyle.h" +#endif #include "RNA_access.h" @@ -277,8 +279,10 @@ int id_make_local(ID *id, int test) return 0; /* can't be linked */ case ID_GD: return 0; /* not implemented */ +#ifdef WITH_FREESTYLE case ID_LS: return 0; /* not implemented */ +#endif } return 0; @@ -373,9 +377,11 @@ int id_copy(ID *id, ID **newid, int test) case ID_MSK: if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id); return 1; +#ifdef WITH_FREESTYLE case ID_LS: if(!test) *newid= (ID*)FRS_copy_linestyle((FreestyleLineStyle*)id); return 1; +#endif } return 0; @@ -506,8 +512,10 @@ ListBase *which_libbase(Main *mainlib, short type) return &(mainlib->movieclip); case ID_MSK: return &(mainlib->mask); +#ifdef WITH_FREESTYLE case ID_LS: return &(mainlib->linestyle); +#endif } return NULL; } @@ -592,7 +600,9 @@ int set_listbasepointers(Main *main, ListBase **lb) lb[a++] = &(main->wm); lb[a++] = &(main->movieclip); lb[a++] = &(main->mask); +#ifdef WITH_FREESTYLE lb[a++] = &(main->linestyle); +#endif lb[a] = NULL; @@ -707,9 +717,11 @@ static ID *alloc_libblock_notest(short type) case ID_MSK: id = MEM_callocN(sizeof(Mask), "Mask"); break; +#ifdef WITH_FREESTYLE case ID_LS: id = MEM_callocN(sizeof(FreestyleLineStyle), "Freestyle Line Style"); break; +#endif } return id; } @@ -934,9 +946,11 @@ void BKE_libblock_free(ListBase *lb, void *idv) case ID_MSK: BKE_mask_free(bmain, (Mask *)id); break; +#ifdef WITH_FREESTYLE case ID_LS: FRS_free_linestyle((FreestyleLineStyle *)id); break; +#endif } BLI_remlink(lb, id); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3bfd4f4f760..54bd03ece70 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -153,7 +153,9 @@ void init_material(Material *ma) ma->tx_limit = 0.0; ma->tx_falloff = 1.0; ma->shad_alpha = 1.0f; +#ifdef WITH_FREESTYLE ma->vcol_alpha = 0; +#endif ma->gloss_mir = ma->gloss_tra = 1.0; ma->samp_gloss_mir = ma->samp_gloss_tra = 18; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index bf4e32ef122..f0819d426fb 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -115,7 +115,9 @@ #include "GPU_material.h" -#include "FRS_freestyle.h" +#ifdef WITH_FREESTYLE +# include "FRS_freestyle.h" +#endif /* Local function protos */ float originmat[3][3]; /* after BKE_object_where_is_calc(), can be used in other functions (bad!) */ @@ -635,6 +637,7 @@ void BKE_object_unlink(Object *ob) SEQ_END } +#ifdef WITH_FREESTYLE { SceneRenderLayer *srl; @@ -642,6 +645,7 @@ void BKE_object_unlink(Object *ob) FRS_unlink_target_object(&srl->freestyleConfig, ob); } } +#endif } sce = sce->id.next; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 5e6d7647d1d..1c98f6c32a2 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -85,7 +85,9 @@ //XXX #include "BIF_previewrender.h" //XXX #include "BIF_editseq.h" -#include "FRS_freestyle_config.h" +#ifdef WITH_FREESTYLE +# include "FRS_freestyle_config.h" +#endif #ifdef WIN32 #else @@ -288,7 +290,6 @@ Scene *BKE_scene_copy(Scene *sce, int type) void BKE_scene_free(Scene *sce) { Base *base; - SceneRenderLayer *srl; base = sce->base.first; while (base) { @@ -329,9 +330,15 @@ void BKE_scene_free(Scene *sce) sce->r.ffcodecdata.properties = NULL; } - for(srl= sce->r.layers.first; srl; srl= srl->next) { - FRS_free_freestyle_config(srl); +#ifdef WITH_FREESTYLE + { + SceneRenderLayer *srl; + + for (srl = sce->r.layers.first; srl; srl = srl->next) { + FRS_free_freestyle_config(srl); + } } +#endif BLI_freelistN(&sce->markers); BLI_freelistN(&sce->transform_spaces); @@ -1190,7 +1197,9 @@ SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name) srl->lay = (1 << 20) - 1; srl->layflag = 0x7FFF; /* solid ztra halo edge strand */ srl->passflag = SCE_PASS_COMBINED | SCE_PASS_Z; - FRS_add_freestyle_config( srl ); +#ifdef WITH_FREESTYLE + FRS_add_freestyle_config(srl); +#endif return srl; } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 7c58c7b21ed..37c9c1dd84e 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -964,7 +964,11 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) edgeFlag = (ccgdm->edgeFlags) ? &ccgdm->edgeFlags[i] : NULL; if (edgeFlag) +#ifdef WITH_FREESTYLE flags |= (*edgeFlag & (ME_SEAM | ME_SHARP | ME_FREESTYLE_EDGE)) | ME_EDGEDRAW | ME_EDGERENDER; +#else + flags |= (*edgeFlag & (ME_SEAM | ME_SHARP)) | ME_EDGEDRAW | ME_EDGERENDER; +#endif else flags |= ME_EDGEDRAW | ME_EDGERENDER; @@ -1228,7 +1232,11 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) if (edgeFlags) { if (edgeIdx != -1) { +#ifdef WITH_FREESTYLE flags |= ((edgeFlags[index] & (ME_SEAM | ME_SHARP | ME_FREESTYLE_EDGE)) | ME_EDGEDRAW | ME_EDGERENDER); +#else + flags |= ((edgeFlags[index] & (ME_SEAM | ME_SHARP)) | ME_EDGEDRAW | ME_EDGERENDER); +#endif } } else { |