Rename "options/top bar" terminology to "control bar" and update comments

This commit is contained in:
Keavon Chambers 2025-01-07 17:23:57 -08:00
parent 1c880daea2
commit 9eb544df74
21 changed files with 83 additions and 92 deletions

View File

@ -9,7 +9,8 @@ jobs:
clippy:
name: Run Clippy
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
# TODO(Keavon): Find a workaround (passing the output text to a separate action with permission to read the secrets?) that allows this to work on fork PRs
if: ${{ !github.event.pull_request.draft && !github.event.pull_request.head.repo.fork }}
permissions:
contents: read
pull-requests: write

View File

@ -77,7 +77,7 @@ impl Dispatcher {
pub fn handle_message<T: Into<Message>>(&mut self, message: T, process_after_all_current: bool) {
let message = message.into();
// Add all aditional messages to the buffer if it exists (except from the end buffer message)
// Add all additional messages to the buffer if it exists (except from the end buffer message)
if !matches!(message, Message::EndBuffer(_)) {
if let Some(buffered_queue) = &mut self.buffered_queue {
Self::schedule_execution(buffered_queue, true, [message]);

View File

@ -110,7 +110,7 @@ pub enum FrontendMessage {
#[serde(rename = "copyText")]
copy_text: String,
},
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
TriggerUpgradeDocumentToVectorManipulationFormat {
#[serde(rename = "documentId")]
document_id: DocumentId,
@ -234,7 +234,7 @@ pub enum FrontendMessage {
#[serde(rename = "hintData")]
hint_data: HintData,
},
UpdateLayersPanelOptionsLayout {
UpdateLayersPanelControlBarLayout {
#[serde(rename = "layoutTarget")]
layout_target: LayoutTarget,
diff: Vec<WidgetDiff>,
@ -251,7 +251,7 @@ pub enum FrontendMessage {
nodes: Vec<FrontendNode>,
wires: Vec<FrontendNodeWire>,
},
UpdateNodeGraphBarLayout {
UpdateNodeGraphControlBarLayout {
#[serde(rename = "layoutTarget")]
layout_target: LayoutTarget,
diff: Vec<WidgetDiff>,

View File

@ -401,9 +401,9 @@ impl LayoutMessageHandler {
LayoutTarget::DialogColumn2 => FrontendMessage::UpdateDialogColumn2 { layout_target, diff },
LayoutTarget::DocumentBar => FrontendMessage::UpdateDocumentBarLayout { layout_target, diff },
LayoutTarget::DocumentMode => FrontendMessage::UpdateDocumentModeLayout { layout_target, diff },
LayoutTarget::LayersPanelOptions => FrontendMessage::UpdateLayersPanelOptionsLayout { layout_target, diff },
LayoutTarget::LayersPanelControlBar => FrontendMessage::UpdateLayersPanelControlBarLayout { layout_target, diff },
LayoutTarget::MenuBar => unreachable!("Menu bar is not diffed"),
LayoutTarget::NodeGraphBar => FrontendMessage::UpdateNodeGraphBarLayout { layout_target, diff },
LayoutTarget::NodeGraphControlBar => FrontendMessage::UpdateNodeGraphControlBarLayout { layout_target, diff },
LayoutTarget::PropertiesSections => FrontendMessage::UpdatePropertyPanelSectionsLayout { layout_target, diff },
LayoutTarget::ToolOptions => FrontendMessage::UpdateToolOptionsLayout { layout_target, diff },
LayoutTarget::ToolShelf => FrontendMessage::UpdateToolShelfLayout { layout_target, diff },

View File

@ -33,11 +33,11 @@ pub enum LayoutTarget {
/// Contains the dropdown for design / select / guide mode found on the top left of the canvas.
DocumentMode,
/// Options for opacity seen at the top of the Layers panel.
LayersPanelOptions,
LayersPanelControlBar,
/// The dropdown menu at the very top of the application: File, Edit, etc.
MenuBar,
/// Bar at the top of the node graph containing the location and the "Preview" and "Hide" buttons.
NodeGraphBar,
NodeGraphControlBar,
/// The body of the Properties panel containing many collapsable sections.
PropertiesSections,
/// The bar directly above the canvas, left-aligned and to the right of the document mode dropdown.

View File

@ -275,10 +275,10 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
let data_buffer: RawBuffer = Self::default().serialize_root();
responses.add(FrontendMessage::UpdateDocumentLayerStructure { data_buffer });
// Clear the options bar
// Clear the control bar
responses.add(LayoutMessage::SendLayout {
layout: Layout::WidgetLayout(Default::default()),
layout_target: LayoutTarget::LayersPanelOptions,
layout_target: LayoutTarget::LayersPanelControlBar,
});
}
DocumentMessage::InsertBooleanOperation { operation } => {
@ -350,7 +350,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
DocumentMessage::DocumentHistoryBackward => self.undo_with_history(ipp, responses),
DocumentMessage::DocumentHistoryForward => self.redo_with_history(ipp, responses),
DocumentMessage::DocumentStructureChanged => {
self.update_layers_panel_options_bar_widgets(responses);
self.update_layers_panel_control_bar_widgets(responses);
self.network_interface.load_structure();
let data_buffer: RawBuffer = self.serialize_root();
@ -1901,7 +1901,7 @@ impl DocumentMessageHandler {
});
}
pub fn update_layers_panel_options_bar_widgets(&self, responses: &mut VecDeque<Message>) {
pub fn update_layers_panel_control_bar_widgets(&self, responses: &mut VecDeque<Message>) {
// Get an iterator over the selected layers (excluding artboards which don't have an opacity or blend mode).
let selected_nodes = self.network_interface.selected_nodes(&[]).unwrap();
let selected_layers_except_artboards = selected_nodes.selected_layers_except_artboards(&self.network_interface);
@ -1969,7 +1969,7 @@ impl DocumentMessageHandler {
.selected_layers(self.metadata())
.all(|layer| self.network_interface.is_locked(&layer.to_node(), &[]));
let layers_panel_options_bar = WidgetLayout::new(vec![LayoutGroup::Row {
let layers_panel_control_bar = WidgetLayout::new(vec![LayoutGroup::Row {
widgets: vec![
DropdownInput::new(blend_mode_menu_entries)
.selected_index(blend_mode.and_then(|blend_mode| blend_mode.index_in_list_svg_subset()).map(|index| index as u32))
@ -2037,8 +2037,8 @@ impl DocumentMessageHandler {
}]);
responses.add(LayoutMessage::SendLayout {
layout: Layout::WidgetLayout(layers_panel_options_bar),
layout_target: LayoutTarget::LayersPanelOptions,
layout: Layout::WidgetLayout(layers_panel_control_bar),
layout_target: LayoutTarget::LayersPanelControlBar,
});
}
@ -2295,7 +2295,7 @@ impl Iterator for ClickXRayIter<'_> {
}
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct OldDocumentMessageHandler {
// ============================================

View File

@ -1637,11 +1637,11 @@ impl NodeGraphMessageHandler {
common
}
/// Send the cached layout to the frontend for the options bar at the top of the node panel
/// Send the cached layout to the frontend for the control bar at the top of the node panel
fn send_node_bar_layout(&self, responses: &mut VecDeque<Message>) {
responses.add(LayoutMessage::SendLayout {
layout: Layout::WidgetLayout(WidgetLayout::new(self.widgets.to_vec())),
layout_target: LayoutTarget::NodeGraphBar,
layout_target: LayoutTarget::NodeGraphControlBar,
});
}

View File

@ -3311,7 +3311,7 @@ impl NodeNetworkInterface {
node.implementation = implementation;
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
/// Keep metadata in sync with the new implementation if this is used by anything other than the upgrade scripts
pub fn replace_implementation_metadata(&mut self, node_id: &NodeId, network_path: &[NodeId], metadata: DocumentNodePersistentMetadata) {
let Some(network_metadata) = self.network_metadata_mut(network_path) else {

View File

@ -407,7 +407,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
}
};
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
// Upgrade all old nodes to support editable subgraphs introduced in #1750
if upgrade_from_before_editable_subgraphs {
// This can be used, if uncommented, to upgrade demo artwork with outdated document node internals from their definitions. Delete when it's no longer needed.
@ -461,7 +461,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
};
// Upgrade Fill nodes to the format change in #1778
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
let Some(ref reference) = node_metadata.persistent_metadata.reference.clone() else {
continue;
};
@ -616,7 +616,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageData<'_>> for PortfolioMes
}
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
// Upgrade document to the new vector manipulation format introduced in #1676
let document_serialized_content = document.serialize_document();
if upgrade_vector_manipulation_format && !document_serialized_content.is_empty() {
@ -974,7 +974,7 @@ impl PortfolioMessageHandler {
fn load_document(&mut self, new_document: DocumentMessageHandler, document_id: DocumentId, responses: &mut VecDeque<Message>) {
let new_document = new_document;
self.document_ids.push(document_id);
new_document.update_layers_panel_options_bar_widgets(responses);
new_document.update_layers_panel_control_bar_widgets(responses);
self.documents.insert(document_id, new_document);

View File

@ -795,7 +795,7 @@ impl ShapeState {
while let Some((anchor, handles)) = missing_anchors.keys().next().copied().and_then(|id| missing_anchors.remove_entry(&id)) {
visited.push(anchor);
// If the adgacent point is just this point then skip
// If the adjacent point is just this point then skip
let mut handles = handles.map(|handle| (handle.1 != anchor).then_some(handle));
// If the adjacent points are themselves being deleted, then repeatedly visit the newest agacent points.

View File

@ -63,8 +63,7 @@ pub trait Fsm {
/// The implementing tool must set this to a struct designed to store the internal values stored in the tool.
/// For example, it might be used to store the starting location of a point when a drag began so the displacement distance can be calculated.
type ToolData;
/// The implementing tool must set this to a struct (or `()` if none) designed to store the values of the tool options set by the user in the Options Bar
/// (located above the viewport, below the document's tab).
/// The implementing tool must set this to a struct (or `()` if none) designed to store the values of the tool options set by the user in the tool controls portion on the left of the control bar.
type ToolOptions;
/// Implementing this mandatory trait function lets a specific tool react accordingly (and potentially change its state or internal variables) upon receiving an event to do something.

View File

@ -444,18 +444,18 @@
</script>
<LayoutCol class="document" on:dragover={(e) => e.preventDefault()} on:drop={dropFile}>
<LayoutRow class="options-bar" classes={{ "for-graph": $document.graphViewOverlayOpen }} scrollableX={true}>
<LayoutRow class="control-bar" classes={{ "for-graph": $document.graphViewOverlayOpen }} scrollableX={true}>
{#if !$document.graphViewOverlayOpen}
<WidgetLayout layout={$document.documentModeLayout} />
<WidgetLayout layout={$document.toolOptionsLayout} />
<LayoutRow class="spacer" />
<WidgetLayout layout={$document.documentBarLayout} />
{:else}
<WidgetLayout layout={$document.nodeGraphBarLayout} />
<WidgetLayout layout={$document.nodeGraphControlBarLayout} />
{/if}
</LayoutRow>
<LayoutRow
class="shelf-and-table"
class="tool-shelf-and-viewport-area"
styles={toolShelfTotalToolsAndSeparators && {
"--total-separators": toolShelfTotalToolsAndSeparators.totalSeparators,
"--total-tool-rows-for-1-columns": toolShelfTotalToolsAndSeparators.totalToolRowsFor1Columns,
@ -463,7 +463,7 @@
"--total-tool-rows-for-3-columns": toolShelfTotalToolsAndSeparators.totalToolRowsFor3Columns,
}}
>
<LayoutCol class="shelf">
<LayoutCol class="tool-shelf">
{#if !$document.graphViewOverlayOpen}
<LayoutCol class="tools" scrollableY={true}>
<WidgetLayout layout={$document.toolShelfLayout} />
@ -471,24 +471,24 @@
{:else}
<LayoutRow class="spacer" />
{/if}
<LayoutCol class="shelf-bottom-widgets">
<LayoutCol class="tool-shelf-bottom-widgets">
<WidgetLayout class={"working-colors-input-area"} layout={$document.workingColorsLayout} />
</LayoutCol>
</LayoutCol>
<LayoutCol class="table">
<LayoutCol class="viewport-container">
{#if rulersVisible}
<LayoutRow class="ruler-or-scrollbar top-ruler">
<LayoutCol class="ruler-corner"></LayoutCol>
<RulerInput origin={rulerOrigin.x} majorMarkSpacing={rulerSpacing} numberInterval={rulerInterval} direction="Horizontal" bind:this={rulerHorizontal} />
</LayoutRow>
{/if}
<LayoutRow class="viewport-container">
<LayoutRow class="viewport-container-inner">
{#if rulersVisible}
<LayoutCol class="ruler-or-scrollbar">
<RulerInput origin={rulerOrigin.y} majorMarkSpacing={rulerSpacing} numberInterval={rulerInterval} direction="Vertical" bind:this={rulerVertical} />
</LayoutCol>
{/if}
<LayoutCol class="viewport-container" styles={{ cursor: canvasCursor }}>
<LayoutCol class="viewport-container-inner" styles={{ cursor: canvasCursor }}>
{#if cursorEyedropper}
<EyedropperPreview
colorChoice={cursorEyedropperPreviewColorChoice}
@ -547,7 +547,7 @@
padding-bottom: 0;
}
.options-bar {
.control-bar {
height: 32px;
flex: 0 0 auto;
margin: 0 4px;
@ -561,7 +561,7 @@
}
}
.shelf-and-table {
.tool-shelf-and-viewport-area {
// Enables usage of the `100cqh` unit to reference the height of this container element.
container-type: size;
@ -586,7 +586,7 @@
--columns-width: calc(var(--columns) * var(--tool-width));
--columns-width-max: calc(3px * var(--tool-width));
.shelf {
.tool-shelf {
flex: 0 0 auto;
justify-content: space-between;
// A precaution in case the variables above somehow fail
@ -644,7 +644,7 @@
}
}
.shelf-bottom-widgets {
.tool-shelf-bottom-widgets {
flex: 0 0 auto;
align-items: center;
@ -664,7 +664,7 @@
}
}
.table {
.viewport-container {
flex: 1 1 100%;
.ruler-or-scrollbar {
@ -699,7 +699,7 @@
margin-right: 16px;
}
.viewport-container {
.viewport-container-inner {
flex: 1 1 100%;
position: relative;

View File

@ -6,7 +6,7 @@
import { platformIsMac } from "@graphite/utility-functions/platform";
import { extractPixelData } from "@graphite/utility-functions/rasterization";
import type { Editor } from "@graphite/wasm-communication/editor";
import { defaultWidgetLayout, patchWidgetLayout, UpdateDocumentLayerDetails, UpdateDocumentLayerStructureJs, UpdateLayersPanelOptionsLayout } from "@graphite/wasm-communication/messages";
import { defaultWidgetLayout, patchWidgetLayout, UpdateDocumentLayerDetails, UpdateDocumentLayerStructureJs, UpdateLayersPanelControlBarLayout } from "@graphite/wasm-communication/messages";
import type { DataBuffer, LayerPanelEntry } from "@graphite/wasm-communication/messages";
import LayoutCol from "@graphite/components/layout/LayoutCol.svelte";
@ -47,12 +47,12 @@
let dragInPanel = false;
// Layouts
let layersPanelOptionsLayout = defaultWidgetLayout();
let layersPanelControlBarLayout = defaultWidgetLayout();
onMount(() => {
editor.subscriptions.subscribeJsMessage(UpdateLayersPanelOptionsLayout, (updateLayersPanelOptionsLayout) => {
patchWidgetLayout(layersPanelOptionsLayout, updateLayersPanelOptionsLayout);
layersPanelOptionsLayout = layersPanelOptionsLayout;
editor.subscriptions.subscribeJsMessage(UpdateLayersPanelControlBarLayout, (updateLayersPanelControlBarLayout) => {
patchWidgetLayout(layersPanelControlBarLayout, updateLayersPanelControlBarLayout);
layersPanelControlBarLayout = layersPanelControlBarLayout;
});
editor.subscriptions.subscribeJsMessage(UpdateDocumentLayerStructureJs, (updateDocumentLayerStructure) => {
@ -403,8 +403,8 @@
</script>
<LayoutCol class="layers" on:dragleave={() => (dragInPanel = false)}>
<LayoutRow class="options-bar" scrollableX={true}>
<WidgetLayout layout={layersPanelOptionsLayout} />
<LayoutRow class="control-bar" scrollableX={true}>
<WidgetLayout layout={layersPanelControlBarLayout} />
</LayoutRow>
<LayoutRow class="list-area" scrollableY={true}>
<LayoutCol class="list" data-layer-panel bind:this={list} on:click={() => deselectAllLayers()} on:dragover={updateInsertLine} on:dragend={drop} on:drop={drop}>
@ -489,8 +489,8 @@
<style lang="scss" global>
.layers {
// Options bar
.options-bar {
// Control bar
.control-bar {
height: 32px;
flex: 0 0 auto;
margin: 0 4px;

View File

@ -30,15 +30,6 @@
height: 100%;
flex: 1 1 100%;
.options-bar {
min-height: 32px;
margin: 0 4px;
.widget-span {
width: 100%;
}
}
.sections {
flex: 1 1 100%;

View File

@ -10,7 +10,7 @@ import {
UpdateToolOptionsLayout,
UpdateToolShelfLayout,
UpdateWorkingColorsLayout,
UpdateNodeGraphBarLayout,
UpdateNodeGraphControlBarLayout,
UpdateGraphViewOverlay,
TriggerDelayedZoomCanvasToFitAll,
UpdateGraphFadeArtwork,
@ -25,7 +25,7 @@ export function createDocumentState(editor: Editor) {
documentBarLayout: defaultWidgetLayout(),
toolShelfLayout: defaultWidgetLayout(),
workingColorsLayout: defaultWidgetLayout(),
nodeGraphBarLayout: defaultWidgetLayout(),
nodeGraphControlBarLayout: defaultWidgetLayout(),
// Graph view overlay
graphViewOverlayOpen: false,
fadeArtwork: 100,
@ -84,9 +84,9 @@ export function createDocumentState(editor: Editor) {
return state;
});
});
editor.subscriptions.subscribeJsMessage(UpdateNodeGraphBarLayout, (updateNodeGraphBarLayout) => {
editor.subscriptions.subscribeJsMessage(UpdateNodeGraphControlBarLayout, (updateNodeGraphControlBarLayout) => {
update((state) => {
patchWidgetLayout(state.nodeGraphBarLayout, updateNodeGraphBarLayout);
patchWidgetLayout(state.nodeGraphControlBarLayout, updateNodeGraphControlBarLayout);
return state;
});
});

View File

@ -117,7 +117,7 @@ export function createPortfolioState(editor: Editor) {
URL.revokeObjectURL(triggerRevokeBlobUrl.url);
});
editor.subscriptions.subscribeJsMessage(TriggerUpgradeDocumentToVectorManipulationFormat, async (triggerUpgradeDocumentToVectorManipulationFormat) => {
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
const { documentId, documentName, documentIsAutoSaved, documentIsSaved, documentSerializedContent } = triggerUpgradeDocumentToVectorManipulationFormat;
editor.handle.triggerUpgradeDocumentToVectorManipulationFormat(documentId, documentName, documentIsAutoSaved, documentIsSaved, documentSerializedContent);
});

View File

@ -920,7 +920,7 @@ export class TriggerAboutGraphiteLocalizedCommitDate extends JsMessage {
readonly commitDate!: string;
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
export class TriggerUpgradeDocumentToVectorManipulationFormat extends JsMessage {
readonly documentId!: bigint;
readonly documentName!: string;
@ -1518,7 +1518,7 @@ export class UpdateDocumentBarLayout extends WidgetDiffUpdate {}
export class UpdateDocumentModeLayout extends WidgetDiffUpdate {}
export class UpdateLayersPanelOptionsLayout extends WidgetDiffUpdate {}
export class UpdateLayersPanelControlBarLayout extends WidgetDiffUpdate {}
// Extends JsMessage instead of WidgetDiffUpdate because the menu bar isn't diffed
export class UpdateMenuBarLayout extends JsMessage {
@ -1530,7 +1530,7 @@ export class UpdateMenuBarLayout extends JsMessage {
layout!: MenuBarEntry[];
}
export class UpdateNodeGraphBarLayout extends WidgetDiffUpdate {}
export class UpdateNodeGraphControlBarLayout extends WidgetDiffUpdate {}
export class UpdatePropertyPanelSectionsLayout extends WidgetDiffUpdate {}
@ -1613,12 +1613,12 @@ export const messageMakers: Record<string, MessageMaker> = {
UpdateImportsExports,
UpdateInputHints,
UpdateInSelectedNetwork,
UpdateLayersPanelOptionsLayout,
UpdateLayersPanelControlBarLayout,
UpdateLayerWidths,
UpdateMenuBarLayout,
UpdateMouseCursor,
UpdateNodeGraph,
UpdateNodeGraphBarLayout,
UpdateNodeGraphControlBarLayout,
UpdateNodeGraphSelection,
UpdateNodeGraphTransform,
UpdateNodeThumbnail,

View File

@ -702,7 +702,7 @@ impl EditorHandle {
self.dispatch(PortfolioMessage::ImaginatePollServerStatus);
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[wasm_bindgen(js_name = triggerUpgradeDocumentToVectorManipulationFormat)]
pub async fn upgrade_document_to_vector_manipulation_format(
&self,

View File

@ -501,7 +501,7 @@ fn modify_existing() {
}
// Do we want to enforce that all serialized/deserialized hashmaps are a vec of tuples?
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
use serde::de::{SeqAccess, Visitor};
use serde::ser::SerializeSeq;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

View File

@ -31,7 +31,7 @@ fn return_true() -> bool {
true
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
@ -40,7 +40,7 @@ enum NodeInputVersions {
NodeInput(NodeInput),
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub enum OldNodeInput {
@ -58,7 +58,7 @@ pub enum OldNodeInput {
Inline(InlineRust),
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[cfg(feature = "serde")]
fn deserialize_inputs<'de, D>(deserializer: D) -> Result<Vec<NodeInput>, D::Error>
where
@ -496,7 +496,7 @@ pub enum OldDocumentNodeImplementation {
/// This describes a (document) node implemented as a proto node.
///
/// A proto node identifier which can be found in `node_registry.rs`.
#[cfg_attr(feature = "serde", serde(alias = "Unresolved"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "Unresolved"))] // TODO: Eventually remove this alias document upgrade code
ProtoNode(ProtoNodeIdentifier),
/// The Extract variant is a tag which tells the compilation process to do something special. It invokes language-level functionality built for use by the ExtractNode to enable metaprogramming.
/// When the ExtractNode is compiled, it gets replaced by a value node containing a representation of the source code for the function/lambda of the document node that's fed into the ExtractNode
@ -531,7 +531,7 @@ pub enum DocumentNodeImplementation {
/// This describes a (document) node implemented as a proto node.
///
/// A proto node identifier which can be found in `node_registry.rs`.
#[cfg_attr(feature = "serde", serde(alias = "Unresolved"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "Unresolved"))] // TODO: Eventually remove this alias document upgrade code
ProtoNode(ProtoNodeIdentifier),
/// The Extract variant is a tag which tells the compilation process to do something special. It invokes language-level functionality built for use by the ExtractNode to enable metaprogramming.
/// When the ExtractNode is compiled, it gets replaced by a value node containing a representation of the source code for the function/lambda of the document node that's fed into the ExtractNode
@ -588,7 +588,7 @@ impl DocumentNodeImplementation {
}
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
@ -597,7 +597,7 @@ pub enum NodeExportVersions {
NodeInput(NodeInput),
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub struct NodeOutput {
@ -605,7 +605,7 @@ pub struct NodeOutput {
pub node_output_index: usize,
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[cfg(feature = "serde")]
fn deserialize_exports<'de, D>(deserializer: D) -> Result<Vec<NodeInput>, D::Error>
where
@ -681,7 +681,7 @@ pub struct OldDocumentNode {
pub original_location: OriginalLocation,
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Clone, Debug, PartialEq, Default, specta::Type, Hash, DynAny)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
/// Metadata about the node including its position in the graph UI
@ -689,7 +689,7 @@ pub struct OldDocumentNodeMetadata {
pub position: IVec2,
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
/// Root Node is the "default" export for a node network. Used by document metadata, displaying UI-only "Export" node, and for restoring the default preview node.
@ -698,7 +698,7 @@ pub struct OldRootNode {
pub output_index: usize,
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(PartialEq, Debug, Clone, Hash, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum OldPreviewing {
@ -709,14 +709,14 @@ pub enum OldPreviewing {
No,
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[derive(Clone, Debug, DynAny)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
/// A network (subgraph) of nodes containing each [`DocumentNode`] and its ID, as well as list mapping each export to its connected node, or a value if disconnected
pub struct OldNodeNetwork {
/// The list of data outputs that are exported from this network to the parent network.
/// Each export is a reference to a node within this network, paired with its output index, that is the source of the network's exported data.
#[cfg_attr(feature = "serde", serde(alias = "outputs", deserialize_with = "deserialize_exports"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "outputs", deserialize_with = "deserialize_exports"))] // TODO: Eventually remove this alias document upgrade code
pub exports: Vec<NodeInput>,
/// The list of all nodes in this network.
//cfg_attr(feature = "serde", #[cfg_attr(feature = "serde", serde(serialize_with = "graphene_core::vector::serialize_hashmap", deserialize_with = "graphene_core::vector::deserialize_hashmap")))]
@ -736,7 +736,7 @@ pub struct OldNodeNetwork {
pub scope_injections: HashMap<String, (NodeId, Type)>,
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
#[cfg(feature = "serde")]
fn migrate_layer_to_merge<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<String, D::Error> {
let mut s: String = serde::Deserialize::deserialize(deserializer)?;
@ -745,11 +745,11 @@ fn migrate_layer_to_merge<'de, D: serde::Deserializer<'de>>(deserializer: D) ->
}
Ok(s)
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
fn default_import_metadata() -> (NodeId, IVec2) {
(NodeId::new(), IVec2::new(-25, -4))
}
// TODO: Eventually remove this (probably starting late 2024)
// TODO: Eventually remove this document upgrade code
fn default_export_metadata() -> (NodeId, IVec2) {
(NodeId::new(), IVec2::new(8, -4))
}
@ -760,7 +760,7 @@ fn default_export_metadata() -> (NodeId, IVec2) {
pub struct NodeNetwork {
/// The list of data outputs that are exported from this network to the parent network.
/// Each export is a reference to a node within this network, paired with its output index, that is the source of the network's exported data.
#[cfg_attr(feature = "serde", serde(alias = "outputs", deserialize_with = "deserialize_exports"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "outputs", deserialize_with = "deserialize_exports"))] // TODO: Eventually remove this alias document upgrade code
pub exports: Vec<NodeInput>,
/// TODO: Instead of storing import types in each NodeInput::Network connection, the types are stored here. This is similar to how types need to be defined for parameters when creating a function in Rust.
// pub import_types: Vec<Type>,

View File

@ -118,7 +118,7 @@ tagged_value! {
String(String),
U32(u32),
U64(u64),
#[cfg_attr(feature = "serde", serde(alias = "F32"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "F32"))] // TODO: Eventually remove this alias document upgrade code
F64(f64),
OptionalF64(Option<f64>),
Bool(bool),
@ -141,7 +141,7 @@ tagged_value! {
Fill(graphene_core::vector::style::Fill),
Stroke(graphene_core::vector::style::Stroke),
F64Array4([f64; 4]),
#[cfg_attr(feature = "serde", serde(alias = "VecF32"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "VecF32"))] // TODO: Eventually remove this alias document upgrade code
VecF64(Vec<f64>),
VecU64(Vec<u64>),
NodePath(Vec<NodeId>),
@ -161,10 +161,10 @@ tagged_value! {
FillChoice(graphene_core::vector::style::FillChoice),
Gradient(graphene_core::vector::style::Gradient),
GradientType(graphene_core::vector::style::GradientType),
#[cfg_attr(feature = "serde", serde(alias = "GradientPositions"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "GradientPositions"))] // TODO: Eventually remove this alias document upgrade code
GradientStops(graphene_core::vector::style::GradientStops),
OptionalColor(Option<graphene_core::raster::color::Color>),
#[cfg_attr(feature = "serde", serde(alias = "ManipulatorGroupIds"))] // TODO: Eventually remove this alias (probably starting late 2024)
#[cfg_attr(feature = "serde", serde(alias = "ManipulatorGroupIds"))] // TODO: Eventually remove this alias document upgrade code
PointIds(Vec<graphene_core::vector::PointId>),
Font(graphene_core::text::Font),
BrushStrokes(Vec<graphene_core::vector::brush_stroke::BrushStroke>),