[Bf-blender-cvs] [ae69986] master: Viewport smoke: fix a couple of issues in the new display settings.

Kévin Dietrich noreply at git.blender.org
Sun Sep 25 17:03:20 CEST 2016


Commit: ae69986b70611f358491759f39fd91efd015dab9
Author: Kévin Dietrich
Date:   Sun Sep 25 17:02:46 2016 +0200
Branches: master
https://developer.blender.org/rBae69986b70611f358491759f39fd91efd015dab9

Viewport smoke: fix a couple of issues in the new display settings.

- WITH_SMOKE macro was not defined so some code was not compiled, though
it was still accessible from the UI
- some UI elements were disappearing due to bad indentation, also rework
the UI code to not hide but rather disable/grey out button in the UI
- Display thickness was not used due to bad manual merge of the code
from the patch.

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/editors/space_view3d/CMakeLists.txt
M	source/blender/editors/space_view3d/drawvolume.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 3cf7713..41a0194 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -373,23 +373,26 @@ class PHYSICS_PT_smoke_display_settings(PhysicButtonsPanel, Panel):
         slice_method = domain.slice_method
         axis_slice_method = domain.axis_slice_method
 
-        if slice_method == 'AXIS_ALIGNED':
-            layout.prop(domain, "axis_slice_method")
-
-            if axis_slice_method == 'SINGLE':
-                layout.prop(domain, "slice_axis")
-                layout.prop(domain, "slice_depth")
-
-        if axis_slice_method == 'FULL':
-            layout.prop(domain, "slice_per_voxel")
-
-            layout.separator()
-            layout.label(text="Debug:")
-            layout.prop(domain, "draw_velocity")
-            col = layout.column();
-            col.enabled = domain.draw_velocity
-            col.prop(domain, "vector_draw_type")
-            col.prop(domain, "vector_scale")
+        row = layout.row();
+        row.enabled = (slice_method == 'AXIS_ALIGNED')
+        row.prop(domain, "axis_slice_method")
+
+        col = layout.column();
+        col.enabled = (axis_slice_method == 'SINGLE')
+        col.prop(domain, "slice_axis")
+        col.prop(domain, "slice_depth")
+
+        row = layout.row();
+        row.enabled = (axis_slice_method == 'FULL')
+        row.prop(domain, "slice_per_voxel")
+
+        layout.separator()
+        layout.label(text="Debug:")
+        layout.prop(domain, "draw_velocity")
+        col = layout.column();
+        col.enabled = domain.draw_velocity
+        col.prop(domain, "vector_draw_type")
+        col.prop(domain, "vector_scale")
 
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index 059b384..a5c6024 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -90,6 +90,10 @@ if(WITH_FREESTYLE)
 	add_definitions(-DWITH_FREESTYLE)
 endif()
 
+if(WITH_MOD_SMOKE)
+	add_definitions(-DWITH_SMOKE)
+endif()
+
 if(WITH_LEGACY_DEPSGRAPH)
 	add_definitions(-DWITH_LEGACY_DEPSGRAPH)
 endif()
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 79d5109..d743ff9 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -382,7 +382,7 @@ static void bind_shader(SmokeDomainSettings *sds, GPUShader *shader, GPUTexture
 		GPU_shader_uniform_texture(shader, spec_location, tex_spec);
 	}
 	else {
-		float density_scale = 10.0f;
+		float density_scale = 10.0f * sds->display_thickness;
 
 		GPU_shader_uniform_vector(shader, stepsize_location, 1, 1, &sds->dx);
 		GPU_shader_uniform_vector(shader, densityscale_location, 1, 1, &density_scale);
@@ -572,6 +572,7 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
 	}
 }
 
+#ifdef WITH_SMOKE
 static void add_tri(float (*verts)[3], float(*colors)[3], int *offset,
                     float p1[3], float p2[3], float p3[3], float rgb[3])
 {
@@ -645,6 +646,7 @@ static void add_streamline(float (*verts)[3], float(*colors)[3], float center[3]
 }
 
 typedef void (*vector_draw_func)(float(*)[3], float(*)[3], float*, float*, float, float, int*);
+#endif  /* WITH_SMOKE */
 
 void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
 {
@@ -652,11 +654,6 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
 	const float *vel_x = smoke_get_velocity_x(domain->fluid);
 	const float *vel_y = smoke_get_velocity_y(domain->fluid);
 	const float *vel_z = smoke_get_velocity_z(domain->fluid);
-#else
-	const float *vel_x = NULL;
-	const float *vel_y = NULL;
-	const float *vel_z = NULL;
-#endif
 
 	if (ELEM(NULL, vel_x, vel_y, vel_z)) {
 		return;
@@ -755,6 +752,9 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
 
 	MEM_freeN(verts);
 	MEM_freeN(colors);
+#else
+	UNUSED_VARS(domain, viewnormal);
+#endif
 }
 
 #ifdef SMOKE_DEBUG_HEAT




More information about the Bf-blender-cvs mailing list