예제 #1
0
        public static void GenerateLightmapUVButton(CSGModel[] models)
        {
            GUIStyleUtility.InitStyles();

            bool needLightmapUVUpdate = false;

            for (int m = 0; m < models.Length && !needLightmapUVUpdate; m++)
            {
                if (!models[m])
                {
                    continue;
                }

                needLightmapUVUpdate = MeshInstanceManager.NeedToGenerateLightmapUVsForModel(models[m]) || needLightmapUVUpdate;
            }

            if (needLightmapUVUpdate)
            {
                if (GUILayout.Button(UpdateLightmapUVContent, GUIStyleUtility.redButton))
                {
                    for (int m = 0; m < models.Length; m++)
                    {
                        if (!models[m] || models[m].AutoRebuildUVs)
                        {
                            continue;
                        }

                        if (!MeshInstanceManager.NeedToGenerateLightmapUVsForModel(models[m]))
                        {
                            continue;
                        }

                        MeshInstanceManager.GenerateLightmapUVsForModel(models[m]);
                    }
                }
                GUILayout.Space(10);
            }
        }
예제 #2
0
        public static void UpdateButtons(CSGModel[] models)
        {
            CSG_GUIStyleUtility.InitStyles();

            bool needLightmapUVUpdate = false;
            bool needColliderUpdate   = false;

            for (int m = 0; m < models.Length; m++)
            {
                if (!models[m])
                {
                    continue;
                }

                needLightmapUVUpdate = needLightmapUVUpdate || MeshInstanceManager.NeedToGenerateLightmapUVsForModel(models[m]);
                needColliderUpdate   = needColliderUpdate || MeshInstanceManager.NeedToGenerateCollidersForModel(models[m]);
            }

            if (needLightmapUVUpdate)
            {
                if (GUILayout.Button(UpdateLightmapUVContent, CSG_GUIStyleUtility.redButton))
                {
                    CSGModelManager.BuildLightmapUvs();
                }
                GUILayout.Space(10);
            }

            if (needColliderUpdate)
            {
                if (GUILayout.Button(UpdateCollidersContent))
                {
                    CSGModelManager.BuildColliders();
                }
                GUILayout.Space(10);
            }
        }