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:
authorLukas Tönne <lukas.toenne@gmail.com>2016-03-24 13:41:44 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2016-03-24 14:07:03 +0300
commitbdae647670817f4c09d4c871314f237dde1bfaac (patch)
tree59907fb1b268a3023e43b3b4568798a5e4c3f7e2 /source/blender/editors/space_node
parent8e9a55f1e51daaadf92cd4f8236e3214b8db7c85 (diff)
Color sources for point density textures based on mesh vertices
This patch adds support for coloring point density textures based on several mesh vertex attributes. * Vertex Color: Use a vertex color layer for coloring the point density texture * Vertex Weight: Use a weights from a vertex group as intensity values. (for Blender Render engine the additional color band is used) * Vertex Normals: Use object-space vertex normals as RGB values. The vertex color source enum is stored separately from the particle color source, to avoid invalid values when switching. Note that vertex colors are technically "corner colors" (MLoop), so each vertex can have as many colors as faces it is part of. For the purpose of point density the mloop colors are simply averaged, which is physically plausible because corners can be viewed as multiple points in the same location.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/drawnode.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 1460a3a35c8..b2f3306fb62 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -961,6 +961,11 @@ static void node_shader_buts_tex_pointdensity(uiLayout *layout, bContext *UNUSED
{
bNode *node = ptr->data;
NodeShaderTexPointDensity *shader_point_density = node->storage;
+ Object *ob = (Object *)node->id;
+ PointerRNA ob_ptr, obdata_ptr;
+
+ RNA_id_pointer_create((ID *)ob, &ob_ptr);
+ RNA_id_pointer_create(ob ? (ID *)ob->data : NULL, &obdata_ptr);
uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
@@ -976,7 +981,18 @@ static void node_shader_buts_tex_pointdensity(uiLayout *layout, bContext *UNUSED
uiItemR(layout, ptr, "interpolation", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "resolution", 0, NULL, ICON_NONE);
if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
- uiItemR(layout, ptr, "color_source", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "particle_color_source", 0, NULL, ICON_NONE);
+ }
+ else {
+ uiItemR(layout, ptr, "vertex_color_source", 0, NULL, ICON_NONE);
+ if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTWEIGHT) {
+ if (ob_ptr.data)
+ uiItemPointerR(layout, ptr, "vertex_attribute_name", &ob_ptr, "vertex_groups", "", ICON_NONE);
+ }
+ if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTCOL) {
+ if (obdata_ptr.data)
+ uiItemPointerR(layout, ptr, "vertex_attribute_name", &obdata_ptr, "vertex_colors", "", ICON_NONE);
+ }
}
}