/// <summary> /// 处理Atlas,将Sprite与Atlas一起处理 /// </summary> private void DealWithAtlas() { List <string> atlasPaths = (from path in m_BundleAssetPathList where Path.GetExtension(path).ToLower() == ".spriteatlas" select path).ToList(); atlasPaths.ForEach((atlasPath) => { ProgressCallback?.Invoke(atlasPath, m_FindIndex / (float)m_BundleAssetPathList.Count); m_FindIndex++; SpriteAtlas atlas = AssetDatabase.LoadAssetAtPath <SpriteAtlas>(atlasPath); if (atlas == null) { Debug.LogError("AssetDependFinder::Find->atlas is null. path = " + atlasPath); } else { string[] spriteInAtlas = SpriteAtlasUtil.GetDependAssets(atlas); m_BundleDependAssetDic.Add(atlasPath, new List <string>(spriteInAtlas)); foreach (var spritePath in spriteInAtlas) { m_SpriteInAtlasDic.Add(spritePath, atlasPath); } } }); }
protected void drawFeatureData(LeapGraphicGroup sharedGroup) { using (new ProfilerSample("Draw Leap Gui Graphic Editor")) { if (targets.Length == 0) { return; } var mainGraphic = targets[0]; if (mainGraphic.featureData.Count == 0) { return; } if (mainGraphic.attachedGroup != null) { SpriteAtlasUtil.ShowInvalidSpriteWarning(mainGraphic.attachedGroup.features); } int maxGraphics = LeapGraphicPreferences.graphicMax; if (targets.Query().Any(e => e.attachedGroup != null && e.attachedGroup.graphics.IndexOf(e) >= maxGraphics)) { string noun = targets.Length == 1 ? "This graphic" : "Some of these graphics"; string rendererName = targets.Length == 1 ? "its renderer" : "their renderers"; EditorGUILayout.HelpBox(noun + " may not be properly displayed because there are too many graphics on " + rendererName + ". " + "Either lower the number of graphics or increase the maximum graphic count by visiting " + "Edit->Preferences.", MessageType.Warning); } //If we are not all attached to the same group we cannot show features if (!targets.Query().Select(g => g.attachedGroup).AllEqual()) { return; } EditorGUILayout.Space(); using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField("Feature Data: ", EditorStyles.boldLabel); if (sharedGroup != null) { var meshRendering = sharedGroup.renderingMethod as LeapMesherBase; if (meshRendering != null && meshRendering.IsAtlasDirty && !EditorApplication.isPlaying) { if (GUILayout.Button("Refresh Atlas", GUILayout.MaxHeight(EditorGUIUtility.singleLineHeight))) { meshRendering.RebuildAtlas(new ProgressBar()); sharedGroup.renderer.editor.ScheduleRebuild(); } } } } for (int i = 0; i < _featureTable.arraySize; i++) { var idIndex = _featureTable.GetArrayElementAtIndex(i); var dataProp = MultiTypedListUtil.GetReferenceProperty(_featureList, idIndex); EditorGUILayout.LabelField(LeapGraphicTagAttribute.GetTagName(dataProp.type)); if (mainGraphic.attachedGroup != null) { currentFeature = mainGraphic.attachedGroup.features[i]; } EditorGUI.indentLevel++; EditorGUILayout.PropertyField(dataProp, includeChildren: true); EditorGUI.indentLevel--; currentFeature = null; } serializedObject.ApplyModifiedProperties(); } }