Experimental animation support (#2443)

* Implement experimental time routing to the node graph

* Allow toggling live preview with SHIFT + SPACE

* Add animation message handler

* Fix hotkeys

* Fix milisecond node

* Adevertize set frame index action

* Fix frame index

* Fix year calculation

* Add comment for why month and day are not exposed

* Combine animation nodes and fix animation time implementation

* Fix animation time interaction with playback

* Add set animation time mode message

* Captalize UTC

* Fix compiling

* Fix crash and add text nodes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Dennis Kobert
2025-03-19 09:19:49 +01:00
committed by GitHub
parent b98711dbdb
commit 44694ff8d6
31 changed files with 428 additions and 62 deletions

View File

@@ -3,6 +3,8 @@ use crate::vector::{HandleId, VectorData, VectorDataTable};
use bezier_rs::Subpath;
use glam::DVec2;
use super::misc::AsU64;
trait CornerRadius {
fn generate(self, size: DVec2, clamped: bool) -> VectorDataTable;
}
@@ -70,30 +72,32 @@ fn rectangle<T: CornerRadius>(
}
#[node_macro::node(category("Vector: Shape"))]
fn regular_polygon(
fn regular_polygon<T: AsU64>(
_: impl Ctx,
_primary: (),
#[default(6)]
#[min(3.)]
sides: u32,
#[implementations(u32, u64, f64)]
sides: T,
#[default(50)] radius: f64,
) -> VectorDataTable {
let points = sides.into();
let points = sides.as_u64();
let radius: f64 = radius * 2.;
VectorDataTable::new(VectorData::from_subpath(Subpath::new_regular_polygon(DVec2::splat(-radius), points, radius)))
}
#[node_macro::node(category("Vector: Shape"))]
fn star(
fn star<T: AsU64>(
_: impl Ctx,
_primary: (),
#[default(5)]
#[min(2.)]
sides: u32,
#[implementations(u32, u64, f64)]
sides: T,
#[default(50)] radius: f64,
#[default(25)] inner_radius: f64,
) -> VectorDataTable {
let points = sides.into();
let points = sides.as_u64();
let diameter: f64 = radius * 2.;
let inner_diameter = inner_radius * 2.;

View File

@@ -47,3 +47,41 @@ impl core::fmt::Display for BooleanOperation {
}
}
}
pub trait AsU64 {
fn as_u64(&self) -> u64;
}
impl AsU64 for u32 {
fn as_u64(&self) -> u64 {
*self as u64
}
}
impl AsU64 for u64 {
fn as_u64(&self) -> u64 {
*self
}
}
impl AsU64 for f64 {
fn as_u64(&self) -> u64 {
*self as u64
}
}
pub trait AsI64 {
fn as_i64(&self) -> i64;
}
impl AsI64 for u32 {
fn as_i64(&self) -> i64 {
*self as i64
}
}
impl AsI64 for u64 {
fn as_i64(&self) -> i64 {
*self as i64
}
}
impl AsI64 for f64 {
fn as_i64(&self) -> i64 {
*self as i64
}
}