Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportSettings support for Groups #40

Closed
hiroki-o opened this issue Nov 14, 2016 · 13 comments
Closed

ImportSettings support for Groups #40

hiroki-o opened this issue Nov 14, 2016 · 13 comments
Milestone

Comments

@hiroki-o
Copy link
Contributor

Original report by James Marr (Bitbucket: [James Marr](https://bitbucket.org/James Marr), ).


It would be extremely useful if the ImportSettings node was capable of accepting the output of a Group node, and could use the * wildcard to be filled in with the group name.

The primary use for this in our project would be for forcing images into sprite sheets according to how they were grouped by the Group node.

For example, imagine I have a folder Characters, with sub folders Hero, Enemy, Dog. I would like to have a Group node with the rule Characters/*/, which would group together the assets in each sub folder. I would then like to connect the output of that Group node to an ImportSettings node, which would set the sprite tag to the group name captured by *.

Without this enhanced functionality, our workflow is much more difficult. W would have to individually configure a node hierarchy for each Hero, Enemy, and Dog subfolder. Any changes we wanted to make to our pipeline, would have to be individually applied to each subfolder. Any new subfolders would have to meticulously duplicate one of the existing hierarchies.

@hiroki-o
Copy link
Contributor Author

hiroki-o commented Dec 9, 2016

Original comment by Sam Narain (Bitbucket: samnarain, GitHub: samnarain).


@Tyrannicus100BC those are indeed strong use cases, and I think they even should deserve their own "nodes", purely for visual aid. Can you help @homae out by sketching out an example graph of how these graphs should work in ideal circumstances?

@hiroki-o
Copy link
Contributor Author

Original comment by James Marr (Bitbucket: [James Marr](https://bitbucket.org/James Marr), ).


Sure, here is an attached image, proposing a new "Group Sprite Tag" node. This node would accept the output from a group node, and force sprite packing tags according to the group name.

I also showed what the current alternative is, where there are many individual loading/importer nodes for each sub folder. Graph.png

@hiroki-o
Copy link
Contributor Author

hiroki-o commented Jan 6, 2017

Original comment by Hiroki Omae (Bitbucket: [Hiroki Omae](https://bitbucket.org/Hiroki Omae), ).


I like to solve this issue somehow whether by

  • extending ABGT to let you create custom node to do anything with input/output
  • Somehow let ImportSetting to configure per Group.

My concern is there is not much configuration you want to modify per incomfing group name other than Packing Tag. So rather than extending ImportSettings, I could just add "Tag Sprite", or, let you extend ABGT so that you write such task quickly.

@hiroki-o
Copy link
Contributor Author

hiroki-o commented Jan 6, 2017

Original comment by Sam Narain (Bitbucket: samnarain, GitHub: samnarain).


I like to solve this issue somehow whether by - extending ABGT to let you create custom node to do anything with input/output - Somehow let ImportSetting to configure per Group.

That would a perfect start. This allows also some more flexibility in the tool.

So rather than extending ImportSettings, I could just add "Tag Sprite", or, let you extend ABGT so that you write such task quickly.

How about the ability of extending ABGT and have a Tag Sprite as an example which demonstrates how you can apply customization?

@hiroki-o
Copy link
Contributor Author

hiroki-o commented Jan 7, 2017

Original comment by Hiroki Omae (Bitbucket: [Hiroki Omae](https://bitbucket.org/Hiroki Omae), ).


Yes, Tag Sprite would be a good example to include.

@hiroki-o
Copy link
Contributor Author

Original comment by James Marr (Bitbucket: [James Marr](https://bitbucket.org/James Marr), ).


Thanks guys, this sounds like a great solution for my use case. Can't wait for 1.2!

@hiroki-o
Copy link
Contributor Author

hiroki-o commented Feb 6, 2017

Original comment by Hiroki Omae (Bitbucket: [Hiroki Omae](https://bitbucket.org/Hiroki Omae), ).


Hi, I have been working on this a while for 1.2, and here is some quick progress.

C3-NGazUcAAC593.jpg

You will be able to extend ABGT and define your node - pass assets around.

@hiroki-o
Copy link
Contributor Author

Original comment by Hiroki Omae (Bitbucket: [Hiroki Omae](https://bitbucket.org/Hiroki Omae), ).


Here is an SpriteTag by group implemented with custom node in dev branch.

SpriteTag.cs (Custom Node example)
https://gist.github.com/hiroki-o/c726f6f31c40073f8a7baa74d75238bc

ss.png

After done all this, I am starting to think that SpriteTag should be part of ImportSetting. You've got the flexibility already, but I will consider adding "Packing Tag configuration by group" to be part of ImportSetting.

@hiroki-o
Copy link
Contributor Author

Original comment by Hiroki Omae (Bitbucket: [Hiroki Omae](https://bitbucket.org/Hiroki Omae), ).


importsetting.png

Implemented Sprite Packing Tag configuration in ImportSetting (landed to dev branch). This should do the Group Sprite Tag requested in this issue.

@hiroki-o
Copy link
Contributor Author

Original comment by James Marr (Bitbucket: [James Marr](https://bitbucket.org/James Marr), ).


I'm really excited to check this out!

[I previously said I was getting compilation errors. It was user error and it is working as expected for me now]

@hiroki-o
Copy link
Contributor Author

Original comment by Hiroki Omae (Bitbucket: [Hiroki Omae](https://bitbucket.org/Hiroki Omae), ).


James, thank you for checking out. I hope it works as you expect :)
Let me know if you have any issues or feedbacks.

@hiroki-o
Copy link
Contributor Author

Original comment by James Marr (Bitbucket: [James Marr](https://bitbucket.org/James Marr), ).


This is working exactly as I had imagined. It's great! Thanks!

So to give you context, we have a shipping game which uses tons of asset bundles. We currently do all of our bundling and spritesheeting by hand and it's a pain. As a research project, I'm trying to use ABGT to radically simplify our process. My perspective is usually going to be "how can I automate what is currently a manual process using ABGT".

The next thing I'm realizing, is that when we do sprite sheet assignment, we put things on to different spritesheets based on whether they have an alpha channel. This is because if we don't put them onto different named spritesheets, then Unity automatically appends a "(0)" or "(1)", which looks a lot like a mismatch of other import settings that should be fixed (like mip maps, or sprite vs texture). We'll have a single folder that has a mix of assets with and without alpha channels. We usually append "-Transparent" vs "-Opaque" to our spritesheet names based on whether they have an alpha channel. That way, if we ever see a "(0)", we know we have a mismatch on some other import setting that we should fix.

In ABGT, the Filter node allows me to select just TextureImporters, but I can't filter further filter them based on those import settings. What would be your recommendation for filtering out images with or without an alpha channel?

(Here is what my text project sprite sheets currently look like. BG's and Frame's have a mix of alpha and opaque textures: Screen Shot 2017-02-17 at 4.51.06 PM.png

@hiroki-o
Copy link
Contributor Author

Original comment by Hiroki Omae (Bitbucket: [Hiroki Omae](https://bitbucket.org/Hiroki Omae), ).


James, thank you for the additional context.
In 1.2 I have extended Filter node so that you can write your own custom filter condition. With custom filter you can write filter by texture's alpha channel configuration.

I have wrote a quick example Filter to do this and here is a quick example screenshot.

customfilter.png

You can just drop this file in your project and it should just work. (don't forget to grab newest ABGT! ;) )

https://gist.github.com/hiroki-o/6574e93836d298ec79a07d92a18a120c

Please let me know if this solves your issue.

@hiroki-o hiroki-o added this to the 1.2 milestone Mar 3, 2020
zxsean pushed a commit to zxsean/AssetGraph that referenced this issue May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant