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
2021-10-11Only hide preview image while dragging over 3D Viewasset-browser-snap-draggingJulian Eisel
Make the preview hide and unhide depending on if the user drags over the 3D View. In there the preview is too much visual noice, together with the bounding box and snapping plane we draw there.
2021-10-11Adapt to changes in masterJulian Eisel
2021-10-11Merge branch 'master' into asset-browser-snap-draggingJulian Eisel
2021-10-04Asset Browser: Support dragging assets into catalogsJulian Eisel
With this it is possible to select any number of assets in the Asset Browser and drag them into catalogs. The assets will be moved to that catalog then. However, this will only work in the "Current File" asset library, since that is the only library that allows changing assets, which is what's done here. While dragging assets over the tree row, a tooltip is shown explaining what's going to happen. In preparation to this, the new UI tree-view API was already extended with custom drop support, see 4ee2d9df428d. ---- Changes here to the `wmDrag` code were needed to support dragging multiple assets. Some of it is considered temporary because a) a proper #AssetHandle design should replace some ugly parts of this patch and b) the multi-item support in `wmDrag` isn't that great yet. The entire API will have to be written anyway (see D4071). Maniphest Tasks: T91573 Differential Revision: https://developer.blender.org/D12713 Reviewed by: Sybren Stüvel
2021-09-29Fix T89864: Adding an asset referencing other objects adds it to scene but ↵Bastien Montagne
only adds data-blocks of referenced objects. Link/append code needs proper access to scene/view3d data to handle collections/objects instantiation. Note that this is a temporary hack more than a proper fix, which would require a deeper redesign of drag&drop code. Also note that this will not handle 'properly' (i.e. as user would expect it) cases like implicitely appended parent objects, in that only the explicitely appended object will be dropped to the nes location, the others will remain at their original coordinates. Differential Revision: https://developer.blender.org/D12696
2021-09-29Assets: Expose option to reuse data-block data when appendingJulian Eisel
With 794c2828af60 & f48a4aa0f915 it's possible to reuse possibly expensive, nested data of a data-block when appending. E.g. the texture of a material, or the mesh of an object. Without this it's easy to bloat memory and the file size. Duplicated textures also cause unnecessary shader recompilations. The feature was intended to be the new default behavior for the Asset Browser, but it wasn't actually added to the UI yet. This patch adds a new import type option to the Asset Browser. So from the menu in the header, you can now choose between: * Link * Append * Append (Reuse Data) The latter is the new default. Maniphest Task: https://developer.blender.org/T91741 Differential Revision: https://developer.blender.org/D12647 Reviewed by: Sybren Stüvel, Bastien Montagne
2021-09-23LibLink: Modify WM API to link/append one ID to take flag parameter.Bastien Montagne
There is no reason to lock behavior into a specific configuration in those calls, make them properly configurable like the rest of the link/append code. This also enable users of those functions to activate 'ID reuse' behavior.
2021-09-22Cleanup: spelling in commentsCampbell Barton
2021-09-21UI: Style drag-drop indicators as tooltipsPablo Vazquez
Currently, the drop indicator colors are hardcoded to white text on semi-transparent black background. This patch makes the drop indicator use the tooltip theme settings, as they serve a similar purpose. {F10530482, size=full} All built-in themes seem to work well and got improved readability. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D12588
2021-09-13Merge branch 'master' into asset-browser-snap-draggingJulian Eisel
2021-08-05Fix T90430: Crash when dragging materialJulian Eisel
Was trying to get asset information even when there was none, i.e. when the material wasn't an asset or not dragged from the Asset Browser.
2021-08-04T90371: Asset: Drop Material Tooltip.Jeroen Bakker
This patch changes the drop named material tooltip to give feedback to the user what is going to happen when they invoke the change. There are 3 states: * "": Operator will be canceled as not all data is present (dropping on background.) * "Drop <named material> on <object name> (slot <slot number>, replacing <current material in slot>). * "Drop <named material> on <object name> (slot <slot number). Reviewed By: Severin Maniphest Tasks: T90371 Differential Revision: https://developer.blender.org/D12106
2021-08-02WindowManager: Support Dynamic tooltips when dragging.Jeroen Bakker
Originally the operator name was drawn next to the dragging content. After that there was an option to add custom, static text with the dragging content. This patch allows dynamic text to be drawn. The custom text was implemented as out parameter of the poll function what made the code unclear. This patch introduces a tooltip function that separates tooltip generation from the poll function. NOTE: the text should always be returned in its own memory block. This block will be freed after it is copied in the drag struct. Reviewed By: Severin Differential Revision: https://developer.blender.org/D12104
2021-07-30Fix T90318: Dragging asset while Asset Browser is still loading crashesJulian Eisel
This partially reverts cb0b017d8f51: We can't store the asset handle in the drag data, because the file pointer it wraps may be freed as the Asset Browser generates its file list.
2021-07-20Cleanup: Store asset-handle in drag dataJulian Eisel
Would previously pass a few properties that are available via the asset-handle now. This asset-handle is also required for some of the asset API, e.g. the temporary ID loading. This will probably be needed before too long.
2021-07-15Cleanup: replace BLI_assert(!"text") with BLI_assert_msg(0, "text")Campbell Barton
This shows the text as part of the assertion message.
2021-07-05Cleanup: spelling in commentsCampbell Barton
2021-06-22Cleanup: Spelling MistakesLeon Zandman
This patch fixes many minor spelling mistakes, all in comments or console output. Mostly contractions like can't, won't, don't, its/it's, etc. Differential Revision: https://developer.blender.org/D11663 Reviewed by Harley Acheson
2021-06-14Adjustments to drag info drawingJulian Eisel
* Change the "Add Named Object" drag into string to "Add Object". The "Named" part is kinda useless info and relates to an implementation detail. * Draw drag info closer to the cursor. Looked quite off before.
2021-06-13Merge branch 'master' into asset-browser-snap-draggingJulian Eisel
2021-06-11Add option to link assets on drag & dropJulian Eisel
Note: Linking in this case as in link vs. append. Easily confused with linking a data-block to multiple usages (e.g. single material used by multiple objects). Adds a drop-down to the Asset Browser header to choose between Link and Append. This is probably gonna be a temporary place, T54642 shows where this could be placed eventually. Linking support is crucial for usage of the asset browser in production environments. It just wasn't enabled yet because a) the asset project currently focuses on single user, not production assets, and b) because there were many unkowns still for the workflow that have big impact on production use as well. With the recently held asset workshop I'm more confident with enabling linking, as design ideas relevant to production use were confirmed. Differential Revision: https://developer.blender.org/D11536 Reviewed by: Bastien Montagne
2021-04-30Show a bounding box for object assets while draggingJulian Eisel
Note: Object assets have to be saved with this commit or later for the bounding box to appear. Basic idea is: * Store the bounding box (and related info) in the asset metadata. * The bounding box has to be updated and written to custom properties of the asset metadata. * There's a new `AssetTypeInfo` struct, to set asset type dependent callbacks or data (in future). ID types can conveniently define asset-type info as part of their `IDTypeInfo` definition. * The asset-type info can contain a custom callback to be executed before the asset is saved. This is how the object can write its custom asset metadata. * The dropbox can also register a callback to set properties for its gizmo-group now. Used to copy * The "placement plane" gizmo is scaled to the bounding box size too. * For local ID assets, the data should be accessed directly, so the file doesn't have to be saved to get the bounding box updated. Also: * Added proper gizmo group custom property support to C (was already supported in Python, or in C with some hacking). * Store the basis matrix (world matrix without parent or constraint transforms) in the custom asset metadata. Used by the placement gizmo to scale the bounding box to match the result visually when dropping. * The preview image is disabled while dragging objects over the 3D view. * The bounding box always snaps with its lower edge (Z axis) to the surface. Snapping with other axes can be added still. * However, actually dropping the object still uses the origin, so the drop position may not match what the bounding box indicated. This could be changed to also use the bounding box instead. Or the drawn bounding box should be translated to respect the origin position.
2021-04-21Initial prototype for snapping plane feedback while dragging assetsJulian Eisel
Shows the same grid overlay as the Add Object tool when dragging an asset into a 3D view. Uses the gizmo-system for that. How visibility of gizmo-groups is managed is rather tricky, for now I hacked things a bit to work. I have ideas to make this nicer. Besides that, this is generally a design that I think can work in master: Just like tools, drop-boxes can set a gizmo-group to use while they are active. If the gizmo-group supports usage while dragging, it is drawn.
2021-04-11Cleanup: use ELEM, STREQ macrosCampbell Barton
2021-02-16Assets: Remove appended asset when dropping operation failsJulian Eisel
When dropping an asset somewhere, it is appended and then a drop operation is called to actually add it to the scene based on current context. If this drop operation fails, the appended data-block is now still in the .blend. The user may not notice and not expect this. Instead idea is to rollback any changes done by dropping code if the operation fails, namely removing the appended data-block again. Adds a new `cancel()` callback which is called if the drop operator returns `OPERATOR_CANCELLED` to drop-boxes and a generic function to deal with assets on drop failure. Also removes the `free_id_on_error` property of the `NODE_OT_add_group` operator, which was used as ad-hoc solution to get this same behavior.
2021-01-24UI: Avoid showing drop hint on drag & drop if dropping won't succeedJulian Eisel
If the poll check of the operator fails, the operator won't run. We can check that in advance to hide the drop hint if dropping will fail anyway. This improves feedback during dragging.
2021-01-24Cleanup: Add/use helper to check if dragging a certain ID type or asset ID typeJulian Eisel
This check is a common pattern, avoid duplication by using a helper function.
2021-01-13Fix memory leak with image drag and dropCampbell Barton
Dragging an image from the file selector into the sequencer was leaking memory. Regression in b5d778a7d4072bfb091198a2094890157a6d017b.
2020-12-15Asset System: Support dragging assets and appending on dropJulian Eisel
For the Asset Browser, it needs to be possible to drag assets into various editors, which may not come from the current .blend file. In other words, the dragging needs to work with just the asset metadata, without direct access to the data-block itself. Idea is simple: When dragging an asset, store the source file-path and data-block name and when dropping, append the data-block. It uses existing drop operators, but the function to get the dropped data-block is replaced with one that returns the local data-block, or, in case of an external asset, appends the data-block first. The drop operators need to be adjusted to use this new function that respects assets. With this patch it only works for dragging assets into the 3D view. Note that I expect this to be a short-lived change. A refactor like D4071 is needed to make the drag & drop system more future proof for assets and other use cases. Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1 project milestone on developer.blender.org. Differential Revision: https://developer.blender.org/D9721 Reviewed by: Bastien Montagne, Brecht Van Lommel
2020-10-17Cleanup: Miscellaneous improvements in wm directoryHans Goudey
- Reduce variable scope. - Use LISTBASE_FOREACH macros. - Return early in some cases to reduce to reduce indentation.
2020-09-10Cleanup: spellingCampbell Barton
2020-08-18GPUState: GPU_blend final API renamingClément Foucault
We now use GPU_blend for enabling / disabling blending and explicitly set the blend equation.
2020-08-07Cleanup: Blenlib, Clang-Tidy else-after-return fixes (incomplete)Sybren A. Stüvel
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/blenlib` module. Not all warnings are addressed in this commit. No functional changes.
2020-07-26Cleanup: GPU: Remove glew headers part2Clément Foucault
2020-07-26GPU: Remove GL constant from BIF_glutilClément Foucault
2020-04-03Code Quality: Replace for loops with LISTBASE_FOREACHDalai Felinto
Note this only changes cases where the variable was declared inside the for loop. To handle it outside as well is a different challenge. Differential Revision: https://developer.blender.org/D7320
2020-04-03Cleanup: Rename ScrArea variables from sa to areaJulian Eisel
Follow up of b2ee1770d4c3 and 10c2254d412d, part of T74432. Now the area and region naming conventions should be less confusing. Mostly a careful batch rename but had to do few smaller fixes. Also ran clang-format on affected files.
2020-03-19Cleanup/refactor: remove BKE_idcode, in favour of BKE_idtype.Bastien Montagne
Mpving utils from idcode to idtype proved to be somewhat painful for some reasons, but now all looks good. Had to add a fake/empty shell for the special snowflake too, `ID_LINK_PLACEHOLDER/INDEX_ID_NULL`...
2020-03-19Cleanup: `make format` after SortedIncludes changeDalai Felinto
2020-03-06Cleanup: Rename ARegion variables from ar to regionJulian Eisel
The old convention was easy to confuse with ScrArea. Part of https://developer.blender.org/T74432. This is mostly a batch rename with some manual fixing. Only single word variable names are changed, no prefixed/suffixed names. Brecht van Lommel and Campbell Barton both gave me a green light for this convention change. Also ran clan clang format on affected files.
2019-11-27Cleanup: Remove BIF_gl.hJeroen Bakker
BIF_gl.h included hacks like redefining glew functions and a constant. The named constant `GLA_PIXEL_OFS` has been moved to `GPU_viewport.h` Reviewed By: brecht Differential Revision: https://developer.blender.org/D5860
2019-09-26WM: clean up cursors constants and codeBrecht Van Lommel
There was a mix of old and new constants. Now have one list of WM_CURSOR_* cursor types, using GHOST standard cursors when available and otherwise falling back to our custom cursors. Ref D5197
2019-08-05Cleanup: use unsigned char for theme colorsCampbell Barton
Nearly all byte-color functions use 'uchar' causing casts when then colors were passed in. Declare as uchar to remove the need for casts.
2019-06-04Fix status bar and keymap editor showing Call Menu instead of menu nameBrecht Van Lommel
2019-05-09Cleanup: avoid some floating point divisions in drawing codeBrecht Van Lommel
2019-05-09UI: dim icons in inactive tabs, similar to textBrecht Van Lommel
This makes the properties editor navigation bar less saturated. Internally the icon theme coloring was refactored a bit to move more towards the button drawing code.
2019-05-09Cleanup: reduce number of UI_icon_draw variationsBrecht Van Lommel
2019-04-17ClangFormat: apply to source, most of internCampbell Barton
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-13Cleanup: style, use braces for the window managerCampbell Barton
2019-03-25GPU: State: Replace GL_BLEND by GPU_blendClément Foucault