[Bf-blender-cvs] [b7f085d] master: Patch D246: Texture Marks for freestyle strokes, written and contributed by Paolo Acampora.
Tamito Kajiyama
noreply at git.blender.org
Sat May 3 11:56:21 CEST 2014
Commit: b7f085d9c128f31d576c732c6439b5a71e8922ee
Author: Tamito Kajiyama
Date: Sat May 3 18:51:53 2014 +0900
https://developer.blender.org/rBb7f085d9c128f31d576c732c6439b5a71e8922ee
Patch D246: Texture Marks for freestyle strokes, written and contributed by Paolo Acampora.
Reviewers: brecht, kjym3, #freestyle
Reviewed By: brecht, kjym3
Differential Revision: https://developer.blender.org/D246
===================================================================
M release/scripts/freestyle/modules/freestyle/shaders.py
M release/scripts/freestyle/modules/parameter_editor.py
M release/scripts/startup/bl_ui/properties_freestyle.py
M release/scripts/startup/bl_ui/properties_texture.py
M source/blender/blenkernel/BKE_context.h
M source/blender/blenkernel/BKE_node.h
M source/blender/blenkernel/BKE_texture.h
M source/blender/blenkernel/intern/context.c
M source/blender/blenkernel/intern/library.c
M source/blender/blenkernel/intern/library_query.c
M source/blender/blenkernel/intern/linestyle.c
M source/blender/blenkernel/intern/node.c
M source/blender/blenkernel/intern/texture.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/versioning_defaults.c
M source/blender/blenloader/intern/writefile.c
M source/blender/editors/include/ED_buttons.h
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/render/render_shading.c
M source/blender/editors/space_buttons/buttons_context.c
M source/blender/editors/space_buttons/buttons_texture.c
M source/blender/editors/space_node/node_draw.c
M source/blender/freestyle/CMakeLists.txt
M source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
M source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h
M source/blender/freestyle/intern/python/BPy_Freestyle.cpp
M source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
A source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
A source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h
A source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
A source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h
M source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
M source/blender/freestyle/intern/stroke/BasicStrokeShaders.h
M source/blender/freestyle/intern/stroke/Stroke.cpp
M source/blender/freestyle/intern/stroke/Stroke.h
M source/blender/freestyle/intern/stroke/StrokeRep.cpp
M source/blender/freestyle/intern/stroke/StrokeRep.h
M source/blender/makesdna/DNA_linestyle_types.h
M source/blender/makesdna/DNA_space_types.h
M source/blender/makesdna/DNA_texture_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_linestyle.c
M source/blender/makesrna/intern/rna_space.c
M source/blender/nodes/texture/node_texture_tree.c
===================================================================
diff --git a/release/scripts/freestyle/modules/freestyle/shaders.py b/release/scripts/freestyle/modules/freestyle/shaders.py
index a6ff616..ca14df7 100644
--- a/release/scripts/freestyle/modules/freestyle/shaders.py
+++ b/release/scripts/freestyle/modules/freestyle/shaders.py
@@ -30,6 +30,7 @@ to be a collection of examples for shader definition in Python
from _freestyle import (
BackboneStretcherShader,
BezierCurveShader,
+ BlenderTextureShader,
CalligraphicShader,
ColorNoiseShader,
ColorVariationPatternShader,
@@ -44,6 +45,7 @@ from _freestyle import (
SmoothingShader,
SpatialNoiseShader,
StrokeTextureShader,
+ StrokeTextureStepShader,
TextureAssignerShader,
ThicknessNoiseShader,
ThicknessVariationPatternShader,
diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py
index 73ae0f4..a2109d7 100644
--- a/release/scripts/freestyle/modules/parameter_editor.py
+++ b/release/scripts/freestyle/modules/parameter_editor.py
@@ -66,12 +66,14 @@ from freestyle.predicates import (
from freestyle.shaders import (
BackboneStretcherShader,
BezierCurveShader,
+ BlenderTextureShader,
ConstantColorShader,
GuidingLinesShader,
PolygonalizationShader,
SamplingShader,
SpatialNoiseShader,
StrokeShader,
+ StrokeTextureStepShader,
TipRemoverShader,
pyBluePrintCirclesShader,
pyBluePrintEllipsesShader,
@@ -1368,6 +1370,14 @@ def process(layer_name, lineset_name):
shaders_list.append(Transform2DShader(
m.pivot, m.scale_x, m.scale_y, m.angle, m.pivot_u, m.pivot_x, m.pivot_y))
color = linestyle.color
+ if linestyle.use_texture:
+ has_tex = False
+ for slot in linestyle.texture_slots:
+ if slot is not None:
+ shaders_list.append(BlenderTextureShader(slot))
+ has_tex = True
+ if has_tex:
+ shaders_list.append(StrokeTextureStepShader(linestyle.texture_spacing))
if (not linestyle.use_chaining) or (linestyle.chaining == 'PLAIN' and linestyle.use_same_object):
thickness_position = linestyle.thickness_position
else:
diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py
index 63e4f4a..e979c03 100644
--- a/release/scripts/startup/bl_ui/properties_freestyle.py
+++ b/release/scripts/startup/bl_ui/properties_freestyle.py
@@ -674,6 +674,19 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
for modifier in linestyle.geometry_modifiers:
self.draw_geometry_modifier(context, modifier)
+ elif linestyle.panel == 'TEXTURE':
+ layout.separator()
+
+ row = layout.row()
+ row.prop(linestyle, "use_texture", text="Use Textures")
+ row.prop(linestyle, "texture_spacing", text="Spacing Along Stroke")
+
+ row = layout.row()
+ op = row.operator("wm.properties_context_change",
+ text="Go to Linestyle Textures Properties",
+ icon='TEXTURE')
+ op.context = 'TEXTURE'
+
elif linestyle.panel == 'MISC':
pass
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
index 0093094..9aa137c 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -25,6 +25,7 @@ from bpy.types import (Brush,
Material,
Object,
ParticleSettings,
+ FreestyleLineStyle,
Texture,
World)
@@ -94,6 +95,10 @@ def context_tex_datablock(context):
if idblock:
return idblock
+ idblock = context.line_style
+ if idblock:
+ return idblock
+
if context.particle_system:
idblock = context.particle_system.settings
@@ -134,6 +139,7 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel, Panel):
context.world or
context.lamp or
context.texture or
+ context.line_style or
context.particle_system or
isinstance(context.space_data.pin_id, ParticleSettings) or
context.texture_user) and
@@ -952,11 +958,28 @@ class TEXTURE_PT_mapping(TextureSlotPanel, Panel):
split.label(text="Object:")
split.prop(tex, "object", text="")
+ elif tex.texture_coords == 'ALONG_STROKE':
+ split = layout.split(percentage=0.3)
+ split.label(text="Use Tips:")
+ split.prop(tex, "use_tips", text="")
+
if isinstance(idblock, Brush):
if context.sculpt_object or context.image_paint_object:
brush_texture_settings(layout, idblock, context.sculpt_object)
else:
- if isinstance(idblock, Material):
+ if isinstance(idblock, FreestyleLineStyle):
+ split = layout.split(percentage=0.3)
+ split.label(text="Projection:")
+ split.prop(tex, "mapping", text="")
+
+ split = layout.split(percentage=0.3)
+ split.separator()
+ row = split.row()
+ row.prop(tex, "mapping_x", text="")
+ row.prop(tex, "mapping_y", text="")
+ row.prop(tex, "mapping_z", text="")
+
+ elif isinstance(idblock, Material):
split = layout.split(percentage=0.3)
split.label(text="Projection:")
split.prop(tex, "mapping", text="")
@@ -1129,6 +1152,15 @@ class TEXTURE_PT_influence(TextureSlotPanel, Panel):
factor_but(col, "use_map_kink", "kink_factor", "Kink")
factor_but(col, "use_map_rough", "rough_factor", "Rough")
+ elif isinstance(idblock, FreestyleLineStyle):
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
+ col = split.column()
+ factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
+
+
layout.separator()
if not isinstance(idblock, ParticleSettings):
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 877e376..e30c8ec 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -234,6 +234,7 @@ int ctx_data_list_count(const bContext *C, int (*func)(const bContext *, ListBas
struct Main *CTX_data_main(const bContext *C);
struct Scene *CTX_data_scene(const bContext *C);
struct ToolSettings *CTX_data_tool_settings(const bContext *C);
+struct FreestyleLineStyle *CTX_data_linestyle_from_scene(struct Scene *scene);
const char *CTX_data_mode_string(const bContext *C);
int CTX_data_mode_enum(const bContext *C);
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 1d76cab..13a32ee 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -44,6 +44,7 @@
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
+#include "DNA_linestyle_types.h"
#include "RNA_types.h"
@@ -632,6 +633,7 @@ struct NodeTreeIterStore {
Tex *tex;
Lamp *lamp;
World *world;
+ FreestyleLineStyle *linestyle;
};
void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain);
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index c136a30..4ad84dc 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -41,6 +41,7 @@ struct bNode;
struct Brush;
struct ColorBand;
struct EnvMap;
+struct FreestyleLineStyle;
struct HaloRen;
struct Lamp;
struct LampRen;
@@ -85,6 +86,7 @@ void BKE_texture_make_local(struct Tex *tex);
struct Tex *give_current_object_texture(struct Object *ob);
struct Tex *give_current_material_texture(struct Material *ma);
struct Tex *give_current_lamp_texture(struct Lamp *la);
+struct Tex *give_current_linestyle_texture(struct FreestyleLineStyle *linestyle);
struct Tex *give_current_world_texture(struct World *world);
struct Tex *give_current_brush_texture(struct Brush *br);
struct Tex *give_current_particle_texture(struct ParticleSettings *part);
@@ -98,6 +100,7 @@ void set_current_brush_texture(struct Brush *br, struct Tex *tex);
void set_current_world_texture(struct World *wo, struct Tex *tex);
void set_current_material_texture(struct Material *ma, struct Tex *tex);
void set_current_lamp_texture(struct Lamp *la, struct Tex *tex);
+void set_current_linestyle_texture(struct FreestyleLineStyle *linestyle, struct Tex *tex);
void set_current_particle_texture(struct ParticleSettings *part, struct Tex *tex);
bool has_current_material_texture(struct Material *ma);
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index f3ee5c5..89ba2e9 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -36,6 +36,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_object_types.h"
+#include "DNA_linestyle_types.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
@@ -47,6 +48,7 @@
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_screen.h"
+#include "BKE_freestyle.h"
#include "RNA_access.h"
@@ -1090,3 +1092,15 @@ int CTX_data_visible_pose_bones(const bContext *C, ListBase *list)
return ctx_data_collection_get(C, "visible_pose_bones", list);
}
+FreestyleLineStyle *CTX_data_linestyle_from_scene(Scene *scene)
+{
+ SceneRenderLayer *actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+ FreestyleConfig *config = &actsrl->freestyleConfig;
+ FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
+
+ if (lineset) {
+ return lineset->linestyle;
+ }
+
+ return NULL;
+}
diff --git
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list