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-12-16Cleanup: spellingCampbell Barton
2021-12-15Node Editor: Link Drag Search MenuHans Goudey
This commit adds a search menu when links are dragged above empty space. When releasing the drag, a menu displays all compatible sockets with the source link. The "main" sockets (usually the first) are weighted above other sockets in the search, so they appear first when you type the name of the node. A few special operators for creating a reroute or a group input node are also added to the search. Translation is started after choosing a node so it can be placed quickly, since users would likely adjust the position after anyway. A small "+" is displayed next to the cursor to give a hint about this. Further improvements are possible after this first iteration: - Support custom node trees. - Better drawing of items in the search menu. - Potential tweaks to filtering of items, depending on user feedback. Thanks to Juanfran Matheu for developing an initial patch. Differential Revision: https://developer.blender.org/D8286
2021-12-14Cleanup: Simplify node group input and output socket verificationHans Goudey
This commit refactors the way the socket lists for group nodes, and group input/output nodes are verified to match the group's interface. Previously the `bNodeSocket.new_sock` pointer was used to temporarily mark the new sockets. This made the code confusing and more complicated than necessary. Now the old socket list is saved, and sockets are moved directly from the old list to a new list if they match, or a new socket is created directly in the new list. This change is split from D13518, which aims to remove the `new_node` and `new_sock` pointers. In the future this code might be removed entirely in favor of using node socket declarations. Differential Revision: https://developer.blender.org/D13543
2021-12-13Cleanup: Remove includes in node_util.h headerHans Goudey
This ends up including the removed headers in many unnecessary places. Also, remove unnecessary extern from function definitions.
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-11Geometry Nodes: remove accidental exponential time algorithmJacques Lucke
Calling `foreach_field_input` on a highly nested field (we do that often) has an exponential running time in the number of nodes. That is because the same node may be visited many times. This made Blender freeze on some setups that should work just fine. Now every field keeps track of its inputs all the time. That replaces the exponential algorithm with constant time access.
2021-12-10Cleanup: Use const argument, rename variablesHans Goudey
The const argument makes sense because these are the "source" sockets, even though a const cast is necessary at one point. The name "interface_socket" is an improvement over "stemp" because the latter sounds like "temporary", or it confuses the old socket template system with a node group's interface.
2021-12-10Cleanup: move public doc-strings into headers for 'nodes'Campbell Barton
Ref T92709
2021-12-08Nodes: Add Shader Socket to new decleration APIAaron Carlisle
This commit adds the shader socket type to the new socket builder api. Re commits part of rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740
2021-12-07Geometry Nodes: move type conversions to blenkernelJacques Lucke
The type conversions do not depend on other files in the nodes module. Furthermore we want to use the conversions in the geometry module without creating a dependency to the nodes module there.
2021-12-07Revert moving all shader nodes to c++Jacques Lucke
This reverts to following commits: * rB5cad004d716da02f511bd34983ac7da820308676 * rB97e3a2d935ba9b21b127eda7ca104d4bcf4e48bd * rBf60b95b5320f8d6abe6a629fe8fc4f1b94d0d91c * rB0bd3cad04edf4bf9b9d3b1353f955534aa5e6740 * rBf72cc47d8edf849af98e196f721022bacf86a5e7 * rB3f7014ecc9d523997062eadd62888af5fc70a2b6 * rB0578921063fbb081239439062215f2538a31af4b * rBc20098e6ec6adee874a12e510aa4a56d89f92838 * rBd5efda72f501ad95679d7ac554086a1fb18c1ac0 The original move to c++ that the other commits depended upon had some issues that should be fixed before committing it again. The issues were reported in T93797, T93809 and T93798. We should also find a better rule for not using c-style casts going forward, although that wouldn't have been reason enough to revert the commits. Introducing something like a `MEM_new<T>` and `MEM_delete<T>` function might help with the the most common case of casting the return type of `MEM_malloc`. Going forward, I recommend first committing the changes that don't require converting files to c++. Then convert the shading node files in smaller chunks. Especially don't mix fairly low risk changes like moving some simple nodes, with higher risk changes.
2021-12-07Cleanup: Remove unused includesHans Goudey
2021-12-06Nodes: Add function to set compact socket flag for vectorsAaron Carlisle
This flag is currently only used for vector sockets so the function is limited to the vector builder. The flag is only used by two shader nodes at the moment and this is needed to port them over to the new socket declaration API. Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13490
2021-12-06Nodes: Add Shader Socket to new decleration APIAaron Carlisle
This commit adds the shader socket type to the new socket builder api. As a test, this commit also converts the Add Shader node to the new API Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13485
2021-12-06Cleanup: remove unnecessary extern template implementationsJacques Lucke
This technique isn't really necessary anymore, because unity builds avoid instantiating the same template too many times already.
2021-12-02Fix T93555: crash when muting nodes with multiple internal linksJacques Lucke
The crash happened because I was incorrectly and inconsistently assuming that a socket is part of at most one internal link. However, this is not the case. In geometry nodes, an input socket can be internally linked to multiple output sockets. In the general case, an output could also be linked to multiple input sockets, even though we don't have that in Blender yet.
2021-12-02Fix: Add tooltip translation marker to disabled hintsHans Goudey
This was overlooked, as it seems there's no way for these strings to be translated currently. Generally it's not that clear whether `N_` or `TIP_` should be used in this case, but `TIP_` seems more consistent. To avoid the cost of the translation lookup when the UI text isn't necessary, we could allow the disabled hint argument to be optional. Differential Revision: https://developer.blender.org/D13141
2021-12-01Geometry Nodes: Generalized Compare NodeJohnny Matthews
Replace compare floats node with a generalized compare node. The node allows for the comparison of float, int, string, color, and vector. The datatypes support the following operators: Float, Int: <, >, <=, >=, ==, != String: ==, != Color: ==, !=, lighter, darker (using rgb_to_grayscale value as the brightness value) Vector Supports 5 comparison modes for: ==, !=, <, >, <=, >= Average: The average of the components of the vectors are compared. Dot Product: The dot product of the vectors are compared. Direction: The angle between the vectors is compared to an angle Element-wise: The individual components of the vectors are compared. Length: The lengths of the vectors are compared. Differential Revision: https://developer.blender.org/D13228
2021-11-30Cleanup: spelling in comments & stringsCampbell Barton
2021-11-29Nodes: Support internal links for custom socketsOmar Emara
Currently, nodes with custom sockets do not get their internal links populated. So operators like Delete And Reconnect don't work with such nodes. This patch put custom sockets into consideration when computing priorities for internal links such that sockets of the same idname get connected. Additionally, the patch cleanup the function in the process to avoid redundant code repetition. Reviewed By: Jacques Lucke Differential Revision: https://developer.blender.org/D13386
2021-11-26Geometry Nodes: add utility to set remaining outputsJacques Lucke
Differential Revision: https://developer.blender.org/D13384
2021-11-25Fix: Crash when muting the Group Output nodeErik
This fixes a crash when muting the "Group Output" node. It should not be possible to mute it so this patch sets the `no_muting`-variable on it. Differential Revision: https://developer.blender.org/D13364
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-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-22Cleanup: use simple data member instead of callbackJacques Lucke
This really doesn't have to be a callback currently, since it is always the same `CPPType` for a socket type.
2021-11-21Functions: use static names for multi-functionsJacques Lucke
Previously, the function names were stored in `std::string` and were often created dynamically (especially when the function just output a constant). This resulted in a lot of overhead. Now the function name is just a `const char *` that should be statically allocated. This is good enough for the majority of cases. If a multi-function needs a more dynamic name, it can override the `MultiFunction::debug_name` method. In my test file with >400,000 simple math nodes, the execution time improves from 3s to 1s.
2021-11-19Merge branch 'blender-v3.0-release'Jacques Lucke
2021-11-19Fix T93054: crash when deleting a missed linked fileJacques Lucke
This is a bit similar to rBb7260ca4c9f4b7618c9c214f1270e31d6ed9886b. Sometimes a group node may not reference a node group because it was linked and can't be found.
2021-11-17Cleanup: use same function for updating internal links for all nodesJacques Lucke
Previously, node types had a callback that creates internal links. Pretty much all nodes used the same callback though. The exceptions are the reroute node (which probably shouldn't be mutable anyway) and some input/output nodes that are not mutable. Removing the callback helps with D13246, because it makes it easier to reason about which internal links are created and when they change. In the future, the internal links should be part of the node declaration.
2021-11-17Cleanup: change node socket availability in a single placeJacques Lucke
This cleans up part of the code that still set the flag manually. Also, this change helps with D13246 because it makes it easier to tag the node tree as changed when the availability of a socket changed.
2021-11-16Geometry Nodes: refactor virtual array systemJacques Lucke
Goals of this refactor: * Simplify creating virtual arrays. * Simplify passing virtual arrays around. * Simplify converting between typed and generic virtual arrays. * Reduce memory allocations. As a quick reminder, a virtual arrays is a data structure that behaves like an array (i.e. it can be accessed using an index). However, it may not actually be stored as array internally. The two most important implementations of virtual arrays are those that correspond to an actual plain array and those that have the same value for every index. However, many more implementations exist for various reasons (interfacing with legacy attributes, unified iterator over all points in multiple splines, ...). With this refactor the core types (`VArray`, `GVArray`, `VMutableArray` and `GVMutableArray`) can be used like "normal values". They typically live on the stack. Before, they were usually inside a `std::unique_ptr`. This makes passing them around much easier. Creation of new virtual arrays is also much simpler now due to some constructors. Memory allocations are reduced by making use of small object optimization inside the core types. Previously, `VArray` was a class with virtual methods that had to be overridden to change the behavior of a the virtual array. Now,`VArray` has a fixed size and has no virtual methods. Instead it contains a `VArrayImpl` that is similar to the old `VArray`. `VArrayImpl` should rarely ever be used directly, unless a new virtual array implementation is added. To support the small object optimization for many `VArrayImpl` classes, a new `blender::Any` type is added. It is similar to `std::any` with two additional features. It has an adjustable inline buffer size and alignment. The inline buffer size of `std::any` can't be relied on and is usually too small for our use case here. Furthermore, `blender::Any` can store additional user-defined type information without increasing the stack size. Differential Revision: https://developer.blender.org/D12986
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-03Fix: muted nodes not handled correctlyJacques Lucke
This was an error in rBb55bddde40db3eda3531d98caa99be9a8e88a8ee.
2021-11-03Fix T91862: do type conversion when data enters or exists node groupJacques Lucke
The geometry node evaluator now has access to the entire socket path from the node that produces a value to the node that uses it. This allows the evaluator to make decisions about at which points in the path the value should be converted. Multiple conversions may be necessary under some circumstances with nested node groups. Differential Revision: https://developer.blender.org/D13034
2021-10-27Fix: typo in info messageJacques Lucke
2021-10-27Fix T92328: crash during field inferencing when there is a link cycleJacques Lucke
The toposort did not handle link cycles which it should.
2021-10-26Geometry Nodes: geometry component type warning systemJacques Lucke
Previously, every node had to create warnings for unsupported input geometry manually. Now this is automated. Nodes just have to specify the geometry types they support in the node declaration. Differential Revision: https://developer.blender.org/D12899
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-24Geometry Nodes: Remove repeated instance attribute names in searchHans Goudey
This commit makes sure that each attribute name is only added once when logging geometry values for attribute search. The `attribute_foreach` function for a single geometry component deduplicated names, but a much more common situation is to have more than one component in the instances of a geometry set. Differential Revision: https://developer.blender.org/D12959
2021-10-21Geometry Nodes: Attribute search in the modifierHans Goudey
This adds attribute search to the geometry nodes modifier for the input and output attributes. The "New" search item is only shown for the output attributes. Some of the attribute search code is extracted to a new file in the interface code, to avoid some code duplication. The UI code required two fixes so that the search would work for dynamic length strings (IDProperties do not have a fixed size). Since this does changes to the UI layout of the modifier, I also addressed T91485 here. Differential Revisiion: https://developer.blender.org/D12788
2021-10-21Geometry Nodes: fix force-computing multiple non-output socketsJacques Lucke
There were some issues when multiple inputs of the same node were forced to be computed (e.g. for the spreadsheet), but none of the node outputs (if existant) were used. Essentially the node was marked as "finished" too early in this case. This fix is necessary for the improved viewer node (T92167).
2021-10-21Nodes: add utility to find NodeRef for nodeJacques Lucke
In the future `NodeTreeRef` could have a lazy initialized map, but for now this is good enough.
2021-10-18Nodes: add default value to string socket declarationErik Abrahamsson
Differential Revision: https://developer.blender.org/D12758
2021-10-18Geometry Nodes: decouple multi-function lifetimes from modifierJacques Lucke
Previously, some multi-functions were allocated in a resource scope. This was fine as long as the multi-functions were only needed during the current evaluation of the node tree. However, now cases arise that require the multi-functions to be alive after the modifier is finished. For example, we want to evaluate fields created with geometry nodes outside of geometry nodes. To make this work, `std::shared_ptr` has to be used in a few more places. Realistically, this shouldn't have a noticable impact on performance. If this does become a bottleneck in the future, we can think about ways to make this work without using `shared_ptr` for multi-functions that are only used once.
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: Attempt to fix benign macOS compile warningsHans Goudey
2021-10-05Cleanup: use doxygen sectionsCampbell Barton
2021-10-03Nodes: use extern templates for socket declarationsJacques Lucke
The new socket declaration api generates a surprising amount of symbols in each translation unit where it is used. This resulted in a measurable compile time increase. This commit reduces the number of symbols that are generated in each translation unit significantly. For example, in `node_geo_distribute_points_on_faces.cc` the number of symbols decreased from 1930 to 1335. In my tests, this results in a 5-20% compile time speedup when this and similar files are compiled in isolation (measured by executing the command in `compile_commands.json`). Compiling the distribute points on faces node sped up from ~2.65s to ~2.4s.