New nodes: 'Reset Transform', 'Replace Transform', 'Count Points', 'Index Points' (#3420)

- Add the 'Reset Transform' and 'Replace Transform' nodes
- Add the 'Count Points' and 'Index Points' nodes
- Make the 'Index Elements' node support negative indexing from the end
- Make the 'Flatten Vector' node's implementation reusable
- Fix crash displaying 0x0 raster image in the Data panel
- Fix the 'Points to Polyline' node not working on two-point objects
This commit is contained in:
Keavon Chambers
2025-11-25 20:41:59 -08:00
committed by GitHub
parent 117ce301b0
commit eb0f019b15
9 changed files with 210 additions and 79 deletions

View File

@@ -502,10 +502,17 @@ impl TableRowLayout for Raster<CPU> {
format!("Raster ({}x{})", self.width, self.height)
}
fn element_page(&self, _data: &mut LayoutData) -> Vec<LayoutGroup> {
let base64_string = self.data().base64_string.clone().unwrap_or_else(|| {
let raster = self.data();
if raster.width == 0 || raster.height == 0 {
let widgets = vec![TextLabel::new("Image has no area").widget_holder()];
return vec![LayoutGroup::Row { widgets }];
}
let base64_string = raster.base64_string.clone().unwrap_or_else(|| {
use base64::Engine;
let output = self.data().to_png();
let output = raster.to_png();
let preamble = "data:image/png;base64,";
let mut base64_string = String::with_capacity(preamble.len() + output.len() * 4);
base64_string.push_str(preamble);

View File

@@ -154,6 +154,7 @@ pub(crate) fn property_from_type(
Some("PixelLength") => number_widget(default_info, number_input.min(min(0.)).unit(unit.unwrap_or(" px"))).into(),
Some("Length") => number_widget(default_info, number_input.min(min(0.))).into(),
Some("Fraction") => number_widget(default_info, number_input.mode_range().min(min(0.)).max(max(1.))).into(),
Some("SignedInteger") => number_widget(default_info, number_input.int()).into(),
Some("IntegerCount") => number_widget(default_info, number_input.int().min(min(1.))).into(),
Some("SeedValue") => number_widget(default_info, number_input.int().min(min(0.))).into(),
Some("PixelSize") => vec2_widget(default_info, "X", "Y", unit.unwrap_or(" px"), None, false),