[Bf-blender-cvs] [160918d1162] soc-2020-fluid-tools: Fluid: Added color mapping and vector display options for force grids
Sriharsha Kotcharlakot
noreply at git.blender.org
Thu Jul 23 17:37:03 CEST 2020
Commit: 160918d116222502c14612cc1c71d54b233b0723
Author: Sriharsha Kotcharlakot
Date: Thu Jul 23 21:02:52 2020 +0530
Branches: soc-2020-fluid-tools
https://developer.blender.org/rB160918d116222502c14612cc1c71d54b233b0723
Fluid: Added color mapping and vector display options for force grids
===================================================================
M source/blender/gpu/intern/gpu_draw_smoke.c
M source/blender/makesdna/DNA_fluid_types.h
M source/blender/makesrna/intern/rna_fluid.c
===================================================================
diff --git a/source/blender/gpu/intern/gpu_draw_smoke.c b/source/blender/gpu/intern/gpu_draw_smoke.c
index 76158d6f2cd..878f5f5ccaf 100644
--- a/source/blender/gpu/intern/gpu_draw_smoke.c
+++ b/source/blender/gpu/intern/gpu_draw_smoke.c
@@ -312,6 +312,11 @@ static bool get_smoke_velocity_field(FluidDomainSettings *fds,
*r_velocity_y = manta_get_guide_velocity_y(fds->fluid);
*r_velocity_z = manta_get_guide_velocity_z(fds->fluid);
break;
+ case VECTOR_DRAW_GRID_FORCE:
+ *r_velocity_x = manta_get_force_x(fds->fluid);
+ *r_velocity_y = manta_get_force_y(fds->fluid);
+ *r_velocity_z = manta_get_force_z(fds->fluid);
+ break;
}
return *r_velocity_x && *r_velocity_y && *r_velocity_z;
diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h
index 645033ca8a3..c76ce110250 100644
--- a/source/blender/makesdna/DNA_fluid_types.h
+++ b/source/blender/makesdna/DNA_fluid_types.h
@@ -96,6 +96,7 @@ enum {
enum {
VECTOR_DRAW_GRID_FLUID_VELOCITY = 0,
VECTOR_DRAW_GRID_GUIDE_VELOCITY = 1,
+ VECTOR_DRAW_GRID_FORCE = 2,
};
enum {
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c
index 52110eeebef..008da0572bb 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -1086,6 +1086,27 @@ static const EnumPropertyItem *rna_Fluid_cobafield_itemf(bContext *UNUSED(C),
tmp.description = "Z component of the velocity field";
RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_X;
+ tmp.identifier = "FORCE_X";
+ tmp.icon = 0;
+ tmp.name = "X Force";
+ tmp.description = "X component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_Y;
+ tmp.identifier = "FORCE_Y";
+ tmp.icon = 0;
+ tmp.name = "Y Force";
+ tmp.description = "Y component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = FLUID_DOMAIN_FIELD_FORCE_Z;
+ tmp.identifier = "FORCE_Z";
+ tmp.icon = 0;
+ tmp.name = "Z Force";
+ tmp.description = "Z component of the force field";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
if (settings->type == FLUID_DOMAIN_TYPE_GAS) {
tmp.value = FLUID_DOMAIN_FIELD_COLOR_R;
tmp.identifier = "COLOR_R";
@@ -1329,6 +1350,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
0,
"Guide Velocity",
"Display guide velocity grid"},
+ {VECTOR_DRAW_GRID_FORCE, "FORCE", 0, "Force", "Display external forces"},
{0, NULL, 0, NULL, NULL},
};
More information about the Bf-blender-cvs
mailing list