[Studio Beta] Major updates to in-experience Mesh & Image APIs

I found the bug now sorry it was something else that gave the error

1 Like

Hello good. I don’t understand why this error occurs.

Code:

editable = assetservice:CreateEditableMeshAsync(Content.fromUri(leaves.MeshId))
if editable then
	leaves.MeshContent = Content.fromObject(editable)
end

Thanks for double checking, relieved to hear it’s working :slight_smile:

1 Like

You can only “get” MeshContent once a MeshPart has been created. It is not “settable” just like MeshId is not settable on a MeshPart. Notice how both the docs links for those properties say: Not Accessible Security and shows this help text in the docs:

Attempting to access this member in scripts causes an error. 
You might be able to access this member from Roblox Studio's property window.

Take a look at the Live Rendering an EditableMesh section of the original post for the right way to do this. Here is the snippet you probably need:

-- Create a new MeshPart instance linked to this EditableMesh Content
-- Note: EditableMesh:CreateMeshPartAsync will be replaced with
-- AssetService:CreateMeshPartAsync(Content, …) before public release
local newMeshPart = myEditableMesh:CreateMeshPartAsync(computeExtents(myEditableMesh))

-- Apply newMeshPart, which is now linked to the EditableMesh, onto myMeshPart
myMeshPart:ApplyMesh(newMeshPart)

-- Any changes to myEditableMesh will now live update on myMeshPart
local vertexId = myEditableMesh:GetVertices()[1]
myEditableMesh:SetPosition(vertexId, Vector3.one)

-- Calling these two lines again will recalculate collision and fluid geometry
-- with a snapshot of the current edits and update myMeshPart.
-- It is generally recommended to do this at the end of a conceptual edit operation.
-- Note: EditableMesh:CreateMeshPartAsync will be replaced with
-- AssetService:CreateMeshPartAsync(Content, …) before public release
local newMeshPart = myEditableMesh:CreateMeshPartAsync(computeExtents(myEditableMesh))
myMeshPart:ApplyMesh(newMeshPart)
2 Likes

Thanks for catching this! A fix will be going out soon for this.

2 Likes

Another question, is there a reason DrawTriangle is roblox script security for images, but the others are normal access?

i cant find the documentation for editablemesh:createmeshpartasync(). of course this is because it will be a replaced method, but in the meantime, what can i put in the parameters?

function EditableMesh:CreateMeshPartAsync(initialSize: Vector3, options: {}?): MeshPart

initialSize will assigned to the MeshSize of the created MeshPart. Usually you should pass the extents of the mesh. The AssetService replacement will probably not support this MeshSize override.

Same options table as AssetService:CreateMeshPartAsync.

The update to AssetService:CreateMeshPartAsync that adds support for EditableMesh should be available after the Studio update to version 649 this week.

The idea with initialSize was that if you were using this to update physics data on an existing MeshPart with ApplyMesh this argument would allow you to chose between the true mesh extents or temporarily override that with meshPart.MeshSize from the original part instead of the mesh’s actual extents, keeping a stable scale factor. This caused problems though, since it allows you to create “oversized” collision geometry that would unintentionally allow collision geometry larger than the max part size. For now, we’re removing that override.

1 Like

MMm… what my code is looking for is to make the leaves of my map move simulating the wind. Doing this for 40 meshes of 8k vertices, is it worth it?

Creating an Editable Mesh with the MeshContent of a MeshPart created from a different Editable Mesh causes an error, which should work without errors considering the MeshPart has been created and the MeshContent property should be retrievable. I mentioned this in a previous post I made and would like to follow up on that as it is a relevant issue for me.

1 Like

editableimages are so cool!! I just updated my old fragment shader test to support path tracing and it works really well! (1024x512)

4 Likes

Nice new update

Nvm all good now
Screenshot 2024-10-31 at 10.39.37 am

We will be adding TextureContent to Decal very soon. Thanks for flagging this.

For now, you might be able to work around this in your use case by using SurfaceGui + ImageLabel with size UDim2.fromScale(1, 1) instead of Decal.

Are there any plans for permissions to allow group members that have studio access?
Our group has members that uploaded decals to their accounts over the group inventory so trying to create an EditableImage with any of those id’s throws an error.

How would I upload my mesh to a group? the creation tab under a group says to do it in studio, but im having trouble to get it uploaded through studio? Im trying to upload it to the group to get the editable mesh working for a group game because of the new requirements. only saw 2 posts relating and one is unanswered while the other just had staff say they were submitting a report??? https://devforum.roblox.com/t/meshes-uploaded-through-studio-game-tab-to-a-group-game-will-upload-them-under-the-name-of-the-uploader/58987 Cannot Upload Meshes to a Group - #2 by Focia19

I aint sure if anyone got this problem too but i found a workaround for it, Im still not sure if its gonna be patched.

The solution is to create the editable mesh and meshpart, Then we need to add a random triangle to it, Because it needs to have at least 1 face or it will throw an error.

Now having the mesh created we can update it and it wont throw any errors about it being too big.

-- Add a random triangle with its 3 vertices so it wont throw an error because the mesh is empty

local editableMesh = assetService:CreateEditableMesh()
editableMesh:AddTriangle(editableMesh:AddVertex(vectorOne), editableMesh:AddVertex(vectorOne * 0), editableMesh:AddVertex(xAxis))

-- You can create the mesh now and create big meshes (+2048 studs)

local meshpart = editableMesh:CreateMeshPartAsync(vectorOne)
meshpart:ApplyMesh(meshpart)

Still, Im not sure if this is just an error but i hope this doesn’t get patched because i would like to keep distant views in my game with this meshes:

2 Likes

AssetService:CreateMeshPartAsync() Does not support DoubleSided.
DoubleSided Property in Meshpart is locked behind PluginSecurity.
That means, you still need to copy Meshpart with DoubleSided Property, as there’s no way to turn on DoubleSided property with server scripts.

i seem to have found 2 more bugs 1 being that making an editablemesh is taking 16ms no matter what


this happens for every editablemesh i make and changes my terrain generation from taking 3ms every frame to 16ms.

The other bug is when you stop playtesting on the same frame an editablemesh is made your studio crashes.

normal behaviour that doesn't crash because all meshes are constructed

crashes when i stop playtesting while an editablemesh is loading / being made the same frame

Just wanted to ping this post and point out that the developer hub entry for EditableImage is completely wrong, saying you need to use Instance.new() to create them and using the old paradigm.

Thanks for pointing this out, I will update this documentation.