Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Keavon committed Jan 21, 2025
1 parent 913b5e2 commit 73c144a
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct NodePropertiesContext<'a> {
impl NodePropertiesContext<'_> {
pub fn call_widget_override(&mut self, node_id: &NodeId, index: usize) -> Option<Vec<LayoutGroup>> {
let Some(input_properties_row) = self.network_interface.input_properties_row(node_id, index, self.selection_network_path) else {
log::error!("Could not get input properties row in call_widget_override");
log::error!("Could not get input properties row at the beginning of call_widget_override");
return None;
};
if let Some(widget_override) = &input_properties_row.widget_override {
Expand Down Expand Up @@ -2466,7 +2466,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
nodes: [
DocumentNode {
inputs: vec![NodeInput::network(concrete!(graphene_core::vector::VectorData), 0)],
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::vector_nodes::SubpathSegmentLengthsNode")),
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::SubpathSegmentLengthsNode")),
manual_composition: Some(generic!(T)),
..Default::default()
},
Expand All @@ -2479,7 +2479,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
NodeInput::network(concrete!(bool), 4), // From the document node's parameters
NodeInput::node(NodeId(0), 0), // From output 0 of SubpathSegmentLengthsNode
],
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::vector_nodes::SamplePointsNode")),
implementation: DocumentNodeImplementation::ProtoNode(ProtoNodeIdentifier::new("graphene_core::vector::SamplePointsNode")),
manual_composition: Some(generic!(T)),
..Default::default()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ pub(crate) fn property_from_type(node_id: NodeId, index: usize, ty: &Type, conte
Separator::new(SeparatorType::Unrelated).widget_holder(),
TextLabel::new("-")
.tooltip(format!(
"This data can only be supplied through the\n\
node graph because no widget exists for its type:\n\
"This data can only be supplied through the node graph because no widget exists for its type:\n\
{}",
concrete_type.name
))
Expand Down
93 changes: 45 additions & 48 deletions editor/src/messages/portfolio/portfolio_message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
let upgrade_vector_manipulation_format = document_serialized_content.contains("ManipulatorGroupIds") && !document_name.contains("__DO_NOT_UPGRADE__");
let document_name = document_name.replace("__DO_NOT_UPGRADE__", "");

const TEXT_REPLACEMENTS: [(&str, &str); 2] = [
("graphene_core::vector::vector_nodes::SamplePointsNode", "graphene_core::vector::SamplePointsNode"),
("graphene_core::vector::vector_nodes::SubpathSegmentLengthsNode", "graphene_core::vector::SubpathSegmentLengthsNode"),
];
let document_serialized_content = TEXT_REPLACEMENTS
.iter()
.fold(document_serialized_content, |document_serialized_content, (old, new)| document_serialized_content.replace(old, new));

let document = DocumentMessageHandler::deserialize_document(&document_serialized_content).map(|mut document| {
document.name.clone_from(&document_name);
document
Expand All @@ -413,57 +421,46 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
}
};

const REPLACEMENTS: [(&str, &str); 47] = [
("graphene_core::graphic_element::AppendArtboardNode", "graphene_core::AddArtboardNode"),
("graphene_core::graphic_element::ToArtboardNode", "graphene_core::ConstructArtboardNode"),
("graphene_core::graphic_element::ToElementNode", "graphene_core::ToGraphicElementNode"),
("graphene_core::graphic_element::ToGroupNode", "graphene_core::ToGraphicGroupNode"),
("graphene_core::ops::LogicAndNode", "graphene_core::logic::LogicAndNode"),
("graphene_core::ops::LogicNotNode", "graphene_core::logic::LogicNotNode"),
("graphene_core::ops::LogicOrNode", "graphene_core::logic::LogicOrNode"),
("graphene_core::ops::Vector2ValueNode", "graphene_core::ops::ConstructVector2"),
("graphene_core::raster::adjustments::BlackAndWhiteNode", "graphene_core::raster::BlackAndWhiteNode"),
("graphene_core::raster::adjustments::BlendNode", "graphene_core::raster::BlendNode"),
("graphene_core::raster::adjustments::ChannelMixerNode", "graphene_core::raster::ChannelMixerNode"),
const REPLACEMENTS: [(&str, &str); 36] = [
("graphene_core::AddArtboardNode", "graphene_core::graphic_element::AppendArtboardNode"),
("graphene_core::ConstructArtboardNode", "graphene_core::graphic_element::ToArtboardNode"),
("graphene_core::ToGraphicElementNode", "graphene_core::graphic_element::ToElementNode"),
("graphene_core::ToGraphicGroupNode", "graphene_core::graphic_element::ToGroupNode"),
("graphene_core::logic::LogicAndNode", "graphene_core::ops::LogicAndNode"),
("graphene_core::logic::LogicNotNode", "graphene_core::ops::LogicNotNode"),
("graphene_core::logic::LogicOrNode", "graphene_core::ops::LogicOrNode"),
("graphene_core::ops::ConstructVector2", "graphene_core::ops::Vector2ValueNode"),
("graphene_core::raster::BlackAndWhiteNode", "graphene_core::raster::adjustments::BlackAndWhiteNode"),
("graphene_core::raster::BlendNode", "graphene_core::raster::adjustments::BlendNode"),
("graphene_core::raster::ChannelMixerNode", "graphene_core::raster::adjustments::ChannelMixerNode"),
("graphene_core::raster::adjustments::ColorOverlayNode", "graphene_core::raster::adjustments::ColorOverlayNode"),
("graphene_core::raster::adjustments::ExposureNode", "graphene_core::raster::ExposureNode"),
("graphene_core::raster::adjustments::ExtractChannelNode", "graphene_core::raster::ExtractChannelNode"),
("graphene_core::raster::adjustments::GradientMapNode", "graphene_core::raster::GradientMapNode"),
("graphene_core::raster::adjustments::HueSaturationNode", "graphene_core::raster::HueSaturationNode"),
("graphene_core::raster::adjustments::IndexNode", "graphene_core::raster::IndexNode"),
("graphene_core::raster::adjustments::InvertNode", "graphene_core::raster::InvertNode"),
("graphene_core::raster::adjustments::InvertNode", "graphene_core::raster::InvertRGBNode"),
("graphene_core::raster::adjustments::LevelsNode", "graphene_core::raster::LevelsNode"),
("graphene_core::raster::adjustments::LuminanceNode", "graphene_core::raster::LuminanceNode"),
("graphene_core::raster::adjustments::MakeOpaqueNode", "graphene_core::raster::ExtractOpaqueNode"),
("graphene_core::raster::adjustments::PosterizeNode", "graphene_core::raster::PosterizeNode"),
("graphene_core::raster::adjustments::ThresholdNode", "graphene_core::raster::ThresholdNode"),
("graphene_core::raster::adjustments::VibranceNode", "graphene_core::raster::VibranceNode"),
("graphene_core::text::TextNode", "graphene_core::text::TextGeneratorNode"),
("graphene_core::transform::ReplaceTransformNode", "graphene_core::transform::SetTransformNode"),
("graphene_core::vector::generator_nodes::EllipseNode", "graphene_core::vector::generator_nodes::EllipseGenerator"),
("graphene_core::vector::generator_nodes::LineNode", "graphene_core::vector::generator_nodes::LineGenerator"),
("graphene_core::vector::generator_nodes::PathNode", "graphene_core::vector::generator_nodes::PathGenerator"),
("graphene_core::vector::generator_nodes::RectangleNode", "graphene_core::vector::generator_nodes::RectangleGenerator"),
("graphene_core::raster::ExposureNode", "graphene_core::raster::adjustments::ExposureNode"),
("graphene_core::raster::ExtractChannelNode", "graphene_core::raster::adjustments::ExtractChannelNode"),
("graphene_core::raster::GradientMapNode", "graphene_core::raster::adjustments::GradientMapNode"),
("graphene_core::raster::HueSaturationNode", "graphene_core::raster::adjustments::HueSaturationNode"),
("graphene_core::raster::IndexNode", "graphene_core::raster::adjustments::IndexNode"),
("graphene_core::raster::InvertNode", "graphene_core::raster::adjustments::InvertNode"),
("graphene_core::raster::InvertRGBNode", "graphene_core::raster::adjustments::InvertNode"),
("graphene_core::raster::LevelsNode", "graphene_core::raster::adjustments::LevelsNode"),
("graphene_core::raster::LuminanceNode", "graphene_core::raster::adjustments::LuminanceNode"),
("graphene_core::raster::ExtractOpaqueNode", "graphene_core::raster::adjustments::MakeOpaqueNode"),
("graphene_core::raster::PosterizeNode", "graphene_core::raster::adjustments::PosterizeNode"),
("graphene_core::raster::ThresholdNode", "graphene_core::raster::adjustments::ThresholdNode"),
("graphene_core::raster::VibranceNode", "graphene_core::raster::adjustments::VibranceNode"),
("graphene_core::text::TextGeneratorNode", "graphene_core::text::TextNode"),
("graphene_core::transform::SetTransformNode", "graphene_core::transform::ReplaceTransformNode"),
("graphene_core::vector::generator_nodes::EllipseGenerator", "graphene_core::vector::generator_nodes::EllipseNode"),
("graphene_core::vector::generator_nodes::LineGenerator", "graphene_core::vector::generator_nodes::LineNode"),
("graphene_core::vector::generator_nodes::PathGenerator", "graphene_core::vector::generator_nodes::PathNode"),
("graphene_core::vector::generator_nodes::RectangleGenerator", "graphene_core::vector::generator_nodes::RectangleNode"),
(
"graphene_core::vector::generator_nodes::RegularPolygonNode",
"graphene_core::vector::generator_nodes::RegularPolygonGenerator",
"graphene_core::vector::generator_nodes::RegularPolygonNode",
),
("graphene_core::vector::generator_nodes::SplineNode", "graphene_core::vector::generator_nodes::SplineGenerator"),
("graphene_core::vector::generator_nodes::StarNode", "graphene_core::vector::generator_nodes::StarGenerator"),
("graphene_core::vector::vector_nodes::AreaNode", "graphene_core::vector::AreaNode"),
("graphene_core::vector::vector_nodes::BoundingBoxNode", "graphene_core::vector::BoundingBoxNode"),
("graphene_core::vector::vector_nodes::CentroidNode", "graphene_core::vector::CentroidNode"),
("graphene_core::vector::vector_nodes::CircularRepeatNode", "graphene_core::vector::CircularRepeatNode"),
("graphene_core::vector::vector_nodes::CopyToPoints", "graphene_core::vector::CopyToPoints"),
("graphene_core::vector::vector_nodes::MorphNode", "graphene_core::vector::MorphNode"),
("graphene_core::vector::vector_nodes::PoissonDiskPoints", "graphene_core::vector::PoissonDiskPoints"),
("graphene_core::vector::vector_nodes::RepeatNode", "graphene_core::vector::RepeatNode"),
("graphene_core::vector::vector_nodes::SolidifyStrokeNode", "graphene_core::vector::SolidifyStrokeNode"),
("graphene_core::vector::vector_nodes::SplinesFromPointsNode", "graphene_core::vector::SplinesFromPointsNode"),
("graphene_core::vector::vector_nodes::StrokeNode", "graphene_core::vector::SetStrokeNode"),
("graphene_std::gpu_nodes::BlendGpuImageNode", "graphene_std::executor::BlendGpuImageNode"),
("graphene_std::raster::SampleImageNode", "graphene_std::raster::SampleNode"),
("graphene_core::vector::generator_nodes::SplineGenerator", "graphene_core::vector::generator_nodes::SplineNode"),
("graphene_core::vector::generator_nodes::StarGenerator", "graphene_core::vector::generator_nodes::StarNode"),
("graphene_std::executor::BlendGpuImageNode", "graphene_std::gpu_nodes::BlendGpuImageNode"),
("graphene_std::raster::SampleNode", "graphene_std::raster::SampleImageNode"),
];
for node_id in &document
.network_interface
Expand All @@ -476,7 +473,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
.collect::<Vec<NodeId>>()
{
if let Some(DocumentNodeImplementation::ProtoNode(protonode_id)) = document.network_interface.network(&[]).unwrap().nodes.get(node_id).map(|node| node.implementation.clone()) {
for (new, old) in REPLACEMENTS {
for (old, new) in REPLACEMENTS {
let node_path_without_type_args = protonode_id.name.split('<').next();
if node_path_without_type_args == Some(old) {
document
Expand Down
2 changes: 1 addition & 1 deletion node-graph/gcore/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub mod types {
pub type PixelLength = f64;
/// Non negative
pub type Length = f64;
/// 0.- 1.
/// 0 to 1
pub type Fraction = f64;
pub type IntegerCount = u32;
/// Int input with randomization button
Expand Down
6 changes: 4 additions & 2 deletions node-graph/gcore/src/vector/vector_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ impl ConcatElement for GraphicGroup {
}
}

#[node_macro::node(category(""))]
#[node_macro::node(category(""), path(graphene_core::vector))]
async fn sample_points<F: 'n + Send + Copy>(
#[implementations(
(),
Expand Down Expand Up @@ -815,7 +815,7 @@ async fn poisson_disk_points<F: 'n + Send>(
result
}

#[node_macro::node(category(""))]
#[node_macro::node(category(""), path(graphene_core::vector))]
async fn subpath_segment_lengths<F: 'n + Send>(
#[implementations(
(),
Expand Down Expand Up @@ -979,6 +979,8 @@ async fn morph<F: 'n + Send + Copy>(
let target = target.eval(footprint).await;
let mut result = VectorData::empty();

let time = time.clamp(0., 1.);

// Lerp styles
result.alpha_blending = if time < 0.5 { source.alpha_blending } else { target.alpha_blending };
result.style = source.style.lerp(&target.style, time);
Expand Down
2 changes: 1 addition & 1 deletion website/content/donate.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Click a membership level below to pay directly (no account needed). A small fee
**$25 / month**

- Your **personal name** (or handle) **on the Graphite website and GitHub readme**
- Option to be mailed a personal **thank-you card with Graphite stickers** (US addresses only)
- Option to be mailed a personal **thank-you card with Graphite stickers** (in the US only)
- *Plus the lower-tier rewards*

</a>
Expand Down

0 comments on commit 73c144a

Please sign in to comment.