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-10Sculpt: Change symmetrize merge threshold and expose in workspace panelJoseph Eagar
The sculpt symmetrize operator's merge threshold now defaults to 0.0005 instead of 0.001, which tends to be a bit too big for metric scale. Also changed its step and precision a bit to be more usable.
2022-11-10Sculpt: Fix inconsistent naming for cavity_from_mask operatorJoseph Eagar
With db40b62252e5 there have been various UI adjustments and improved renaming. The Mask From Cavity menu operator didn't follow this new naming yet. Reviewed By: Joseph Eagar Differential Revision: https://developer.blender.org/D16409 Ref D16409
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-16Sculpt: Fix T101864: Mask initialization not updating multires dataJoseph Eagar
BKE_sculpt_mask_layers_ensure now takes a depsgraph argument and will evaluate the depsgraph if a multires mask layer is added. This is necassary to update the multires runtime data so that pbvh knows it has a grids mask layer. Also added code to update pbvh->gridkey.
2022-10-11Sculpt: Fix mask from cavity not redrawing viewport with modifiersJoseph Eagar
2022-10-10Cleanup: spelling in commentsCampbell Barton
2022-10-04Cleanup: remove unnecessary includes from sculpt_paintCampbell Barton
2022-10-04Cleanup: undeclared function warningCampbell Barton
2022-10-04Sculpt: Visibility bugfixesJoseph Eagar
* Unhide all is no longer part of face_set_change_visibility. * Implemented a few visibility API methods for PBVH_BMESH * Fixed bug with unhide all not freeing all multires grid_hidden bitmaps.
2022-10-01Sculpt: Fix T101430: Curve shown improperly in mask from cavity redoJoseph Eagar
2022-09-29Sculpt: Fix T101464: Crash in mask from cavityJoseph Eagar
2022-09-29Cleanup: run clang-format in sculpt codeJoseph Eagar
2022-09-29Sculpt: Normal-based automasking modesJoseph Eagar
Two new normal-based automasking modes. The first mode, "brush", compares vertex normals with the initial normal at the beginning of the brush stroke. The second, "view", compares vertex normals with the view normal. If "occlusion" is on then rays will be shot from each vertex to test if it is occluded by other geometry (note: this can be very slow).\ Only geometry inside the sculpt mesh is considered. Each mode has an associated angular limit and a falloff. Reviewed by: Julien Kaspar and Jeroen Bakker Differential Revision: https://developer.blender.org/D15297 Ref D15297
2022-09-29Cleanup: remove '.' from the end of descriptionsCampbell Barton
Quiet warnings at startup & build time.
2022-09-29Cleanup: replace UNUSED() with commented argumentsCampbell Barton
This is the conventional way of dealing with unused arguments in C++. Also quiet enum conversion warnings.
2022-09-29Cleanup: formatCampbell Barton
2022-09-29Sculpt: New Cavity Automasking ModeJoseph Eagar
Add new cavity automasking mode based on local mesh curvature. Cavity masking is a great way to quickly add detail in crevices and the like. It's meant to be used with the Paint brush in color attribute mode. It does work with other brushes but the results can be unpredictable. {F13131497} The old "dirty mask" operator has been replace with a new "mask from cavity" operator that shares the same code with cavity automasking. Differences from the sculpt-dev implementation: * It uses the word "cavity." When I first implemented this I wasn't aware this feature existed in other software (and other paint modes in Blender), and for reasons that escape me today I initially decided to call it a concave or concavity mask. * The cavity factor works a bit differently. It's no longer non-linear and functions as a simple scale around 0.5f. * Supports custom curves. * Supports blurring. Reviewed By: Julian Kaspar, Jeroen Bakker and Campbell Barton Differential Revision: https://developer.blender.org/D15122 Ref D15122
2022-09-16Sculpt: add .sculpt to allow_procedural_attribute_accessJoseph Eagar
Also cleaned up a comment.
2022-09-16Fix: Missing updates for multires sculptingHans Goudey
Caused by ee23f0f3fb58ce56, which removed the update tag when entering sculpt mode, and by b5f7af31d6d474c, which made these layers lazily created, so they weren't always available at the start of a stroke. Now update the evaluated mesh/multires CCG as necessary. Some updates could potentially avoided when switching modes in the future, but for now do it all the time. Fixes T101116 Also fixes a crash when painting multires mask for the first time
2022-09-16Sculpt: New attribute APIJoseph Eagar
New unified attribute API for sculpt code. = Basic Design = The sculpt attribute API can create temporary or permanent attributes (only supported in `PBVH_FACES` mode). Attributes are created via `BKE_sculpt_attribute_ensure.` Attributes can be explicit CustomData attributes or simple array-based pseudo-attributes (this is useful for PBVH_GRIDS and PBVH_BMESH). == `SculptAttributePointers` == There is a structure in `SculptSession` for convenience attribute pointers, `ss->attrs`. Standard attributes should assign these; the attribute API will automatically clear them when the associated attributes are released. For example, the automasking code stores its factor attribute layer in `ss->attrs.automasking_factor`. == Naming == Temporary attributes should use the SCULPT_ATTRIBUTE_NAME macro for naming, it takes an entry in `SculptAttributePointers` and builds a layer name. == `SculptAttribute` == Attributes are referenced by a special `SculptAttribute` structure, which holds all the info needed to look up elements of an attribute at run time. All of these structures live in a preallocated flat array in `SculptSession`, `ss->temp_attributes`. This is extremely important. Since any change to the `CustomData` layout can in principle invalidate every extant `SculptAttribute`, having them all in one block of memory whose location doesn't change allows us to update them transparently. This makes for much simpler code and eliminates bugs. To see why this is tricky to get right, imagine we want to create three attributes in PBVH_BMESH mode and we provide our own `SculptAttribute` structs for the API to fill in. Each new layer will invalidate the `CustomData` block offsets in the prior one, leading to memory corruption. Reviewed by: Brecht Van Lommel Differential Revision: https://developer.blender.org/D15496 Ref D15496
2022-09-14Sculpt: Separate hide status from face sets, use generic attributeHans Goudey
Whether faces are hidden and face sets are orthogonal concepts, but currently sculpt mode stores them together in the face set array. This means that if anything is hidden, there must be face sets, and if there are face sets, we have to keep track of what is hidden. In other words, it adds a bunch of redundant work and state tracking. On the user level it's nice that face sets and hiding are consistent, but we don't need to store them together to accomplish that. This commit uses the `".hide_poly"` attribute from rB2480b55f216c to read and change hiding in sculpt mode. Face sets don't need to be negative anymore, and a bunch of "face set <-> hide status" conversion can be removed. Plus some other benefits: - We don't need to allocate either array quite as much. - The hide status can be read from 1/4 the memory as face sets. - Updates when entering or exiting sculpt mode can be removed. - More opportunities for early-outs when nothing is hidden. - Separating concerns makes sculpt code more obvious. - It will be easier to convert face sets into a generic int attribute. Differential Revision: https://developer.blender.org/D15950
2022-09-14ViewLayer: Lazy sync of scene data.Monique Dewanchand
When a change happens which invalidates view layers the syncing will be postponed until the first usage. This will improve importing or adding many objects in a single operation/script. `BKE_view_layer_need_resync_tag` is used to tag the view layer to be out of sync. Before accessing `BKE_view_layer_active_base_get`, `BKE_view_layer_active_object_get`, `BKE_view_layer_active_collection` or `BKE_view_layer_object_bases` the caller should call `BKE_view_layer_synced_ensure`. Having two functions ensures that partial syncing could be added as smaller patches in the future. Tagging a view layer out of sync could be replaced with a partial sync. Eventually the number of full resyncs could be reduced. After all tagging has been replaced with partial syncs the ensure_sync could be phased out. This patch has been added to discuss the details and consequences of the current approach. For clarity the call to BKE_view_layer_ensure_sync is placed close to the getters. In the future this could be placed in more strategical places to reduce the number of calls or improve performance. Finding those strategical places isn't that clear. When multiple operations are grouped in a single script you might want to always check for resync. Some areas found that can be improved. This list isn't complete. These areas aren't addressed by this patch as these changes would be hard to detect to the reviewer. The idea is to add changes to these areas as a separate patch. It might be that the initial commit would reduce performance compared to master, but will be fixed by the additional patches. **Object duplication** During object duplication the syncing is temporarily disabled. With this patch this isn't useful as when disabled the view_layer is accessed to locate bases. This can be improved by first locating the source bases, then duplicate and sync and locate the new bases. Will be solved in a separate patch for clarity reasons ({D15886}). **Object add** `BKE_object_add` not only adds a new object, but also selects and activates the new base. This requires the view_layer to be resynced. Some callers reverse the selection and activation (See `get_new_constraint_target`). We should make the selection and activation optional. This would make it possible to add multiple objects without having to resync per object. **Postpone Activate Base** Setting the basact is done in many locations. They follow a rule as after an action find the base and set the basact. Finding the base could require a resync. The idea is to store in the view_layer the object which base will be set in the basact during the next sync, reducing the times resyncing needs to happen. Reviewed By: mont29 Maniphest Tasks: T73411 Differential Revision: https://developer.blender.org/D15885
2022-09-12When these features aren't used, there is no sense in storing theHans Goudey
corresponding data layers and using their values for computations. Avoiding that should increase performance in many operations that would otherwise have to read, write, or propagate these values. It also means decreased memory usage-- not just for sculpt mode but for any mesh that was in sculpt mode. Previously the mask, face set, and hide status layers were *always* allocated by sculpt mode. Here are a few basic tests when masking and face sets are not used: | Test | Before | After | | Subsurf Modifier | 148 ms | 126 ms | | Sculpt Overlay Extraction | 24 ms every redraw | 0 ms | | Memory usage | 252 MB | 236 MB | I wouldn't expect any difference when they are used though. The code changes are mostly just making sculpt features safe for when the layers aren't stored, and some changes to the conversion to and from the hide layers. Use of the ".hide_poly" attribute replaces testing whether face sets are negative in many places. Differential Revision: https://developer.blender.org/D15937
2022-09-08Cleanup: prefer terms verts/polys over vertices/polygonsCampbell Barton
Follows existing naming for the most part, also use "num" as a suffix in some instances (following our naming conventions).
2022-09-01Cleanup: Remove/replace View Layer macros.Monique Dewanchand
This patch is a cleanup required before refactoring the view layer syncing process {T73411}. * Remove FIRSTBASE. * Remove LASTBASE. * Remove BASACT. * Remove OBEDIT_FROM_WORKSPACE. * Replace OBACT with BKE_view_layer_active_object. * Replace OBEDIT_FROM_VIEW_LAYER with BKE_view_layer_edit_object. Reviewed By: mont29 Maniphest Tasks: T73411 Differential Revision: https://developer.blender.org/D15799
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-08-02Cleanup: Remove unused sculpt and vertex color operatorsHans Goudey
The "Color Attributes" system from f7bbc7cdbb6cb0d2850 has replaced both "Sculpt Vertex Colors" and "Vertex Colors" in the UI. The Operators for adding and removing them are unused now. This commit does not break backwards compatibility with the Python API, it only removes the operators, which generally aren't used by addons anyway. The mesh RNA properties will be removed in 4.0 (T100153). Differential Revision: https://developer.blender.org/D15077
2022-08-02Merge branch 'blender-v3.3-release'Hans Goudey
2022-08-02Fix T96810: Invalid sculpt normals after some operationsHans Goudey
Mask and color brushes were using the existing PBVH vertex "update tag" to mark their modifications. This was mostly unnecessary, and causes unnecessary calculation of normals. It also caused errors though, because they didn't tag the corresponding PBVH node for normal recalculation, causing problems on the borders of nodes, since one node might accumulate into another's vertex normals, but the other node wouldn't also accumulate and normalize the normals. The solution is to only use the update tag for tagging deformed vertices that need recalculated normals. Everything else is handled at the PBVH node level (which was already the case, but it wasn't clear). The update tag was also used for undo to tag the nodes corresponding to changed vertices. This was wrong though, because normals and visibility would also be recalculated for just color or mask undo steps. Instead, just use local arrays to map from vertices to nodes. Differential Revision: https://developer.blender.org/D15581
2022-07-30Sculpt: Opaque vertex type for sculptJoseph Eagar
This is a port of sculpt-dev's `SculptVertRef` refactor (note that `SculptVertRef was renamed to PBVHVertRef`) to master. `PBVHVertRef` is a structure that abstracts the concept of a vertex in the sculpt code; it's simply an `intptr_t` wrapped in a struct. For `PBVH_FACES` and `PBVH_GRIDS` this struct stores a vertex index, but for `BMesh` it stores a direct pointer to a BMVert. The intptr_t is wrapped in a struct to prevent the accidental usage of it as an index. There are many reasons to do this: * Right now `BMesh` verts are not logical sculpt verts; to use the sculpt API they must first be converted to indices. This requires a lot of indirect lookups into tables, leading to performance loss. It has also led to greater code complexity and duplication. * Having an abstract vertex type makes it feasible to have one unified temporary attribute API for all three PBVH modes, which in turn made it rather trivial to port sculpt brushes to DynTopo in sculpt-dev (e.g. the layer brush, draw sharp, the smooth brushes, the paint brushes, etc). This attribute API will be in a future patch. * We need to do this anyway for the eventual move to C++. Differential Revision: https://developer.blender.org/D14272 Reviewed By: Brecht Van Lommel Ref D14272
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-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-05-31Merge branch 'blender-v3.2-release'Jeroen Bakker
2022-05-31UI: Correct sculpt tooltipsJulien Kaspar
Some of the tools in sculpt mode were still referring to the previously experimental sculpt vertex colors. They should instead refer to color attributes. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15073
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-14Cleanup: Further use of const for retrieved custom data layersHans Goudey
Similar to cf69652618fefcd22b2cde9a2.
2022-05-13Cleanup: Use const when retrieving custom data layersHans Goudey
Knowing when layers are retrieved for write access will be essential when adding proper copy-on-write support. This commit makes that clearer by adding `const` where the retrieved data is not modified. Ref T95842
2022-05-06Switch viewport shading for color tools in solid modeRamil Roosileht
This patch implements T97613, switching viewport shading when using Color Filter and Mask By Color ALSO, this patch makes it so viewport shading color switches only when SOLID mode is chosen, to prevent color switching when using other shading modes, without user noticing it. {F13049889} Reviewed By: JulienKaspar, joeedh, jbakker Maniphest Tasks: T97613 Differential Revision: https://developer.blender.org/D14765
2022-04-29Fix T97608: Sculpt sample color op is missing pmapJoseph Eagar
Add missing call to BKE_sculpt_update_object_for_edit.
2022-04-22Cleanup: spelling in commentsCampbell Barton
2022-04-21Cleanup: clang formatJacques Lucke
2022-04-21Fix T97469: Sculpt colors crash in multiresolution or dynamic topology modes.Joseph Eagar
Sculpt paint tools now pop up an error message if dynamic topology or multires are enabled. Implementation notes: * SCULPT_vertex_colors_poll is now a static function in sculpt_ops.c. It is now used solely by the legacy color attribute conversion operators (SCULPT_OT_vertex_to_loop_colors and SCULPT_OT_loop_to_vertex_colors) and should be deleted when they are. * There is a new method, SCULPT_handles_colors_report, that returns true if the sculpt session can handle color attributes; otherwise it returns false and displays an error message to the user.
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-20Mesh: Avoid unnecessary normal calculation and dirty tagsHans Goudey
This is mostly a cleanup to avoid hardcoding the eager calculation of normals it isn't necessary, by reducing calls to `BKE_mesh_calc_normals` and by removing calls to `BKE_mesh_normals_tag_dirty` when the mesh is newly created and already has dirty normals anyway. This reduces boilerplate code and makes the "dirty by default" state more clear. Any regressions from this commit should be easy to fix, though the lazy calculation is solid enough that none are expected.
2022-04-16Mask by color now auto-creates aJoseph Eagar
color attribute if one does not exist, and no longer passes through to the translate tool on tweak grab.
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-29LibOverride: Massive edits to 'editable' IDs checks in editors code.Bastien Montagne
Add new `BKE_id_is_editable` helper in `BKE_lib_id.h`, that supercedes previous check (simple `ID_IS_LINKED()` macro) for many editing cases. This allows to also take into account 'system override' (aka non-editable override) case. Ref: {T95707}.
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-10Refactor: Move PBVH update tag out of MVertHans Goudey
This is part of the project of converting `MVert` into `float3`. (more details in T93602), The pbvh update flag is removed and replaced with a bitmap stored in the PBVH structure. This patch is similar to D13878. This is mainly setup for an eventual performance improvement by removing the extra data from mesh vertices, but if it's consistent with testing in the other patch doing the same thing for another "temp tag", then it may actually increase the speed of sculpt code slightly, since less memory needs to be loaded when checking/changing the flags. Differential Revision: https://developer.blender.org/D14000