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-09-01Fix: Incorrect vertex group layer "construct" callbackHans Goudey
The "set default" callback doesn't need to be defined since it falls back to clearing the memory, but since "construct" is optional, it needs to be defined. Mistake in 25237d2625078c6d1.
2022-08-31Merge branch 'blender-v3.3-release'Joseph Eagar
2022-08-31Core: Remove color attribute limit from CustomData APIJoseph Eagar
Note: does not fix the limit in PBVH draw which is caused by VBO limits not MAX_MCOL.
2022-08-31Mesh: Move material indices to a generic attributeHans Goudey
This patch moves material indices from the mesh `MPoly` struct to a generic integer attribute. The builtin material index was already exposed in geometry nodes, but this makes it a "proper" attribute accessible with Python and visible in the "Attributes" panel. The goals of the refactor are code simplification and memory and performance improvements, mainly because the attribute doesn't have to be stored and processed if there are no materials. However, until 4.0, material indices will still be read and written in the old format, meaning there may be a temporary increase in memory usage. Further notes: * Completely removing the `MPoly.mat_nr` after 4.0 may require changes to DNA or introducing a new `MPoly` type. * Geometry nodes regression tests didn't look at material indices, so the change reveals a bug in the realize instances node that I fixed. * Access to material indices from the RNA `MeshPolygon` type is slower with this patch. The `material_index` attribute can be used instead. * Cycles is changed to read from the attribute instead. * BMesh isn't changed in this patch. Theoretically it could be though, to save 2 bytes per face when less than two materials are used. * Eventually we could use a 16 bit integer attribute type instead. Ref T95967 Differential Revision: https://developer.blender.org/D15675
2022-08-30Attributes: Improve custom data initialization optionsHans Goudey
When allocating new `CustomData` layers, often we do redundant initialization of arrays. For example, it's common that values are allocated, set to their default value, and then set to some other value. This is wasteful, and it negates the benefits of optimizations to the allocator like D15082. There are two reasons for this. The first is array-of-structs storage that makes it annoying to initialize values manually, and the second is confusing options in the Custom Data API. This patch addresses the latter. The `CustomData` "alloc type" options are rearranged. Now, besides the options that use existing layers, there are two remaining: * `CD_SET_DEFAULT` sets the default value. * Usually zeroes, but for colors this is white (how it was before). * Should be used when you add the layer but don't set all values. * `CD_CONSTRUCT` refers to the "default construct" C++ term. * Only necessary or defined for non-trivial types like vertex groups. * Doesn't do anything for trivial types like `int` or `float3`. * Should be used every other time, when all values will be set. The attribute API's `AttributeInit` types are updated as well. To update code, replace `CD_CALLOC` with `CD_SET_DEFAULT` and `CD_DEFAULT` with `CD_CONSTRUCT`. This doesn't cause any functional changes yet. Follow-up commits will change to avoid initializing new layers where the correctness is clear. Differential Revision: https://developer.blender.org/D15617
2022-08-26CustomData: Add function to get name of default layerHans Goudey
Used by D14365
2022-08-26Cleanup: Fix const correctness in CustomData set name functionHans Goudey
The function does modify the object since it changes the name of a layer it owns. Ideally this wouldn't be possible, but raw pointers don't have ownership semantics so this is a common problem with CustomData.
2022-08-23Fix: Write hide status attributes for undo stepsHans Goudey
We don't convert to the old mesh format when writing undo steps to avoid overhead. So we can't skip writing the hide attributes then.
2022-08-11Mesh: Move hide flags to generic attributesHans Goudey
This commit moves the hide status of mesh vertices, edges, and faces from the `ME_FLAG` to optional generic boolean attributes. Storing this data as generic attributes can significantly simplify and improve code, as described in T95965. The attributes are called `.hide_vert`, `.hide_edge`, and `.hide_poly`, using the attribute name semantics discussed in T97452. The `.` prefix means they are "UI attributes", so they still contain original data edited by users, but they aren't meant to be accessed procedurally by the user in arbitrary situations. They are also be hidden in the spreadsheet and the attribute list by default, Until 4.0, the attributes are still written to and read from the mesh in the old way, so neither forward nor backward compatibility are affected. This means memory requirements will be increased by one byte per element when the hide status is used. When the flags are removed completely, requirements will decrease when hiding is unused. Further notes: * Some code can be further simplified to skip some processing when the hide attributes don't exist. * The data is still stored in flags for `BMesh`, necessitating some complexity in the conversion to and from `Mesh`. * Access to the "hide" property of mesh elements in RNA is slower. The separate boolean arrays should be used where possible. Ref T95965 Differential Revision: https://developer.blender.org/D14685
2022-08-04Cleanup: Remove incorrect commentHans Goudey
2022-08-04Merge branch 'blender-v3.3-release'Hans Goudey
2022-08-04Fix T100099: Cycles crash baking vertex colors in edit modeBrecht Van Lommel
This was not supported, added now.
2022-08-03Cleanup: Fix doxygen section for custom data typeHans Goudey
2022-08-03Cleanup: Use const arguments in definition, add helper variableHans Goudey
2022-07-21Fix failing cycles test from previous commitChris Blackbourn
Deprecated custom data type CD_MTEXPOLY has inconsistent data usage. Reviewed By: Campbell Barton
2022-07-21Fix T90620: Ignore missing UV data caused by corrupt .blend fileChris Blackbourn
Add crash protection and partial recovery for corrupt .blend files, particularly for missing UV data. Differential Revision: https://developer.blender.org/D15489
2022-07-08Cleanup: make formatDalai Felinto
2022-07-08Cleanup: Move mesh legacy conversion to a separate fileHans Goudey
It's helpful to make the separation of legacy data formats explicit, because it declutters actively changed code and makes it clear which areas do not follow Blender's current design. In this case I separated the `MFace`/"tessface" conversion code into a separate blenkernel .cc file and header. This also makes refactoring to remove these functions simpler because they're easier to find. In the future, conversions to the `MLoopUV` type and `MVert` can be implemented here for the same reasons (see T95965). Differential Revision: https://developer.blender.org/D15396
2022-07-02BKE: fix wrong recently added assertJacques Lucke
2022-07-01Cleanup: Add assert for customdata realloc sizeHans Goudey
This gives a more clear error than finding the error with the signed to unsigned conversion for size_t.
2022-06-07CustomData: Add function to free a named layerHans Goudey
This can be useful to avoid unnecessary boilerplate in various users of the CustomData API. Split from D14685 and D14769.
2022-06-04Cleanup: Remove unnecessary struct keywordsHans Goudey
2022-06-01Cleanup: use 'e' prefix for enum typesCampbell Barton
- CustomDataType -> eCustomDataType - CustomDataMask -> eCustomDataMask - AttributeDomain -> eAttrDomain - NamedAttributeUsage -> eNamedAttrUsage
2022-05-31Merge branch 'blender-v3.2-release'Jacques Lucke
2022-05-31Fix T98454: subdivision doesn't propagate int attributesJacques Lucke
Differential Revision: https://developer.blender.org/D15083
2022-05-29Cleanup: Simplify custom data file writing processHans Goudey
Previously the function had a fair amount of ugly boilerplate to avoid allocating the temporary layers array, and then free it if necessary. `blender::Vector` solves that problem more elegantly. Passing a span, using references in a few cases, and using a switch statement also make the functions simpler. This refactoring is in preparation for D14583 and D14685. Differential Revision: https://developer.blender.org/D15011
2022-05-22Cleanup: Fix build error after previous commitHans Goudey
I'm not sure how that happened, sorry for the noise.
2022-05-22Cleanup: Use const argumentsHans Goudey
2022-05-20Cleanup: make functions for setting clone/stencil layer more consistentMartijn Versteegh
This was missing in rBf1beb3b3f60be45854285935d6bfcedf839b317c. Differential Revision: https://developer.blender.org/D14991
2022-05-17Cleanup: Use `switch` and `BLI_assert_unreachable()` more.Bastien Montagne
Replace some `if/else if` chains by proper `switch` statement. Replace some `BLI_assert(0)` calls by `BLI_assert_unreachable()` ones.
2022-05-16Cleanup: make functions for setting active/render layer more consistentMartijn Versteegh
The active/render layer is indexed from the first layer of that type. These functions incorrectly subtracted the layer index of *each* layer, instead of the first one. If there's only a single layer this doesn't matter, but when there are multiple layers it will set the wrong active layer for consecutive layers. I'm not aware of any actual errors caused by this, because the active and render layers are only ever queried from the first layer of that type, but it was confusing during debugging a related issue. This patch makes the behavior of CustomData_set_layer_active_index() consistent with CustomData_set_layer_active() and the same for render. Differential Revision: https://developer.blender.org/D14955
2022-04-29Fix: Incorrect custom data maxlayers in rare filesHans Goudey
For a single day in 2015 between rBff3d535bc2a6309 and rB945f32e66d6ada, custom data structs could be written with an incorrect maxlayer field. This means that custom data structs read from those files would think they have more space to add new layers than they actually did, causing a crash if more layers were added. This was found while investigating a crash from D14365 which adds new face corner layers in versioning. The fix is to reset all maxlayer integers to totlayer, which is done when writing files in current Blender anyway. The file tests/render/motion_blur/camera_zoom_blur_perspective.blend has this problem as it was added on 2015-07-21, right between the two commits. Adding three custom data layers in versioning code would crash. The problem was originally found and investigated by Martijn Versteegh (@Baardaap), thanks! Differential Revision: https://developer.blender.org/D14786
2022-04-26Cleanup: Move anonymous attribute removal to geometry componentHans Goudey
Implementing removal of anonymous attributes with `GeometryComponent` instead of `Mesh` makes it more reusable for other types like curves.
2022-04-25Cleanup: add missing doxy sections in customdataCampbell Barton
2022-04-21Geometry Nodes: better support for byte color attributesJacques Lucke
Since {rBeae36be372a6b16ee3e76eff0485a47da4f3c230} the distinction between float and byte colors is more explicit in the ui. So far, geometry nodes couldn't really deal with byte colors in general. This patch fixes that. There is still only one color socket, which contains float colors. Conversion to and from byte colors is done when read from or writing to attributes. * Support writing to byte color attributes in Store Named Attribute node. * Support converting to/from byte color in attribute conversion operator. * Support propagating byte color attributes. * Add all the implicit conversions from byte colors to the other types. * Display byte colors as integers in spreadsheet. Differential Revision: https://developer.blender.org/D14705
2022-04-20Cleanup: Remove redundant types from custom data masksHans Goudey
Colors and byte colors are already included in `CD_MASK_PROP_ALL`.
2022-04-20Cleanup: Rename CD_MLOOPCOL to CD_PROP_BYTE_COLORHans Goudey
The "PROP" in the name reflects its generic status, and removing "LOOP" makes sense because it is no longer associated with just mesh face corners. In general the goal is to remove extra semantic meaning from the custom data types.
2022-04-05Refactor: Unify vertex and sculpt colors into newJoseph Eagar
color attribute system. This commit removes sculpt colors from experimental status and unifies it with vertex colors. It introduces the concept of "color attributes", which are any attributes that represents colors. Color attributes can be represented with byte or floating-point numbers and can be stored in either vertices or face corners. Color attributes share a common namespace (so you can no longer have a floating-point sculpt color attribute and a byte vertex color attribute with the same name). Note: this commit does not include vertex paint mode, which is a separate patch, see: https://developer.blender.org/D14179 Differential Revision: https://developer.blender.org/D12587 Ref D12587
2022-03-30Cleanup: unbalanced doxy sectionsCampbell Barton
2022-03-25Cleanup: use doxy sections for customdata.ccCampbell Barton
2022-03-25Cleanup: rename CustomDataExternal.filename => filepathCampbell Barton
Reserve "filename" when only the name component is used.
2022-03-19BLI: generalize converting CPPType to static typeJacques Lucke
Previously, the conversion was done manually for a fixed set of types. Now, there is a more general utility that can be used in other contexts (outside of geometry nodes attribute processing) as well.
2022-03-09Attributes: Implement CustomData interpolation for boolean data typeAleksi Juvani
This commit fixes an issue, where for instance, when merging vertices with the "Merge by Distance" geometry node, the resulting vertices had their boolean attributes set unpredictably. Boolean attributes are implemented as custom data, and when welding vertices, the custom data for the resulting vertices comes from interpolating the custom data of the source vertices. This commit implements the missing interpolation function for the boolean custom data type. This interpolation function is implemented in terms of the logical or operation, that is to say, if any of the source vertices (with a weight greater than zero) have the boolean set, the boolean will also be set on the resulting vertex. This logic matches 95981c9876483256b28. In geometry nodes, attribute interpolation generally does not use the CustomData API for performance reasons, but other areas of Blender still do. Differential Revision: https://developer.blender.org/D14172
2022-02-25Fix: Only possible to create one 8 bit integer attributeHans Goudey
The custom data code checks for `LayerTypeInfo.defaultname` before adding a second layer with a certain type. This was missed in e7912dfa1959be671f77e4e67eab. In practice, this default name is not actually used.
2022-02-22Merge branch 'blender-v3.1-release'Hans Goudey
2022-02-22Fix T95839: Data race when lazily creating mesh normal layersHans Goudey
Currently, when normals are calculated for a const mesh, a custom data layer might be added if it doesn't already exist. Adding a custom data layer to a mesh is not thread-safe, so this can be a problem in some situations. This commit moves derived mesh normals for polygons and vertices out of `CustomData` to `Mesh_Runtime`. Most of the hard work for this was already done by rBcfa53e0fbeed7178. Some changes to logic elsewhere are necessary/helpful: - No need to call both `BKE_mesh_runtime_clear_cache` and `BKE_mesh_normals_tag_dirty`, since the former also does the latter. - Cleanup/simplify mesh conversion and copying since normals are handled with other runtime data. Storing these normals like other runtime data clarifies their status as derived data, meaning custom data moves more towards storing original/editable data. This means normals won't automatically benefit from the planned copy-on-write refactor (T95845), so it will have to be added manually like for the other runtime data. Differential Revision: https://developer.blender.org/D14154
2022-02-11Cleanup: Remove unused mesh mask definitionsHans Goudey
Maintaining and understanding these can be a burden, so the fewer we have, the better. These particular masks haven't been used for years.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-09Cleanup: use consistent copyright location, move descriptionsCampbell Barton
Order copyright immediately after the license block, this was done almost everywhere with a few exceptions. Remove authors from a few files (we had already removed "Contributors" section however with old patches being applied this gets added back in). Also move descriptive text into the doxygen comment block under \file. In some cases remove the text as it was accidentally copied.
2022-02-07Curves: Rename "Hair" types, variables, and functions to "Curves"Hans Goudey
Based on discussions from T95355 and T94193, the plan is to use the name "Curves" to describe the data-block container for multiple curves. Eventually this will replace the existing "Curve" data-block. However, it will be a while before the curve data-block can be replaced so in order to distinguish the two curve types in the UI, "Hair Curves" will be used, but eventually changed back to "Curves". This patch renames "hair-related" files, functions, types, and variable names to this convention. A deep rename is preferred to keep code consistent and to avoid any "hair" terminology from leaking, since the new data-block is meant for all curve types, not just hair use cases. The downside of this naming is that the difference between "Curve" and "Curves" has become important. That was considered during design discussons and deemed acceptable, especially given the non-permanent nature of the somewhat common conflict. Some points of interest: - All DNA compatibility is lost, just like rBf59767ff9729. - I renamed `ID_HA` to `ID_CV` so there is no complete mismatch. - `hair_curves` is used where necessary to distinguish from the existing "curves" plural. - I didn't rename any of the cycles/rendering code function names, since that is also used by the old hair particle system. Differential Revision: https://developer.blender.org/D14007