mirror of
https://github.com/storytold/materialcraft.git
synced 2026-11-29 01:23:53 +01:00
Replace the legacy Rust procedural library with clean-room native primitives, typed function execution and FX-Map graphs. Save supported content as native SBS and organize the model, evaluators, codecs and editors into focused modules. Add shared graph editing behavior, flat filtered node menus, frame and comment editing, named Explorer outputs and an original atomic sample. Document the tested scope and remaining interoperability work.
22 lines
749 B
Rust
22 lines
749 B
Rust
use crate::ResourceBytes;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// An embedded file: a bitmap a Bitmap node shows, or an SVG
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
|
pub struct Resource {
|
|
/// Unique name, referenced by nodes (`resource` parameter)
|
|
pub name: String,
|
|
/// File name inside the package's `resources/` folder
|
|
pub file: String,
|
|
/// The file's bytes (stored in the zip, not in `package.json`)
|
|
#[serde(skip)]
|
|
pub bytes: ResourceBytes,
|
|
}
|
|
|
|
impl Resource {
|
|
/// A resource named `name`, stored as `file` in the package
|
|
pub fn new(name: impl Into<String>, file: impl Into<String>, bytes: ResourceBytes) -> Resource {
|
|
Resource { name: name.into(), file: file.into(), bytes }
|
|
}
|
|
}
|