Node network subgraph editing (#1750)

* Breadcrumb visualization, nested network consistency, create definitions for Merge internal nodes

* Add index to network inputs, remove imports usage from flatten network

* Replace NodeOutput with NodeInput::Node

* Fully remove imports field, remove unnecessary identity nodes, move Output node to encapsulating network

* Replace previous_outputs with root_node, fix adding artboard/layer to empty network

* Import/Export UI nodes

* Display input/output types dynamically from compiled network

* Add LayerNodeIdentifer::ROOT_PARENT

* Prevent .to_node() on ROOT_PARENT

* Separate NodeGraphMessage and GraphOperationMessage

* General bug fixes with nested networks

* Change layer color, various bug fixes and improvements

* Fix disconnect and set node input for proto nodes and UI export node

* Dashed line to export for previewed node

* Fix deleting proto nodes and nodes that feed into export

* Allow modifications to nodes outside of nested network

* Get network from Node Id parameter

* Change root_node to previous_root_node

* Get TaggedValue from proto node implementation type when disconnecting

* Improve preview functionality and state

* Artboard position and delete children fix

* Name inputs/outputs based on DocumentNodeDefinition or type, fix new artboard/layer insertion

* replace "Link" with "Wire", adjust previewing

* Various bug fixes and improvements

* Modify Sample and Poisson-Disk points, fix incorrect input index and deleting currently viewed node

* Open demo artwork

* Fix opening already upgraded documents and refactor FrontendGraphDataType usages

* Fix deleting within network and other bugs

* Get default node input from compiled network when copying, fix previews, tests, demo artwork

* Code cleanup

* Hide EditorApi and add a comment describing unresolved Import node input types

* Code review

* Replace placeholder ROOT_PARENT NodeId with std::u64::MAX

* Breadcrumb padding

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
adamgerhant 2024-06-02 01:01:56 -07:00 committed by GitHub
parent e4d3faa52a
commit 6d74abb4de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
77 changed files with 3924 additions and 2327 deletions

View file

@ -141,7 +141,7 @@ pub fn serialize_gpu(networks: &[ProtoNetwork], io: &ShaderIO) -> anyhow::Result
let mut output_nodes = Vec::new();
for network in networks {
dbg!(&network);
//assert_eq!(network.inputs.len(), io.inputs.iter().filter(|x| !x.is_output()).count());
// assert_eq!(network.inputs.len(), io.inputs.iter().filter(|x| !x.is_output()).count());
#[derive(serde::Serialize, Debug)]
struct Node {
id: String,
@ -215,10 +215,10 @@ pub fn compile(dir: &Path) -> Result<spirv_builder::CompileResult, spirv_builder
.preserve_bindings(true)
.release(true)
.spirv_metadata(SpirvMetadata::Full)
//.scalar_block_layout(true)
// .scalar_block_layout(true)
.relax_logical_pointer(true)
//.capability(spirv_builder::Capability::Float64)
//.capability(spirv_builder::Capability::VariablePointersStorageBuffer)
// .capability(spirv_builder::Capability::Float64)
// .capability(spirv_builder::Capability::VariablePointersStorageBuffer)
.extra_arg("no-early-report-zombies")
.extra_arg("no-infer-storage-classes")
.extra_arg("spirt-passes=qptr")

View file

@ -4,39 +4,41 @@
#[cfg(target_arch = "spirv")]
extern crate spirv_std;
//#[cfg(target_arch = "spirv")]
//pub mod gpu {
//use super::*;
use spirv_std::spirv;
use spirv_std::glam;
use spirv_std::glam::{UVec3, Vec2, Mat2, BVec2};
// #[cfg(target_arch = "spirv")]
// pub mod gpu {
// use super::*;
#[allow(unused)]
#[spirv(compute(threads({{compute_threads}})))]
pub fn eval (
#[spirv(global_invocation_id)] _global_index: UVec3,
{% for input in inputs %}
{{input}},
{% endfor %}
) {
use graphene_core::{Node, NodeMut};
use graphene_core::raster::adjustments::{BlendMode, BlendNode};
use graphene_core::Color;
use spirv_std::spirv;
use spirv_std::glam;
use spirv_std::glam::{UVec3, Vec2, Mat2, BVec2};
{% for input in input_nodes %}
let _i{{input.index}} = graphene_core::value::CopiedNode::new(*i{{input.index}});
let _{{input.id}} = {{input.fqn}}::new({% for arg in input.args %}{{arg}}, {% endfor %});
let {{input.id}} = graphene_core::structural::ComposeNode::new(_i{{input.index}}, _{{input.id}});
{% endfor %}
#[allow(unused)]
#[spirv(compute(threads({{compute_threads}})))]
pub fn eval (
#[spirv(global_invocation_id)] _global_index: UVec3,
{% for input in inputs %}
{{input}},
{% endfor %}
) {
use graphene_core::{Node, NodeMut};
use graphene_core::raster::adjustments::{BlendMode, BlendNode};
use graphene_core::Color;
{% for node in nodes %}
let mut {{node.id}} = {{node.fqn}}::new({% for arg in node.args %}{{arg}}, {% endfor %});
{% endfor %}
{% for input in input_nodes %}
let _i{{input.index}} = graphene_core::value::CopiedNode::new(*i{{input.index}});
let _{{input.id}} = {{input.fqn}}::new({% for arg in input.args %}{{arg}}, {% endfor %});
let {{input.id}} = graphene_core::structural::ComposeNode::new(_i{{input.index}}, _{{input.id}});
{% endfor %}
{% for output in output_nodes %}
let v = {{output}}.eval(());
o{{loop.index0}}[(_global_index.y * i0 + _global_index.x) as usize] = v;
{% endfor %}
// TODO: Write output to buffer
}
//}
{% for node in nodes %}
let mut {{node.id}} = {{node.fqn}}::new({% for arg in node.args %}{{arg}}, {% endfor %});
{% endfor %}
{% for output in output_nodes %}
let v = {{output}}.eval(());
o{{loop.index0}}[(_global_index.y * i0 + _global_index.x) as usize] = v;
{% endfor %}
// TODO: Write output to buffer
}
// }