diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-01-31 21:26:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2020-01-31 21:26:20 +0300 |
commit | f9d09a120910a21d383933c15fd72546772b5e81 (patch) | |
tree | aba43105de416afdf376bbf563002f9fd360188f | |
parent | 4633bb9939cd11a2429aeb2c0e5e3ede311a3126 (diff) | |
parent | 57801426792c3ca9c126c3c720ca6f337815294c (diff) |
Merge branch 'blender-v2.82-release'
-rw-r--r-- | intern/cycles/render/buffers.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/film.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/util/util_version.h | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_view.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 10 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/liquid_script.h | 9 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/smoke_script.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 53 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 35 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fluid.c | 16 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 48 |
11 files changed, 119 insertions, 69 deletions
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 50308d0d377..b08b6c84c1d 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -43,6 +43,8 @@ BufferParams::BufferParams() denoising_data_pass = false; denoising_clean_pass = false; denoising_prefiltered_pass = false; + + Pass::add(PASS_COMBINED, passes); } void BufferParams::get_offset_stride(int &offset, int &stride) diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp index bd274844b52..4af0f3c45f0 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -324,9 +324,12 @@ NODE_DEFINE(Film) Film::Film() : Node(node_type) { + Pass::add(PASS_COMBINED, passes); + use_light_visibility = false; filter_table_offset = TABLE_OFFSET_INVALID; cryptomatte_passes = CRYPT_NONE; + display_pass = PASS_COMBINED; need_update = true; } diff --git a/intern/cycles/util/util_version.h b/intern/cycles/util/util_version.h index 38829d3a29c..7489eed8aed 100644 --- a/intern/cycles/util/util_version.h +++ b/intern/cycles/util/util_version.h @@ -22,7 +22,7 @@ CCL_NAMESPACE_BEGIN #define CYCLES_VERSION_MAJOR 1 -#define CYCLES_VERSION_MINOR 9 +#define CYCLES_VERSION_MINOR 11 #define CYCLES_VERSION_PATCH 0 #define CYCLES_MAKE_VERSION_STRING2(a, b, c) #a "." #b "." #c diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp index f23174fd6dc..9d9ff451b3b 100644 --- a/intern/cycles/util/util_view.cpp +++ b/intern/cycles/util/util_view.cpp @@ -134,7 +134,7 @@ static void view_display() glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluOrtho2D(0, V.width, 0, V.height); + glOrtho(0, V.width, 0, V.height, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 6470bb22fef..8c86d92bf75 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -94,6 +94,12 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification { associatedWindow->setImmediateDraw(true); + /* macOS does not send a window resize event when switching between zoomed + * and fullscreen, when automatic show/hide of dock and menu bar are enabled. + * Send our own to prevent artifacts. */ + if ([(NSWindow *)associatedWindow->getOSWindow() isZoomed]) { + systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow); + } } - (void)windowDidEnterFullScreen:(NSNotification *)notification @@ -109,6 +115,10 @@ - (void)windowDidExitFullScreen:(NSNotification *)notification { associatedWindow->setImmediateDraw(false); + /* See comment for windowWillEnterFullScreen. */ + if ([(NSWindow *)associatedWindow->getOSWindow() isZoomed]) { + systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow); + } } - (void)windowDidResize:(NSNotification *)notification diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index bb42b781c19..442b09b5a8a 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -139,7 +139,7 @@ waveCrest_sp$ID$ = sp$ID$.create(RealGrid)\n\ kineticEnergy_sp$ID$ = sp$ID$.create(RealGrid)\n\ \n\ # Keep track of important objects in dict to load them later on\n\ -liquid_particles_dict_final_s$ID$ = dict(ppSnd=ppSnd_sp$ID$, pVelSnd=pVelSnd_pp$ID$, pLifeSnd=pLifeSnd_pp$ID$)\n\ +liquid_particles_dict_final_s$ID$ = dict(ppSnd=ppSnd_sp$ID$, pVelSnd=pVelSnd_pp$ID$, pLifeSnd=pLifeSnd_pp$ID$)\n\ liquid_particles_dict_resume_s$ID$ = dict(trappedAir=trappedAir_sp$ID$, waveCrest=waveCrest_sp$ID$, kineticEnergy=kineticEnergy_sp$ID$)\n"; const std::string liquid_init_phi = @@ -166,15 +166,18 @@ def liquid_adaptive_step_$ID$(framenr):\n\ mantaMsg('Initializing obstacle levelset')\n\ phiObsIn_s$ID$.fillHoles(maxDepth=int(res_s$ID$), boundaryWidth=2)\n\ extrapolateLsSimple(phi=phiObsIn_s$ID$, distance=int(res_s$ID$/2), inside=True)\n\ - extrapolateLsSimple(phi=phiObsIn_s$ID$, distance=int(res_s$ID$/2), inside=False)\n\ + extrapolateLsSimple(phi=phiObsIn_s$ID$, distance=3, inside=False)\n\ phiObs_s$ID$.join(phiObsIn_s$ID$)\n\ \n\ # Using boundaryWidth=2 to not search beginning from walls (just a performance optimization)\n\ # Additional sanity check: fill holes in phiObs which can result after joining with phiObsIn\n\ phiObs_s$ID$.fillHoles(maxDepth=int(res_s$ID$), boundaryWidth=2)\n\ extrapolateLsSimple(phi=phiObs_s$ID$, distance=int(res_s$ID$/2), inside=True)\n\ - extrapolateLsSimple(phi=phiObs_s$ID$, distance=int(res_s$ID$/2), inside=False)\n\ + extrapolateLsSimple(phi=phiObs_s$ID$, distance=3, inside=False)\n\ \n\ + mantaMsg('Initializing fluid levelset')\n\ + extrapolateLsSimple(phi=phiIn_s$ID$, distance=int(res_s$ID$/2), inside=True)\n\ + extrapolateLsSimple(phi=phiIn_s$ID$, distance=int(res_s$ID$/2), inside=False)\n\ phi_s$ID$.join(phiIn_s$ID$)\n\ \n\ if using_obstacle_s$ID$:\n\ diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index ad966503fd1..b4f7a39adeb 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -279,14 +279,18 @@ def smoke_adaptive_step_$ID$(framenr):\n\ mantaMsg('Initializing obstacle levelset')\n\ phiObsIn_s$ID$.fillHoles(maxDepth=int(res_s$ID$), boundaryWidth=2)\n\ extrapolateLsSimple(phi=phiObsIn_s$ID$, distance=int(res_s$ID$/2), inside=True)\n\ - extrapolateLsSimple(phi=phiObsIn_s$ID$, distance=int(res_s$ID$/2), inside=False)\n\ + extrapolateLsSimple(phi=phiObsIn_s$ID$, distance=3, inside=False)\n\ phiObs_s$ID$.join(phiObsIn_s$ID$)\n\ \n\ # Using boundaryWidth=2 to not search beginning from walls (just a performance optimization)\n\ # Additional sanity check: fill holes in phiObs which can result after joining with phiObsIn\n\ phiObs_s$ID$.fillHoles(maxDepth=int(res_s$ID$), boundaryWidth=2)\n\ extrapolateLsSimple(phi=phiObs_s$ID$, distance=int(res_s$ID$/2), inside=True)\n\ - extrapolateLsSimple(phi=phiObs_s$ID$, distance=int(res_s$ID$/2), inside=False)\n\ + extrapolateLsSimple(phi=phiObs_s$ID$, distance=3, inside=False)\n\ + \n\ + mantaMsg('Initializing fluid levelset')\n\ + extrapolateLsSimple(phi=phiIn_s$ID$, distance=int(res_s$ID$/2), inside=True)\n\ + extrapolateLsSimple(phi=phiIn_s$ID$, distance=3, inside=False)\n\ \n\ if using_outflow_s$ID$:\n\ phiOut_s$ID$.join(phiOutIn_s$ID$)\n\ diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 12c65027e25..f19137bf796 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -1452,7 +1452,7 @@ static void update_mesh_distances(int index, return; } - /* b) Volumetric initialization: 1) Ray-casts around mesh object. */ + /* b) Volumetric initialization: Ray-casts around mesh object. */ /* Ray-casts in 26 directions. * (6 main axis + 12 quadrant diagonals (2D) + 8 octant diagonals (3D)). */ @@ -1508,45 +1508,8 @@ static void update_mesh_distances(int index, min_dist = (-1.0f) * fabsf(min_dist); } - /* Update global distance array with distance value. */ - mesh_distances[index] = min_dist; - - /* b) Volumetric initialization: 2) Use nearest neighbor search on mesh surface. */ - - /* Distance between two opposing vertices in a unit cube. - * I.e. the unit cube diagonal or sqrt(3). - * This value is our nearest neighbour search distance. */ - const float surface_distance = 1.732; - BVHTreeNearest nearest = {0}; - nearest.index = -1; - nearest.dist_sq = surface_distance * surface_distance; /* find_nearest uses squared distance. */ - - if (BLI_bvhtree_find_nearest( - tree_data->tree, ray_start, &nearest, tree_data->nearest_callback, tree_data) != -1) { - float ray[3] = {0}; - sub_v3_v3v3(ray, nearest.co, ray_start); - min_dist = len_v3(ray); - - BVHTreeRayHit hit_tree = {0}; - hit_tree.index = -1; - hit_tree.dist = PHI_MAX; - - normalize_v3(ray); - BLI_bvhtree_ray_cast( - tree_data->tree, ray_start, ray, 0.0f, &hit_tree, tree_data->raycast_callback, tree_data); - - /* Only proceed if casted ray hit the mesh surface. */ - if (hit_tree.index != -1) { - - /* Ray and normal are pointing in the same direction: Point must lie inside mesh. */ - if (dot_v3v3(ray, hit_tree.no) > 0) { - min_dist = (-1.0f) * fabsf(min_dist); - } - - /* Update distance map with more accurate distance from this nearest neighbor search. */ - mesh_distances[index] = min_dist; - } - } + /* Update global distance array but ensure that older entries are not overridden. */ + mesh_distances[index] = MIN2(mesh_distances[index], min_dist); /* Subtract optional surface thickness value and virtually increase the object size. */ if (surface_thickness) { @@ -4012,7 +3975,7 @@ void BKE_fluid_particle_system_create(struct Main *bmain, part->type = psys_type; part->totpart = 0; - part->draw_size = 0.01f; // make fluid particles more subtle in viewport + part->draw_size = 0.01f; /* Make fluid particles more subtle in viewport. */ part->draw_col = PART_DRAW_COL_VEL; psys->part = part; psys->pointcache = BKE_ptcache_add(&psys->ptcaches); @@ -4386,7 +4349,7 @@ void BKE_fluid_modifier_create_type_data(struct FluidModifierData *mmd) mmd->domain->particle_number = 2; mmd->domain->particle_minimum = 8; mmd->domain->particle_maximum = 16; - mmd->domain->particle_radius = 1.5f; + mmd->domain->particle_radius = 1.0f; mmd->domain->particle_band_width = 3.0f; mmd->domain->fractions_threshold = 0.05f; @@ -4445,9 +4408,9 @@ void BKE_fluid_modifier_create_type_data(struct FluidModifierData *mmd) mmd->domain->cache_flag = 0; mmd->domain->cache_type = FLUID_DOMAIN_CACHE_MODULAR; mmd->domain->cache_mesh_format = FLUID_DOMAIN_FILE_BIN_OBJECT; - mmd->domain->cache_data_format = FLUID_DOMAIN_FILE_UNI; - mmd->domain->cache_particle_format = FLUID_DOMAIN_FILE_UNI; - mmd->domain->cache_noise_format = FLUID_DOMAIN_FILE_UNI; + mmd->domain->cache_data_format = FLUID_DOMAIN_FILE_OPENVDB; + mmd->domain->cache_particle_format = FLUID_DOMAIN_FILE_OPENVDB; + mmd->domain->cache_noise_format = FLUID_DOMAIN_FILE_OPENVDB; modifier_path_init(mmd->domain->cache_directory, sizeof(mmd->domain->cache_directory), FLUID_DOMAIN_DIR_DEFAULT); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 6b87cf2df81..97fcef4fd27 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3586,14 +3586,47 @@ void object_remove_particle_system(Main *bmain, Scene *UNUSED(scene), Object *ob return; } - /* clear all other appearances of this pointer (like on manta flow modifier) */ + /* Clear particle system in fluid modifier. */ if ((md = modifiers_findByType(ob, eModifierType_Fluid))) { FluidModifierData *mmd = (FluidModifierData *)md; + + /* Clear particle system pointer in flow settings. */ if ((mmd->type == MOD_FLUID_TYPE_FLOW) && mmd->flow && mmd->flow->psys) { if (mmd->flow->psys == psys) { mmd->flow->psys = NULL; } } + /* Clear particle flag in domain settings when removing particle system manually. */ + if (mmd->type == MOD_FLUID_TYPE_DOMAIN) { + if (psys->part->type == PART_FLUID_FLIP) { + mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FLIP; + } + if (psys->part->type == PART_FLUID_SPRAY || psys->part->type == PART_FLUID_SPRAYFOAM || + psys->part->type == PART_FLUID_SPRAYBUBBLE || + psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) { + mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_SPRAY; + } + if (psys->part->type == PART_FLUID_FOAM || psys->part->type == PART_FLUID_SPRAYFOAM || + psys->part->type == PART_FLUID_FOAMBUBBLE || + psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) { + mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FOAM; + } + if (psys->part->type == PART_FLUID_BUBBLE || psys->part->type == PART_FLUID_FOAMBUBBLE || + psys->part->type == PART_FLUID_SPRAYBUBBLE || + psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) { + mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_BUBBLE; + } + if (psys->part->type == PART_FLUID_TRACER) { + mmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_TRACER; + } + + /* Disable combined export if combined particle system was deleted. */ + if (psys->part->type == PART_FLUID_SPRAYFOAM || psys->part->type == PART_FLUID_SPRAYBUBBLE || + psys->part->type == PART_FLUID_FOAMBUBBLE || + psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) { + mmd->domain->sndparticle_combined_export = SNDPARTICLE_COMBINED_EXPORT_OFF; + } + } } if ((md = modifiers_findByType(ob, eModifierType_DynamicPaint))) { diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index 3c29f8ec8c0..01f240e715b 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -246,7 +246,7 @@ static void rna_Fluid_tracer_parts_update(Main *bmain, Scene *UNUSED(scene), Poi rna_Fluid_parts_create(bmain, ptr, "TracerParticleSettings", - "Tracer Particles", + "Tracers", "Tracer Particle System", PART_FLUID_TRACER); mmd->domain->particle_type |= FLUID_DOMAIN_PARTICLE_TRACER; @@ -290,7 +290,7 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR rna_Fluid_parts_create(bmain, ptr, "SprayFoamParticleSettings", - "Spray + Foam Particles", + "Spray + Foam", "Spray + Foam Particle System", PART_FLUID_SPRAYFOAM); @@ -316,7 +316,7 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR rna_Fluid_parts_create(bmain, ptr, "SprayBubbleParticleSettings", - "Spray + Bubble Particles", + "Spray + Bubbles", "Spray + Bubble Particle System", PART_FLUID_SPRAYBUBBLE); @@ -369,7 +369,7 @@ static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerR rna_Fluid_parts_create(bmain, ptr, "SprayFoamBubbleParticleSettings", - "Spray + Foam + Bubble Particles", + "Spray + Foam + Bubbles", "Spray + Foam + Bubble Particle System", PART_FLUID_SPRAYFOAMBUBBLE); @@ -1522,10 +1522,10 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "particle_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0, 10.0); - RNA_def_property_ui_text( - prop, - "Radius", - "Particle radius factor. Adjust this parameter when the simulation appears to leak volume"); + RNA_def_property_ui_text(prop, + "Radius", + "Particle radius factor. Increase this value if the simulation appears " + "to leak volume, decrease it if the simulation seems to gain volume"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_resetCache"); prop = RNA_def_property(srna, "particle_band_width", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index d914dc3b8dd..4155c453440 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -120,6 +120,29 @@ static const EnumPropertyItem part_hair_ren_as_items[] = { }; #endif +static const EnumPropertyItem part_type_items[] = { + {PART_EMITTER, "EMITTER", 0, "Emitter", ""}, + /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */ + {PART_HAIR, "HAIR", 0, "Hair", ""}, + {0, NULL, 0, NULL, NULL}, +}; + +#ifdef RNA_RUNTIME +static const EnumPropertyItem part_fluid_type_items[] = { + {PART_FLUID, "FLUID", 0, "Fluid", ""}, + {PART_FLUID_FLIP, "FLIP", 0, "Liquid", ""}, + {PART_FLUID_SPRAY, "SPRAY", 0, "Spray", ""}, + {PART_FLUID_BUBBLE, "BUBBLE", 0, "Bubble", ""}, + {PART_FLUID_FOAM, "FOAM", 0, "Foam", ""}, + {PART_FLUID_TRACER, "TRACER", 0, "Tracer", ""}, + {PART_FLUID_SPRAYFOAM, "SPRAYFOAM", 0, "Spray-Foam", ""}, + {PART_FLUID_SPRAYBUBBLE, "SPRAYBUBBLE", 0, "Spray-Bubble", ""}, + {PART_FLUID_FOAMBUBBLE, "FOAMBUBBLE", 0, "Foam-Bubble", ""}, + {PART_FLUID_SPRAYFOAMBUBBLE, "SPRAYFOAMBUBBLE", 0, "Spray-Foam-Bubble", ""}, + {0, NULL, 0, NULL, NULL}, +}; +#endif + #ifdef RNA_RUNTIME # include "BLI_math.h" @@ -1239,6 +1262,21 @@ static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr) return strlen(tstr); } +static const EnumPropertyItem *rna_Particle_type_itemf(bContext *UNUSED(C), + PointerRNA *ptr, + PropertyRNA *UNUSED(prop), + bool *UNUSED(r_free)) +{ + ParticleSettings *part = (ParticleSettings *)ptr->owner_id; + + if (part->type == PART_HAIR || part->type == PART_EMITTER) { + return part_type_items; + } + else { + return part_fluid_type_items; + } +} + static const EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), @@ -2260,13 +2298,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem type_items[] = { - {PART_EMITTER, "EMITTER", 0, "Emitter", ""}, - /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */ - {PART_HAIR, "HAIR", 0, "Hair", ""}, - {0, NULL, 0, NULL, NULL}, - }; - static const EnumPropertyItem phys_type_items[] = { {PART_PHYS_NO, "NO", 0, "None", ""}, {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""}, @@ -2493,8 +2524,9 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, type_items); + RNA_def_property_enum_items(prop, part_type_items); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_type_itemf"); RNA_def_property_ui_text(prop, "Type", "Particle Type"); RNA_def_property_update(prop, 0, "rna_Particle_change_type"); |