diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-23 07:00:37 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-23 07:00:37 +0400 |
commit | 62cede96d34d802d97797a635ff8370a5f7556a1 (patch) | |
tree | ec56d7f332164b34c31607ed882218ce892c9319 /source/blender/blenkernel/intern | |
parent | 865e80f0f47b8cda1b126c2130114b833c7c5035 (diff) |
A major code update for making the DNA file specification of Freestyle settings
and RNA for it independent of the build flag for enabling Freestyle. Suggested
by Sergey Sharybin through a code review of the branch.
* Many #ifdef WITH_FREESTYLE blocks were removed to always have Freestyle-specific
DNA file specification and RNA for it built in Blender. This will allow Freestyle
setting survive even when a non-Freestyle build is used for loading and saving
files. It is noted that operations are still conditionally built through #ifdef
WITH_FREESTYLE blocks.
* To this end, new blenkernel files BKE_freestyle.h and intern/freestyle.c have
been added. All API functions in FRS_freestyle_config.h as well as some of those
in FRS_freestyle.h were moved to the new files. Now the relocated API functions
have BKE_ prefix instead of FRS_.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/bpath.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/freestyle.c | 234 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/idcode.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 20 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 68 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 36 |
10 files changed, 294 insertions, 113 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 738d4c5b089..d4563c936d0 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -86,9 +86,7 @@ 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: @@ -831,10 +829,8 @@ 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) @@ -920,10 +916,8 @@ 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); @@ -2410,10 +2404,8 @@ 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 624e86d5787..6998ffabe65 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -70,9 +70,7 @@ #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 "DNA_freestyle_types.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -582,7 +580,6 @@ 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; @@ -593,7 +590,6 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int } } } -#endif break; } case ID_ME: diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c new file mode 100644 index 00000000000..bcbc3dd99c6 --- /dev/null +++ b/source/blender/blenkernel/intern/freestyle.c @@ -0,0 +1,234 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/blenkernel/intern/freestyle.c + * \ingroup bke + */ + +#include "MEM_guardedalloc.h" + +#include "DNA_freestyle_types.h" +#include "DNA_group_types.h" + +#include "BKE_freestyle.h" +#include "BKE_linestyle.h" + +#include "BLI_blenlib.h" +#include "BLI_math.h" + +// function declarations +static FreestyleLineSet *alloc_lineset(); +static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset); +static FreestyleModuleConfig *alloc_module(); +static void copy_module(FreestyleModuleConfig *new_module, FreestyleModuleConfig *module); + +void BKE_freestyle_config_init(FreestyleConfig *config) +{ + config->mode = FREESTYLE_CONTROL_EDITOR_MODE; + + config->modules.first = config->modules.last = NULL; + config->flags = 0; + config->sphere_radius = 1.0f; + config->dkr_epsilon = 0.0f; + config->crease_angle = DEG2RADF(134.43f); + + config->linesets.first = config->linesets.last = NULL; +} + +void BKE_freestyle_config_free(FreestyleConfig *config) +{ + FreestyleLineSet *lineset; + + for (lineset = (FreestyleLineSet *)config->linesets.first; lineset; lineset = lineset->next) { + if (lineset->group) { + lineset->group->id.us--; + lineset->group = NULL; + } + lineset->linestyle->id.us--; + lineset->linestyle = NULL; + } + BLI_freelistN(&config->linesets); + BLI_freelistN(&config->modules); +} + +void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *config) +{ + FreestyleLineSet *lineset, *new_lineset; + FreestyleModuleConfig *module, *new_module; + + new_config->mode = config->mode; + new_config->raycasting_algorithm = config->raycasting_algorithm; /* deprecated */ + new_config->flags = config->flags; + new_config->sphere_radius = config->sphere_radius; + new_config->dkr_epsilon = config->dkr_epsilon; + new_config->crease_angle = config->crease_angle; + + new_config->linesets.first = new_config->linesets.last = NULL; + for (lineset = (FreestyleLineSet *)config->linesets.first; lineset; lineset = lineset->next) { + new_lineset = alloc_lineset(); + copy_lineset(new_lineset, lineset); + BLI_addtail(&new_config->linesets, (void *)new_lineset); + } + + new_config->modules.first = new_config->modules.last = NULL; + for (module = (FreestyleModuleConfig *)config->modules.first; module; module = module->next) { + new_module = alloc_module(); + copy_module(new_module, module); + BLI_addtail(&new_config->modules, (void *)new_module); + } +} + +static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset) +{ + new_lineset->linestyle = lineset->linestyle; + new_lineset->linestyle->id.us++; + new_lineset->flags = lineset->flags; + new_lineset->selection = lineset->selection; + new_lineset->qi = lineset->qi; + new_lineset->qi_start = lineset->qi_start; + new_lineset->qi_end = lineset->qi_end; + new_lineset->edge_types = lineset->edge_types; + new_lineset->exclude_edge_types = lineset->exclude_edge_types; + new_lineset->group = lineset->group; + if (new_lineset->group) { + new_lineset->group->id.us++; + } + strcpy(new_lineset->name, lineset->name); +} + +static FreestyleModuleConfig *alloc_module() +{ + return (FreestyleModuleConfig *)MEM_callocN(sizeof(FreestyleModuleConfig), "style module configuration"); +} + +void BKE_freestyle_module_add(FreestyleConfig *config) +{ + FreestyleModuleConfig *module_conf = alloc_module(); + const size_t maxlen = sizeof(module_conf->module_path); + BLI_addtail(&config->modules, (void *)module_conf); + + BLI_strncpy(module_conf->module_path, BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "freestyle"), maxlen); + BLI_join_dirfile(module_conf->module_path, maxlen, module_conf->module_path, "style_modules"); + BLI_join_dirfile(module_conf->module_path, maxlen, module_conf->module_path, "contour.py"); + module_conf->is_displayed = 1; +} + +static void copy_module(FreestyleModuleConfig *new_module, FreestyleModuleConfig *module) +{ + strcpy(new_module->module_path, module->module_path); + new_module->is_displayed = module->is_displayed; +} + +void BKE_freestyle_module_delete(FreestyleConfig *config, FreestyleModuleConfig *module_conf) +{ + BLI_freelinkN(&config->modules, module_conf); +} + +void BKE_freestyle_module_move_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf) +{ + BLI_remlink(&config->modules, module_conf); + BLI_insertlinkbefore(&config->modules, module_conf->prev, module_conf); +} + +void BKE_freestyle_module_move_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf) +{ + BLI_remlink(&config->modules, module_conf); + BLI_insertlinkafter(&config->modules, module_conf->next, module_conf); +} + +void BKE_freestyle_lineset_unique_name(FreestyleConfig *config, FreestyleLineSet *lineset) +{ + BLI_uniquename(&config->linesets, lineset, "FreestyleLineSet", '.', offsetof(FreestyleLineSet, name), + sizeof(lineset->name)); +} + +static FreestyleLineSet *alloc_lineset() +{ + return (FreestyleLineSet *)MEM_callocN(sizeof(FreestyleLineSet), "Freestyle line set"); +} + +FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config) +{ + int lineset_index = BLI_countlist(&config->linesets); + + FreestyleLineSet *lineset = alloc_lineset(); + BLI_addtail(&config->linesets, (void *)lineset); + BKE_freestyle_lineset_set_active_index(config, lineset_index); + + lineset->linestyle = BKE_new_linestyle("LineStyle", NULL); + lineset->flags |= FREESTYLE_LINESET_ENABLED; + lineset->selection = FREESTYLE_SEL_VISIBILITY | FREESTYLE_SEL_EDGE_TYPES | FREESTYLE_SEL_IMAGE_BORDER; + lineset->qi = FREESTYLE_QI_VISIBLE; + lineset->qi_start = 0; + lineset->qi_end = 100; + lineset->edge_types = FREESTYLE_FE_SILHOUETTE | FREESTYLE_FE_BORDER | FREESTYLE_FE_CREASE; + lineset->exclude_edge_types = 0; + lineset->group = NULL; + if (lineset_index > 0) + sprintf(lineset->name, "LineSet %i", lineset_index + 1); + else + strcpy(lineset->name, "LineSet"); + BKE_freestyle_lineset_unique_name(config, lineset); + + return lineset; +} + +FreestyleLineSet *BKE_freestyle_lineset_get_active(FreestyleConfig *config) +{ + FreestyleLineSet *lineset; + + for (lineset = (FreestyleLineSet *)config->linesets.first; lineset; lineset = lineset->next) { + if (lineset->flags & FREESTYLE_LINESET_CURRENT) + return lineset; + } + return NULL; +} + +short BKE_freestyle_lineset_get_active_index(FreestyleConfig *config) +{ + FreestyleLineSet *lineset; + short i; + + for (lineset = (FreestyleLineSet *)config->linesets.first, i = 0; lineset; lineset = lineset->next, i++) { + if (lineset->flags & FREESTYLE_LINESET_CURRENT) + return i; + } + return 0; +} + +void BKE_freestyle_lineset_set_active_index(FreestyleConfig *config, short index) +{ + FreestyleLineSet *lineset; + short i; + + for (lineset = (FreestyleLineSet *)config->linesets.first, i = 0; lineset; lineset = lineset->next, i++) { + if (i == index) + lineset->flags |= FREESTYLE_LINESET_CURRENT; + else + lineset->flags &= ~FREESTYLE_LINESET_CURRENT; + } +} diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 61f468373f4..98d1d301f65 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -79,6 +79,7 @@ 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) { @@ -103,16 +104,10 @@ void BKE_group_unlink(Group *group) for (srl = sce->r.layers.first; srl; srl = srl->next) { if (srl->light_override == group) srl->light_override = NULL; - -#ifdef WITH_FREESTYLE - { - FreestyleLineSet *lineset; - for(lineset = srl->freestyleConfig.linesets.first; lineset; lineset= lineset->next) { - if (lineset->group == group) - lineset->group = NULL; - } + 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 11d3e69120d..adc0503df29 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -63,9 +63,7 @@ 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 67fc5bd5dca..594905bf7c5 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -93,6 +93,7 @@ #include "BKE_lamp.h" #include "BKE_lattice.h" #include "BKE_library.h" +#include "BKE_linestyle.h" #include "BKE_mesh.h" #include "BKE_material.h" #include "BKE_main.h" @@ -110,9 +111,6 @@ #include "BKE_text.h" #include "BKE_texture.h" #include "BKE_world.h" -#ifdef WITH_FREESTYLE -# include "BKE_linestyle.h" -#endif #include "RNA_access.h" @@ -282,10 +280,8 @@ bool id_make_local(ID *id, bool test) return false; /* can't be linked */ case ID_GD: return false; /* not implemented */ -#ifdef WITH_FREESTYLE case ID_LS: return 0; /* not implemented */ -#endif } return false; @@ -384,11 +380,9 @@ bool id_copy(ID *id, ID **newid, bool test) case ID_MSK: if (!test) *newid = (ID *)BKE_mask_copy((Mask *)id); return true; -#ifdef WITH_FREESTYLE case ID_LS: - if(!test) *newid= (ID*)FRS_copy_linestyle((FreestyleLineStyle*)id); + if (!test) *newid = (ID *)BKE_copy_linestyle((FreestyleLineStyle *)id); return 1; -#endif } return false; @@ -519,10 +513,8 @@ 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; } @@ -613,9 +605,7 @@ 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; @@ -734,11 +724,9 @@ 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; } @@ -974,11 +962,9 @@ 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); + BKE_free_linestyle((FreestyleLineStyle *)id); break; -#endif } BLI_remlink(lb, id); diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index f017b4a97cd..fe27ddcfafe 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -94,12 +94,12 @@ static void default_linestyle_settings(FreestyleLineStyle *linestyle) linestyle->thickness_modifiers.first = linestyle->thickness_modifiers.last = NULL; linestyle->geometry_modifiers.first = linestyle->geometry_modifiers.last = NULL; - FRS_add_linestyle_geometry_modifier(linestyle, LS_MODIFIER_SAMPLING); + BKE_add_linestyle_geometry_modifier(linestyle, LS_MODIFIER_SAMPLING); linestyle->caps = LS_CAPS_BUTT; } -FreestyleLineStyle *FRS_new_linestyle(const char *name, struct Main *main) +FreestyleLineStyle *BKE_new_linestyle(const char *name, struct Main *main) { FreestyleLineStyle *linestyle; @@ -113,28 +113,28 @@ FreestyleLineStyle *FRS_new_linestyle(const char *name, struct Main *main) return linestyle; } -void FRS_free_linestyle(FreestyleLineStyle *linestyle) +void BKE_free_linestyle(FreestyleLineStyle *linestyle) { LineStyleModifier *m; BKE_free_animdata(&linestyle->id); while ((m = (LineStyleModifier *)linestyle->color_modifiers.first)) - FRS_remove_linestyle_color_modifier(linestyle, m); + BKE_remove_linestyle_color_modifier(linestyle, m); while ((m = (LineStyleModifier *)linestyle->alpha_modifiers.first)) - FRS_remove_linestyle_alpha_modifier(linestyle, m); + BKE_remove_linestyle_alpha_modifier(linestyle, m); while ((m = (LineStyleModifier *)linestyle->thickness_modifiers.first)) - FRS_remove_linestyle_thickness_modifier(linestyle, m); + BKE_remove_linestyle_thickness_modifier(linestyle, m); while ((m = (LineStyleModifier *)linestyle->geometry_modifiers.first)) - FRS_remove_linestyle_geometry_modifier(linestyle, m); + BKE_remove_linestyle_geometry_modifier(linestyle, m); } -FreestyleLineStyle *FRS_copy_linestyle(FreestyleLineStyle *linestyle) +FreestyleLineStyle *BKE_copy_linestyle(FreestyleLineStyle *linestyle) { FreestyleLineStyle *new_linestyle; LineStyleModifier *m; - new_linestyle = FRS_new_linestyle(linestyle->id.name + 2, NULL); - FRS_free_linestyle(new_linestyle); + new_linestyle = BKE_new_linestyle(linestyle->id.name + 2, NULL); + BKE_free_linestyle(new_linestyle); new_linestyle->r = linestyle->r; new_linestyle->g = linestyle->g; @@ -160,13 +160,13 @@ FreestyleLineStyle *FRS_copy_linestyle(FreestyleLineStyle *linestyle) new_linestyle->gap3 = linestyle->gap3; new_linestyle->panel = linestyle->panel; for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) - FRS_copy_linestyle_color_modifier(new_linestyle, m); + BKE_copy_linestyle_color_modifier(new_linestyle, m); for (m = (LineStyleModifier *)linestyle->alpha_modifiers.first; m; m = m->next) - FRS_copy_linestyle_alpha_modifier(new_linestyle, m); + BKE_copy_linestyle_alpha_modifier(new_linestyle, m); for (m = (LineStyleModifier *)linestyle->thickness_modifiers.first; m; m = m->next) - FRS_copy_linestyle_thickness_modifier(new_linestyle, m); + BKE_copy_linestyle_thickness_modifier(new_linestyle, m); for (m = (LineStyleModifier *)linestyle->geometry_modifiers.first; m; m = m->next) - FRS_copy_linestyle_geometry_modifier(new_linestyle, m); + BKE_copy_linestyle_geometry_modifier(new_linestyle, m); return new_linestyle; } @@ -214,7 +214,7 @@ static LineStyleModifier *alloc_color_modifier(int type) return new_modifier(type, size); } -LineStyleModifier *FRS_add_linestyle_color_modifier(FreestyleLineStyle *linestyle, int type) +LineStyleModifier *BKE_add_linestyle_color_modifier(FreestyleLineStyle *linestyle, int type) { LineStyleModifier *m; @@ -248,7 +248,7 @@ LineStyleModifier *FRS_add_linestyle_color_modifier(FreestyleLineStyle *linestyl return m; } -LineStyleModifier *FRS_copy_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +LineStyleModifier *BKE_copy_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { LineStyleModifier *new_m; @@ -302,7 +302,7 @@ LineStyleModifier *FRS_copy_linestyle_color_modifier(FreestyleLineStyle *linesty return new_m; } -void FRS_remove_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +void BKE_remove_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { switch (m->type) { case LS_MODIFIER_ALONG_STROKE: @@ -344,7 +344,7 @@ static LineStyleModifier *alloc_alpha_modifier(int type) return new_modifier(type, size); } -LineStyleModifier *FRS_add_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, int type) +LineStyleModifier *BKE_add_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, int type) { LineStyleModifier *m; @@ -390,7 +390,7 @@ LineStyleModifier *FRS_add_linestyle_alpha_modifier(FreestyleLineStyle *linestyl return m; } -LineStyleModifier *FRS_copy_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +LineStyleModifier *BKE_copy_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { LineStyleModifier *new_m; @@ -444,7 +444,7 @@ LineStyleModifier *FRS_copy_linestyle_alpha_modifier(FreestyleLineStyle *linesty return new_m; } -void FRS_remove_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +void BKE_remove_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { switch (m->type) { case LS_MODIFIER_ALONG_STROKE: @@ -490,7 +490,7 @@ static LineStyleModifier *alloc_thickness_modifier(int type) return new_modifier(type, size); } -LineStyleModifier *FRS_add_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, int type) +LineStyleModifier *BKE_add_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, int type) { LineStyleModifier *m; @@ -552,7 +552,7 @@ LineStyleModifier *FRS_add_linestyle_thickness_modifier(FreestyleLineStyle *line return m; } -LineStyleModifier *FRS_copy_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { LineStyleModifier *new_m; @@ -625,7 +625,7 @@ LineStyleModifier *FRS_copy_linestyle_thickness_modifier(FreestyleLineStyle *lin return new_m; } -void FRS_remove_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +void BKE_remove_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { switch (m->type) { case LS_MODIFIER_ALONG_STROKE: @@ -697,7 +697,7 @@ static LineStyleModifier *alloc_geometry_modifier(int type) return new_modifier(type, size); } -LineStyleModifier *FRS_add_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, int type) +LineStyleModifier *BKE_add_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, int type) { LineStyleModifier *m; @@ -815,7 +815,7 @@ LineStyleModifier *FRS_add_linestyle_geometry_modifier(FreestyleLineStyle *lines return m; } -LineStyleModifier *FRS_copy_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { LineStyleModifier *new_m; @@ -947,7 +947,7 @@ LineStyleModifier *FRS_copy_linestyle_geometry_modifier(FreestyleLineStyle *line return new_m; } -void FRS_remove_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) +void BKE_remove_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { BLI_freelinkN(&linestyle->geometry_modifiers, m); } @@ -961,27 +961,27 @@ static void move_modifier(ListBase *lb, LineStyleModifier *modifier, int directi BLI_insertlinkafter(lb, modifier->next, modifier); } -void FRS_move_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +void BKE_move_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { move_modifier(&linestyle->color_modifiers, modifier, direction); } -void FRS_move_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +void BKE_move_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { move_modifier(&linestyle->alpha_modifiers, modifier, direction); } -void FRS_move_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +void BKE_move_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { move_modifier(&linestyle->thickness_modifiers, modifier, direction); } -void FRS_move_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) +void BKE_move_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction) { move_modifier(&linestyle->geometry_modifiers, modifier, direction); } -void FRS_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase) +void BKE_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase) { LineStyleModifier *m; ColorBand *color_ramp; @@ -1011,7 +1011,7 @@ void FRS_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *list } } -char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp) +char *BKE_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp) { LineStyleModifier *m; bool found = false; @@ -1038,11 +1038,11 @@ char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *c if (found) return BLI_sprintfN("color_modifiers[\"%s\"].color_ramp", m->name); } - printf("FRS_path_from_ID_to_color_ramp: No color ramps correspond to the given pointer.\n"); + printf("BKE_path_from_ID_to_color_ramp: No color ramps correspond to the given pointer.\n"); return NULL; } -void FRS_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob) +void BKE_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob) { LineStyleModifier *m; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index a863d187a2c..a4f147a4fac 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -153,9 +153,7 @@ 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 0c6e0f72523..20a5daf7116 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -90,6 +90,7 @@ #include "BKE_lamp.h" #include "BKE_lattice.h" #include "BKE_library.h" +#include "BKE_linestyle.h" #include "BKE_mesh.h" #include "BKE_tessmesh.h" #include "BKE_mball.h" @@ -119,10 +120,6 @@ #include "GPU_material.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!) */ @@ -427,6 +424,8 @@ void BKE_object_unlink(Object *ob) World *wrld; bScreen *sc; Scene *sce; + SceneRenderLayer *srl; + FreestyleLineSet *lineset; Curve *cu; Tex *tex; Group *group; @@ -680,15 +679,12 @@ void BKE_object_unlink(Object *ob) SEQ_END } -#ifdef WITH_FREESTYLE - { - SceneRenderLayer *srl; - - for (srl= sce->r.layers.first; srl; srl= srl->next) { - FRS_unlink_target_object(&srl->freestyleConfig, ob); + for (srl= sce->r.layers.first; srl; srl= srl->next) { + for (lineset = (FreestyleLineSet *)&srl->freestyleConfig.linesets.first; + lineset; lineset = lineset->next) { + BKE_unlink_linestyle_target_object(lineset->linestyle, ob); } } -#endif } sce = sce->id.next; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index a942e694f2e..d01d7090d96 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -63,6 +63,7 @@ #include "BKE_colortools.h" #include "BKE_depsgraph.h" #include "BKE_fcurve.h" +#include "BKE_freestyle.h" #include "BKE_global.h" #include "BKE_group.h" #include "BKE_idprop.h" @@ -87,10 +88,6 @@ //XXX #include "BIF_previewrender.h" //XXX #include "BIF_editseq.h" -#ifdef WITH_FREESTYLE -# include "FRS_freestyle_config.h" -#endif - #ifdef WIN32 #else #include <sys/time.h> @@ -144,6 +141,7 @@ static void remove_sequencer_fcurves(Scene *sce) Scene *BKE_scene_copy(Scene *sce, int type) { Scene *scen; + SceneRenderLayer *srl, *new_srl; ToolSettings *ts; Base *base, *obase; @@ -212,17 +210,12 @@ Scene *BKE_scene_copy(Scene *sce, int type) if (type != SCE_COPY_FULL) remove_sequencer_fcurves(scen); -#ifdef WITH_FREESTYLE - { - SceneRenderLayer *srl, *new_srl; - - new_srl = scen->r.layers.first; - for (srl = sce->r.layers.first; srl; srl = srl->next) { - FRS_copy_freestyle_config(&new_srl->freestyleConfig, &srl->freestyleConfig); - new_srl = new_srl->next; - } + /* copy Freestyle settings */ + new_srl = scen->r.layers.first; + for (srl = sce->r.layers.first; srl; srl = srl->next) { + BKE_freestyle_config_copy(&new_srl->freestyleConfig, &srl->freestyleConfig); + new_srl = new_srl->next; } -#endif } /* tool settings */ @@ -305,6 +298,7 @@ Scene *BKE_scene_copy(Scene *sce, int type) void BKE_scene_free(Scene *sce) { Base *base; + SceneRenderLayer *srl; /* check all sequences */ BKE_sequencer_clear_scene_in_allseqs(G.main, sce); @@ -351,15 +345,9 @@ void BKE_scene_free(Scene *sce) sce->r.ffcodecdata.properties = NULL; } -#ifdef WITH_FREESTYLE - { - SceneRenderLayer *srl; - - for (srl = sce->r.layers.first; srl; srl = srl->next) { - FRS_free_freestyle_config(&srl->freestyleConfig); - } + for (srl = sce->r.layers.first; srl; srl = srl->next) { + BKE_freestyle_config_free(&srl->freestyleConfig); } -#endif BLI_freelistN(&sce->markers); BLI_freelistN(&sce->transform_spaces); @@ -1299,9 +1287,7 @@ 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; -#ifdef WITH_FREESTYLE - FRS_init_freestyle_config(&srl->freestyleConfig); -#endif + BKE_freestyle_config_init(&srl->freestyleConfig); return srl; } |