mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Make the Data panel show type-driven widgets for attributes (#4062)
This commit is contained in:
@@ -447,6 +447,11 @@ impl AttributeColumns {
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns a type-erased reference to the cell value at the given index in the column for the given key.
|
||||
fn get_any_cell(&self, key: &str, index: usize) -> Option<&dyn std::any::Any> {
|
||||
self.columns.iter().find_map(|(k, column)| if k == key { column.get_any(index) } else { None })
|
||||
}
|
||||
|
||||
/// Returns an iterator over the keys of all stored attribute columns, in insertion order.
|
||||
fn keys(&self) -> impl Iterator<Item = &str> {
|
||||
self.columns.iter().map(|(key, _)| key.as_str())
|
||||
@@ -664,6 +669,11 @@ impl<T> Table<T> {
|
||||
self.attributes.display_cell_value(key, index, overrides)
|
||||
}
|
||||
|
||||
/// Returns a type-erased reference to the attribute value at the given row index and key, or `None` if absent.
|
||||
pub fn attribute_any(&self, key: &str, index: usize) -> Option<&dyn std::any::Any> {
|
||||
self.attributes.get_any_cell(key, index)
|
||||
}
|
||||
|
||||
// =====================
|
||||
// Split borrow helpers
|
||||
// =====================
|
||||
|
||||
Reference in New Issue
Block a user