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

It takes an Object, not an Instance

For example, use Content.fromObject(EditableImage) to generate a Content from an EditableImage

Most APIs haven’t been updated yet to use Content and still rely on asset IDs.

1 Like

Odd, it’s showing Instance in the script editor (and yelling at me for not giving it one) so it must be an inconsistency between the editor and docs?


I assume this will be fixed soon, here’s hoping for the best.

3 Likes

If any staff in charge of the update is here, Please give me an answer.

1 Like

My apologies. I investigated my mesh, vertex-by-vertex and though I thought they were all the same Y, some pesky vertices were not. Once I corrected that, the mesh came out perfectly. Apologies for the false report.

2 Likes

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?

1 Like

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)




edit: fixed some math!!


11 Likes

Nice new update

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

1 Like

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.

1 Like

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:

3 Likes