Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RON Map support #179

Open
MickHarrigan opened this issue Jan 11, 2024 · 2 comments
Open

RON Map support #179

MickHarrigan opened this issue Jan 11, 2024 · 2 comments

Comments

@MickHarrigan
Copy link

MickHarrigan commented Jan 11, 2024

I am looking to implement this:

({
	"icons": Map {
		"a" : Image (
			path: "a.png"
		),
		"b" : Image (
			path: "b.png"
		),
		"c" : Image (
			path: "c.png"
		),
	},
	"meshes": Map {
		"sphere": Sphere (
			radius: 0.75,
		),
		"square": Quad (
			size: (
				2.0,
				2.0
			)
		),
	},
})

Where I then am trying to create a dynamic asset out of this, with the backbone enum being:

/// Supported types of icons within the editor to be loaded in
#[derive(serde::Deserialize, Debug, Clone)]
enum EditorIconAssetType {
    /// PNG images for cameras, lights, and audio
    Image { path: String },
    /// Quad mesh for putting images onto
    Quad { size: Vec2 },
    /// Icosphere mesh to make an icon clickable
    Sphere { radius: f32 },

    // *This is the part that I am not sure about*
    /// Collection of multiple inner assets
    Map { items: HashMap<String, EditorIconAssetType> },
}

So my question on this is do I need to try and find a way to support the RON map type like this or is there another way?
I know that in the impl of DynamicAssetType there is a collection type that stores a vec of the data, so is there a clean way that this could be done?
I feel like this should either be a feature if it isn't already, but given a direction I wouldn't mind trying to hash it out.

@NiklasEi
Copy link
Owner

Maps in Ron would be

"icons": {
		"a" : Image (
			path: "a.png"
		),
		"b" : Image (
			path: "b.png"
		),
		"c" : Image (
			path: "c.png"
		),
	}

Without the "Map". But if that doesn't work I can try to extend the custom dynamic assets example and potentially fix it.

@MickHarrigan
Copy link
Author

Maps in Ron would be

"icons": {
		"a" : Image (
			path: "a.png"
		),
		"b" : Image (
			path: "b.png"
		),
		"c" : Image (
			path: "c.png"
		),
	}

Without the "Map". But if that doesn't work I can try to extend the custom dynamic assets example and potentially fix it.

I had that before and edited the comment to have the "Map" in it, my bad. I did try testing with just nothing there but end up getting an Expected Identifier error at the { after "icons"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants