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-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
2021-12-04Cleanup: Use references in node editor, other improvementsHans Goudey
This helps to tell when a pointer is expected to be null, and avoid overly verbose code when dereferencing. This commit also includes a few other cleanups in this area: - Use const in a few places - Use `float2` instead of `float[2]` - Remove some unnecessary includes and old code The change can be continued further in the future.
2021-12-03Cleanup: Use typed enum for node resize directionHans Goudey
2021-12-02Fix T92268: Group input and output nodes have inconsistent paddingNikhil Shringarpurey
The group output node did not have the same size padding as the group input, leading to the node looking different and actually being smaller. Differential Revision: https://developer.blender.org/D13092
2021-12-02UI: Add an option to display the node editor context pathHans Goudey
Since we have the overlays popover, it makes sense to allow toggling the context path like in the 3D viewport. This commit adds a property, and turns it on by default in existing files. Differential Revision: https://developer.blender.org/D13248
2021-11-24Geometry Nodes: add utility to show debug messages in node editorJacques Lucke
This is only meant to be used for development purposes for now, not to show warnings to the user. Differential Revision: https://developer.blender.org/D13348
2021-11-23Cleanup: Else after return, other simplificationsHans Goudey
`std::stringstream` already returns a `std::string`, and there is no particular reason to use short here instead of int.
2021-11-23Geometry Nodes: Node execution time overlayErik
Adds a new overlay called "Timings" to the Geometry Node editor. This shows the node execution time in milliseconds above the node. For group nodes and frames, the total time for all nodes inside (recursively) is shown. Group output node shows the node tree total. The code is prepared for easily adding new rows of information to the box above the node in the future. Differential Revision: https://developer.blender.org/D13256
2021-11-23Geometry Nodes: reduce overhead when processing single valuesJacques Lucke
Currently the geometry nodes evaluator always stores a field for every type that supports it, even if it is just a single value. This results in a lot of overhead when there are many sockets that just contain a single value, which is often the case. This introduces a new `ValueOrField<T>` type that is used by the geometry nodes evaluator. Now a field will only be created when it is actually necessary. See D13307 for more details. In extrem cases this can speed up the evaluation 2-3x (those cases are probably never hit in practice though, but it's good to get rid of unnecessary overhead nevertheless). Differential Revision: https://developer.blender.org/D13307
2021-11-19Cleanup: Simplify node editor link dragging storageHans Goudey
Now that `node_intern.hh` is a C++ header, we can use C++ types there. This patch replaces the linked list of dragged links with a vector. Also, the list of drag operator custom data, `nldrag`, doesn't seem to need to be a list at all, so I just made it a unique pointer. Differential Revision: https://developer.blender.org/D13252
2021-11-18Node Editor: Skip socket drawing on low zoomErik
Socket drawing can be heavy with many nodes. This patch skips drawing them on scale < 0.2 when they are barely visible anyway. Differential Revision: https://developer.blender.org/D13255
2021-11-12Cleanup: Move remaning node editor files to C++Hans Goudey
Differential Revision: https://developer.blender.org/D13200
2021-11-08Nodes: store socket declaration reference in socketJacques Lucke
Previously, to get the declaration of a socket, one had to go through `node->declaration`. Now this indirection is not necessary anymore. This makes it easier to add more per-socket information into the declaration and accessing it in various places. Currently, this system is used by socket descriptions and node warnings for unsupported geometry component types.
2021-11-04Fix T92791: collapsed nodes scaling widget wrong with interface scalePhilipp Oeser
Size, position and scale of the "two-line" widget (the one to scale a node horizontally) was not taking interface scale into account. In the case of the report, it could happen it draws behind an output socket. before (at 2.0 interface scale) {F11698493} after (at 2.0 interface scale) {F11698501} Maniphest Tasks: T92791 Differential Revision: https://developer.blender.org/D13088
2021-11-02UI: Use socket type info color to draw linksOmar Emara
Currently, colored links overlay only supports standard sockets defined by Blender. Some add-ons like Animation Nodes defines custom sockets for everything and hence doesn't get colored sockets. This patch uses the draw color from the socket type info to draw links in order to support custom sockets. Differential Revision: https://developer.blender.org/D13044 Reviewed By: Hans Goudey
2021-10-27Nodes: Cleanup code for header underline alphaPablo Vazquez
Use `UI_GetThemeColorBlend4f` instead of manually setting alpha opaque.
2021-10-27Nodes: Cleanup setting node header alphaPablo Vazquez
Always draw header opaque, set transparency only once after getting the color. Helps to unify the color and alpha values.
2021-10-26Node Editor: Style update to nodesPablo Vazquez
This patch changes how nodes look visually, in an attempt to fix a number of issues: * The header background is currently drawn using a theme color fully opaque, this limits the colors we can use because the node name/label is drawn on top. * Hard-coded transparency makes nodes hard to read. The node backdrop already has alpha so if the user wants it they can set it. This patch uses alpha from the theme. * Better muted status indicator, instead of simply making everything transparent and the wires inside red, draw a red outline around the node, darken the header and backdrop. * On muted nodes, display wires behind the backdrop to not interfere with text/widgets inside the node. Nodes: * Darken header to improve readability of node label. * Draw a line under the header * Thicker outline. * Do not hard-code transparency on nodes, use the theme's node backdrop alpha component. * Use angle icon instead of triangle (to be consistent with the [[ https://developer.blender.org/D12814 | changes ]] to panels) Style adjustment to sockets drawing: * Do not hard-code the socket outline color to black, use `TH_WIRE` instead * Do not use `TH_TEXT_HI` for selected sockets, use `TH_ACTIVE` (active node outline) * Do not draw sockets background transparent on muted nodes. * Thicker outline to help contrast and readability {F11496707, size=full} Reviewed By: #user_interface, HooglyBoogly Differential Revision: https://developer.blender.org/D12884
2021-10-26Fix: Show node editor dot grid when there is no node treeHans Goudey
2021-10-26UI: Improve node editor breadcrumbs displayHans Goudey
This patch upgrades node editor breadcrumbs to have slightly more visual weight, to including the base path of object/modifier/world, etc, have more visually pleasing spacing, and contain icons. In the code, a generic "context path" is added to interface code. The idea is that this could be used to draw other breadcrumbs in areas like the property editor or the spreadsheet, and features could be added to all of those areas at the same time. Ideally we would be able to control the color of the breadcrumbs with a specific theme color, but since they are drawn with the regular layout system, that is not easily possible. Thanks to @fabian_schempp for the original patch. Differential Revision: https://developer.blender.org/D10413
2021-10-26Geometry Nodes: remove reference to anonymous attributes in tooltipsJacques Lucke
This changes socket inspection for fields according to T91881. Differential Revision: https://developer.blender.org/D13006
2021-10-26Geometry Nodes: don't log full fields when not necessaryJacques Lucke
Previously, the field on every socket was logged for later use. This had two main negative consequences: * Increased memory usage, because the fields may contain a lot of data under some circumstances (e.g. a Ray Cast field contains the target geometry). * Decreased performance, because anonymous attributes could not be removed from geometry automatically, because there were still fields that referenced them. Now most fields are not logged anymore. Only those that are viewed by a spreadsheet and constant fields. The required inputs of a field are still logged in string form to keep socket inspection working.
2021-10-26UI: Change node editor grid into a dot gridHans Goudey
This patch makes the background grid of the node editor a grid of dots instead of lines. This makes the background look a bit more subtle and reduces visual complexity. The dots are meant to provide a reference when panning and zooming. Based on the design of @pablovazquez, and a patch originally authored by @fabian_schempp. The "Grid Levels" controls how many levels of dots are drawn. As the editor zooms in, the higher levels of dots fade in, making them closer together visually. The zoom factor at which each grid starts and ends fading in is controllable in the code, and could be tweaked further in the future. The new default value is 7, out of a range from 0 to 9. Differential Revision: https://developer.blender.org/D10345
2021-10-21Node Editor: Introduce color overlay and dashed wires theme settingPablo Vazquez
This patch includes code from D9891 and D12754, so credit goes to Juanfran and Dalai. I updated the patches to work with `master` and with the new overlay toggle. The reason to include both changes as part of one patch is that the dimmed dashed lines work much better together with colored wires. Theme setting for dash opacity: {F11370574, size=full} {F11286177, size=full, autoplay, loop} {F11149912, size=full} For adding the overlay I used `SpaceImageOverlay` as reference, although I'm not familiar with this code so there might be mistakes. Reviewed By: #user_interface, HooglyBoogly Differential Revision: https://developer.blender.org/D12886
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-14Nodes: add boilerplate for image socketsCharlie Jolly
The sockets are not exposed in any nodes yet. They work similar to the Object/Collection/Texture sockets, which also just reference a data block. Based on rB207472930834 Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D12861
2021-10-12Cleanup: spelling in commentsCampbell Barton
2021-10-11Fix T92080: Background of Node editors appear brighter than beforeDalai Felinto
In the original code depth=0 meant that there was no parents. But with BLI_listbase_count we have depth 1 in those cases. Differential Revision: https://developer.blender.org/D12817
2021-10-08Fix crash in the node editor in cases where nodetree was emptyDalai Felinto
This seems to happen only in a few files, and not so trivial to reproduce from scratch. The crash is real though, and this fixes it. It also fix a wrong comment style that was introduced in the same faulty commit. Bug introduced on ebe23745281e86. Differential Revision: https://developer.blender.org/D12794
2021-10-08User Interface: Make the background inside a node group brighterDalai Felinto
The breadcrumbs alone may not be enough to indicate that a user is inside a nodegroup. The original dark green color was a bit overwhelming but having a different background helps. This is a follow up to 919e513fa8f9f.
2021-10-07User Interface: Remove the green background when inside a node groupDalai Felinto
The current background color and parent nodetrees is too distracting and noisy. It drastically affect the readability of the nested node-trees. Other techniques (better bread crumbs) can be used instead to indicate to users that they are inside a node group. --- The background drawing was introduced in 4638e5f99a9ba as part of the Python Nodes branch merge. This made its debut in Blender 2.67 (30/May/2021). At the time the color used for the background was a light gray. Over the years the color changed to the current dark green, aggravating the problem further. Before that, the (expanded) nodegroup already had the partially transparent background, mingling with the other nodes. The Python Nodes branch brought this concept with its changes, and would always draw up to two levels up in the background (the parent nodetree, and its parent nodetree). To read the original inspiration for all the changes introduced then: https://code.blender.org/2012/01/improving-node-group-interface-editing/ Differential Revision: https://developer.blender.org/D12780
2021-10-01Fix T91872: incorrect socket inspection on group nodesJacques Lucke
This bug was introduced in rBef45399f3be0955ba8.
2021-09-24Nodes: initial support for socket tooltipsJohnny Matthews
This adds initial limited support for socket tooltips. It's limited in a couple of ways for now: * Only works when hovering over the socket shape, not when hovering over the value in the socket. * Only works for built-in nodes that already use the new node declaration system. This can later be extended to support pynodes. Those limitations are well worth it for now, given that the implementation is quite simple and the impact on usability is quite large. More complex updates to the layout system, that would allow showing socket tooltips in the nodes, can be done later. With the current implementation we can at least start writing tooltips for geometry nodes now. This commit already adds tooltips for the Cylinder node as an example. Differential Revision: https://developer.blender.org/D12607
2021-09-23Cleanup: Remove hardcoded values and rename keyframe shape shadersDalai Felinto
No functional change. The shader is complicated by itself, having hardcoded values makes it even more cryptic. I also renamed the shader because the shader is not for the keyfarme diamond only, but for all the keyframe shapes. Differential Revision: https://developer.blender.org/D12615