コード例 #1
0
        private void drawSpriteWarning()
        {
            var list = Pool <List <LeapGraphicFeatureBase> > .Spawn();

            try {
                foreach (var group in _renderer.groups)
                {
                    list.AddRange(group.features);
                }
                SpriteAtlasUtil.ShowInvalidSpriteWarning(list);
            } finally {
                list.Clear();
                Pool <List <LeapGraphicFeatureBase> > .Recycle(list);
            }
        }
コード例 #2
0
        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();
            }
        }