void renderMeshComponent(any@ data) { Entity entity; data.retrieve(entity); if (!entity.hasMeshComponent()) return; MeshComponent meshComponent = entity.getMeshComponent(); if (meshComponent.hasMesh) { drawIcon("object3d", 32); } else { drawIcon("empty", 32); } dragDropTarget("MESH", any(meshComponent), setMeshComponentMesh); if (meshComponent.hasMesh) { sameline(); space(); sameline(); titleCenterY(meshComponent.getMesh(), 32); dragDropTarget("MESH", any(meshComponent), setMeshComponentMesh); } space(20, 20); if (button("Clear")) { meshComponent.clear(); } sameline(); space(10, 20); sameline(); if (meshComponent.hasMesh) { meshComponent.isActive = checkbox("Active", meshComponent.isActive); } else { checkboxDisabled("Active", meshComponent.isActive); } } void setMeshComponentMesh(any@ meshComponent_data, any@ mesh_data){ string mesh; mesh_data.retrieve(mesh); MeshComponent meshComponent; meshComponent_data.retrieve(meshComponent); meshComponent.setMesh(mesh); } void removeMeshComponent(any@ entity) { Entity ent; entity.retrieve(ent); if (menuItem("Remove")) { ent.removeMeshComponent(); } }