Files
materialcraft/crates/core/src/resource.rs
T
chasse20 d318484b41 Checkpoint native SBS primitive workflow
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.
2026-11-05 18:23:06 -05:00

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 }
}
}