[Bf-blender-cvs] [bcc086584f3] master: Fix unreported 1 pixel offset when drawing with GPencil
Commit: bcc086584f3d8c1aedd79f8bc13ab21ca6785064 Author: Antonio Vazquez Date: Thu Jun 25 08:17:13 2020 +0200 Branches: master https://developer.blender.org/rBbcc086584f3d8c1aedd79f8bc13ab21ca6785064 Fix unreported 1 pixel offset when drawing with GPencil This bug was introduced in d82c3d86155e Reviewers: @fclem === M source/blender/draw/engines/eevee/eevee_engine.c === diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 14918d407fa..bac96ab1079 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -367,6 +367,8 @@ static void eevee_draw_scene(void *vedata) EEVEE_volumes_free_smoke_textures(); stl->g_data->view_updated = false; + + DRW_view_set_active(NULL); } static void eevee_view_update(void *vedata) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ec776f18ff7] master: Fix crashing on render end/abort introduced in 0dced1a
Commit: ec776f18ff70348fd2b13c70e54843f2ba45b599 Author: Jens Verwiebe Date: Wed Jun 24 23:51:57 2020 +0200 Branches: master https://developer.blender.org/rBec776f18ff70348fd2b13c70e54843f2ba45b599 Fix crashing on render end/abort introduced in 0dced1a === M intern/cycles/render/geometry.cpp === diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp index 9da1c083ba2..291905ac60d 100644 --- a/intern/cycles/render/geometry.cpp +++ b/intern/cycles/render/geometry.cpp @@ -1409,9 +1409,11 @@ void GeometryManager::device_update(Device *device, void GeometryManager::device_free(Device *device, DeviceScene *dscene) { #ifdef WITH_EMBREE - if (dscene->data.bvh.scene) { -BVHEmbree::destroy(dscene->data.bvh.scene); -dscene->data.bvh.scene = NULL; + if (dscene->data.bvh.bvh_layout == BVH_LAYOUT_EMBREE) { +if (dscene->data.bvh.scene) { + BVHEmbree::destroy(dscene->data.bvh.scene); + dscene->data.bvh.scene = NULL; +} } #endif ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [eace5903cb7] master: Fix T67741 EEVEE: World update don't update lightcache if one viewport uses lookdev
Commit: eace5903cb7d6c77207ad31453aee8e8d151f8b1 Author: Clément Foucault Date: Wed Jun 24 22:12:09 2020 +0200 Branches: master https://developer.blender.org/rBeace5903cb7d6c77207ad31453aee8e8d151f8b1 Fix T67741 EEVEE: World update don't update lightcache if one viewport uses lookdev Just a matter of not clearing the updating flag in this case. === M source/blender/draw/engines/eevee/eevee_engine.c === diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index d2369145d83..14918d407fa 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -402,6 +402,11 @@ static void eevee_id_world_update(void *vedata, World *wo) EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl; LightCache *lcache = stl->g_data->light_cache; + if (lcache == NULL || lcache == stl->lookdev_lightcache) { +/* Avoid Lookdev viewport clearing the update flag (see T67741). */ +return; + } + EEVEE_WorldEngineData *wedata = EEVEE_world_data_ensure(wo); if (wedata != NULL && wedata->dd.recalc != 0) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2ad8e16c2d7] master: Fix T78215 EEVEE: incorrect Render Passes results when using motion blur
Commit: 2ad8e16c2d7c416188bb0507a2e3066e6b9fdc7d Author: Clément Foucault Date: Wed Jun 24 21:34:18 2020 +0200 Branches: master https://developer.blender.org/rB2ad8e16c2d7c416188bb0507a2e3066e6b9fdc7d Fix T78215 EEVEE: incorrect Render Passes results when using motion blur This was caused by a missing DRWPass initialization. Now we create the passes for every timestep but avoid clearing the buffer after the first sample. === M source/blender/draw/engines/eevee/eevee_engine.c M source/blender/draw/engines/eevee/eevee_materials.c M source/blender/draw/engines/eevee/eevee_mist.c M source/blender/draw/engines/eevee/eevee_occlusion.c M source/blender/draw/engines/eevee/eevee_screen_raytrace.c M source/blender/draw/engines/eevee/eevee_shadows.c M source/blender/draw/engines/eevee/eevee_subsurface.c M source/blender/draw/engines/eevee/eevee_volumes.c === diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index a5df774656a..d2369145d83 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -527,10 +527,7 @@ static void eevee_render_to_image(void *vedata, /* Actual drawing. */ { - if (i == 0) { -EEVEE_renderpasses_output_init( -sldata, vedata, g_data->render_tot_samples * time_steps_tot); - } + EEVEE_renderpasses_output_init(sldata, vedata, g_data->render_tot_samples * time_steps_tot); EEVEE_temporal_sampling_create_view(vedata); EEVEE_render_draw(vedata, engine, render_layer, rect); diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 41c28075760..29c8a183ae5 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -1018,7 +1018,7 @@ void EEVEE_material_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, /* Should be enough precision for many samples. */ const eGPUTextureFormat texture_format = (tot_samples > 128) ? GPU_RGBA32F : GPU_RGBA16F; - const bool do_clear = DRW_state_is_image_render() || (effects->taa_current_sample == 1); + const bool do_clear = (effects->taa_current_sample == 1); /* Create FrameBuffer. */ GPU_framebuffer_ensure_config(&fbl->material_accum_fb, {GPU_ATTACHMENT_TEXTURE(dtxl->depth), GPU_ATTACHMENT_LEAVE}); diff --git a/source/blender/draw/engines/eevee/eevee_mist.c b/source/blender/draw/engines/eevee/eevee_mist.c index 7b942784ee9..1cedd334d67 100644 --- a/source/blender/draw/engines/eevee/eevee_mist.c +++ b/source/blender/draw/engines/eevee/eevee_mist.c @@ -75,7 +75,7 @@ void EEVEE_mist_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->mist_accum)}); /* Clear texture. */ - if (DRW_state_is_image_render() || effects->taa_current_sample == 1) { + if (effects->taa_current_sample == 1) { GPU_framebuffer_bind(fbl->mist_accum_fb); GPU_framebuffer_clear_color(fbl->mist_accum_fb, clear); } diff --git a/source/blender/draw/engines/eevee/eevee_occlusion.c b/source/blender/draw/engines/eevee/eevee_occlusion.c index f5ebbe08dd1..a075210967c 100644 --- a/source/blender/draw/engines/eevee/eevee_occlusion.c +++ b/source/blender/draw/engines/eevee/eevee_occlusion.c @@ -155,7 +155,7 @@ void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->ao_accum)}); /* Clear texture. */ -if (DRW_state_is_image_render() || effects->taa_current_sample == 1) { +if (effects->taa_current_sample == 1) { GPU_framebuffer_bind(fbl->ao_accum_fb); GPU_framebuffer_clear_color(fbl->ao_accum_fb, clear); } diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c index cece67334c5..32d758dba4b 100644 --- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c +++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c @@ -358,7 +358,7 @@ void EEVEE_reflection_output_init(EEVEE_ViewLayerData *UNUSED(sldata), {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->ssr_accum)}); /* Clear texture. */ - if (DRW_state_is_image_render() || effects->taa_current_sample == 1) { + if (effects->taa_current_sample == 1) { GPU_framebuffer_bind(fbl->ssr_accum_fb); GPU_framebuffer_clear_color(fbl->ssr_accum_fb, clear); } diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c index 84c50a22ae6..d0e430e115f 100644 --- a/source/blende
[Bf-blender-cvs] [d670a1c504d] soc-2020-fluid-tools: Merge branch 'master' into soc-2020-fluid-tools
Commit: d670a1c504dd51cbbd0cd8712541fdf2fafec67f Author: Sriharsha Kotcharlakot Date: Wed Jun 24 23:19:22 2020 +0530 Branches: soc-2020-fluid-tools https://developer.blender.org/rBd670a1c504dd51cbbd0cd8712541fdf2fafec67f Merge branch 'master' into soc-2020-fluid-tools === === diff --cc source/blender/makesdna/DNA_fluid_types.h index ccb5215191f,263cd3f7887..207351e8c19 --- a/source/blender/makesdna/DNA_fluid_types.h +++ b/source/blender/makesdna/DNA_fluid_types.h @@@ -597,8 -612,13 +619,14 @@@ typedef struct FluidDomainSettings char use_coba; char coba_field; /* Simulation field used for the color mapping. */ char interp_method; + char _pad9[4]; /* Unused. */ + /* OpenVDB cache options. */ + int openvdb_compression; + float clipping; + char openvdb_data_depth; + char _pad9[7]; /* Unused. */ + /* -- Deprecated / unsed options (below). -- */ /* View options. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0dced1af34e] master: Fix T78149: Cycles memory leak rendering animation with Embree
Commit: 0dced1af34e2a714475c24357cf93c2b0147f27f Author: Brecht Van Lommel Date: Tue Jun 23 21:07:53 2020 +0200 Branches: master https://developer.blender.org/rB0dced1af34e2a714475c24357cf93c2b0147f27f Fix T78149: Cycles memory leak rendering animation with Embree === M intern/cycles/render/geometry.cpp === diff --git a/intern/cycles/render/geometry.cpp b/intern/cycles/render/geometry.cpp index 797321f6eff..9da1c083ba2 100644 --- a/intern/cycles/render/geometry.cpp +++ b/intern/cycles/render/geometry.cpp @@ -1029,23 +1029,14 @@ void GeometryManager::device_update_bvh(Device *device, VLOG(1) << "Using " << bvh_layout_name(bparams.bvh_layout) << " layout."; -#ifdef WITH_EMBREE - if (bparams.bvh_layout == BVH_LAYOUT_EMBREE) { -if (dscene->data.bvh.scene) { - BVHEmbree::destroy(dscene->data.bvh.scene); -} - } -#endif - BVH *bvh = BVH::create(bparams, scene->geometry, scene->objects); bvh->build(progress, &device->stats); if (progress.get_cancel()) { #ifdef WITH_EMBREE -if (bparams.bvh_layout == BVH_LAYOUT_EMBREE) { - if (dscene->data.bvh.scene) { -BVHEmbree::destroy(dscene->data.bvh.scene); - } +if (dscene->data.bvh.scene) { + BVHEmbree::destroy(dscene->data.bvh.scene); + dscene->data.bvh.scene = NULL; } #endif delete bvh; @@ -1417,6 +1408,13 @@ void GeometryManager::device_update(Device *device, void GeometryManager::device_free(Device *device, DeviceScene *dscene) { +#ifdef WITH_EMBREE + if (dscene->data.bvh.scene) { +BVHEmbree::destroy(dscene->data.bvh.scene); +dscene->data.bvh.scene = NULL; + } +#endif + dscene->bvh_nodes.free(); dscene->bvh_leaf_nodes.free(); dscene->object_node.free(); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [34734aeda32] particle-solver-dev: Deduplicated the "nudge particle out of face" code
Commit: 34734aeda3281acaeac98f3a4dc84dfa262457f6 Author: Sebastian Parborg Date: Wed Jun 24 19:07:32 2020 +0200 Branches: particle-solver-dev https://developer.blender.org/rB34734aeda3281acaeac98f3a4dc84dfa262457f6 Deduplicated the "nudge particle out of face" code === M source/blender/simulations/bparticles/simulate.cpp === diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp index 4937dbf25cc..e28891c89b1 100644 --- a/source/blender/simulations/bparticles/simulate.cpp +++ b/source/blender/simulations/bparticles/simulate.cpp @@ -62,6 +62,29 @@ static void collision_interpolate_element(std::array, } } +static void calc_hit_point_data_tri(float co[3], +float no[3], +const float v0[3], +const float v1[3], +const float v2[3], +float offset) +{ + // Calculate normal of the point we hit. + normal_from_closest_point_to_tri(no, co, v0, v1, v2); + + // Calcualte a point that is not directly in contact with the current triangle. This is so we do + // not stick to the surface as it will collide with the same triangle immediately next time we + // check, even if it moving away from it. + // The offset should be greater than the particle radius + float3 point = co; + float3 normal = no; + float3 p_on_tri; + closest_on_tri_to_point_v3(p_on_tri, point, v0, v1, v2); + + point = p_on_tri + normal * offset; + copy_v3_v3(co, point); +} + /* find first root in range [0-1] starting from 0 */ static float collision_newton_rhapson(std::pair &particle_points, std::array, 3> &tri_points, @@ -90,21 +113,13 @@ static float collision_newton_rhapson(std::pair &particle_points interp_weights_tri_v3( hit_bary_weights, cur_tri_points[0], cur_tri_points[1], cur_tri_points[2], p); -normal_from_closest_point_to_tri( -coll_normal, p, cur_tri_points[0], cur_tri_points[1], cur_tri_points[2]); -// TODO clean up -float3 point = p; -float3 normal = coll_normal; -float3 p2; -closest_on_tri_to_point_v3(p2, point, cur_tri_points[0], cur_tri_points[1], cur_tri_points[2]); -float new_d = (p2 - point).length(); -if (new_d < radius + radius_epsilon) { - // printf("too close!\n"); - point_on_plane = p2 + normal * (radius + radius_epsilon); -} -else { - point_on_plane = p; -} +calc_hit_point_data_tri(p, +coll_normal, +cur_tri_points[0], +cur_tri_points[1], +cur_tri_points[2], +radius + radius_epsilon); +point_on_plane = p; return 0.f; } @@ -140,24 +155,13 @@ static float collision_newton_rhapson(std::pair &particle_points interp_weights_tri_v3( hit_bary_weights, cur_tri_points[0], cur_tri_points[1], cur_tri_points[2], p); -normal_from_closest_point_to_tri( -coll_normal, p, cur_tri_points[0], cur_tri_points[1], cur_tri_points[2]); - -// TODO clean up -float3 point = p; -float3 normal = coll_normal; -float3 p2; -closest_on_tri_to_point_v3( -p2, point, cur_tri_points[0], cur_tri_points[1], cur_tri_points[2]); -float new_d = (p2 - point).length(); -if (new_d < radius + radius_epsilon) { - // TODO should probably always do this - // printf("too close!\n"); - point_on_plane = p2 + normal * (radius + radius_epsilon); -} -else { - point_on_plane = p; -} +calc_hit_point_data_tri(p, +coll_normal, +cur_tri_points[0], +cur_tri_points[1], +cur_tri_points[2], +radius + radius_epsilon); +point_on_plane = p; CLAMP(t1, 0.f, 1.f); return t1; @@ -240,18 +244,7 @@ BLI_NOINLINE static void raycast_callback(void *userdata, hit->dist = dist; madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist); - normal_from_closest_point_to_tri(hit->no, hit->co, v0, v1, v2); - // TODO clean up (unify this into a function and using it in the rapson code) - float3 point = hit->co; - float3 normal = hit->no; - float3 p2; - closest_on_tri_to_point_v3(p2, point, v0, v1, v2); - float new_d = (p2 - point).length(); - if (new_d < ray->radius + rd->radius_epsilon) { -// printf("too close!\n"); -point = p2 + normal * (ray->radius + rd->radius_epsilon); -copy_v3_v3(hit->co,
[Bf-blender-cvs] [2ccdf41da6f] particle-solver-dev: Clamp bayu weights to prevent extrapolated velocity values
Commit: 2ccdf41da6f3cfb014296e7a98fdb3512cbdf02e Author: Sebastian Parborg Date: Wed Jun 24 18:40:42 2020 +0200 Branches: particle-solver-dev https://developer.blender.org/rB2ccdf41da6f3cfb014296e7a98fdb3512cbdf02e Clamp bayu weights to prevent extrapolated velocity values === M source/blender/simulations/bparticles/simulate.cpp === diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp index 43d4a474e6b..4937dbf25cc 100644 --- a/source/blender/simulations/bparticles/simulate.cpp +++ b/source/blender/simulations/bparticles/simulate.cpp @@ -110,8 +110,6 @@ static float collision_newton_rhapson(std::pair &particle_points } for (int iter = 0; iter < 10; iter++) { //, itersum++) { -// printf("\nt1 %f\n", t1); - /* get current location */ collision_interpolate_element(tri_points, cur_tri_points, t1); p = float3::interpolate(particle_points.first, particle_points.second, t1); @@ -233,6 +231,10 @@ BLI_NOINLINE static void raycast_callback(void *userdata, dist = bvhtree_sphereray_tri_intersection(ray, ray->radius, hit->dist, v0, v1, v2); } +// TODO perhaps check if the new collision is inside the triangle and the distance is within +// COLLISION_MIN_DISTANCE, then we take the collision that is inside the face. Note that this +// only for the same coll object + if (dist >= 0.0f && dist < hit->dist) { hit->index = index; hit->dist = dist; @@ -297,7 +299,7 @@ BLI_NOINLINE static void raycast_callback(void *userdata, if (coll_time >= 0.f) { if (hit->index != -1 && dist >= 0.0f && dist >= hit->dist) { - /* We have already collided with and other object at closer distance */ + /* We have already collided with an other object at closer distance */ return; } // We have a collision! @@ -311,6 +313,10 @@ BLI_NOINLINE static void raycast_callback(void *userdata, // Calculate the velocity of the point we hit zero_v3(rd->hit_vel); for (int i = 0; i < 3; i++) { + // Make sure that all the weights are between 0-1. They can be negative or above 1 if the + // point lies slightly outside of the triangle. + CLAMP(hit_bary_weights[i], 0.f, 1.f); + rd->hit_vel += (tri_points[i].second - tri_points[i].first) * hit_bary_weights[i] / rd->duration; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b468023aa1b] master: VR: Properly support outputting sRGB swapchain buffers
Commit: b468023aa1b51b2cdef38cd651c7487b9f4d34c4 Author: Julian Eisel Date: Wed Jun 24 18:26:51 2020 +0200 Branches: master https://developer.blender.org/rBb468023aa1b51b2cdef38cd651c7487b9f4d34c4 VR: Properly support outputting sRGB swapchain buffers Latest SteamVR OpenXR updates brought OpenGL support, but only with sRGB buffers. I think for DirectX it's the same now. It's not a big issue for us to use sRGB buffers, so that's what I will do for now. That way we shouldn't need hardcoded exceptions for specific runtimes that don't transform linear buffers correctly. === M intern/ghost/intern/GHOST_IXrGraphicsBinding.h M intern/ghost/intern/GHOST_XrGraphicsBinding.cpp M intern/ghost/intern/GHOST_XrSession.cpp M intern/ghost/intern/GHOST_XrSwapchain.cpp M intern/ghost/intern/GHOST_XrSwapchain.h === diff --git a/intern/ghost/intern/GHOST_IXrGraphicsBinding.h b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h index 5794a682023..b199c5f9b28 100644 --- a/intern/ghost/intern/GHOST_IXrGraphicsBinding.h +++ b/intern/ghost/intern/GHOST_IXrGraphicsBinding.h @@ -56,7 +56,8 @@ class GHOST_IXrGraphicsBinding { std::string *r_requirement_info) const = 0; virtual void initFromGhostContext(class GHOST_Context *ghost_ctx) = 0; virtual bool chooseSwapchainFormat(const std::vector &runtime_formats, - int64_t *r_result) const = 0; + int64_t &r_result, + bool &r_is_rgb_format) const = 0; virtual std::vector createSwapchainImages( uint32_t image_count) = 0; virtual void submitToSwapchainImage(XrSwapchainImageBaseHeader *swapchain_image, diff --git a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp index 71e6af3fa4f..7d7405a974d 100644 --- a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp +++ b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp @@ -36,7 +36,7 @@ static bool choose_swapchain_format_from_candidates(std::vector gpu_binding_formats, std::vector runtime_formats, -int64_t *r_result) +int64_t &r_result) { if (gpu_binding_formats.empty()) { return false; @@ -50,7 +50,7 @@ static bool choose_swapchain_format_from_candidates(std::vector gpu_bin return false; } - *r_result = *res; + r_result = *res; return true; } @@ -132,10 +132,20 @@ class GHOST_XrGraphicsBindingOpenGL : public GHOST_IXrGraphicsBinding { } bool chooseSwapchainFormat(const std::vector &runtime_formats, - int64_t *r_result) const override + int64_t &r_result, + bool &r_is_srgb_format) const override { -std::vector gpu_binding_formats = {GL_RGBA8}; -return choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result); +std::vector gpu_binding_formats = { +GL_RGBA8, +GL_SRGB8_ALPHA8, +}; + +if (choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result)) { + r_is_srgb_format = (r_result == GL_SRGB8_ALPHA8); + return true; +} + +return false; } std::vector createSwapchainImages(uint32_t image_count) override @@ -248,10 +258,19 @@ class GHOST_XrGraphicsBindingD3D : public GHOST_IXrGraphicsBinding { } bool chooseSwapchainFormat(const std::vector &runtime_formats, - int64_t *r_result) const override + int64_t &r_result, + bool &r_is_srgb_format) const override { -std::vector gpu_binding_formats = {DXGI_FORMAT_R8G8B8A8_UNORM}; -return choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result); +std::vector gpu_binding_formats = { +DXGI_FORMAT_R8G8B8A8_UNORM, +DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, +}; + +if (choose_swapchain_format_from_candidates(gpu_binding_formats, runtime_formats, r_result)) { + r_is_srgb_format = (r_result == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB); + return true; +} +return false; } std::vector createSwapchainImages(uint32_t image_count) override diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp index 7ae819dbfb2..5a747b1e787 100644 --- a/intern/ghost/intern/GHOST_XrSession.cpp +++ b/intern/ghost/intern/GHOST_XrSession.cpp @@ -375,15 +375,6 @@ static void ghost_xr_draw_view_info_from_view(const XrView &view, GHOST_XrDrawVi r_info.fov.angle_down = view.fov.angleDown; } -static bool ghost_xr_draw_view_expects_srgb_buffer(const GHOST_XrContext *
[Bf-blender-cvs] [5cfbc722d09] master: Fix T78047: Fix failing denoiser tests on windows
Commit: 5cfbc722d095664c3d2496f21d9deb21c47f2e12 Author: Ray Molenkamp Date: Wed Jun 24 10:42:00 2020 -0600 Branches: master https://developer.blender.org/rB5cfbc722d095664c3d2496f21d9deb21c47f2e12 Fix T78047: Fix failing denoiser tests on windows When we switched to MSVC2019 and C++17 we seemingly managed to trigger a code-gen bug with MSVC in the AVX code-path. This change works around the issue by (hopefully temporary) disabling the optimizer for the fast_exp2f4 function, given it is only used in a single pass of the denoiser and nowhere else, this is luckily not as bad as it could have been. Once the compiler is fixed or a different fix is available we'll have to revisit this. Details and link to the repro posted to MS is available in T78047 === M intern/cycles/util/util_math_fast.h === diff --git a/intern/cycles/util/util_math_fast.h b/intern/cycles/util/util_math_fast.h index dbed83ab84d..1e0792859a2 100644 --- a/intern/cycles/util/util_math_fast.h +++ b/intern/cycles/util/util_math_fast.h @@ -446,6 +446,11 @@ ccl_device_inline float fast_expf(float x) } #ifndef __KERNEL_GPU__ +/* MSVC seems to have a codegen bug here in atleast SSE41/AVX + * see T78047 for details. */ +#ifdef _MSC_VER +# pragma optimize( "", off ) +#endif ccl_device float4 fast_exp2f4(float4 x) { const float4 one = make_float4(1.0f); @@ -461,6 +466,9 @@ ccl_device float4 fast_exp2f4(float4 x) r = madd4(x, r, make_float4(1.0f)); return __int4_as_float4(__float4_as_int4(r) + (m << 23)); } +#ifdef _MSC_VER +# pragma optimize( "", on ) +#endif ccl_device_inline float4 fast_expf4(float4 x) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ac0852cea0d] master: Fluid: Fix OpenVDB compiler warnings
Commit: ac0852cea0d607b97de1930841fadb1ac1b019e9 Author: Sebastián Barschkis Date: Wed Jun 24 18:36:42 2020 +0200 Branches: master https://developer.blender.org/rBac0852cea0d607b97de1930841fadb1ac1b019e9 Fluid: Fix OpenVDB compiler warnings Kudos to brecht for noticing the issue === M extern/mantaflow/preprocessed/fileio/iovdb.cpp M extern/mantaflow/preprocessed/gitinfo.h === diff --git a/extern/mantaflow/preprocessed/fileio/iovdb.cpp b/extern/mantaflow/preprocessed/fileio/iovdb.cpp index 31958dcb977..b31f7e0e760 100644 --- a/extern/mantaflow/preprocessed/fileio/iovdb.cpp +++ b/extern/mantaflow/preprocessed/fileio/iovdb.cpp @@ -478,7 +478,7 @@ int readObjectsVDB(const string &filename, std::vector *objects, floa } // For every manta object, we loop through the vdb grid list and check for a match -for (const openvdb::GridBase::Ptr vdbGrid : gridsVDB) { +for (const openvdb::GridBase::Ptr &vdbGrid : gridsVDB) { bool nameMatch = (vdbGrid->getName() == (*iter)->getName()); // Sanity checks: Only load valid grids and make sure names match. diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index 1e96ee26de2..e4183ec342b 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit 6725e6840a906167cc63474a22fc822d9aebf3e7" +#define MANTA_GIT_VERSION "commit 5ae24e860cf15f1310666e119575cc01bea48598" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c2ab069dfca] master: Fluid: Use OpenVDB as the default cache format for liquids too
Commit: c2ab069dfca3c2c82313d7f5d2fa2c0a97dbe514 Author: Sebastián Barschkis Date: Wed Jun 24 18:38:56 2020 +0200 Branches: master https://developer.blender.org/rBc2ab069dfca3c2c82313d7f5d2fa2c0a97dbe514 Fluid: Use OpenVDB as the default cache format for liquids too With the updated OpenVDB setup, it is now perfectly fine to use OpenVDB for liquid domains. === M release/scripts/startup/bl_operators/object_quick_effects.py M source/blender/blenkernel/intern/fluid.c === diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py index 59b66b427f1..311631ac65f 100644 --- a/release/scripts/startup/bl_operators/object_quick_effects.py +++ b/release/scripts/startup/bl_operators/object_quick_effects.py @@ -399,6 +399,9 @@ class QuickSmoke(ObjectModeOperator, Operator): if self.style == 'FIRE' or self.style == 'BOTH': obj.modifiers[-1].domain_settings.use_noise = True +# ensure correct cache file format for smoke +obj.modifiers[-1].domain_settings.cache_data_format = 'OPENVDB' + # Setup material # Cycles and Eevee @@ -511,7 +514,8 @@ class QuickLiquid(Operator): obj.modifiers[-1].domain_settings.use_collision_border_top = True obj.modifiers[-1].domain_settings.use_collision_border_bottom = True -# set correct cache file format for liquid +# ensure correct cache file formats for liquid +obj.modifiers[-1].domain_settings.cache_data_format = 'OPENVDB' obj.modifiers[-1].domain_settings.cache_mesh_format = 'BOBJECT' # change domain type, will also allocate and show particle system for FLIP diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 103c3bb119d..98573ea98ec 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -4583,13 +4583,9 @@ void BKE_fluid_particles_set(FluidDomainSettings *settings, int value, bool clea void BKE_fluid_domain_type_set(Object *object, FluidDomainSettings *settings, int type) { - /* Set common values for liquid/smoke domain: cache type, - * border collision and viewport draw-type. */ + /* Set values for border collision: + * Liquids should have a closed domain, smoke domains should be open. */ if (type == FLUID_DOMAIN_TYPE_GAS) { -BKE_fluid_cachetype_mesh_set(settings, FLUID_DOMAIN_FILE_BIN_OBJECT); -BKE_fluid_cachetype_data_set(settings, FLUID_DOMAIN_FILE_UNI); -BKE_fluid_cachetype_particle_set(settings, FLUID_DOMAIN_FILE_UNI); -BKE_fluid_cachetype_noise_set(settings, FLUID_DOMAIN_FILE_UNI); BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_FRONT, 1); BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_BACK, 1); BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_RIGHT, 1); @@ -4599,10 +4595,6 @@ void BKE_fluid_domain_type_set(Object *object, FluidDomainSettings *settings, in object->dt = OB_WIRE; } else if (type == FLUID_DOMAIN_TYPE_LIQUID) { -BKE_fluid_cachetype_mesh_set(settings, FLUID_DOMAIN_FILE_BIN_OBJECT); -BKE_fluid_cachetype_data_set(settings, FLUID_DOMAIN_FILE_UNI); -BKE_fluid_cachetype_particle_set(settings, FLUID_DOMAIN_FILE_UNI); -BKE_fluid_cachetype_noise_set(settings, FLUID_DOMAIN_FILE_UNI); BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_FRONT, 0); BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_BACK, 0); BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_RIGHT, 0); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ba380fc0bf7] master: Fix T78213: Windows 10 Build Errors: Extern_Manaflow error messages
Commit: ba380fc0bf7b646d2c5d4832f6111879b3dd3f97 Author: Sebastián Barschkis Date: Wed Jun 24 18:01:26 2020 +0200 Branches: master https://developer.blender.org/rBba380fc0bf7b646d2c5d4832f6111879b3dd3f97 Fix T78213: Windows 10 Build Errors: Extern_Manaflow error messages Kudos to LazyDodo for figuring this out === M extern/mantaflow/helper/util/randomstream.h M extern/mantaflow/preprocessed/gitinfo.h === diff --git a/extern/mantaflow/helper/util/randomstream.h b/extern/mantaflow/helper/util/randomstream.h index 35b9c7d8858..6c20ddc6a14 100644 --- a/extern/mantaflow/helper/util/randomstream.h +++ b/extern/mantaflow/helper/util/randomstream.h @@ -16,13 +16,13 @@ #ifndef _RANDOMSTREAM_H #define _RANDOMSTREAM_H -namespace Manta { - #include #include #include #include "vectorbase.h" +namespace Manta { + class MTRand { // Data public: diff --git a/extern/mantaflow/preprocessed/gitinfo.h b/extern/mantaflow/preprocessed/gitinfo.h index ad7ce45cbce..1e96ee26de2 100644 --- a/extern/mantaflow/preprocessed/gitinfo.h +++ b/extern/mantaflow/preprocessed/gitinfo.h @@ -1,3 +1,3 @@ -#define MANTA_GIT_VERSION "commit 2c83bddc59cd5140e5dd91b172167a7cba9d4960" +#define MANTA_GIT_VERSION "commit 6725e6840a906167cc63474a22fc822d9aebf3e7" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [baff05ad1c1] master: UI: Add Free Handle Types to CurveProfile Widget
Commit: baff05ad1c156ca477375c440e2c5b92cad214e9 Author: Hans Goudey Date: Wed Jun 24 11:50:01 2020 -0400 Branches: master https://developer.blender.org/rBbaff05ad1c156ca477375c440e2c5b92cad214e9 UI: Add Free Handle Types to CurveProfile Widget Under the hood the CurveProfile widget (used for bevel custom profiles) uses a bezier curve, but right now though it only supports two of the bezier curve handle types, vector and auto. This patch adds support for free handles and adds all of the logic for editing them. This is the first step to the ability to import and export curve objects in the widget. There's some code cleanup in curveprofile.c. Movement for handles and control points is abstracted to functions there rather than happening in interface_handlers.c. An "Apply Preset" button is also added, which solves a confusing issue where you apply a preset, then change the number of samples and the preset doesn't change. The button makes it clear that the preset needs to be reapplied. Reviewed By: Severin Differential Revision: https://developer.blender.org/D6470 === M source/blender/blenkernel/BKE_curveprofile.h M source/blender/blenkernel/intern/curveprofile.c M source/blender/editors/interface/interface_draw.c M source/blender/editors/interface/interface_handlers.c M source/blender/editors/interface/interface_templates.c M source/blender/makesdna/DNA_curveprofile_types.h M source/blender/makesrna/intern/rna_curveprofile.c === diff --git a/source/blender/blenkernel/BKE_curveprofile.h b/source/blender/blenkernel/BKE_curveprofile.h index bf50cde1efc..877ab887138 100644 --- a/source/blender/blenkernel/BKE_curveprofile.h +++ b/source/blender/blenkernel/BKE_curveprofile.h @@ -45,6 +45,16 @@ void BKE_curveprofile_copy_data(struct CurveProfile *target, const struct CurveP struct CurveProfile *BKE_curveprofile_copy(const struct CurveProfile *profile); +bool BKE_curveprofile_move_handle(struct CurveProfilePoint *point, + const bool handle_1, + const bool snap, + const float delta[2]); + +bool BKE_curveprofile_move_point(struct CurveProfile *profile, + struct CurveProfilePoint *point, + const bool snap, + const float delta[2]); + bool BKE_curveprofile_remove_point(struct CurveProfile *profile, struct CurveProfilePoint *point); void BKE_curveprofile_remove_by_flag(struct CurveProfile *profile, const short flag); @@ -65,7 +75,12 @@ void BKE_curveprofile_create_samples(struct CurveProfile *profile, void BKE_curveprofile_initialize(struct CurveProfile *profile, short segments_len); /* Called for a complete update of the widget after modifications */ -void BKE_curveprofile_update(struct CurveProfile *profile, const bool rem_doubles); +enum { + PROF_UPDATE_NONE = 0, + PROF_UPDATE_REMOVE_DOUBLES = (1 << 0), + PROF_UPDATE_CLIP = (1 << 1), +}; +void BKE_curveprofile_update(struct CurveProfile *profile, const int update_flags); /* Need to find the total length of the curve to sample a portion of it */ float BKE_curveprofile_total_length(const struct CurveProfile *profile); diff --git a/source/blender/blenkernel/intern/curveprofile.c b/source/blender/blenkernel/intern/curveprofile.c index f43e0355eaa..7b7cadfcb1b 100644 --- a/source/blender/blenkernel/intern/curveprofile.c +++ b/source/blender/blenkernel/intern/curveprofile.c @@ -65,6 +65,11 @@ void BKE_curveprofile_copy_data(CurveProfile *target, const CurveProfile *profil target->path = MEM_dupallocN(profile->path); target->table = MEM_dupallocN(profile->table); target->segments = MEM_dupallocN(profile->segments); + + /* Update the reference the points have to the profile. */ + for (int i = 0; i < target->path_len; i++) { +target->path[i].profile = target; + } } CurveProfile *BKE_curveprofile_copy(const CurveProfile *profile) @@ -77,6 +82,101 @@ CurveProfile *BKE_curveprofile_copy(const CurveProfile *profile) return NULL; } +/** + * Move a point's handle, accounting for the alignment of handles with the HD_ALIGN type. + * + * \param handle_1 Whether to move the 1st or 2nd control point. + * \param new_location The *relative* change in the handle's position. + * \note Requires #BKE_curveprofile_update call after. + * \return Whether the handle moved from its start position. + */ +bool BKE_curveprofile_move_handle(struct CurveProfilePoint *point, + const bool handle_1, + const bool snap, + const float delta[2]) +{ + short handle_type = (handle_1) ? point->h1 : point->h2; + float *handle_location = (handle_1) ? &point->h1_loc[0] : &point->h2_loc[0]; + +
[Bf-blender-cvs] [ec7510b4585] master: Fix T67319 DRW: Large objects gets incorrectly culled
Commit: ec7510b458528eb8dcdf2c538a2b805813940447 Author: Clément Foucault Date: Wed Jun 24 17:44:50 2020 +0200 Branches: master https://developer.blender.org/rBec7510b458528eb8dcdf2c538a2b805813940447 Fix T67319 DRW: Large objects gets incorrectly culled To avoid this we just bypass culling if the object is too big to avoid float precision issues. === M source/blender/draw/intern/draw_manager_data.c === diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 8a99907e5db..fa3f0417f79 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -538,6 +538,11 @@ static void drw_call_culling_init(DRWCullingState *cull, Object *ob) mul_v3_m4v3(corner, ob->obmat, bbox->vec[0]); mul_m4_v3(ob->obmat, cull->bsphere.center); cull->bsphere.radius = len_v3v3(cull->bsphere.center, corner); + +/* Bypass test for very large objects (see T67319). */ +if (UNLIKELY(cull->bsphere.radius > 1e12)) { + cull->bsphere.radius = -1.0f; +} } else { /* Bypass test. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [560a73610b7] master: Fix artifact in Clay Strips when producing large deformations
Commit: 560a73610b76a08384d7396f3e864f82ece558a2 Author: Pablo Dobarro Date: Mon Jun 22 01:01:42 2020 +0200 Branches: master https://developer.blender.org/rB560a73610b76a08384d7396f3e864f82ece558a2 Fix artifact in Clay Strips when producing large deformations The clay strips brush tip tests distances against a cube with beveled Z aligned edges. This cube was positioned with its center in the surface of the mesh, so when producing large deformation, some vertices that should be deformed were positioned further than the cube's Z dimension, so they were left behind, producing artifacts. This displaces and deforms the local space to position the brush tip cube (now a prism) towards the deformation direction, so more vertices can be included, removing most of these artifacts. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8004 === M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index ffbaf1f1037..25b01a20981 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4706,6 +4706,17 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t mul_v3_fl(temp, displace); add_v3_v3(area_co, temp); + /* Clay Strips uses a cube test with falloff in the XY axis (not in Z) and a plane to deform the + * vertices. When in Add mode, vertices that are below the plane and inside the cube are move + * towards the plane. In this situation, there may be cases where a vertex is outside the cube + * but below the plane, so won't be deformed, causing artifacts. In order to prevent these + * artifacts, this displaces the test cube space in relation to the plane in order to + * deform more vertices that may be below it. */ + /* The 0.7 and 1.25 factors are arbitrary and don't have any relation between them, they were set + * by doing multiple tests using the defaul Clay Strips brush preset. */ + float area_co_displaced[3]; + madd_v3_v3v3fl(area_co_displaced, area_co, area_no, -radius * 0.7f); + /* Init brush local space matrix. */ cross_v3_v3v3(mat[0], area_no, ss->cache->grab_delta_symmetry); mat[0][3] = 0.0f; @@ -4713,13 +4724,19 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t mat[1][3] = 0.0f; copy_v3_v3(mat[2], area_no); mat[2][3] = 0.0f; - copy_v3_v3(mat[3], ss->cache->location); + copy_v3_v3(mat[3], area_co_displaced); mat[3][3] = 1.0f; normalize_m4(mat); /* Scale brush local space matrix. */ scale_m4_fl(scale, ss->cache->radius); mul_m4_m4m4(tmat, mat, scale); + + /* Deform the local space in Z to scale the test cube. As the test cube does not have falloff in + * Z this does not produce artifacts in the falloff cube and allows to deform extra vertices + * during big deformation while keeping the surface as uniform as possible. */ + mul_v3_fl(tmat[2], 1.25f); + invert_m4_m4(mat, tmat); SculptThreadedTaskData data = { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [255638d2235] master: Fix Surface Smooth not taking the sculpt mask into account
Commit: 255638d2235e5890a38751d9a33432c5e35d3daa Author: Pablo Dobarro Date: Thu Jun 18 22:16:31 2020 +0200 Branches: master https://developer.blender.org/rB255638d2235e5890a38751d9a33432c5e35d3daa Fix Surface Smooth not taking the sculpt mask into account The sculpt mask was hardcoded to 0.0 Reviewed By: sergey Differential Revision: https://developer.blender.org/D8071 === M source/blender/editors/sculpt_paint/sculpt_smooth.c === diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c index 02c7b65dcb7..3ef8c43ee56 100644 --- a/source/blender/editors/sculpt_paint/sculpt_smooth.c +++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c @@ -545,10 +545,15 @@ static void SCULPT_do_surface_smooth_brush_laplacian_task_cb_ex( { SCULPT_orig_vert_data_update(&orig_data, &vd); if (sculpt_brush_test_sq_fn(&test, vd.co)) { - const float fade = - bstrength * - SCULPT_brush_strength_factor( - ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, 0.0f, vd.index, thread_id); + const float fade = bstrength * SCULPT_brush_strength_factor(ss, + brush, + vd.co, + sqrtf(test.dist), + vd.no, + vd.fno, + vd.mask ? *vd.mask : 0.0f, + vd.index, + thread_id); float disp[3]; SCULPT_surface_smooth_laplacian_step(ss, @@ -586,10 +591,15 @@ static void SCULPT_do_surface_smooth_brush_displace_task_cb_ex( BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { if (sculpt_brush_test_sq_fn(&test, vd.co)) { - const float fade = - bstrength * - SCULPT_brush_strength_factor( - ss, brush, vd.co, sqrtf(test.dist), vd.no, vd.fno, 0.0f, vd.index, thread_id); + const float fade = bstrength * SCULPT_brush_strength_factor(ss, + brush, + vd.co, + sqrtf(test.dist), + vd.no, + vd.fno, + vd.mask ? *vd.mask : 0.0f, + vd.index, + thread_id); SCULPT_surface_smooth_displace_step( ss, vd.co, ss->cache->surface_smooth_laplacian_disp, vd.index, beta, fade); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2b522e3345a] master: Fix T78188: Sculpt mask glitching after using sculpt vertex colors
Commit: 2b522e3345a490ff8ad387ed4f2214e32b7dac57 Author: Pablo Dobarro Date: Wed Jun 24 16:45:17 2020 +0200 Branches: master https://developer.blender.org/rB2b522e3345a490ff8ad387ed4f2214e32b7dac57 Fix T78188: Sculpt mask glitching after using sculpt vertex colors The face sets color copy to the GPU was done outside of the loop, probably after a merge error in a rebase. Also, the default color was initialized using the wrong type. Reviewed By: sergey Maniphest Tasks: T78188 Differential Revision: https://developer.blender.org/D8106 === M source/blender/gpu/intern/gpu_buffers.c === diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 53ef305f629..9c21f9040da 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -316,7 +316,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, empty_mask = empty_mask && (cmask == 0); /* Vertex Colors. */ if (show_vcol) { -ushort scol[4] = {1.0f, 1.0f, 1.0f, 1.0f}; +ushort scol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; if (vtcol) { scol[0] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[0]); scol[1] = unit_float_to_ushort_clamp(vtcol[vtri[j]].color[1]); @@ -334,10 +334,9 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, memcpy(GPU_vertbuf_raw_step(&col_step), scol, sizeof(scol)); } } + /* Face Sets. */ + memcpy(GPU_vertbuf_raw_step(&fset_step), face_set_color, sizeof(uchar) * 3); } - -/* Face Sets. */ -memcpy(GPU_vertbuf_raw_step(&fset_step), face_set_color, sizeof(uchar) * 3); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0f7851ee79b] master: Fix T78192: Draw Face Sets tool not updating the viewport color
Commit: 0f7851ee79bdcd39b475633b5f65c31aa5370a23 Author: Pablo Dobarro Date: Wed Jun 24 16:51:54 2020 +0200 Branches: master https://developer.blender.org/rB0f7851ee79bdcd39b475633b5f65c31aa5370a23 Fix T78192: Draw Face Sets tool not updating the viewport color The draw face set tool always needs to redraw the nodes, but it only needs the full update when in smooth mode because it moves the vertices. Reviewed By: sergey Maniphest Tasks: T78192 Differential Revision: https://developer.blender.org/D8108 === M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8bb6701436a..ffbaf1f1037 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5284,6 +5284,7 @@ static void do_brush_action_task_cb(void *__restrict userdata, /* Face Sets modifications do a single undo push */ if (data->brush->sculpt_tool == SCULPT_TOOL_DRAW_FACE_SETS) { +BKE_pbvh_node_mark_redraw(data->nodes[n]); /* Draw face sets in smooth mode moves the vertices. */ if (ss->cache->alt_smooth) { SCULPT_undo_push_node(data->ob, data->nodes[n], SCULPT_UNDO_COORDS); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b4e1571d0bc] master: Cleanup: compiler warnings
Commit: b4e1571d0bcf186df979455cf9852dccd325345b Author: Brecht Van Lommel Date: Wed Jun 24 17:08:01 2020 +0200 Branches: master https://developer.blender.org/rBb4e1571d0bcf186df979455cf9852dccd325345b Cleanup: compiler warnings === M intern/cycles/blender/blender_camera.cpp M intern/cycles/blender/blender_session.cpp M intern/cycles/blender/blender_sync.h M intern/cycles/device/device_denoising.cpp M intern/cycles/device/device_optix.cpp M intern/cycles/device/device_task.h M intern/cycles/kernel/kernels/cpu/kernel.cpp M intern/cycles/render/object.cpp === diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index d9c63bec737..011678a7a65 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -867,8 +867,7 @@ void BlenderSync::sync_view(BL::SpaceView3D &b_v3d, } } -BufferParams BlenderSync::get_buffer_params(BL::Scene &b_scene, -BL::RenderSettings &b_render, +BufferParams BlenderSync::get_buffer_params(BL::RenderSettings &b_render, BL::SpaceView3D &b_v3d, BL::RegionView3D &b_rv3d, Camera *cam, diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 2874ccb6470..391a1b8f473 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -157,14 +157,8 @@ void BlenderSession::create_session() } /* set buffer parameters */ - BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, - b_render, - b_v3d, - b_rv3d, - scene->camera, - width, - height, - session_params.denoising.use); + BufferParams buffer_params = BlenderSync::get_buffer_params( + b_render, b_v3d, b_rv3d, scene->camera, width, height, session_params.denoising.use); session->reset(buffer_params, session_params.samples); b_engine.use_highlight_tiles(session_params.progressive_refine == false); @@ -245,8 +239,7 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg BL::SpaceView3D b_null_space_view3d(PointerRNA_NULL); BL::RegionView3D b_null_region_view3d(PointerRNA_NULL); - BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, - b_render, + BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_null_space_view3d, b_null_region_view3d, scene->camera, @@ -485,14 +478,8 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_) /* get buffer parameters */ SessionParams session_params = BlenderSync::get_session_params( b_engine, b_userpref, b_scene, background, b_view_layer); - BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, - b_render, - b_v3d, - b_rv3d, - scene->camera, - width, - height, - session_params.denoising.use); + BufferParams buffer_params = BlenderSync::get_buffer_params( + b_render, b_v3d, b_rv3d, scene->camera, width, height, session_params.denoising.use); /* temporary render result to find needed passes and views */ BL::RenderResult b_rr = begin_render_result( @@ -838,14 +825,8 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_) sync->sync_camera(b_render, b_camera_override, width, height, ""); /* get buffer parameters */ - BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, - b_render, - b_v3d, - b_rv3d, -
[Bf-blender-cvs] [c78b831e69f] master: Fix T78073 EEVEE: new motion blur and overscan produce wrong render
Commit: c78b831e69faaa206ca457e80581f6371cad73fa Author: Clément Foucault Date: Wed Jun 24 15:49:51 2020 +0200 Branches: master https://developer.blender.org/rBc78b831e69faaa206ca457e80581f6371cad73fa Fix T78073 EEVEE: new motion blur and overscan produce wrong render This was caused by the override viewport size not being maintained after DRW_cache_restart(). Also this fixes issue with the inv_size not being updated correctly. === M source/blender/draw/intern/draw_manager.c === diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 5b1276d0d6b..3e42c4cdb23 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -373,6 +373,8 @@ void DRW_render_viewport_size_set(int size[2]) { DST.size[0] = size[0]; DST.size[1] = size[1]; + DST.inv_size[0] = 1.0f / size[0]; + DST.inv_size[1] = 1.0f / size[1]; } const float *DRW_viewport_size_get(void) @@ -1945,6 +1947,11 @@ void DRW_custom_pipeline(DrawEngineType *draw_engine_type, /* Used when the render engine want to redo another cache populate inside the same render frame. */ void DRW_cache_restart(void) { + /* Save viewport size. */ + float size[2], inv_size[2]; + copy_v2_v2(size, DST.size); + copy_v2_v2(inv_size, DST.inv_size); + /* Force cache to reset. */ drw_viewport_cache_resize(); @@ -1953,6 +1960,10 @@ void DRW_cache_restart(void) DST.buffer_finish_called = false; DRW_hair_init(); + + /* Restore. */ + copy_v2_v2(DST.size, size); + copy_v2_v2(DST.inv_size, inv_size); } static struct DRWSelectBuffer { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e761d0bdc93] master: Fix T78080: group node has incorrect sockets after changing group
Commit: e761d0bdc93007d3fadf14fc42eff3a71ad5ee26 Author: Jacques Lucke Date: Wed Jun 24 16:53:46 2020 +0200 Branches: master https://developer.blender.org/rBe761d0bdc93007d3fadf14fc42eff3a71ad5ee26 Fix T78080: group node has incorrect sockets after changing group It was only checking for the identifier, but the type has to be equivalent as well. Reviewers: mano-wii, brecht Differential Revision: https://developer.blender.org/D8101 === M source/blender/nodes/intern/node_common.c === diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 765fa84439f..996fb93eb76 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -125,7 +125,7 @@ static bNodeSocket *group_verify_socket( bNodeSocket *sock; for (sock = verify_lb->first; sock; sock = sock->next) { -if (STREQ(sock->identifier, iosock->identifier)) { +if (sock->typeinfo == iosock->typeinfo && STREQ(sock->identifier, iosock->identifier)) { break; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ff0df7c546d] master: UI: Add Extrude Manifold Icon
Commit: ff0df7c546d7bedf092e7f150f6c4ce6a02978c1 Author: Germano Cavalcante Date: Wed Jun 24 11:32:06 2020 -0300 Branches: master https://developer.blender.org/rBff0df7c546d7bedf092e7f150f6c4ce6a02978c1 UI: Add Extrude Manifold Icon Differential Revision: https://developer.blender.org/D8016 === A release/datafiles/icons/ops.mesh.extrude_manifold.dat M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py M source/blender/editors/datafiles/CMakeLists.txt === diff --git a/release/datafiles/icons/ops.mesh.extrude_manifold.dat b/release/datafiles/icons/ops.mesh.extrude_manifold.dat new file mode 100644 index 000..c1cc5b2d723 Binary files /dev/null and b/release/datafiles/icons/ops.mesh.extrude_manifold.dat differ diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index 65f399118e6..2605cf1e1b9 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -821,7 +821,7 @@ class _defs_edit_mesh: description=( "Extrude, dissolves edges whose faces form a flat surface and intersect new edges" ), -icon="none", +icon="ops.mesh.extrude_manifold", widget="VIEW3D_GGT_tool_generic_handle_normal", keymap=(), ) diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index 1a5b3d6ac45..0dcb8de37f1 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -713,6 +713,7 @@ set_property(GLOBAL PROPERTY ICON_GEOM_NAMES ops.mesh.bisect ops.mesh.dupli_extrude_cursor ops.mesh.extrude_faces_move + ops.mesh.extrude_manifold ops.mesh.extrude_region_move ops.mesh.extrude_region_shrink_fatten ops.mesh.inset ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9fe64948abe] master: Fluid: Updated Mantaflow source with latest OpenVDB changes
Commit: 9fe64948abe991d18c1af3a52d81e87c24d39687 Author: Sebastián Barschkis Date: Wed Jun 24 12:00:13 2020 +0200 Branches: master https://developer.blender.org/rB9fe64948abe991d18c1af3a52d81e87c24d39687 Fluid: Updated Mantaflow source with latest OpenVDB changes This updated set of Mantaflow files includes the improved OpenVDB file IO. With this update it is finally possible to store multiple grids per file. It is also possible to save particle systems and particle data to OpenVDB files. === M extern/mantaflow/CMakeLists.txt M extern/mantaflow/helper/pwrapper/pconvert.cpp M extern/mantaflow/helper/pwrapper/pconvert.h M extern/mantaflow/preprocessed/fileio/iogrids.cpp M extern/mantaflow/preprocessed/fileio/iomeshes.cpp M extern/mantaflow/preprocessed/fileio/ioparticles.cpp M extern/mantaflow/preprocessed/fileio/ioutil.cpp A extern/mantaflow/preprocessed/fileio/iovdb.cpp A extern/mantaflow/preprocessed/fileio/mantaio.cpp M extern/mantaflow/preprocessed/fileio/mantaio.h M extern/mantaflow/preprocessed/gitinfo.h M extern/mantaflow/preprocessed/grid.cpp M extern/mantaflow/preprocessed/grid.h M extern/mantaflow/preprocessed/grid4d.cpp M extern/mantaflow/preprocessed/grid4d.h M extern/mantaflow/preprocessed/particle.cpp M extern/mantaflow/preprocessed/particle.h M extern/mantaflow/preprocessed/python/defines.py.reg.cpp M extern/mantaflow/preprocessed/registration.cpp === diff --git a/extern/mantaflow/CMakeLists.txt b/extern/mantaflow/CMakeLists.txt index bdee06349d2..8b7453bf4c5 100644 --- a/extern/mantaflow/CMakeLists.txt +++ b/extern/mantaflow/CMakeLists.txt @@ -54,6 +54,10 @@ if(WITH_OPENVDB) add_definitions(-DOPENVDB_STATICLIB) endif() +if(WITH_OPENVDB_BLOSC) + add_definitions(-DOPENVDB_BLOSC=1) +endif() + if(WIN32) add_definitions(-D_USE_MATH_DEFINES) endif() @@ -106,10 +110,12 @@ set(SRC ${MANTA_PP}/fastmarch.cpp ${MANTA_PP}/fastmarch.h ${MANTA_PP}/fastmarch.h.reg.cpp - ${MANTA_PP}/fileio/ioutil.cpp ${MANTA_PP}/fileio/iogrids.cpp ${MANTA_PP}/fileio/iomeshes.cpp ${MANTA_PP}/fileio/ioparticles.cpp + ${MANTA_PP}/fileio/ioutil.cpp + ${MANTA_PP}/fileio/iovdb.cpp + ${MANTA_PP}/fileio/mantaio.cpp ${MANTA_PP}/fileio/mantaio.h ${MANTA_PP}/fileio/mantaio.h.reg.cpp ${MANTA_PP}/fluidsolver.cpp diff --git a/extern/mantaflow/helper/pwrapper/pconvert.cpp b/extern/mantaflow/helper/pwrapper/pconvert.cpp index 9ada75519fc..861a2c070bd 100644 --- a/extern/mantaflow/helper/pwrapper/pconvert.cpp +++ b/extern/mantaflow/helper/pwrapper/pconvert.cpp @@ -96,6 +96,37 @@ template<> PyObject *toPy(const PbClass_Ptr &obj) { return obj->getPyObject(); } +template<> PyObject *toPy>(const std::vector &vec) +{ + PyObject *listObj = PyList_New(vec.size()); + if (!listObj) +throw logic_error("Unable to allocate memory for Python list"); + for (unsigned int i = 0; i < vec.size(); i++) { +PbClass *pb = vec[i]; +PyObject *item = pb->getPyObject(); +if (!item) { + Py_DECREF(listObj); + throw logic_error("Unable to allocate memory for Python list"); +} +PyList_SET_ITEM(listObj, i, item); + } + return listObj; +} +template<> PyObject *toPy>(const std::vector &vec) +{ + PyObject *listObj = PyList_New(vec.size()); + if (!listObj) +throw logic_error("Unable to allocate memory for Python list"); + for (unsigned int i = 0; i < vec.size(); i++) { +PyObject *item = toPy(vec[i]); +if (!item) { + Py_DECREF(listObj); + throw logic_error("Unable to allocate memory for Python list"); +} +PyList_SET_ITEM(listObj, i, item); + } + return listObj; +} template<> float fromPy(PyObject *obj) { @@ -125,6 +156,42 @@ template<> PyObject *fromPy(PyObject *obj) { return obj; } +template<> PbClass *fromPy(PyObject *obj) +{ + PbClass *pbo = Pb::objFromPy(obj); + + if (!PyType_Check(obj)) +return pbo; + + const char *tname = ((PyTypeObject *)obj)->tp_name; + pbo->setName(tname); + + return pbo; +} +template<> std::vector fromPy>(PyObject *obj) +{ + std::vector vec; + if (PyList_Check(obj)) { +int sz = PyList_Size(obj); +for (int i = 0; i < sz; ++i) { + PyObject *lobj = PyList_GetItem(obj, i); + vec.push_back(fromPy(lobj)); +} + } + return vec; +} +template<> std::vector fromPy>(PyObject *obj) +{ + std::vector vec; + if (PyList_Check(obj)) { +int sz = PyList_Size(obj); +for (int i = 0; i < sz; ++i) { + PyObject *lobj = PyList_GetItem(obj, i); + vec.push_back(fromPy(lobj)); +} + } + return vec; +} template<> int fromPy(PyObject *obj) { #if PY_MAJOR_VERSION <= 2 @@ -259,11 +326,10 @@ template T *tmpAlloc(PyObject *obj, std::vector *tmp) { if (!tmp) throw Error("dynamic de-ref not supported for this type"); - void *ptr = mal
[Bf-blender-cvs] [99518589428] master: Fluid: Improved OpenVDB support for fluid caches
Commit: 9951858942893adeb4eef27ec8a8471a179e9c59 Author: Sebastián Barschkis Date: Wed Jun 24 15:30:49 2020 +0200 Branches: master https://developer.blender.org/rB9951858942893adeb4eef27ec8a8471a179e9c59 Fluid: Improved OpenVDB support for fluid caches This commit makes uses of the new OpenVDB IO in Mantaflow (introduced in 781f783a66ac). From now on, fluid cache files in OpenVDB format will contain a list of grids per frame (before: one .vdb file per grid per frame). Besides regular grids, particle systems are also stored using OpenVDBs PointGrid data structures. All older cache formats will remain fully functional: - Uni caches (.uni) files are still available from the UI and can be used as before - Raw caches (.raw) are no longer available from the UI, but loading them is still possible - Old OpenVDB caches (one .vdb per grid) can no longer be baked either, but loading them is still possible. It is also no longer possible to choose file formats for 'Noise' and 'Particles'. Instead there are now options to set the file format for 'Volumetric' and for 'Mesh' data. Known issues (planned to be resolved soon): - OpenVDB files are currently not taking into consideration the clipping value (FluidDomainSettings). Empty cells are therefore being written too. Depending on the scene, this can make file sizes unnecessarily large. - Domains are not being exported at their world position. Instead they are always clipped to the origin. === M intern/mantaflow/extern/manta_fluid_API.h M intern/mantaflow/intern/MANTA_main.cpp M intern/mantaflow/intern/MANTA_main.h M intern/mantaflow/intern/manta_fluid_API.cpp M intern/mantaflow/intern/strings/fluid_script.h M intern/mantaflow/intern/strings/liquid_script.h M intern/mantaflow/intern/strings/smoke_script.h M release/scripts/startup/bl_operators/object_quick_effects.py M release/scripts/startup/bl_ui/properties_physics_fluid.py M source/blender/blenkernel/intern/fluid.c M source/blender/blenkernel/intern/pointcache.c M source/blender/editors/physics/physics_fluid.c M source/blender/makesdna/DNA_fluid_types.h M source/blender/makesrna/intern/rna_fluid.c === diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h index 7825ad14d7d..d78aa6732b1 100644 --- a/intern/mantaflow/extern/manta_fluid_API.h +++ b/intern/mantaflow/extern/manta_fluid_API.h @@ -41,23 +41,23 @@ int manta_write_config(struct MANTA *fluid, struct FluidModifierData *mmd, int f int manta_write_data(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); int manta_write_noise(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); int manta_read_config(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); -int manta_read_data(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); -int manta_read_noise(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); +int manta_read_data(struct MANTA *fluid, +struct FluidModifierData *mmd, +int framenr, +bool resumable); +int manta_read_noise(struct MANTA *fluid, + struct FluidModifierData *mmd, + int framenr, + bool resumable); int manta_read_mesh(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); -int manta_read_particles(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); +int manta_read_particles(struct MANTA *fluid, + struct FluidModifierData *mmd, + int framenr, + bool resumable); int manta_read_guiding(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr, bool sourceDomain); -int manta_update_liquid_structures(struct MANTA *fluid, - struct FluidModifierData *mmd, - int framenr); -int manta_update_mesh_structures(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); -int manta_update_particle_structures(struct MANTA *fluid, - struct FluidModifierData *mmd, - int framenr); -int manta_update_smoke_structures(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); -int manta_update_noise_structures(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); int manta_bake_data(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); int manta_bake_noise(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); int manta_bake_mesh(struct MANTA *fluid, struct FluidModifierData *mmd, int framenr); diff --git a/intern/mantaflow/intern/MANTA_main.
[Bf-blender-cvs] [6fec2e4db05] master: Cleanup: fix typo in denoiser menu
Commit: 6fec2e4db05f6acdfc2b1b0ba365af143201277c Author: Brecht Van Lommel Date: Wed Jun 24 16:01:23 2020 +0200 Branches: master https://developer.blender.org/rB6fec2e4db05f6acdfc2b1b0ba365af143201277c Cleanup: fix typo in denoiser menu === M intern/cycles/blender/addon/properties.py === diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 053de16529c..840efb65d96 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -199,7 +199,7 @@ def enum_preview_denoiser(self, context): if len(optix_items): auto_label = "Fastest (Optix)" elif len(oidn_items): -auto_label = "Fatest (OpenImageDenoise)" +auto_label = "Fastest (OpenImageDenoise)" else: auto_label = "None" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d645525dae8] master: Fix missing WITH_CYCLES_EMBREE in the build configurations
Commit: d645525dae83f239c0b6eb43dd5adeabe263735a Author: Brecht Van Lommel Date: Wed Jun 24 15:51:08 2020 +0200 Branches: master https://developer.blender.org/rBd645525dae83f239c0b6eb43dd5adeabe263735a Fix missing WITH_CYCLES_EMBREE in the build configurations === M build_files/cmake/config/blender_full.cmake M build_files/cmake/config/blender_lite.cmake M build_files/cmake/config/blender_release.cmake === diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake index a997d7c0e68..41bee263e22 100644 --- a/build_files/cmake/config/blender_full.cmake +++ b/build_files/cmake/config/blender_full.cmake @@ -11,6 +11,7 @@ set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE) set(WITH_CODEC_FFMPEGON CACHE BOOL "" FORCE) set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE) set(WITH_CYCLES ON CACHE BOOL "" FORCE) +set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE) set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE) set(WITH_DRACO ON CACHE BOOL "" FORCE) set(WITH_FFTW3 ON CACHE BOOL "" FORCE) diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake index f3a6d4608fe..68b9bd1d94d 100644 --- a/build_files/cmake/config/blender_lite.cmake +++ b/build_files/cmake/config/blender_lite.cmake @@ -15,6 +15,7 @@ set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE) set(WITH_CODEC_FFMPEGOFF CACHE BOOL "" FORCE) set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE) set(WITH_CYCLES OFF CACHE BOOL "" FORCE) +set(WITH_CYCLES_EMBREE OFF CACHE BOOL "" FORCE) set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE) set(WITH_CYCLES_DEVICE_OPTIX OFF CACHE BOOL "" FORCE) set(WITH_DRACO OFF CACHE BOOL "" FORCE) diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake index 01a59e451aa..5fce64ce719 100644 --- a/build_files/cmake/config/blender_release.cmake +++ b/build_files/cmake/config/blender_release.cmake @@ -12,6 +12,7 @@ set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE) set(WITH_CODEC_FFMPEGON CACHE BOOL "" FORCE) set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE) set(WITH_CYCLES ON CACHE BOOL "" FORCE) +set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE) set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE) set(WITH_DRACO ON CACHE BOOL "" FORCE) set(WITH_FFTW3 ON CACHE BOOL "" FORCE) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a3c4e90969e] greasepencil-object: GPencil: First steps to implement spread for a segment
Commit: a3c4e90969eee43afd86e3247a780e920f82131e Author: Antonio Vazquez Date: Tue Jun 23 17:21:23 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rBa3c4e90969eee43afd86e3247a780e920f82131e GPencil: First steps to implement spread for a segment Still not working. Keep this commit to save the current status. === M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/gpencil/gpencil_utils.c M source/blender/editors/include/ED_gpencil.h === diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index eacf0d80be7..2abfb392711 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -3758,6 +3758,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) for (int r = 0; r < 5; r++) { gp_smooth_segment(p->gpd, 0.15f, size_before - 1, size_after - 1); } +/* Spread the points if needed. */ +ED_gpencil_stroke_buffer_spread_segment( +p->brush, &p->gsc, size_before - 1, size_after - 1); } /* finish painting operation if anything went wrong just now */ diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 83286b78620..2db8ef27116 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -3094,7 +3094,7 @@ static void gpencil_copy_buffer_point(tGPspoint *pt_from, tGPspoint *pt_dst) } /** - * Spread last buffer point to get more topoly + * Spread last buffer point to get more topology * @param brush Current brush * @param gpd Current datablock */ @@ -3124,3 +3124,43 @@ void ED_gpencil_stroke_buffer_spread(Brush *brush, GP_SpaceConversion *gsc) /* Spread the points. */ gpencil_spread_points(brush, gsc, spread, last_index); } + +/** + * Spread a segment of buffer points to get more topology. + * This function assumes the segment is at the end of the stroke. + * + * @param brush Current brush + * @param gpd Current datablock + * @param from_index Index of the first point to spread + * @param to_index Index of the last point to spread + */ +void ED_gpencil_stroke_buffer_spread_segment(struct Brush *brush, + struct GP_SpaceConversion *gsc, + int from_index, + int to_index) +{ + bGPdata *gpd = gsc->gpd; + const int spread = brush->gpencil_settings->draw_spread; + if (spread == 0) { +return; + } + + const int totpoints = to_index - from_index; + + /* Increase the buffer size to hold the new points. + * As the function add 1, add only spread point minus 1. */ + gpd->runtime.sbuffer_used += (spread * totpoints) - 1; + gpd->runtime.sbuffer = ED_gpencil_sbuffer_ensure( + gpd->runtime.sbuffer, &gpd->runtime.sbuffer_size, &gpd->runtime.sbuffer_used, false); + /* Increment counters after expand buffer. */ + gpd->runtime.sbuffer_used++; + + /* Move original points to the right index depending of spread value. */ + for (int i = totpoints; i > 0; i--) { +tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + from_index + i); +tGPspoint *pt_dst = ((tGPspoint *)(gpd->runtime.sbuffer) + from_index + (spread * i)); +gpencil_copy_buffer_point(pt_orig, pt_dst); + } + + /* Copy each point is his segment. */ +} diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 7ebf7501851..78c49af3bf0 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -357,6 +357,10 @@ bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps, const float diff_mat[4][4]); void ED_gpencil_stroke_buffer_spread(struct Brush *brush, struct GP_SpaceConversion *gsc); +void ED_gpencil_stroke_buffer_spread_segment(struct Brush *brush, + struct GP_SpaceConversion *gsc, + int from_index, + int to_index); #ifdef __cplusplus } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1e2c87b9516] greasepencil-edit-curve: Merge branch 'master' into greasepencil-edit-curve
Commit: 1e2c87b95163ed1affabef92e1492e67c814faf1 Author: Antonio Vazquez Date: Wed Jun 24 16:02:41 2020 +0200 Branches: greasepencil-edit-curve https://developer.blender.org/rB1e2c87b95163ed1affabef92e1492e67c814faf1 Merge branch 'master' into greasepencil-edit-curve === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3cfb687b559] master: Cleanup: make it possible to include util_tbb.h in any order
Commit: 3cfb687b5595733f5817f3186b372f231e76bed5 Author: Brecht Van Lommel Date: Wed Jun 24 15:27:28 2020 +0200 Branches: master https://developer.blender.org/rB3cfb687b5595733f5817f3186b372f231e76bed5 Cleanup: make it possible to include util_tbb.h in any order === M intern/cycles/util/util_task.h M intern/cycles/util/util_tbb.h === diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index c3bc14348be..a56ca62f62c 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -19,11 +19,10 @@ #include "util/util_list.h" #include "util/util_string.h" +#include "util/util_tbb.h" #include "util/util_thread.h" #include "util/util_vector.h" -#include "util/util_tbb.h" - CCL_NAMESPACE_BEGIN class TaskPool; diff --git a/intern/cycles/util/util_tbb.h b/intern/cycles/util/util_tbb.h index 7a3dacb3a9d..301cb80c5b0 100644 --- a/intern/cycles/util/util_tbb.h +++ b/intern/cycles/util/util_tbb.h @@ -17,6 +17,10 @@ #ifndef __UTIL_TBB_H__ #define __UTIL_TBB_H__ +/* TBB includes , do it ourselves first so we are sure + * WIN32_LEAN_AND_MEAN and similar are defined beforehand. */ +#include "util_windows.h" + #define TBB_SUPPRESS_DEPRECATED_MESSAGES 1 #include ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [64a655ec4c1] greasepencil-object: GPencil: Increase default buffer size
Commit: 64a655ec4c1dada3ab7596d2511f7f9f7331ee01 Author: Antonio Vazquez Date: Wed Jun 24 16:00:09 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rB64a655ec4c1dada3ab7596d2511f7f9f7331ee01 GPencil: Increase default buffer size Using spread the number of points is huge and for each expand of points there is a small flash on the screen, so keep a big buffer reduce the effect. === M source/blender/editors/gpencil/gpencil_intern.h === diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 6dd918efce0..595f2e66c4e 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -399,7 +399,7 @@ typedef enum eGPencil_PaintModes { } eGPencil_PaintModes; /* chunk size for gp-session buffer (the total size is a multiple of this number) */ -#define GP_STROKE_BUFFER_CHUNK 2048 +#define GP_STROKE_BUFFER_CHUNK 8192 /* stroke editing - */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1957304f9b8] greasepencil-object: GPencil: Spread the point os sampled points
Commit: 1957304f9b80bef9b9622e83b3aa7e46e7f6c5c7 Author: Antonio Vazquez Date: Wed Jun 24 16:00:33 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rB1957304f9b80bef9b9622e83b3aa7e46e7f6c5c7 GPencil: Spread the point os sampled points === M source/blender/editors/gpencil/gpencil_utils.c === diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 2db8ef27116..201ee7b5128 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -3145,7 +3145,7 @@ void ED_gpencil_stroke_buffer_spread_segment(struct Brush *brush, return; } - const int totpoints = to_index - from_index; + const int totpoints = to_index - from_index - 1; /* Increase the buffer size to hold the new points. * As the function add 1, add only spread point minus 1. */ @@ -3156,11 +3156,24 @@ void ED_gpencil_stroke_buffer_spread_segment(struct Brush *brush, gpd->runtime.sbuffer_used++; /* Move original points to the right index depending of spread value. */ + int step = spread + 1; + int offset = gpd->runtime.sbuffer_used - 1; for (int i = totpoints; i > 0; i--) { -tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + from_index + i); -tGPspoint *pt_dst = ((tGPspoint *)(gpd->runtime.sbuffer) + from_index + (spread * i)); +tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + from_index + i + 1); +tGPspoint *pt_dst = ((tGPspoint *)(gpd->runtime.sbuffer) + offset); gpencil_copy_buffer_point(pt_orig, pt_dst); +offset -= step; } - /* Copy each point is his segment. */ + /* Copy each point to its segment. */ + for (int i = 0; i < totpoints; i++) { +int idx = from_index + (step * i) + 1; +tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + idx); +for (int x = 0; x < spread; x++) { + tGPspoint *pt_dst = ((tGPspoint *)(gpd->runtime.sbuffer) + idx + x + 1); + gpencil_copy_buffer_point(pt_orig, pt_dst); +} +/* Spread the points. */ +gpencil_spread_points(brush, gsc, spread, idx); + } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e32945bfd36] greasepencil-object: Merge branch 'master' into greasepencil-object
Commit: e32945bfd366823cea400fdc78aba507b226f77c Author: Antonio Vazquez Date: Wed Jun 24 16:01:59 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rBe32945bfd366823cea400fdc78aba507b226f77c Merge branch 'master' into greasepencil-object === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1fc71bf2eae] greasepencil-object: GPencil: Basic spread point functionality
Commit: 1fc71bf2eaec676f1162aed2b3bd4d11b1c16976 Author: Antonio Vazquez Date: Mon Jun 22 18:51:32 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rB1fc71bf2eaec676f1162aed2b3bd4d11b1c16976 GPencil: Basic spread point functionality === M release/scripts/startup/bl_ui/space_view3d_toolbar.py M source/blender/editors/gpencil/gpencil_paint.c M source/blender/editors/gpencil/gpencil_utils.c M source/blender/editors/include/ED_gpencil.h M source/blender/makesdna/DNA_brush_types.h M source/blender/makesrna/intern/rna_brush.c === diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index a951025166e..254b92ba493 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1623,6 +1623,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_random(View3DPanel, Panel): col.template_curve_mapping(gp_settings, "curve_jitter", brush=True, use_negative_slope=True) +row = col.row(align=True) +row.prop(gp_settings, "pen_spread") + class VIEW3D_PT_tools_grease_pencil_brush_paint_falloff(GreasePencilBrushFalloff, Panel, View3DPaintPanel): bl_context = ".greasepencil_paint" diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e3512b8660f..eacf0d80be7 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -911,6 +911,11 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure } } +/* Spread points. */ +if (brush_settings->flag & GP_BRUSH_GROUP_RANDOM) { + ED_gpencil_stroke_buffer_spread(brush, &p->gsc); +} + /* Update evaluated data. */ ED_gpencil_sbuffer_update_eval(gpd, p->ob_eval); diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 422b5e0c1b9..7508cec8eac 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -2978,3 +2978,134 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, return hit; } + +/* Helper to move a point in buffer. */ +void gpencil_spread_point( +Brush *brush, GP_SpaceConversion *gsc, const int pt_index, const float x, const float y) +{ + RegionView3D *rv3d = gsc->region->regiondata; + float pixsize = rv3d->pixsize * 1000.0f; + const float factor = brush->size * pixsize; + float rand = 1.0f; + + bGPdata *gpd = gsc->gpd; + tGPspoint *pt = ((tGPspoint *)(gpd->runtime.sbuffer) + pt_index); + rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x + gpd->runtime.sbuffer_used, pt->y)) * 2.0f - 1.0f; + pt->x += x * factor * rand; + + rand = BLI_hash_int_01(BLI_hash_int_2d(pt->y + gpd->runtime.sbuffer_used, pt->x)) * 2.0f - 1.0f; + pt->y += y * factor * rand; + + /* Randomness to other factors. */ + rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x, pt->y)) * 2.0f - 1.0f; + pt->pressure += rand * 1.5f; + + rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x + pt->y, pt->x)) * 2.0f - 1.0f; + pt->strength += rand * 1.5f; + CLAMP(pt->strength, 0.1f, 1.0f); +} + +/** + * Spread last buffer point to get more topoly + * @param brush Current brush + * @param gpd Current datablock + */ +void ED_gpencil_stroke_buffer_spread(Brush *brush, GP_SpaceConversion *gsc) +{ + bGPdata *gpd = gsc->gpd; + const int spread = brush->gpencil_settings->draw_spread; + if (spread == 0) { +return; + } + const int last_index = gpd->runtime.sbuffer_used - 1; + + /* Increase the buffer size to hold the new points. + * As the function add 1, add only spread point minus 1. */ + gpd->runtime.sbuffer_used += spread - 1; + gpd->runtime.sbuffer = ED_gpencil_sbuffer_ensure( + gpd->runtime.sbuffer, &gpd->runtime.sbuffer_size, &gpd->runtime.sbuffer_used, false); + /* Increment counters after expand buffer. */ + gpd->runtime.sbuffer_used++; + + /* Duplicate las point to the new point. */ + tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + last_index); + for (int i = 0; i < spread; i++) { +tGPspoint *pt = ((tGPspoint *)(gpd->runtime.sbuffer) + last_index + i + 1); +copy_v2_v2(&pt->x, &pt_orig->x); +pt->pressure = pt_orig->pressure; +pt->strength = pt_orig->strength; +pt->time = pt_orig->time; +pt->uv_fac = pt_orig->uv_fac; +pt->uv_rot = pt_orig->uv_rot; +copy_v3_v3(pt->rnd, pt_orig->rnd); +pt->rnd_dirty = pt_orig->rnd_dirty; +copy_v4_v4(pt->vert_color, pt_orig->vert_color); + } + /* Spread the points. */ + switch (spread) { +case 1: { + gpencil_spread_point(brush, gsc, last_index, -1.0f, 0.0f); + gpencil_spread_point(brush, gsc, last_index
[Bf-blender-cvs] [0974ab0ab75] greasepencil-object: GPencil: Reformat spread code and prepare for sampled points
Commit: 0974ab0ab7599aa88868aaa42404f0e7bb6d5599 Author: Antonio Vazquez Date: Tue Jun 23 16:59:28 2020 +0200 Branches: greasepencil-object https://developer.blender.org/rB0974ab0ab7599aa88868aaa42404f0e7bb6d5599 GPencil: Reformat spread code and prepare for sampled points === M source/blender/editors/gpencil/gpencil_utils.c === diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 7508cec8eac..83286b78620 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -2980,9 +2980,10 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, } /* Helper to move a point in buffer. */ -void gpencil_spread_point( +static void gpencil_spread_point( Brush *brush, GP_SpaceConversion *gsc, const int pt_index, const float x, const float y) { + BrushGpencilSettings *brush_settings = brush->gpencil_settings; RegionView3D *rv3d = gsc->region->regiondata; float pixsize = rv3d->pixsize * 1000.0f; const float factor = brush->size * pixsize; @@ -2999,113 +3000,127 @@ void gpencil_spread_point( /* Randomness to other factors. */ rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x, pt->y)) * 2.0f - 1.0f; pt->pressure += rand * 1.5f; + CLAMP_MIN(pt->pressure, 0.01f); rand = BLI_hash_int_01(BLI_hash_int_2d(pt->x + pt->y, pt->x)) * 2.0f - 1.0f; pt->strength += rand * 1.5f; - CLAMP(pt->strength, 0.1f, 1.0f); + CLAMP(pt->strength, 0.01f, brush_settings->draw_strength); } -/** - * Spread last buffer point to get more topoly - * @param brush Current brush - * @param gpd Current datablock - */ -void ED_gpencil_stroke_buffer_spread(Brush *brush, GP_SpaceConversion *gsc) +/* Define how the spread points are created. */ +static void gpencil_spread_points(Brush *brush, GP_SpaceConversion *gsc, int spread, int pt_index) { - bGPdata *gpd = gsc->gpd; - const int spread = brush->gpencil_settings->draw_spread; - if (spread == 0) { -return; - } - const int last_index = gpd->runtime.sbuffer_used - 1; - - /* Increase the buffer size to hold the new points. - * As the function add 1, add only spread point minus 1. */ - gpd->runtime.sbuffer_used += spread - 1; - gpd->runtime.sbuffer = ED_gpencil_sbuffer_ensure( - gpd->runtime.sbuffer, &gpd->runtime.sbuffer_size, &gpd->runtime.sbuffer_used, false); - /* Increment counters after expand buffer. */ - gpd->runtime.sbuffer_used++; - - /* Duplicate las point to the new point. */ - tGPspoint *pt_orig = ((tGPspoint *)(gpd->runtime.sbuffer) + last_index); - for (int i = 0; i < spread; i++) { -tGPspoint *pt = ((tGPspoint *)(gpd->runtime.sbuffer) + last_index + i + 1); -copy_v2_v2(&pt->x, &pt_orig->x); -pt->pressure = pt_orig->pressure; -pt->strength = pt_orig->strength; -pt->time = pt_orig->time; -pt->uv_fac = pt_orig->uv_fac; -pt->uv_rot = pt_orig->uv_rot; -copy_v3_v3(pt->rnd, pt_orig->rnd); -pt->rnd_dirty = pt_orig->rnd_dirty; -copy_v4_v4(pt->vert_color, pt_orig->vert_color); - } /* Spread the points. */ switch (spread) { case 1: { - gpencil_spread_point(brush, gsc, last_index, -1.0f, 0.0f); - gpencil_spread_point(brush, gsc, last_index + 1, 1.0f, 0.0f); + gpencil_spread_point(brush, gsc, pt_index, -1.0f, 0.0f); + gpencil_spread_point(brush, gsc, pt_index + 1, 1.0f, 0.0f); break; } case 2: { - gpencil_spread_point(brush, gsc, last_index, -0.7f, 1.0f); - gpencil_spread_point(brush, gsc, last_index + 2, 0.7f, -1.0f); + gpencil_spread_point(brush, gsc, pt_index, -0.7f, 1.0f); + gpencil_spread_point(brush, gsc, pt_index + 2, 0.7f, -1.0f); break; } case 3: { - gpencil_spread_point(brush, gsc, last_index, -1.0f, 1.0f); - gpencil_spread_point(brush, gsc, last_index + 1, 1.0f, 1.0f); - gpencil_spread_point(brush, gsc, last_index + 3, 0.0f, -1.0f); + gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f); + gpencil_spread_point(brush, gsc, pt_index + 1, 1.0f, 1.0f); + gpencil_spread_point(brush, gsc, pt_index + 3, 0.0f, -1.0f); break; } case 4: { - gpencil_spread_point(brush, gsc, last_index, -1.0f, 1.0f); - gpencil_spread_point(brush, gsc, last_index + 1, 1.0f, 1.0f); - gpencil_spread_point(brush, gsc, last_index + 3, -1.0f, -1.0f); - gpencil_spread_point(brush, gsc, last_index + 4, 1.0f, -1.0f); + gpencil_spread_point(brush, gsc, pt_index, -1.0f, 1.0f); + gpencil_spread_point(brush, gsc, pt_index + 1, 1.0f, 1.0f); + gpencil_spread_point(brush, gsc, pt_index + 3, -1.0f, -1.0f); + gpencil_spread_point(brush, gsc, pt_index + 4, 1.0f, -1.0f); break; } case 5: { - gpencil_spread_point(brush, gsc, last_index, -1.0f, 1.0f); - gpencil_spread_point(brush, gsc, last_
[Bf-blender-cvs] [b50834bb50b] soc-2020-fluid-tools: Fluid: Improvements in Phi grid display
Commit: b50834bb50bd178497c8e28f4f2f5ea4ad4121a5 Author: Sriharsha Kotcharlakot Date: Wed Jun 24 19:03:50 2020 +0530 Branches: soc-2020-fluid-tools https://developer.blender.org/rBb50834bb50bd178497c8e28f4f2f5ea4ad4121a5 Fluid: Improvements in Phi grid display * Changed field texture format from 'GPU_R8' to 'GPU_R16F' for level-set fields to avoid data normalisation. * Fragment coloring for level-set fields is now dynamic and does not depend on transfer texture. === M source/blender/blenlib/BLI_math_color.h M source/blender/blenlib/intern/math_color.c M source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl M source/blender/draw/engines/workbench/workbench_private.h M source/blender/draw/engines/workbench/workbench_shader.c M source/blender/draw/engines/workbench/workbench_volume.c M source/blender/gpu/intern/gpu_draw_smoke.c === diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 547c17f0382..ba95da4092e 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -145,7 +145,6 @@ MINLINE void rgba_uchar_args_test_set(unsigned char col[4], MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack); void blackbody_temperature_to_rgb_table(float *r_table, int width, float min, float max); -void phi_to_rgb(float *r_table, int width, float min, float max); /* lift/gamma/gain / ASC-CDL conversion ***/ diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 06333e1f961..625849c01df 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -714,29 +714,3 @@ void blackbody_temperature_to_rgb_table(float *r_table, int width, float min, fl r_table[i * 4 + 3] = 0.0f; } } - -void phi_to_rgb(float *r_table, int width, float min, float max) -{ - for (int i = 0; i < width; i++) { -float value = min + (max - min) / (float)width * (float)i; - -float rgb[3]; - -value = (value < 1.0f) ? value : 1.0f; -value = (value >= -1.0f) ? value : -1.0f; - -if (value >= 0.0f) { - rgb[0] = value; - rgb[1] = 0.0f; - rgb[2] = 0.5f; -} -else { - rgb[0] = 0.5f; - rgb[1] = 1.0f + value; - rgb[2] = 0.0f; -} - -copy_v3_v3(&r_table[i * 4], rgb); -r_table[i * 4 + 3] = 0.0f; - } -} \ No newline at end of file diff --git a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl index f1893faf669..e61d3473f3d 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl @@ -23,6 +23,8 @@ uniform vec3 activeColor; uniform float slicePosition; uniform int sliceAxis; /* -1 is no slice, 0 is X, 1 is Y, 2 is Z. */ +uniform bool showPhi; + #ifdef VOLUME_SLICE in vec3 localPos; #endif @@ -115,14 +117,29 @@ void volume_properties(vec3 ls_pos, out vec3 scattering, out float extinction) { vec3 co = ls_pos * 0.5 + 0.5; #ifdef USE_COBA - float val = sample_volume_texture(densityTexture, co).r; -# ifdef SHOW_PHI - /* Scaling the value holding 0.5 as neutral. */ - val = 0.5 + (val - 0.5) * gridScale; -# else - val *= gridScale; -# endif - vec4 tval = texture(transferTexture, val) * densityScale; + float val = sample_volume_texture(densityTexture, co).r * gridScale; + vec4 tval; + if(showPhi) { +/* Color mapping for level-set representation */ +val = (val * 0.2 < 1.0) ? val * 0.2 : 1.0; +val = (val >= -1.0) ? val : -1.0; + +if (val >= 0.0) { + tval.r = val; + tval.g = 0.0; + tval.b = 0.5; +} +else { + tval.r = 0.5; + tval.g = 1.0 + val; + tval.b = 0.0; +} +tval.a = 0.06; + } + else { +tval = texture(transferTexture, val); + } + tval *= densityScale; tval.rgb = pow(tval.rgb, vec3(2.2)); scattering = tval.rgb * 1500.0; extinction = max(1e-4, tval.a * 50.0); diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 63f613b93dd..edb2046568c 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -420,8 +420,7 @@ GPUShader *workbench_shader_outline_get(void); GPUShader *workbench_shader_antialiasing_accumulation_get(void); GPUShader *workbench_shader_antialiasing_get(int stage); -GPUShader *workbench_shader_volume_get( -bool slice, bool coba, InterpType cubic, bool smoke, bool show_phi); +GPUShader *workbench_shader_volume_get(bool slice, bool coba, InterpType cubic, bool smoke); void workbench_sh
[Bf-blender-cvs] [daf873c79f8] soc-2020-fluid-tools: Merge branch 'master' into soc-2020-fluid-tools
Commit: daf873c79f8623562507f993e12ff2bbf7c1d683 Author: Sriharsha Kotcharlakot Date: Wed Jun 24 18:57:07 2020 +0530 Branches: soc-2020-fluid-tools https://developer.blender.org/rBdaf873c79f8623562507f993e12ff2bbf7c1d683 Merge branch 'master' into soc-2020-fluid-tools === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [23b5e10dbd7] master: Fix T78112: VSE Sequencer/Preview crash after fullscreen
Commit: 23b5e10dbd7b47553504a24afc35aa1f13bb85eb Author: Julian Eisel Date: Wed Jun 24 15:15:22 2020 +0200 Branches: master https://developer.blender.org/rB23b5e10dbd7b47553504a24afc35aa1f13bb85eb Fix T78112: VSE Sequencer/Preview crash after fullscreen The region refresh callback wasn't called, which in the VSE ensures valid region sizes and removes handlers of invisible regions. === M source/blender/editors/screen/screen_edit.c === diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 6f004238522..b6f210d7f13 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1331,6 +1331,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *area, const oldscreen->animtimer = NULL; ED_screen_change(C, screen); +ED_area_tag_refresh(fullsa); BKE_workspace_layout_remove(CTX_data_main(C), workspace, layout_old); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0a3bde63006] master: Cycles: add denoising settings to the render properties
Commit: 0a3bde63006c66b8b8531ed5eccca9bdf5e5dc20 Author: Brecht Van Lommel Date: Sun May 31 23:49:10 2020 +0200 Branches: master https://developer.blender.org/rB0a3bde63006c66b8b8531ed5eccca9bdf5e5dc20 Cycles: add denoising settings to the render properties Enabling render and viewport denoising is now both done from the render properties. View layers still can individually be enabled/disabled for denoising and have their own denoising parameters. Note that the denoising engine also affects how denoising data passes are output even if no denoising happens on the render itself, to make the passes compatible with the engine. This includes internal refactoring for how denoising parameters are passed along, trying to avoid code duplication and unclear naming. Ref T76259 === M intern/cycles/blender/addon/properties.py M intern/cycles/blender/addon/ui.py M intern/cycles/blender/blender_camera.cpp M intern/cycles/blender/blender_device.cpp M intern/cycles/blender/blender_session.cpp M intern/cycles/blender/blender_sync.cpp M intern/cycles/blender/blender_sync.h M intern/cycles/blender/blender_viewport.cpp M intern/cycles/blender/blender_viewport.h M intern/cycles/device/device.cpp M intern/cycles/device/device.h M intern/cycles/device/device_cpu.cpp M intern/cycles/device/device_cuda.cpp M intern/cycles/device/device_denoising.cpp M intern/cycles/device/device_denoising.h M intern/cycles/device/device_network.cpp M intern/cycles/device/device_opencl.cpp M intern/cycles/device/device_optix.cpp M intern/cycles/device/device_task.h M intern/cycles/render/denoising.cpp M intern/cycles/render/session.cpp M intern/cycles/render/session.h M source/blender/blenkernel/BKE_blender_version.h M source/blender/blenloader/intern/versioning_cycles.c === diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index b7e9b1511ec..061e3784b0d 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -182,10 +182,20 @@ enum_aov_types = ( ('COLOR', "Color", "Write a Color pass", 1), ) -enum_viewport_denoising = ( -('NONE', "None", "Disable viewport denoising", 0), -('OPTIX', "OptiX AI-Accelerated", "Use the OptiX denoiser running on the GPU (requires at least one compatible OptiX device)", 1), -) +def enum_optix_denoiser(self, context): +if not context or bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX')): +return [('OPTIX', "OptiX", "Use the OptiX AI denoiser with GPU acceleration, only available on NVIDIA GPUs", 2)] +return [] + +def enum_preview_denoiser(self, context): +items = [('AUTO', "Auto", "Use the fastest available denoiser for viewport rendering", 0)] +items += enum_optix_denoiser(self, context) +return items + +def enum_denoiser(self, context): +items = [('NLM', "NLM", "Cycles native non-local means denoiser, running on any compute device", 1)] +items += enum_optix_denoiser(self, context) +return items enum_denoising_optix_input_passes = ( ('RGB', "Color", "Use only color as input", 1), @@ -224,11 +234,29 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): description="Pause all viewport preview renders", default=False, ) -preview_denoising: EnumProperty( -name="Viewport Denoising", -description="Denoise the image after each preview update with the selected denoiser engine", -items=enum_viewport_denoising, -default='NONE', + +use_denoising: BoolProperty( +name="Use Denoising", +description="Denoise the rendered image", +default=False, +) +use_preview_denoising: BoolProperty( +name="Use Viewport Denoising", +description="Denoise the image in the 3D viewport", +default=False, +) + +denoiser: EnumProperty( +name="Denoiser", +description="Denoise the image with the selected denoiser", +items=enum_denoiser, +default=1, +) +preview_denoiser: EnumProperty( +name="Viewport Denoiser", +description="Denoise the image after each preview update with the selected denoiser", +items=enum_preview_denoiser, +default=0, ) use_square_samples: BoolProperty( @@ -244,7 +272,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): default=128, ) preview_samples: IntProperty( -name="Preview Samples", +name="Viewport Samples", description="Number of samples to render in the viewport, unlimited if 0", min=0, max=(1 << 24), default=32, @@ -464,7 +492,7 @@ class CyclesRenderSettings(bpy.types.Property
[Bf-blender-cvs] [669befdfbe4] master: Cycles: add Intel OpenImageDenoise support for viewport denoising
Commit: 669befdfbe487f76c65f54e3da0013d140d56893 Author: Brecht Van Lommel Date: Mon Jun 1 00:11:17 2020 +0200 Branches: master https://developer.blender.org/rB669befdfbe487f76c65f54e3da0013d140d56893 Cycles: add Intel OpenImageDenoise support for viewport denoising Compared to Optix denoise, this is usually slower since there is no GPU acceleration. Some optimizations may still be possible, in avoid copies to the GPU and/or denoising less often. The main thing is that this adds viewport denoising support for computers without an NVIDIA GPU (as long as the CPU supports SSE 4.1, which is nearly all of them). Ref T76259 === M intern/cycles/blender/CMakeLists.txt M intern/cycles/blender/addon/properties.py M intern/cycles/blender/addon/ui.py M intern/cycles/blender/blender_python.cpp M intern/cycles/blender/blender_sync.cpp M intern/cycles/device/CMakeLists.txt M intern/cycles/device/device.cpp M intern/cycles/device/device_cpu.cpp M intern/cycles/device/device_task.h M intern/cycles/render/session.cpp M intern/cycles/util/CMakeLists.txt A intern/cycles/util/util_openimagedenoise.h === diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt index 4589f4573d9..2316800e21e 100644 --- a/intern/cycles/blender/CMakeLists.txt +++ b/intern/cycles/blender/CMakeLists.txt @@ -102,6 +102,13 @@ if(WITH_OPENVDB) ) endif() +if(WITH_OPENIMAGEDENOISE) + add_definitions(-DWITH_OPENIMAGEDENOISE) + list(APPEND INC_SYS +${OPENIMAGEDENOISE_INCLUDE_DIRS} + ) +endif() + blender_add_lib(bf_intern_cycles "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") # avoid link failure with clang 3.4 debug diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 061e3784b0d..053de16529c 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -182,14 +182,30 @@ enum_aov_types = ( ('COLOR', "Color", "Write a Color pass", 1), ) +def enum_openimagedenoise_denoiser(self, context): +if _cycles.with_openimagedenoise: +return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)] +return [] + def enum_optix_denoiser(self, context): if not context or bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX')): return [('OPTIX', "OptiX", "Use the OptiX AI denoiser with GPU acceleration, only available on NVIDIA GPUs", 2)] return [] def enum_preview_denoiser(self, context): -items = [('AUTO', "Auto", "Use the fastest available denoiser for viewport rendering", 0)] -items += enum_optix_denoiser(self, context) +optix_items = enum_optix_denoiser(self, context) +oidn_items = enum_openimagedenoise_denoiser(self, context) + +if len(optix_items): +auto_label = "Fastest (Optix)" +elif len(oidn_items): +auto_label = "Fatest (OpenImageDenoise)" +else: +auto_label = "None" + +items = [('AUTO', auto_label, "Use the fastest available denoiser for viewport rendering", 0)] +items += optix_items +items += oidn_items return items def enum_denoiser(self, context): diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index e689ec90983..aa0a47eb9c7 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -1006,6 +1006,8 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel): if denoiser == 'OPTIX': col.prop(cycles_view_layer, "denoising_optix_input_passes") return +elif denoiser == 'OPENIMAGEDENOISE': +return col.prop(cycles_view_layer, "denoising_radius", text="Radius") diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 5595d657640..3e595c3ee52 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -31,6 +31,7 @@ #include "util/util_logging.h" #include "util/util_md5.h" #include "util/util_opengl.h" +#include "util/util_openimagedenoise.h" #include "util/util_path.h" #include "util/util_string.h" #include "util/util_task.h" @@ -1076,5 +1077,14 @@ void *CCL_python_module_init() Py_INCREF(Py_False); #endif /* WITH_EMBREE */ + if (ccl::openimagedenoise_supported()) { +PyModule_AddObject(mod, "with_openimagedenoise", Py_True); +Py_INCREF(Py_True); + } + else { +PyModule_AddObject(mod, "with_openimagedenoise", Py_False); +Py_INCREF(Py_False); + } + return (void *)mod; } diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index aed92cf1376..bf065cc5492 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycle
[Bf-blender-cvs] [073ab4703e2] master: Fix build error on Windows after recent changes
Commit: 073ab4703e2645537963e2641a4fde9a28524c60 Author: Brecht Van Lommel Date: Wed Jun 24 15:14:38 2020 +0200 Branches: master https://developer.blender.org/rB073ab4703e2645537963e2641a4fde9a28524c60 Fix build error on Windows after recent changes === M intern/cycles/util/util_task.h === diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index a56ca62f62c..c3bc14348be 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -19,10 +19,11 @@ #include "util/util_list.h" #include "util/util_string.h" -#include "util/util_tbb.h" #include "util/util_thread.h" #include "util/util_vector.h" +#include "util/util_tbb.h" + CCL_NAMESPACE_BEGIN class TaskPool; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [88157b9efb2] master: Python API: support integer default for bpy.props.EnumProperty
Commit: 88157b9efb2027380c4083d06e4ed61d8d109cef Author: Brecht Van Lommel Date: Wed Jun 24 13:15:28 2020 +0200 Branches: master https://developer.blender.org/rB88157b9efb2027380c4083d06e4ed61d8d109cef Python API: support integer default for bpy.props.EnumProperty This must match the specified number in enum items, and is supported for both static and dynamic enums. Previously dynamic enums did not support a default value at all. === M source/blender/python/intern/bpy_props.c === diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index ade02780210..3df0d805c5b 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -1366,14 +1366,14 @@ static void bpy_prop_enum_set_cb(struct PointerRNA *ptr, struct PropertyRNA *pro } /* utility function we need for parsing int's in an if statement */ -static int py_long_as_int(PyObject *py_long, int *r_int) +static bool py_long_as_int(PyObject *py_long, int *r_int) { if (PyLong_CheckExact(py_long)) { *r_int = (int)PyLong_AS_LONG(py_long); -return 0; +return true; } else { -return -1; +return false; } } @@ -1422,7 +1422,8 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, Py_ssize_t totbuf = 0; int i; short def_used = 0; - const char *def_cmp = NULL; + const char *def_string_cmp = NULL; + int def_int_cmp = 0; if (is_enum_flag) { if (seq_len > RNA_ENUM_BITFLAG_SIZE) { @@ -1441,13 +1442,15 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, } else { if (def) { - def_cmp = _PyUnicode_AsString(def); - if (def_cmp == NULL) { -PyErr_Format(PyExc_TypeError, - "EnumProperty(...): default option must be a 'str' " - "type when ENUM_FLAG is disabled, not a '%.200s'", - Py_TYPE(def)->tp_name); -return NULL; + if (!py_long_as_int(def, &def_int_cmp)) { +def_string_cmp = _PyUnicode_AsString(def); +if (def_string_cmp == NULL) { + PyErr_Format(PyExc_TypeError, + "EnumProperty(...): default option must be a 'str' or 'int' " + "type when ENUM_FLAG is disabled, not a '%.200s'", + Py_TYPE(def)->tp_name); + return NULL; +} } } } @@ -1474,10 +1477,10 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) && /* TODO, number isn't ensured to be unique from the script author */ -(item_size != 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1) && -(item_size != 5 || ((py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.icon) != -1 || +(item_size != 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value)) && +(item_size != 5 || ((py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.icon) || (tmp_icon = _PyUnicode_AsString(PyTuple_GET_ITEM(item, 3 && -py_long_as_int(PyTuple_GET_ITEM(item, 4), &tmp.value) != -1))) { +py_long_as_int(PyTuple_GET_ITEM(item, 4), &tmp.value { if (is_enum_flag) { if (item_size < 4) { tmp.value = 1 << i; @@ -1493,9 +1496,12 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, tmp.value = i; } -if (def && def_used == 0 && STREQ(def_cmp, tmp.identifier)) { - *defvalue = tmp.value; - def_used++; /* only ever 1 */ +if (def && def_used == 0) { + if ((def_string_cmp != NULL && STREQ(def_string_cmp, tmp.identifier)) || + (def_string_cmp == NULL && def_int_cmp == tmp.value)) { +*defvalue = tmp.value; +def_used++; /* only ever 1 */ + } } } @@ -1537,9 +1543,16 @@ static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, if (def && def_used == 0) { MEM_freeN(items); - PyErr_Format(PyExc_TypeError, - "EnumProperty(..., default=\'%s\'): not found in enum members", - def_cmp); + if (def_string_cmp) { +PyErr_Format(PyExc_TypeError, + "EnumProperty(..., default=\'%s\'): not found in enum members", + def_string_cmp); + } + else { +PyErr_Format(PyExc_TypeError, + "EnumProperty(..., default=%d): not found in enum members", + def_int_cmp); + } return NULL; } } @@ -3001,13 +3014,12 @@ PyDoc_STRVAR( " :type items: sequence of string tuples o
[Bf-blender-cvs] [756e664e4f4] master: Fix T77913: Incorrect handling of negative-scale bit in DRWResourceHandle
Commit: 756e664e4f4474401627d261f35e35a2b198bea6 Author: Jacques Lucke Date: Wed Jun 24 14:42:46 2020 +0200 Branches: master https://developer.blender.org/rB756e664e4f4474401627d261f35e35a2b198bea6 Fix T77913: Incorrect handling of negative-scale bit in DRWResourceHandle Reviewers: fclem Differential Revision: https://developer.blender.org/D8103 === M source/blender/draw/intern/draw_manager_data.c === diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 01cecc338c7..8a99907e5db 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -577,7 +577,7 @@ uint32_t DRW_object_resource_id_get(Object *UNUSED(ob)) /* Handle not yet allocated. Return next handle. */ handle = DST.resource_handle; } - return handle; + return handle & ~(1 << 31); } static DRWResourceHandle drw_resource_handle(DRWShadingGroup *shgroup, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e59712b7c80] master: Sculpt: rename default vertex color layer name from Col to Color
Commit: e59712b7c80358f7912eebd55ef08c8cc6daafc4 Author: Brecht Van Lommel Date: Wed Jun 24 14:17:44 2020 +0200 Branches: master https://developer.blender.org/rBe59712b7c80358f7912eebd55ef08c8cc6daafc4 Sculpt: rename default vertex color layer name from Col to Color No need for abbreviation here, and helps avoid conflicts with old vertex color layers. Ref T76659 === M source/blender/blenkernel/intern/customdata.c === diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 642a865afab..76d31ab30b4 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1783,7 +1783,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { {sizeof(MPropCol), "MPropCol", 1, - N_("Col"), + N_("Color"), NULL, NULL, layerInterp_propcol, ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e389c05410b] master: Cleanup: move TBB includes into own header
Commit: e389c05410b0a03eb76f5430801f37780bf4ee1b Author: Brecht Van Lommel Date: Tue Jun 23 15:06:00 2020 +0200 Branches: master https://developer.blender.org/rBe389c05410b0a03eb76f5430801f37780bf4ee1b Cleanup: move TBB includes into own header === M intern/cycles/util/CMakeLists.txt M intern/cycles/util/util_task.h A intern/cycles/util/util_tbb.h === diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index 2ba30cdb8af..4f66ced1c5a 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -113,6 +113,7 @@ set(SRC_HEADERS util_string.h util_system.h util_task.h + util_tbb.h util_texture.h util_thread.h util_time.h diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index ef1d2d70800..a56ca62f62c 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -19,22 +19,12 @@ #include "util/util_list.h" #include "util/util_string.h" +#include "util/util_tbb.h" #include "util/util_thread.h" #include "util/util_vector.h" -#define TBB_SUPPRESS_DEPRECATED_MESSAGES 1 -#include - -#if TBB_INTERFACE_VERSION_MAJOR >= 10 -# define WITH_TBB_GLOBAL_CONTROL -#endif - CCL_NAMESPACE_BEGIN -using tbb::blocked_range; -using tbb::enumerable_thread_specific; -using tbb::parallel_for; - class TaskPool; class TaskScheduler; diff --git a/intern/cycles/util/util_tbb.h b/intern/cycles/util/util_tbb.h new file mode 100644 index 000..7a3dacb3a9d --- /dev/null +++ b/intern/cycles/util/util_tbb.h @@ -0,0 +1,35 @@ +/* + * Copyright 2011-2020 Blender Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __UTIL_TBB_H__ +#define __UTIL_TBB_H__ + +#define TBB_SUPPRESS_DEPRECATED_MESSAGES 1 +#include + +#if TBB_INTERFACE_VERSION_MAJOR >= 10 +# define WITH_TBB_GLOBAL_CONTROL +#endif + +CCL_NAMESPACE_BEGIN + +using tbb::blocked_range; +using tbb::enumerable_thread_specific; +using tbb::parallel_for; + +CCL_NAMESPACE_END + +#endif /* __UTIL_TBB_H__ */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a6c59863d38] master: EEVEE: Fix crash when using motion blur without postfx blur
Commit: a6c59863d38fa81a58744f7fc5b400254de5f59e Author: Clément Foucault Date: Wed Jun 24 14:27:35 2020 +0200 Branches: master https://developer.blender.org/rBa6c59863d38fa81a58744f7fc5b400254de5f59e EEVEE: Fix crash when using motion blur without postfx blur === M source/blender/draw/engines/eevee/eevee_engine.c === diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 83d2168af8e..a5df774656a 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -470,8 +470,6 @@ static void eevee_render_to_image(void *vedata, /* The previous step of this iteration N is exactly the next step of iteration N - 1. * So we just swap the resources to avoid too much re-evaluation. */ EEVEE_motion_blur_swap_data(vedata); - -DRW_cache_restart(); } else { EEVEE_motion_blur_step_set(ved, MB_PREV); @@ -536,6 +534,12 @@ static void eevee_render_to_image(void *vedata, EEVEE_temporal_sampling_create_view(vedata); EEVEE_render_draw(vedata, engine, render_layer, rect); + + if (i < time_steps_tot - 1) { +/* Don't reset after the last loop. Since EEVEE_render_read_result + * might need some DRWPasses. */ +DRW_cache_restart(); + } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [074929d1c5f] master: MEM_guardedalloc: allow freeing const arrays with MEM_SAFE_FREE
Commit: 074929d1c5f5b0e9a4da3c3058cc9f3038fb2910 Author: Campbell Barton Date: Wed Jun 24 22:08:49 2020 +1000 Branches: master https://developer.blender.org/rB074929d1c5f5b0e9a4da3c3058cc9f3038fb2910 MEM_guardedalloc: allow freeing const arrays with MEM_SAFE_FREE 'const' arrays couldn't use this macro with GNUC. === M intern/guardedalloc/MEM_guardedalloc.h === diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 602297576c8..bbba69edf1d 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -187,7 +187,8 @@ extern size_t (*MEM_get_peak_memory)(void) ATTR_WARN_UNUSED_RESULT; do { \ typeof(&(v)) _v = &(v); \ if (*_v) { \ -MEM_freeN(*_v); \ +/* Cast so we can free constant arrays. */ \ +MEM_freeN((void *)*_v); \ *_v = NULL; \ } \ } while (0) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [dd328be0f08] master: Fix memory leak calculating deform modifiers in edit-mode
Commit: dd328be0f08bc79125f9bc862d814e49c213b2f3 Author: Campbell Barton Date: Wed Jun 24 22:09:40 2020 +1000 Branches: master https://developer.blender.org/rBdd328be0f08bc79125f9bc862d814e49c213b2f3 Fix memory leak calculating deform modifiers in edit-mode This bug goes back to 2.80 but doesn't seem to have been reported. === M source/blender/blenkernel/BKE_mesh_runtime.h M source/blender/blenkernel/intern/DerivedMesh.c M source/blender/blenkernel/intern/mesh_runtime.c === diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h b/source/blender/blenkernel/BKE_mesh_runtime.h index fdddafcc71f..468ec6a44cd 100644 --- a/source/blender/blenkernel/BKE_mesh_runtime.h +++ b/source/blender/blenkernel/BKE_mesh_runtime.h @@ -49,6 +49,7 @@ void BKE_mesh_runtime_looptri_recalc(struct Mesh *mesh); const struct MLoopTri *BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh); bool BKE_mesh_runtime_ensure_edit_data(struct Mesh *mesh); bool BKE_mesh_runtime_clear_edit_data(struct Mesh *mesh); +bool BKE_mesh_runtime_reset_edit_data(struct Mesh *mesh); void BKE_mesh_runtime_clear_geometry(struct Mesh *mesh); void BKE_mesh_runtime_clear_cache(struct Mesh *mesh); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index b4e2cd772c9..8a5be6b9cb3 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1669,7 +1669,9 @@ static void editbmesh_calc_modifiers(struct Depsgraph *depsgraph, else { Mesh *me_orig = mesh_input; if (me_orig->id.tag & LIB_TAG_COPIED_ON_WRITE) { - BKE_mesh_runtime_ensure_edit_data(me_orig); + if (!BKE_mesh_runtime_ensure_edit_data(me_orig)) { +BKE_mesh_runtime_reset_edit_data(me_orig); + } me_orig->runtime.edit_data->vertexCos = MEM_dupallocN(deformed_verts); } mesh_cage = BKE_mesh_wrapper_from_editmesh_with_coords( diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c index 8bce577897b..932423bc445 100644 --- a/source/blender/blenkernel/intern/mesh_runtime.c +++ b/source/blender/blenkernel/intern/mesh_runtime.c @@ -203,26 +203,31 @@ bool BKE_mesh_runtime_ensure_edit_data(struct Mesh *mesh) return true; } +bool BKE_mesh_runtime_reset_edit_data(Mesh *mesh) +{ + EditMeshData *edit_data = mesh->runtime.edit_data; + if (edit_data == NULL) { +return false; + } + + MEM_SAFE_FREE(edit_data->polyCos); + MEM_SAFE_FREE(edit_data->polyNos); + MEM_SAFE_FREE(edit_data->vertexCos); + MEM_SAFE_FREE(edit_data->vertexNos); + + return true; +} + bool BKE_mesh_runtime_clear_edit_data(Mesh *mesh) { if (mesh->runtime.edit_data == NULL) { return false; } + BKE_mesh_runtime_reset_edit_data(mesh); - if (mesh->runtime.edit_data->polyCos != NULL) { -MEM_freeN((void *)mesh->runtime.edit_data->polyCos); - } - if (mesh->runtime.edit_data->polyNos != NULL) { -MEM_freeN((void *)mesh->runtime.edit_data->polyNos); - } - if (mesh->runtime.edit_data->vertexCos != NULL) { -MEM_freeN((void *)mesh->runtime.edit_data->vertexCos); - } - if (mesh->runtime.edit_data->vertexNos != NULL) { -MEM_freeN((void *)mesh->runtime.edit_data->vertexNos); - } + MEM_freeN(mesh->runtime.edit_data); + mesh->runtime.edit_data = NULL; - MEM_SAFE_FREE(mesh->runtime.edit_data); return true; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9b3dfbe6513] master: Fix T77672 EEVEE: Reflections with reflection plane broken (regression)
Commit: 9b3dfbe6513106c71faa50d09fbe27a071b3194f Author: Clément Foucault Date: Wed Jun 24 13:50:20 2020 +0200 Branches: master https://developer.blender.org/rB9b3dfbe6513106c71faa50d09fbe27a071b3194f Fix T77672 EEVEE: Reflections with reflection plane broken (regression) === M source/blender/draw/engines/eevee/eevee_lightprobes.c === diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 83b2a9bb6d4..71c8294d123 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -957,8 +957,8 @@ static void lightbake_render_scene_reflected(int layer, EEVEE_BakeRenderData *us /* Slight modification: we handle refraction as normal * shading and don't do SSRefraction. */ - DRW_draw_pass(psl->depth_ps); - DRW_draw_pass(psl->depth_refract_ps); + DRW_draw_pass(psl->depth_clip_ps); + DRW_draw_pass(psl->depth_refract_clip_ps); DRW_draw_pass(psl->probe_background); EEVEE_create_minmax_buffer(vedata, tmp_planar_depth, layer); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [be0622533de] master: Fix T78190 EEVEE: Render passes broken in final render
Commit: be0622533de28d6338797cab65999183572f44f8 Author: Clément Foucault Date: Wed Jun 24 13:23:30 2020 +0200 Branches: master https://developer.blender.org/rBbe0622533de28d6338797cab65999183572f44f8 Fix T78190 EEVEE: Render passes broken in final render This was caused by the step motion blur implementation. `DRW_cache_restart` was reseting the cache and cause `EEVEE_renderpasses_postprocess` to not work inside `EEVEE_render_read_result`. === M source/blender/draw/engines/eevee/eevee_engine.c M source/blender/draw/engines/eevee/eevee_private.h M source/blender/draw/engines/eevee/eevee_renderpasses.c === diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 55a20a0f6bb..83d2168af8e 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -166,6 +166,7 @@ static void eevee_cache_finish(void *vedata) EEVEE_materials_cache_finish(sldata, vedata); EEVEE_lights_cache_finish(sldata, vedata); EEVEE_lightprobes_cache_finish(sldata, vedata); + EEVEE_renderpasses_cache_finish(sldata, vedata); EEVEE_subsurface_draw_init(sldata, vedata); EEVEE_effects_draw_init(sldata, vedata); @@ -469,6 +470,8 @@ static void eevee_render_to_image(void *vedata, /* The previous step of this iteration N is exactly the next step of iteration N - 1. * So we just swap the resources to avoid too much re-evaluation. */ EEVEE_motion_blur_swap_data(vedata); + +DRW_cache_restart(); } else { EEVEE_motion_blur_step_set(ved, MB_PREV); @@ -517,6 +520,7 @@ static void eevee_render_to_image(void *vedata, EEVEE_materials_cache_finish(sldata, vedata); EEVEE_lights_cache_finish(sldata, vedata); EEVEE_lightprobes_cache_finish(sldata, vedata); + EEVEE_renderpasses_cache_finish(sldata, vedata); EEVEE_subsurface_draw_init(sldata, vedata); EEVEE_effects_draw_init(sldata, vedata); @@ -532,8 +536,6 @@ static void eevee_render_to_image(void *vedata, EEVEE_temporal_sampling_create_view(vedata); EEVEE_render_draw(vedata, engine, render_layer, rect); - - DRW_cache_restart(); } } diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 239a1ddcc1f..5005c5a8ba9 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -1220,6 +1220,7 @@ void EEVEE_renderpasses_init(EEVEE_Data *vedata); void EEVEE_renderpasses_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, uint tot_samples); +void EEVEE_renderpasses_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_renderpasses_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, bool post_effect); diff --git a/source/blender/draw/engines/eevee/eevee_renderpasses.c b/source/blender/draw/engines/eevee/eevee_renderpasses.c index 9a47ca19e7b..be771d7cf42 100644 --- a/source/blender/draw/engines/eevee/eevee_renderpasses.c +++ b/source/blender/draw/engines/eevee/eevee_renderpasses.c @@ -136,24 +136,13 @@ void EEVEE_renderpasses_output_init(EEVEE_ViewLayerData *sldata, { EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_TextureList *txl = vedata->txl; - EEVEE_PassList *psl = vedata->psl; EEVEE_StorageList *stl = vedata->stl; EEVEE_EffectsInfo *effects = stl->effects; EEVEE_PrivateData *g_data = stl->g_data; - DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); const bool needs_post_processing = (g_data->render_passes & EEVEE_RENDERPASSES_WITH_POST_PROCESSING) > 0; if (needs_post_processing) { -if (e_data.postprocess_sh == NULL) { - char *frag_str = BLI_string_joinN(datatoc_common_view_lib_glsl, -datatoc_common_uniforms_lib_glsl, -datatoc_bsdf_common_lib_glsl, - datatoc_renderpass_postprocess_frag_glsl); - e_data.postprocess_sh = DRW_shader_create_fullscreen(frag_str, NULL); - MEM_freeN(frag_str); -} - /* Create FrameBuffer. */ /* Should be enough to store the data needs for a single pass. @@ -188,29 +177,51 @@ void EEVEE_renderpasses_output_init(EEVEE_ViewLayerData *sldata, EEVEE_volumes_output_init(sldata, vedata, tot_samples); } -/* Create Pass. */ -DRW_PASS_CREATE(psl->renderpass_pass, DRW_STATE_WRITE_COLOR); -DRWShadingGroup *grp = DRW_shgroup_create(e_data.postprocess_sh, psl->renderpass_pass); /* We set a default
[Bf-blender-cvs] [6f5a9dd8dea] master: Fix T78172: Undo crash due to IDTemplate operations missing undo push.
Commit: 6f5a9dd8dea8a20e9ca298bb713786a247b9c9d3 Author: Bastien Montagne Date: Wed Jun 24 12:51:08 2020 +0200 Branches: master https://developer.blender.org/rB6f5a9dd8dea8a20e9ca298bb713786a247b9c9d3 Fix T78172: Undo crash due to IDTemplate operations missing undo push. This should be included in 2.83 as well. === M source/blender/editors/interface/interface_templates.c === diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index c3a432d6bcc..16b6b313f69 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -511,6 +511,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) PointerRNA idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); ID *id = idptr.data; int event = POINTER_AS_INT(arg_event); + const char *undo_push_label = NULL; switch (event) { case UI_ID_BROWSE: @@ -531,6 +532,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) id_us_clear_real(id); id_fake_user_clear(id); id->us = 0; +undo_push_label = "Delete Data-Block"; } break; @@ -542,6 +544,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) else { id_us_min(id); } +undo_push_label = "Fake User"; } else { return; @@ -572,6 +575,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) } RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL); RNA_property_update(C, &template_ui->ptr, template_ui->prop); +undo_push_label = "Make Local"; } break; case UI_ID_OVERRIDE: @@ -581,6 +585,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) idptr = RNA_property_pointer_get(&template_ui->ptr, template_ui->prop); RNA_property_pointer_set(&template_ui->ptr, template_ui->prop, idptr, NULL); RNA_property_update(C, &template_ui->ptr, template_ui->prop); +undo_push_label = "Override Data-Block"; } break; case UI_ID_ALONE: @@ -601,6 +606,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) id_single_user(C, id, &template_ui->ptr, template_ui->prop); DEG_relations_tag_update(bmain); } +undo_push_label = "Make Single User"; } break; #if 0 @@ -608,6 +614,10 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) break; #endif } + + if (undo_push_label != NULL) { +ED_undo_push(C, undo_push_label); + } } static const char *template_id_browse_tip(const StructRNA *type) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [105d94aa2bd] particle-solver-dev: Minor clean up
Commit: 105d94aa2bd0c56d12ffb2afa243431045d157e5 Author: Sebastian Parborg Date: Wed Jun 24 09:58:44 2020 +0200 Branches: particle-solver-dev https://developer.blender.org/rB105d94aa2bd0c56d12ffb2afa243431045d157e5 Minor clean up === M source/blender/simulations/bparticles/simulate.cpp === diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp index 07a9ef10f08..43d4a474e6b 100644 --- a/source/blender/simulations/bparticles/simulate.cpp +++ b/source/blender/simulations/bparticles/simulate.cpp @@ -106,14 +106,6 @@ static float collision_newton_rhapson(std::pair &particle_points point_on_plane = p; } -// printf("t = 0, d0 = %f\n", d0); - -// print_v3("p", p); -// print_v3("first", particle_points.first); -// print_v3("second", particle_points.second); -// print_v3("point on plane", point_on_plane); -// printf("t0\n"); - return 0.f; } @@ -169,15 +161,7 @@ static float collision_newton_rhapson(std::pair &particle_points point_on_plane = p; } -// printf("old_d %f\n", new_d); -// printf("new_d %f\n", (point_on_plane - p2).length()); -// print_v3("p", p); -// print_v3("first", particle_points.first); -// print_v3("second", particle_points.second); -// print_v3("point on plane", point_on_plane); - CLAMP(t1, 0.f, 1.f); -// printf("t1 last: %f\n", t1); return t1; } else { @@ -331,16 +315,21 @@ BLI_NOINLINE static void raycast_callback(void *userdata, rd->duration; } -// printf("Best hit so far!\n"); - copy_v3_v3(hit->co, point_on_plane); copy_v3_v3(hit->no, coll_normal); } } +// TODO come up with a better function name... static float3 min_add(float3 a, float3 b) { - // TODO come up with a better function name... + + if (dot_v3v3(a, b) == -1.0f) { +// If a == -b then we will get NaN in this function. +// So just return a and hope for the best. +return a; + } + if (is_zero_v3(a)) { return b; } @@ -363,10 +352,6 @@ static float3 min_add(float3 a, float3 b) proj = float3::project(a, b); } - // TODO do a NaN check here in case a == -b which will lead to division by zero. - - // print_v3("proj", proj); - b += a - proj; return b; @@ -393,11 +378,7 @@ BLI_NOINLINE static void simulate_particle_chunk(SimulationState &UNUSED(simulat MutableArrayRef velocities = attributes.get("Velocity"); MutableArrayRef positions = attributes.get("Position"); MutableArrayRef sizes = attributes.get("Size"); - MutableArrayRef dead_state = attributes.get("Dead"); - - // system_info.collision_objects - // simulation_state.m_depsgraph; - // cloth_bvh_collision + // MutableArrayRef dead_state = attributes.get("Dead"); for (uint pindex : IndexRange(amount)) { // if (pindex != 422) { @@ -456,7 +437,6 @@ BLI_NOINLINE static void simulate_particle_chunk(SimulationState &UNUSED(simulat hit.index = -1; hit.dist = max_move; - // TODO the particle radius seems a bit flaky with higher distances? float particle_radius = sizes[pindex]; float3 start = positions[pindex]; @@ -486,14 +466,12 @@ BLI_NOINLINE static void simulate_particle_chunk(SimulationState &UNUSED(simulat // We didn't hit anything continue; } - if (false && prev_collider == collmd && prev_hit_idx == hit.index) { -// TODO look into removing this check as it shouldn't be needed anymore. If the -// particle hits the same face twice in a row, it must be because it couldn't move -// enough and should be poked again by this face. - + if (!collmd->is_static && prev_collider == collmd && prev_hit_idx == hit.index) { // We collided with the same face twice in a row. // Skip collision handling here as the set velocity from the previous collision // handling should keep the particle from tunneling through the face. +// (If it is static, otherwise dampening and friction might make it collide again +// during the same time step) continue; } @@ -533,14 +511,6 @@ BLI_NOINLINE static void simulate_particle_chunk(SimulationState &UNUSED(simulat float dot_epsilon = 1e-5f; - // printf(" COLLIDED \n"); - // print_v3("best_hit", best_hit.co); - - // print_v3("hit normal", normal); - // print_v3("hit velo", best_hit_vel); - // print_v3("part velo", velocities[pindex]); - // print_v3("const vel pre", constraint_velo); - // Modify constraint_velo so if it is along the collider normal if it is moving into