Skip to content

Commit c2815ea

Browse files
committed
fix animation
1 parent 04ff7b7 commit c2815ea

30 files changed

+258
-386
lines changed

editor/src/dispatcher.rs

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub struct Dispatcher {
1616

1717
#[derive(Debug, Default)]
1818
pub struct DispatcherMessageHandlers {
19-
animation_message_handler: AnimationMessageHandler,
2019
broadcast_message_handler: BroadcastMessageHandler,
2120
debug_message_handler: DebugMessageHandler,
2221
dialog_message_handler: DialogMessageHandler,
@@ -59,7 +58,7 @@ const SIDE_EFFECT_FREE_MESSAGES: &[MessageDiscriminant] = &[
5958
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::UpdateDocumentLayerStructure),
6059
MessageDiscriminant::Frontend(FrontendMessageDiscriminant::TriggerFontLoad),
6160
];
62-
const DEBUG_MESSAGE_BLOCK_LIST: &[MessageDiscriminant] = &[MessageDiscriminant::Broadcast(BroadcastMessageDiscriminant::TriggerEvent(BroadcastEventDiscriminant::AnimationFrame))];
61+
const DEBUG_MESSAGE_BLOCK_LIST: &[MessageDiscriminant] = &[MessageDiscriminant::InputPreprocessor(InputPreprocessorMessageDiscriminant::CurrentTime)];
6362
// TODO: Find a way to combine these with the list above. We use strings for now since these are the standard variant names used by multiple messages. But having these also type-checked would be best.
6463
const DEBUG_MESSAGE_ENDING_BLOCK_LIST: &[&str] = &["PointerMove", "PointerOutsideViewport", "Overlays", "Draw", "CurrentTime", "Time"];
6564

@@ -163,27 +162,6 @@ impl Dispatcher {
163162
let clear_message = PortfolioMessage::ClearIntrospectedData.into();
164163
Self::schedule_execution(&mut self.message_queues, true, [clear_message]);
165164
}
166-
Message::NoOp => {}
167-
Message::Init => {
168-
// Load persistent data from the browser database
169-
queue.add(FrontendMessage::TriggerLoadFirstAutoSaveDocument);
170-
queue.add(FrontendMessage::TriggerLoadPreferences);
171-
172-
// Display the menu bar at the top of the window
173-
queue.add(MenuBarMessage::SendLayout);
174-
175-
// Send the information for tooltips and categories for each node/input.
176-
queue.add(FrontendMessage::SendUIMetadata {
177-
node_descriptions: document_node_definitions::collect_node_descriptions(),
178-
node_types: document_node_definitions::collect_node_types(),
179-
});
180-
181-
// Finish loading persistent data from the browser database
182-
queue.add(FrontendMessage::TriggerLoadRestAutoSaveDocuments);
183-
}
184-
Message::Animation(message) => {
185-
self.message_handlers.animation_message_handler.process_message(message, &mut queue, ());
186-
}
187165
Message::Broadcast(message) => self.message_handlers.broadcast_message_handler.process_message(message, &mut queue, ()),
188166
Message::Debug(message) => {
189167
self.message_handlers.debug_message_handler.process_message(message, &mut queue, ());
@@ -238,8 +216,6 @@ impl Dispatcher {
238216
let current_tool = &self.message_handlers.tool_message_handler.tool_state.tool_data.active_tool_type;
239217
let message_logging_verbosity = self.message_handlers.debug_message_handler.message_logging_verbosity;
240218
let reset_node_definitions_on_open = self.message_handlers.portfolio_message_handler.reset_node_definitions_on_open;
241-
let timing_information = self.message_handlers.animation_message_handler.timing_information();
242-
let animation = &self.message_handlers.animation_message_handler;
243219

244220
self.message_handlers.portfolio_message_handler.process_message(
245221
message,
@@ -250,8 +226,6 @@ impl Dispatcher {
250226
current_tool,
251227
message_logging_verbosity,
252228
reset_node_definitions_on_open,
253-
timing_information,
254-
animation,
255229
},
256230
);
257231
}
@@ -283,37 +257,6 @@ impl Dispatcher {
283257
Message::Batched { messages } => {
284258
messages.iter().for_each(|message| self.handle_message(message.to_owned(), false));
285259
}
286-
Message::StartBuffer => {
287-
self.buffered_queue = Some(std::mem::take(&mut self.message_queues));
288-
}
289-
Message::EndBuffer { render_metadata } => {
290-
// Assign the message queue to the currently buffered queue
291-
if let Some(buffered_queue) = self.buffered_queue.take() {
292-
self.cleanup_queues(false);
293-
assert!(self.message_queues.is_empty(), "message queues are always empty when ending a buffer");
294-
self.message_queues = buffered_queue;
295-
};
296-
297-
let graphene_std::renderer::RenderMetadata {
298-
upstream_footprints: footprints,
299-
local_transforms,
300-
first_instance_source_id,
301-
click_targets,
302-
clip_targets,
303-
} = render_metadata;
304-
305-
// Run these update state messages immediately
306-
let messages = [
307-
DocumentMessage::UpdateUpstreamTransforms {
308-
upstream_footprints: footprints,
309-
local_transforms,
310-
first_instance_source_id,
311-
},
312-
DocumentMessage::UpdateClickTargets { click_targets },
313-
DocumentMessage::UpdateClipTargets { clip_targets },
314-
];
315-
Self::schedule_execution(&mut self.message_queues, false, messages.map(Message::from));
316-
}
317260
}
318261

319262
// If there are child messages, append the queue to the list of queues
@@ -329,7 +272,6 @@ impl Dispatcher {
329272
// TODO: Reduce the number of heap allocations
330273
let mut list = Vec::new();
331274
list.extend(self.message_handlers.dialog_message_handler.actions());
332-
list.extend(self.message_handlers.animation_message_handler.actions());
333275
list.extend(self.message_handlers.input_preprocessor_message_handler.actions());
334276
list.extend(self.message_handlers.key_mapping_message_handler.actions());
335277
list.extend(self.message_handlers.debug_message_handler.actions());

editor/src/messages/animation/animation_message.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

editor/src/messages/animation/animation_message_handler.rs

Lines changed: 0 additions & 134 deletions
This file was deleted.

editor/src/messages/animation/mod.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

editor/src/messages/input_mapper/input_mappings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ pub fn input_mappings() -> Mapping {
437437
entry!(KeyDown(Digit1); modifiers=[Alt], action_dispatch=DebugMessage::MessageNames),
438438
entry!(KeyDown(Digit2); modifiers=[Alt], action_dispatch=DebugMessage::MessageContents),
439439
// AnimationMessage
440-
entry!(KeyDown(Space); modifiers=[Shift], action_dispatch=AnimationMessage::ToggleLivePreview),
441-
entry!(KeyDown(Home); modifiers=[Shift], action_dispatch=AnimationMessage::RestartAnimation),
440+
entry!(KeyDown(Space); modifiers=[Shift], action_dispatch=DocumentMessage::ToggleAnimation),
441+
entry!(KeyDown(Home); modifiers=[Shift], action_dispatch=DocumentMessage::RestartAnimation),
442442
];
443443
let (mut key_up, mut key_down, mut key_up_no_repeat, mut key_down_no_repeat, mut double_click, mut wheel_scroll, mut pointer_move) = mappings;
444444

editor/src/messages/input_preprocessor/input_preprocessor_message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ pub enum InputPreprocessorMessage {
1212
PointerDown { editor_mouse_state: EditorMouseState, modifier_keys: ModifierKeys },
1313
PointerMove { editor_mouse_state: EditorMouseState, modifier_keys: ModifierKeys },
1414
PointerUp { editor_mouse_state: EditorMouseState, modifier_keys: ModifierKeys },
15-
CurrentTime { timestamp: u64 },
15+
CurrentTime { timestamp: f64 },
1616
WheelScroll { editor_mouse_state: EditorMouseState, modifier_keys: ModifierKeys },
1717
}

editor/src/messages/input_preprocessor/input_preprocessor_message_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl MessageHandler<InputPreprocessorMessage, InputPreprocessorMessageContext> f
9797
self.translate_mouse_event(mouse_state, false, responses);
9898
}
9999
InputPreprocessorMessage::CurrentTime { timestamp } => {
100-
self.time = timestamp as f64;
100+
self.time = timestamp;
101101
}
102102
InputPreprocessorMessage::WheelScroll { editor_mouse_state, modifier_keys } => {
103103
self.update_states_of_modifier_keys(modifier_keys, keyboard_platform, responses);

editor/src/messages/message.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ use graphite_proc_macros::*;
44
#[impl_message]
55
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
66
pub enum Message {
7-
NoOp,
8-
Init,
9-
Batched(Box<[Message]>),
107
// Adds any subsequent messages to the queue
118
StartEvaluationQueue,
129
// Stop adding messages to the queue.
@@ -15,8 +12,6 @@ pub enum Message {
1512
#[serde(skip)]
1613
ProcessEvaluationQueue(graphene_std::renderer::RenderMetadata, IntrospectionResponse),
1714
#[child]
18-
Animation(AnimationMessage),
19-
#[child]
2015
Broadcast(BroadcastMessage),
2116
#[child]
2217
Debug(DebugMessage),
@@ -46,10 +41,6 @@ pub enum Message {
4641
Batched {
4742
messages: Box<[Message]>,
4843
},
49-
StartBuffer,
50-
EndBuffer {
51-
render_metadata: RenderMetadata,
52-
},
5344
}
5445

5546
/// Provides an impl of `specta::Type` for `MessageDiscriminant`, the struct created by `impl_message`.

editor/src/messages/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! The root-level messages forming the first layer of the message system architecture.
22
3-
pub mod animation;
43
pub mod broadcast;
54
pub mod debug;
65
pub mod dialog;

editor/src/messages/portfolio/document/document_message.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ pub enum DocumentMessage {
170170
RepeatedAbortTransaction {
171171
undo_count: usize,
172172
},
173+
ToggleAnimation,
174+
RestartAnimation,
173175
ToggleLayerExpansion {
174176
id: NodeId,
175177
recursive: bool,

0 commit comments

Comments
 (0)