Exemplo n.º 1
0
        /// <summary>
        /// Pop a dialog to save the primitive's mesh as a unity asset
        /// </summary>
        private void ExportMesh()
        {
            var table = ItemAuthoring.GetComponentInParent <TableAuthoring>();

            if (table != null)
            {
                var rog = Item.GetRenderObjects(table.Table, Origin.Original, false);
                if (rog != null && rog.RenderObjects.Length > 0)
                {
                    var unityMesh = rog.RenderObjects[0].Mesh?.ToUnityMesh(Item.Name);
                    if (unityMesh != null)
                    {
                        string savePath = EditorUtility.SaveFilePanelInProject("Export Mesh", Item.Name, "asset", "Export Mesh");
                        AssetDatabase.CreateAsset(unityMesh, savePath);
                    }
                }
            }
        }
Exemplo n.º 2
0
 protected override void FinishEdit(string label, bool dirtyMesh = true)
 {
     base.FinishEdit(label, dirtyMesh);
     ItemAuthoring.UpdatePosition();
 }