WIP: Testing realtime clock branch in combination with simulation nodes #106309
4726803e85 Fixed typo in Simulation Input node
"Delta Time" was set instead of "Elapsed Time" output.
97df619be7 Move "Run" input to simulation output node
It's the output node that decides whether to requiest the values from the nodes inside the simulation, so it makes more sense for it to be there. This is part of a general effort to have less redundancy in the options.
18b2ec1963 Rename "Use Cache" to "Persistent Cache"
This is a temporary option anyway, the caches will be controlled in a more unified place at the object or scene level. But for now the name can be a bit better anyway.
7469e19446 Add basic UI support for multiple simulations in a group
Just allows multiple simulation "frames"/regions/contexts to be drawn in the editor, doesn't include any changes to caching yet.
92a1234830 Add hint to add simulation output node first
Until we can add both nodes at the same time, or we find an improve simulation to link the two nodes
850aa3d26a Allow multiple caches in the same node group
The caches now hash the identifier of the output node as well.
bb732c240d Half finished refactoring to simulation cache
- Cache is accessed with a string identifier, allowing multiple sockets in the future - Cache is meant to be stored in a simple array, not sparsely like before - Persistent cache and temporary "last run" cache are separated more clearly - Use a "Time Point" class instead of integers, to maybe clarify adding subframe support in the future - Use a different "sim" namespace (not sure if that will last) - The value from the last frame is moved, to avoid a copy when no persistent cache is used I don't think this works now, at least I haven't tested it.
c9958c8e9f Basics of temporary and persistent cache working again
Edge cases not really tested still though
3dcb437d5c Remove elapsed time sockets
Since this is theoretically redundant with simulating a float with the delta time value, we decided to remove it for now to make the whole interface simpler.
94e6f87ebc Remove "Persistent Cache" option from the UI
I will keep it internally, but for the simulation MVP we want to focus on the most basic "last frame's cache" features at first.
49e8218edf Remove Started and Ended booleans
These aren't theoretically necessary, since you can just created them as regular outputs. Maybe we will eventually add them back for convenience, but that's not clear.
3fcf50d37a Make the simulation always run, remove run socket
Note: Still unstable. Simulation resets when playback stops bug. Since the "Run" behavior can basically be implemented with the switch node already, it's just adding unnecessary complexity to the interface now, when it's use case isn't clear. We decided to remove it for now, and only consider it later as a possible convenience feature, rather than an essential part of the design. Also, the simulation nodes are now considered "side effect nodes" for the evaluator, meaning they are *always* evaluated, even if they aren't needed because of switch nodes, etc. This was the best way we thought of to make simulations run consistently even through situations like that.
1965e31d17 Fix T101130: Scaling of NLA Strip Via S Hotkey Not Working
After switching over to using start_frame / end_frame, scaling an NLA strip didn't scale the strip, it just repeated the action. Now withing the NLA transform code, we look for TFM_TIME_EXTEND / TFM_TIME_SCALE transform mode, and handle the update to strip scale accordingly
c30718ded9 cmake/win: Allow running blender_test from the VS debugger
This was missing some paths setup in the environment, ctest normally sets this up before running the tests from the CLI but that does not help the IDE all that much.
496e344015 Cleanup: Move mesh modifier apply function to editors module
The function was highly related to the apply modifier operator, and only used once. This was too specific to be in the blenkernel, especially in a mesh conversion file.
e50d567c97 Cleanup: Various improvements to modifier apply operator
Use C++ casts, decrease variable scope, use references, use const.
6b26b0db21 Fix build issue with NanoVDB and HIP on Linux
This patch was already accepted upstream, so this is temporary until we update to a new OpenVDB release that includes it.
f1b16f3ceb Fix: ignore unavailable sockets linked to multi-input socket
Differential Revision: https://developer.blender.org/D16784
f9b621a9d9 Nodes: Allow skipping node attachment after dragging
This patch allows skipping the automatic insertion of nodes on top of links when the transform operator ends. When putting nodes into small spaces this often gets in the way and wastes time. Now, when holding `alt`, this is turned off. The header text is also improved to add this shortcut and to remove the Dx and Dy values and improve the formatting a bit. Making this functionality optional might allow us to use it in more places in the future, like for the nodes added by link-drag-search. Differential Revision: https://developer.blender.org/D16230
20cab8f8f2 Geometry Nodes: Add error message when applying modifier with no mesh
If the resulting geometry from applying a geometry nodes modifier contains no mesh, give an error message. This gives people something to search and makes the behavior more purposeful. Also remove the `modifyMesh` implementation from the geometry nodes modifier, since it isn't necessary anymore. And remove the existing "Modifier returned error, skipping apply" message which was cryptic and redundant if applying returns an actual error message. Resolves T103229 Differential Revision: https://developer.blender.org/D16782
24523726d7 Mesh: Store active & default color attributes with strings
Attributes are unifying around a name-based API, and we would like to be able to move away from CustomData in the future. This patch moves the identification of active and fallback (render) color attributes to strings on the mesh from flags on CustomDataLayer. This also removes some ugliness used to retrieve these attributes and maintain the active status. The design is described more here: T98366 The patch keeps forward compatibility working until 4.0 with the same method as the mesh struct of array refactors (T95965). The strings are allowed to not correspond to an attribute, to allow setting the active/default attribute independently of actually filling its data. When applying a modifier, if the strings don't match an attribute, they will be removed. The realize instances / join node and join operator take the names from the first / active input mesh. While other heuristics may be helpful (and could be a future improvement), just using the first is simple and predictable. Differential Revision: https://developer.blender.org/D15169
ac59dfeffd Fix T103049: Cycles specular light leak regression
The logic here is not ideal but was unintentionally changed in refactoring for path guiding, now restore it back to 3.3 behavior again.
a3a132ea74 Build: upgrade pre-built libraries for Linux
Replace ../lib/linux_centos7_x86_64 with ../lib/linux_x86_64_glibc_228, built with Rocky8 Linux, compatible with the VFX platform CY2023, see: T99618. - Update build-bot configuration. - Remove unnecessary check for Blosc, this is part of OpenVDB lib now. - Remove WITH_CXX11_ABI, always use new C++11 ABI now - Replace centos7 by glibc_228 everywhere Note that existing builds with cached paths pointing to "../lib/linux_centos7_x86_64" will need to be updated. Includes contributions by Brecht.
34f307547b Fix T103183: UV map name of mesh converted from curve is untranslated
Upon conversion, the newly-created UV map with default name "UVMap" should be translated. Reviewed By: mont29 Maniphest Tasks: T103183 Differential Revision: https://developer.blender.org/D16775
af7c34716b Fix active/default color names not being editable
Revert  and enable the editable flag as the intent for  was that these values would be editable. :
0403d77a0f Fix T103237: Prevent UV Unwrap from packing hidden UV islands
When migrating to the new packing API, pin_unselected was not implemented correctly. Regression from rB143e74c0b8eb, rBe3075f3cf7ce, rB0ce18561bc82. Differential Revision: https://developer.blender.org/D16788 Reviewed By: Campbell Barton Duplicated in blender-v3.4-release as rB3dcd9992676a
a12614d166 Fix T102923: replace zero check with epsilons with uv constrain to bounds
Small roundoff errors during UV editing can sometimes occur, most likely due to so-called "catastrophic cancellation". Here we set a tolerance around zero when using Constrain-To-Bounds and UV Scaling. The tolerance is set at one quarter of a texel, on a 65536 x 65536 texture. TODO: If this fix holds, we should formalize the tolerance into the UV editing subsystem, perhaps as a helper function, and investigate where else it needs to be applied. Differential Revision: https://developer.blender.org/D16702
c9bd78890a Build: remove opus workaround for sndfile
For some reason SNDFILE now builds without this workaround, which broke building FFMPEG.
bb8cbf0c10 UI: don't change mouse cursor while it's grabbed
The paint cursor was continuously set which meant hiding the cursor while interacting with buttons would immediately show it again. This exposed cursor warping.
5d1ed47d6c Fix T103253: Infinite drag of number buttons is broken on WIN32
Recent reverting of changes to cursor grabbing intended to match Blender 3.3 release. This is the case for 3.4x branch, however there is an additional change to grabbing on WIN32 by Germano  which is a significant improvement on old grabbing logic for Windows. So instead of matching 3.3x behavior, restore logic that keeps the cursor centered while grabbing & hidden. This re-introduces T102792 issue displaying the paint-brush while dragging buttons, this will have to be solved separately. Re-apply  & , revert  & . :
54942e5ea6 Fix T102792: Sculpt cursor jumps to random place
Restrict the condition under which paint cursors read use the cursor location from the the operating-system. This caused a glitch when dragging UI elements in painting context popup. Since the paint cursor would display using mouse motion which was clamped to the window center - an internal detail of hidden cursor grabbing. Now only read the cursor coordinates when clamped to a region which is used for the transform cursor to stay visible even when the cursor wraps around.
32a7384c0b Geometry Nodes: improve dot graph export of lazy function graph
* Dim default input values. * Print default input values instead of type name. * Add node/socket names to group input/output nodes.
74171ff3b0 CMake: warn Linux references old linux_centos7_x86_64 paths
When the centos7 library dir is found, warn when the values of cached variables reference it, listing the variables and their values.
06525747c0 Build: resolve failure to copy indirect dependencies for USD on Linux
Even when building without OpenImageIO and OpenVDB, USD depends on these libraries. Ensure these libraries are copied when building with USD.
cfb77c54b0 Fix T103257: Enabling or disabling viewport denoising while using OptiX OSL results in an error
Switching viewport denoising causes kernels to be reloaded with a new feature mask, which would destroy the existing OptiX pipelines. But OSL kernels were not reloaded as well, leaving the shading pipeline uninitialized and therefore causing an error when it is later attempted to execute it. This fixes that by ensuring OSL kernels are always reloaded when the normal kernels are too.
6bd6d7aec7 Fix T103258: Deleting a shader with OptiX OSL results in an illegal address error
Materials without connections to the output node would crash with OSL in OptiX, since the Cycles `OSLCompiler` generates an empty shader group reference for them, which resulted in the OptiX device implementation setting an empty SBT entry for the corresponding direct callables, which then crashed when calling those direct callables was attempted in `osl_eval_nodes`. This fixes that by setting the SBT entries for empty shader groups to a dummy direct callable that does nothing.
f92a85d7d2 Nodes: Add Exclusion color mix mode
Expands Color Mix nodes with new Exclusion mode. Similar to Difference but produces less contrast. Requested by Pierre Schiller @3D_director and @OmarSquircleArt on twitter. Differential Revision: https://developer.blender.org/D16543
807be888a5 Fix: Crash after mesh color attribute name commit
6514bb05eamissed a null check when accessing the active and default color attribute names, since the CustomData API does not do that check itself.
8226abc111 Cleanup: Remove duplicate UV islands header
This code was duplicated from `pbvh_uv_islands.hh`, which was the version that was actually used.
a0ed3601c9 Fix T103187: Opening node search menu is slow because of assets.
Avoid utility function call that would query the file system, this was a bottleneck. The path joining was also problematic. See patch for more details. Differential Revision: https://developer.blender.org/D16768 Reviewed by: Jacques Lucke
a2cee52617 Fix std::optional value() build error on older macOS SDK
Patch from @dupoxy Differential Revision: https://developer.blender.org/D16796
988241e23e Geometry Nodes: simplify handling of invalid group interface sockets
Previously, the code tried to keep node groups working even if some of their input/output sockets had undefined type. This caused some complexity with no benefit because not all places outside of this file would handle the case correctly. Now node groups with undefined interface sockets are disabled and have to be fixed manually before they work again. Undefined interface sockets are mostly caused by invalid Python API usage and incomplete forward compatibility (e.g. when newer versions introduce new socket types that the older version does not know).
aeea690e00 Cleanup: Remove unnecessary node link flag
Links that are currently being dragged are now stored outside of the node tree, so we don't need a flag to distinguish them from "proper" links.
38567bc023 Cleanup: Slightly refactor cancelling link drag operator
Clarify that the dragged links aren't stored in the tree, use a separate function for cancelling vs. applying the links to the tree.
508fd044b4 Revert "Fix simulation"
This reverts commit
468f43c7a6. Revert "Add initial dynamic declarations" This reverts commit
50a2c77c4e. Revert "Add initial simulation state items array to output node" This reverts commit
9241ab1d7c Merge branch 'main' into geometry-nodes-simulation
b2e508f7af Merge branch 'main' into geometry-nodes-simulation
f36dd06609 Add initial infrastructure for multiple simulation state items
- Use dynamic declarations to build simulation node sockets - Fixes in some node code for futher use of dynamic declarations - Copying, freeing, reading, and writing of simulation state array - Add simulation state items with link drag operator The new sockets won't do anything yet, only geometry sockets are supported, and there is no way to remove sockets yet.
3bad7a51cb Implement simulation nodes as lazy functions directly
Support for multiple sockets will be slightly more complete now too, but that part hasn't been tested.
b77436b534 Added realtime clock struct in the animtimer customdata.
Multiple clocks can run at the same time, using the same animtimer. The `active_clock` flags show which clocks are running. If any clock is running (`active_clock != 0`) the `animtimer` must also exist.
8ca3840b4f Replaced checks for `animtimer` that are used to check if anim playback is running.
Since the timer is now shared, the existence of the pointer alone is not enough to determine if animation playback is running. The screen flag (or better: the ED_screen_animation_is_playing function) should be used for such checks.
53582157f4 Store both animation and realtime clock data in the animtimer customdata.
Running clocks are identified by the `active_clock` flags now, the `animtimer` pointer is not sufficient any longer to determine if animation playback is running.
2c4e71f4ef Use the same operator for both clocks.
If separate operators are used they will have to return pass-through and, more importantly, we won't be easily able to ensure a single depsgraph update.
74b50cf429 Fix memory leak: operators were running as modal when they shouldn't.
The bool return value of the ED_ functions got converted to 1, which is the operator return value for modal operators.
070ac1898a Added a `BKE_scene_graph_update_for_timestep` function to handle different clocks.
The original `BKE_scene_graph_update_for_newframe` function sets the scene frame and only tags the scene time source. The new function supports all clock types while still ensuring only one actual depsgraph evaluation. It would be nicer if this could be split such that the update passes are more agnostic towards the specific clock types. The current update pass loop is quite complicated and handles a lot of corner cases.
b14668ae03 Simulation Nodes: refactor automatic caching
The most important part of this change is that the simulation state at a specific point in time is more self contained now. This way, only the modifier has to deal with finding the old/new simulation states and not every simulation individually. Furthermore, this also includes some simple cache invalidation when the user changes something that might affect the result.
d98988d872 Simulation Nodes: indicate which frames are cached in timeline
4f46024e0b Added a persisten clock value to Scene DNA.
This is necessary to have a reliable persistent frame value from which simulations can compute a "delta time". The `realtime_clock.frame` value in `Scene` is currently never reset, this should be supported eventually.
06227194bb Store the depsgraph update frame and ctime in time source nodes.
Multiple clocks exist now to give a "current time" value for computing time steps and for checking if a simulation needs to be reset.
40bc4816cd Add realtime clock relations for modifiers if they declare them in dependsOnTime callback.
1bdbab4f4e Make sure the realtime time source node frame is updated when the realtime clock changes.
9cda17ef65 Fix for uninitialized memory use when the cache is cleared.
The `prev_simulation_state` is looked up before and needs to stay valid. To make this work the cache now is pruned up to the last state, rather than cleared entirely. It will contain at most 2 states at any time.
e80440a95b Fix broken realtime clock while animation is running.
The `active_clock` flags need to be checked using bitwise operators, not a switch statement, since both clocks can be running at the same time.
5a179ae1bc Operator for resetting the realtime clock to zero.
The value 0.0 counts a special "start frame" which causes the simulation cache to be invalidated.
19027eb676 Added own notifier for the realtime clock to ensure depsgraph time is correct.
The depsgraph time source node for the realtime clock needs to be updated to the current clock time before evaluation. This currently happens after operators through the `ND_FRAME` notifier for the scene frame. The realtime clock needs its own notfier so that operators can ensure the clock value is correct. Without this update the simulation nodes see an old clock value and don't find a "previous state" until the simulation is past that frame again. It will never insert a new frame until that point and delta time will remain 0.0.
d95a33d6ac More reliable cache invalidation on reset.
This is not a great solution yet, it relies on an explicit depsgraph update to ensure that the modifier eval sees a frame 0.0 value.
db7597f00a Better solution to invalidating all caches.
Instead of relying on the depsgraph update and a "frame == 0" test, the operator now explicitly invalidates all caches. This requires looping over the scene, but as a one-off user operation that is acceptable. This reverts commit
2bf3c7cd41 Disable cache invalidation on manual modifier changes.
This may be ok for scene playback, but it means the simulation is reset entirely whenever any dependency is changed, for example moving an object whose transform is used with an Object Info node.
This pull request has changes conflicting with the target branch.
Reference in New Issue
There is no content yet.
Delete Branch "LukasTonne/blender:geometry-nodes-simulation-realtime-clock"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?