pite_core/nodes/
sprite2d.rs1use crate::schema::{DefaultPropVal, NodeTypeSchema, PropHint, PropSchema};
5
6pub static SCHEMA: NodeTypeSchema = NodeTypeSchema {
7 type_name: "Sprite2D",
8 description: "Displays a 2D texture or one frame from a spritesheet atlas.",
9 inherits: Some("Node2D"),
10 abstract_class: false,
11 props: PROPS,
12};
13
14pub static PROPS: &[PropSchema] = &[
15 PropSchema {
16 key: "texture",
17 label: "Texture",
18 doc: "Path to a png/jpg/webp image to draw. Mutually exclusive with `atlas`.",
19 default_value: DefaultPropVal::Str(""),
20 hint: PropHint::Asset {
21 filter: &["png", "jpg", "jpeg", "webp"],
22 },
23 read_only: false,
24 },
25 PropSchema {
26 key: "atlas",
27 label: "Atlas",
28 doc: "Path to a spritesheet sidecar (`.atlas.json`). Requires `frame`.",
29 default_value: DefaultPropVal::Str(""),
30 hint: PropHint::Asset {
31 filter: &["atlas.json", "json"],
32 },
33 read_only: false,
34 },
35 PropSchema {
36 key: "frame",
37 label: "Frame",
38 doc: "Named frame inside the atlas. Ignored without `atlas`.",
39 default_value: DefaultPropVal::Str(""),
40 hint: PropHint::Text,
41 read_only: false,
42 },
43];