Re-prepare VisualServer if SoftBody mesh changed
This commit is contained in:
parent
3e2bb415a9
commit
ff27b994cd
|
@ -437,8 +437,9 @@ void SoftBody::_draw_soft_mesh() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!visual_server_handler.is_ready()) {
|
const RID mesh_rid = get_mesh()->get_rid();
|
||||||
visual_server_handler.prepare(get_mesh()->get_rid(), 0);
|
if (!visual_server_handler.is_ready(mesh_rid)) {
|
||||||
|
visual_server_handler.prepare(mesh_rid, 0);
|
||||||
|
|
||||||
/// Necessary in order to render the mesh correctly (Soft body nodes are in global space)
|
/// Necessary in order to render the mesh correctly (Soft body nodes are in global space)
|
||||||
simulation_started = true;
|
simulation_started = true;
|
||||||
|
|
|
@ -49,7 +49,7 @@ class SoftBodyVisualServerHandler {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SoftBodyVisualServerHandler();
|
SoftBodyVisualServerHandler();
|
||||||
bool is_ready() { return mesh.is_valid(); }
|
bool is_ready(RID p_mesh_rid) const { return mesh.is_valid() && mesh == p_mesh_rid; }
|
||||||
void prepare(RID p_mesh_rid, int p_surface);
|
void prepare(RID p_mesh_rid, int p_surface);
|
||||||
void clear();
|
void clear();
|
||||||
void open();
|
void open();
|
||||||
|
|
Loading…
Reference in New Issue