From 62cede96d34d802d97797a635ff8370a5f7556a1 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sat, 23 Mar 2013 03:00:37 +0000 Subject: 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_. --- source/blender/CMakeLists.txt | 5 +- source/blender/SConscript | 1 + source/blender/blenfont/BLF_translation.h | 4 +- source/blender/blenfont/CMakeLists.txt | 4 - source/blender/blenfont/SConscript | 3 - source/blender/blenkernel/BKE_freestyle.h | 64 ++++++ source/blender/blenkernel/BKE_linestyle.h | 49 ++--- source/blender/blenkernel/BKE_main.h | 2 - source/blender/blenkernel/CMakeLists.txt | 11 +- source/blender/blenkernel/SConscript | 3 - source/blender/blenkernel/intern/anim_sys.c | 8 - source/blender/blenkernel/intern/bpath.c | 6 +- source/blender/blenkernel/intern/freestyle.c | 234 +++++++++++++++++++++ source/blender/blenkernel/intern/group.c | 13 +- source/blender/blenkernel/intern/idcode.c | 2 - source/blender/blenkernel/intern/library.c | 20 +- source/blender/blenkernel/intern/linestyle.c | 68 +++--- source/blender/blenkernel/intern/material.c | 2 - source/blender/blenkernel/intern/object.c | 18 +- source/blender/blenkernel/intern/scene.c | 36 +--- source/blender/blenlib/CMakeLists.txt | 4 - source/blender/blenlib/SConscript | 3 - source/blender/blenloader/CMakeLists.txt | 4 - source/blender/blenloader/SConscript | 3 - source/blender/blenloader/intern/readfile.c | 64 ++---- source/blender/blenloader/intern/writefile.c | 30 +-- source/blender/editors/animation/CMakeLists.txt | 4 - source/blender/editors/animation/SConscript | 3 - .../editors/animation/anim_channels_defines.c | 8 +- .../blender/editors/animation/anim_channels_edit.c | 10 - source/blender/editors/animation/anim_filter.c | 12 +- source/blender/editors/include/ED_anim_api.h | 6 +- source/blender/editors/include/UI_resources.h | 2 - source/blender/editors/interface/CMakeLists.txt | 4 - source/blender/editors/interface/SConscript | 3 - .../editors/interface/interface_templates.c | 8 +- source/blender/editors/interface/resources.c | 6 - source/blender/editors/render/render_shading.c | 69 +++--- source/blender/editors/space_nla/CMakeLists.txt | 4 - source/blender/editors/space_nla/SConscript | 3 - source/blender/editors/space_nla/nla_buttons.c | 2 - source/blender/editors/space_nla/nla_channels.c | 2 - source/blender/freestyle/FRS_freestyle.h | 16 -- source/blender/freestyle/FRS_freestyle_config.h | 50 ----- .../intern/blender_interface/FRS_freestyle.cpp | 221 +------------------ source/blender/makesdna/DNA_ID.h | 4 +- source/blender/makesdna/DNA_action_types.h | 2 - source/blender/makesdna/DNA_material_types.h | 2 - source/blender/makesdna/DNA_mesh_types.h | 2 - source/blender/makesdna/DNA_meshdata_types.h | 4 - source/blender/makesdna/DNA_scene_types.h | 14 +- source/blender/makesdna/DNA_userdef_types.h | 2 - source/blender/makesdna/intern/CMakeLists.txt | 4 - source/blender/makesdna/intern/SConscript | 3 - source/blender/makesdna/intern/makesdna.c | 4 - source/blender/makesrna/RNA_access.h | 4 - source/blender/makesrna/RNA_enum_types.h | 2 - source/blender/makesrna/intern/CMakeLists.txt | 11 +- source/blender/makesrna/intern/SConscript | 2 +- source/blender/makesrna/intern/makesrna.c | 2 - source/blender/makesrna/intern/rna_ID.c | 6 - source/blender/makesrna/intern/rna_action.c | 2 - source/blender/makesrna/intern/rna_color.c | 24 +-- source/blender/makesrna/intern/rna_internal.h | 4 - source/blender/makesrna/intern/rna_main.c | 4 - source/blender/makesrna/intern/rna_main_api.c | 14 +- source/blender/makesrna/intern/rna_mesh.c | 4 - source/blender/makesrna/intern/rna_scene.c | 32 +-- source/blender/makesrna/intern/rna_userdef.c | 4 - .../blender/render/intern/source/render_result.c | 9 +- source/blender/windowmanager/WM_types.h | 4 +- 71 files changed, 486 insertions(+), 777 deletions(-) create mode 100644 source/blender/blenkernel/BKE_freestyle.h create mode 100644 source/blender/blenkernel/intern/freestyle.c delete mode 100644 source/blender/freestyle/FRS_freestyle_config.h diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt index 14d5a2cca0c..7e327028a01 100644 --- a/source/blender/CMakeLists.txt +++ b/source/blender/CMakeLists.txt @@ -43,6 +43,7 @@ set(SRC_DNA_INC ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_dynamicpaint_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_effect_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_fileglobal_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_freestyle_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_genfile.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_group_types.h @@ -51,6 +52,7 @@ set(SRC_DNA_INC ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_key_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lamp_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lattice_types.h + ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_linestyle_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_listBase.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_material_types.h ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_mesh_types.h @@ -140,9 +142,6 @@ if(WITH_OPENCOLLADA) endif() if(WITH_FREESTYLE) - list(APPEND SRC_DNA_INC - ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_linestyle_types.h - ) add_subdirectory(freestyle) endif() diff --git a/source/blender/SConscript b/source/blender/SConscript index a4041212c89..66d54961131 100644 --- a/source/blender/SConscript +++ b/source/blender/SConscript @@ -66,5 +66,6 @@ if env['WITH_BF_COLLADA']: if env['WITH_BF_COMPOSITOR']: SConscript (['compositor/SConscript']) + if env['WITH_BF_FREESTYLE']: SConscript (['freestyle/SConscript']) diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index c8d46503e26..19746f7d5b4 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -134,9 +134,7 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid); #define BLF_I18NCONTEXT_ID_BRUSH "Brush" #define BLF_I18NCONTEXT_ID_CAMERA "Camera" #define BLF_I18NCONTEXT_ID_CURVE "Curve" -#ifdef WITH_FREESTYLE -# define BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE "FreestyleLineStyle" -#endif +#define BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE "FreestyleLineStyle" #define BLF_I18NCONTEXT_ID_GPENCIL "GPencil" #define BLF_I18NCONTEXT_ID_GROUP "Group" #define BLF_I18NCONTEXT_ID_ID "ID" diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt index 42298133d7d..7bb80c34323 100644 --- a/source/blender/blenfont/CMakeLists.txt +++ b/source/blender/blenfont/CMakeLists.txt @@ -59,10 +59,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) -endif() - add_definitions(-DGLEW_STATIC) blender_add_lib(bf_blenfont "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenfont/SConscript b/source/blender/blenfont/SConscript index 8273ddf1e40..3529330a308 100644 --- a/source/blender/blenfont/SConscript +++ b/source/blender/blenfont/SConscript @@ -43,7 +43,4 @@ if sys.platform == 'win32' or env['OURPLATFORM'] == 'linuxcross': if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') -if env['WITH_BF_FREESTYLE']: - defs.append('WITH_FREESTYLE') - env.BlenderLib ( 'bf_blenfont', sources, Split(incs), defines=defs, libtype=['core','player'], priority=[210,210] ) diff --git a/source/blender/blenkernel/BKE_freestyle.h b/source/blender/blenkernel/BKE_freestyle.h new file mode 100644 index 00000000000..84a4bc255af --- /dev/null +++ b/source/blender/blenkernel/BKE_freestyle.h @@ -0,0 +1,64 @@ +/* + * ***** 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 ***** + */ + +#ifndef __BKE_FREESTYLE_H__ +#define __BKE_FREESTYLE_H__ + +/** \file BKE_freestyle.h + * \ingroup bke + */ + +#include "DNA_scene_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* FreestyleConfig */ +void BKE_freestyle_config_init(FreestyleConfig *config); +void BKE_freestyle_config_free(FreestyleConfig *config); +void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *config); + +/* FreestyleConfig.modules */ +void BKE_freestyle_module_add(FreestyleConfig *config); +void BKE_freestyle_module_delete(FreestyleConfig *config, FreestyleModuleConfig *module_conf); +void BKE_freestyle_module_move_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf); +void BKE_freestyle_module_move_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf); + +/* FreestyleConfig.linesets */ +FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config); +FreestyleLineSet *BKE_freestyle_lineset_get_active(FreestyleConfig *config); +short BKE_freestyle_lineset_get_active_index(FreestyleConfig *config); +void BKE_freestyle_lineset_set_active_index(FreestyleConfig *config, short index); +void BKE_freestyle_lineset_unique_name(FreestyleConfig *config, FreestyleLineSet *lineset); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index e077cd998c9..13d111cb93b 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -33,8 +33,6 @@ * \brief Blender kernel freestyle line style functionality. */ -#ifdef WITH_FREESTYLE - #include "DNA_linestyle_types.h" #define LS_MODIFIER_TYPE_COLOR 1 @@ -44,36 +42,35 @@ struct Main; struct Object; +struct ColorBand; -FreestyleLineStyle *FRS_new_linestyle(const char *name, struct Main *main); -void FRS_free_linestyle(FreestyleLineStyle *linestyle); -FreestyleLineStyle *FRS_copy_linestyle(FreestyleLineStyle *linestyle); - -LineStyleModifier *FRS_add_linestyle_color_modifier(FreestyleLineStyle *linestyle, int type); -LineStyleModifier *FRS_add_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, int type); -LineStyleModifier *FRS_add_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, int type); -LineStyleModifier *FRS_add_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, int type); +FreestyleLineStyle *BKE_new_linestyle(const char *name, struct Main *main); +void BKE_free_linestyle(FreestyleLineStyle *linestyle); +FreestyleLineStyle *BKE_copy_linestyle(FreestyleLineStyle *linestyle); -LineStyleModifier *FRS_copy_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); -LineStyleModifier *FRS_copy_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); -LineStyleModifier *FRS_copy_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); -LineStyleModifier *FRS_copy_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); +LineStyleModifier *BKE_add_linestyle_color_modifier(FreestyleLineStyle *linestyle, int type); +LineStyleModifier *BKE_add_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, int type); +LineStyleModifier *BKE_add_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, int type); +LineStyleModifier *BKE_add_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, int type); -void FRS_remove_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); -void FRS_remove_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); -void FRS_remove_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); -void FRS_remove_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); +LineStyleModifier *BKE_copy_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); +LineStyleModifier *BKE_copy_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); +LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); +LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m); -void FRS_move_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void FRS_move_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void FRS_move_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void FRS_move_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +void BKE_remove_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); +void BKE_remove_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); +void BKE_remove_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); +void BKE_remove_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); -void FRS_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase); -char *FRS_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, ColorBand *color_ramp); +void BKE_move_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +void BKE_move_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +void BKE_move_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); +void BKE_move_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction); -void FRS_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob); +void BKE_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase); +char *BKE_path_from_ID_to_color_ramp(FreestyleLineStyle *linestyle, struct ColorBand *color_ramp); -#endif /* WITH_FREESTYLE */ +void BKE_unlink_linestyle_target_object(FreestyleLineStyle *linestyle, struct Object *ob); #endif /* __BKE_LINESTYLE_H__ */ diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index fec163e2d17..264a7421e91 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -88,9 +88,7 @@ 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 599296f54a5..57e99481604 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -90,6 +90,7 @@ set(SRC intern/fluidsim.c intern/fmodifier.c intern/font.c + intern/freestyle.c intern/gpencil.c intern/group.c intern/icons.c @@ -103,6 +104,7 @@ 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 @@ -188,6 +190,7 @@ set(SRC BKE_fcurve.h BKE_fluidsim.h BKE_font.h + BKE_freestyle.h BKE_global.h BKE_gpencil.h BKE_group.h @@ -200,6 +203,7 @@ set(SRC BKE_lamp.h BKE_lattice.h BKE_library.h + BKE_linestyle.h BKE_main.h BKE_mask.h BKE_material.h @@ -425,13 +429,6 @@ if(WITH_INTERNATIONAL) endif() if(WITH_FREESTYLE) - list(APPEND SRC - intern/linestyle.c - BKE_linestyle.h - ) - list(APPEND INC - ../freestyle - ) add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 623df124d96..c21cd168874 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -150,9 +150,6 @@ if env['WITH_BF_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 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 @@ -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; } diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 199174ae602..e39ae395ffa 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -169,10 +169,6 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() -if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) -endif() - if(WIN32) list(APPEND INC ../../../intern/utfconv diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript index 79e2a47aeb8..41a9fe9e8b4 100644 --- a/source/blender/blenlib/SConscript +++ b/source/blender/blenlib/SConscript @@ -37,9 +37,6 @@ incs += ' ' + env['BF_FREETYPE_INC'] incs += ' ' + env['BF_ZLIB_INC'] defs = [] -if env['WITH_BF_FREESTYLE']: - defs.append('WITH_FREESTYLE') - if env['WITH_BF_BINRELOC']: cflags='-pthread' incs += ' ../../../extern/binreloc/include' diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index b55d6b679d2..5b929195aea 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -66,8 +66,4 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) -endif() - blender_add_lib(bf_blenloader "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript index f85ae8c112b..8950c4f7702 100644 --- a/source/blender/blenloader/SConscript +++ b/source/blender/blenloader/SConscript @@ -40,9 +40,6 @@ defs = [] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') -if env['WITH_BF_FREESTYLE']: - defs.append('WITH_FREESTYLE') - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [167,30]) #, cc_compileflags=['/WX'] ) else: diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0fa01b95bb2..2be1b958982 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -71,9 +71,7 @@ #include "DNA_key_types.h" #include "DNA_lattice_types.h" #include "DNA_lamp_types.h" -#ifdef WITH_FREESTYLE -# include "DNA_linestyle_types.h" -#endif +#include "DNA_linestyle_types.h" #include "DNA_meta_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" @@ -5018,6 +5016,7 @@ static void lib_link_scene(FileData *fd, Main *main) Sequence *seq; SceneRenderLayer *srl; TimeMarker *marker; + FreestyleLineSet *fls; for (sce = main->scene.first; sce; sce = sce->id.next) { if (sce->id.flag & LIB_NEED_LINK) { @@ -5132,16 +5131,10 @@ static void lib_link_scene(FileData *fd, Main *main) for (srl = sce->r.layers.first; srl; srl = srl->next) { srl->mat_override = newlibadr_us(fd, sce->id.lib, srl->mat_override); srl->light_override = newlibadr_us(fd, sce->id.lib, srl->light_override); -#ifdef WITH_FREESTYLE - { - FreestyleLineSet *fls; - - for (fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) { - fls->linestyle = newlibadr_us(fd, sce->id.lib, fls->linestyle); - fls->group = newlibadr_us(fd, sce->id.lib, fls->group); - } + for (fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) { + fls->linestyle = newlibadr_us(fd, sce->id.lib, fls->linestyle); + fls->group = newlibadr_us(fd, sce->id.lib, fls->group); } -#endif } /*Game Settings: Dome Warp Text*/ sce->gm.dome.warptext = newlibadr(fd, sce->id.lib, sce->gm.dome.warptext); @@ -5211,6 +5204,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) Sequence *seq; MetaStack *ms; RigidBodyWorld *rbw; + SceneRenderLayer *srl; sce->theDag = NULL; sce->obedit = NULL; @@ -5389,18 +5383,12 @@ static void direct_link_scene(FileData *fd, Scene *sce) link_list(fd, &(sce->transform_spaces)); link_list(fd, &(sce->r.layers)); -#ifdef WITH_FREESTYLE - { - SceneRenderLayer *srl; - - for(srl = sce->r.layers.first; srl; srl = srl->next) { - link_list(fd, &(srl->freestyleConfig.modules)); - } - for(srl = sce->r.layers.first; srl; srl = srl->next) { - link_list(fd, &(srl->freestyleConfig.linesets)); - } + for(srl = sce->r.layers.first; srl; srl = srl->next) { + link_list(fd, &(srl->freestyleConfig.modules)); + } + for(srl = sce->r.layers.first; srl; srl = srl->next) { + link_list(fd, &(srl->freestyleConfig.linesets)); } -#endif sce->nodetree = newdataadr(fd, sce->nodetree); if (sce->nodetree) { @@ -6737,7 +6725,6 @@ static void lib_link_mask(FileData *fd, Main *main) } } -#ifdef WITH_FREESTYLE /* ************ READ LINE STYLE ***************** */ static void lib_link_linestyle(FileData *fd, Main *main) @@ -6910,7 +6897,6 @@ static void direct_link_linestyle(FileData *fd, FreestyleLineStyle *linestyle) for(modifier = linestyle->geometry_modifiers.first; modifier; modifier = modifier->next) direct_link_linestyle_geometry_modifier(fd, modifier); } -#endif /* ************** GENERAL & MAIN ******************** */ @@ -6946,9 +6932,7 @@ static const char *dataname(short id_code) case ID_PA: return "Data from PA"; case ID_GD: return "Data from GD"; case ID_MC: return "Data from MC"; -#ifdef WITH_FREESTYLE case ID_LS: return "Data from LS"; -#endif } return "Data from Lib Block"; @@ -7125,11 +7109,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID case ID_MSK: direct_link_mask(fd, (Mask *)id); break; -#ifdef WITH_FREESTYLE case ID_LS: direct_link_linestyle(fd, (FreestyleLineStyle *)id); break; -#endif } oldnewmap_free_unused(fd->datamap); @@ -9247,7 +9229,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } -#ifdef WITH_FREESTYLE /* default values in Freestyle settings */ { Scene *sce; @@ -9344,7 +9325,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } } -#endif /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init see do_versions_userdef() above! */ @@ -9395,9 +9375,7 @@ static void lib_link_all(FileData *fd, Main *main) lib_link_particlesettings(fd, main); lib_link_movieclip(fd, main); lib_link_mask(fd, main); -#ifdef WITH_FREESTYLE lib_link_linestyle(fd, main); -#endif lib_link_mesh(fd, main); /* as last: tpage images with users at zero */ @@ -10340,6 +10318,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) { Base *base; SceneRenderLayer *srl; + FreestyleLineSet *lineset; for (base = sce->base.first; base; base = base->next) { expand_doit(fd, mainvar, base->object); @@ -10360,18 +10339,11 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) for (srl = sce->r.layers.first; srl; srl = srl->next) { expand_doit(fd, mainvar, srl->mat_override); expand_doit(fd, mainvar, srl->light_override); - -#ifdef WITH_FREESTYLE - { - FreestyleLineSet *lineset; - - for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { - if (lineset->group) - expand_doit(fd, mainvar, lineset->group); - expand_doit(fd, mainvar, lineset->linestyle); - } + for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { + if (lineset->group) + expand_doit(fd, mainvar, lineset->group); + expand_doit(fd, mainvar, lineset->linestyle); } -#endif } if (sce->r.dometext) @@ -10470,7 +10442,6 @@ static void expand_mask(FileData *fd, Main *mainvar, Mask *mask) } } -#ifdef WITH_FREESTYLE static void expand_linestyle(FileData *fd, Main *mainvar, FreestyleLineStyle *linestyle) { LineStyleModifier *m; @@ -10490,7 +10461,6 @@ static void expand_linestyle(FileData *fd, Main *mainvar, FreestyleLineStyle *li expand_doit(fd, mainvar, ((LineStyleThicknessModifier_DistanceFromObject *)m)->target); } } -#endif void BLO_main_expander(void (*expand_doit_func)(void *, Main *, void *)) { @@ -10582,11 +10552,9 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) case ID_MSK: expand_mask(fd, mainvar, (Mask *)id); break; -#ifdef WITH_FREESTYLE case ID_LS: expand_linestyle(fd, mainvar, (FreestyleLineStyle *)id); break; -#endif } do_it = TRUE; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 83899c3c3a0..24075a1fe58 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -111,9 +111,7 @@ #include "DNA_key_types.h" #include "DNA_lattice_types.h" #include "DNA_lamp_types.h" -#ifdef WITH_FREESTYLE -# include "DNA_linestyle_types.h" -#endif +#include "DNA_linestyle_types.h" #include "DNA_meta_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" @@ -2198,6 +2196,8 @@ static void write_scenes(WriteData *wd, ListBase *scebase) TransformOrientation *ts; SceneRenderLayer *srl; ToolSettings *tos; + FreestyleModuleConfig *fmc; + FreestyleLineSet *fls; sce= scebase->first; while (sce) { @@ -2323,22 +2323,12 @@ static void write_scenes(WriteData *wd, ListBase *scebase) for (srl = sce->r.layers.first; srl; srl = srl->next) { writestruct(wd, DATA, "SceneRenderLayer", 1, srl); - -#ifdef WITH_FREESTYLE - { - FreestyleModuleConfig *fmc; - FreestyleLineSet *fls; - - for(fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) { - writestruct(wd, DATA, "FreestyleModuleConfig", 1, fmc); - } - - for(fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) { - writestruct(wd, DATA, "FreestyleLineSet", 1, fls); - } - + for(fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) { + writestruct(wd, DATA, "FreestyleModuleConfig", 1, fmc); + } + for(fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) { + writestruct(wd, DATA, "FreestyleLineSet", 1, fls); } -#endif } if (sce->nodetree) { @@ -3061,7 +3051,6 @@ static void write_masks(WriteData *wd, ListBase *idbase) mywrite(wd, MYWRITE_FLUSH, 0); } -#ifdef WITH_FREESTYLE static void write_linestyle_color_modifiers(WriteData *wd, ListBase *modifiers) { LineStyleModifier *m; @@ -3262,7 +3251,6 @@ static void write_linestyles(WriteData *wd, ListBase *idbase) } } } -#endif /* context is usually defined by WM, two cases where no WM is available: * - for forward compatibility, curscreen has to be saved @@ -3375,9 +3363,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil write_brushes (wd, &mainvar->brush); write_scripts (wd, &mainvar->script); write_gpencils (wd, &mainvar->gpencil); -#ifdef WITH_FREESTYLE write_linestyles(wd, &mainvar->linestyle); -#endif write_libraries(wd, mainvar->next); if (write_user_block) { diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt index 58e38e55fa3..9e1e44e411d 100644 --- a/source/blender/editors/animation/CMakeLists.txt +++ b/source/blender/editors/animation/CMakeLists.txt @@ -58,8 +58,4 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) -endif() - blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/animation/SConscript b/source/blender/editors/animation/SConscript index a4ccf1f6c3c..2a6b381ba66 100644 --- a/source/blender/editors/animation/SConscript +++ b/source/blender/editors/animation/SConscript @@ -37,7 +37,4 @@ defs = [] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') -if env['WITH_BF_FREESTYLE']: - defs.append('WITH_FREESTYLE') - env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), defs, libtype=['core'], priority=[125] ) diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index d6188720cdf..c7b28587e47 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -49,9 +49,7 @@ #include "DNA_key_types.h" #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" -#ifdef WITH_FREESTYLE -# include "DNA_linestyle_types.h" -#endif +#include "DNA_linestyle_types.h" #include "DNA_mesh_types.h" #include "DNA_material_types.h" #include "DNA_meta_types.h" @@ -2040,7 +2038,6 @@ static bAnimChannelType ACF_DSNTREE = acf_dsntree_setting_ptr /* pointer for setting */ }; -#ifdef WITH_FREESTYLE /* LineStyle Expander ------------------------------------------- */ /* TODO: just get this from RNA? */ @@ -2117,7 +2114,6 @@ static bAnimChannelType ACF_DSLINESTYLE= acf_dslinestyle_setting_flag, /* flag for setting */ acf_dslinestyle_setting_ptr /* pointer for setting */ }; -#endif /* Mesh Expander ------------------------------------------- */ @@ -2831,9 +2827,7 @@ static void ANIM_init_channel_typeinfo_data(void) animchannelTypeInfo[type++] = &ACF_DSTEX; /* Texture Channel */ animchannelTypeInfo[type++] = &ACF_DSLAT; /* Lattice Channel */ animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */ -#ifdef WITH_FREESTYLE animchannelTypeInfo[type++] = &ACF_DSLINESTYLE; /* LineStyle Channel */ -#endif animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */ diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index dd18d07732d..481430f37e4 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -124,9 +124,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f case ANIMTYPE_DSMESH: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: -#endif case ANIMTYPE_DSSPK: { /* need to verify that this data is valid for now */ @@ -172,9 +170,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f case ANIMTYPE_DSARM: case ANIMTYPE_DSMESH: case ANIMTYPE_DSLAT: -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: -#endif case ANIMTYPE_DSSPK: { /* need to verify that this data is valid for now */ @@ -255,9 +251,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: -#endif case ANIMTYPE_DSSPK: { if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED)) @@ -352,9 +346,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: -#endif case ANIMTYPE_DSSPK: { /* need to verify that this data is valid for now */ @@ -2431,9 +2423,7 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in case ANIMTYPE_DSNTREE: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: -#endif case ANIMTYPE_DSSPK: { /* sanity checking... */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 7648d998216..61e03806391 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -55,9 +55,7 @@ #include "DNA_camera_types.h" #include "DNA_lamp_types.h" #include "DNA_lattice_types.h" -#ifdef WITH_FREESTYLE -# include "DNA_linestyle_types.h" -#endif +#include "DNA_linestyle_types.h" #include "DNA_key_types.h" #include "DNA_mask_types.h" #include "DNA_material_types.h" @@ -737,7 +735,6 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->adt = BKE_animdata_from_id(data); } break; -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: { FreestyleLineStyle *linestyle = (FreestyleLineStyle *)data; @@ -750,8 +747,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->adt = BKE_animdata_from_id(data); } - break; -#endif + break; case ANIMTYPE_DSPART: { ParticleSettings *part = (ParticleSettings *)ale->data; @@ -1550,7 +1546,6 @@ static size_t animdata_filter_ds_nodetree(bAnimContext *ac, ListBase *anim_data, return items; } -#ifdef WITH_FREESTYLE static size_t animdata_filter_ds_linestyle (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode) { SceneRenderLayer *srl; @@ -1598,7 +1593,6 @@ static size_t animdata_filter_ds_linestyle (bAnimContext *ac, ListBase *anim_dat /* return the number of items added to the list */ return items; } -#endif /* NOTE: owner_id is either material, lamp, or world block, which is the direct owner of the texture stack in question */ static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, int filter_mode) @@ -2234,12 +2228,10 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)sce, ntree, filter_mode); } -#ifdef WITH_FREESTYLE /* line styles */ if ((ads->filterflag & ADS_FILTER_NOLINESTYLE) == 0) { tmp_items += animdata_filter_ds_linestyle(ac, &tmp_data, ads, sce, filter_mode); } -#endif /* TODO: one day, when sequencer becomes its own datatype, perhaps it should be included here */ } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 625ef27f4f7..1c2ec27a061 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -155,9 +155,7 @@ typedef enum eAnim_ChannelType { ANIMTYPE_DSMESH, ANIMTYPE_DSTEX, ANIMTYPE_DSLAT, -#ifdef WITH_FREESTYLE ANIMTYPE_DSLINESTYLE, -#endif ANIMTYPE_DSSPK, ANIMTYPE_SHAPEKEY, @@ -239,9 +237,7 @@ typedef enum eAnimFilter_Flags { #define EXPANDED_SCEC(sce) (CHECK_TYPE_INLINE(sce, Scene), ((sce->flag & SCE_DS_COLLAPSED) == 0)) /* 'Sub-Scene' channels (flags stored in Data block) */ #define FILTER_WOR_SCED(wo) (CHECK_TYPE_INLINE(wo, World), (wo->flag & WO_DS_EXPAND)) -#ifdef WITH_FREESTYLE -# define FILTER_LS_SCED(linestyle) ((linestyle->flag & LS_DS_EXPAND)) -#endif +#define FILTER_LS_SCED(linestyle) ((linestyle->flag & LS_DS_EXPAND)) /* 'Object' channels */ #define SEL_OBJC(base) (CHECK_TYPE_INLINE(base, Base), ((base->flag & SELECT))) #define EXPANDED_OBJC(ob) (CHECK_TYPE_INLINE(ob, Object), ((ob->nlaflag & OB_ADS_COLLAPSED) == 0)) diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index fb4e9d2aa6e..308ca8c9355 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -208,10 +208,8 @@ enum { TH_STITCH_PREVIEW_UNSTITCHABLE, TH_STITCH_PREVIEW_ACTIVE, -/* #ifdef WITH_FREESTYLE */ TH_FREESTYLE_EDGE_MARK, TH_FREESTYLE_FACE_MARK, -/* #endif */ TH_MATCH, /* highlight color for search matches */ TH_SELECT_HIGHLIGHT, /* highlight color for selected outliner item */ diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt index 267e7c05737..8ba86673f87 100644 --- a/source/blender/editors/interface/CMakeLists.txt +++ b/source/blender/editors/interface/CMakeLists.txt @@ -62,10 +62,6 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) -endif() - if(WITH_HEADLESS) add_definitions(-DWITH_HEADLESS) endif() diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript index 16e4e6cb9c0..8d277d6cd35 100644 --- a/source/blender/editors/interface/SConscript +++ b/source/blender/editors/interface/SConscript @@ -42,9 +42,6 @@ defs = [] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') -if env['WITH_BF_FREESTYLE']: - defs.append('WITH_FREESTYLE') - if env['WITH_BF_PYTHON']: defs.append('WITH_PYTHON') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index f376d42e7a8..30d360363c6 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -334,9 +334,7 @@ static const char *template_id_browse_tip(StructRNA *type) case ID_MA: return N_("Browse Material to be linked"); case ID_TE: return N_("Browse Texture to be linked"); case ID_IM: return N_("Browse Image to be linked"); -#ifdef WITH_FREESTYLE case ID_LS: return N_("Browse Line Style Data to be linked"); -#endif case ID_LT: return N_("Browse Lattice Data to be linked"); case ID_LA: return N_("Browse Lamp Data to be linked"); case ID_CA: return N_("Browse Camera Data to be linked"); @@ -372,9 +370,7 @@ static const char *template_id_context(StructRNA *type) case ID_MA: return BLF_I18NCONTEXT_ID_MATERIAL; case ID_TE: return BLF_I18NCONTEXT_ID_TEXTURE; case ID_IM: return BLF_I18NCONTEXT_ID_IMAGE; -#ifdef WITH_FREESTYLE case ID_LS: return BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE; -#endif case ID_LT: return BLF_I18NCONTEXT_ID_LATTICE; case ID_LA: return BLF_I18NCONTEXT_ID_LAMP; case ID_CA: return BLF_I18NCONTEXT_ID_CAMERA; @@ -532,9 +528,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str BLF_I18NCONTEXT_ID_BRUSH, BLF_I18NCONTEXT_ID_PARTICLESETTINGS, BLF_I18NCONTEXT_ID_GPENCIL, -#ifdef WITH_FREESTYLE - BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE -#endif + BLF_I18NCONTEXT_ID_FREESTYLELINESTYLE, ); if (newop) { diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 658d89abea3..288b8b43e82 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -361,12 +361,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp = ts->handle_sel_vect; break; case TH_HANDLE_SEL_ALIGN: cp = ts->handle_sel_align; break; -#ifdef WITH_FREESTYLE case TH_FREESTYLE_EDGE_MARK: cp = ts->freestyle_edge_mark; break; case TH_FREESTYLE_FACE_MARK: cp = ts->freestyle_face_mark; break; -#endif case TH_SYNTAX_B: cp = ts->syntaxb; break; @@ -768,10 +766,8 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tv3d.button_text_hi, 255, 255, 255, 255); rgba_char_args_set(btheme->tv3d.button_title, 0, 0, 0, 255); rgba_char_args_set(btheme->tv3d.title, 0, 0, 0, 255); -#ifdef WITH_FREESTYLE rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255); rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51); -#endif btheme->tv3d.facedot_size = 4; @@ -2030,7 +2026,6 @@ void init_userdef_do_versions(void) } } -#ifdef WITH_FREESTYLE /* Freestyle color settings */ { bTheme *btheme; @@ -2043,7 +2038,6 @@ void init_userdef_do_versions(void) } } } -#endif /* GL Texture Garbage Collection (variable abused above!) */ if (U.textimeout == 0) { diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 174343ff0ad..d1254a7cb78 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -51,10 +51,12 @@ #include "BKE_curve.h" #include "BKE_depsgraph.h" #include "BKE_font.h" +#include "BKE_freestyle.h" #include "BKE_global.h" #include "BKE_icons.h" #include "BKE_image.h" #include "BKE_library.h" +#include "BKE_linestyle.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_node.h" @@ -70,7 +72,6 @@ #include "GPU_material.h" #ifdef WITH_FREESTYLE -# include "BKE_linestyle.h" # include "FRS_freestyle.h" #endif @@ -580,12 +581,13 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot) } #ifdef WITH_FREESTYLE + static int freestyle_module_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FRS_add_module(&srl->freestyleConfig); + BKE_freestyle_module_add(&srl->freestyleConfig); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -613,7 +615,7 @@ static int freestyle_module_remove_exec(bContext *C, wmOperator *UNUSED(op)) PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings); FreestyleModuleConfig *module = ptr.data; - FRS_delete_module(&srl->freestyleConfig, module); + BKE_freestyle_module_delete(&srl->freestyleConfig, module); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -643,10 +645,10 @@ static int freestyle_module_move_exec(bContext *C, wmOperator *op) int dir = RNA_enum_get(op->ptr, "direction"); if (dir == 1) { - FRS_move_module_up(&srl->freestyleConfig, module); + BKE_freestyle_module_move_up(&srl->freestyleConfig, module); } else { - FRS_move_module_down(&srl->freestyleConfig, module); + BKE_freestyle_module_move_down(&srl->freestyleConfig, module); } WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -681,7 +683,7 @@ static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FRS_add_lineset(&srl->freestyleConfig); + BKE_freestyle_lineset_add(&srl->freestyleConfig); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -707,7 +709,7 @@ static int freestyle_active_lineset_poll(bContext *C) Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - return FRS_get_active_lineset(&srl->freestyleConfig) != NULL; + return BKE_freestyle_lineset_get_active(&srl->freestyleConfig) != NULL; } static int freestyle_lineset_copy_exec(bContext *C, wmOperator *UNUSED(op)) @@ -836,14 +838,14 @@ static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); if (!lineset) { BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to"); return OPERATOR_CANCELLED; } lineset->linestyle->id.us--; - lineset->linestyle = FRS_copy_linestyle(lineset->linestyle); + lineset->linestyle = BKE_copy_linestyle(lineset->linestyle); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -869,14 +871,14 @@ static int freestyle_color_modifier_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } - if (FRS_add_linestyle_color_modifier(lineset->linestyle, type) == NULL) { + if (BKE_add_linestyle_color_modifier(lineset->linestyle, type) == NULL) { BKE_report(op->reports, RPT_ERROR, "Unknown line color modifier type."); return OPERATOR_CANCELLED; } @@ -908,14 +910,14 @@ static int freestyle_alpha_modifier_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } - if (FRS_add_linestyle_alpha_modifier(lineset->linestyle, type) == NULL) { + if (BKE_add_linestyle_alpha_modifier(lineset->linestyle, type) == NULL) { BKE_report(op->reports, RPT_ERROR, "Unknown alpha transparency modifier type"); return OPERATOR_CANCELLED; } @@ -947,14 +949,14 @@ static int freestyle_thickness_modifier_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } - if (FRS_add_linestyle_thickness_modifier(lineset->linestyle, type) == NULL) { + if (BKE_add_linestyle_thickness_modifier(lineset->linestyle, type) == NULL) { BKE_report(op->reports, RPT_ERROR, "Unknown line thickness modifier type"); return OPERATOR_CANCELLED; } @@ -986,14 +988,14 @@ static int freestyle_geometry_modifier_add_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } - if (FRS_add_linestyle_geometry_modifier(lineset->linestyle, type) == NULL) { + if (BKE_add_linestyle_geometry_modifier(lineset->linestyle, type) == NULL) { BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type"); return OPERATOR_CANCELLED; } @@ -1038,7 +1040,7 @@ static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); LineStyleModifier *modifier = ptr.data; @@ -1049,16 +1051,16 @@ static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op) switch (freestyle_get_modifier_type(&ptr)) { case LS_MODIFIER_TYPE_COLOR: - FRS_remove_linestyle_color_modifier(lineset->linestyle, modifier); + BKE_remove_linestyle_color_modifier(lineset->linestyle, modifier); break; case LS_MODIFIER_TYPE_ALPHA: - FRS_remove_linestyle_alpha_modifier(lineset->linestyle, modifier); + BKE_remove_linestyle_alpha_modifier(lineset->linestyle, modifier); break; case LS_MODIFIER_TYPE_THICKNESS: - FRS_remove_linestyle_thickness_modifier(lineset->linestyle, modifier); + BKE_remove_linestyle_thickness_modifier(lineset->linestyle, modifier); break; case LS_MODIFIER_TYPE_GEOMETRY: - FRS_remove_linestyle_geometry_modifier(lineset->linestyle, modifier); + BKE_remove_linestyle_geometry_modifier(lineset->linestyle, modifier); break; default: BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); @@ -1088,7 +1090,7 @@ static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); LineStyleModifier *modifier = ptr.data; @@ -1099,16 +1101,16 @@ static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op) switch (freestyle_get_modifier_type(&ptr)) { case LS_MODIFIER_TYPE_COLOR: - FRS_copy_linestyle_color_modifier(lineset->linestyle, modifier); + BKE_copy_linestyle_color_modifier(lineset->linestyle, modifier); break; case LS_MODIFIER_TYPE_ALPHA: - FRS_copy_linestyle_alpha_modifier(lineset->linestyle, modifier); + BKE_copy_linestyle_alpha_modifier(lineset->linestyle, modifier); break; case LS_MODIFIER_TYPE_THICKNESS: - FRS_copy_linestyle_thickness_modifier(lineset->linestyle, modifier); + BKE_copy_linestyle_thickness_modifier(lineset->linestyle, modifier); break; case LS_MODIFIER_TYPE_GEOMETRY: - FRS_copy_linestyle_geometry_modifier(lineset->linestyle, modifier); + BKE_copy_linestyle_geometry_modifier(lineset->linestyle, modifier); break; default: BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); @@ -1138,7 +1140,7 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig); PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); LineStyleModifier *modifier = ptr.data; int dir = RNA_enum_get(op->ptr, "direction"); @@ -1150,16 +1152,16 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) switch (freestyle_get_modifier_type(&ptr)) { case LS_MODIFIER_TYPE_COLOR: - FRS_move_linestyle_color_modifier(lineset->linestyle, modifier, dir); + BKE_move_linestyle_color_modifier(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_ALPHA: - FRS_move_linestyle_alpha_modifier(lineset->linestyle, modifier, dir); + BKE_move_linestyle_alpha_modifier(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_THICKNESS: - FRS_move_linestyle_thickness_modifier(lineset->linestyle, modifier, dir); + BKE_move_linestyle_thickness_modifier(lineset->linestyle, modifier, dir); break; case LS_MODIFIER_TYPE_GEOMETRY: - FRS_move_linestyle_geometry_modifier(lineset->linestyle, modifier, dir); + BKE_move_linestyle_geometry_modifier(lineset->linestyle, modifier, dir); break; default: BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); @@ -1193,7 +1195,8 @@ void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) /* props */ RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); } -#endif + +#endif /* WITH_FREESTYLE */ static int texture_slot_move(bContext *C, wmOperator *op) { diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt index 32fb3850cee..aa3598e8e1f 100644 --- a/source/blender/editors/space_nla/CMakeLists.txt +++ b/source/blender/editors/space_nla/CMakeLists.txt @@ -50,8 +50,4 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() -if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) -endif() - blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/space_nla/SConscript b/source/blender/editors/space_nla/SConscript index 2316f37e661..18c6392eee9 100644 --- a/source/blender/editors/space_nla/SConscript +++ b/source/blender/editors/space_nla/SConscript @@ -37,7 +37,4 @@ defs = [] if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') -if env['WITH_BF_FREESTYLE']: - defs.append('WITH_FREESTYLE') - env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), defs, libtype=['core'], priority=[85] ) diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index b2cae8e5496..b26d1662f6c 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -144,9 +144,7 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA case ANIMTYPE_DSMESH: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: -#endif case ANIMTYPE_DSSPK: { /* for these channels, we only do AnimData */ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 6d091e3c7c4..97a1c583e36 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -179,9 +179,7 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor case ANIMTYPE_DSMESH: case ANIMTYPE_DSTEX: case ANIMTYPE_DSLAT: -#ifdef WITH_FREESTYLE case ANIMTYPE_DSLINESTYLE: -#endif case ANIMTYPE_DSSPK: { /* sanity checking... */ diff --git a/source/blender/freestyle/FRS_freestyle.h b/source/blender/freestyle/FRS_freestyle.h index 5b2b62818c1..1759d394664 100644 --- a/source/blender/freestyle/FRS_freestyle.h +++ b/source/blender/freestyle/FRS_freestyle.h @@ -40,7 +40,6 @@ extern "C" { #include "DNA_scene_types.h" #include "BKE_context.h" -#include "BKE_object.h" struct Render; @@ -61,28 +60,13 @@ void FRS_finish_stroke_rendering(struct Render *re); void FRS_composite_result(struct Render *re, struct SceneRenderLayer *srl, struct Render *freestyle_render); void FRS_exit(void); -/* FreestyleConfig.modules */ -FreestyleModuleConfig *FRS_alloc_module(void); -void FRS_add_module(FreestyleConfig *config); -void FRS_delete_module(FreestyleConfig *config, FreestyleModuleConfig *module_conf); -void FRS_move_module_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf); -void FRS_move_module_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf); - /* FreestyleConfig.linesets */ -FreestyleLineSet *FRS_alloc_lineset(void); -FreestyleLineSet *FRS_add_lineset(FreestyleConfig *config); void FRS_copy_active_lineset(FreestyleConfig *config); void FRS_paste_active_lineset(FreestyleConfig *config); void FRS_delete_active_lineset(FreestyleConfig *config); void FRS_move_active_lineset_up(FreestyleConfig *config); void FRS_move_active_lineset_down(FreestyleConfig *config); -FreestyleLineSet *FRS_get_active_lineset(FreestyleConfig *config); -short FRS_get_active_lineset_index(FreestyleConfig *config); -void FRS_set_active_lineset_index(FreestyleConfig *config, short index); - -void FRS_unlink_target_object(FreestyleConfig *config, struct Object *ob); - #ifdef __cplusplus } #endif diff --git a/source/blender/freestyle/FRS_freestyle_config.h b/source/blender/freestyle/FRS_freestyle_config.h deleted file mode 100644 index 3a1d1482ec0..00000000000 --- a/source/blender/freestyle/FRS_freestyle_config.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ***** 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) 2010 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __FRS_FREESTYLE_CONFIG_H__ -#define __FRS_FREESTYLE_CONFIG_H__ - -/** \file FRS_freestyle_config.h - * \ingroup freestyle - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "DNA_scene_types.h" - -void FRS_init_freestyle_config(FreestyleConfig *config); -void FRS_free_freestyle_config(FreestyleConfig *config); - -void FRS_copy_freestyle_config(FreestyleConfig *new_config, FreestyleConfig *config); - -#ifdef __cplusplus -} -#endif - -#endif // __FRS_FREESTYLE_CONFIG_H__ diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index a5003302653..16f6633f54c 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -38,14 +38,9 @@ #include "../application/AppView.h" #include "../application/Controller.h" -#include "BKE_global.h" - using namespace std; -// XXX Are those "ifdef __cplusplus" useful here? -#ifdef __cplusplus extern "C" { -#endif #include "MEM_guardedalloc.h" @@ -54,6 +49,7 @@ extern "C" { #include "DNA_group_types.h" #include "DNA_text_types.h" +#include "BKE_freestyle.h" #include "BKE_global.h" #include "BKE_library.h" #include "BKE_linestyle.h" @@ -69,7 +65,6 @@ extern "C" { #include "pixelblending.h" #include "FRS_freestyle.h" -#include "FRS_freestyle_config.h" #define DEFAULT_SPHERE_RADIUS 1.0f #define DEFAULT_DKR_EPSILON 0.0f @@ -95,10 +90,6 @@ Scene *freestyle_scene; static string default_module_path; -// function declarations -static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset); -static void copy_module(FreestyleModuleConfig *new_module, FreestyleModuleConfig *module); - //======================================================= // Initialization //======================================================= @@ -640,158 +631,9 @@ void FRS_finish_stroke_rendering(Render *re) // Freestyle Panel Configuration //======================================================= -void FRS_init_freestyle_config(FreestyleConfig *config) -{ - config->mode = FREESTYLE_CONTROL_EDITOR_MODE; - - config->modules.first = config->modules.last = NULL; - config->flags = 0; - config->sphere_radius = DEFAULT_SPHERE_RADIUS; - config->dkr_epsilon = DEFAULT_DKR_EPSILON; - config->crease_angle = DEG2RADF(134.43f); - - config->linesets.first = config->linesets.last = NULL; -} - -void FRS_free_freestyle_config(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 FRS_copy_freestyle_config(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 = FRS_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 = FRS_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); -} - -FreestyleModuleConfig *FRS_alloc_module() -{ - return (FreestyleModuleConfig *)MEM_callocN(sizeof(FreestyleModuleConfig), "style module configuration"); -} - -void FRS_add_module(FreestyleConfig *config) -{ - FreestyleModuleConfig *module_conf = (FreestyleModuleConfig *)MEM_callocN(sizeof(FreestyleModuleConfig), - "style module configuration"); - BLI_addtail(&config->modules, (void *)module_conf); - - strcpy(module_conf->module_path, default_module_path.c_str()); - 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 FRS_delete_module(FreestyleConfig *config, FreestyleModuleConfig *module_conf) -{ - BLI_freelinkN(&config->modules, module_conf); -} - -void FRS_move_module_up(FreestyleConfig *config, FreestyleModuleConfig *module_conf) -{ - BLI_remlink(&config->modules, module_conf); - BLI_insertlinkbefore(&config->modules, module_conf->prev, module_conf); -} - -void FRS_move_module_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf) -{ - BLI_remlink(&config->modules, module_conf); - BLI_insertlinkafter(&config->modules, module_conf->next, module_conf); -} - -static void unique_lineset_name(FreestyleConfig *config, FreestyleLineSet *lineset) -{ - BLI_uniquename(&config->linesets, lineset, "FreestyleLineSet", '.', offsetof(FreestyleLineSet, name), - sizeof(lineset->name)); -} - -FreestyleLineSet *FRS_alloc_lineset() -{ - return (FreestyleLineSet *)MEM_callocN(sizeof(FreestyleLineSet), "Freestyle line set"); -} - -FreestyleLineSet *FRS_add_lineset(FreestyleConfig *config) -{ - int lineset_index = BLI_countlist(&config->linesets); - - FreestyleLineSet *lineset = FRS_alloc_lineset(); - BLI_addtail(&config->linesets, (void *)lineset); - FRS_set_active_lineset_index(config, lineset_index); - - lineset->linestyle = FRS_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"); - unique_lineset_name(config, lineset); - - return lineset; -} - void FRS_copy_active_lineset(FreestyleConfig *config) { - FreestyleLineSet *lineset = FRS_get_active_lineset(config); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); if (lineset) { lineset_buffer.linestyle = lineset->linestyle; @@ -813,7 +655,7 @@ void FRS_paste_active_lineset(FreestyleConfig *config) if (!lineset_copied) return; - FreestyleLineSet *lineset = FRS_get_active_lineset(config); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); if (lineset) { lineset->linestyle->id.us--; @@ -835,14 +677,14 @@ void FRS_paste_active_lineset(FreestyleConfig *config) lineset->group->id.us++; } strcpy(lineset->name, lineset_buffer.name); - unique_lineset_name(config, lineset); + BKE_freestyle_lineset_unique_name(config, lineset); lineset->flags |= FREESTYLE_LINESET_CURRENT; } } void FRS_delete_active_lineset(FreestyleConfig *config) { - FreestyleLineSet *lineset = FRS_get_active_lineset(config); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); if (lineset) { if (lineset->group) { @@ -853,13 +695,13 @@ void FRS_delete_active_lineset(FreestyleConfig *config) lineset->linestyle = NULL; BLI_remlink(&config->linesets, lineset); MEM_freeN(lineset); - FRS_set_active_lineset_index(config, 0); + BKE_freestyle_lineset_set_active_index(config, 0); } } void FRS_move_active_lineset_up(FreestyleConfig *config) { - FreestyleLineSet *lineset = FRS_get_active_lineset(config); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); if (lineset) { BLI_remlink(&config->linesets, lineset); @@ -869,7 +711,7 @@ void FRS_move_active_lineset_up(FreestyleConfig *config) void FRS_move_active_lineset_down(FreestyleConfig *config) { - FreestyleLineSet *lineset = FRS_get_active_lineset(config); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); if (lineset) { BLI_remlink(&config->linesets, lineset); @@ -877,51 +719,4 @@ void FRS_move_active_lineset_down(FreestyleConfig *config) } } -FreestyleLineSet *FRS_get_active_lineset(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 FRS_get_active_lineset_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 FRS_set_active_lineset_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; - } -} - -void FRS_unlink_target_object(FreestyleConfig *config, Object *ob) -{ - FreestyleLineSet *lineset; - - for (lineset = (FreestyleLineSet *)config->linesets.first; lineset; lineset = lineset->next) { - FRS_unlink_linestyle_target_object(lineset->linestyle, ob); - } -} - -#ifdef __cplusplus } // extern "C" -#endif diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 289af755170..9103914c3e7 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -212,9 +212,7 @@ typedef struct PreviewImage { #define ID_WM MAKE_ID2('W', 'M') /* WindowManager */ #define ID_MC MAKE_ID2('M', 'C') /* MovieClip */ #define ID_MSK MAKE_ID2('M', 'S') /* Mask */ -/* #ifdef WITH_FREESTYLE */ -# define ID_LS MAKE_ID2('L', 'S') /* FreestyleLineStyle */ -/* #endif */ +#define ID_LS MAKE_ID2('L', 'S') /* FreestyleLineStyle */ /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */ #define ID_SEQ MAKE_ID2('S', 'Q') diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 392c92148b4..eded0b4b76e 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -560,9 +560,7 @@ typedef enum eDopeSheet_FilterFlag { ADS_FILTER_NONTREE = (1 << 19), ADS_FILTER_NOTEX = (1 << 20), ADS_FILTER_NOSPK = (1 << 21), -/* #ifdef WITH_FREESTYLE */ ADS_FILTER_NOLINESTYLE = (1 << 22), -/* #endif */ /* NLA-specific filters */ ADS_FILTER_NLA_NOACT = (1 << 25), /* if the AnimData block has no NLA data, don't include to just show Action-line */ diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 544535303bd..e23b85b5a4e 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -177,10 +177,8 @@ typedef struct Material { short shadowonly_flag; /* "shadowsonly" type */ short index; /* custom index for render passes */ -/* #ifdef WITH_FREESTYLE */ short vcol_alpha; short pad4[3]; -/* #endif */ ListBase gpumaterial; /* runtime */ } Material; diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index c125518ba73..df8b423fcad 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -203,10 +203,8 @@ typedef struct TFace { /* debug only option */ #define ME_DRAWEXTRA_INDICES (1 << 13) -/* #ifdef WITH_FREESTYLE */ #define ME_DRAW_FREESTYLE_EDGE (1 << 14) #define ME_DRAW_FREESTYLE_FACE (1 << 15) -/* #endif */ /* Subsurf Type */ #define ME_CC_SUBSURF 0 diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index b849ca28d49..0eba83dae55 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -311,9 +311,7 @@ typedef struct FreestyleFace { #define ME_LOOSEEDGE (1<<7) /* #define ME_SEAM_LAST (1<<8) */ /* UNUSED */ #define ME_SHARP (1<<9) /* only reason this flag remains a 'short' */ -/* #ifdef WITH_FREESTYLE */ #define ME_FREESTYLE_EDGE (1<<10) /* TO BE REMOVED when the trunk merger is done */ -/* #endif */ /* puno = vertexnormal (mface) */ #define ME_PROJXY 16 @@ -330,9 +328,7 @@ typedef struct FreestyleFace { /* flag (mface) */ #define ME_SMOOTH 1 #define ME_FACE_SEL 2 -/* #ifdef WITH_FREESTYLE */ #define ME_FREESTYLE_FACE 4 /* TO BE REMOVED when the trunk merger is done */ -/* #endif */ /* flag ME_HIDE==16 is used here too */ #define ME_POLY_LOOP_PREV(mloop, mp, i) (&(mloop)[(mp)->loopstart + (((i) + (mp)->totloop - 1) % (mp)->totloop)]) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 702df31f832..a106afd38b2 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -45,9 +45,7 @@ extern "C" { #include "DNA_vec_types.h" #include "DNA_listBase.h" #include "DNA_ID.h" -/* #ifdef WITH_FREESTYLE */ #include "DNA_freestyle_types.h" -/* #endif */ struct Object; struct Brush; @@ -191,9 +189,7 @@ typedef struct SceneRenderLayer { int samples; int pad; -/* #ifdef WITH_FREESTYLE */ struct FreestyleConfig freestyleConfig; -/* #endif */ } SceneRenderLayer; /* srl->layflag */ @@ -203,10 +199,8 @@ typedef struct SceneRenderLayer { #define SCE_LAY_EDGE 8 #define SCE_LAY_SKY 16 #define SCE_LAY_STRAND 32 -/* #ifdef WITH_FREESTYLE */ #define SCE_LAY_FRS 64 -/* #endif */ - /* flags between 64 and 0x8000 are set to 1 already, for future options */ + /* flags between 128 and 0x8000 are set to 1 already, for future options */ #define SCE_LAY_ALL_Z 0x8000 #define SCE_LAY_XOR 0x10000 @@ -554,11 +548,9 @@ typedef struct RenderData { float pad2; struct Text *dometext DNA_DEPRECATED; // XXX deprecated since 2.5 -/* #ifdef WITH_FREESTYLE */ /* Freestyle line thickness options */ int line_thickness_mode; float unit_line_thickness; /* in pixels */ -/* #endif */ /* render engine */ char engine[32]; @@ -1354,11 +1346,9 @@ typedef struct Scene { /* simplify_flag */ #define R_SIMPLE_NO_TRIANGULATE 1 -/* #ifdef WITH_FREESTYLE */ /* line_thickness_mode */ #define R_LINE_THICKNESS_ABSOLUTE 1 #define R_LINE_THICKNESS_RELATIVE 2 -/* #endif */ /* sequencer seq_prev_type seq_rend_type */ @@ -1568,9 +1558,7 @@ typedef enum SculptFlags { #define EDGE_MODE_TAG_SHARP 2 #define EDGE_MODE_TAG_CREASE 3 #define EDGE_MODE_TAG_BEVEL 4 -/* #ifdef WITH_FREESTYLE */ #define EDGE_MODE_TAG_FREESTYLE 5 -/* #endif */ /* toolsettings->gpencil_flags */ #define GP_TOOL_FLAG_PAINTSESSIONS_ON (1<<0) diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 950483ba3ff..c70433eeea3 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -240,9 +240,7 @@ typedef struct ThemeSpace { char bone_solid[4], bone_pose[4], bone_pose_active[4]; char strip[4], strip_select[4]; char cframe[4]; -/* #ifdef WITH_FREESTYLE */ char freestyle_edge_mark[4], freestyle_face_mark[4]; -/* #endif */ char nurb_uline[4], nurb_vline[4]; char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4], lastsel_point[4]; diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt index 0632564b998..0ad52d9b3a3 100644 --- a/source/blender/makesdna/intern/CMakeLists.txt +++ b/source/blender/makesdna/intern/CMakeLists.txt @@ -34,10 +34,6 @@ blender_include_dirs( .. ) -if(WITH_FREESTYLE) - add_definitions(-DWITH_FREESTYLE) -endif() - # ----------------------------------------------------------------------------- # Build makesdna executable set(SRC diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript index 8fd5b67c44b..add9611866d 100644 --- a/source/blender/makesdna/intern/SConscript +++ b/source/blender/makesdna/intern/SConscript @@ -39,9 +39,6 @@ root_build_dir=normpath(env['BF_BUILDDIR']) source_files = ['makesdna.c'] header_files = env.Glob('../*.h') -if env['WITH_BF_FREESTYLE']: - defines.append('WITH_FREESTYLE') - makesdna_tool = env.Clone() dna = env.Clone() makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ') diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index acc6597d2c7..da1811656a6 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -134,10 +134,8 @@ static const char *includefiles[] = { "DNA_dynamicpaint_types.h", "DNA_mask_types.h", "DNA_rigidbody_types.h", -/* #ifdef WITH_FREESTYLE */ "DNA_freestyle_types.h", "DNA_linestyle_types.h", -/* #endif */ /* empty string to indicate end of includefiles */ "" @@ -1272,8 +1270,6 @@ int main(int argc, char **argv) #include "DNA_dynamicpaint_types.h" #include "DNA_mask_types.h" #include "DNA_rigidbody_types.h" -/* #ifdef WITH_FREESTYLE */ #include "DNA_freestyle_types.h" #include "DNA_linestyle_types.h" -/* #endif */ /* end of list */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index f8c49d683c3..22259d71a2f 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -243,12 +243,10 @@ extern StructRNA RNA_FluidFluidSettings; extern StructRNA RNA_FluidSettings; extern StructRNA RNA_FluidSimulationModifier; extern StructRNA RNA_FollowPathConstraint; -#ifdef WITH_FREESTYLE extern StructRNA RNA_FreestyleLineStyle; extern StructRNA RNA_FreestyleLineSet; extern StructRNA RNA_FreestyleModuleSettings; extern StructRNA RNA_FreestyleSettings; -#endif extern StructRNA RNA_Function; extern StructRNA RNA_GPencilFrame; extern StructRNA RNA_GPencilLayer; @@ -305,7 +303,6 @@ extern StructRNA RNA_LimitDistanceConstraint; extern StructRNA RNA_LimitLocationConstraint; extern StructRNA RNA_LimitRotationConstraint; extern StructRNA RNA_LimitScaleConstraint; -#ifdef WITH_FREESTYLE extern StructRNA RNA_LineStyleAlphaModifier; extern StructRNA RNA_LineStyleAlphaModifier_AlongStroke; extern StructRNA RNA_LineStyleAlphaModifier_DistanceFromCamera; @@ -337,7 +334,6 @@ extern StructRNA RNA_LineStyleThicknessModifier_Calligraphy; extern StructRNA RNA_LineStyleThicknessModifier_DistanceFromCamera; extern StructRNA RNA_LineStyleThicknessModifier_DistanceFromObject; extern StructRNA RNA_LineStyleThicknessModifier_Material; -#endif extern StructRNA RNA_LockedTrackConstraint; extern StructRNA RNA_Macro; extern StructRNA RNA_MagicTexture; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 09d08db59d7..e6ee1b7c382 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -163,12 +163,10 @@ extern EnumPropertyItem clip_editor_mode_items[]; extern EnumPropertyItem icon_items[]; extern EnumPropertyItem uilist_layout_type_items[]; -#ifdef WITH_FREESTYLE extern EnumPropertyItem linestyle_color_modifier_type_items[]; extern EnumPropertyItem linestyle_alpha_modifier_type_items[]; extern EnumPropertyItem linestyle_thickness_modifier_type_items[]; extern EnumPropertyItem linestyle_geometry_modifier_type_items[]; -#endif struct bContext; struct PointerRNA; diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 0375868915b..609592cc1cd 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -54,6 +54,7 @@ set(DEFSRC rna_key.c rna_lamp.c rna_lattice.c + rna_linestyle.c rna_main.c rna_mask.c rna_material.c @@ -93,12 +94,6 @@ set(DEFSRC rna_world.c ) -if(WITH_FREESTYLE) - list(APPEND DEFSRC - rna_linestyle.c - ) -endif() - set(APISRC rna_action_api.c rna_actuator_api.c @@ -277,9 +272,7 @@ blender_include_dirs( ) if(WITH_FREESTYLE) - blender_include_dirs( - ../../freestyle - ) + # TO BE REMOVED when the trunk merger is done add_definitions(-DWITH_FREESTYLE) endif() diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index fc520bdea2f..910cf8385f5 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -139,8 +139,8 @@ if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') if env['WITH_BF_FREESTYLE']: + # TO BE REMOVED when the trunk merger is done defs.append('WITH_FREESTYLE') - incs += ' ../../freestyle' if not env['BF_DEBUG']: defs.append('NDEBUG') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 0d5c1eb2352..6fc4ab33ad1 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3250,9 +3250,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_key.c", NULL, RNA_def_key}, {"rna_lamp.c", NULL, RNA_def_lamp}, {"rna_lattice.c", NULL, RNA_def_lattice}, -#ifdef WITH_FREESTYLE {"rna_linestyle.c", NULL, RNA_def_linestyle}, -#endif {"rna_main.c", "rna_main_api.c", RNA_def_main}, {"rna_material.c", "rna_material_api.c", RNA_def_material}, {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh}, diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 1716864f23f..0489f85a37f 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -57,9 +57,7 @@ EnumPropertyItem id_type_items[] = { {ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""}, {ID_LA, "LAMP", ICON_LAMP_DATA, "Lamp", ""}, {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""}, -#ifdef WITH_FREESTYLE {ID_LS, "LINESTYLE", ICON_PARTICLE_DATA, "FreestyleLineStyle", ""}, /* FIXME proper icon */ -#endif {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""}, {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""}, {ID_MB, "META", ICON_META_DATA, "MetaBall", ""}, @@ -135,9 +133,7 @@ short RNA_type_to_ID_code(StructRNA *type) if (RNA_struct_is_a(type, &RNA_Key)) return ID_KE; if (RNA_struct_is_a(type, &RNA_Lamp)) return ID_LA; if (RNA_struct_is_a(type, &RNA_Library)) return ID_LI; -#ifdef WITH_FREESTYLE if (RNA_struct_is_a(type, &RNA_FreestyleLineStyle)) return ID_LS; -#endif if (RNA_struct_is_a(type, &RNA_Lattice)) return ID_LT; if (RNA_struct_is_a(type, &RNA_Material)) return ID_MA; if (RNA_struct_is_a(type, &RNA_MetaBall)) return ID_MB; @@ -174,9 +170,7 @@ StructRNA *ID_code_to_RNA_type(short idcode) case ID_KE: return &RNA_Key; case ID_LA: return &RNA_Lamp; case ID_LI: return &RNA_Library; -#ifdef WITH_FREESTYLE case ID_LS: return &RNA_FreestyleLineStyle; -#endif case ID_LT: return &RNA_Lattice; case ID_MA: return &RNA_Material; case ID_MB: return &RNA_MetaBall; diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index e9bf40a58b1..6ab6b8528f9 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -396,13 +396,11 @@ static void rna_def_dopesheet(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_LAMP_DATA, 0); RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); -#ifdef WITH_FREESTYLE prop = RNA_def_property(srna, "show_linestyles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLINESTYLE); RNA_def_property_ui_text(prop, "Display Line Style", "Include visualization of Line Style related Animation data"); RNA_def_property_ui_icon(prop, ICON_BRUSH_DATA, 0); /* FIXME */ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); -#endif prop = RNA_def_property(srna, "show_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOTEX); diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 98672f2fca2..640e91adabf 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -57,9 +57,7 @@ #include "BKE_node.h" #include "BKE_sequencer.h" #include "BKE_texture.h" -#ifdef WITH_FREESTYLE -# include "BKE_linestyle.h" -#endif +#include "BKE_linestyle.h" #include "ED_node.h" @@ -188,20 +186,18 @@ static char *rna_ColorRamp_path(PointerRNA *ptr) break; } - default: - /* everything else just uses 'color_ramp' */ - path = BLI_strdup("color_ramp"); - break; - -#ifdef WITH_FREESTYLE case ID_LS: { - char *path = FRS_path_from_ID_to_color_ramp((FreestyleLineStyle *)id, (ColorBand *)ptr->data); + char *path = BKE_path_from_ID_to_color_ramp((FreestyleLineStyle *)id, (ColorBand *)ptr->data); if (path) return path; break; } -#endif + + default: + /* everything else just uses 'color_ramp' */ + path = BLI_strdup("color_ramp"); + break; } } else { @@ -273,13 +269,12 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) } break; -#ifdef WITH_FREESTYLE case ID_LS: { ListBase listbase; LinkData *link; - FRS_list_modifier_color_ramps((FreestyleLineStyle *)id, &listbase); + BKE_list_modifier_color_ramps((FreestyleLineStyle *)id, &listbase); for (link = (LinkData *)listbase.first; link; link = link->next) { RNA_pointer_create(id, &RNA_ColorRamp, link->data, &ramp_ptr); COLRAMP_GETPATH; @@ -287,7 +282,6 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) BLI_freelistN(&listbase); break; } -#endif default: /* everything else should have a "color_ramp" property */ { @@ -340,7 +334,6 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * WM_main_add_notifier(NC_TEXTURE, tex); } break; -#ifdef WITH_FREESTYLE case ID_LS: { FreestyleLineStyle *linestyle= ptr->id.data; @@ -348,7 +341,6 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * WM_main_add_notifier(NC_LINESTYLE, linestyle); break; } -#endif default: break; } diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 550a3d8f353..09ea82e5ec7 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -152,9 +152,7 @@ void RNA_def_image(struct BlenderRNA *brna); void RNA_def_key(struct BlenderRNA *brna); void RNA_def_lamp(struct BlenderRNA *brna); void RNA_def_lattice(struct BlenderRNA *brna); -#ifdef WITH_FREESTYLE void RNA_def_linestyle(struct BlenderRNA *brna); -#endif void RNA_def_main(struct BlenderRNA *brna); void RNA_def_material(struct BlenderRNA *brna); void RNA_def_mesh(struct BlenderRNA *brna); @@ -316,9 +314,7 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop); void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop); -#ifdef WITH_FREESTYLE void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop); -#endif /* ID Properties */ diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c index 06a7b4aa11b..389ec426428 100644 --- a/source/blender/makesrna/intern/rna_main.c +++ b/source/blender/makesrna/intern/rna_main.c @@ -259,13 +259,11 @@ static void rna_Main_masks_begin(CollectionPropertyIterator *iter, PointerRNA *p rna_iterator_listbase_begin(iter, &bmain->mask, NULL); } -#ifdef WITH_FREESTYLE static void rna_Main_linestyle_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { Main *bmain = (Main*)ptr->data; rna_iterator_listbase_begin(iter, &bmain->linestyle, NULL); } -#endif #ifdef UNIT_TEST @@ -331,9 +329,7 @@ void RNA_def_main(BlenderRNA *brna) {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil}, {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips}, {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks datablocks", RNA_def_main_masks}, -#ifdef WITH_FREESTYLE {"linestyles", "FreestyleLineStyle", "rna_Main_linestyle_begin", "Line Styles", "Line Style datablocks", RNA_def_main_linestyles}, -#endif {NULL, NULL, NULL, NULL, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index f5c23923f81..fb0aeffcffb 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -76,9 +76,7 @@ #include "BKE_movieclip.h" #include "BKE_mask.h" #include "BKE_gpencil.h" -#ifdef WITH_FREESTYLE -# include "BKE_linestyle.h" -#endif +#include "BKE_linestyle.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" @@ -848,10 +846,9 @@ static void rna_Main_grease_pencil_remove(Main *bmain, ReportList *reports, Poin gpd->id.name + 2, ID_REAL_USERS(gpd)); } -#ifdef WITH_FREESTYLE FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char* name) { - FreestyleLineStyle *linestyle = FRS_new_linestyle(name, bmain); + FreestyleLineStyle *linestyle = BKE_new_linestyle(name, bmain); id_us_min(&linestyle->id); return linestyle; } @@ -865,7 +862,6 @@ void rna_Main_linestyles_remove(Main *bmain, ReportList *reports, FreestyleLineS /* XXX python now has invalid pointer? */ } -#endif /* tag functions, all the same */ static void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); } @@ -898,9 +894,7 @@ static void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain- static void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); } static void rna_Main_movieclips_tag(Main *bmain, int value) { tag_main_lb(&bmain->movieclip, value); } static void rna_Main_masks_tag(Main *bmain, int value) { tag_main_lb(&bmain->mask, value); } -#ifdef WITH_FREESTYLE -void rna_Main_linestyle_tag(Main *bmain, int value) { tag_main_lb(&bmain->linestyle, value); } -#endif +static void rna_Main_linestyle_tag(Main *bmain, int value) { tag_main_lb(&bmain->linestyle, value); } static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA); } static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE); } @@ -1943,7 +1937,6 @@ void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); } -#ifdef WITH_FREESTYLE void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -1969,6 +1962,5 @@ void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop) parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "Line style to remove"); RNA_def_property_flag(parm, PROP_REQUIRED); } -#endif #endif diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index ac67a80e862..e488bedca8a 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1736,12 +1736,10 @@ static void rna_def_mpolygon(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Smooth", ""); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); -#ifdef WITH_FREESTYLE prop = RNA_def_property(srna, "use_freestyle_face_mark", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FREESTYLE_FACE); RNA_def_property_ui_text(prop, "Freestyle Face Mark", "Face mark for Freestyle feature edge detection"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); -#endif prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION); RNA_def_property_array(prop, 3); @@ -2955,7 +2953,6 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the EdgeSplit modifier"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); -#ifdef WITH_FREESTYLE prop = RNA_def_property(srna, "show_freestyle_edge_marks", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FREESTYLE_EDGE); RNA_def_property_ui_text(prop, "Draw Freestyle Edge Marks", "Display Freestyle edge marks, used with the Freestyle renderer"); @@ -2965,7 +2962,6 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FREESTYLE_FACE); RNA_def_property_ui_text(prop, "Draw Freestyle Face Marks", "Display Freestyle face marks, used with the Freestyle renderer"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); -#endif prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 0553402d111..7469aac56ad 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -32,16 +32,15 @@ #include "DNA_particle_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" +#include "DNA_linestyle_types.h" #include "DNA_userdef_types.h" #include "DNA_world_types.h" -#ifdef WITH_FREESTYLE -# include "DNA_linestyle_types.h" -#endif #include "BLI_math.h" #include "BLF_translation.h" +#include "BKE_freestyle.h" #include "BKE_tessmesh.h" #include "RNA_define.h" @@ -336,10 +335,6 @@ EnumPropertyItem image_color_depth_items[] = { #include "RE_engine.h" -#ifdef WITH_FREESTYLE -# include "FRS_freestyle.h" -#endif - static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings); @@ -1461,7 +1456,6 @@ static char *rna_ToolSettings_path(PointerRNA *ptr) return BLI_strdup("tool_settings"); } -#ifdef WITH_FREESTYLE static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr) { FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data; @@ -1481,7 +1475,7 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; - FreestyleLineSet *lineset = FRS_get_active_lineset(config); + FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset); } @@ -1497,15 +1491,14 @@ static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, in static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; - return FRS_get_active_lineset_index(config); + return BKE_freestyle_lineset_get_active_index(config); } static void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value) { FreestyleConfig *config = (FreestyleConfig *)ptr->data; - FRS_set_active_lineset_index(config, value); + BKE_freestyle_lineset_set_active_index(config, value); } -#endif #else @@ -1574,9 +1567,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""}, {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""}, {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""}, -#ifdef WITH_FREESTYLE {EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""}, -#endif {0, NULL, 0, NULL, NULL} }; @@ -2143,7 +2134,6 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); -#ifdef WITH_FREESTYLE prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS); RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer"); @@ -2151,7 +2141,6 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); else RNA_def_property_clear_flag(prop, PROP_EDITABLE); -#endif /* passes */ prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE); @@ -2373,7 +2362,6 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) else RNA_def_property_clear_flag(prop, PROP_EDITABLE); } -#ifdef WITH_FREESTYLE static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; @@ -2781,7 +2769,6 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Line Sets", ""); rna_def_freestyle_linesets(brna, prop); } -#endif static void rna_def_scene_game_recast_data(BlenderRNA *brna) { @@ -3326,9 +3313,7 @@ static void rna_def_scene_render_layer(BlenderRNA *brna) rna_def_render_layer_common(srna, 1); -#ifdef WITH_FREESTYLE /* Freestyle */ - rna_def_freestyle_settings(brna); prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE); @@ -3336,7 +3321,6 @@ static void rna_def_scene_render_layer(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "freestyleConfig"); RNA_def_property_struct_type(prop, "FreestyleSettings"); RNA_def_property_ui_text(prop, "Freestyle Settings", ""); -#endif } /* curve.splines */ @@ -3931,14 +3915,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; -#ifdef WITH_FREESTYLE static EnumPropertyItem freestyle_thickness_items[] = { {R_LINE_THICKNESS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Specify unit line thickness in pixels"}, {R_LINE_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", "Unit line thickness is scaled by the proportion of the present vertical image " "resolution to 480 pixels"}, {0, NULL, 0, NULL, NULL}}; -#endif rna_def_scene_ffmpeg_settings(brna); #ifdef WITH_QUICKTIME @@ -4184,12 +4166,10 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Edge Color", "Edge color"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); -#ifdef WITH_FREESTYLE prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS); RNA_def_property_ui_text(prop, "Edge", "Draw stylized strokes using Freestyle"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); -#endif /* threads */ prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE); @@ -4652,7 +4632,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Persistent Data", "Keep render data around for faster re-renders"); RNA_def_property_update(prop, 0, "rna_Scene_use_persistent_data_update"); -#ifdef WITH_FREESTYLE /* Freestyle line thickness options */ prop = RNA_def_property(srna, "line_thickness_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "line_thickness_mode"); @@ -4663,7 +4642,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "unit_line_thickness"); RNA_def_property_range(prop, 0.f, 10000.f); RNA_def_property_ui_text(prop, "Unit Line Thickness", "Unit line thickness in pixels"); -#endif /* Scene API */ RNA_api_scene_render(srna); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2a4a73b91c1..9e4583b84ee 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1201,12 +1201,10 @@ static void rna_def_userdef_theme_spaces_edge(StructRNA *srna) RNA_def_property_ui_text(prop, "Edge UV Face Select", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); -#ifdef WITH_FREESTYLE prop = RNA_def_property(srna, "freestyle_edge_mark", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Freestyle Edge Mark", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); -#endif } static void rna_def_userdef_theme_spaces_face(StructRNA *srna) @@ -1233,12 +1231,10 @@ static void rna_def_userdef_theme_spaces_face(StructRNA *srna) RNA_def_property_ui_text(prop, "Face Dot Size", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); -#ifdef WITH_FREESTYLE prop = RNA_def_property(srna, "freestyle_face_mark", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Freestyle Face Mark", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); -#endif } static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurbs) diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 21e7b698610..10c83d19c4b 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -47,6 +47,7 @@ #include "BKE_global.h" #include "BKE_main.h" #include "BKE_report.h" +#include "BKE_freestyle.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -57,10 +58,6 @@ #include "render_result.h" #include "render_types.h" -#ifdef WITH_FREESTYLE -# include "FRS_freestyle_config.h" -#endif - /********************************** Free *************************************/ void render_result_free(RenderResult *res) @@ -568,9 +565,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf rl->lay = (1 << 20) - 1; rl->layflag = 0x7FFF; /* solid ztra halo strand */ rl->passflag = SCE_PASS_COMBINED; -#ifdef WITH_FREESTYLE - FRS_init_freestyle_config(&srl->freestyleConfig); -#endif + BKE_freestyle_config_init(&srl->freestyleConfig); re->r.actlay = 0; } diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index a42e4438311..c823810fc75 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -239,9 +239,7 @@ typedef struct wmNotifier { #define NC_MOVIECLIP (20<<24) #define NC_MASK (21<<24) #define NC_GPENCIL (22<<24) -#ifdef WITH_FREESTYLE -# define NC_LINESTYLE (23<<24) -#endif +#define NC_LINESTYLE (23<<24) /* data type, 256 entries is enough, it can overlap */ #define NOTE_DATA 0x00FF0000 -- cgit v1.2.3