示例#1
0
        void OnPreprocessAsset()
        {
            ISpriteEditorDataProvider ai = GetSpriteEditorDataProvider(assetPath);

            if (ai != null)
            {
                var characterDataProvider = ai.GetDataProvider <ICharacterDataProvider>();
                var boneDataProvider      = ai.GetDataProvider <ISpriteBoneDataProvider>();
                var characterData         = characterDataProvider?.GetCharacterData();

                if (characterData.HasValue && characterData.Value.boneReadOnly && boneDataProvider != null)
                {
                    var skinningCache = Cache.Create <SkinningCache>();
                    skinningCache.Create(ai, new SkinningCachePersistentStateTemp());
                    SkinningModule.ApplyChanges(skinningCache, ai);
                    ai.Apply();
                }
            }
        }
        void OnPreprocessAsset()
        {
            var ai = GetSpriteEditorDataProvider(assetPath);
            var characterDataProvider = ai?.GetDataProvider <ICharacterDataProvider>();

            if (characterDataProvider != null)
            {
                var mainSkeletonBonesDataProvider = ai?.GetDataProvider <IMainSkeletonDataProvider>();
                if (mainSkeletonBonesDataProvider != null)
                {
                    var skinningCache = Cache.Create <SkinningCache>();
                    skinningCache.Create(ai, new SkinningCachePersistentStateTemp());

                    var skeletonBones = mainSkeletonBonesDataProvider.GetMainSkeletonData().bones ?? new SpriteBone[0];
                    RemapCharacterPartsToNewBones(skinningCache, skeletonBones);

                    SkinningModule.ApplyChanges(skinningCache, ai);
                }
            }
        }