예제 #1
0
        /// <inheritdoc/>
        public override void GetAnimationDuration(UFile localPath, Logger logger, AssetImporterParameters importParameters, out TimeSpan startTime, out TimeSpan endTime)
        {
            var meshConverter = new Importer.Assimp.MeshConverter(logger);
            var sceneData     = meshConverter.ConvertAnimation(localPath.FullPath, "");

            startTime = CompressedTimeSpan.MaxValue; // This will go down, so we start from positive infinity
            endTime   = CompressedTimeSpan.MinValue; // This will go up, so we start from negative infinity

            foreach (var animationClip in sceneData.AnimationClips)
            {
                foreach (var animationCurve in animationClip.Value.Curves)
                {
                    foreach (var compressedTimeSpan in animationCurve.Keys)
                    {
                        if (compressedTimeSpan < startTime)
                        {
                            startTime = compressedTimeSpan;
                        }
                        if (compressedTimeSpan > endTime)
                        {
                            endTime = compressedTimeSpan;
                        }
                    }
                }
            }

            if (startTime == CompressedTimeSpan.MaxValue)
            {
                startTime = CompressedTimeSpan.Zero;
            }
            if (endTime == CompressedTimeSpan.MinValue)
            {
                endTime = CompressedTimeSpan.Zero;
            }
        }
예제 #2
0
        /// <inheritdoc/>
        public override EntityInfo GetEntityInfo(UFile localPath, Logger logger, AssetImporterParameters importParameters)
        {
            var meshConverter = new Importer.Assimp.MeshConverter(logger);

            if (!importParameters.InputParameters.TryGet(DeduplicateMaterialsKey, out var deduplicateMaterials))
            {
                deduplicateMaterials = true;    // Dedupe is the default value
            }
            var entityInfo = meshConverter.ExtractEntity(localPath.FullPath, null, importParameters.IsTypeSelectedForOutput(typeof(TextureAsset)), deduplicateMaterials);

            return(entityInfo);
        }