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-09Asset System: New core type to represent assets (`AssetRepresenation`)Julian Eisel
Introduces a new `AssetRepresentation` type, as a runtime only container to hold asset information. It is supposed to become _the_ main way to represent and refer to assets in the asset system, see T87235. It can store things like the asset name, asset traits, preview and other asset metadata. Technical documentation: https://wiki.blender.org/wiki/Source/Architecture/Asset_System/Back_End#Asset_Representation. By introducing a proper asset representation type, we do an important step away from the previous, non-optimal representation of assets as files in the file browser backend, and towards the asset system as backend. It should replace the temporary & hacky `AssetHandle` design in the near future. Note that the loading of asset data still happens through the file browser backend, check the linked to Wiki page for more information on that. As a side-effect, asset metadata isn't stored in file browser file entries when browsing with link/append anymore. Don't think this was ever used, but scripts may have accessed this. Can be brought back if there's a need for it.
2022-11-05Cleanup: use bools and typed enums for WM_job type & flagCampbell Barton
Also use typed enum for the event handler flag.
2022-11-05Cleanup: use bool instead of short for job stop & do_update argumentsCampbell Barton
Since these values are only ever 0/1, use bool type.
2022-10-10UI: show the windowing environment in the "About" splashCampbell Barton
Show the windowing environment on non MS-Windows/Apple systems, since X11/WAYLAND are selected startup there was no convenient way for users to know which back-end was being used. Include the windowing environment in the About splash & system-info.txt since it will be useful for handling bug reports. This commit adds a private API call not intended for general use as I would like to be able to remove this later and it's only needed in the specific case of testing if Blender is using WAYLAND or X11 (which maybe be used via XWayland). Python scripts can already inspect the system to check which windowing environment used, the API call is mainly useful for troubleshooting.
2022-09-26UI: add preference to disable touchpad multitouch gesturesrecht Van Lommel
Available on Windows and macOS, where such gestures are supported. For Windows, disabling this option restores touchpad behavior to match Blender 3.2. Ref T97925 Differential Revision: https://developer.blender.org/D16005
2022-09-08Cleanup: remove ED_types.h & ACTIVE, DESELECT definitionsCampbell Barton
- ACTIVE flag is no longer in use. - DESELECT was used in some places as an alias for false, even though this could arguably help readability, in practice this was often passed with a selection flag leading to confusing calls such as `select_beztriple(bezt, DESELECT, SELECT, HIDDEN)`. Replace SELECT/DESELECT with true/false in these cases. - Remove ED_types.h. Add a 'SELECT' definition to DNA_anim_types.h, for fcurve_test, we could use a shared DNA header, or remove use of the define entirely in favor of typed enums.
2022-08-17Fix T98462: Save Screenshot (glReadPixels) fails under WaylandCampbell Barton
Use an off-screen buffer for the screen-shot operator. Reading from the front-buffer immediately after calling swap-buffers failed for GHOST/Wayland in some cases. While EGL can request to preserve the front-buffer while drawing, this isn't always supported. So workaround the problem by avoiding use of the front-buffer entirely.
2022-07-14Fix `on_drag_start` handler not getting ID when dragging from OutlinerJulian Eisel
We would first invoke the dragging, and then set the drag data (like the ID or the dragged modifier), so the `wmDropBox.on_drag_start()` handler wouldn't be able to access this. This broke dragging some IDs from the Outliner, noticed in D15333. It's now possible to first create/request drag data, extend it, and then invoke the actual dragging. The normal function to start dragging returns `void` now instead of `wmDrag *`, so the drag data can't easily be modified after starting anymore.
2022-07-14WM: Remove ASCII members from wmEvent & GHOST_TEventKeyDataCampbell Barton
The `ascii` member was only kept for historic reason as some platforms didn't support utf8 when it was first introduced. Remove the `ascii` struct members since many checks used this as a fall-back for utf8_buf not being set which isn't needed. There are a few cases where it's convenient to access the ASCII value of an event (or nil) so a function has been added to do that. *Details* - WM_event_utf8_to_ascii() has been added for the few cases an events ASCII value needs to be accessed, this just avoids having to do multi-byte character checks in-line. - RNA Event.ascii remains, using utf8_buf[0] for single byte characters. - GHOST_TEventKeyData.ascii has been removed. - To avoid regressions non-ASCII Latin1 characters from GHOST are converted into multi-byte UTF8, when building X11 without XInput & X_HAVE_UTF8_STRING it seems like could still occur.
2022-07-04Cleanup: remove unused WM_event_is_last_mousemoveCampbell Barton
This was part of walk-mode logic that implemented it's own cursor-grab, now this has been moved to use GHOST's cursor grabbing, it's no longer needed.
2022-06-24Cleanup: remove unused function WM_cursor_compatible_xyCampbell Barton
2022-06-14Fix T98875: Adding camera background image shows errorJulian Eisel
Don't show an error if no operator property is set at all that can be used to find an image file or ID for dropping. The caller can decide if this is an error that needs reporting or a valid case, like it is here.
2022-06-05UI: show gizmo while transformingCampbell Barton
When interacting with translate/rotate/scale gizmo, show the gizmo while it's in use. There are some exceptions to this, as showing all scale gizmos while scaling causes the gizmos to become large & distracting so in this case only the gizmo being dragged is shown. Resolves T63743.
2022-06-02Expose background job info to PythonSybren A. Stüvel
Add `bpy.app.is_job_running(job_type)` as high-level indicator. Job types currently exposed are `WM_JOB_TYPE_RENDER`, `WM_JOB_TYPE_RENDER_PREVIEW`, and `WM_JOB_TYPE_OBJECT_BAKE`, as strings with the `WM_JOB_TYPE_` prefix removed. The functions can be polled by Python code to determine whether such background work is still ongoing or not. Furthermore, new app handles are added for `object_bake_{pre,complete,canceled}`, which are called respectively before an object baking job starts, completes sucessfully, and stops due to a cancellation. Motivation: There are various cases where Python can trigger the execution of a background job, without getting notification that that background job is done. As a result, it's hard to do things like cleanups, or auto-quitting Blender after the work is done. The approach in this commit can easily be extended with other job types, when the need arises. The rendering of asset previews is one that's likely to be added sooner than later, as there have already been requests about this. Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D14587
2022-05-28XR: Fix controller flicker when switching action setsPeter Kim
This could happen when switching between custom action sets that both had controller pose actions. Problem was that controller data is cleared when changing action sets, and this clearing was done when handling WM events, which always occurs after XR controller data is updated from GHOST. Now, instead of activating the action set immediately, delay activation until just before the next XR actions sync.
2022-05-26UI support for showing candidates for string propertiesCampbell Barton
Currently strings are used for cases where a list of identifiers would be useful to show. Add support for string properties to reference a callback to populate candidates to show when editing a string. The user isn't prevented from typing in text not found in this list, it's just useful as a reference. Support for expanding the following strings has been added: - Operator, menu & panel identifiers in the keymap editor. - WM operators that reference data-paths expand using the Python-consoles auto-complete functionality. - Names of keying sets for insert/delete keyframe operators. Details: - `bpy.props.StringProperty` takes an option `search` callback. - A new string callback has been added, set via `RNA_def_property_string_search_func` or `RNA_def_property_string_search_func_runtime`. - Addresses usability issue highlighted by T89560, where setting keying set identifiers as strings isn't practical. - Showing additional right-aligned text in the search results is supported but disabled by default as the text is too cramped in most string search popups where the feature would make sense. It could be enabled as part of other layout tweaks. Reviewed By: brecht Ref D14986
2022-05-24Cleanup: Use new helpers for passing IDs from drag & drop to operatorsJulian Eisel
There are now some generalized helpers for passing IDs from drag & drop to operators via operator properties, mostly introduced in 917c096be6b9 and 8f79fa9c6780. These can be used in a bunch of places to reduce duplicated code and explicitly share a common solution. Side-effect: The "Name" property won't show up in the Adjust Last Operation anymore, and its value won't be remembered over multiple executions of the operator. Both were not at all useful from what I can tell, and I doubt this was done intentionally.
2022-05-24Drag & drop: Invert priority of name and session UUID in ID lookupsJulian Eisel
Continuation of 8f79fa9c6780 and 917c096be6b9. The ID's session UUID is now always priotitized over its name to lookup the ID from drop-box or operator properties. bc3dbf109c67 shows what happens if the name happens to be set for whatever reason and the session UUID isn't prioritized.
2022-05-24Merge branch 'blender-v3.2-release'Julian Eisel
2022-05-24Fix possible lingering around of ID after asset dropping failedJulian Eisel
More and more of the drop operations are being switched to use the ID's session UUID rather than the name, but the cleanup after a drop operator was cancelled assumed they would set the name. They will now first attempt to use the session UUID and fallback to the name if needed.
2022-05-23Merge branch 'blender-v3.2-release'Julian Eisel
2022-05-23Fix further issues when mixing link & append for asset drag & dropJulian Eisel
917c096be6b9 applied to objects only, this also applies the same fix for the general 3D View drop operations, e.g. used for dragging materials, images, worlds, etc. This is needed to fix T95706, but apparently something else is still going on. Needs further investigation.
2022-05-23Cleanup: Move new utilities for ID lookup operator propertiesJulian Eisel
Move them to a more accessible place, so that other operators in different files can use them. The following commit needs this.
2022-05-20WM: return the string length from operator name conversionCampbell Barton
- In some cases it avoids using strlen on the result. - Use ATTR_NONNULL for all arguments. - Remove NULL pointer check for WM_operator_bl_idname src argument. - Rename from/to to src/dst.
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: Simplify job custom data query APISergey Sharybin
There were two calls to access job's custom data. One of them ignored job type, the other one ignored job owner. Now there is a single function to access job's custom data. If the job type or owner is not relevant NULL or WM_JOB_TYPE_ANY can be passes explicitly. Differential Revision: https://developer.blender.org/D14803
2022-04-28VSE: Add precise drag and drop and strip previewsSebastian Parborg
This patch adds the drag and drop strip previews in the VSE. It also adds two new functions to the drag and drop API. 1. "draw_in_view" for callbacks that wants to draw elements in local viewport coordinates 2. "on_drag_start" that can be used for prefetching data only once at the start of the drag. Reviewed By: Julian, Campbell Differential Revision: http://developer.blender.org/D14560
2022-04-04Cleanup: ensure space after file named in headersCampbell Barton
Add blank lines after file references to avoid them being interpreted as doc-strings the following declarations.
2022-03-30Cleanup: use utility function to initialize SelectPick_ParamsCampbell Barton
2022-03-26Cleanup: move eFileSel_Action from DNA to WM_api.hCampbell Barton
This isn't stored in blend files so it can be moved out of DNA. Also use an enum for `WM_FILESEL_*` members.
2022-03-11Fix out of order event handling when calling operators from gizmosCampbell Barton
Activating a gizmo used the windows eventstate which may have values newer than the event used to activate the gizmo. This meant transforms check for the key that activated transform could be incorrect. Support passing an event when calling operators to avoid this problem.
2022-03-10Cleanup: use 'WM_file_' prefix for file operationsCampbell Barton
2022-03-10Cleanup: spelling in comments & some minor clarificationsCampbell Barton
2022-03-09Event System: drag events no longer default to the drag start locationCampbell Barton
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-04Cleanup: remove outdated references to tweakCampbell Barton
2022-03-03Cleanup: Remove redundant drag image size parametersJulian Eisel
Just use the image-buffer size and the already provided scale to determine the size, not the button size (which would always have to match the scaled image-buffer size or it would give unexpected results).
2022-03-02Event System: remove tweak events in favor of click-dragCampbell Barton
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-02Event System: support "Release Confirms" for click-drag eventsCampbell Barton
2022-03-02Merge branch 'blender-v3.1-release'Germano Cavalcante
2022-03-02Fix T95608: Mac issues with drag drop on multi-monitorGermano Cavalcante
Mousemove events are sent to windows. In Windows OS, almost all mousemove events are sent to the window whose mouse cursor is over. On MacOS, the window with mousemove events is always the active window. It doesn't matter if the mouse cursor is inside or outside the window. So, in order for non-active windows to also have events, `WM_window_find_under_cursor` is called to find those windows and send the same events. The problem is that to find the window, `WM_window_find_under_cursor` only has the mouse coordinates available, it doesn't differentiate which monitor these coordinates came from. So the mouse on one monitor may incorrectly send events to a window on another monitor. The solution used is to use a native API on Mac to detect the window under the cursor. For Windows and Linux nothing has changed. Reviewed By: brecht Differential Revision: https://developer.blender.org/D14197
2022-02-25Cleanup: use flags for wmEvent modifier keysCampbell Barton
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-18UI: Speedup preview icon loading from hard driveJulian Eisel
Significantly improves loading speed of preview images from disk, e.g. custom previews loaded using `bpy.utils.previews.ImagePreviewCollection.load()`. See D14144 for details & comparison videos. Differential Revision: https://developer.blender.org/D14144 Reviewed by: Bastien Montagne
2022-02-17XR: Allow variable count of action map subactionsPeter Kim
Previously, the number of action map subactions was limited to two per action (identified by user_path0, user_path1), however for devices with more than two user paths (e.g. Vive Tracker) it will be useful to support a variable amount instead. For example, a single pose action could then be used to query the positions of all connected trackers, with each tracker having its own subaction tracking space. NOTE: This introduces breaking changes for the XR Python API as follows: - XrActionMapItem: The new `user_paths` collection property replaces the `user_path0`/`user_path1` properties. - XrActionMapBinding: The new `component_paths` collection property replaces the `component_path0`/`component_path1` properties. Reviewed By: Severin Differential Revision: https://developer.blender.org/D13949
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-01-26Performance: Remap multiple items in UIJeroen Bakker
During sprite fright loading of complex scenes would spend a long time in remapping ID's The remapping process is done on a per ID instance that resulted in a very time consuming process that goes over every possible ID reference to find out if it needs to be updated. If there are N of references to ID blocks and there are M ID blocks that needed to be remapped it would take N*M checks. These checks are scattered around the place and memory. Each reference would only be updated at most once, but most of the time no update is needed at all. Idea: By grouping the changes together will reduce the number of checks resulting in improved performance. This would only require N checks. Additional benefits is improved data locality as data is only loaded once in the L2 cache. It has be implemented for the resyncing process and UI editors. On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went from 170 seconds to 145 seconds (during hotspot recording). After this patch has been applied we could add similar approach to references (references between data blocks) and functionality (tagged deletion). In my understanding this could reduce the resyncing process to less than a second. Opening the village production file between 10 and 20 seconds. Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`) * Master {F12769210 size=full} * This patch {F12769211 size=full} Reviewed By: mont29 Maniphest Tasks: T94185 Differential Revision: https://developer.blender.org/D13615
2022-01-25Revert "Performance: Remap multiple items in UI"Jeroen Bakker
This reverts commit 948211679f2a0681421160be0d3b90f507bc0be7. This commit introduced some regressions in the test suite. As this change is a core part of blender Bastien and I decided to revert it as the solution isn't clear and needs more investigation. The following tests FAILED: 62 - blendfile_liblink (SEGFAULT) 63 - blendfile_library_overrides (SEGFAULT) It fails in (id_us_ensure_real)
2022-01-25Performance: Remap multiple items in UIJeroen Bakker
During sprite fright loading of complex scenes would spend a long time in remapping ID's The remapping process is done on a per ID instance that resulted in a very time consuming process that goes over every possible ID reference to find out if it needs to be updated. If there are N of references to ID blocks and there are M ID blocks that needed to be remapped it would take N*M checks. These checks are scattered around the place and memory. Each reference would only be updated at most once, but most of the time no update is needed at all. Idea: By grouping the changes together will reduce the number of checks resulting in improved performance. This would only require N checks. Additional benefits is improved data locality as data is only loaded once in the L2 cache. It has be implemented for the resyncing process and UI editors. On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went from 170 seconds to 145 seconds (during hotspot recording). After this patch has been applied we could add similar approach to references (references between data blocks) and functionality (tagged deletion). In my understanding this could reduce the resyncing process to less than a second. Opening the village production file between 10 and 20 seconds. Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`) * Master {F12769210 size=full} * This patch {F12769211 size=full} Reviewed By: mont29 Maniphest Tasks: T94185 Differential Revision: https://developer.blender.org/D13615
2022-01-24Cleanup: Grammar: its self vs. itselfHans Goudey
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Includes unwanted changes This reverts commit 46e049d0ce2bce2f53ddc41a0dbbea2969d00a5d.
2022-01-12BLI: Refactor vector types & functions to use templatesClment Foucault
This patch implements the vector types (i.e:`float2`) by making heavy usage of templating. All vector functions are now outside of the vector classes (inside the `blender::math` namespace) and are not vector size dependent for the most part. In the ongoing effort to make shaders less GL centric, we are aiming to share more code between GLSL and C++ to avoid code duplication. ####Motivations: - We are aiming to share UBO and SSBO structures between GLSL and C++. This means we will use many of the existing vector types and others we currently don't have (uintX, intX). All these variations were asking for many more code duplication. - Deduplicate existing code which is duplicated for each vector size. - We also want to share small functions. Which means that vector functions should be static and not in the class namespace. - Reduce friction to use these types in new projects due to their incompleteness. - The current state of the `BLI_(float|double|mpq)(2|3|4).hh` is a bit of a let down. Most clases are incomplete, out of sync with each others with different codestyles, and some functions that should be static are not (i.e: `float3::reflect()`). ####Upsides: - Still support `.x, .y, .z, .w` for readability. - Compact, readable and easilly extendable. - All of the vector functions are available for all the vectors types and can be restricted to certain types. Also template specialization let us define exception for special class (like mpq). - With optimization ON, the compiler unroll the loops and performance is the same. ####Downsides: - Might impact debugability. Though I would arge that the bugs are rarelly caused by the vector class itself (since the operations are quite trivial) but by the type conversions. - Might impact compile time. I did not saw a significant impact since the usage is not really widespread. - Functions needs to be rewritten to support arbitrary vector length. For instance, one can't call `len_squared_v3v3` in `math::length_squared()` and call it a day. - Type cast does not work with the template version of the `math::` vector functions. Meaning you need to manually cast `float *` and `(float *)[3]` to `float3` for the function calls. i.e: `math::distance_squared(float3(nearest.co), positions[i]);` - Some parts might loose in readability: `float3::dot(v1.normalized(), v2.normalized())` becoming `math::dot(math::normalize(v1), math::normalize(v2))` But I propose, when appropriate, to use `using namespace blender::math;` on function local or file scope to increase readability. `dot(normalize(v1), normalize(v2))` ####Consideration: - Include back `.length()` method. It is quite handy and is more C++ oriented. - I considered the GLM library as a candidate for replacement. It felt like too much for what we need and would be difficult to extend / modify to our needs. - I used Macros to reduce code in operators declaration and potential copy paste bugs. This could reduce debugability and could be reverted. - This touches `delaunay_2d.cc` and the intersection code. I would like to know @howardt opinion on the matter. - The `noexcept` on the copy constructor of `mpq(2|3)` is being removed. But according to @JacquesLucke it is not a real problem for now. I would like to give a huge thanks to @JacquesLucke who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: https://developer.blender.org/D13791