Allow any kind of Mesh to be added to an EditorSpatialGizmo
This commit is contained in:
parent
144e3cd31f
commit
e0729b9c79
|
@ -46,7 +46,7 @@
|
||||||
</method>
|
</method>
|
||||||
<method name="add_mesh">
|
<method name="add_mesh">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<argument index="0" name="mesh" type="ArrayMesh" />
|
<argument index="0" name="mesh" type="Mesh" />
|
||||||
<argument index="1" name="billboard" type="bool" default="false" />
|
<argument index="1" name="billboard" type="bool" default="false" />
|
||||||
<argument index="2" name="skeleton" type="SkinReference" default="null" />
|
<argument index="2" name="skeleton" type="SkinReference" default="null" />
|
||||||
<argument index="3" name="material" type="Material" default="null" />
|
<argument index="3" name="material" type="Material" default="null" />
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
struct Instance {
|
struct Instance {
|
||||||
RID instance;
|
RID instance;
|
||||||
Ref<ArrayMesh> mesh;
|
Ref<Mesh> mesh;
|
||||||
Ref<Material> material;
|
Ref<Material> material;
|
||||||
Ref<SkinReference> skin_reference;
|
Ref<SkinReference> skin_reference;
|
||||||
RID skeleton;
|
RID skeleton;
|
||||||
|
@ -103,7 +103,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
void add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard = false, const Color &p_modulate = Color(1, 1, 1));
|
void add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard = false, const Color &p_modulate = Color(1, 1, 1));
|
||||||
void add_vertices(const Vector<Vector3> &p_vertices, const Ref<Material> &p_material, Mesh::PrimitiveType p_primitive_type, bool p_billboard = false, const Color &p_modulate = Color(1, 1, 1));
|
void add_vertices(const Vector<Vector3> &p_vertices, const Ref<Material> &p_material, Mesh::PrimitiveType p_primitive_type, bool p_billboard = false, const Color &p_modulate = Color(1, 1, 1));
|
||||||
void add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard = false, const Ref<SkinReference> &p_skin_reference = Ref<SkinReference>(), const Ref<Material> &p_material = Ref<Material>());
|
void add_mesh(const Ref<Mesh> &p_mesh, bool p_billboard = false, const Ref<SkinReference> &p_skin_reference = Ref<SkinReference>(), const Ref<Material> &p_material = Ref<Material>());
|
||||||
void add_collision_segments(const Vector<Vector3> &p_lines);
|
void add_collision_segments(const Vector<Vector3> &p_lines);
|
||||||
void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh);
|
void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh);
|
||||||
void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1, const Color &p_modulate = Color(1, 1, 1));
|
void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1, const Color &p_modulate = Color(1, 1, 1));
|
||||||
|
|
|
@ -179,8 +179,10 @@ void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base, bool p_hidde
|
||||||
VS::get_singleton()->instance_set_layer_mask(instance, layer); //gizmos are 26
|
VS::get_singleton()->instance_set_layer_mask(instance, layer); //gizmos are 26
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSpatialGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard, const Ref<SkinReference> &p_skin_reference, const Ref<Material> &p_material) {
|
void EditorSpatialGizmo::add_mesh(const Ref<Mesh> &p_mesh, bool p_billboard, const Ref<SkinReference> &p_skin_reference, const Ref<Material> &p_material) {
|
||||||
ERR_FAIL_COND(!spatial_node);
|
ERR_FAIL_COND(!spatial_node);
|
||||||
|
ERR_FAIL_COND_MSG(!p_mesh.is_valid(), "EditorSpatialGizmo.add_mesh() requires a valid Mesh resource.");
|
||||||
|
|
||||||
Instance ins;
|
Instance ins;
|
||||||
|
|
||||||
ins.billboard = p_billboard;
|
ins.billboard = p_billboard;
|
||||||
|
|
Loading…
Reference in New Issue