diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-01-24 20:15:15 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-01-24 20:15:15 +0300 |
commit | f08f92a04dac7213d7f55eb1e5d6d245ae522f03 (patch) | |
tree | bd9c5afc98b461378d048e6b2aa5294ea98c06ec | |
parent | be691105c2adcd2bdc64aa7646cfe3fab8cb6fb7 (diff) | |
parent | 5186bb56b583dc9a84b5cb9e9dd22bec269a28c3 (diff) |
Merge branch 'blender-v2.82-release'
-rw-r--r-- | intern/mantaflow/intern/MANTA_main.cpp | 2 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/fluid_script.h | 3 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/liquid_script.h | 10 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/smoke_script.h | 8 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_fluid.py | 16 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 25 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_mask_extract.c | 4 |
7 files changed, 46 insertions, 22 deletions
diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index 024c562e64c..7f6ff9094c6 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -934,6 +934,8 @@ std::string MANTA::getRealValue(const std::string &varName, FluidModifierData *m ss << mmd->domain->gravity[2]; else if (varName == "CACHE_DIR") ss << mmd->domain->cache_directory; + else if (varName == "CACHE_RESUMABLE") + ss << (mmd->domain->cache_type == FLUID_DOMAIN_CACHE_FINAL ? "False" : "True"); else if (varName == "USING_ADAPTIVETIME") ss << (mmd->domain->flags & FLUID_DOMAIN_USE_ADAPTIVE_TIME ? "True" : "False"); else if (varName == "USING_SPEEDVECTORS") diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h index 436bc037a92..f66f2fadcb1 100644 --- a/intern/mantaflow/intern/strings/fluid_script.h +++ b/intern/mantaflow/intern/strings/fluid_script.h @@ -693,6 +693,7 @@ if (GUI):\n\ gui.pause()\n\ \n\ cache_dir = '$CACHE_DIR$'\n\ +cache_resumable = $CACHE_RESUMABLE$\n\ file_format_data = '.uni'\n\ file_format_noise = '.uni'\n\ file_format_particles = '.uni'\n\ @@ -710,7 +711,7 @@ while current_frame <= end_frame:\n\ \n\ # Load already simulated data from cache:\n\ if loop_cnt < from_cache_cnt:\n\ - load(current_frame)\n\ + load(current_frame, cache_resumable)\n\ \n\ # Otherwise simulate new data\n\ else:\n\ diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index df0a5254fe2..6cbbf06f0d2 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -438,13 +438,11 @@ def liquid_save_particles_$ID$(path, framenr, file_format, resumable):\n\ const std::string liquid_standalone = "\n\ # Helper function to call cache load functions\n\ -def load(frame):\n\ - fluid_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data)\n\ - liquid_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data)\n\ - liquid_load_flip_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_particles)\n\ +def load(frame, cache_resumable):\n\ + fluid_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data, cache_resumable)\n\ + liquid_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data, cache_resumable)\n\ if using_sndparts_s$ID$:\n\ - fluid_load_particles_$ID$(os.path.join(cache_dir, 'particles'), frame, file_format_particles)\n\ - liquid_load_particles_$ID$(os.path.join(cache_dir, 'particles'), frame, file_format_particles)\n\ + liquid_load_particles_$ID$(os.path.join(cache_dir, 'particles'), frame, file_format_particles, cache_resumable)\n\ if using_mesh_s$ID$:\n\ liquid_load_mesh_$ID$(os.path.join(cache_dir, 'mesh'), frame, file_format_mesh)\n\ if using_guiding_s$ID$:\n\ diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index e77074f35cb..9277923fa7a 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -584,11 +584,11 @@ def smoke_save_noise_$ID$(path, framenr, file_format, resumable):\n\ const std::string smoke_standalone = "\n\ # Helper function to call cache load functions\n\ -def load(frame):\n\ - fluid_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data)\n\ - smoke_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data)\n\ +def load(frame, cache_resumable):\n\ + fluid_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data, cache_resumable)\n\ + smoke_load_data_$ID$(os.path.join(cache_dir, 'data'), frame, file_format_data, cache_resumable)\n\ if using_noise_s$ID$:\n\ - smoke_load_noise_$ID$(os.path.join(cache_dir, 'noise'), frame, file_format_noise)\n\ + smoke_load_noise_$ID$(os.path.join(cache_dir, 'noise'), frame, file_format_noise, cache_resumable)\n\ if using_guiding_s$ID$:\n\ fluid_load_guiding_$ID$(os.path.join(cache_dir, 'guiding'), frame, file_format_data)\n\ \n\ diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 6252ba3bb74..c1b8ae1a36a 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -95,6 +95,16 @@ class PhysicButtonsPanel: md = context.fluid return md and (md.fluid_type == 'FLOW') + @staticmethod + def poll_fluid_flow_outflow(context): + if not PhysicButtonsPanel.poll_fluid_flow(context): + return False + + md = context.fluid + flow = md.flow_settings + if (flow.flow_behavior == 'OUTFLOW'): + return True + class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel): bl_label = "Fluid" @@ -507,6 +517,9 @@ class PHYSICS_PT_flow_initial_velocity(PhysicButtonsPanel, Panel): if not PhysicButtonsPanel.poll_fluid_flow(context): return False + if PhysicButtonsPanel.poll_fluid_flow_outflow(context): + return False + return (context.engine in cls.COMPAT_ENGINES) def draw_header(self, context): @@ -546,6 +559,9 @@ class PHYSICS_PT_flow_texture(PhysicButtonsPanel, Panel): if not PhysicButtonsPanel.poll_fluid_flow(context): return False + if PhysicButtonsPanel.poll_fluid_flow_outflow(context): + return False + return (context.engine in cls.COMPAT_ENGINES) def draw_header(self, context): diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 1b483960c91..51e6039f86f 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -85,6 +85,9 @@ /** Time step default value for nice appearance. */ #define DT_DEFAULT 0.1f +/** Max value for phi initialization */ +#define PHI_MAX 9999.0f + static void BKE_fluid_modifier_reset_ex(struct FluidModifierData *mmd, bool need_lock); #ifdef WITH_FLUID @@ -927,10 +930,10 @@ static void update_obstacles(Depsgraph *depsgraph, /* Use big value that's not inf to initialize levelset grids. */ if (phi_obs_in) { - phi_obs_in[z] = FLT_MAX; + phi_obs_in[z] = PHI_MAX; } if (phi_guide_in) { - phi_guide_in[z] = FLT_MAX; + phi_guide_in[z] = PHI_MAX; } if (num_obstacles) { num_obstacles[z] = 0; @@ -1551,7 +1554,7 @@ static void update_mesh_distances(int index, float surface_thickness, int use_plane_init) { - float min_dist = FLT_MAX; + float min_dist = PHI_MAX; /* Ensure that planes get initialized correctly. */ if (use_plane_init) { @@ -1585,12 +1588,12 @@ static void update_mesh_distances(int index, /* Count for ray misses (no face hit) and cases where ray direction matches face normal * direction. */ int miss_cnt = 0, dir_cnt = 0; - min_dist = FLT_MAX; + min_dist = PHI_MAX; for (int i = 0; i < ray_cnt; i++) { BVHTreeRayHit hit_tree = {0}; hit_tree.index = -1; - hit_tree.dist = FLT_MAX; + hit_tree.dist = PHI_MAX; normalize_v3(ray_dirs[i]); BLI_bvhtree_ray_cast(tree_data->tree, @@ -1640,7 +1643,7 @@ static void update_mesh_distances(int index, BVHTreeRayHit hit_tree = {0}; hit_tree.index = -1; - hit_tree.dist = FLT_MAX; + hit_tree.dist = PHI_MAX; normalize_v3(ray); BLI_bvhtree_ray_cast( @@ -1695,7 +1698,7 @@ static void sample_mesh(FluidFlowSettings *mfs, float sample_str = 0.0f; hit.index = -1; - hit.dist = FLT_MAX; + hit.dist = PHI_MAX; nearest.index = -1; nearest.dist_sq = mfs->surface_distance * mfs->surface_distance; /* find_nearest uses squared distance */ @@ -1717,7 +1720,7 @@ static void sample_mesh(FluidFlowSettings *mfs, * point is at least surrounded by two faces */ negate_v3(ray_dir); hit.index = -1; - hit.dist = FLT_MAX; + hit.dist = PHI_MAX; BLI_bvhtree_ray_cast(tree_data->tree, ray_start, @@ -2779,10 +2782,10 @@ static void update_flowsfluids(struct Depsgraph *depsgraph, /* Grid reset before writing again */ for (z = 0; z < mds->res[0] * mds->res[1] * mds->res[2]; z++) { if (phi_in) { - phi_in[z] = FLT_MAX; + phi_in[z] = PHI_MAX; } if (phiout_in) { - phiout_in[z] = FLT_MAX; + phiout_in[z] = PHI_MAX; } if (density_in) { density_in[z] = 0.0f; @@ -2862,7 +2865,7 @@ static void update_flowsfluids(struct Depsgraph *depsgraph, else if (mfs->behavior == FLUID_FLOW_BEHAVIOR_GEOMETRY && !is_first_frame) { apply_inflow_fields(mfs, 0.0f, - FLT_MAX, + PHI_MAX, d_index, density_in, density, diff --git a/source/blender/editors/mesh/editmesh_mask_extract.c b/source/blender/editors/mesh/editmesh_mask_extract.c index 28962c8ec01..139f05db01c 100644 --- a/source/blender/editors/mesh/editmesh_mask_extract.c +++ b/source/blender/editors/mesh/editmesh_mask_extract.c @@ -125,6 +125,10 @@ static int paint_mask_extract_exec(bContext *C, wmOperator *op) BM_mesh_delete_hflag_context(bm, BM_ELEM_TAG, DEL_FACES); BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false); + BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { + mul_v3_v3(v->co, ob->scale); + } + if (RNA_boolean_get(op->ptr, "add_boundary_loop")) { BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) { BM_elem_flag_set(ed, BM_ELEM_TAG, BM_edge_is_boundary(ed)); |