Пример #1
0
        static void ImportObjPositionsToJson()
        {
            var Filenames = GetSelectedObjFilenames();

            foreach (var Filename in Filenames)
            {
                try
                {
                    var Mesh = ImportFileToPointMesh(Filename);
                    AssetWriter.SaveAsset(Mesh);
                }
                catch (System.Exception e)
                {
                    Debug.LogError("Failed to convert " + Filename + "; " + e.Message);
                }
            }
        }
Пример #2
0
    void ShowInspector(AudioClip Clip)
    {
        var Preview = AssetPreview.GetAssetPreview(Clip);

        Left = GUILayout.HorizontalSlider(Left, 0, 1, GUILayout.ExpandWidth(true));
        Left = Mathf.Min(Left, Right);

        Right = GUILayout.HorizontalSlider(Right, 0, 1, GUILayout.ExpandWidth(true));
        Right = Mathf.Max(Left, Right);

        if (GUILayout.Button("Preview", GUILayout.ExpandWidth(false)))
        {
            var SubClip = MakeSubclip(Clip, Left * Clip.length, Right * Clip.length);
            PlayClip(SubClip, 0, false);
        }

        if (GUILayout.Button("Save As...", GUILayout.ExpandWidth(false)))
        {
            var SubClip = MakeSubclip(Clip, Left * Clip.length, Right * Clip.length);
            AssetWriter.SaveAsset(SubClip);
        }


        {
            GUIStyle style = new GUIStyle();
            style.fixedHeight = 100.0f;
            var Options   = new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) };
            var GroupRect = GUILayoutUtility.GetRect(new GUIContent(), style, Options);
            GUI.BeginGroup(GroupRect);
            GroupRect.x = 0;
            GroupRect.y = 0;
            EditorGUILayout.BeginVertical();
            GUI.DrawTextureWithTexCoords(GroupRect, Preview, new Rect(Left, 0, Right - Left, 1));
            EditorGUILayout.EndVertical();
            GUI.EndGroup();
        }
    }