Example #1
0
    void addPerfSection(float amount, double perf, string iconname)
    {
        float width = Screen.width * 0.9f;

        GUI.color = PerformanceProfile.doubleToPerfColor(perf);
        GUILayout.Label(amount + "", GUILayout.Width(width / 2));
        GUI.color = Color.white;
        addButton(iconname, 0, -20, 15, false);
    }
Example #2
0
    void OnGUI()
    {
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUILayout.Width(position.width), GUILayout.Height(position.height - 74));
        GuiLine(2);
        KAPProfile[] kps = KAPProfile.getAllInProject();
        foreach (KAPProfile item in kps)
        {
            AvatarsContainer.initKPValue(item.name);
            addButton("avatar", 3, 0, 20, true);
            GUILayout.Label("    " + item.name, EditorStyles.boldLabel);
            GUI.color = PerformanceProfile.doubleToPerfColor(item.perfP.performance());
            Rect r = EditorGUILayout.BeginVertical();
            EditorGUI.ProgressBar(r, ((4 - item.perfP.performance()) / 4), PerformanceProfile.doubleToPerfName(item.perfP.performance()) + " (" + (4 - item.perfP.performance()) + ")");
            GUILayout.Space(18);
            EditorGUILayout.EndVertical();
            GUI.color = Color.white;
            AvatarsContainer.kpsfoldout[item.name] = EditorGUILayout.Foldout(AvatarsContainer.kpsfoldout[item.name], "details");
            if (AvatarsContainer.kpsfoldout[item.name])
            {
                GUILayout.BeginHorizontal();
                addPerfSection(item.polys, item.perfP.polysperf, "polygon");
                DrawBreak();
                addPerfSection(item.boneamount, item.perfP.boneamountperf, "bone");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.meshrenderers, item.perfP.meshrenderersperf, "mesh");
                DrawBreak();
                addPerfSection(item.dynboneamount, item.perfP.dynboneamountperf, "dynamic_bone");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.dynbonecolliders, item.perfP.dynbonecollidersperf, "dynamic_bone_collider");
                DrawBreak();
                addPerfSection(item.particle_systems, item.perfP.particle_systemsperf, "particle");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.audio_sources, item.perfP.audio_sourcesperf, "audio");
                DrawBreak();
                addPerfSection(item.lights, item.perfP.lightsperf, "light_source");
                GUILayout.EndHorizontal();
                GuiLine();
                GUILayout.BeginHorizontal();
                addPerfSection(item.animators, item.perfP.animatorsperf, "animator");
                DrawBreak();
                addPerfSection(item.cloth, item.perfP.clothperf, "cloth");
                GUILayout.EndHorizontal();
                GUILayout.Space(5);
                GUILayout.BeginHorizontal();
                AvatarsContainer.kpsscene[item.name]  = GUILayout.Button("scene");
                AvatarsContainer.kpsfolder[item.name] = GUILayout.Button("folder");
                GUI.backgroundColor = MainContainer.fromRGB(255f, 119f, 110f);
                AvatarsContainer.kpsdelete[item.name] = GUILayout.Button("delete");
                GUI.backgroundColor = Color.white;
                GUILayout.EndHorizontal();
            }
            GuiLine(2);

            if (AvatarsContainer.kpsscene[item.name])
            {
                item.openScene();
            }
            if (AvatarsContainer.kpsfolder[item.name])
            {
                item.openFolder();
                CleanFolder.cleanFolder(item.name);
            }
            if (AvatarsContainer.kpsdelete[item.name])
            {
                item.delete();
            }
        }
        GUILayout.EndScrollView();
        addButton("avatar", 3, 0, 20, true);
        GUILayout.Label("    add avatar", EditorStyles.boldLabel);

        model = (GameObject)EditorGUILayout.ObjectField("select your avatar:", model, typeof(GameObject), true);
        if (model != null)
        {
            bool btn = GUILayout.Button("do it!");
            if (btn == true)
            {
                AvatarStructureBuilder.BuildOverride(model);
            }
        }
        else
        {
            GUI.enabled = false;
            GUILayout.Button("please select a .fbx");
            GUI.enabled = true;
        }
    }