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-11Merge branch 'blender-v3.4-release'Jacques Lucke
2022-11-11Fix T102386: crash when trying to link sockets from different node treesJacques Lucke
This was caused by rBc39eb09ae587e1d9. The optimization broke the case when the socket is not in the provided node tree. Now there are two separate functions, one that always does the slow check to see of the socket is really in the node tree and a potentially much faster version when we are sure that the socket is in the tree.
2022-11-08Merge branch 'blender-v3.4-release'Sergey Sharybin
2022-11-08Fix deprecation warnings about printf() on macOSSergey Sharybin
The new Xcode 14.1 brings the new Apple Clang compiler which considers sprintf unsafe and geenrates deprecation warnings suggesting to sue snprintf instead. This only happens for C++ code by default, and C code can still use sprintf without any warning. This changes does the following: - Whenever is trivial replace sprintf() with BLI_snprintf. - For all other cases use the newly introduced BLI_sprintf which is a wrapper around sprintf() but without warning. There is a discouragement note in the BLI_sprintf comment to suggest use of BLI_snprintf when the size is known. Differential Revision: https://developer.blender.org/D16410
2022-11-05Cleanup: Remove unnecessary node type registraction functionsHans Goudey
These functions provided little benefit compared to simply setting the function pointers directly.
2022-11-02Nodes: Reuse input sockets when creating new node groupsCsaba Boncsér
**Problem** Currently multiple input sockets are created when a new node group is made from selected nodes. Some of these are linked from the same source. It is not convenient to sort out and remove multiple input sockets that represent the same input. These inputs usually have meaningless names like 'value', 'x', etc. **Solution** Create common input sockets for each link starting from the same input. Move links inside the new group's node tree and reroute it to connect the common input socket to the original nodes. This is done by building up a mapping between the incoming link sources to the input interfaces created for them. The input interfaces are reused by the rest of the links having the same source. This patch also changes the way the input sockets get their names. Output socket names of the group nodes usually are specific and are given consciously. Use the output socket names from group nodes instead of the inputs where the links point to. Differential Revision: https://developer.blender.org/D15802
2022-10-31Nodes: Improve socket node lookup performanceHans Goudey
Use the newly added node topology cache to find the node that contains a socket rather than looping through all nodes every time. The change improves performance of drawing a some large node trees by 2-3x.
2022-10-24Fix T101210: invalid internal node links lead to crashJacques Lucke
Internal links are run-time/derived data. Therefore it is not necessary to load them from .blend files where invalid internal links may be stored. They will be regenerated after a node tree is loaded anyway.
2022-10-17Fix T101705: crash when connecting reroute to multi-input socketIliya Katueshenock
Differential Revision: https://developer.blender.org/D16203
2022-10-06Cleanup: Remove unnecessary MOD_nodes.h includesHans Goudey
2022-10-05Cleanup: Clang tidyHans Goudey
Also remove unnecessary struct keywords in C++ files.
2022-10-04Cleanup: replace UNUSED macro with commented args in C++ codeHans Goudey
This is the conventional way of dealing with unused arguments in C++, since it works on all compilers. Regex find and replace: `UNUSED\((\w+)\)` -> `/*$1*/`
2022-10-04Geometry Nodes: Rename Control Point Neighbors NodeHans Goudey
Rename the node to "Offset Point in Curve" Since this was committed, more mesh and curve topology nodes have been committed with a different naming scheme (482d431bb6735e82069). Change the name of this node to match "Offset Corner in Face". Because the node was only added recently, it's a full rename, including the ID, so forward compatibility is broken.
2022-10-03Geometry Nodes: Set Curve NormalJohnny Matthews
This node allows for curves to have their evaluated normal mode changed between MINIMUM_TWIST and Z_UP. A selection input allows for choosing which spline in the curves object will be affected. Differential Revision: D16118
2022-10-03Geometry Nodes: new Sample UV Surface nodeJacques Lucke
This node allows sampling an attribute on a mesh surface based on a UV coordinate. Internally, this has to do a "reverse uv lookup", i.e. the node has to find the polygon that corresponds to the uv coordinate. Therefore, the uv map of the mesh should not have overlapping faces. Differential Revision: https://developer.blender.org/D15440
2022-09-28Geometry Nodes: Curve and mesh topology access nodesHans Goudey
This patch contains an initial set of nodes to access basic mesh topology information, as explored in T100020. The nodes allow six direct topology mappings for meshes: - **Corner -> Face** The face a corner is in, the index in the face - **Vertex -> Edge** Choose an edge attached to the vertex - **Vertex -> Corner** Choose a corner attached to the vertex - **Corner -> Edge** The next and previous edge at each face corner - **Corner -> Vertex** The vertex associated with a corner - **Corner -> Corner** Offset a corner index within a face And two new topology mappings for curves: - **Curve -> Points** Choose a point within a curve - **Point -> Curve** The curve a point is in, the index in the curve The idea is that some of the 16 possible mesh mappings are more important, and that this is a useful set of nodes to start exploring this area. For mappings with an arbitrary number of connections, we must sort them and use an index to choose a single element, because geometry nodes does not support list fields. Note that the sort index has repeating behavior as it goes over the "Total" number of connections, and negative sort indices choose from the end. Currently which of the "start" elements is used is determined by the field context, so the "Field at Index" and "Interpolate Domain" nodes will be quite important. Also, currently the "Sort Index" inputs are clamped to the number of connections. One important feature that isn't implemented here is using the winding order for the output elements. This can be a separate mode for some of these nodes. It will be optional because of the performance impact. There are several todos for separate commits after this: - Rename "Control Point Neighbors" to be consistent with this naming - Version away the "Vertex Neighbors" node which is fully redundant now - Implement a special case for when no weights are used for performance - De-duplicating some of the sorting logic between the nodes - Improve performance and memory use of topology mappings - Look into caching some of the mappings on meshes Differential Revision: https://developer.blender.org/D16029
2022-09-28Geometry Nodes: viewport previewJacques Lucke
This adds support for showing geometry passed to the Viewer in the 3d viewport (instead of just in the spreadsheet). The "viewer geometry" bypasses the group output. So it is not necessary to change the final output of the node group to be able to see the intermediate geometry. **Activation and deactivation of a viewer node** * A viewer node is activated by clicking on it. * Ctrl+shift+click on any node/socket connects it to the viewer and makes it active. * Ctrl+shift+click in empty space deactivates the active viewer. * When the active viewer is not visible anymore (e.g. another object is selected, or the current node group is exit), it is deactivated. * Clicking on the icon in the header of the Viewer node toggles whether its active or not. **Pinning** * The spreadsheet still allows pinning the active viewer as before. When pinned, the spreadsheet still references the viewer node even when it becomes inactive. * The viewport does not support pinning at the moment. It always shows the active viewer. **Attribute** * When a field is linked to the second input of the viewer node it is displayed as an overlay in the viewport. * When possible the correct domain for the attribute is determined automatically. This does not work in all cases. It falls back to the face corner domain on meshes and the point domain on curves. When necessary, the domain can be picked manually. * The spreadsheet now only shows the "Viewer" column for the domain that is selected in the Viewer node. * Instance attributes are visualized as a constant color per instance. **Viewport Options** * The attribute overlay opacity can be controlled with the "Viewer Node" setting in the overlays popover. * A viewport can be configured not to show intermediate viewer-geometry by disabling the "Viewer Node" option in the "View" menu. **Implementation Details** * The "spreadsheet context path" was generalized to a "viewer path" that is used in more places now. * The viewer node itself determines the attribute domain, evaluates the field and stores the result in a `.viewer` attribute. * A new "viewer attribute' overlay displays the data from the `.viewer` attribute. * The ground truth for the active viewer node is stored in the workspace now. Node editors, spreadsheets and viewports retrieve the active viewer from there unless they are pinned. * The depsgraph object iterator has a new "viewer path" setting. When set, the viewed geometry of the corresponding object is part of the iterator instead of the final evaluated geometry. * To support the instance attribute overlay `DupliObject` was extended to contain the information necessary for drawing the overlay. * The ctrl+shift+click operator has been refactored so that it can make existing links to viewers active again. * The auto-domain-detection in the Viewer node works by checking the "preferred domain" for every field input. If there is not exactly one preferred domain, the fallback is used. Known limitations: * Loose edges of meshes don't have the attribute overlay. This could be added separately if necessary. * Some attributes are hard to visualize as a color directly. For example, the values might have to be normalized or some should be drawn as arrays. For now, we encourage users to build node groups that generate appropriate viewer-geometry. We might include some of that functionality in future versions. Support for displaying attribute values as text in the viewport is planned as well. * There seems to be an issue with the attribute overlay for pointclouds on nvidia gpus, to be investigated. Differential Revision: https://developer.blender.org/D15954
2022-09-26Geometry Nodes: Control Point Neighbors NodeJohnny Matthews
This node allows access to the indices of neighboring control points within a curve via an offset. This includes taking into consideration curves that are cyclic. Differential Revision: D13373
2022-09-25Cleanup: remove redundant parenthesis (especially with macros)Campbell Barton
2022-09-25Cleanup: replace C-style casts with functional casts for numeric typesCampbell Barton
2022-09-25Cleanup: use 'u' prefixed integer types for brevity & cast styleCampbell Barton
To use function style cast '(unsigned char)x' can't be replaced by 'unsigned char(x)'.
2022-09-23Geometry Nodes: Split transfer attribute nodeHans Goudey
This patch replaces the existing transfer attribute node with three nodes, "Sample Nearest Surface", "Sample Index", and "Sample Nearest". This follows the design in T100010, allowing for new nodes like UV sampling in the future. There is versioning so the new nodes replace the old ones and are relinked as necessary. The "Sample Nearest Surface" node is meant for the more complex sampling algorithms that only work on meshes and interpolate values inside of faces. The new "Sample Index" just retrieves attributes from a geometry at specific indices. It doesn't have implicit behavior like the old transfer mode, which should make it more predictable. In order to not change the behavior from existing files, the node has a has a "Clamp", which is off by default for consistency with the "Field at Index" node. The "Sample Nearest" node returns the index of the nearest element on a geometry. It can be combined with the "Sample Index" node for the same functionality as the old transfer node. This node can support curves in the future. Backwards compatibility is handled by versioning, but old versions can not understand these nodes. The warning from 680fa8a523e0 should make this explicit in 3.3 and earlier. Differential Revision: https://developer.blender.org/D15909
2022-09-22Geometry Nodes: Add Self Object NodeHans Goudey
From the nodes' description: "Retrieve the object that contains the geometry nodes modifier currently being executed". This was discussed in the most recent geometry nodes module meeting. Because the node allows you to retrieve the position of the modifier object, it has to add a depsgraph relation to object transform. Expect that modifiers will be reevaluated when moving the object. In the future, better static analysis of node trees could make this check smarter. Differential Revision: https://developer.blender.org/D16037
2022-09-19Nodes: Add node group assets to search menusHans Goudey
Currently node group assets are supported, but using them by dragging from the asset browser is cumbersome. This patch adds all node group assets from user asset libraries and the current file libraries to the add node search menu and the link drag search menu. Node groups added through the search will have their "options" hidden, meaning the data-block selector is displayed. This helps keep the UI clean, and the selector shouldn't be necessary anyway. To make that possible, metadata like the node tree type and its inputs and outputs has to be saved in the file. This requires re-saving the files that contain the assets with the patch applied. The node add search operator is moved from Python to C++ to ease development and allow more flexibility. It supports a tooltip that gives the description of assets. Currently the node groups are added with the asset system's existing "Append & Reuse" behavior. It's likely that linking should be possible in the future too, but for now the idea is to use the more foolproof option that doesn't create dependencies between files. Because loading assets can potentially take a long time, the search menu refreshes its items as new assets are loaded. However, changing the search field is necessary to see the update. Differential Revision: https://developer.blender.org/D15568
2022-09-19Geometry Nodes: Distribute Points in VolumeIyad Ahmed
This commit adds a node to distribute points inside of volume grids. The "Random" mode usese OpenVDB's "point scatter" implementation, and there is also a "Grid" mode for uniform distributions. Both methods operate on all of the float grids in the volume, using every voxel with a value higher than the threshold. The random method is not stable as the input volume deforms. Based on a patch by Angus Stanton (@abstanton), which was based on a patch by Kenzie (@kenziemac130). Differential Revision: https://developer.blender.org/D15375
2022-09-18Geometry Nodes: New Face Set Boundaries nodeWannes Malfait
With the recent addition of the UV unwrapping node, there is a need to be able to create seams easily. This node does that by outputting a selection of the boundaries between different input face sets. In the context of UV mapping, one inputs the "patches" you want, and the node gives you the seams needed to make those patches. Differential Revision: https://developer.blender.org/D15423
2022-09-16Cleanup: spelling in commentsCampbell Barton
2022-09-13Geometry Nodes: new evaluation systemJacques Lucke
This refactors the geometry nodes evaluation system. No changes for the user are expected. At a high level the goals are: * Support using geometry nodes outside of the geometry nodes modifier. * Support using the evaluator infrastructure for other purposes like field evaluation. * Support more nodes, especially when many of them are disabled behind switch nodes. * Support doing preprocessing on node groups. For more details see T98492. There are fairly detailed comments in the code, but here is a high level overview for how it works now: * There is a new "lazy-function" system. It is similar in spirit to the multi-function system but with different goals. Instead of optimizing throughput for highly parallelizable work, this system is designed to compute only the data that is actually necessary. What data is necessary can be determined dynamically during evaluation. Many lazy-functions can be composed in a graph to form a new lazy-function, which can again be used in a graph etc. * Each geometry node group is converted into a lazy-function graph prior to evaluation. To evaluate geometry nodes, one then just has to evaluate that graph. Node groups are no longer inlined into their parents. Next steps for the evaluation system is to reduce the use of threads in some situations to avoid overhead. Many small node groups don't benefit from multi-threading at all. This is much easier to do now because not everything has to be inlined in one huge node tree anymore. Differential Revision: https://developer.blender.org/D15914
2022-09-09Nodes: fix memory leakJacques Lucke
2022-09-08Silence warnings/assert about invalid embedded IDs for older blendfiles.Bastien Montagne
there is no point in warning about files that are not supposed to be 'correct' in that regard.
2022-09-08IDManagement: change `IDTypeInfo.owner_get` to instead return address of the ↵Bastien Montagne
owner_id pointer. Also rename the callback. That way, we can keep moving toward a more generic handling of those embedded IDs (think e.g. about copy code).
2022-09-07IDManagement: Add some assert to ensure lib consistency in embedded IDs.Bastien Montagne
From re-checking related code, it seems that we already always ensure consistency of the `lib` pointer between embedded IDs and their owners. This commit only adds some asserts in ambedded ID read code to double-check this.
2022-09-07Cleanup: spelling in comments, correct doxy slashes, replace '/w'Campbell Barton
2022-09-06Cleanup: IDManagement: Simplify `owner_get` calllback of IDTypeInfo.Bastien Montagne
Now that all embedded IDs have a loopback pointer to their owner, we do need anymore extra parameters for this accessor.
2022-09-06Address to some extent issues with invalid embedded IDs in existing files.Bastien Montagne
Many existing .blend files (including startup ones) seem to have invalid embedded IDs (they are not properly tagged with `LIB_EMBEDDED_DATA`). We cannot `do_version` this so just fix it on the fly when detecting the issue. User then need to re-save these files. We also need to update some release files (default factory startup is OK, but e.g. the VSE template one is not). Keeping the assert is important here, as such missing flag is a critical data corruption that can potentially have many serious consequences throughout the ID management code.
2022-09-06Fix T100850: Regression: Gpencil: crash on material color and other ↵Bastien Montagne
properties change. rBcd49fee74114 forgot to add proper support for calls to `ntreeAddTree` with a NULL Main (which should generate `NO_MAIN` ntrees).
2022-09-05IDMAnagement: Add owner ID pointer to embedded ones.Bastien Montagne
Add a dedicated `owner_id` pointer to ID types that can be embedded (Collections and NodeTrees), and modify slightly come code to make handling those more safe and consistent. This implements first part of T69169. Reviewed By: brecht Differential Revision: https://developer.blender.org/D15838
2022-09-04Cleanup: Replace recursive quadratic node link mute operationHans Goudey
The previous implementation iterated over all links multiple times recursively. Instead, use the node tree topology cache, only iterate over all links once, and use a stack to propagate the mute upsteam and downstream.
2022-09-03Cleanup: use more standard variable name for node socketsHans Goudey
2022-08-31Nodes: move NodeTreeRef functionality into node runtime dataJacques Lucke
The purpose of `NodeTreeRef` was to speed up various queries on a read-only `bNodeTree`. Not that we have runtime data in nodes and sockets, we can also store the result of some queries there. This has some benefits: * No need for a read-only separate node tree data structure which increased complexity. * Makes it easier to reuse cached queries in more parts of Blender that can benefit from it. A downside is that we loose some type safety that we got by having different types for input and output sockets, as well as internal and non-internal links. This patch also refactors `DerivedNodeTree` so that it does not use `NodeTreeRef` anymore, but uses `bNodeTree` directly instead. To provide a convenient API (that is also close to what `NodeTreeRef` has), a new approach is implemented: `bNodeTree`, `bNode`, `bNodeSocket` and `bNodeLink` now have C++ methods declared in `DNA_node_types.h` which are implemented in `BKE_node_runtime.hh`. To make this work, `makesdna` now skips c++ sections when parsing dna header files. No user visible changes are expected. Differential Revision: https://developer.blender.org/D15491
2022-08-31Node: Mix nodeCharlie Jolly
This patch is a response to T92588 and is implemented as a Function/Shader node. This node has support for Float, Vector and Color data types. For Vector it supports uniform and non-uniform mixing. For Color it now has the option to remove factor clamping. It replaces the Mix RGB for Shader and Geometry node trees. As discussed in T96219, this patch converts existing nodes in .blend files. The old node is still available in the Python API but hidden from the menus. Reviewed By: HooglyBoogly, JacquesLucke, simonthommes, brecht Maniphest Tasks: T92588 Differential Revision: https://developer.blender.org/D13749
2022-08-30Cleanup: formatCampbell Barton
2022-08-29I18n: translate newly created node group socketsDamien Picard
Translate: - new group socket names - default names Input and Output - on connecting a link from another node - new geometry nodes input and output socket names Reviewed By: mont29 Differential Revision: https://developer.blender.org/D15763
2022-08-12IDType `get_owner`: add an optional hint about owner ID.Bastien Montagne
In some cases, there is a chance code already knows who might be the owner of the given ID, in which case it can be more efficient to check it first (especially in cases like embedded node trees or scene collections, where the only other way is to loop over all possible owners currently). Will be used in next commit in some Outliner fix.
2022-08-10Fix T100308: Removing scene time node does not update relationsHans Goudey
Similar to the fix in 734c6a4405f21078270e71.
2022-07-29Fix (unreported) lib-linking of ID properties not taking library parameter.Bastien Montagne
While this was not a critical issue (that lib pointer is only used for some kind of sanity check that no linked data uses local ID pointers), better to keep `IDP_BlendReadLib` in sync with all other lib-linking code.
2022-07-27Geometry Nodes: Rename "Field on Domain" to "Interpolate Domain"Hans Goudey
This name doesn't require understanding of fields, and is phrased as an action which is consistent with other nodes. Discussed in the latest geometry nodes sub-module meeting.
2022-07-27Geometry Nodes: Shortest Paths nodesErik Abrahamsson
This adds three new nodes: * `Shortest Edge Paths`: Actually finds the shortest paths. * `Edge Paths to Curves`: Converts the paths to separate curves. This may generate a quadratic amount of data, making it slow for large meshes. * `Edge Paths to Selection`: Generates an edge selection that contains all edges that are part of a path. This can be used with the Separate Geometry node to only keep the edges that are part of a path. For large meshes, this approach can be much faster than the `Edge Paths to Curves` node, because less data is created. Differential Revision: https://developer.blender.org/D15274
2022-07-08Curves: support deforming curves on surfaceJacques Lucke
Curves that are attached to a surface can now follow the surface when it is modified using shape keys or modifiers (but not when the original surface is deformed in edit or sculpt mode). The surface is allowed to be changed in any way that keeps uv maps intact. So deformation is allowed, but also some topology changes like subdivision. The following features are added: * A new `Deform Curves on Surface` node, which deforms curves with attachment information based on the surface object and uv map set in the properties panel. * A new `Add Rest Position` checkbox in the shape keys panel. When checked, a new `rest_position` vector attribute is added to the mesh before shape keys and modifiers are applied. This is necessary to support proper deformation of the curves, but can also be used for other purposes. * The `Add > Curve > Empty Hair` operator now sets up a simple geometry nodes setup that deforms the hair. It also makes sure that the rest position attribute is added to the surface. * A new `Object (Attach Curves to Surface)` operator in the `Set Parent To` (ctrl+P) menu, which attaches existing curves to the surface and sets the surface object as parent. Limitations: * Sculpting the procedurally deformed curves will be implemented separately. * The `Deform Curves on Surface` node is not generic and can only be used for one specific purpose currently. We plan to generalize this more in the future by adding support by exposing more inputs and/or by turning it into a node group. Differential Revision: https://developer.blender.org/D14864
2022-07-02Revert "Start of Bevel V2, as being worked on with task T98674."Howard Trickey
This reverts commit 9bb2afb55e50f9353cfc76cf2d8df7521b0b5feb. Oops, did not intend to commit this to master.