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:
-rw-r--r--release/scripts/startup/bl_ui/properties_texture.py1
-rw-r--r--source/blender/blenkernel/intern/implicit.c38
-rw-r--r--source/blender/makesdna/DNA_texture_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_texture.c14
4 files changed, 55 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
index 675655e7035..884ef54a58d 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -773,6 +773,7 @@ class TEXTURE_PT_voxeldata(TextureButtonsPanel, Panel):
layout.prop(vd, "smoke_data_type")
elif vd.file_format == 'HAIR':
layout.prop(vd, "domain_object")
+ layout.prop(vd, "hair_data_type")
elif vd.file_format == 'IMAGE_SEQUENCE':
layout.template_ID(tex, "image", open="image.open")
layout.template_image(tex, "image", tex.image_user, compact=True)
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 0bc013efe00..27e7ac79756 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -1494,6 +1494,7 @@ bool implicit_hair_volume_get_texture_data(Object *UNUSED(ob), ClothModifierData
HairGridVert *hairgrid/*, *collgrid*/;
int numverts;
int totres, i;
+ int depth;
if (!clmd->clothObject || !clmd->clothObject->implicit)
return false;
@@ -1511,15 +1512,44 @@ bool implicit_hair_volume_get_texture_data(Object *UNUSED(ob), ClothModifierData
totres = hair_grid_size(hair_grid_res);
- vd->data_type = TEX_VD_INTENSITY;
+ if (vd->hair_type == TEX_VD_HAIRVELOCITY) {
+ depth = 4;
+ vd->data_type = TEX_VD_RGBA_PREMUL;
+ }
+ else {
+ depth = 1;
+ vd->data_type = TEX_VD_INTENSITY;
+ }
+
if (totres > 0) {
- vd->dataset = (float *)MEM_mapallocN(sizeof(float) * (totres), "hair volume texture data");
+ vd->dataset = (float *)MEM_mapallocN(sizeof(float) * depth * (totres), "hair volume texture data");
+
for (i = 0; i < totres; ++i) {
- vd->dataset[i] = hairgrid[i].density;
+ switch (vd->hair_type) {
+ case TEX_VD_HAIRDENSITY:
+ vd->dataset[i] = hairgrid[i].density;
+ break;
+
+ case TEX_VD_HAIRRESTDENSITY:
+ vd->dataset[i] = 0.0f; // TODO
+ break;
+
+ case TEX_VD_HAIRVELOCITY:
+ vd->dataset[i + 0*totres] = hairgrid[i].velocity[0];
+ vd->dataset[i + 1*totres] = hairgrid[i].velocity[1];
+ vd->dataset[i + 2*totres] = hairgrid[i].velocity[2];
+ vd->dataset[i + 3*totres] = len_v3(hairgrid[i].velocity);
+ break;
+
+ case TEX_VD_HAIRENERGY:
+ vd->dataset[i] = 0.0f; // TODO
+ break;
+ }
}
}
- else
+ else {
vd->dataset = NULL;
+ }
MEM_freeN(hairgrid);
// MEM_freeN(collgrid);
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index 4209ce8168d..78e3aeb9c0e 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -175,8 +175,8 @@ typedef struct VoxelData {
short flag;
short extend;
short smoked_type;
+ short hair_type;
short data_type;
- short pad;
int _pad;
struct Object *object; /* for rendering smoke sims */
@@ -627,6 +627,11 @@ enum {
#define TEX_VD_SMOKEVEL 2
#define TEX_VD_SMOKEFLAME 3
+#define TEX_VD_HAIRDENSITY 0
+#define TEX_VD_HAIRVELOCITY 1
+#define TEX_VD_HAIRENERGY 2
+#define TEX_VD_HAIRRESTDENSITY 3
+
/* data_type */
#define TEX_VD_INTENSITY 0
#define TEX_VD_RGBA_PREMUL 1
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 26644ba1a5d..3abe4cde2d0 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -1870,6 +1870,14 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem hair_type_items[] = {
+ {TEX_VD_HAIRDENSITY, "HAIRDENSITY", 0, "Density", "Use hair density as texture data"},
+ {TEX_VD_HAIRRESTDENSITY, "HAIRRESTDENSITY", 0, "Rest Density", "Use hair rest density as texture data"},
+ {TEX_VD_HAIRVELOCITY, "HAIRVELOCITY", 0, "Velocity", "Use hair velocity as texture data"},
+ {TEX_VD_HAIRENERGY, "HAIRENERGY", 0, "Energy", "Use potential hair energy as texture data"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "VoxelData", NULL);
RNA_def_struct_sdna(srna, "VoxelData");
RNA_def_struct_ui_text(srna, "VoxelData", "Voxel data settings");
@@ -1887,6 +1895,12 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Source", "Simulation value to be used as a texture");
RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
+ prop = RNA_def_property(srna, "hair_data_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "hair_type");
+ RNA_def_property_enum_items(prop, hair_type_items);
+ RNA_def_property_ui_text(prop, "Source", "Simulation value to be used as a texture");
+ RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
+
prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "extend");
RNA_def_property_enum_items(prop, voxeldata_extension);