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-06-30Transform Snap: nearest face snap mode, snapping options, refactoring.jon denning
This commit adds a new face nearest snapping mode, adds new snapping options, and (lightly) refactors code around snapping. The new face nearest snapping mode will snap transformed geometry to the nearest surface in world space. In contrast, the original face snapping mode uses projection (raycasting) to snap source to target geometry. Face snapping therefore only works with what is visible, while nearest face snapping can snap geometry to occluded parts of the scene. This new mode is critical for retopology work, where some of the target mesh might be occluded (ex: sliding an edge loop that wraps around the backside of target mesh). The nearest face snapping mode has two options: "Snap to Same Target" and "Face Nearest Steps". When the Snap to Same Object option is enabled, the selected source geometry will stay near the target that it is nearest before editing started, which prevents the source geometry from snapping to other targets. The Face Nearest Steps divides the overall transformation for each vertex into n smaller transformations, then applies those n transformations with surface snapping interlacing each step. This steps option handles transformations that cross U-shaped targets better. The new snapping options allow the artist to better control which target objects (objects to which the edited geometry is snapped) are considered when snapping. In particular, the only option for filtering target objects was a "Project onto Self", which allowed the currently edited mesh to be considered as a target. Now, the artist can choose any combination of the following to be considered as a target: the active object, any edited object that isn't active (see note below), any non- edited object. Additionally, the artist has another snapping option to exclude objects that are not selectable as potential targets. The Snapping Options dropdown has been lightly reorganized to allow for the additional options. Included in this patch: - Snap target selection is more controllable for artist with additional snapping options. - Renamed a few of the snap-related functions to better reflect what they actually do now. For example, `applySnapping` implies that this handles the snapping, while `applyProject` implies something entirely different is done there. However, better names would be `applySnappingAsGroup` and `applySnappingIndividual`, respectively, where `applySnappingIndividual` previously only does Face snapping. - Added an initial coordinate parameter to snapping functions so that the nearest target before transforming can be determined(for "Snap to Same Object"), and so the transformation can be broken into smaller steps (for "Face Nearest Steps"). - Separated the BVH Tree getter code from mesh/edit mesh to its own function to reduce code duplication. - Added icon for nearest face snapping. - The original "Project onto Self" was actually not correct! This option should be called "Project onto Active" instead, but that only matters when editing multiple meshes at the same time. This patch makes this change in the UI. Reviewed By: Campbell Barton, Germano Cavalcante Differential Revision: https://developer.blender.org/D14591
2022-06-27Fix T99182: Hard code screen_scale for circle drawing in 3DChris Blackbourn
2022-06-12Fix unreported: Choose nsegments for 2D rotation gizmo based on screen scale.Chris Blackbourn
This mostly affects large rotation gizmos at high DPI. Without this patch, they appear as 32-gons instead of circles.
2022-06-12Fix unreported: 2D Gizmo bounding box updated to use gizmo scale.Chris Blackbourn
2022-06-07Fix drawing increments after running Spin gizmoGermano Cavalcante
Caused by {ea182deeb9cdd2a9137e98eb0072f57c0fb1e09f}.
2022-06-07Cleanup: potential dereferencing of a NULL pointerGermano Cavalcante
If `cancel` is `false`, `NULL` `inter` pointer dereferencing could occur. Currently I haven't found a case where this can happen. But it's best to avoid.
2022-06-07Remove workaround for drawing the rotation gizmoGermano Cavalcante
Since [0], transform gizmos are no longer hidden during transform. The same can be observed for rotation gizmos. However, as a workaround for these rotation gizmos, there was already a drawing utility running. With the gizmo and the utility this drawing is now being done twice. So remove the utility/workaround and update the gizmo accordingly. [0] {648350e456490f8d6258e7de9bf94d3a6a34dbb2} Differential Revision: https://developer.blender.org/D9542
2022-06-06Refactor: Snap-related. Clarified attribute names and refactored #defines ↵jon denning
into enums The transformation snapping code contains a bunch of `#define`s, some ambiguously or incorrectly named attributes. This patch contains refactored code to improve this. This patch does (should) not change functionality of snapping. Clarified ambiguously / incorrectly named attributes. - "Target" is used to refer to the part of the source that is to be snapped (Active, Median, Center, Closest), but several other areas of Blender use the term "target" to refer to the thing being snapped to and "source" to refer to the thing getting snapped. Moreover, the implications of the previous terms do not match the descriptions. For example: `SCE_SNAP_TARGET_CENTER` does not snap the grabbed geometry to the center of the target, but instead "Snap transforamtion center onto target". - "Select" refers to the condition for an object to be a possible target for snapping. - `SCE_SNAP_MODE_FACE` is renamed to `SCE_SNAP_MODE_FACE_RAYCAST` to better describe its affect and to make way for other face snapping methods (ex: nearest). Refactored related `#define` into `enum`s. In particular, constants relating to... - `ToolSettings.snap_flag` are now in `enum eSnapFlag` - `ToolSettings.snap_mode` are now in `enum eSnapMode` - `ToolSettings.snap_source` (was `snap_target`) are now in `enum eSnapSourceSelect` - `ToolSettings.snap_flag` (`SCE_SNAP_NO_SELF`) and `TransSnap.target_select` are now in `enum eSnapTargetSelect` As the terms became more consistent and the constants were packed together into meaningful enumerations, some of the attribute names seemed ambiguous. For example, it is unclear whether `SnapObjectParams.snap_select` referred to the target or the source. This patch also adds a small amount of clarity. This patch also swaps out generic types (ex: `char`, `short`, `ushort`) and unclear hard coded numbers (ex: `0`) used with snap-related enumerations with the actual `enum`s and values. Note: I did leave myself some comments to follow-up with further refactoring. Specifically, using "target" and "source" consistently will mean the Python API will need to change (ex: `ToolSettings.snap_target` is not `ToolSettings.snap_source`). If the API is going to change, it would be good to make sure that the used terms are descriptive enough. For example, `bpy.ops.transform.translate` uses a `snap` argument to determine if snapping should be enabled while transforming. Perhaps `use_snap` might be an improvement that's more consistent with other conventions. This patch is (mostly) a subset of D14591, as suggested by @mano-wii. Task T69342 proposes to separate the `Absolute Grid Snap` option out from `Increment` snapping method into its own method. Also, there might be reason to create additional snapping methods or options. (Indeed, D14591 heads in this direction). This patch can work along with these suggestions, as this patch is trying to clarify the snapping code and to prompt more work in this area. Reviewed By: mano-wii Differential Revision: https://developer.blender.org/D15037
2022-06-06UI: offset scale gizmos instead of scaling their shapeCampbell Barton
Scaling handles while dragging could be distracting, especially at extreme values where handles could become large on-screen. Now all gizmos are shown while scaling. GIZMO_GT_arrow_3d now now support changing their length while being dragged as well as negative lengths.
2022-06-01Merge branch 'blender-v3.2-release'Campbell Barton
2022-06-01Fix T89726: Fix hitbox of axis gizmo in UV EditorChris Blackbourn
Use the scale from the wmGizmo.matrix_final as a reference for the arrow head-size. Reviewed By: campbellbarton Ref D15056
2022-05-13Cleanup: spelling in comments, capitalize tagsCampbell Barton
Also add missing task-ID reference & remove colon after \note as it doesn't render properly in doxygen.
2022-04-29Cleanup: silence unused variable warningsGermano Cavalcante
2022-04-28Snap Gizmo: update props using gizmo's snap_stateGermano Cavalcante
A snap state can be replaced by another snap state of a gizmo or cursor. The snap gizmo should only change its state, not the current state. It's not really a problem currently.
2022-04-28Snap Cursor: split 'ED_view3d_cursor_snap_data_get'Germano Cavalcante
Split 'ED_view3d_cursor_snap_data_get' into 'update' and 'get' functions Sometimes we just want to update and sometimes we just get the result. Make it clear.
2022-04-20Cleanup: spelling in commentsCampbell Barton
2022-04-14Metal: GPU_PRIM_LINE_LOOP alternative implementations.Jason Fielder
Prefer using immVertex3f when 3D shaders are used for 2D rendering due to overhead of vertex padding in hardware. CPU overhead is negligible. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D14494
2022-03-15Fix T96357: Issue clicking on stem of arrow gizmos to scale on axisCampbell Barton
Caused by 0cb5eae9d0617abedf745753c23061ddfcfd1416 which restored support for 3D depth when selecting gizmos - making it difficult to select single lines drawn in front of other gizmos. Previously the first hit was always used. Resolve by using a margin around arrow stems when selecting which was already done for 2D arrows.
2022-03-14Auto-generate RNA-structs declarations in `RNA_prototypes.h`Julian Eisel
So far it was needed to declare a new RNA struct to `RNA_access.h` manually. Since 9b298cf3dbec we generate a `RNA_prototypes.h` for RNA property declarations. Now this also includes the RNA struct declarations, so they don't have to be added manually anymore. Differential Revision: https://developer.blender.org/D13862 Reviewed by: brecht, campbellbarton
2022-03-01Cleanup: ED_view3d_win_to_delta & ED_view3d_calc_zfac usageCampbell Barton
- Rename ED_view3d_win_to_delta `mval` argument to `xy_delta` as it as it was misleading since this is an screen-space offset not a region relative cursor position (typical use of the name `mval`). Also rename the variable passed to this function which also used the term `mval` in many places. - Re-order the output argument of ED_view3d_win_to_delta last. use an r_ prefix for return arguments. - Document how the `zfac` argument is intended to be used. - Split ED_view3d_calc_zfac into two functions as the `r_flip` argument was only used in some special cases.
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-04Cleanup: cage3d gizmo used two margin scale valuesCampbell Barton
Replace this with a single margin.
2022-02-04Fix T88579: scale cage doesn't work well for small/large objectslictex_
Apply proper view scale for cage 3d's draw_select, same as draw. Reviewed By: campbellbarton Ref D13956
2021-12-14Cleanup: correct unbalanced doxygen groupsCampbell Barton
Also add groups in some files.
2021-12-08Cleanup: move public doc-strings into headers for 'editors'Campbell Barton
Ref T92709
2021-11-08Fix snap cursor not active even if gizmo is availableGermano Cavalcante
Error introduced in rB69d6222481b4 and partially fixed in rB24310441ddc8. When gizmo was turned on but the scene has more than one 3D viewport, one of them the snap cursor did not appear.
2021-11-02Fix snap cursor still active even when gizmo is not availableGermano Cavalcante
The snap cursor continued to appear even when the workspace is changed for example. So add the region to check in the cursor pool.
2021-10-27Cleanup: remove underscore prefix from variableCampbell Barton
Avoid using underscore prefix since these typically mean the variable shouldn't be accessed directly (it may be accessed from a macro, or memory on the stack which is assigned to a pointer). In this case a more meaningful name can be used for the argument that was shadowed.
2021-10-26View3D Snap Cursor: sanitize and increase the maximum amount of statesGermano Cavalcante
3 is a small amount as each viewport creates a gizmo that creates its own state Now if the state is not created, the gizmos use the last state.
2021-10-20Cleanup: use an array for wmEvent cursor position variablesAaron Carlisle
Use arrays for wmEvent coordinates, this quiets warnings with GCC11. - `x, y` -> `xy`. - `prevx, prevy` -> `prev_xy`. - `prevclickx, prevclicky` -> `prev_click_xy`. There is still some cleanup such as using `copy_v2_v2_int()`, this can be done separately. Reviewed By: campbellbarton, Severin Ref D12901
2021-10-20Cleanup: unused parameters, `nullptr` instead of `NULL` in cpp code...Bastien Montagne
2021-10-20View3D: Cursor Snap RefactorGermano Cavalcante
Make the snap system consistent with the placement tool and leak-safe. **Changes:** - Store `SnapCursorDataIntern` in a `static` variable; - Initialize (lazily) `SnapCursorDataIntern` only once (for the keymap). - Move setup members of `V3DSnapCursorData` to a new struct `V3DSnapCursorState` - Merge `ED_view3d_cursor_snap_activate_point` and `ED_view3d_cursor_snap_activate_plane` into `state = ED_view3d_cursor_snap_active()` - Merge `ED_view3d_cursor_snap_deactivate_point` and `ED_view3d_cursor_snap_deactivate_plane` into `ED_view3d_cursor_snap_deactive(state)` - Be sure to free the snap context when closing via `ED_view3d_cursor_snap_exit` - Use RNA properties callbacks to update the properties of the `"Add Primitive Object"` operator
2021-10-18Snap and Placement Gizmo RefactorGermano Cavalcante
Move most of the gizmo snap and placement code to `view_cursor_snap.c`. Simplify and extend the snap API. Differential Revision: https://developer.blender.org/D12868
2021-10-16Fix T92184: Cage gizmo doesn't with area lightRichard Antalik
This is caused by removing `gizmo_cage2d_modal()` code in 482806c8167. Some areas use cage gizmo to modify RNA properties without using transform operator like area light, image empty, and compositor preview. This functionality is implemented in code that was removed. Add this code back. Reviewed By: zeddb, campbellbarton Differential Revision: https://developer.blender.org/D12859
2021-10-14Cleanup: clang-tidy, clang-format & spellingCampbell Barton
2021-10-14Fix invalid arguments to ED_gizmotypes_snap_3d_context_ensureCampbell Barton
2021-10-13Cleanup: Snap Context RefactorGermano Cavalcante
Move runtime parameters out of context creation. Not being able to choose another region and v3d limits the use of the snap API.
2021-10-08VSE: Implement the bounding box (xform) tool in the seq preview windowSebastian Parborg
Make the "xform" tool/gizmo available for strip transformations in the sequencer preview window. Because of the amount of hacks needed to make the gizmo work nicely with multiple strips at the same time, it was decided to only show the translate gizmo when multiple strips are selected. This is because the transforms with multiple strips would appear buggy because of our lack of shearing support in the transform system. There is also currently no way to properly sync the gizmo drawing with the transform when using multiple strips. Reviewed By: Richard Antalik, Campbell Barton Differential Revision: http://developer.blender.org/D12729
2021-07-30Cleanup: headers, use 'pragma once', remove argument to '\file'Campbell Barton
2021-07-30Cleanup: clang-format (re-run after v12 version bump)Campbell Barton
2021-07-03Cleanup: consistent use of tags: NOTE/TODO/FIXME/XXXCampbell Barton
Also use doxy style function reference `#` prefix chars when referencing identifiers.
2021-06-30Cleanup: use const arguments for accessor functionsCampbell Barton
2021-04-30Merge branch 'blender-v2.93-release'Campbell Barton
2021-04-30Fix/Workaround T87511: snap gizmo flickers on Ctrl-DragCampbell Barton
Hack to bypass drag events, eventually the gizmo API should support this use case without hacks.
2021-04-30Cleanup: avoid ambiguous parenthesisCampbell Barton
2021-04-19Merge branch 'blender-v2.93-release'Campbell Barton
2021-04-19Fix spin-gizmo button tool-tip placementCampbell Barton
gizmo_button2d_bounds result wasn't valid when the gizmo was part of a 3D gizmo group. Regression in cf6d17a6aa421e0038fc1f8e60e3f1f708887c3e
2021-04-18Cleanup: make formatJacques Lucke
2021-04-17Snap Gizmo Refactor: Implement options for the gizmo behaviorGermano Cavalcante
The Snap Gizmo now has options for occlusion, selection filter and edit geometry. It will be useful to implement in current tools.
2021-04-17Transform Snap Refactor: Use enum for cage snap optionsGermano Cavalcante
This allows the addition of the `SNAP_GEOM_CAGE` option. Currently unused.