/// <summary>
        /// Retrieves import options for the mesh we're currently inspecting.
        /// </summary>
        /// <returns>Mesh import options object.</returns>
        private MeshImportOptions GetImportOptions()
        {
            MeshImportOptions output = null;

            LibraryEntry meshEntry = ProjectLibrary.GetEntry(InspectedResourcePath);

            if (meshEntry != null && meshEntry.Type == LibraryEntryType.File)
            {
                FileEntry meshFileEntry = (FileEntry)meshEntry;
                output = meshFileEntry.Options as MeshImportOptions;
            }

            if (output == null)
            {
                if (importOptions == null)
                {
                    output = new MeshImportOptions();
                }
                else
                {
                    output = importOptions;
                }
            }

            return(output);
        }
        /// <inheritdoc/>
        protected internal override InspectableState Refresh(bool force = false)
        {
            importOptions = GetImportOptions();
            reimportButton.Update();

            return(InspectableState.NotModified);
        }
        /// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            MeshImportOptions newImportOptions = GetImportOptions();


            importOptions = newImportOptions;

            return(InspectableState.NotModified);
        }
        /// <summary>
        /// Saves the animation curves and events stored in this object, into the associated animation clip resource.
        /// Relevant animation clip resource must already be created and exist in the project library.
        /// </summary>
        public void SaveToClip()
        {
            if (!isImported)
            {
                EditorAnimClipData editorAnimClipData;
                Apply(out editorAnimClipData);

                string resourcePath = ProjectLibrary.GetPath(clip);
                ProjectLibrary.Save(clip);

                ProjectLibrary.SetEditorData(resourcePath, editorAnimClipData);
            }
            else
            {
                string       resourcePath = ProjectLibrary.GetPath(clip);
                LibraryEntry entry        = ProjectLibrary.GetEntry(resourcePath);

                if (entry != null && entry.Type == LibraryEntryType.File)
                {
                    FileEntry         fileEntry         = (FileEntry)entry;
                    MeshImportOptions meshImportOptions = (MeshImportOptions)fileEntry.Options;

                    string clipName = PathEx.GetTail(resourcePath);

                    List <ImportedAnimationEvents> newEvents = new List <ImportedAnimationEvents>();
                    newEvents.AddRange(meshImportOptions.AnimationEvents);

                    bool isExisting = false;
                    for (int i = 0; i < newEvents.Count; i++)
                    {
                        if (newEvents[i].Name == clipName)
                        {
                            newEvents[i].Events = events;
                            isExisting          = true;
                            break;
                        }
                    }

                    if (!isExisting)
                    {
                        ImportedAnimationEvents newEntry = new ImportedAnimationEvents();
                        newEntry.Name   = clipName;
                        newEntry.Events = events;

                        newEvents.Add(newEntry);
                    }

                    meshImportOptions.AnimationEvents = newEvents.ToArray();

                    ProjectLibrary.Reimport(resourcePath, meshImportOptions, true);
                }
            }
        }
Exemple #5
0
        /// <inheritdoc/>
        protected internal override InspectableState Refresh()
        {
            MeshImportOptions newImportOptions = GetImportOptions();

            animSplitInfoField.Refresh();

            normalsField.Value           = newImportOptions.ImportNormals;
            tangentsField.Value          = newImportOptions.ImportTangents;
            skinField.Value              = newImportOptions.ImportSkin;
            blendShapesField.Value       = newImportOptions.ImportBlendShapes;
            animationField.Value         = newImportOptions.ImportAnimation;
            scaleField.Value             = newImportOptions.ImportScale;
            cpuCachedField.Value         = newImportOptions.CpuCached;
            collisionMeshTypeField.Value = (ulong)newImportOptions.CollisionMeshType;
            keyFrameReductionField.Value = newImportOptions.ReduceKeyFrames;
            rootMotionField.Value        = newImportOptions.ImportRootMotion;

            importOptions = newImportOptions;

            return(InspectableState.NotModified);
        }
 /// <inheritdoc/>
 protected internal override void Initialize()
 {
     importOptions = GetImportOptions();
     BuildGUI();
 }
Exemple #7
0
 private static extern void Internal_create(MeshImportOptions managedInstance);