Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt13
-rw-r--r--source/blender/makesrna/intern/SConscript6
-rw-r--r--source/blender/makesrna/intern/makesrna.c3
-rw-r--r--source/blender/makesrna/intern/rna_ID.c9
-rw-r--r--source/blender/makesrna/intern/rna_action.c8
-rw-r--r--source/blender/makesrna/intern/rna_color.c38
-rw-r--r--source/blender/makesrna/intern/rna_internal.h6
-rw-r--r--source/blender/makesrna/intern/rna_linestyle.c1146
-rw-r--r--source/blender/makesrna/intern/rna_main.c11
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c53
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c33
-rw-r--r--source/blender/makesrna/intern/rna_scene.c518
-rw-r--r--source/blender/makesrna/intern/rna_space.c1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c14
14 files changed, 1859 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 210857a4690..2fb1f0bf6b4 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -93,6 +93,12 @@ 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
@@ -268,6 +274,13 @@ blender_include_dirs(
../../../../intern/smoke/extern
)
+if(WITH_FREESTYLE)
+ blender_include_dirs(
+ ../../freestyle
+ )
+ add_definitions(-DWITH_FREESTYLE)
+endif()
+
blender_include_dirs_sys(
${GLEW_INCLUDE_PATH}
)
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 33d43e1e019..e159b9fd8eb 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -38,6 +38,8 @@ root_build_dir=normpath(env['BF_BUILDDIR'])
source_files = env.Glob('*.c')
source_files.remove('rna_access.c')
+if not env['WITH_BF_FREESTYLE']:
+ source_files.remove('rna_linestyle.c')
generated_files = source_files[:]
generated_files.remove('rna_define.c')
@@ -136,6 +138,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
if env['WITH_BF_INTERNATIONAL']:
defs.append('WITH_INTERNATIONAL')
+if env['WITH_BF_FREESTYLE']:
+ 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 41b6e3e5ca6..b4bf241815d 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3245,6 +3245,9 @@ 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 184ee23b488..18281d4d251 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -56,6 +56,9 @@ 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", ""},
@@ -131,6 +134,9 @@ 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;
@@ -167,6 +173,9 @@ 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 bf6faa3f2cc..da8aa15cf2e 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -397,6 +397,14 @@ 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);
RNA_def_property_ui_text(prop, "Display Texture", "Include visualization of texture related animation data");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index c70dc285b20..f32f28e8143 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -56,6 +56,9 @@
#include "BKE_node.h"
#include "BKE_sequencer.h"
#include "BKE_texture.h"
+#ifdef WITH_FREESTYLE
+# include "BKE_linestyle.h"
+#endif
#include "ED_node.h"
@@ -188,6 +191,16 @@ static char *rna_ColorRamp_path(PointerRNA *ptr)
/* 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);
+ if (path)
+ return path;
+ break;
+ }
+#endif
}
}
else {
@@ -259,6 +272,22 @@ 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);
+ for (link = (LinkData *)listbase.first; link; link = link->next) {
+ RNA_pointer_create(id, &RNA_ColorRamp, link->data, &ramp_ptr);
+ COLRAMP_GETPATH;
+ }
+ BLI_freelistN(&listbase);
+ break;
+ }
+#endif
+
default: /* everything else should have a "color_ramp" property */
{
/* create pointer to the ID block, and try to resolve "color_ramp" pointer */
@@ -310,6 +339,15 @@ 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;
+
+ 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 76947d856f8..99dd0a860d2 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -151,6 +151,9 @@ 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);
@@ -311,6 +314,9 @@ 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_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c
new file mode 100644
index 00000000000..370b72126b8
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_linestyle.c
@@ -0,0 +1,1146 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Blender Foundation (2008).
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_linestyle.c
+ * \ingroup RNA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "rna_internal.h"
+
+#include "DNA_linestyle_types.h"
+#include "DNA_material_types.h"
+#include "DNA_texture_types.h"
+
+#include "WM_types.h"
+#include "WM_api.h"
+
+EnumPropertyItem linestyle_color_modifier_type_items[] = {
+ {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
+ {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
+ {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
+ {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem linestyle_alpha_modifier_type_items[] = {
+ {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
+ {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
+ {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
+ {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem linestyle_thickness_modifier_type_items[] = {
+ {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
+ {LS_MODIFIER_CALLIGRAPHY, "CALLIGRAPHY", ICON_MODIFIER, "Calligraphy", ""},
+ {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
+ {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
+ {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem linestyle_geometry_modifier_type_items[] = {
+ {LS_MODIFIER_2D_OFFSET, "2D_OFFSET", ICON_MODIFIER, "2D Offset", ""},
+ {LS_MODIFIER_2D_TRANSFORM, "2D_TRANSFORM", ICON_MODIFIER, "2D Transform", ""},
+ {LS_MODIFIER_BACKBONE_STRETCHER, "BACKBONE_STRETCHER", ICON_MODIFIER, "Backbone Stretcher", ""},
+ {LS_MODIFIER_BEZIER_CURVE, "BEZIER_CURVE", ICON_MODIFIER, "Bezier Curve", ""},
+ {LS_MODIFIER_BLUEPRINT, "BLUEPRINT", ICON_MODIFIER, "Blueprint", ""},
+ {LS_MODIFIER_GUIDING_LINES, "GUIDING_LINES", ICON_MODIFIER, "Guiding Lines", ""},
+ {LS_MODIFIER_PERLIN_NOISE_1D, "PERLIN_NOISE_1D", ICON_MODIFIER, "Perlin Noise 1D", ""},
+ {LS_MODIFIER_PERLIN_NOISE_2D, "PERLIN_NOISE_2D", ICON_MODIFIER, "Perlin Noise 2D", ""},
+ {LS_MODIFIER_POLYGONIZATION, "POLYGONIZATION", ICON_MODIFIER, "Polygonization", ""},
+ {LS_MODIFIER_SAMPLING, "SAMPLING", ICON_MODIFIER, "Sampling", ""},
+ {LS_MODIFIER_SINUS_DISPLACEMENT, "SINUS_DISPLACEMENT", ICON_MODIFIER, "Sinus Displacement", ""},
+ {LS_MODIFIER_SPATIAL_NOISE, "SPATIAL_NOISE", ICON_MODIFIER, "Spatial Noise", ""},
+ {LS_MODIFIER_TIP_REMOVER, "TIP_REMOVER", ICON_MODIFIER, "Tip Remover", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_linestyle.h"
+
+static StructRNA *rna_LineStyle_color_modifier_refine(struct PointerRNA *ptr)
+{
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_ALONG_STROKE:
+ return &RNA_LineStyleColorModifier_AlongStroke;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ return &RNA_LineStyleColorModifier_DistanceFromCamera;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ return &RNA_LineStyleColorModifier_DistanceFromObject;
+ case LS_MODIFIER_MATERIAL:
+ return &RNA_LineStyleColorModifier_Material;
+ default:
+ return &RNA_LineStyleColorModifier;
+ }
+}
+
+static StructRNA *rna_LineStyle_alpha_modifier_refine(struct PointerRNA *ptr)
+{
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_ALONG_STROKE:
+ return &RNA_LineStyleAlphaModifier_AlongStroke;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ return &RNA_LineStyleAlphaModifier_DistanceFromCamera;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ return &RNA_LineStyleAlphaModifier_DistanceFromObject;
+ case LS_MODIFIER_MATERIAL:
+ return &RNA_LineStyleAlphaModifier_Material;
+ default:
+ return &RNA_LineStyleAlphaModifier;
+ }
+}
+
+static StructRNA *rna_LineStyle_thickness_modifier_refine(struct PointerRNA *ptr)
+{
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_ALONG_STROKE:
+ return &RNA_LineStyleThicknessModifier_AlongStroke;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ return &RNA_LineStyleThicknessModifier_DistanceFromCamera;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ return &RNA_LineStyleThicknessModifier_DistanceFromObject;
+ case LS_MODIFIER_MATERIAL:
+ return &RNA_LineStyleThicknessModifier_Material;
+ case LS_MODIFIER_CALLIGRAPHY:
+ return &RNA_LineStyleThicknessModifier_Calligraphy;
+ default:
+ return &RNA_LineStyleThicknessModifier;
+ }
+}
+
+static StructRNA *rna_LineStyle_geometry_modifier_refine(struct PointerRNA *ptr)
+{
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_SAMPLING:
+ return &RNA_LineStyleGeometryModifier_Sampling;
+ case LS_MODIFIER_BEZIER_CURVE:
+ return &RNA_LineStyleGeometryModifier_BezierCurve;
+ case LS_MODIFIER_SINUS_DISPLACEMENT:
+ return &RNA_LineStyleGeometryModifier_SinusDisplacement;
+ case LS_MODIFIER_SPATIAL_NOISE:
+ return &RNA_LineStyleGeometryModifier_SpatialNoise;
+ case LS_MODIFIER_PERLIN_NOISE_1D:
+ return &RNA_LineStyleGeometryModifier_PerlinNoise1D;
+ case LS_MODIFIER_PERLIN_NOISE_2D:
+ return &RNA_LineStyleGeometryModifier_PerlinNoise2D;
+ case LS_MODIFIER_BACKBONE_STRETCHER:
+ return &RNA_LineStyleGeometryModifier_BackboneStretcher;
+ case LS_MODIFIER_TIP_REMOVER:
+ return &RNA_LineStyleGeometryModifier_TipRemover;
+ case LS_MODIFIER_POLYGONIZATION:
+ return &RNA_LineStyleGeometryModifier_Polygonalization;
+ case LS_MODIFIER_GUIDING_LINES:
+ return &RNA_LineStyleGeometryModifier_GuidingLines;
+ case LS_MODIFIER_BLUEPRINT:
+ return &RNA_LineStyleGeometryModifier_Blueprint;
+ case LS_MODIFIER_2D_OFFSET:
+ return &RNA_LineStyleGeometryModifier_2DOffset;
+ case LS_MODIFIER_2D_TRANSFORM:
+ return &RNA_LineStyleGeometryModifier_2DTransform;
+ default:
+ return &RNA_LineStyleGeometryModifier;
+ }
+}
+
+static char *rna_LineStyle_color_modifier_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("color_modifiers[\"%s\"]", ((LineStyleModifier *)ptr->data)->name);
+}
+
+static char *rna_LineStyle_alpha_modifier_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("alpha_modifiers[\"%s\"]", ((LineStyleModifier *)ptr->data)->name);
+}
+
+static char *rna_LineStyle_thickness_modifier_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("thickness_modifiers[\"%s\"]", ((LineStyleModifier *)ptr->data)->name);
+}
+
+static char *rna_LineStyle_geometry_modifier_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("geometry_modifiers[\"%s\"]", ((LineStyleModifier *)ptr->data)->name);
+}
+
+static void rna_LineStyleColorModifier_name_set(PointerRNA *ptr, const char *value)
+{
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->color_modifiers, m, "ColorModifier", '.',
+ offsetof(LineStyleModifier, name), sizeof(m->name));
+}
+
+static void rna_LineStyleAlphaModifier_name_set(PointerRNA *ptr, const char *value)
+{
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->alpha_modifiers, m, "AlphaModifier", '.',
+ offsetof(LineStyleModifier, name), sizeof(m->name));
+}
+
+static void rna_LineStyleThicknessModifier_name_set(PointerRNA *ptr, const char *value)
+{
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->thickness_modifiers, m, "ThicknessModifier", '.',
+ offsetof(LineStyleModifier, name), sizeof(m->name));
+}
+
+static void rna_LineStyleGeometryModifier_name_set(PointerRNA *ptr, const char *value)
+{
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->geometry_modifiers, m, "GeometryModifier", '.',
+ offsetof(LineStyleModifier, name), sizeof(m->name));
+}
+
+#else
+
+#include "BLI_math.h"
+
+static void rna_def_modifier_type_common(StructRNA *srna, EnumPropertyItem *modifier_type_items,
+ char *set_name_func, int blend, int color)
+{
+ PropertyRNA *prop;
+
+ /* TODO: Check this is not already defined somewhere else, e.g. in nodes... */
+ static EnumPropertyItem value_blend_items[] = {
+ {LS_VALUE_BLEND, "MIX", 0, "Mix", ""},
+ {LS_VALUE_ADD, "ADD", 0, "Add", ""},
+ {LS_VALUE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {LS_VALUE_MULT, "MULTIPLY", 0, "Multiply", ""},
+ {LS_VALUE_DIV, "DIVIDE", 0, "Divide", ""},
+ {LS_VALUE_DIFF, "DIFFERENCE", 0, "Divide", ""},
+ {LS_VALUE_MIN, "MININUM", 0, "Minimum", ""},
+ {LS_VALUE_MAX, "MAXIMUM", 0, "Maximum", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "modifier.type");
+ RNA_def_property_enum_items(prop, modifier_type_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Modifier Type", "Type of the modifier");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "modifier.name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, set_name_func);
+ RNA_def_property_ui_text(prop, "Modifier Name", "Name of the modifier");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ if (blend) {
+ prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "modifier.blend");
+ RNA_def_property_enum_items(prop, (color) ? ramp_blend_items : value_blend_items);
+ RNA_def_property_ui_text(prop, "Blend", "Specify how the modifier value is blended into the base value");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "modifier.influence");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Influence", "Influence factor by which the modifier changes the property");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+ }
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_ENABLED);
+ RNA_def_property_ui_text(prop, "Use", "Enable or disable this modifier during stroke rendering");
+
+ prop = RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_EXPANDED);
+ RNA_def_property_ui_text(prop, "Expanded", "True if the modifier tab is expanded");
+}
+
+static void rna_def_color_modifier(StructRNA *srna)
+{
+ rna_def_modifier_type_common(srna, linestyle_color_modifier_type_items,
+ "rna_LineStyleColorModifier_name_set", TRUE, TRUE);
+}
+
+static void rna_def_alpha_modifier(StructRNA *srna)
+{
+ rna_def_modifier_type_common(srna, linestyle_alpha_modifier_type_items,
+ "rna_LineStyleAlphaModifier_name_set", TRUE, FALSE);
+}
+
+static void rna_def_thickness_modifier(StructRNA *srna)
+{
+ rna_def_modifier_type_common(srna, linestyle_thickness_modifier_type_items,
+ "rna_LineStyleThicknessModifier_name_set", TRUE, FALSE);
+}
+
+static void rna_def_geometry_modifier(StructRNA *srna)
+{
+ rna_def_modifier_type_common(srna, linestyle_geometry_modifier_type_items,
+ "rna_LineStyleGeometryModifier_name_set", FALSE, FALSE);
+}
+
+static void rna_def_modifier_color_ramp_common(StructRNA *srna, int range)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "color_ramp");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop, "Color Ramp", "Color ramp used to change line color");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ if (range) {
+ prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "range_min");
+ RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "range_max");
+ RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+ }
+}
+
+static void rna_def_modifier_curve_common(StructRNA *srna, int range, int value)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem mapping_items[] = {
+ {0, "LINEAR", 0, "Linear", "Use linear mapping"},
+ {LS_MODIFIER_USE_CURVE, "CURVE", 0, "Curve", "Use curve mapping"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "Select the mapping type");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_INVERT);
+ RNA_def_property_ui_text(prop, "Invert", "Invert the fade-out direction of the linear mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve", "Curve used for the curve mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ if (range) {
+ prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "range_min");
+ RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "range_max");
+ RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+ }
+
+ if (value) {
+ prop = RNA_def_property(srna, "value_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "value_min");
+ RNA_def_property_ui_text(prop, "Value Min", "Minimum output value of the mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "value_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "value_max");
+ RNA_def_property_ui_text(prop, "Value Max", "Maximum output value of the mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+ }
+}
+
+static void rna_def_modifier_material_common(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem mat_attr_items[] = {
+ {LS_MODIFIER_MATERIAL_DIFF, "DIFF", 0, "Diffuse", ""},
+ {LS_MODIFIER_MATERIAL_DIFF_R, "DIFF_R", 0, "Diffuse Red", ""},
+ {LS_MODIFIER_MATERIAL_DIFF_G, "DIFF_G", 0, "Diffuse Green", ""},
+ {LS_MODIFIER_MATERIAL_DIFF_B, "DIFF_B", 0, "Diffuse Blue", ""},
+ {LS_MODIFIER_MATERIAL_SPEC, "SPEC", 0, "Specular", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_R, "SPEC_R", 0, "Specular Red", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_G, "SPEC_G", 0, "Specular Green", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_B, "SPEC_B", 0, "Specular Blue", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_HARD, "SPEC_HARD", 0, "Specular Hardness", ""},
+ {LS_MODIFIER_MATERIAL_ALPHA, "ALPHA", 0, "Alpha", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "material_attr", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mat_attr");
+ RNA_def_property_enum_items(prop, mat_attr_items);
+ RNA_def_property_ui_text(prop, "Material Attribute", "Specify which material attribute is used");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+}
+
+static void rna_def_linestyle_modifiers(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem blueprint_shape_items[] = {
+ {LS_MODIFIER_BLUEPRINT_CIRCLES, "CIRCLES", 0, "Circles", "Draw a blueprint using circular contour strokes"},
+ {LS_MODIFIER_BLUEPRINT_ELLIPSES, "ELLIPSES", 0, "Ellipses", "Draw a blueprint using elliptic contour strokes"},
+ {LS_MODIFIER_BLUEPRINT_SQUARES, "SQUARES", 0, "Squares", "Draw a blueprint using square contour strokes"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem transform_pivot_items[] = {
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER, "CENTER", 0, "Stroke Center", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_START, "START", 0, "Stroke Start", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_END, "END", 0, "Stroke End", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_PARAM, "PARAM", 0, "Stroke Point Parameter", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_ABSOLUTE, "ABSOLUTE", 0, "Absolute 2D Point", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "LineStyleModifier", NULL);
+ RNA_def_struct_ui_text(srna, "Line Style Modifier", "Base type to define modifiers");
+
+ /* line color modifiers */
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_color_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_color_modifier_path");
+ RNA_def_struct_ui_text(srna, "Line Style Color Modifier", "Base type to define line color modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_AlongStroke", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Along Stroke", "Change line color along stroke");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, FALSE);
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromCamera", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line color based on the distance from the camera");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, TRUE);
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromObject", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Distance from Object", "Change line color based on the distance from an object");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, TRUE);
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_Material", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Material", "Change line color based on a material attribute");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_material_common(srna);
+ rna_def_modifier_color_ramp_common(srna, FALSE);
+
+ prop = RNA_def_property(srna, "use_ramp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_USE_RAMP);
+ RNA_def_property_ui_text(prop, "Ramp", "Use color ramp to map the BW average into an RGB color");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ /* alpha transparency modifiers */
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_alpha_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_alpha_modifier_path");
+ RNA_def_struct_ui_text(srna, "Line Style Alpha Modifier", "Base type to define alpha transparency modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_AlongStroke", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna, "Along Stroke", "Change alpha transparency along stroke");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, FALSE, FALSE);
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromCamera", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna, "Distance from Camera",
+ "Change alpha transparency based on the distance from the camera");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, TRUE, FALSE);
+
+ srna= RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromObject", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna, "Distance from Object",
+ "Change alpha transparency based on the distance from an object");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, TRUE, FALSE);
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Material", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna, "Material", "Change alpha transparency based on a material attribute");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_material_common(srna);
+ rna_def_modifier_curve_common(srna, FALSE, FALSE);
+
+ /* line thickness modifiers */
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_thickness_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_thickness_modifier_path");
+ RNA_def_struct_ui_text(srna, "Line Style Thickness Modifier", "Base type to define line thickness modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_AlongStroke", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Along Stroke", "Change line thickness along stroke");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, FALSE, TRUE);
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromCamera", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line thickness based on the distance from the camera");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, TRUE, TRUE);
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromObject", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Distance from Object", "Change line thickness based on the distance from an object");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, TRUE, TRUE);
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Material", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Material", "Change line thickness based on a material attribute");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_material_common(srna);
+ rna_def_modifier_curve_common(srna, FALSE, TRUE);
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Calligraphy", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Calligraphy",
+ "Change line thickness so that stroke looks like made with a calligraphic pen");
+ rna_def_thickness_modifier(srna);
+
+ prop = RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "orientation");
+ RNA_def_property_ui_text(prop, "Orientation", "Angle of the main direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "min_thickness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Min Thickness",
+ "Minimum thickness in the direction perpendicular to the main direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "max_thickness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness in the main direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ /* geometry modifiers */
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_geometry_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_geometry_modifier_path");
+ RNA_def_struct_ui_text(srna, "Line Style Geometry Modifier", "Base type to define stroke geometry modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Sampling", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Sampling",
+ "Specify a new sampling value that determines the resolution of stroke polylines");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "sampling", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sampling");
+ RNA_def_property_ui_text(prop, "Sampling", "New sampling value to be used for subsequent modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_BezierCurve", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Bezier Curve",
+ "Replace stroke backbone geometry by a Bezier curve approximation of the "
+ "original backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_ui_text(prop, "Error",
+ "Maximum distance allowed between the new Bezier curve and the "
+ "original backbone geometry)");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_SinusDisplacement", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Sinus Displacement", "Add sinus displacement to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "wavelength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "wavelength");
+ RNA_def_property_ui_text(prop, "Wavelength", "Wavelength of the sinus displacement");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the sinus displacement");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "phase");
+ RNA_def_property_ui_text(prop, "Phase", "Phase of the sinus displacement");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_SpatialNoise", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Spatial Noise", "Add spatial noise to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the spatial noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_ui_text(prop, "Scale", "Scale of the spatial noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "octaves");
+ RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the spatial noise)");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_SMOOTH);
+ RNA_def_property_ui_text(prop, "Smooth", "If true, the spatial noise is smooth");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "pure_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_PURERANDOM);
+ RNA_def_property_ui_text(prop, "Pure Random", "If true, the spatial noise does not show any coherence");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise1D", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Perlin Noise 1D", "Add one-dimensional Perlin noise to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frequency");
+ RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "octaves");
+ RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Angle", "Displacement direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_ui_text(prop, "Seed",
+ "Seed for random number generation (if negative, time is used as a seed instead)");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise2D", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Perlin Noise 2D", "Add two-dimensional Perlin noise to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frequency");
+ RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "octaves");
+ RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Angle", "Displacement direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_ui_text(prop, "Seed",
+ "Seed for random number generation (if negative, time is used as a seed instead)");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_BackboneStretcher", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Backbone Stretcher", "Stretch the beginning and the end of stroke backbone");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "backbone_length");
+ RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_TipRemover", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Tip Remover",
+ "Remove a piece of stroke at the beginning and the end of stroke backbone");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "tip_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tip_length");
+ RNA_def_property_ui_text(prop, "Tip Length", "Length of tips to be removed");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Polygonalization", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Polygonalization", "Modify the stroke geometry so that it looks more 'polygonal'");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_ui_text(prop, "Error",
+ "Maximum distance between the original stroke and its polygonal approximation");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_GuidingLines", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Guiding Lines",
+ "Modify the stroke geometry so that it corresponds to its main direction line");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset",
+ "Displacement that is applied to the main direction line along its normal");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Blueprint", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Blueprint",
+ "Produce a blueprint using circular, elliptic, and square contour strokes");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, blueprint_shape_items);
+ RNA_def_property_ui_text(prop, "Shape", "Select the shape of blueprint contour strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "rounds");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in contour strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "backbone_length");
+ RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "random_radius", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_radius");
+ RNA_def_property_ui_text(prop, "Random Radius", "Randomness of the radius");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "random_center", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_center");
+ RNA_def_property_ui_text(prop, "Random Center", "Randomness of the center");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "random_backbone", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_backbone");
+ RNA_def_property_ui_text(prop, "Random Backbone", "Randomness of the backbone stretching");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_2DOffset", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "2D Offset", "Add two-dimensional offsets to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "start");
+ RNA_def_property_ui_text(prop, "Start", "Displacement that is applied from the beginning of the stroke");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "end");
+ RNA_def_property_ui_text(prop, "End", "Displacement that is applied from the end of the stroke");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_ui_text(prop, "X", "Displacement that is applied to the X coordinates of stroke vertices");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "y");
+ RNA_def_property_ui_text(prop, "Y", "Displacement that is applied to the Y coordinates of stroke vertices");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_2DTransform", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "2D Transform",
+ "Apply two-dimensional scaling and rotation to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "pivot");
+ RNA_def_property_enum_items(prop, transform_pivot_items);
+ RNA_def_property_ui_text(prop, "Pivot", "Pivot of scaling and rotation operations");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale_x");
+ RNA_def_property_ui_text(prop, "Scale X", "Scaling factor that is applied along the X axis");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale_y");
+ RNA_def_property_ui_text(prop, "Scale Y", "Scaling factor that is applied along the Y axis");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation angle");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "pivot_u", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pivot_u");
+ RNA_def_property_range(prop, 0.f, 1.f);
+ RNA_def_property_ui_text(prop, "Stroke Point Parameter",
+ "Pivot in terms of the stroke point parameter u (0 <= u <= 1)");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pivot_x");
+ RNA_def_property_ui_text(prop, "Pivot X", "2D X coordinate of the absolute pivot");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pivot_y");
+ RNA_def_property_ui_text(prop, "Pivot Y", "2D Y coordinate of the absolute pivot");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+}
+
+static void rna_def_linestyle(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem panel_items[] = {
+ {LS_PANEL_STROKES, "STROKES", 0, "Strokes", "Show the panel for stroke construction"},
+ {LS_PANEL_COLOR, "COLOR", 0, "Color", "Show the panel for line color options"},
+ {LS_PANEL_ALPHA, "ALPHA", 0, "Alpha", "Show the panel for alpha transparency options"},
+ {LS_PANEL_THICKNESS, "THICKNESS", 0, "Thickness", "Show the panel for line thickness options"},
+ {LS_PANEL_GEOMETRY, "GEOMETRY", 0, "Geometry", "Show the panel for stroke geometry options"},
+#if 0 /* hidden for now */
+ {LS_PANEL_MISC, "MISC", 0, "Misc", "Show the panel for miscellaneous options"},
+#endif
+ {0, NULL, 0, NULL, NULL}
+ };
+ static EnumPropertyItem chaining_items[] = {
+ {LS_CHAINING_PLAIN, "PLAIN", 0, "Plain", "Plain chaining"},
+ {LS_CHAINING_SKETCHY, "SKETCHY", 0, "Sketchy", "Sketchy chaining with a multiple touch"},
+ {0, NULL, 0, NULL, NULL}
+ };
+ static EnumPropertyItem cap_items[] = {
+ {LS_CAPS_BUTT, "BUTT", 0, "Butt", "Butt cap (flat)"},
+ {LS_CAPS_ROUND, "ROUND", 0, "Round", "Round cap (half-circle)"},
+ {LS_CAPS_SQUARE, "SQUARE", 0, "Square", "Square cap (flat and extended)"},
+ {0, NULL, 0, NULL, NULL}
+ };
+ static EnumPropertyItem thickness_position_items[] = {
+ {LS_THICKNESS_CENTER, "CENTER", 0, "Center", "Stroke is centered along stroke geometry"},
+ {LS_THICKNESS_INSIDE, "INSIDE", 0, "Inside", "Stroke is drawn inside stroke geometry"},
+ {LS_THICKNESS_OUTSIDE, "OUTSIDE", 0, "Outside", "Stroke is drawn outside stroke geometry"},
+ {LS_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", "Stroke thinkness is split by a user-defined ratio"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "FreestyleLineStyle", "ID");
+ RNA_def_struct_ui_text(srna, "Freestyle Line Style", "Freestyle line style, reusable by multiple line sets");
+ RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA); /* FIXME: use a proper icon */
+
+ prop = RNA_def_property(srna, "panel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "panel");
+ RNA_def_property_enum_items(prop, panel_items);
+ RNA_def_property_ui_text(prop, "Panel", "Select the property panel to be shown");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "r");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Base line color, possibly modified by line color modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Alpha",
+ "Base alpha transparency, possibly modified by alpha transparency modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Thickness", "Base line thickness, possibly modified by line thickness modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "thickness_position", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "thickness_position");
+ RNA_def_property_enum_items(prop, thickness_position_items);
+ RNA_def_property_ui_text(prop, "Thickness Position", "Select the position of stroke thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "thickness_ratio", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "thickness_ratio");
+ RNA_def_property_range(prop, 0.f, 1.f);
+ RNA_def_property_ui_text(prop, "Thickness Ratio",
+ "A number between 0 (inside) and 1 (outside) specifying the relative position of "
+ "stroke thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "color_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "color_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleColorModifier");
+ RNA_def_property_ui_text(prop, "Color Modifiers", "List of line color modifiers");
+
+ prop = RNA_def_property(srna, "alpha_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "alpha_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleAlphaModifier");
+ RNA_def_property_ui_text(prop, "Alpha Modifiers", "List of alpha trancparency modifiers");
+
+ prop = RNA_def_property(srna, "thickness_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "thickness_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleThicknessModifier");
+ RNA_def_property_ui_text(prop, "Thickness Modifiers", "List of line thickness modifiers");
+
+ prop = RNA_def_property(srna, "use_chaining", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LS_NO_CHAINING);
+ RNA_def_property_ui_text(prop, "Chaining", "Enable chaining of feature edges");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "chaining", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "chaining");
+ RNA_def_property_enum_items(prop, chaining_items);
+ RNA_def_property_ui_text(prop, "Chaining", "Select the way how feature edges are jointed to form chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "rounds");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in a sketchy multiple touch");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "geometry_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "geometry_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleGeometryModifier");
+ RNA_def_property_ui_text(prop, "Geometry Modifiers", "List of stroke geometry modifiers");
+
+ prop = RNA_def_property(srna, "same_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SAME_OBJECT);
+ RNA_def_property_ui_text(prop, "Same Object", "If true, only feature edges of the same object are joined");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "use_split_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_LENGTH);
+ RNA_def_property_ui_text(prop, "Use Split Length", "Enable chain splitting by curvilinear 2D length");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "split_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "split_length");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Split Length", "Curvilinear 2D length for chain splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "use_min_angle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_ANGLE);
+ RNA_def_property_ui_text(prop, "Use Min 2D Angle",
+ "Split chains at points with angles smaller than the minimum 2D angle");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "min_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "min_angle");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Min 2D Angle", "Minimum 2D angle for splitting chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "use_max_angle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_ANGLE);
+ RNA_def_property_ui_text(prop, "Use Max 2D Angle",
+ "Split chains at points with angles larger than the maximum 2D angle");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "max_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "max_angle");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Max 2D Angle", "Maximum 2D angle for splitting chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "use_min_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_LENGTH);
+ RNA_def_property_ui_text(prop, "Use Min 2D Length", "Enable the selection of chains by a minimum 2D length");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "min_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_length");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Min 2D Length", "Minimum curvilinear 2D length for the selection of chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "use_max_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_LENGTH);
+ RNA_def_property_ui_text(prop, "Use Max 2D Length", "Enable the selection of chains by a maximum 2D length");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "max_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_length");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum curvilinear 2D length for the selection of chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "use_split_pattern", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_PATTERN);
+ RNA_def_property_ui_text(prop, "Use Split Pattern", "Enable chain splitting by dashed line patterns");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "split_dash1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_dash1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Dash 1", "Length of the 1st dash for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "split_gap1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_gap1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Gap 1", "Length of the 1st gap for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "split_dash2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_dash2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Dash 2", "Length of the 2nd dash for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "split_gap2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_gap2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Gap 2", "Length of the 2nd gap for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "split_dash3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_dash3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Dash 3", "Length of the 3rd dash for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "split_gap3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_gap3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Gap 3", "Length of the 3rd gap for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "material_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MATERIAL_BOUNDARY);
+ RNA_def_property_ui_text(prop, "Material Boundary", "If true, chains of feature edges are split at material boundaries");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "use_dashed_line", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_DASHED_LINE);
+ RNA_def_property_ui_text(prop, "Dashed Line", "Enable or disable dashed line");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "caps", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "caps");
+ RNA_def_property_enum_items(prop, cap_items);
+ RNA_def_property_ui_text(prop, "Cap", "Select the shape of both ends of strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "dash1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "dash1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Dash 1", "Length of the 1st dash for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "gap1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "gap1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Gap 1", "Length of the 1st gap for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "dash2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "dash2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Dash 2", "Length of the 2nd dash for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "gap2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "gap2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Gap 2", "Length of the 2nd gap for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "dash3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "dash3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Dash 3", "Length of the 3rd dash for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+
+ prop = RNA_def_property(srna, "gap3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "gap3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Gap 3", "Length of the 3rd gap for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+}
+
+void RNA_def_linestyle(BlenderRNA *brna)
+{
+ rna_def_linestyle_modifiers(brna);
+ rna_def_linestyle(brna);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 04b8d2fa3df..32db099c0c0 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -258,6 +258,14 @@ 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
static PointerRNA rna_Test_test_get(PointerRNA *ptr)
@@ -322,6 +330,9 @@ 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 e9ed3aa8682..6d182ed17f0 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -72,6 +72,9 @@
#include "BKE_movieclip.h"
#include "BKE_mask.h"
#include "BKE_gpencil.h"
+#ifdef WITH_FREESTYLE
+# include "BKE_linestyle.h"
+#endif
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
@@ -634,6 +637,25 @@ 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);
+ id_us_min(&linestyle->id);
+ return linestyle;
+}
+
+void rna_Main_linestyles_remove(Main *bmain, ReportList *reports, FreestyleLineStyle *linestyle)
+{
+ if(ID_REAL_USERS(linestyle) <= 0)
+ BKE_libblock_free(&bmain->linestyle, linestyle);
+ else
+ BKE_reportf(reports, RPT_ERROR, "Line style '%s' must have zero users to be removed, found %d", linestyle->id.name+2, ID_REAL_USERS(linestyle));
+
+ /* 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); }
static void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); }
@@ -665,6 +687,9 @@ 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 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); }
@@ -1686,4 +1711,32 @@ 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;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataLineStyles");
+ srna = RNA_def_struct(brna, "BlendDataLineStyles", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Line Styles", "Collection of line styles");
+
+ func = RNA_def_function(srna, "new", "rna_Main_linestyles_new");
+ RNA_def_function_ui_description(func, "Add a new line style instance to the main database");
+ parm = RNA_def_string(func, "name", "FreestyleLineStyle", 0, "", "New name for the datablock");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "New line style datablock");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_linestyles_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a line style instance from the current blendfile");
+ 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 025279b3836..60625cb0e0b 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1570,6 +1570,13 @@ static void rna_def_medge(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Sharp", "Sharp edge for the EdgeSplit modifier");
RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+#ifdef WITH_FREESTYLE
+ prop = RNA_def_property(srna, "use_freestyle_edge_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FREESTYLE_EDGE);
+ RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "Edge mark for Freestyle feature edge detection");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+#endif
+
prop = RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_LOOSEEDGE);
RNA_def_property_ui_text(prop, "Loose", "Loose edge");
@@ -1625,6 +1632,13 @@ static void rna_def_mface(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH);
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);
@@ -1723,6 +1737,13 @@ 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);
RNA_def_property_range(prop, -1.0f, 1.0f);
@@ -2935,6 +2956,18 @@ 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");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+ prop = RNA_def_property(srna, "show_freestyle_face_marks", PROP_BOOLEAN, PROP_NONE);
+ 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);
RNA_def_property_ui_text(prop, "Edge Length",
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 7304f7c9a49..96bd0fb327e 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -39,6 +39,9 @@
#include "DNA_scene_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"
@@ -333,6 +336,10 @@ 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);
@@ -1460,6 +1467,52 @@ 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;
+
+ return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
+}
+
+static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
+{
+ FreestyleLineSet *lineset = (FreestyleLineSet*)ptr->data;
+
+ lineset->linestyle->id.us--;
+ lineset->linestyle = (FreestyleLineStyle *)value.data;
+ lineset->linestyle->id.us++;
+}
+
+static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
+{
+ FreestyleConfig *config = (FreestyleConfig *)ptr->data;
+ FreestyleLineSet *lineset = FRS_get_active_lineset(config);
+ return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
+}
+
+static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, int *min, int *max,
+ int *softmin, int *softmax)
+{
+ FreestyleConfig *config = (FreestyleConfig *)ptr->data;
+
+ *min = 0;
+ *max = max_ii(0, BLI_countlist(&config->linesets) - 1);
+}
+
+static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
+{
+ FreestyleConfig *config = (FreestyleConfig *)ptr->data;
+ return FRS_get_active_lineset_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);
+}
+#endif
+
#else
static void rna_def_transform_orientation(BlenderRNA *brna)
@@ -1527,6 +1580,9 @@ 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}
};
@@ -2078,6 +2134,16 @@ 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");
+ if (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);
RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
@@ -2298,6 +2364,416 @@ 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;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "Linesets");
+ srna = RNA_def_struct(brna, "Linesets", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleSettings");
+ RNA_def_struct_ui_text(srna, "Line Sets", "Line sets for associating lines and style parameters");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FreestyleLineSet");
+ RNA_def_property_pointer_funcs(prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_FreestyleSettings_active_lineset_index_get",
+ "rna_FreestyleSettings_active_lineset_index_set",
+ "rna_FreestyleSettings_active_lineset_index_range");
+ RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+}
+
+static void rna_def_freestyle_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem edge_type_negation_items[] = {
+ {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions"},
+ {FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive",
+ "Select feature edges not satisfying the given edge type conditions"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem edge_type_combination_items[] = {
+ {0, "OR", 0, "Logical OR", "Combine feature edge type conditions by logical OR (logical disjunction)"},
+ {FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND",
+ "Combine feature edge type conditions by logical AND (logical conjunction)"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem group_negation_items[] = {
+ {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges belonging to some object in the group"},
+ {FREESTYLE_LINESET_GR_NOT, "EXCLUSIVE", 0, "Exclusive",
+ "Select feature edges not belonging to any object in the group"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem face_mark_negation_items[] = {
+ {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given face mark conditions"},
+ {FREESTYLE_LINESET_FM_NOT, "EXCLUSIVE", 0, "Exclusive",
+ "Select feature edges not satisfying the given face mark conditions"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem face_mark_condition_items[] = {
+ {0, "ONE", 0, "One Face", "Select feature edges if one of faces on the right and left has a face mark"},
+ {FREESTYLE_LINESET_FM_BOTH, "BOTH", 0, "Both Faces",
+ "Select feature edges if both faces on the right and left faces have a face mark"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem freestyle_ui_mode_items[] = {
+ {FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode",
+ "Advanced mode for using style modules in Python"},
+ {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode",
+ "Basic mode for interactive style parameter editing"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem visibility_items[] ={
+ {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
+ {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
+ {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range",
+ "Select feature edges within a range of quantitative invisibility (QI) values"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem freestyle_raycasting_algorithm_items[] = {
+ {FREESTYLE_ALGO_REGULAR, "REGULAR", 0, "Normal Ray Casting", "Consider all FEdges in each ViewEdge"},
+ {FREESTYLE_ALGO_FAST, "FAST", 0, "Fast Ray Casting", "Sample some FEdges in each ViewEdge"},
+ {FREESTYLE_ALGO_VERYFAST, "VERYFAST", 0, "Very Fast Ray Casting",
+ "Sample one FEdge in each ViewEdge; do not save list of occluders"},
+ {FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL, "CULLEDADAPTIVETRADITIONAL", 0,
+ "Culled Traditional Visibility Detection",
+ "Culled adaptive grid with heuristic density and "
+ "traditional QI calculation"},
+ {FREESTYLE_ALGO_ADAPTIVE_TRADITIONAL, "ADAPTIVETRADITIONAL", 0, "Unculled Traditional Visibility Detection",
+ "Adaptive grid with heuristic density and traditional QI calculation"},
+ {FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE, "CULLEDADAPTIVECUMULATIVE", 0,
+ "Culled Cumulative Visibility Detection",
+ "Culled adaptive grid with heuristic density and "
+ "cumulative QI calculation"},
+ {FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE, "ADAPTIVECUMULATIVE", 0, "Unculled Cumulative Visibility Detection",
+ "Adaptive grid with heuristic density and cumulative QI calculation"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+
+ /* FreestyleLineSet */
+
+ srna = RNA_def_struct(brna, "FreestyleLineSet", NULL);
+ RNA_def_struct_ui_text(srna, "Freestyle Line Set", "Line set for associating lines and style parameters");
+
+ /* access to line style settings is redirected through functions
+ * to allow proper id-buttons functionality
+ */
+ prop = RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FreestyleLineStyle");
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_FreestyleLineSet_linestyle_get",
+ "rna_FreestyleLineSet_linestyle_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
+ RNA_def_property_ui_text(prop, "Use", "Enable or disable this line set during stroke rendering");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
+ RNA_def_property_ui_text(prop, "Selection by Visibility", "Select feature edges based on visibility");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
+ RNA_def_property_ui_text(prop, "Selection by Edge Types", "Select feature edges based on edge types");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_by_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_GROUP);
+ RNA_def_property_ui_text(prop, "Selection by Group", "Select feature edges based on a group of objects");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_by_image_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_IMAGE_BORDER);
+ RNA_def_property_ui_text(prop, "Selection by Image Border",
+ "Select feature edges by image border (less memory consumption)");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_by_face_marks", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_FACE_MARK);
+ RNA_def_property_ui_text(prop, "Selection by Face Marks", "Select feature edges by face marks");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, edge_type_negation_items);
+ RNA_def_property_ui_text(prop, "Edge Type Negation",
+ "Set the negation operation for conditions on feature edge types");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, edge_type_combination_items);
+ RNA_def_property_ui_text(prop, "Edge Type Combination",
+ "Set the combination operation for conditions on feature edge types");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "group");
+ RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Group", "A group of objects based on which feature edges are selected");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "group_negation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, group_negation_items);
+ RNA_def_property_ui_text(prop, "Group Negation",
+ "Set the negation operation for conditions on feature edge types");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, face_mark_negation_items);
+ RNA_def_property_ui_text(prop, "Face Mark Negation",
+ "Set the negation operation for the condition on face marks");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, face_mark_condition_items);
+ RNA_def_property_ui_text(prop, "Face Mark Condition", "Set a feature edge selection condition on face marks");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
+ RNA_def_property_ui_text(prop, "Silhouette", "Select silhouette edges");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
+ RNA_def_property_ui_text(prop, "Border", "Select border edges");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
+ RNA_def_property_ui_text(prop, "Crease", "Select crease edges");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY);
+ RNA_def_property_ui_text(prop, "Ridge & Valley", "Select ridges and valleys");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
+ RNA_def_property_ui_text(prop, "Suggestive Contour", "Select suggestive contours");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
+ RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
+ RNA_def_property_ui_text(prop, "Contour", "Select contours");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
+ RNA_def_property_ui_text(prop, "External Contour", "Select external contours");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EDGE_MARK);
+ RNA_def_property_ui_text(prop, "Edge Mark", "Select edge marks");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_silhouette", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SILHOUETTE);
+ RNA_def_property_ui_text(prop, "Silhouette", "Exclude silhouette edges");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_BORDER);
+ RNA_def_property_ui_text(prop, "Border", "Exclude border edges");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_crease", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CREASE);
+ RNA_def_property_ui_text(prop, "Crease", "Exclude crease edges");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_ridge_valley", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_RIDGE_VALLEY);
+ RNA_def_property_ui_text(prop, "Ridge & Valley", "Exclude ridges and valleys");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
+ RNA_def_property_ui_text(prop, "Suggestive Contour", "Exclude suggestive contours");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_material_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
+ RNA_def_property_ui_text(prop, "Material Boundary", "Exclude edges at material boundaries");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CONTOUR);
+ RNA_def_property_ui_text(prop, "Contour", "Exclude contours");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_external_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
+ RNA_def_property_ui_text(prop, "External Contour", "Exclude external contours");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "exclude_edge_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EDGE_MARK);
+ RNA_def_property_ui_text(prop, "Edge Mark", "Exclude edge marks");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "qi");
+ RNA_def_property_enum_items(prop, visibility_items);
+ RNA_def_property_ui_text(prop, "Visibility", "Determine how to use visibility for feature edge selection");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "qi_start");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "qi_end");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ /* FreestyleModuleSettings */
+
+ srna = RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
+ RNA_def_struct_ui_text(srna, "Freestyle Module", "Style module configuration for specifying a style module");
+
+ prop = RNA_def_property(srna, "module_path", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "module_path");
+ RNA_def_property_ui_text(prop, "Module Path", "Path to a style module file");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
+ RNA_def_property_ui_text(prop, "Use", "Enable or disable this style module during stroke rendering");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ /* FreestyleSettings */
+
+ srna = RNA_def_struct(brna, "FreestyleSettings", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleConfig");
+ RNA_def_struct_nested(brna, srna, "SceneRenderLayer");
+ RNA_def_struct_ui_text(srna, "Frestyle Settings", "Freestyle settings for a SceneRenderLayer datablock");
+
+ prop = RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
+ RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
+ RNA_def_property_ui_text(prop, "Style modules", "A list of style modules (to be applied from top to bottom)");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
+ RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "raycasting_algorithm", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "raycasting_algorithm");
+ RNA_def_property_enum_items(prop, freestyle_raycasting_algorithm_items);
+ RNA_def_property_ui_text(prop, "Raycasting Algorithm", "Select the Freestyle raycasting algorithm");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING);
+ RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
+ RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use_ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
+ RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use_material_boundaries", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
+ RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use_smoothness", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_FACE_SMOOTHNESS_FLAG);
+ RNA_def_property_ui_text(prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
+ RNA_def_property_ui_text(prop, "Advanced Edge Detection Options",
+ "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "kr_derivative_epsilon", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
+ RNA_def_property_range(prop, -1000.0, 1000.0);
+ RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "crease_angle");
+ RNA_def_property_range(prop, 0.0, DEG2RAD(180.0));
+ RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold for detecting crease edges");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
+ RNA_def_property_struct_type(prop, "FreestyleLineSet");
+ 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)
{
StructRNA *srna;
@@ -2834,6 +3310,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
static void rna_def_scene_render_layer(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
srna = RNA_def_struct(brna, "SceneRenderLayer", NULL);
RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer");
@@ -2841,6 +3318,18 @@ static void rna_def_scene_render_layer(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_SceneRenderLayer_path");
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);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ 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 */
@@ -3434,6 +3923,15 @@ 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
rna_def_scene_quicktime_settings(brna);
@@ -3678,6 +4176,13 @@ 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);
RNA_def_property_int_sdna(prop, NULL, "threads");
@@ -4133,6 +4638,19 @@ 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");
+ RNA_def_property_enum_items(prop, freestyle_thickness_items);
+ RNA_def_property_ui_text(prop, "Line Thickness Mode", "Line thickness mode for Freestyle line drawing");
+
+ prop = RNA_def_property(srna, "unit_line_thickness", PROP_FLOAT, PROP_NONE);
+ 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_space.c b/source/blender/makesrna/intern/rna_space.c
index 09969ddc7e5..cccdf3258d2 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1986,6 +1986,7 @@ static void rna_def_space_buttons(BlenderRNA *brna)
static EnumPropertyItem buttons_context_items[] = {
{BCONTEXT_SCENE, "SCENE", ICON_SCENE, "Scene", "Scene"},
{BCONTEXT_RENDER, "RENDER", ICON_SCENE_DATA, "Render", "Render"},
+ {BCONTEXT_RENDER_LAYER, "RENDER_LAYER", ICON_RENDERLAYERS, "Render Layers", "Render Layers"},
{BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
{BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
{BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Constraints"},
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 0def5988315..8ebf83532de 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -1194,6 +1194,13 @@ static void rna_def_userdef_theme_spaces_edge(StructRNA *srna)
RNA_def_property_array(prop, 3);
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)
@@ -1219,6 +1226,13 @@ static void rna_def_userdef_theme_spaces_face(StructRNA *srna)
RNA_def_property_range(prop, 1, 10);
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)