[Bf-blender-cvs] [2629cf12f5e] mesh-to-volume-modifier: remove different modes

Jacques Lucke noreply at git.blender.org
Mon Sep 28 13:18:29 CEST 2020


Commit: 2629cf12f5edd178745b20a5cc14e88c6418adc5
Author: Jacques Lucke
Date:   Mon Sep 28 12:39:04 2020 +0200
Branches: mesh-to-volume-modifier
https://developer.blender.org/rB2629cf12f5edd178745b20a5cc14e88c6418adc5

remove different modes

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

M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_mesh_to_volume.cc

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

diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 2c270a3a8c2..1c5b9ef7d89 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -2215,9 +2215,6 @@ typedef struct MeshToVolumeModifierData {
   /** This is the object that is supposed to be converted to a volume. */
   struct Object *object;
 
-  /** MeshToVolumeModifierMode */
-  int mode;
-
   /** MeshToVolumeModifierResolutionMode */
   int resolution_mode;
   /** Size of a voxel in object space. */
@@ -2230,18 +2227,12 @@ typedef struct MeshToVolumeModifierData {
    * is used. */
   char fill_volume;
   char _pad1[3];
+
   /** Bandwidths are on object space. */
   float interior_bandwidth;
   float exterior_bandwidth;
-  char _pad[4];
 } MeshToVolumeModifierData;
 
-/* MeshToVolumeModifierData->mode */
-typedef enum MeshToVolumeModifierMode {
-  MESH_TO_VOLUME_MODE_VOLUME = 0,
-  MESH_TO_VOLUME_MODE_SURFACE = 1,
-} MeshToVolumeModifierMode;
-
 /* MeshToVolumeModifierData->resolution_mode */
 typedef enum MeshToVolumeModifierResolutionMode {
   MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT = 0,
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 00e5583f9c0..d1667b429a3 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -6983,20 +6983,6 @@ static void rna_def_modifier_mesh_to_volume(BlenderRNA *brna)
   StructRNA *srna;
   PropertyRNA *prop;
 
-  static EnumPropertyItem mode_items[] = {
-      {MESH_TO_VOLUME_MODE_VOLUME,
-       "VOLUME",
-       0,
-       "Volume",
-       "Create a volume based on the volume that is enclosed by the mesh surface"},
-      {MESH_TO_VOLUME_MODE_SURFACE,
-       "SURFACE",
-       0,
-       "Surface",
-       "Create a volume based on the mesh surface"},
-      {0, NULL, 0, NULL, NULL},
-  };
-
   static EnumPropertyItem resolution_mode_items[] = {
       {MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT,
        "VOXEL_AMOUNT",
@@ -7023,11 +7009,6 @@ static void rna_def_modifier_mesh_to_volume(BlenderRNA *brna)
   RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
   RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-  prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_items(prop, mode_items);
-  RNA_def_property_ui_text(prop, "Mode", "Mode for the mesh to volume conversion");
-  RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
   prop = RNA_def_property(srna, "resolution_mode", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, resolution_mode_items);
   RNA_def_property_ui_text(
diff --git a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
index 6709d747fbd..c9ac053ca3c 100644
--- a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
+++ b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
@@ -108,13 +108,12 @@ static void initData(ModifierData *md)
 {
   MeshToVolumeModifierData *mvmd = reinterpret_cast<MeshToVolumeModifierData *>(md);
   mvmd->object = NULL;
-  mvmd->mode = MESH_TO_VOLUME_MODE_VOLUME;
   mvmd->resolution_mode = MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT;
   mvmd->voxel_size = 0.1f;
   mvmd->voxel_amount = 32;
   mvmd->fill_volume = true;
-  mvmd->interior_bandwidth = 1.0f;
-  mvmd->exterior_bandwidth = 1.0f;
+  mvmd->interior_bandwidth = 0.1f;
+  mvmd->exterior_bandwidth = 0.1f;
 }
 
 static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
@@ -151,18 +150,12 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
   uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
 
   col = uiLayoutColumn(layout, false);
-  uiItemR(col, ptr, "mode", 0, NULL, ICON_NONE);
-  if (mvmd->mode == MESH_TO_VOLUME_MODE_VOLUME) {
-    uiItemR(col, ptr, "fill_volume", 0, NULL, ICON_NONE);
-    uiItemR(col, ptr, "exterior_bandwidth", 0, NULL, ICON_NONE);
-
-    uiLayout *subcol = uiLayoutColumn(col, false);
-    uiLayoutSetEnabled(subcol, !mvmd->fill_volume);
-    uiItemR(subcol, ptr, "interior_bandwidth", 0, NULL, ICON_NONE);
-  }
-  else if (mvmd->mode == MESH_TO_VOLUME_MODE_SURFACE) {
-    uiItemR(col, ptr, "exterior_bandwidth", 0, "Bandwidth", ICON_NONE);
-  }
+  uiItemR(col, ptr, "fill_volume", 0, NULL, ICON_NONE);
+  uiItemR(col, ptr, "exterior_bandwidth", 0, NULL, ICON_NONE);
+
+  uiLayout *subcol = uiLayoutColumn(col, false);
+  uiLayoutSetEnabled(subcol, !mvmd->fill_volume);
+  uiItemR(subcol, ptr, "interior_bandwidth", 0, NULL, ICON_NONE);
 
   col = uiLayoutColumn(layout, false);
   uiItemR(col, ptr, "resolution_mode", 0, NULL, ICON_NONE);
@@ -231,25 +224,14 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo
   const float interior_bandwidth = MAX2(0.001f, mvmd->interior_bandwidth / voxel_size);
 
   openvdb::FloatGrid::Ptr new_grid;
-  if (mvmd->mode == MESH_TO_VOLUME_MODE_VOLUME) {
-    if (mvmd->fill_volume) {
-      /* Setting the interior bandwidth to FLT_MAX, will make it fill the entire volume. */
-      new_grid = openvdb::tools::meshToVolume<openvdb::FloatGrid>(
-          mesh_adapter, {}, exterior_bandwidth, FLT_MAX);
-    }
-    else {
-      new_grid = openvdb::tools::meshToVolume<openvdb::FloatGrid>(
-          mesh_adapter, {}, exterior_bandwidth, interior_bandwidth);
-    }
+  if (mvmd->fill_volume) {
+    /* Setting the interior bandwidth to FLT_MAX, will make it fill the entire volume. */
+    new_grid = openvdb::tools::meshToVolume<openvdb::FloatGrid>(
+        mesh_adapter, {}, exterior_bandwidth, FLT_MAX);
   }
   else {
-    /* Create an unsigned field, because we don't assume that the mesh is closed. */
     new_grid = openvdb::tools::meshToVolume<openvdb::FloatGrid>(
-        mesh_adapter,
-        {},
-        exterior_bandwidth,
-        exterior_bandwidth,
-        openvdb::tools::UNSIGNED_DISTANCE_FIELD);
+        mesh_adapter, {}, exterior_bandwidth, interior_bandwidth);
   }
 
   /* Create a new volume object and add the density grid. */



More information about the Bf-blender-cvs mailing list