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-04-25Nodes: show overlays in node editor even when nodes are collapsedJacques Lucke
2022-04-25Geometry Nodes: improve attribute dependency overlayJacques Lucke
* Adjust width based on node width, necessary to make the longer name below work. * Show "X Named Attributes" in the overlay. * Use "Accessed named attributes" in the tooltip. Differential Revision: https://developer.blender.org/D14751
2022-04-25Geometry Nodes: show timing overlay above attributes overlayJacques Lucke
2022-04-25Fix: use natural string sorting for attribute namesJacques Lucke
2022-04-15Cleanup: Clang tidyHans Goudey
2022-04-14Geometry Nodes: show used named attributes in nodesJacques Lucke
This adds a new node editor overlay that helps users to see where named attributes are used. This is important, because named attributes can have name collisions between independent node groups which can lead to hard to find issues. Differential Revision: https://developer.blender.org/D14618
2022-04-12UI: Add support for showing socket descriptions in tooltipsLukas Stockner
Currently, hovering over a socket itself shows no tooltip at all, while hovering over its value field shows "Default value", which is not helpful. This patch therefore implements socket tooltips following the proposal at https://blender.community/c/rightclickselect/2Qgbbc/. A lot of the basic functionality was already implemented for Geometry Nodes, where hovering over the socket itself shows introspection info. This patch extends this by: - Supporting dynamic tooltips on labels, which is important for good tooltip coverage in a socket's region of the node. - Adding a function to setting a dynamic tooltip for an entire uiLayout, which avoids needing to set it manually for a wide variety of socket types. - Hiding the property label field in a tooltip when dynamic tooltip is also provided. If really needed, this label can be restored through the dynamic tooltip, but in all current cases the label is actually pointless anyways since the dynamic tooltip gives more accurate and specific information. - Adding dynamic tooltips to a socket's UI layout row if it has a description configured, both in the Node Editor as well as in the Material Properties. Note that the patch does not add any actual tooltip content yet, just the infrastructure to show them. By default, sockets without a description still show the old "Default value" tooltip. For an example of how to add socket descriptions, check the Cylinder node in the Geometry Nodes. Differential Revision: https://developer.blender.org/D9967
2022-04-05Cleanup: clang-formatCampbell Barton
Also add space below file references.
2022-04-04Cleanup: clang-tidyCampbell Barton
2022-04-01Cleanup: Move geometry set fields to a separate headerHans Goudey
This commit moves declarations that depend on `FN_field.hh` out of `BKE_geometry_set.hh` into `BKE_geometry_fields.hh`. This helps to reduce the number of areas that need to depend on the functions module, which recently came in in review of D11591. In the future we may have a library of standard field inputs in order to make composing algorithms easier, so it makes sense to have a header that could contain them and some basic related utilities relating the concepts of geometry and fields. Reducing use of unnecessary headers may also reduce compilation time. Differential Revision: https://developer.blender.org/D14517
2022-03-30UI: Fix cosmetic papercuts of the reroute nodeLeon Schittek
Fix small cosmetic issues with the reroute node: 1. Remove special case that allowed curved links to attach vertically. 2. Center align the reroute node's label. The vertically attached node links could lead to kinks in the otherwise smooth curves. This would break the visual flow and make the link potentially intersect the node's label. The center alignment of the label gives more consistent results for different label lengths and also reduces the chance of the label interfering with the node links. Reviewed By: Hans Goudey, Pablo Vazquez Differential Revision: D14457
2022-03-19BLI: move generic data structures to blenlibJacques Lucke
This is a follow up to rB2252bc6a5527cd7360d1ccfe7a2d1bc640a8dfa6.
2022-03-18BLI: move CPPType to blenlibJacques Lucke
For more detail about `CPPType`, see `BLI_cpp_type.hh` and D14367. Differential Revision: https://developer.blender.org/D14367
2022-03-16Geometry Nodes: Remove legacy node codeHans Goudey
This commit removes the implementations of legacy nodes, their type definitions, and related code that becomes unused. Now that we have two releases that included the legacy nodes, there is not much reason to include them still. Removing the code means refactoring will be easier, and old code doesn't have to be tested and maintained. After this commit, the legacy nodes will be undefined in the UI, so 3.0 or 3.1 should be used to convert files to the fields system. The net change is 12184 lines removed! The tooltip for legacy nodes mentioned that we would remove them before 4.0, which was purposefully a bit vague to allow us this flexibility. In a poll in a devtalk post showed that the majority of people were okay with removing the nodes. https://devtalk.blender.org/t/geometry-nodes-backward-compatibility-poll/20199 Differential Revision: https://developer.blender.org/D14353
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-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: spelling in comments & some minor clarificationsCampbell Barton
2022-03-01UI: Fix multi input socket outline and highlightLeon Schittek
Small fixes to the drawing of multi input sockets: - Make the outline thickness consistent with normal node sockets, independent from the screen DPI. - Only highlight multi input sockets when they are actually selected. - Skip selected multi inputs when drawing normal selected sockets. Differential Revision: https://developer.blender.org/D14192
2022-02-28Nodes: Improve readability of selected node linksLeon Schittek
This commit improves the drawing of selected node links: - Highlight the entire link to make it easier to spot where the link is going/coming from. - Always draw selected links on top, so they are always clearly visible. - Don't fade selected node links when the sockets they are connected to are out out view. - Dragged node links still get a partial highlight when they are only attached to one socket. Differential Revision: https://developer.blender.org/D11930
2022-02-23Cleanup: Remove repeated word in commentsCampbell Barton
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-08Merge branch 'blender-v3.1-release'Philipp Oeser
2022-02-08Fix T94415: Nodes: poor selection behavior inside frame nodesPhilipp Oeser
Previously, node selection made no distinction between a frame node and other nodes. So a frame node would be selected by their whole rect or center (depending on box/lasso/circle select). As a consequence of this, box and lasso could not pratically be started inside a frame node (with the intention to select a subset of contained child nodes) because the frame would be selected immediately and tweak-transforming started. Circle selecting would always contain the frame node as well (making transforming a subset of nodes without also transforming the whole frame impossible). Now change selection behavior so that for all selection modes only the border [the margin area that is automatically added around all nodes, see note below] of a frame node is considered in selection. This makes for a much more intuitive experience when arranging nodes inside frames. note: to make the area of interest for selection/moving more obvious, the cursor changes when hovering over (as is done for resizing). note: this also makes the resize margin consistent with other nodes. note: this also fixes right resize border (was exclusive instead of inclusive as every other border) Also fixes T46540.
2022-02-08UI: Change computation of node socket position to align with labelDominik Fill
This Diff changes the computation of the input and output socket position to being always aligned with its corresponding label. Reviewed By: campbellbarton Ref D14025
2022-02-07Nodes: Dynamic node class for Map Range nodeCharlie Jolly
This patch makes it possible to set the UI color of a node's header bar and override the default from the node's typeinfo. Currently the color is taken from the `.nclass` member of the node's bNodeType->TypeInfo struct. This is created once when registering the node. The TypeInfo is used for both UI and non-UI functionality. Since the TypeInfo is shared, the header bar for the node can't be changed without changing all nodes of that type. The Map Range node is shown as a `Converter` or blue color by default. This patch allows this to be changed dynamically to `Vector` or purple. This is done by adding a `ui_class` callback to node typeinfo struct. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D13936
2022-01-31UI Papercut: Fix gap in node outlineLeon Schittek
Correct corner radius of the node outline to prevent a noticeable gap in some cases. --- Currently we make a small mistake in the creation of the node outline: We offset the rectangle describing the outline by the outline thickness, but we don't adjust the corner radius accordingly. Therefore the rounded corner of the outline and the node body are not concentric which can sometimes lead to a visible gap at the corner. How noticeable it is depends on the theme, the screen's dpi and the line thickness set in the preferences. Simply adjusting the corner radius for the outline to also be increased by the outline thickness fixes this small issue. | display, line thickness | **patch** | **master** | | --- | --- | --- | | 1080p, default/thin | {F12835304} | {F12835305} | | retina, thin | {F12835306} | {F12835307} | The issue was mentioned by @hitrpr Reviewed By: Blendify Differential Revision: https://developer.blender.org/D13955
2022-01-20Cleanup: Move node editor files to proper namespaceHans Goudey
This commit moves code in all node editor files to the `blender::ed::space_node` namespace, except for C API functions defined in `ED_node.h`, which can only be moved once all areas calling them are moved to C++. The change is fairly straightforward, I just moved a couple of "ED_" code blocks around to make the namespace more contiguous, and there's the method for adding a pointer to a struct in a C++ namespace in DNA. Differential Revision: https://developer.blender.org/D13871
2022-01-18Cleanup: Use references, LISTBASE_FOREACH macroHans Goudey
2022-01-18Cleanup: Make node editor functions privateHans Goudey
These operations (sorting and selecting all nodes) should generally be handled by the node editor and not outside code. They were not called outside of the node editor, so they can be moved to the editor's `intern` header.
2022-01-17Cleanup: Improve naming of immediate mode buffer draw functionsJulian Eisel
Followup to the previous commit. Jeroen and I agreed the old naming was confusing.
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
2022-01-12Revert "BLI: Refactor vector types & functions to use templates"Clément Foucault
Reverted because the commit removes a lot of commits. This reverts commit a2c1c368af48644fa8995ecbe7138cc0d7900c30.
2022-01-12BLI: Refactor vector types & functions to use templatesClément 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 @Howard Trickey (howardt) opinion on the matter. - The noexcept on the copy constructor of mpq(2|3) is being removed. But according to @Jacques Lucke (JacquesLucke) it is not a real problem for now. I would like to give a huge thanks to @Jacques Lucke (JacquesLucke) who helped during this and pushed me to reduce the duplication further. Reviewed By: brecht, sergey, JacquesLucke Differential Revision: http://developer.blender.org/D13791
2022-01-12BLF: Reduction of use of BLF_DRAW_STR_DUMMY_MAXHarley Acheson
Reduction of the number of uses of the define BLF_DRAW_STR_DUMMY_MAX by using actual sizes of static character arrays. See D13793 for more details. Differential Revision: https://developer.blender.org/D13793 Reviewed by Campbell Barton
2021-12-22Nodes: Remove unnecessary node tree socket taggingHans Goudey
`SOCK_IN_USE` is now set in `update_socket_used_tags` in `node_tree_update.cc` when a node tree is changed. It doesn't need to run every single redraw. Removing this results in a small speedup of 0.4 ms when drawing a tree with about 4000 nodes (from about 70 ms total). Differential Revision: https://developer.blender.org/D13645
2021-12-21Nodes: refactor node tree update handlingJacques Lucke
Goals of this refactor: * More unified approach to updating everything that needs to be updated after a change in a node tree. * The updates should happen in the correct order and quadratic or worse algorithms should be avoided. * Improve detection of changes to the output to avoid tagging the depsgraph when it's not necessary. * Move towards a more declarative style of defining nodes by having a more centralized update procedure. The refactor consists of two main parts: * Node tree tagging and update refactor. * Generally, when changes are done to a node tree, it is tagged dirty until a global update function is called that updates everything in the correct order. * The tagging is more fine-grained compared to before, to allow for more precise depsgraph update tagging. * Depsgraph changes. * The shading specific depsgraph node for node trees as been removed. * Instead, there is a new `NTREE_OUTPUT` depsgrap node, which is only tagged when the output of the node tree changed (e.g. the Group Output or Material Output node). * The copy-on-write relation from node trees to the data block they are embedded in is now non-flushing. This avoids e.g. triggering a material update after the shader node tree changed in unrelated ways. Instead the material has a flushing relation to the new `NTREE_OUTPUT` node now. * The depsgraph no longer reports data block changes through to cycles through `Depsgraph.updates` when only the node tree changed in ways that do not affect the output. Avoiding unnecessary updates seems to work well for geometry nodes and cycles. The situation is a bit worse when there are drivers on the node tree, but that could potentially be improved separately in the future. Avoiding updates in eevee and the compositor is more tricky, but also less urgent. * Eevee updates are triggered by calling `DRW_notify_view_update` in `ED_render_view3d_update` indirectly from `DEG_editors_update`. * Compositor updates are triggered by `ED_node_composite_job` in `node_area_refresh`. This is triggered by calling `ED_area_tag_refresh` in `node_area_listener`. Removing updates always has the risk of breaking some dependency that no one was aware of. It's not unlikely that this will happen here as well. Adding back missing updates should be quite a bit easier than getting rid of unnecessary updates though. Differential Revision: https://developer.blender.org/D13246
2021-12-18Fix T94173: Missing update for frame node sizeHans Goudey
Before d56bbfea7b420d7, nodes were updated (size calculated and buttons added) in reverse order. Instead, now calculate the size of frame nodes after all other nodes. Separating the drawing further may be a good step to removing the O(n^2) loop later on.
2021-12-17UI: Fix node socket alignment in some casesAlessio Monti di Sopra
The patch fixes some misalignments in the nodes' sockets/options recently introduced in 26d2caee3ba0, while maintaining the original fix for T92268. The original fix made the top padding always of the same size; while that works when the first row of the other node is `Socket | Socket`, it doesn't for other more common cases, `like Socket | Node Option`, where the text results misaligned. Differential Revision: https://developer.blender.org/D13451
2021-12-14Cleanup: Remove unused argumentsHans Goudey
2021-12-14Cleanup: Remove runtime uiBlock pointer from nodesHans Goudey
Code is simpler when the uiBlocks used during drawing are simply stored in an array. Additionally, looping can be simpler when we use an vector to hold a temporary copy of the tree's linked list of nodes. This patch also slightly changes how uiBlocks are "named" in `node_uiblocks_init`. Now it uses the node name instead of the pointer, which is helpful so we rely less on the node's address. Differential Revision: https://developer.blender.org/D13540
2021-12-11Cleanup: Use const argumentsHans Goudey
Also remove unnecessary function to set a node type's label function that duplicated its definition, and make another function static.
2021-12-10Cleanup: Remove unnecessary runtime rectangle from nodes in DNAHans Goudey
I assume this `butr` rectangle was used more in the past, but currently its value is set and used less than 10 lines apart, so it's trivial to remove 16 bytes from every node. The other rectangles are also runtime data and could be removed, but they are more difficult.
2021-12-08Cleanup: Use float2 for node view functionsHans Goudey
Though the interfacing with `rctf` becomes slightly more complicated, this should be more helpful as more of this code usese `float2` instead of two separate floats.
2021-12-08Cleanup: move public doc-strings into headers for 'editors'Campbell Barton
Ref T92709
2021-12-08Cleanup: Clang-Tidy modernize-redundant-void-argAaron Carlisle
2021-12-07Cleanup: Remove unused includesHans Goudey
2021-12-07Cleanup: Remove unnecessary generic includes from headersHans Goudey
2021-12-06Cleanup: Remove unnecesary node type draw callbackHans Goudey
As a followup to 338c1060d5d7, apply the same change to the node drawing callback. This helps to simplify code when the complexity of a callback isn't necessary right now.
2021-12-06Cleanup: Remove unnecessary node type callbacks for drawingHans Goudey
Currently there are a few callbacks on `bNodeType` that do the same thing for every node type except reroutes and frame nodes. Having a callback for basic things complicates code and makes it harder to understand, and reroutes and frames are special cases in larger way. Arguably frame nodes shouldn't even be drawn like regular nodes, given that it adds a case of O(N^2) looping through all nodes. "Unrolling" the callbacks makes it easier to see what's happening, and therefore easier to optimize. Differential Revision: https://developer.blender.org/D13463