Remove copy and use instance material override in gizmos, fixes #23783
This commit is contained in:
parent
6cd4006fb3
commit
bfa9be85d3
@ -60,6 +60,7 @@ public:
|
||||
|
||||
RID instance;
|
||||
Ref<ArrayMesh> mesh;
|
||||
Ref<Material> material;
|
||||
RID skeleton;
|
||||
bool billboard;
|
||||
bool unscaled;
|
||||
@ -103,7 +104,7 @@ protected:
|
||||
|
||||
public:
|
||||
void add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard = false);
|
||||
void add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard = false, const RID &p_skeleton = RID());
|
||||
void add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard = false, const RID &p_skeleton = RID(), const Ref<Material> &p_material = Ref<Material>());
|
||||
void add_collision_segments(const Vector<Vector3> &p_lines);
|
||||
void add_collision_triangles(const Ref<TriangleMesh> &p_tmesh);
|
||||
void add_unscaled_billboard(const Ref<Material> &p_material, float p_scale = 1);
|
||||
|
@ -179,7 +179,7 @@ void EditorSpatialGizmo::Instance::create_instance(Spatial *p_base, bool p_hidde
|
||||
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 RID &p_skeleton) {
|
||||
void EditorSpatialGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard, const RID &p_skeleton, const Ref<Material> &p_material) {
|
||||
|
||||
ERR_FAIL_COND(!spatial_node);
|
||||
Instance ins;
|
||||
@ -187,9 +187,13 @@ void EditorSpatialGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard
|
||||
ins.billboard = p_billboard;
|
||||
ins.mesh = p_mesh;
|
||||
ins.skeleton = p_skeleton;
|
||||
ins.material = p_material;
|
||||
if (valid) {
|
||||
ins.create_instance(spatial_node, hidden);
|
||||
VS::get_singleton()->instance_set_transform(ins.instance, spatial_node->get_global_transform());
|
||||
if (ins.material.is_valid()) {
|
||||
VS::get_singleton()->instance_geometry_set_material_override(ins.instance, p_material->get_rid());
|
||||
}
|
||||
}
|
||||
|
||||
instances.push_back(ins);
|
||||
@ -3519,9 +3523,8 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
|
||||
if (Object::cast_to<ConcavePolygonShape>(*s)) {
|
||||
|
||||
Ref<ConcavePolygonShape> cs2 = s;
|
||||
Ref<ArrayMesh> mesh = cs2->get_debug_mesh()->duplicate();
|
||||
mesh->surface_set_material(0, material);
|
||||
p_gizmo->add_mesh(mesh);
|
||||
Ref<ArrayMesh> mesh = cs2->get_debug_mesh();
|
||||
p_gizmo->add_mesh(mesh, false, RID(), material);
|
||||
}
|
||||
|
||||
if (Object::cast_to<RayShape>(*s)) {
|
||||
|
@ -107,6 +107,9 @@ void PathFollow::_update_transform() {
|
||||
}
|
||||
|
||||
float bl = c->get_baked_length();
|
||||
if (bl == 0.0) {
|
||||
return;
|
||||
}
|
||||
float bi = c->get_bake_interval();
|
||||
float o = offset;
|
||||
float o_next = offset + bi;
|
||||
|
Loading…
Reference in New Issue
Block a user