generated from vrchat-community/template-package
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fc8c66
commit e7ef0ae
Showing
13 changed files
with
566 additions
and
204 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
Packages/com.happyrobot33.atlasgenerator/Editor/Atlas Generator.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "com.happyrobot33.editorgames.atlasgenerator", | ||
"rootNamespace": "", | ||
"references": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
Packages/com.happyrobot33.atlasgenerator/Editor/Atlas Generator.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
Packages/com.happyrobot33.atlasgenerator/Editor/AtlasGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
using UnityEditor; | ||
|
||
namespace HappysTools.AtlasGenerator | ||
{ | ||
class AtlasGenerator : AssetPostprocessor | ||
{ | ||
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths, bool didDomainReload) | ||
{ | ||
//gather up all changed textures | ||
List<Texture2D> changedTextures = new List<Texture2D>(); | ||
foreach (string assetPath in importedAssets) | ||
{ | ||
//load the asset | ||
Object asset = AssetDatabase.LoadAssetAtPath<Object>(assetPath); | ||
|
||
//check if the asset is a texture | ||
if (asset is Texture2D) | ||
{ | ||
//add the texture to the list | ||
changedTextures.Add((Texture2D)asset); | ||
} | ||
} | ||
|
||
//if none, return | ||
if (changedTextures.Count == 0) | ||
{ | ||
return; | ||
} | ||
|
||
List<AtlasInformation> atlasInformationList = AtlasInformation.GetAllAssociatedAtlas(changedTextures.ToArray()); | ||
//rebuild them | ||
foreach (AtlasInformation atlasInformation in atlasInformationList) | ||
{ | ||
atlasInformation.Rebuild(); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/com.happyrobot33.atlasgenerator/Editor/AtlasGenerator.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.