How to export plane object from Blender to Godot as quad?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Vasily Lobaskin
:warning: Old Version Published before Godot 3 was released.

I’m trying to get Quad in imported scene, but my Plane in Blender imports to Godot as mesh. How can I change it? Is it even possible? Thanks!

P.S. i’m trying to add dynamically created texture to plane from scene, it’s possible with quad object but i’m unable to do same with mesh. If you know how to bind texture to plane mesh, it would be useful too.

That how I bind the texture:

get_node("Quad").get_material_override().set_texture(FixedMaterial.PARAM_DIFFUSE, tex)
:bust_in_silhouette: Reply From: guppy42

Completely untested code, but if I read the documentation correct this should work;

var material=FixedMaterial.new()
material.set_texture(FixedMaterial.PARAM_DIFFUSE, tex)

get_node("Mesh").surface_set_material(0,material)

Rellevant documentation;

http://docs.godotengine.org/en/stable/classes/class_fixedmaterial.html#class-fixedmaterial-set-texture

the surface number should be 0 because you only have a quad in your mesh, if that fails
print get_surface_count() from the mesh and work your way through them :wink:

A little fix for your code, It should be

get_node("Mesh").get_mesh().surface_set_material(0,material)

And anyway that doesn’t work. Also i’m still waiting answer for main question. Maybe I should use some specific object or flag like here

Vasily Lobaskin | 2017-02-08 18:50

Ah sorry forgot about the first bit.

I’m fairly sure that godot will always import as a mesh regardless of the number of vertices.

Now you could use the blend4web exporter which exports to json and then import and parse that into a quad your self -but at that point it would be easier to just create it by hand.

guppy42 | 2017-02-08 19:22

One thing you should note tho is that sine the node “Mesh” is apparently a mesh instance;

The documentation for the get_mesh() function says;

Mesh get_mesh ( ) const

I’m still new to gdscript but I take that to mean it’s not a reference, so you would need to call set_mesh() with the copy you received for it to take effect

guppy42 | 2017-02-08 19:32