Commit Graph

12473 Commits

Author SHA1 Message Date
Julian Eisel 7ec2c5c10b Cleanup: Remove confusing double negation in RNA helper function
Much more readable that way.
2022-03-15 13:11:41 +01:00
Hans Goudey d4e46c13cc Geometry Nodes: Add named attribute nodes behind experimental flag
This commit adds three nodes:
- `Remove Attribute`: Removes an attribute with the given name
- `Named Attribute`: A field input node
- `Store Named Attribute`: Puts results of a field in a named attribute

They are added behind a new experimental feature flag, because further
development of attribute search and name dependency visualization will
happen as separate steps.

Ref T91742

Differential Revision: https://developer.blender.org/D12685
2022-03-14 11:48:11 -05:00
Julian Eisel a5578351c3 Auto-generate RNA-structs declarations in `RNA_prototypes.h`
So far it was needed to declare a new RNA struct to `RNA_access.h` manually.
Since 9b298cf3db 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-14 17:08:46 +01:00
Julian Eisel 9b298cf3db RNA: Generate property declerations header, solving msg-bus C++ incompatibility
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all
RNA properties. This can be included in regular source files when needing to
reference RNA properties statically.

This solves an issue on MSVC with adding such declarations in functions, like
we used to do. See 800fc17367. Removes any such declarations and the related
FIXME comments.

Reviewed By: campbellbarton, LazyDodo, brecht

Differential Revision: https://developer.blender.org/D13837
2022-03-14 16:50:49 +01:00
Sybren A. Stüvel 7306417ae4 Revert "Animation: Sensible frame range for motion paths"
This reverts commit 1558b270e9.

An earlier commit (rB101fadcf6b93c) introduced some new functionality,
which was overlooked in reviewing this commit & got broken.

Will re-commit after the issue has been fixed.

Ref: D13687
2022-03-14 11:17:45 +01:00
Jacques Lucke 82e7956f12 Fix T96396: cannot set active node group output with Python
This is essentially the same fix as in rB22a341d9d8d3d337f79df228ab2e4e0726f81430.
2022-03-14 10:21:47 +01:00
Campbell Barton 541ba68991 Cleanup: use size_t for BLF text API functions
Also minor cleanup to txt_sel_to_buf:

- Use memcpy instead of strncpy as the strings don't contain nil bytes.
- Replace while loops with for loops.
2022-03-14 14:25:33 +11:00
Hallam Roberts 3da84d8b08 Cleanup: use M_PI_2 and M_PI_4 where possible
The constant M_PI_4 is added to GLSL to ensure it works there too.

Differential Revision: https://developer.blender.org/D14288
2022-03-11 18:27:58 +01:00
Campbell Barton cf58648409 Correct error in d2222d5b2c 2022-03-11 15:27:34 +11:00
Campbell Barton d2222d5b2c RNA: use a function to access the nurbs error message
It makes more sense to use a function in this case as this
creates an error message which is not data associated with
the NURBS curve.
2022-03-11 15:21:30 +11:00
Campbell Barton 231eac160e PyAPI: use C/RNA API for Text.from_string/to_string
Use faster C code for getting the buffer from text.
2022-03-11 14:44:02 +11:00
Campbell Barton 1032f111d0 RNA: support functions returning allocated strings
Now it's possible for a C/RNA function to return a dynamic string,
The PROP_NEVER_NULL flag is also supported so a NULL string returns
None in Python.
2022-03-11 14:42:39 +11:00
Laurynas Duburas 0602852860 Curve: Improve NURBS knot generation modes
This patch enables all 8 combinations of Nurbs modes: Cyclic,
Bezier and Endpoint. Also removes restriction on Bezier Nurbs order.

The most significant changes are mode combinations bringing new
meaning. In D13891 is a scheme showing NURBS with same control
points in a modes, and also further description of each possible case.

Differential Revision: https://developer.blender.org/D13891
2022-03-10 18:34:27 -06:00
Germano Cavalcante e3de755ae3 Transform/UI: individualize the option to use snap per editor type
`3DView`'s `use_snap` option has little or nothing to do with using
snapping in `UV`, `Nodes` or `Sequencer`.
So there are no real advantages to keeping these options in sync.

Therefore, individualize the option to use snap for each "spacetype".

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D13310
2022-03-10 18:47:38 -03:00
Jacques Lucke 22a341d9d8 Fix T96292: unable to set active material output using Python
Differential Revision: https://developer.blender.org/D14301
2022-03-10 18:04:07 +01:00
Sybren A. Stüvel 7b62203fc7 IK: make Ik chain length non-animatable
Mark the chain length of regular and spline IK constraints
non-animatable. Changing the IK chain length requires a rebuild of
depsgraph relations. This makes it unsuitable for animation. It's better
to simply avoid having this property animatable than to allow animation
but produce unstable results.

Ref: T96203
2022-03-10 11:34:51 +01:00
Campbell Barton 36dd3f42bc Cleanup: use 'WM_file_' prefix for file operations 2022-03-10 16:27:18 +11:00
Campbell Barton 1829232598 Cleanup: spelling in comments & some minor clarifications 2022-03-10 16:27:18 +11:00
Jacques Lucke 4da282a161 Curves: rename initial brushes
The brushes that are still called "Test" still need to be changed
until they can get their correct name.

Ref T96259.
2022-03-09 11:33:33 +01:00
Campbell Barton 2146256563 Cleanup: use ELEM macro 2022-03-09 10:13:43 +11:00
Campbell Barton 626c844105 Cleanup: rename wmEvent.prev_click_* to prev_press_*
At the time of naming these members only some event types generated
click events so it made some sense to differentiate a click.

Now all buttons support click & drag it's more logical to use the
prefix "prev_press_" as any press event will set these values.

Also update doc-strings.
2022-03-09 09:25:14 +11:00
Campbell Barton b8960267dd Event System: drag events no longer default to the drag start location
This avoids transform jumping which is a problem when tweaking values a
small amount. A fix for T40549 was made box-select used the location
when the key was pressed.

While it's important for box-select or any operator where it's expected
the drag-start location is used, this is only needed in some cases.
Since the event stores the click location and the current location,
no longer overwrite the events real location. Operators that depend on
using the drag-start can use this location if they need.

In some cases the region relative cursor location (Event.mval) now needs
to be calculated based on the click location.

- Added `WM_event_drag_start_mval` for convenient access to the region
  relative drag-start location (for drag events).
- Added `WM_event_drag_start_xy` for window relative coordinates.
- Added Python property Event.mouse_prev_click_x/y

Resolves T93599.

Reviewed By: Severin

Ref D14213
2022-03-09 08:38:42 +11:00
Antonio Vazquez 50bd8bb175 Cleanup: Remove extra . at the end of RNA string
The strings must not end with point.
2022-03-08 16:55:29 +01:00
Marc Chéhab e74838d0d0 GPencil: New "Additive" mode for build modifier
The new mode only builds the new strokes in each frame. 

The code is assuming somebody uses "additive" drawing, so that each frame is different only in its NEW strokes. Already existing strokes are skipped. 

I used a simple solution: Count the number of strokes in the previous frame and ignore this many strokes in the current frame.

Differential Revision: https://developer.blender.org/D14252
2022-03-08 16:40:27 +01:00
Bastien Montagne 0df8c22c8a LibOverrides: Tweak to ensure no overrides can be created on linked data.
Was already mostly the case, but from RNA API there was no proper check.
2022-03-08 11:02:22 +01:00
Jacques Lucke 10c11bb897 Curves: add initial comb, grow and shrink brush
The exact behavior of the brushes is still being iterated on, but it
helps having a base implementation that we can work upon.
All of that is still hidden behind an experimental feature flag anyway.

The brushes will get a name in the ui soon.

Differential Revision: https://developer.blender.org/D14241
2022-03-08 10:41:52 +01:00
Campbell Barton 59c972b40a Event System: remove unused NDOF buttons
GHOST always converts NDOF keyboard buttons into keyboard events
so there is no need to expose their values for Blender event types.
2022-03-08 14:01:49 +11:00
Campbell Barton 7b66397664 Cleanup: spelling in comments, use C++ comments for disabled code 2022-03-08 13:48:31 +11:00
Campbell Barton 0212c423bf Cleanup: remove outdated references to tweak 2022-03-04 13:31:16 +11:00
Azeem Bande-Ali fd2519e0b6 UI: Drag & Drop to Properties Materials Panel
Support drag/drop of materials to Properties Material Slots.

See D13549 for more details.

Differential Revision: https://developer.blender.org/D13549

Reviewed by Julian Eisel
2022-03-03 15:28:48 -08:00
Bastien Montagne 1b863041c9 i18n: Fix more potential contextual issues with "Back" UI label.
Add 'ID_ACTION' context to some animation curve interpolation enums.

Related to T95506/T43295.
2022-03-03 14:52:45 +01:00
Siddhartha Jejurkar ffaaa0bcbf UV: Edge selection support
This patch adds edge selection support for UV editing (refer T76545).
Developed as a part of GSoC 2021 project - UV Editor Improvements.

Previously, selections in the UV editor always flushed down to vertices
and this caused multiple issues such as T76343, T78757 and T26676.
This patch fixes that by adding edge selection support for all UV
operators and adding support for flushing selections between vertices
and edges. Updating UV select modes is now done using a separate
operator, which also handles select mode flushing and undo for UV
select modes. Drawing edges (in UV edge mode) is also updated to match
the edit-mesh display in the 3D viewport.

Notes on technical changes made with this patch:
* MLOOPUV_EDGESEL flag is restored (was removed in rB9fa29fe7652a).
* Support for flushing selection between vertices and edges.
* Restored the BMLoopUV.select_edge boolean in the Python API.
* New operator to update UV select modes and flushing.
* UV select mode is now part of editmesh undo.

TODOs added with this patch:
* Edge support for shortest path operator (currently uses vertex path logic).
* Change default theme color instead of reducing contrast with edge-select.
* Proper UV element selections for Reveal Hidden operator.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12028
2022-03-03 17:59:09 +05:30
Hans Goudey 3c175caaa3 Cleanup: Rename set handle type node internally to match UI
I've had trouble finding this node a few times now,
it's simpler if the file name matches the name in the UI.
2022-03-02 17:58:17 -05:00
Nikhil Shringarpurey 721b705499 UI: Comments Misspellings of Vertex/Vertices
Correct misspellings in code comments of "vertex" and "vertices".

See D13932 for more details.

Differential Revision: https://developer.blender.org/D13932

Reviewed by Harley Acheson
2022-03-02 10:05:15 -08:00
Antonio Vazquez ca0b728529 Fix T96101: "Remove" button failure on Grease Pencil layer's relation to bone
As the channel was not found, the relation data was not updated.

Now, if the bone is removed, the relation is set.
2022-03-02 17:48:35 +01:00
Jacques Lucke ac45540a34 Curves: add brush to add curves on surface
This adds a prototype for the first brush that can add new curves by
painting on a surface. Note that this can only be used when the curves
object has a surface object set in the properties panel.

The brush can take minimum distance into account. This allows
distributing curves with a somewhat consistent density.

Differential Revision: https://developer.blender.org/D14207
2022-03-02 17:15:44 +01:00
Campbell Barton 46a5a15d30 Cleanup: rename direction enum as it's part of the key-map item
Also improve doc-strings for key-map item constants.
2022-03-02 18:00:59 +11:00
Campbell Barton 4986f71848 Event System: remove tweak events in favor of click-drag
Supporting two kinds of dragging is redundant, remove tweak events as
they only supported 3 mouse buttons and added complexity from using the
'value' to store directions.

Support only click-drag events (KM_CLICK_DRAG) which can be used with
any keyboard or mouse button.

Details:

- A "direction" member has been added to keymap items and events which
  can be used when the event value is set to KM_CLICK_DRAG.

- Keymap items are version patched.

- Loading older key-maps are also updated.

- Currently the key-maps stored in ./release/scripts/presets/keyconfig/
  still reference tweak events & need updating. For now they are updated
  on load.

Note that in general this wont impact add-ons as modal operators don't
receive tweak events.

Reviewed By: brecht

Ref D14214
2022-03-02 15:31:50 +11:00
Jacques Lucke 4b9c77a19a Merge branch 'blender-v3.1-release' 2022-03-01 11:36:46 +01:00
Jeroen Bakker a5214212cf Fix T96030: ImageEditor not updated for generated images. 2022-03-01 10:51:07 +01:00
Campbell Barton 8a8424021c Cleanup: move Event.is_repeat & is_direction_inverted to flags
Use a flag for events to avoid adding struct members every time a new
kind of tag is needed - so events remain small.

This also simplifies copying settings as flags can be copied at once
with a mask.
2022-03-01 12:21:27 +11:00
Campbell Barton 5777bd719b Cleanup: use doxygen comments, correct spelling
Also move eDupli_ID_Flags doc-string to it's declaration.
2022-03-01 09:36:25 +11:00
Colin Marmont 1558b270e9 Animation: Sensible frame range for motion paths
Motion paths can now be initialised to more sensible frame ranges,
rather than simply 1-250:

- Scene Frame Range
- Selected Keyframes
- All Keyframes

The Motion Paths operators are now also added to the Object context menu
and the Dopesheet context menu.

The scene range operator was removed, because the operators now
automatically find the range when baking the motion paths.

The clear operator now appears separated in "Selected Only" and "All",
because it was not clear for the user what the button was doing.

Reviewed By: sybren, looch

Maniphest Tasks: T93047

Differential Revision: https://developer.blender.org/D13687
2022-02-28 12:28:19 +01:00
Aaron Carlisle 576853661c UI: Use title case for labels 2022-02-25 23:34:08 -05:00
Jacques Lucke 6e11cfc56a Curves: add surface object pointer
Ref T95776.

Differential Revision: https://developer.blender.org/D14182
2022-02-25 13:22:42 +01:00
Bastien Montagne 1a853a9e90 LibOverrides: fix handling of hierarchy root in complex cases.
This affects essentially the Outliner 'create hierarchy' tool currenlty.
Previously code did not handle properly hierarchy root in case overrides
where created from a non-root ID (e.g. an object inside of a linked
collection), and in case additional partial overrides were added to an
existing partially overrided hierarchy.

Also did some renaming on the go to avoid using 'reference' in override
context for anything else but the reference linked IDs.
2022-02-25 12:18:48 +01:00
Antonio Vazquez 5fd792c1f6 GPencil: Fill Dilate using negative values contract the fill area
This is requested by artist for some animation styles where is necessary to fill the area, but create a gap between fill and stroke.

Also some code cleanup and fix a bug in dilate for top area.

Reviewed By: pepeland, mendio

Differential Revision: https://developer.blender.org/D14082

Note: This was committed only in master (3.2) by error.
2022-02-25 11:15:42 +01:00
Campbell Barton ad0b3abf53 Cleanup: use flags for wmEvent modifier keys
Using flags makes checking multiple modifiers at once more convenient
and avoids macros/functions such as IS_EVENT_MOD & WM_event_modifier_flag
which have been removed. It also simplifies checking if modifier keys
have changed.
2022-02-25 17:58:22 +11:00
Hans Goudey cc966c548d Merge branch 'blender-v3.1-release' 2022-02-24 11:57:53 -05:00
Hans Goudey 7b37d980b9 Fix: Crash switching between sculpt and edit mode
Also fix a couple other places where normals layers weren't properly
tagged dirty or reallocated when the mesh changes.

Caused by cfa53e0fbe. When the size of a mesh changes,
the normal layers need to be reallocated. There were a couple of places
that cleared other runtime data with `BKE_mesh_runtime_clear_geometry`
but didn't deal with normals properly. Clearing the runtime "geometry"
is different from clearing the normals, because sometimes the size of
the normal layers doesn't have to change, in which case simply tagging
them dirty is fine.
2022-02-24 11:56:32 -05:00