Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-01-12BLI: Refactor vector types & functions to use templatesClment Foucault
This patch implements the vector types (i.e:`float2`) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the `blender::math` namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. ####Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: `float3::reflect()`). ####Upsides: - Still support `.x, .y, .z, .w` for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. ####Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call `len_squared_v3v3` in `math::length_squared()` and call it a day. - Type cast does not work with the template version of the `math::` vector functions. Meaning you need to manually cast `float *` and `(float *)[3]` to `float3` for the function calls. i.e: `math::distance_squared(float3(nearest.co), positions[i]);` - Some parts might loose in readability: `float3::dot(v1.normalized(), v2.normalized())` becoming `math::dot(math::normalize(v1), math::normalize(v2))` But I propose, when appropriate, to use `using namespace blender::math;` on function local or file scope to increase readability. `dot(normalize(v1), normalize(v2))` ####Consideration: - Include back `.length()` method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches `delaunay_2d.cc` and the intersection code. I would like to know @howardt opinion on the matter. - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed. But according to @JacquesLucke it is not a real problem for now. I would like to give a huge thanks to @JacquesLucke who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: https://developer.blender.org/D13791
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Reverted because the commit removes a lot of commits. This reverts commit a2c1c368af48644fa8995ecbe7138cc0d7900c30.
2022-01-12Compositor: Add Scene Time Node, Rename Time nodeNathan Rozendaal
Fixes issue T94603 It adds a new compositor node called Scene Time which is already present as a geo node, having the same basic nodes available in all node trees is a nice thing to have. Renames "Time" node to "Time Curve", this is done to avoid confusion between the Time node and the Scene Time node. Reviewed By: jbakker Maniphest Tasks: T94603 Differential Revision: https://developer.blender.org/D13762
2022-01-12BLI: Refactor vector types & functions to use templatesClément Foucault
This patch implements the vector types (i.e:float2) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the blender::math namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the BLI_(float|double|mpq)(2|3|4).hh is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: float3::reflect()). Upsides: - Still support .x, .y, .z, .w for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call len_squared_v3v3 in math::length_squared() and call it a day. - Type cast does not work with the template version of the math:: vector functions. Meaning you need to manually cast float * and (float *)[3] to float3 for the function calls. i.e: math::distance_squared(float3(nearest.co), positions[i]); - Some parts might loose in readability: float3::dot(v1.normalized(), v2.normalized()) becoming math::dot(math::normalize(v1), math::normalize(v2)) But I propose, when appropriate, to use using namespace blender::math; on function local or file scope to increase readability. dot(normalize(v1), normalize(v2)) Consideration: - Include back .length() method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches delaunay_2d.cc and the intersection code. I would like to know @Howard Trickey (howardt) opinion on the matter. - The noexcept on the copy constructor of mpq(2|3) is being removed. But according to @Jacques Lucke (JacquesLucke) it is not a real problem for now. I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: http://developer.blender.org/D13791
2022-01-12Cleanup: make formatDalai Felinto
2022-01-12Fix T94797: crash when playing animation in eevee rendered viewJacques Lucke
The issue was caused by rBd09b1d2759861aa012ab2e7e4ce2ffa2. Since this commit, the image users in gpu materials were updated during depsgraph evaluation as well. However, there was a race condition when one thread is deleting gpu materials in `BKE_material_eval` while another thread is updating the image users at the same time. The solution is to make sure that deleting gpu materials is done before iterating over all gpu materials, by adding a new depsgraph relation.
2022-01-12Fix T94812: render layer sockets are missing after file loadJacques Lucke
The main issue was the use of `G_MAIN` during file load. This patch refactors the code so that iterating over `G_MAIN` is not necessary anymore. See D13800 for more details. Differential Revision: https://developer.blender.org/D13800
2022-01-12Fix T94041: Loading a new file gives crash while rendering in viewportSergey Sharybin
The issue was caused by Cycles display driver not being able to restore window's OpenGL context after disposing Cycles-side OpenGL context. This is due to the window OpenGL re-activation needing to access window manager which gets cleared out form global main during file reading. Defer clearing window manager from the global main to until after all screens are "exited". This allows Cycles to properly stop rendering, dispose its OpenGL context, and restore window's drawable context. It is unclear why it was required to clear window manager list early on. Guess is that it comes from an original code in a1c8543f2ac where there was an early return which then got replaced with an actual logic without changing the order of de-initialization and window manager list clear. Differential Revision: https://developer.blender.org/D13799
2022-01-12CMake: exclude linker options for APPLE and non-UNIXCampbell Barton
These are only used for non-apple unix systems.
2022-01-12Revert "Cleanup GPencil strength previous commit"Antonio Vazquez
This reverts commit e339946515b00bc230bad2ec52a729dd914a8af3. This broken the tablet pressure and it was impossible to set a proper strength.
2022-01-12Cleanup: use utility functionsKévin Dietrich
2022-01-12Fix T89542: Crash when loading certain .hdr filesJesse Yurkovich
The direct cause of the bug in question was passing in the raw memory buffer to sscanf. It should be called with a null-terminated buffer; which isn't guaranteed when blindly trusting the file data. When attempting to fuzz this code path, a variety of other crashes were discovered and fixed. Differential Revision: https://developer.blender.org/D11952
2022-01-12Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
2022-01-12Cleanup: VSE channel drawingRichard Antalik
Remove code that very slightly darkened line on bottom of timeline, when backdrop is enabled. Purpose of the code wasn't dodumented, and 2.79 doesn't seem to produce this darkened line. Rename drawing functions to appropriate names.
2022-01-12deps_builder: GMP 6.2.1Ray Molenkamp
Pretty straightforward update, nothing noteworthy to report. Differential Revision: https://developer.blender.org/D13278 Reviewed by: brecht, sybren
2022-01-12BLF: UI_fontstyle_draw UsageHarley Acheson
Add maximum string length argument to UI_fontstyle_draw to reduce usage of BLF_DRAW_STR_DUMMY_MAX. Reorders arguments to UI_fontstyle_draw_ex See D13794 for more details. Differential Revision: https://developer.blender.org/D13794 Reviewed by Campbell Barton
2022-01-12BLF: Reduction of use of BLF_DRAW_STR_DUMMY_MAXHarley Acheson
Reduction of the number of uses of the define BLF_DRAW_STR_DUMMY_MAX by using actual sizes of static character arrays. See D13793 for more details. Differential Revision: https://developer.blender.org/D13793 Reviewed by Campbell Barton
2022-01-12Fix T94751: ground created by Setup Tracking Scene not marked as Shadow CatcherGermano Cavalcante
Change that was missing in {rBca64bd0aacda}.
2022-01-12Cleanup: Fix build warning with MSVCRay Molenkamp
comparing a bool > 0 make MSVC emit warning C4804: '>': unsafe use of type 'bool' in operation. int does the job nicely.
2022-01-12Build: Enable unity build for `bf_compositor`Aaron Carlisle
Blender's compositor code already makes extensive use of namespace which makes it very simple to enable unity build. There was one duplicated function that has since to be moved to a common header. I saw roughly a 3x speedup of bf_compositor using ninja on linux using i5 8250u (1:34 down to 0:34). Reviewed By: LazyDodo Differential Revision: https://developer.blender.org/D13792
2022-01-12Build: Add precompiled headers for `bf_compositor`Aaron Carlisle
With this change, compilation saw a 2.4x improvement. This can be combined with unity build to give an overall 4x improvement Depends on D13797 Reviewed By: LazyDodo Differential Revision: https://developer.blender.org/D13798
2022-01-12cleanup: hipew remove unused variablesRay Molenkamp
caused 4 warnings, nothing even conditionally uses them, can be safely removed.
2022-01-12Cleanup previous commitAntonio Vazquez
Don't need check minimum constant value, brush value is enough.
2022-01-12Fix T94799: GPencil Strokes drawn at 0.0 Strength still visibleAntonio Vazquez
There was a clamp with a value greater than 0.
2022-01-11Fix T93588: some videos loaded flipped over Y axis on macOS ArmBrecht Van Lommel
Was not actually flipping in the need_aligned_ffmpeg_buffer case.
2022-01-11IME Cleanup: Unused GHOST_TEventImeData MemberHarley Acheson
Removal of unused tmp member of GHOST_TEventImeData. Not used now, nor was it used by the commit that added it to begin with. Differential Revision: https://developer.blender.org/D11799 Reviewed by Ray Molenkamp
2022-01-11Cleanup: Fix build warnings with MSVCRay Molenkamp
our UNUSED macro is essentially a no-op for MSVC, which lead to the situation where this well meant macro was emitting the following warning: C4189: 'UNUSED_i': local variable is initialized but not referenced However since we have been on c++17 for a while now the UNUSED macro can be replaced with the standard [[maybe_unused]] attribute in cpp files. This changes cleans up the use of the UNUSED macro in the bf_nodes_geometry project. Differential Revision: https://developer.blender.org/D12915 Reviewed by: JacquesLucke, Severin, Sergey, HooglyBoogly
2022-01-11Build: use precompiled headers on all platformsAaron Carlisle
Since CMake 3.16, CMake has native precompiled header (PCH) support. This change swaps Blender's own PCH implementation with the native implementation. Previously, PCH was only enabled on Windows however, this new implementation works on all platforms. For more information see https://cmake.org/cmake/help/latest/command/target_precompile_headers.html On my system, Linux with ninja running on an i5 8250U I saw a 60% reduction in compile times for `bf_freestyle` + linking time. Reviewed By: LazyDodo, brecht Differential Revision: https://developer.blender.org/D13797
2022-01-11Fix T94804: GPencil Simplify when strokes are Automerged in Draw ModeAntonio Vazquez
The problem was the points were selected in edit mode and then sampled. Now, in draw mode, the points are always unselected to avoid this effect in the auto merge process.
2022-01-11Add support for a longest diagonal quad triangulation modeHenrik Dick
The new triangulation mode for quads is the opposite of the current default shortest diagonal mode. It is optimal for cloth simulations using quad meshes. Differential Revision: http://developer.blender.org/D13777
2022-01-11Fix T94299: Object asset set as visible but doesn't showJulian Eisel
Differential Revision: https://developer.blender.org/D13738 Reviewed by: Bastien Montagne, Sergey Sharybin
2022-01-11Cleanup compiler warning in WindowsAntonio Vazquez
`bool` used instead of `int`
2022-01-11Fix T94728: Auto Depth problem with Cliping RegionGermano Cavalcante
Issue introduced in rB1d49293b80446b89b5b12fa0eeefaf14e5051e48 `drw_manager_init` must be called after `drw_context_state_init` as `DST.draw_ctx.sh_cfg` (indicating when the view is clipped) must be set first. Differential Revision: https://developer.blender.org/D13795
2022-01-11Cleanup: remove unnecessary 'use_opengl_context' parameterGermano Cavalcante
The argument passed is always false.
2022-01-11Fix `PSYS_GLOBAL_HAIR` stripped even if connecting the hair failsAleksi Juvani
After disconnecting hair on an object, if you then hide the particle system, and try connecting the hair again, the operator is cancelled due to `remap_hair_emitter` returning `false` because `target_psmd->mesh_final` is NULL, but `connect_hair` will still strip the `PSYS_GLOBAL_HAIR` flag, which will cause the hair in the hidden particle system to be positioned incorrectly. The correct behavior is to strip the flag only if `remap_hair_emitter` succeeds. Differential Revision: https://developer.blender.org/D13703
2022-01-11Select Similar: hide 'threshold' from UI when not usedPhilipp Oeser
When the 'threshold' is not used in the type we are comparing, just hide it. This was obvious for some types (e.g. Materials), but maybe not so on others (e.g. Polygon Sides) and potentionally confusing. Reported by @hitrpr in chat. Differential Revision: https://developer.blender.org/D13760
2022-01-11GPU: Utility function to bind UBO to batches.Jeroen Bakker
2022-01-11Explicit Color OCIO role comment fix.Evan Wilson
This is an update to the correct OCIO role. It changes `SceneReference` to `scene_linear` See https://opencolorio.readthedocs.io/en/latest/guides/authoring/overview.html#config-roles > - reference - the color space against which the other color spaces are defined >NOTE: The reference role has sometimes been misinterpreted as being the space in which “reference art” is stored in. > > - scene_linear - the scene-referred linear-to-light color space, often the same as the reference space The current OCIO UX working group doc says: >reference: This role has had multiple interpreted meanings over the years and is a common point of confusion. It is kept in OCIO for backwards compatibility, but the recommendation is that it is not used by apps. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D11398
2022-01-11Cleanup: use unity build for composite nodesAaron Carlisle
GIves about a 2.1x improvement in compilation times.
2022-01-11Cleanup: Deduplicate `finv_test` functionAaron Carlisle
2022-01-11Cleanup: quite missing-variable-declarations warningsCampbell Barton
2022-01-11Cleanup: correct exception messageCampbell Barton
2022-01-11Revert "Cleanup: remove declaration for removed function"Campbell Barton
This reverts commit aa363ec2ae9382c052f024284dcdb77ac495c177. The function still exists, this commit caused a warning with Clang So keep MEM_printmemlist_pydict.
2022-01-11Cleanup: Composite nodes: add namespace for every fileAaron Carlisle
This puts all static functions in composite node files into a new namespace. This allows using unity build which can improve compile times significantly. This is a follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5 but for compositor nodes. The namespace name is derived from the file name. That makes it possible to write some tooling that checks the names later on. The filename extension (`cc`) is added to the namespace name as well. his also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file. Reviewed By: JacquesLucke, HooglyBoogly, jbakker Differential Revision: https://developer.blender.org/D13466
2022-01-11Fix T94768: Crash in VSE prefetchingRichard Antalik
If timeline contains scene strip outside of edited meta strip, this will cause crash. This is because prefetchin ignored meta strips being edited when rendering, but did check for scene strips only inside edited meta strip. Change active seqbase pointer when entering meta strip. This makes it possible to prefetch only content that is being presented to user.
2022-01-11Fix T94671: performance regression with subsurf modifierKévin Dietrich
rBeed45d2a239a introduced a GPU backend for OpenSubDiv which lets us do the subdivision at render time. However, some tools might still need to have the subdivision data available on the CPU side. For this a subdivision mesh wrapper was also introduced, and is computed whenever a CPU side mesh is needed. The subdivision settings for this wrapper are stored during modifier evaluation if GPU subdivision can be done. The performance regression is due to the fact that although the subdivision mesh was already computed on the CPU, and no subdivision wrapper is generated, some checks for creating subdivision data in `BKE_mesh_wrapper_ensure_subdivision` where still run, one of which is very expensive. To fix this we first check the runtime settings of the mesh to see if subdivision is needed at all.
2022-01-11Spreadsheet: Add mesh topology information with a debug valueHans Goudey
This commit adds topology information from mesh data structs to the spreadsheet when the debug value `4001` is set. Eventually we could expose these. For now it can be a useful tool for developers when working on mesh algorithms. Differential Revision: https://developer.blender.org/D13735
2022-01-11Cleanup: Remove unused "active ID" node flagHans Goudey
The value of this flag was only retrieved in `nodeGetActiveID`, which wasn't used anywhere. Other than that, the `NODE_ACTIVE_ID` and related functions seem to come from the Blender internal renderer. Differential Revision: https://developer.blender.org/D13770
2022-01-11Geometry Nodes: Move normal field input to be usable elsewhereHans Goudey
This commit moves the normal field input to `BKE_geometry_set.hh` from the node file so that normals can be used as an implicit input to other nodes. Differential Revision: https://developer.blender.org/D13779
2022-01-11Docs: correct doc-string for bl_run_operators_event_simulateCampbell Barton
The event() action swapped type/value arguments.