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-02-03Fix T94435: remove anonymous attributes when applying modifierJacques Lucke
Differential Revision: https://developer.blender.org/D13994
2022-01-27USD Preview Surface material export.Michael Kowalski
Add `USD Preview Surface From Nodes` export option, to convert a Principled BSDF material node network to an approximate USD Preview Surface shader representation. If this option is disabled, the original material export behavior is maintained, where viewport setting are saved to the Preview Surface shader. Also added the following options for texture export. - `Export Textures`: If converting Preview Surface, export textures referenced by shader nodes to a 'textures' directory which is a sibling of the USD file. - `Overwrite Textures`: Allow overwriting existing texture files when exporting textures (this option is off by default). - `Relative Texture Paths`: Make texture asset paths relative to the USD. The entry point for the new functionality is `create_usd_preview_surface_material()`, called from `USDAbstractWriter::ensure_usd_material()`. The material conversion currently handles a small subset of Blender shading nodes, `BSDF_DIFFUSE`, `BSDF_PRINCIPLED`, `TEX_IMAGE` and `UVMAP`. Texture export is handled by copying texture files from their original location to a `textures` folder in the same directory as the USD. In-memory and packed textures are saved directly to the textures folder. This patch is based, in part, on code in Tangent Animation's USD exporter branch. Reviewed By: sybren, HooglyBoogly Differential Revision: https://developer.blender.org/D13647
2022-01-19BMesh: add mesh debug information printingCampbell Barton
- Add BM_mesh_debug_print & BM_mesh_debug_info. - Report flags in Mesh.cd_flag in BKE_mesh_debug_print - Move custom data printing into customdata.cc (noted as a TODO). Note that the term "runtime" has been removed from `BKE_mesh_runtime_debug_print` since these are useful for debugging any kind of mesh data.
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Includes unwanted changes This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d.
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-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: remove redundant const qualifiers for POD typesCampbell Barton
2022-01-07Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
MSVC used to warn about const mismatch for arguments passed by value. Remove these as newer versions of MSVC no longer show this warning.
2021-12-07Cleanup: move public doc-strings into headers for 'blenkernel'Campbell Barton
- Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. - Minor improvements to doc-strings. Ref T92709
2021-09-09Geometry Nodes: fields and anonymous attributesJacques Lucke
This implements the initial core framework for fields and anonymous attributes (also see T91274). The new functionality is hidden behind the "Geometry Nodes Fields" feature flag. When enabled in the user preferences, the following new nodes become available: `Position`, `Index`, `Normal`, `Set Position` and `Attribute Capture`. Socket inspection has not been updated to work with fields yet. Besides these changes at the user level, this patch contains the ground work for: * building and evaluating fields at run-time (`FN_fields.hh`) and * creating and accessing anonymous attributes on geometry (`BKE_anonymous_attribute.h`). For evaluating fields we use a new so called multi-function procedure (`FN_multi_function_procedure.hh`). It allows composing multi-functions in arbitrary ways and supports efficient evaluation as is required by fields. See `FN_multi_function_procedure.hh` for more details on how this evaluation mechanism can be used. A new `AttributeIDRef` has been added which allows handling named and anonymous attributes in the same way in many places. Hans and I worked on this patch together. Differential Revision: https://developer.blender.org/D12414
2021-07-23Cleanup: code comments punctuation / spacingCampbell Barton
2021-06-28Cleanup: repeated terms in code comments & error messagesCampbell Barton
2021-06-26Cleanup: full sentences in comments, improve comment formattingCampbell Barton
2021-06-25Fix T88756: crash when baking with autosmoothKévin Dietrich
When baking some data, we create a new Mesh with edits and modifiers applied. However, in some cases (e.g. when there is no modifier), the returned Mesh is actually referencing the original one and its data layers. When autosmooth is enabled we also split the Mesh. However, since the new Mesh is referencing the original one, although `BKE_mesh_split_faces` is creating new vertices and edges, the reallocation of the custom data layers is preempted because of the reference, so adding the new vertices and edges overwrites valid data To fix this we duplicate referenced layers before splitting the faces. Reviewed By: brecht Differential Revision: https://developer.blender.org/D11703
2021-02-22Change Exact Boolean modifier to skip round trip through BMesh.Howard Trickey
The Exact modifier code had been written to avoid using BMesh but in the initial release the modifier still converted all Meshes to BMeshes, and then after running the boolean code on the BMeshes, converted the result back to a Mesh. This change skips that. Most of the work here is in getting the Custom Data layers right. The approach taken is to merge default layers from all operand meshes into the final result, and then use the original verts, edges, polys, and loops to copy or interpolate the appropriate custom data layers from all operands into the result.
2021-02-11Fix T84114: Existence of vertex groups slows down mesh editingCampbell Barton
Having a vertex group in a mesh slowed down unrelated operations such as selection. De-duplicating custom-data arrays for layers that contain pointers can become slow without any benefit as the content never matches. Use full copies when storing custom-data for edit-mesh undo.
2020-09-30Cleanup: sort struct declarationsCampbell Barton
2020-09-11Cleanup: make formatJacques Lucke
2020-09-09Fix T80626: Crash adding custom-data layers after reloading the fileCampbell Barton
Regression in a48d78ce07f4f which caused the meshes CustomData to be written before it's layer values were updated for writing.
2020-08-28Refactor: move CustomData .blend I/O to blenkernelJacques Lucke
This is part of T76372.
2020-08-07Code Style: use "#pragma once" in source directoryJacques Lucke
This replaces header include guards with `#pragma once`. A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`), because they are used in other places. This patch has been generated by P1561 followed by `make format`. Differential Revision: https://developer.blender.org/D8466
2020-08-06Move CDData debug print helper from DM to CustomData 'namespace'/files.Bastien Montagne
2020-05-09Cleanup: double-spaces in commentsCampbell Barton
2020-05-08Cleanup: take includes out of 'extern "C"' blocksJacques Lucke
Surrounding includes with an 'extern "C"' block is not necessary anymore. Also that made it harder to add any C++ code to some headers, or include headers that have "optional" C++ code like `MEM_guardedalloc.h`. I tested compilation on linux and windows (and got help from @LazyDodo). If this still breaks compilation due to some linker error, the header containing the symbol in question is probably missing an 'extern "C"' block. Differential Revision: https://developer.blender.org/D7653
2019-11-26BMesh: support copying & freeing layers by typeCampbell Barton
2019-11-24Cleanup: doxygen commentsCampbell Barton
Also correct some outdated symbol references, add missing 'name' commands.
2019-04-27Cleanup: comments (long lines) in blenkernelCampbell Barton
2019-04-18Cleanup: comment blocksCampbell Barton
2019-04-17ClangFormat: apply to source, most of internCampbell Barton
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
2019-03-07Refactor CDData masks, to have one mask per mesh elem type.Bastien Montagne
We already have different storages for cddata of verts, edges etc., 'simply' do the same for the mask flags we use all around Blender code to request some data, or limit some operation to some layers, etc. Reason we need this is that some cddata types (like Normals) are actually shared between verts/polys/loops, and we don’t want to generate clnors everytime we request vnors! As a side note, this also does final fix to T59338, which was the trigger for this patch (need to request computed loop normals for another mesh than evaluated one). Reviewers: brecht, campbellbarton, sergey Differential Revision: https://developer.blender.org/D4407
2019-02-28CustomData: add function to clear layers' flags.Bastien Montagne
We only had one to set those flags, up til now...
2019-02-18doxygen: add newline after \fileCampbell Barton
While \file doesn't need an argument, it can't have another doxy command after it.
2019-02-06Cleanup: remove redundant doxygen \file argumentCampbell Barton
Move \ingroup onto same line to be more compact and make it clear the file is in the group.
2019-02-02Cleanup: remove author/date info from doxy headersCampbell Barton
2019-02-01Cleanup: remove redundant, invalid info from headersCampbell Barton
BF-admins agree to remove header information that isn't useful, to reduce noise. - BEGIN/END license blocks Developers should add non license comments as separate comment blocks. No need for separator text. - Contributors This is often invalid, outdated or misleading especially when splitting files. It's more useful to git-blame to find out who has developed the code. See P901 for script to perform these edits.
2019-01-28Cleanup: sort forward declarations of enum & structCampbell Barton
Done using: source/tools/utils_maintenance/c_sort_blocks.py
2018-12-03Fix T57858: Add validation callback to CustomData layers.Bastien Montagne
Our mesh validation was only checking cd layout so far, not their actual data. While this might only be needed for a few types, this is a required addition for things like imported UVs, else we have no way to avoid nasty things like NANs & co. Note that more layer types may need that callback, time will say. For now added it to some obvious missing cases...
2018-09-25CustomData: Allow copying content of a single layerSergey Sharybin
2018-09-25Cleanup: indentationSergey Sharybin
2018-09-24Merge branch 'master' into blender2.8Brecht Van Lommel
2018-09-24Spelling fixes in comments and descriptions, patch by luzpaz.Brecht Van Lommel
Differential Revision: https://developer.blender.org/D3719
2018-06-29Merge branch 'master' into blender2.8Campbell Barton
2018-06-29Cleanup: trailing newlinesCampbell Barton
2018-06-17Merge branch 'master' into blender2.8Campbell Barton
2018-06-17Cleanup: trailing space for blenkernelCampbell Barton
2018-05-30Cleanup: use 'e' prefix for enum typesCampbell Barton
2018-05-30Cleanup: Use typed allocation type enum in custom data APISergey Sharybin
2018-05-30Use enum for custom data allocation typeSergey Sharybin
Allows to easily see human readable value in debugger.
2017-05-25TexFace removal part 3Campbell Barton
- MTexPoly structure & layer type. - The 'Mesh.uv_textures' layers. - DerivedMesh TexFace drawing. - Scripts & UI.