diff --git a/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs b/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs index b478caac..969c33fd 100644 --- a/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/data_panel/data_panel_message_handler.rs @@ -165,6 +165,7 @@ fn generate_layout(introspected_data: &Arc>, Table, Table, + Vec, f64, u32, u64, @@ -203,12 +204,44 @@ trait TableRowLayout { } } +impl TableRowLayout for Vec { + fn type_name() -> &'static str { + "Vec" + } + fn identifier(&self) -> String { + format!("Vec<{}> ({} element{})", T::type_name(), self.len(), if self.len() == 1 { "" } else { "s" }) + } + fn element_page(&self, data: &mut LayoutData) -> Vec { + if let Some(index) = data.desired_path.get(data.current_depth).copied() { + if let Some(row) = self.get(index) { + data.current_depth += 1; + let result = row.layout_with_breadcrumb(data); + data.current_depth -= 1; + return result; + } else { + warn!("Desired path truncated"); + data.desired_path.truncate(data.current_depth); + } + } + + let mut rows = self + .iter() + .enumerate() + .map(|(index, row)| vec![TextLabel::new(format!("{index}")).narrow(true).widget_holder(), row.element_widget(index)]) + .collect::>(); + + rows.insert(0, column_headings(&["", "element"])); + + vec![LayoutGroup::Table { rows }] + } +} + impl TableRowLayout for Table { fn type_name() -> &'static str { "Table" } fn identifier(&self) -> String { - format!("Table<{}> ({} row{})", T::type_name(), self.len(), if self.len() == 1 { "" } else { "s" }) + format!("Table<{}> ({} element{})", T::type_name(), self.len(), if self.len() == 1 { "" } else { "s" }) } fn element_page(&self, data: &mut LayoutData) -> Vec { if let Some(index) = data.desired_path.get(data.current_depth).copied() { @@ -595,7 +628,13 @@ impl TableRowLayout for String { "String" } fn identifier(&self) -> String { - "String".to_string() + // Show the first line, and if there are more, indicate that with an ellipsis + let first_line = self.lines().next().unwrap_or(""); + if self.lines().count() > 1 { + format!("\"{} …\"", first_line) + } else { + format!("\"{}\"", first_line) + } } fn element_page(&self, _data: &mut LayoutData) -> Vec { let widgets = vec![TextAreaInput::new(self.to_string()).disabled(true).widget_holder()]; diff --git a/editor/src/messages/portfolio/document/node_graph/utility_types.rs b/editor/src/messages/portfolio/document/node_graph/utility_types.rs index b3ed8777..c22df85c 100644 --- a/editor/src/messages/portfolio/document/node_graph/utility_types.rs +++ b/editor/src/messages/portfolio/document/node_graph/utility_types.rs @@ -37,7 +37,7 @@ impl FrontendGraphDataType { TaggedValue::Vector(_) => Self::Vector, TaggedValue::Color(_) => Self::Color, TaggedValue::Gradient(_) | TaggedValue::GradientStops(_) | TaggedValue::GradientTable(_) => Self::Gradient, - TaggedValue::String(_) => Self::Typography, + TaggedValue::String(_) | TaggedValue::VecString(_) => Self::Typography, _ => Self::General, } } diff --git a/frontend/src/components/panels/Data.svelte b/frontend/src/components/panels/Data.svelte index 7873be68..f3b11179 100644 --- a/frontend/src/components/panels/Data.svelte +++ b/frontend/src/components/panels/Data.svelte @@ -45,6 +45,21 @@ &:not(:first-child) { margin-top: 0; } + + tr:first-child:has(td:first-child label:empty) ~ tr td:first-child { + width: 0; + } + } + + .widget-span:has(.text-area-input) { + flex: 1 1 100%; + + .text-area-input textarea { + height: 100%; + margin-top: 0; + margin-bottom: 0; + resize: none; + } } } diff --git a/node-graph/graph-craft/src/document/value.rs b/node-graph/graph-craft/src/document/value.rs index 18e9533f..adc6b32e 100644 --- a/node-graph/graph-craft/src/document/value.rs +++ b/node-graph/graph-craft/src/document/value.rs @@ -180,6 +180,7 @@ tagged_value! { VecF64(Vec), VecDVec2(Vec), F64Array4([f64; 4]), + VecString(Vec), NodePath(Vec), // =========== // TABLE TYPES