public override void OnInspectorGUI() { if (_spawnable == null) { _spawnable = (CVRSpawnable)target; } _spawnable.spawnHeight = EditorGUILayout.FloatField("Spawn Height", _spawnable.spawnHeight); GUILayout.BeginVertical("HelpBox"); GUILayout.BeginHorizontal(); _spawnable.useAdditionalValues = EditorGUILayout.Toggle(_spawnable.useAdditionalValues, GUILayout.Width(16)); EditorGUILayout.LabelField("Enable Sync Values", GUILayout.Width(250)); GUILayout.EndHorizontal(); if (_spawnable.useAdditionalValues) { GUILayout.BeginHorizontal(); GUILayout.BeginVertical("GroupBox"); Rect _rect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight); EditorGUI.ProgressBar(_rect, _spawnable.syncValues.Count / 9f, _spawnable.syncValues.Count + " of 9 Synced Parameter Slots used"); if (reorderableList == null) { InitializeList(); } reorderableList.DoLayoutList(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); }
void OnGUISpawnable(CVRSpawnable s) { GameObject spawnableObject = s.gameObject; GUI.enabled = true; EditorGUILayout.InspectorTitlebar(spawnableObject.activeInHierarchy, spawnableObject); int errors = 0; int overallPolygonsCount = 0; int overallSkinnedMeshRenderer = 0; int overallUniqueMaterials = 0; int overallMissingScripts = 0; foreach (MeshFilter filter in s.gameObject.GetComponentsInChildren <MeshFilter>()) { if (filter.sharedMesh != null) { overallPolygonsCount = overallPolygonsCount + filter.sharedMesh.triangles.Length / 3; } } foreach (SkinnedMeshRenderer renderer in s.gameObject.GetComponentsInChildren <SkinnedMeshRenderer>()) { overallSkinnedMeshRenderer++; if (renderer.sharedMaterials != null) { overallUniqueMaterials = overallUniqueMaterials + renderer.sharedMaterials.Length; } } overallMissingScripts = CCK_Tools.CleanMissingScripts(CCK_Tools.SearchType.Selection, false, spawnableObject); if (overallMissingScripts > 0) { errors++; } //Errors if (overallMissingScripts > 0) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_ERROR_MISSING_SCRIPT"), MessageType.Error); } //Warnings if (overallPolygonsCount > 100000) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_WARNING_POLYGONS").Replace("{X}", overallPolygonsCount.ToString()), MessageType.Warning); } if (overallSkinnedMeshRenderer > 10) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_WARNING_SKINNED_MESH_RENDERERS").Replace("{X}", overallSkinnedMeshRenderer.ToString()), MessageType.Warning); } if (overallUniqueMaterials > 20) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_WARNING_MATERIALS").Replace("{X}", overallUniqueMaterials.ToString()), MessageType.Warning); } var spawnableMeshes = getAllAssetMeshesInAvatar(spawnableObject); if (CheckForLegacyBlendShapeNormals(spawnableMeshes)) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_WARNING_LEGACY_BLENDSHAPES"), MessageType.Warning); if (GUILayout.Button(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_FIX_IMPORT_SETTINGS"))) { FixLegacyBlendShapeNormals(spawnableMeshes); } } //Info if (overallPolygonsCount >= 50000 && overallPolygonsCount <= 100000) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_INFO_POLYGONS").Replace("{X}", overallPolygonsCount.ToString()), MessageType.Info); } if (overallSkinnedMeshRenderer >= 5 && overallSkinnedMeshRenderer <= 10) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_INFO_SKINNED_MESH_RENDERERS").Replace("{X}", overallSkinnedMeshRenderer.ToString()), MessageType.Info); } if (overallUniqueMaterials >= 10 && overallUniqueMaterials <= 20) { EditorGUILayout.HelpBox(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_INFO_MATERIALS").Replace("{X}", overallUniqueMaterials.ToString()), MessageType.Info); } if (errors <= 0 && overallMissingScripts <= 0) { if (GUILayout.Button(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_PROPS_UPLOAD_BUTTON"))) { CCK_BuildUtility.BuildAndUploadSpawnable(spawnableObject); } } if (overallMissingScripts > 0) { if (GUILayout.Button(CCKLocalizationProvider.GetLocalizedText("ABI_UI_BUILDPANEL_UTIL_REMOVE_MISSING_SCRIPTS_BUTTON"))) { CCK_Tools.CleanMissingScripts(CCK_Tools.SearchType.Selection, true, spawnableObject); } } }