Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: nah0y on December 21, 2012, 06:18:46 AM

Title: "Issue" with Atlas Maker
Post by: nah0y on December 21, 2012, 06:18:46 AM
The Atlas Maker works by selecting a sprite and it appears as "Add" or "Update" in the atlas maker.

But it also works when selecting a scene... so if we have an Atlas Maker window opened and click on a scene, well it scans everything in the scene and if you have a large scene it can take some time... maybe there's a way to prevent this ? Like ignore things if they're something different than textures, or at least a scene.
Title: Re: "Issue" with Atlas Maker
Post by: ArenMook on December 22, 2012, 04:00:02 AM
I'm sure there is if I dug deeper into it, but is it really worth digging deeper into it? :)
Title: Re: "Issue" with Atlas Maker
Post by: nah0y on December 22, 2012, 01:28:12 PM
Héhé, no it's absolutely not critical. Maybe you could guide me a little bit into where I should look, so I can try to fix this. It's in the UIAtlasMaker script or somewhere else ?
Title: Re: "Issue" with Atlas Maker
Post by: ArenMook on December 23, 2012, 06:50:46 AM
Yup it's all in there. NGUI uses Unity's function that collects the selection's dependencies. This way you can select a folder and it will grab all the images underneath.
Title: Re: "Issue" with Atlas Maker
Post by: nah0y on December 23, 2012, 09:09:28 AM
I suppose there is a better way to do that, but here is the new code for the GetSelectedTextures method:

  1.         List<Texture> GetSelectedTextures ()
  2.         {
  3.                 List<Texture> textures = new List<Texture>();
  4.  
  5.                 if (Selection.objects != null && Selection.objects.Length > 0)
  6.                 {
  7.                         List<Object> selectedObjects = new List<Object>();
  8.                        
  9.                         for (int i = 0; i < Selection.objects.Length; i++)
  10.                         {
  11.                                 if (!System.IO.Path.GetExtension(AssetDatabase.GetAssetPath(Selection.objects[i])).Equals(".unity"))
  12.                                 {
  13.                                         selectedObjects.Add(Selection.objects[i]);
  14.                                 }
  15.                         }
  16.                        
  17.                         Object[] objects = EditorUtility.CollectDependencies(selectedObjects.ToArray());
  18.  
  19.                         foreach (Object o in objects)
  20.                         {
  21.                                 Texture tex = o as Texture;
  22.                                 if (tex != null && (NGUISettings.atlas == null || NGUISettings.atlas.texture != tex)) textures.Add(tex);
  23.                         }
  24.                 }
  25.                 return textures;
  26.         }
  27.  

I just create another array of selected objects without including every objects with the extension .unity
Title: Re: "Issue" with Atlas Maker
Post by: nah0y on January 07, 2013, 06:20:46 AM
UP ? :)