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-11-10Cleanup: Move sculpt.c to C++Hans Goudey
2022-11-02Refactor: Rename Object->imat to Object->world_to_objectSergey Sharybin
The goal is to improve clarity and readability, without introducing big design changes. Follows the recent obmat to object_to_world refactor: the similar naming is used, and it is a run-time only rename, meaning, there is no affect on .blend files. This patch does not touch the redundant inversions. Those can be removed in almost (if not all) cases, but it would be the best to do it as a separate change. Differential Revision: https://developer.blender.org/D16367
2022-11-01Refactor: Rename Object->obmat to Object->object_to_worldSergey Sharybin
Motivation is to disambiguate on the naming level what the matrix actually means. It is very easy to understand the meaning backwards, especially since in Python the name goes the opposite way (it is called `world_matrix` in the Python API). It is important to disambiguate the naming without making developers to look into the comment in the header file (which is also not super clear either). Additionally, more clear naming facilitates the unit verification (or, in this case, space validation) when reading an expression. This patch calls the matrix `object_to_world` which makes it clear from the local code what is it exactly going on. This is only done on DNA level, and a lot of local variables still follow the old naming. A DNA rename is setup in a way that there is no change on the file level, so there should be no regressions at all. The possibility is to add `_matrix` or `_mat` suffix to the name to make it explicit that it is a matrix. Although, not sure if it really helps the readability, or is it something redundant. Differential Revision: https://developer.blender.org/D16328
2022-10-18Brush: Wrap mtex/mask_tex around functions.Jeroen Bakker
`Brush` has two attributes for holding texture information (`MTex`). One for color textures (`mtex`) and one for mask textures (`mask_mtex`). Unfortunately sculpt mode due to reasons used `mtex` to store mask textures. Changes like brush asset/paint mode require modes/tools to read the mask/color texture from one place. To start sanatizing this we isolate the attributes in functions. `BKE_brush_color_texture_get` and `BKE_brush_mask_texture_get`. All object paint modes should use these functions.
2022-10-07Cleanup: redundant parenthesisCampbell Barton
2022-10-04Cleanup: remove unnecessary includes from sculpt_paintCampbell Barton
2022-10-04Cleanup: replace UNUSED macro with commented args in C++ codeHans Goudey
This is the conventional way of dealing with unused arguments in C++, since it works on all compilers. Regex find and replace: `UNUSED\((\w+)\)` -> `/*$1*/`
2022-09-25Cleanup: remove redundant parenthesis (especially with macros)Campbell Barton
2022-09-25Cleanup: replace C-style casts with functional casts for numeric typesCampbell Barton
2022-09-25Cleanup: remove redundant double parenthesisCampbell Barton
2022-09-23Mesh: Move selection flags to generic attributesHans Goudey
Using the attribute name semantics from T97452, this patch moves the selection status of mesh elements from the `SELECT` of vertices, and edges, and the `ME_FACE_SEL` of faces to generic boolean attribute Storing this data as generic attributes can significantly simplify and improve code, as described in T95965. The attributes are called `.select_vert`, `.select_edge`, and `.select_poly`. 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. 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 selection is used. When the flags are removed completely, requirements will decrease. Further notes: * The `MVert` flag is empty at runtime now, so it can be ignored. * `BMesh` is unchanged, otherwise the change would be much larger. * Many tests have slightly different results, since the selection attribute uses more generic propagation. Previously you couldn't really rely on edit mode selections being propagated procedurally. Now it mostly works as expected. Similar to 2480b55f216c Ref T95965 Differential Revision: https://developer.blender.org/D15795
2022-09-07Cleanup: Tweak naming for recently added mesh accessorsHans Goudey
Use `verts` instead of `vertices` and `polys` instead of `polygons` in the API added in 05952aa94d33eeb50. This aligns better with existing naming where the shorter names are much more common.
2022-09-06Cleanup: spelling in comments, formatting, move comments into headersCampbell Barton
2022-09-05Mesh: Remove redundant custom data pointersHans Goudey
For copy-on-write, we want to share attribute arrays between meshes where possible. Mutable pointers like `Mesh.mvert` make that difficult by making ownership vague. They also make code more complex by adding redundancy. The simplest solution is just removing them and retrieving layers from `CustomData` as needed. Similar changes have already been applied to curves and point clouds (e9f82d3dc7ee, 410a6efb747f). Removing use of the pointers generally makes code more obvious and more reusable. Mesh data is now accessed with a C++ API (`Mesh::edges()` or `Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`). The CoW changes this commit makes possible are described in T95845 and T95842, and started in D14139 and D14140. The change also simplifies the ongoing mesh struct-of-array refactors from T95965. **RNA/Python Access Performance** Theoretically, accessing mesh elements with the RNA API may become slower, since the layer needs to be found on every random access. However, overhead is already high enough that this doesn't make a noticible differenc, and performance is actually improved in some cases. Random access can be up to 10% faster, but other situations might be a bit slower. Generally using `foreach_get/set` are the best way to improve performance. See the differential revision for more discussion about Python performance. Cycles has been updated to use raw pointers and the internal Blender mesh types, mostly because there is no sense in having this overhead when it's already compiled with Blender. In my tests this roughly halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million face grid). Differential Revision: https://developer.blender.org/D15488
2022-08-16Sculpt: Fix redo panel bugsJoseph Eagar
SCULPT_undo_push_begin no longer takes an explicit name. Instead it takes a wmOperator pointer and uses op->type->name for the name. This is necassary for the redo panel to work and should fix the entire class of bugs related to misspelled undo push names. Cases where the calling operator is not registered may use SCULPT_undo_push_begin_ex if desired; it takes a name string as before.
2022-06-30Fix T99196: sculpt_update_object calls paint updates for nonpaint toolsJoseph Eagar
Specifically BKE_texpaint_slots_refresh_object was being called, which causes cycles to reset at strange times (like moving the mouse cursor in pose, boundary and various other tools). This (along with some code that checks if the pbvh pixels need to be rebuilt) is only run if is_paint_mode (which used to be needs_colors) is true.
2022-06-27Fix T98673: Color attribute fill API didn't support editmodeJoseph Eagar
2022-06-26Cleanup: Clang tidyHans Goudey
2022-06-23Cleanup: Remove unused array in vertex paint codeHans Goudey
Unused since 4f616c93f7cb8c8c8e038
2022-06-23Vertex paint mode tried to do a "fast update" by trying to avoid taggingHans Goudey
the mesh ID for a full update. The conditions it uses are troublesome: 1. There must be an evaluated mesh 2. The evaluated mesh's active byte color layer must equal the original's This logic doesn't make sense for a few reasons. First of all, the `mloopcol` pointer doesn't make sense in the context of color attributes (rather than the old vertex colors), since it only points to byte color attribute on face corners. Second, just because the layer pointers are equal doesn't mean something doesn't depend on the attribute's values. I think the best solution currently is to remove this "fast update" case and instead work on optimizing the general case. Also, T95842 suggests removing these pointers, and this is one of the last remaining uses of `Mesh.mloopcol`. Differential Revision: https://developer.blender.org/D15275
2022-06-16Cleanup: differentiate region/screen relative coordinatesCampbell Barton
- Avoid ambiguity which caused these values to be confused, use `mval` for region relative mouse coordinates, otherwise `event_xy`. - Pass region relative coordinates to sample_detail_dyntopo & sample_detail_voxel as there is no reason to use screen-space values. - Rename invalid use of mval for screen-space coordinates.
2022-06-09Cleanup: formatCampbell Barton
2022-06-08Paint: Fix Image Editor Cursor Disappearing (T90120)Joseph Eagar
This patch fixes T90120. The fundamental problem is that 2d and the old 3d paint modes share a single Paint struct, ToolSettings->imapaint. This patch is a temporary fix until the new 3d paint mode (which has its own Paint struct) is released. The patch works by listening for `NC_SCENE|ND_MODE` inside `image_listener` in `space_image.c`. It does not use `ED_space_image_paint_update` since that requires a `bMain.` Instead it calls `paint_cursor_start` (which is promoted to `ED_paint_cursor_start`). `image_paint_poll` is also promoted to an `ED_` function. Reviewed By: Campbell Barton Differential Revision: https://developer.blender.org/D14946 Ref D14946
2022-06-08Cleanup: Use const variables/pointersHans Goudey
2022-06-07Cleanup: Use const pointers in attribute APIHans Goudey
2022-06-01Cleanup: use 'e' prefix for enum typesCampbell Barton
- CustomDataType -> eCustomDataType - CustomDataMask -> eCustomDataMask - AttributeDomain -> eAttrDomain - NamedAttributeUsage -> eNamedAttrUsage
2022-05-23Merge remote-tracking branch 'origin/blender-v3.2-release'Dalai Felinto
2022-05-23Cleanup: clarify what is scene linear color space in conversion conversionBrecht Van Lommel
* Rename ambiguous rgb to scene_linear in some places * Precompute matrices to directly go to scene instead of through XYZ * Make function signatures more consistent
2022-05-04Cleanup: duplicating doc-stringsCampbell Barton
2022-05-03Cleanup: spelling in commentsCampbell Barton
2022-05-02Color Attributes: Add initial fill color optionEthan-Hall
This patch adds allows the user to select the initial fill color when adding a new color attribute layer. --- {F13035372} Reviewed By: JulienKaspar, joeedh Differential Revision: https://developer.blender.org/D14743
2022-04-28Cleanup: unbalanced doxy sections, add some sectionsCampbell Barton
2022-04-26Cleanup: use boolean arguments and return valuesCampbell Barton
2022-04-25Vertex Paint: Fix brush color spaceJoseph Eagar
The brush color wasn't being converted to scene linear space properly.
2022-04-25Cleanup: remove unused function parameterJoseph Eagar
2022-04-25Fix T97597: vertex paint initialization wasJoseph Eagar
called by weight paint mode, causing a crash
2022-04-25Cleanup: fix unused variable warning in `paint_vertex.cc`Sybren A. Stüvel
No functional changes.
2022-04-22Cleanup: Clang tidy, unused variable warningsHans Goudey
Also remove unnecessary uses of `struct` and add const in one place.
2022-04-21Cleanup: fix various warnings after recent commitJacques Lucke
2022-04-21Vertex paint: Fix debug compile error and aJoseph Eagar
few warnings.
2022-04-21Commit D14179: Revamp Vertex Paint With C++Joseph Eagar
- Verrtex paint mode has been refactored into C++ templates. It now works with both byte and float colors and point & corner attribute domains. - There is a new API for mixing colors (also based on C++ templates). Unlike the existing APIs byte and float colors are interpolated identically. Interpolation does happen in a squared rgb space, this may be changed in the future. - Vertex paint now uses the sculpt undo system. Reviewed By: Brecht Van Lommel. Differential Revision: https://developer.blender.org/D14179 Ref D14179