Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary workaround for MeshPart.MeshId writes #390

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions patches/parts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Change:
formFactorRaw:
AliasFor: FormFactor

MeshPart:
# MeshPart.MeshId writes have to be deferred through InsertService:CreateMeshPartAsync
MeshId:
Scriptability: Custom

Part:
Shape:
Serialization:
Expand Down
16 changes: 16 additions & 0 deletions rbx_dom_lua/src/customProperties.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local InsertService = game:GetService("InsertService")
local CollectionService = game:GetService("CollectionService")
local ScriptEditorService = game:GetService("ScriptEditorService")

Expand Down Expand Up @@ -112,6 +113,21 @@ return {
end,
},
},
MeshPart = {
MeshId = {
read = function(instance, _, _)
return true, instance.MeshId
end,
write = function(instance, _, value)
task.spawn(function()
local mesh = InsertService:CreateMeshPartAsync(value, instance.CollisionFidelity, instance.RenderFidelity)
instance:ApplyMesh(mesh)
end)

return true
end,
},
},
Terrain = {
MaterialColors = {
read = function(instance: Terrain)
Expand Down