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>2011-08-19 18:05:11 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-08-19 18:05:11 +0400
commit6bc5d5258f78963bdefe10a5ed9124b552d6be6c (patch)
treea415cecaec9946e69154134d6121de7f2afb0d9a /source/blender/editors
parentaece060cbff344083a4bea01c480ed891cefdd7e (diff)
Stroke geometry modifiers
Added a set of stroke geometry modifiers to the Geometry tab of line styles in the Parameter Editor mode. Now the following stroke geometry modifiers are available, each with a set of animateable parameters: - Sampling: changes the resolution of stroke backbone polylines. - Bezier Curve: replace stroke backbone with a Bezier approximation of the stroke backbone. - Sinus Displacement: add sinus displacement to stroke backbone. - Spatial Noise: add spatial noise to stroke backbone. - Perlin Noise 1D: add one-dimensional Perlin noise to stroke backbone. - Perlin Noise 2D: add two-dimensional Perlin noise to stroke backbone. - Backbone Stretcher: stretch the beginning and the end of strokes. - Tip Remover: remove a piece of stroke at the beginning and the end of strokes. To branch users: When you have a .blend file with Freestyle options specified, you may want to add a Sampling modifier with the 'sampling' value set to 5. This value specifies a resolution of polylines for line drawing in Freestyle. If no sampling modifier is specified, your line drawing will result in coarse polylines. Before geometry modifiers were introduced, this initial sampling was automatically done. Now the initial sampling is a tunable parameter that can be omitted, allowing better control on polyline resolution.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/render/render_intern.h1
-rw-r--r--source/blender/editors/render/render_ops.c1
-rw-r--r--source/blender/editors/render/render_shading.c47
3 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h
index a2167eb95ad..f2fb0f13f26 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -65,6 +65,7 @@ void SCENE_OT_freestyle_linestyle_new(struct wmOperatorType *ot);
void SCENE_OT_freestyle_color_modifier_add(struct wmOperatorType *ot);
void SCENE_OT_freestyle_alpha_modifier_add(struct wmOperatorType *ot);
void SCENE_OT_freestyle_thickness_modifier_add(struct wmOperatorType *ot);
+void SCENE_OT_freestyle_geometry_modifier_add(struct wmOperatorType *ot);
void SCENE_OT_freestyle_modifier_remove(struct wmOperatorType *ot);
void SCENE_OT_freestyle_modifier_move(struct wmOperatorType *ot);
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index 56621096303..945b452a8d2 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -74,6 +74,7 @@ void ED_operatortypes_render(void)
WM_operatortype_append(SCENE_OT_freestyle_color_modifier_add);
WM_operatortype_append(SCENE_OT_freestyle_alpha_modifier_add);
WM_operatortype_append(SCENE_OT_freestyle_thickness_modifier_add);
+ WM_operatortype_append(SCENE_OT_freestyle_geometry_modifier_add);
WM_operatortype_append(SCENE_OT_freestyle_modifier_remove);
WM_operatortype_append(SCENE_OT_freestyle_modifier_move);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index f121b23b11f..0484df56a0e 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -921,6 +921,45 @@ void SCENE_OT_freestyle_thickness_modifier_add(wmOperatorType *ot)
ot->prop= RNA_def_enum(ot->srna, "type", linestyle_thickness_modifier_type_items, 0, "Type", "");
}
+static int freestyle_geometry_modifier_add_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay);
+ FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig);
+ int type= RNA_enum_get(op->ptr, "type");
+
+ if (!lineset) {
+ BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to.");
+ return OPERATOR_CANCELLED;
+ }
+ if (FRS_add_linestyle_geometry_modifier(lineset->linestyle, type) < 0) {
+ BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type.");
+ return OPERATOR_CANCELLED;
+ }
+ WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+void SCENE_OT_freestyle_geometry_modifier_add(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Add Stroke Geometry Modifier";
+ ot->idname= "SCENE_OT_freestyle_geometry_modifier_add";
+ ot->description = "Add a stroke geometry modifier to the line style associated with the active lineset.";
+
+ /* api callbacks */
+ ot->invoke= WM_menu_invoke;
+ ot->exec= freestyle_geometry_modifier_add_exec;
+ ot->poll= freestyle_active_lineset_poll;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop= RNA_def_enum(ot->srna, "type", linestyle_geometry_modifier_type_items, 0, "Type", "");
+}
+
static int freestyle_get_modifier_type(PointerRNA *ptr)
{
if (RNA_struct_is_a(ptr->type, &RNA_LineStyleColorModifier))
@@ -929,6 +968,8 @@ static int freestyle_get_modifier_type(PointerRNA *ptr)
return LS_MODIFIER_TYPE_ALPHA;
else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleThicknessModifier))
return LS_MODIFIER_TYPE_THICKNESS;
+ else if (RNA_struct_is_a(ptr->type, &RNA_LineStyleGeometryModifier))
+ return LS_MODIFIER_TYPE_GEOMETRY;
return -1;
}
@@ -954,6 +995,9 @@ static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op)
case LS_MODIFIER_TYPE_THICKNESS:
FRS_remove_linestyle_thickness_modifier(lineset->linestyle, modifier);
break;
+ case LS_MODIFIER_TYPE_GEOMETRY:
+ FRS_remove_linestyle_geometry_modifier(lineset->linestyle, modifier);
+ break;
default:
BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier.");
return OPERATOR_CANCELLED;
@@ -1001,6 +1045,9 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op)
case LS_MODIFIER_TYPE_THICKNESS:
FRS_move_linestyle_thickness_modifier(lineset->linestyle, modifier, dir);
break;
+ case LS_MODIFIER_TYPE_GEOMETRY:
+ FRS_move_linestyle_geometry_modifier(lineset->linestyle, modifier, dir);
+ break;
default:
BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier.");
return OPERATOR_CANCELLED;