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-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-07Fix T93797, T93809: Crash/undefined-behavior when opening demo fileJulian Eisel
Error in d5efda72f501. Was changing an iteration that would free items to an iterator that is not safe for use in such cases. There still seem to be significant issues with the rendering, but that's a separate issue to be fixed.
2021-12-07Cleanup: move public doc-strings into headers for 'blenkernel'Campbell Barton
- Added space below non doc-string comments to make it clear these aren't comments for the symbols directly below them. - Use doxy sections for some headers. - Minor improvements to doc-strings. Ref T92709
2021-12-07Cleanup: clang formatAaron Carlisle
2021-12-07Shader Nodes: Migrate shader category to new node socket declaration APIAaron Carlisle
No functional changes, tests passed and I double checked the nodes by hand.
2021-12-07Cleanup: Remove unused includesHans Goudey
2021-12-07Cleanup: Remove unused node flagHans Goudey
2021-12-07Cleanup: Remove unnecessary generic includes from headersHans Goudey
2021-12-06Fix: Compile error in field inputHans Goudey
Instead of essentially hashing a bool, just use a ternary operator. Differential Revision: https://developer.blender.org/D13494
2021-12-06macOS: Fix build error in hash functionsAnkit Meel
Remove unneeded recent static_cast attempt. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D13492
2021-12-06Shader Nodes: Split each node into own fileAaron Carlisle
This improves both code finding, for example "color ramp" now has its own file. And now each node has its own namespace so function names can be simplified similar to rBfab39440e94 This commit also makes all file names use snake case instead of camel case. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D13482
2021-12-06Cleanup: Fix warnings about copied Map loop variablesHans Goudey
The `Map::items()` iterator does not return references.
2021-12-06Fix: Attempt to fix build error on macOSHans 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-06Geometry Nodes: reduce code duplication with new GeometyrFieldInputJacques Lucke
Most of our field inputs are currently specific to geometry. This patch introduces a new `GeometryFieldInput` that reduces the overhead of adding new geometry field input. Differential Revision: https://developer.blender.org/D13489
2021-12-06Geometry Nodes: 4 Field Inputs for Mesh Topology DataJohnny Matthews
Creates 4 new nodes which provide topology information for the mesh. Values are interpolated from the primary domain in each case using basic attribute interpolation. Vertex Neighbors - Vertex Count - Face Count Face Neighbors - Vertex Count - Neighboring Face Count Edge Vertices - Vertex Index 1 - Vertex Index 2 - Position 1 - Position 2 Face Area - Face Area Differential Revision: https://developer.blender.org/D13343
2021-12-06Fix T93521: Single point NURBS crash in resample nodeHans Goudey
The resample node didn't handle the case of when a spline didn't have any evaluated points. For poly and Bezier splines we should never hit this case, but it is expected when the number of NURBS control points is smaller than its order, so we have to handle the case here. It's not that obvious what to do in this case, there are a few options: - Remove the bad splines from the result - Generate empty splines for those inputs - Skip resampling the bad splines, copy them to the result - Arbitrarily generate single point splines I chose option three, just skipping the "bad" splines. Since the node already has a selection input, this can be described by just extending that. "Splines with no evaluated points are implicitly deselected." The first option would probably be valid too though. Differential Revision: https://developer.blender.org/D13434
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-06Shader Nodes: Unity BuildAaron Carlisle
- Create a new `bf_nodes_shader` library - Enable unity builds for `bf_nodes_shader`, gives abount a 2.7x speed up for compile times Reviewed By: JacquesLucke Differential Revision: https://developer.blender.org/D13484
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-06Shader Nodes: Declare nodes in their own namespaceAaron Carlisle
Follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5 This puts all static functions in geometry node files into a new namespace. This allows using unity build which can improve compile times significantly - The namespace name is derived from the file name. That makes it possible to write some tooling that checks the names later on. The filename extension (cc) is added to the namespace name as well. This also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file. - In the register function of every node, I added a namespace alias namespace `file_ns = blender::nodes::node_shader_*_cc`;. This avoids some duplication of the file name and may also simplify tooling, because this line is easy to detect. The name `file_ns` stands for "file namespace" and also indicates that this namespace corresponds to the current file. In the future some nodes will be split up to separate files and given their own namespace This will allow function names to be simplified similar to rBfab39440e94 Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D13480
2021-12-06Cleanup: clang-tidy: modernize-redundant-void-argAaron Carlisle
This change follows up on recent c --> c++ conversions
2021-12-05Cleanup: Add missing includeAaron Carlisle
Fixes compilation errors after rBd5efda72f501 Re sorted some includes.
2021-12-05Cleanup: Migrate all shader nodes to c++Aaron Carlisle
This will be useful in the future to use the new socket builder API Aditional changes: - Declare variables where initialized - Do not use relative includes Differential Revision: https://developer.blender.org/D13465
2021-12-05Fix (unreported): off-by-one error when setting curve handlesJacques Lucke
The problem is that `current_mask` can become `selection.size()`. The loop could also be refactored to break out of it when the end of the selection is reached. This can be done separately.
2021-12-04Compositor: Migrate most nodes to new socket builder APIAaron Carlisle
This patch leaves a out a few nodes: - Group Nodes - Image input node - File output node - Switch View - Cryptomatte These nodes above are a bit more complicated and should be worked on individually. Differential Revision: https://developer.blender.org/D13266
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-02Cleanup: spelling in commentsCampbell Barton
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-01Cleanup: Move node_shader_util.c to C++Hans Goudey
This will allow using a function I've declared in a C++ header.
2021-12-01Geometry Nodes: deduplicate join geometry codeJacques Lucke
The Realize Instances and Join Geometry node can share most of their code. Until now, both nodes had their own implementations though. This patch removes the implementation in the Join Geometry node in favor of the more general Realize Instances implementation. This removes an optimization for avoiding spline copies. This can be brought back later. The realize instances code has to be rewritten to support attribute instances anyway. Differential Revision: https://developer.blender.org/D13417
2021-12-01Geometry Nodes: Dual Mesh NodeWannes Malfait
This node calculates the dual of the input mesh. This means that faces get replaced with vertices and vertices with faces. In principle this only makes sense when the mesh in manifold, but there is an option to keep the (non-manifold) boundaries of the mesh intact. Attributes are propagated: - Point domain goes to face domain and vice versa - Edge domain and Face corner domain gets mapped to itself Because of the duality, when the mesh is manifold, the attributes get mapped to themselves when applying the node twice. Thanks to Leul Mulugeta (@Leul) for help with the ascii diagrams in the code comments. Note that this does not work well with some non-manifold geometry, like an edge connected to more than 2 faces, or a vertex connected to only two faces, while not being in the boundary. This is because there is no good way to define the dual at some of those points. This type of non-manifold vertices are just removed for this reason. Differential Revision: https://developer.blender.org/D12949
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-12-01Cleanup: Store instances id attribute with other attributesHans Goudey
Now that we can store any dynamic attribute on the instances component, we don't need the special case for `id`, it can just be handled by the generic attribute storage. Mostly this just allows removing a bunch of redundant code. I had to add a null check for `update_custom_data_pointers` because the instances component doesn't have any pointers to inside of custom data. Differential Revision: https://developer.blender.org/D13430
2021-12-01Geometry Nodes: Propagate attributes in Instances to Points nodeHans Goudey
This is part of T92926, and is very similar to 221b7b27fce3, except slightly similar, because it only transfers from one component, and it doesn't handle multi-threading at the moment.
2021-12-01Geometry Nodes: Add Point Count to Spline Length NodeJohnny Matthews
- Integer Field input of the number of control points on each spline in the spline domain. - In the point domain, it is the number of points on the spline that contains the given control point. Differential Revision: https://developer.blender.org/D13279
2021-12-01Fix missing subsurface IOR/Anisotropy socket after refactor in c2ab47eBrecht Van Lommel
2021-11-30Geometry Nodes: propagate attributes in Instance on Points nodeJacques Lucke
This is part of T92926. Differential Revision: https://developer.blender.org/D13429
2021-11-30Geometry Nodes: Rename Curve Parameter, Add Index on SplineJohnny Matthews
- Rename the Curve Parameter node to Spline Parameter. - Add "Index on Spline" to the node. This output is the index of the current point on it's parent spline rather than the entrire curve. Differential Revision: https://developer.blender.org/D13275
2021-11-30Cleanup: spelling in comments & stringsCampbell Barton
2021-11-29Geometry Nodes: Domain Size NodeJohnny Matthews
The Domain Size node has a single geometry input and a selection for the component type. Based on the component chosen, outputs containing single values for the related domains are shown. Mesh: - Point Count - Edge Count - Face Count - Face Corner Count Curve: - Point Count - Spline Count Point Cloud: - Point Count Instances: - Instance Count Differential Revision: https://developer.blender.org/D13365
2021-11-29Fix: Missing min value for set spline resolution nodeHans Goudey
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-27Geometry Nodes: Optimize Cube primitive vertex calculationErik
This patch gets rid of the O(N^3) complexity of calculate_vertices. Execution time of the node is reduced from 250ms to 140ms with 500^3 vertices. In the future edge calculations could be done manually and reduce the execution time even further. Differential Revision: https://developer.blender.org/D13207
2021-11-27Geometry Nodes: Parallelize "Set Spline Type"-nodeErik
Parallelizes the loop that converts splines. It gives around a 2x speedup on curves with over 1k splines. Differential Revision: https://developer.blender.org/D13389
2021-11-26Geometry Nodes: add utility to set remaining outputsJacques Lucke
Differential Revision: https://developer.blender.org/D13384
2021-11-26Geometry Nodes: optimize Set Position nodeJacques Lucke
This implements four optimizations in the Set Position node: * Check whether the position input is the current position and ignore it if it is. This results in a speedup when only the Offset input is used. * Use multi-threading when copying to computed values to the position attribute. All geometry types benefit from this. * Use devirtualization for the offset and position input. This optimizes the common case that they are either single values or computed in the fly in a span. * Write to `Mesh->mvert` directly instead of creating a temporary span. This makes setting mesh vertex positions even more efficient. In my simple benchmark I'm using a White Noise node to offset the position of 1,000,000 vertices. The speed is `20 ms -> 4.5 ms` in the multi-threaded case and `32 ms -> 22 ms` in the single-threaded case.
2021-11-26Geometry Nodes: refactor multi-threading in field evaluationJacques Lucke
Previously, there was a fixed grain size for all multi-functions. That was not sufficient because some functions could benefit a lot from smaller grain sizes. This refactors adds a new `MultiFunction::call_auto` method which has the same effect as just calling `MultiFunction::call` but additionally figures out how to execute the specific multi-function efficiently. It determines a good grain size and decides whether the mask indices should be shifted or not. Most multi-function evaluations benefit from this, but medium sized work loads (1000 - 50000 elements) benefit from it the most. Especially when expensive multi-functions (e.g. noise) is involved. This is because for smaller work loads, threading is rarely used and for larger work loads threading worked fine before already. With this patch, multi-functions can specify execution hints, that allow the caller to execute it most efficiently. These execution hints still have to be added to more functions. Some performance measurements of a field evaluation involving noise and math nodes, ordered by the number of elements being evaluated: ``` 1,000,000: 133 ms -> 120 ms 100,000: 30 ms -> 18 ms 10,000: 20 ms -> 2.7 ms 1,000: 4 ms -> 0.5 ms 100: 0.5 ms -> 0.4 ms ```
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-25Fix T93367: wrong attribute propagation in Delete Geometry nodeJacques Lucke
This only happened with non-point selections. It used an incorrect index mapping for the attribute propagation.