Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

API access to PolybrushMesh

Discussion in 'World Building' started by deekpyro, Jul 20, 2020.

  1. deekpyro

    deekpyro

    Joined:
    Oct 16, 2012
    Posts:
    60
    Hey all -

    I've been pleased lately to be using Polybrush to paint vertex colors and do some mesh editing nicely in Unity. After doing mesh adjustments lots of objects in our scene have PolybrushMesh components on them and I've written an editor script to clean things up. It finds PolybrushMesh components in the scene, saves out just the mesh data we require, and removes the PolybrushMesh components. This way I can efficiently trim duplicated data (using Additional Vertex Stream with Polybrush appears to duplicate all the mesh data) and store it in ways optimal for our game.

    But wait - I can't actually do that as PolybrushMesh is a class marked as internal....(⊙_◎)

    Is there no way to interact with PolybrushMesh scripts in my scene? Is there a different workflow I'm supposed to use in order to accomplish what I set out above?
     
  2. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    359
    Polybrush does not have a public API. However if you are planning to modify there is a nice feature in Package Manager that allows you to embed packages in your project so that they may be edited.
     
  3. deekpyro

    deekpyro

    Joined:
    Oct 16, 2012
    Posts:
    60
    Thanks kaarrrllll. So there's no way to automate what I mention above without a public API? Are there plans to make the API public?
     
  4. kaarrrllll

    kaarrrllll

    Unity Technologies

    Joined:
    Aug 24, 2017
    Posts:
    359
    Actually yes, you don't really need to access the PolybrushMesh component to modify the vertex streams. You can access that mesh through MeshRenderer.additionalVertexStreams.

    On another note, if Polybrush is storing anything other than vertex positions + modified attributes, that sounds like a bug to me.
     
  5. deekpyro

    deekpyro

    Joined:
    Oct 16, 2012
    Posts:
    60
    Right, I do access the mesh data through the MeshRenderer but I first need to find all objects in the scene that have PolybrushMesh (which is a class I can't reference) components on them in order to process the data and remove the component.

    When I read the additional vertex streams I get the full mesh data (vertices, uvs, triangles) when I only modified the vertex colors. That appears to be a full mesh copy.
     
unityunity