WIP: Field type inferencing using a constraint solver method #120420

Draft
Lukas Tönne wants to merge 52 commits from LukasTonne/blender:socket-type-inference into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

52 Commits

Author SHA1 Message Date
Lukas Tönne cef0316269 Merge branch 'main' into socket-type-inference 2024-05-08 12:59:42 +02:00
Lukas Tönne 1a154dbae2 Merge branch 'main' into socket-type-inference 2024-04-28 11:16:15 +02:00
Lukas Tönne 10a6d84ace Merge branch 'socket-type-inference' of projects.blender.org:LukasTonne/blender into socket-type-inference 2024-04-21 08:45:18 +02:00
Lukas Tönne 415b24c3e1 Merge branch 'main' into socket-type-inference 2024-04-21 08:43:57 +02:00
Lukas Tönne c71dd02032 Merge branch 'main' into socket-type-inference 2024-04-19 14:55:56 +02:00
Lukas Tönne daf213706d Moved legacy propagation code into its own file for easy comparison. 2024-04-09 10:57:24 +02:00
Lukas Tönne a09bce3251 Merge branch 'main' into socket-type-inference 2024-04-09 09:37:13 +02:00
Lukas Tönne b3128a83e7 Use the gather function to determine group interface.
The states of internal nodes include superpositions of single value and
field to indicate that a socket _can_ be either, but the overall group
interface should only include the concrete connected types. A single
value socket connected to a group output creates a single-or-field
socket, while the group interface should consider it a single value.
The `find_group_output_dependencies` has to be used to determine the
interface types for the tree as a whole, rather than the state of
internal sockets.
2024-04-03 18:13:44 +02:00
Lukas Tönne 8232759635 Add constraints for internal dependencies to propagate fields from inputs to outputs. 2024-04-02 15:27:47 +02:00
Lukas Tönne e129d1b99c Add link constraints in the output->input direction.
This forces inputs to become fields when connected outputs can only be
fields (field sources).

There are still missing internal constraints that unify field types
within a single node.
2024-04-02 14:42:10 +02:00
Lukas Tönne 76e265eba1 Update the socket shapes after solving constraints. 2024-04-02 14:22:32 +02:00
Lukas Tönne a703e66d97 Use the symmetric constraint declaration for zone relationships. 2024-04-02 14:10:16 +02:00
Lukas Tönne 410ecc34cd Better error messages. 2024-04-02 13:02:34 +02:00
Lukas Tönne 67a45c00f7 Added utility struct for consistent socket variables and fix current errors. 2024-04-02 12:16:58 +02:00
Lukas Tönne 1f482030c1 Check for empty domain errors to cover all potential cases in verification. 2024-04-02 10:45:15 +02:00
Lukas Tönne 610cd372e9 Avoid checking conditions twice. 2024-04-02 10:24:56 +02:00
Lukas Tönne d48be0ad97 Add verification for the overall tree interface as well. 2024-04-02 10:20:08 +02:00
Lukas Tönne 17298bb464 Added a verification step that optionally compares old and new inferencing. 2024-04-02 09:31:55 +02:00
Lukas Tönne 02613546ca Added an experimental flag to toggle new field inferencing algorithm. 2024-04-01 19:17:08 +02:00
Lukas Tönne b3744a2ebc Added a Sudoku solver test, because why not. 2024-04-01 16:32:37 +02:00
Lukas Tönne 1291d4a41e Added tests for over- and under-constrained systems. 2024-04-01 14:04:56 +02:00
Lukas Tönne fd27c22dac Build support for (anti)symmetric constraints into the ConstraintSet. 2024-04-01 12:24:59 +02:00
Lukas Tönne 366ef46858 Finished the basic existing test. 2024-04-01 11:54:50 +02:00
Lukas Tönne 4dee63d459 Fix incorrect dependency scheduling that caused infinte loops. 2024-04-01 11:40:37 +02:00
Lukas Tönne 64265f4ae0 Fix build errors. 2024-04-01 10:29:07 +02:00
Lukas Tönne f52223d789 Reverted the VariableRef struct in favor of a simpler VariableIndex alias. 2024-04-01 10:19:13 +02:00
Lukas Tönne 74b92bae90 Added new BLI test for constraint satisfaction. 2024-04-01 10:08:50 +02:00
Lukas Tönne c2552b0dcd Moved constraint satisfaction to a new BLI file. 2024-04-01 09:39:01 +02:00
Lukas Tönne f662508fe1 Merge branch 'main' into socket-type-inference 2024-03-31 12:17:21 +02:00
Lukas Tönne fbcfd48d2a Replace int variable indexes with formalized (Mutable)VariableKey.
This helps ensure correctness and clarifies which of the variables is
being modified.
2024-03-31 12:14:53 +02:00
Lukas Tönne 0e1e2a9514 Merge branch 'main' into socket-type-inference 2024-03-27 11:05:06 +01:00
Lukas Tönne dcc2d51acd Merge branch 'main' into socket-type-inference 2024-03-18 10:38:36 +01:00
Lukas Tönne f0c3d9c556 stuff 2024-03-18 10:27:34 +01:00
Lukas Tönne 948b6a9c08 Skip unavailable sockets for constraints. 2024-03-17 10:45:10 +01:00
Lukas Tönne 1fcf9240a4 Operator to explicitly dump debug data into a json file. 2024-03-16 13:55:57 +01:00
Lukas Tönne aef69e3f98 progress 2024-03-15 18:33:02 +01:00
Lukas Tönne a5d83bfdf1 More logging functions. 2024-03-15 15:37:08 +01:00
Lukas Tönne 8f71366ba7 Merge branch 'main' into socket-type-inference 2024-03-14 16:10:04 +01:00
Lukas Tönne 0e2be8a6e7 set_variable_names logger function. 2024-03-14 09:49:43 +01:00
Lukas Tönne 483b14da79 Cleanup: more specialized logging functions. 2024-03-13 18:41:45 +01:00
Lukas Tönne 8c976aa345 Fixed ranges for interface sockets. 2024-03-13 18:11:06 +01:00
Lukas Tönne 56df2b0245 Merge branch 'main' into socket-type-inference 2024-03-13 16:20:42 +01:00
Lukas Tönne 243e400c07 Use interface variables for the group input/output nodes. 2024-03-12 10:49:20 +01:00
Lukas Tönne f6cc0d9a88 Merge branch 'main' into socket-type-inference 2024-03-12 09:53:21 +01:00
Lukas Tönne 945bb8ce12 new interface. 2024-03-11 16:17:09 +01:00
Lukas Tönne 23c03502fa More constraints for field inference. 2024-03-11 14:48:43 +01:00
Lukas Tönne 52d7ffcd70 Merge branch 'main' into socket-type-inference 2024-03-11 12:20:35 +01:00
Lukas Tönne dbcb3a51b7 Initial steps for field inference with new solver. 2024-03-11 00:49:35 +01:00
Lukas Tönne 3211ba1309 Fixed binary constraint resolution. 2024-03-11 00:01:12 +01:00
Lukas Tönne d4048cf06b Nicer printing. 2024-03-10 22:57:47 +01:00
Lukas Tönne b1be9e94fc More debug printiiiing. 2024-03-10 20:03:37 +01:00
Lukas Tönne 7ac85ef397 Initial implementation of the AC3 algorithm for resolving socket types. 2024-03-10 19:13:47 +01:00