Blender model

(Ebinshabu) #1

how to import a blender model directly in rust using amethyst

1 Like
(Joël Lupien) #2

You will want to export the model to the gltf format from blender, and import it in amethyst using the gltf prefab format. Check the gltf example for more details :slight_smile:

(Ebinshabu) #3

->did you know what is mean by .ron file and how to create it
->is it possible to convert a blender model to .ron file

(Gray Olson) #4

.ron is the file extension for the Rusty Object Notation format ( It is sort of like JSON but for rust. You can’t “convert a blender model to a .ron file”, but you can export a blender model into the GLTF format, and then create a .ron file manually which references the GLTF model you exported from Blender and will then allow you to load it within Amethyst.

1 Like
(Ebinshabu) #5

is .ron is like xml

(Gray Olson) #6

Sort-of… yea it’s similar but has a different syntax

(doomy) #7

Someone correct me if I’m off the mark, but in Amethyst, ron files usually are describing metadata of some sort. So to expand on termhn’s example, whatever Blender exports needs an additional ron “metadata” file so that Amethyst knows how to use it.

Let’s say you have a simple Sprite Sheet in PNG format. As you can see, the image is split into a bunch of smaller images. However, the PNG format doesn’t tell us anything about how that image is divided. Hence, we need .ron “metadata” files to tell Amethyst where each sprite on the spritesheet is located, so we can use it in game.

This is a simplification, and ron is used beyond this purpose, but for getting started I think it’s a decent explanation.

To again expand on termhn’s response, ron and xml are actually pretty similar in purpose. If you’ve heard of yaml or json or even csv, they’re also similar. ron is just a way of representing data declaratively.

One big benefit to ron is that it was designed with Rust in mind, so it integrates easily to the language. For example, enum types are not found in languages like json, as json only really has strings, bools, and numbers (again, simplified). ron is also less verbose than XML, which makes human reading and editing much easier.

1 Like
(Ebinshabu) #8

so instead of xml can we use .ron for gui development

(Marco Alka) #9


instead of xml can we use .ron for gui development

yes, you can create “prefabs”, which contain your UI or part of it. From the examples here’s how a pause screen prefab in a .ron-file might be stored for Amethyst v0.10:

    transform: (
        id: "paused",
        anchor: Middle,
        x: 0.,
        y: 0.,
        width: 200.,
        height: 50.,
        transparent: true,
    text: (
        text: "Paused",
        font_size: 25.,
        color: (1., 1., 1., 1.),
        font: File("font/square.ttf", ("TTF", ())),
(doomy) #10

I will make a distinction here that HTML (and sometimes XML) can be the actual document that is read and from which a GUI is created. In .ron, you can get similar results, but the ron file is describing what needs to be constructed to run, and is not directly displayed from the file itself. In other words, that means you can’t simply open a ron GUI file and expect to see your GUI, you need to write some code to go along with it and tell Amethyst how it should be handled.

AFAIK, It’s a way of representing data, not a standard from which a GUI can be directly constructed (although that would be neat).