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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-10-18 13:35:29 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2014-10-18 13:35:29 +0400
commit61a330baca0ff9bb3cf477c04f539ef276a0356f (patch)
tree7c51dee268d1ac1d3dc9fb54371d3c0741316022 /source/blender
parent4b42c4bce41b139229c35781b6364cfb4125cba9 (diff)
Freestyle: Built-in SVG exporter.
Features: * Both still image and animation rendering, as well as polygon fills are supported. * The exporter creates a new SVG layer for every Freestyle line set. The different layers are correctly sorted. * SVG paths use data from line styles, so the base color of a line style becomes the color of paths, idem for dashes and stroke thickness. * Strokes can be split at invisible parts. This functionality is useful when exporting for instance dashed lines or line styles with a Blue Print shader * The exporter can be used not only in the Parameter Editor mode, but also from within style modules written for the Python Scripting mode. Acknowledgements: The author would like to thank Francesco Fantoni and Jarno Leppänen for their [[ https://github.com/hvfrancesco/freestylesvg | Freestyle SVG exporter ]]. Differential revision: https://developer.blender.org/D785 Author: flokkievids (Folkert de Vries) Reviewed by: kjym3 (Tamito Kajiyama)
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/scene.c3
-rw-r--r--source/blender/blenloader/intern/versioning_270.c13
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c1
-rw-r--r--source/blender/makesdna/DNA_scene_types.h14
-rw-r--r--source/blender/makesrna/intern/rna_scene.c36
5 files changed, 67 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 5bfd6e8a120..bec42809cd8 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -467,6 +467,9 @@ Scene *BKE_scene_add(Main *bmain, const char *name)
sce->r.posthue = 0.0;
sce->r.postsat = 1.0;
+ /* Freestyle SVG Export */
+ sce->r.svg_mode = FREESTYLE_CONTROL_SVG_FRAME;
+
sce->r.bake_mode = 1; /* prevent to include render stuff here */
sce->r.bake_filter = 16;
sce->r.bake_osa = 5;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index bd1b5f2c269..86556707e6f 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -435,4 +435,17 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
+
+ // uncomment when commiting
+ /*
+ if (!MAIN_VERSION_ATLEAST(main, 273, 0)) {
+ Scene *scene;
+
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ scene->r.svg_mode = FREESTYLE_CONTROL_SVG_FRAME;
+ }
+ }
+ */
+
+
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 1afcac313a2..cfe90fe042c 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -76,6 +76,7 @@ void BLO_update_defaults_startup_blend(Main *bmain)
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
scene->r.im_format.planes = R_IMF_PLANES_RGBA;
scene->r.im_format.compress = 15;
+ scene->r.svg_mode = FREESTYLE_CONTROL_SVG_FRAME;
for (srl = scene->r.layers.first; srl; srl = srl->next) {
srl->freestyleConfig.sphere_radius = 0.1f;
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index f8f962107f6..04a9291ba67 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -600,6 +600,11 @@ typedef struct RenderData {
int line_thickness_mode;
float unit_line_thickness; /* in pixels */
+ /* Freestyle SVG Export */
+ char svg_path[1024]; /* 1024 = FILE_MAX */
+ int svg_mode;
+ int svg_flag;
+
/* render engine */
char engine[32];
@@ -610,6 +615,15 @@ typedef struct RenderData {
int pad;
} RenderData;
+/* RenderData::svg_flag */
+#define FREESTYLE_SVG_EXPORT (1 << 0)
+#define FREESTYLE_SVG_SPLIT_AT_INVISIBLE (1 << 1)
+#define FREESTYLE_SVG_OBJECT_FILL (1 << 2)
+
+/* RenderData::svg_mode */
+#define FREESTYLE_CONTROL_SVG_FRAME 1
+#define FREESTYLE_CONTROL_SVG_ANIMATION 2
+
/* *************************************************************** */
/* Render Conversion/Simplfication Settings */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 70ce87ab68b..665779c03e9 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -4330,6 +4330,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
{R_OUTPUT_NONE, "NONE", 0, "Keep UI", "Images are rendered without forcing UI changes"},
{0, NULL, 0, NULL, NULL}
};
+
+ /* Freestyle SVG export */
+ static EnumPropertyItem freestyle_ui_svg_mode_items[] = {
+ {FREESTYLE_CONTROL_SVG_FRAME, "FRAME", 0, "Frame", "Write a single frame to the SVG file"},
+ {FREESTYLE_CONTROL_SVG_ANIMATION, "ANIMATION", 0, "Animation", "Write an animation to the SVG file"},
+ {0, NULL, 0, NULL, NULL}
+ };
/* Bake */
static EnumPropertyItem bake_mode_items[] = {
@@ -4860,6 +4867,35 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
"Note: affects indirectly rendered scenes)");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ prop = RNA_def_property(srna, "use_svg_export", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "svg_flag", FREESTYLE_SVG_EXPORT);
+ RNA_def_property_ui_text(prop, "SVG export",
+ "Export the freestyle view map to the given location");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "svg_split_at_invisible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "svg_flag", FREESTYLE_SVG_SPLIT_AT_INVISIBLE);
+ RNA_def_property_ui_text(prop, "Split at Invisible",
+ "Start a new SVG path when encountering an invisible stroke vertex");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "svg_use_object_fill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "svg_flag", FREESTYLE_SVG_OBJECT_FILL);
+ RNA_def_property_ui_text(prop, "Object Fill",
+ "Fill surface patches within contours (doesn't always work as expected)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "svg_path", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "svg_path");
+ RNA_def_property_ui_text(prop, "SVG Output Path", "Path to store the svg ouput");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "svg_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "svg_mode");
+ RNA_def_property_enum_items(prop, freestyle_ui_svg_mode_items);
+ RNA_def_property_ui_text(prop, "SVG Export Mode", "Select the SVG export mode");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
/* Bake */
prop = RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);