コード例 #1
0
        protected override void OnInspector()
        {
            base.OnInspector();

            BeginError(Any(t => t.DownsampleSteps < 0));
            Draw("downsampleSteps", "Counting all the pixels of a texture can be slow, so you can pick how many times the texture is downsampled before it gets counted. One downsample = half width & height or 1/4 of the pixels. NOTE: The pixel totals will be multiplied to account for this downsampling.");
            EndError();
            Draw("threshold", "The RGBA values must be within this range of a color for it to be counted.");

            Separator();

            BeginDisabled();
            EditorGUILayout.IntField("Total", Target.Total);

            for (var i = 0; i < Target.Contributions.Count; i++)
            {
                var contribution = Target.Contributions[i];
                var rect         = P3dHelper.Reserve();
                var rectL        = rect; rectL.xMax -= (rect.width - EditorGUIUtility.labelWidth) / 2 + 1;
                var rectR        = rect; rectR.xMin = rectL.xMax + 2;

                EditorGUI.IntField(rectL, contribution.Color != null ? contribution.Color.name : "", contribution.Count);
                EditorGUI.ProgressBar(rectR, contribution.Ratio, "Ratio");
            }
            EndDisabled();
        }
コード例 #2
0
        private void DrawChannel(string countTitle, string ratioTitle, float ratio)
        {
            var rect  = P3dHelper.Reserve();
            var rectL = rect; rectL.xMax -= (rect.width - EditorGUIUtility.labelWidth) / 2 + 1;
            var rectR = rect; rectR.xMin = rectL.xMax + 2;

            EditorGUI.PropertyField(rectL, serializedObject.FindProperty(countTitle));
            EditorGUI.ProgressBar(rectR, ratio, ratioTitle);
        }
コード例 #3
0
        protected override void OnInspector()
        {
            Draw("color", "The color associated with this component and GameObject name.");

            EditorGUILayout.Separator();

            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.IntField(new GUIContent("Total", "This tells you how many pixels this color could be painted on."), Target.Total);
            var rect  = P3dHelper.Reserve();
            var rectL = rect; rectL.xMax -= (rect.width - EditorGUIUtility.labelWidth) / 2 + 1;
            var rectR = rect; rectR.xMin = rectL.xMax + 2;

            EditorGUI.IntField(rectL, new GUIContent("Solid", "This tells you how many pixels this color has been painted on."), Target.Solid);
            EditorGUI.ProgressBar(rectR, Target.Ratio, "Ratio");
            EditorGUI.EndDisabledGroup();
        }
コード例 #4
0
        protected override void OnInspector()
        {
            base.OnInspector();

            Draw("threshold", "The RGBA values must be within this range of a color for it to be counted.");

            Separator();

            BeginDisabled();
            EditorGUILayout.IntField("Total", Target.Total);

            for (var i = 0; i < Target.Contributions.Count; i++)
            {
                var contribution = Target.Contributions[i];
                var rect         = P3dHelper.Reserve();
                var rectL        = rect; rectL.xMax -= (rect.width - EditorGUIUtility.labelWidth) / 2 + 1;
                var rectR        = rect; rectR.xMin = rectL.xMax + 2;

                EditorGUI.IntField(rectL, contribution.Color != null ? contribution.Color.name : "", contribution.Count);
                EditorGUI.ProgressBar(rectR, contribution.Ratio, "Ratio");
            }
            EndDisabled();
        }