public override void OnInspectorGUI()
        {
            if (m_UnwrapParameters == null || m_StaticEditorFlags == null)
            {
                return;
            }

            Styles.Init();

            if (GUILayout.Button("Open ProBuilder"))
            {
                ProBuilderEditor.MenuOpenWindow();
            }

            GUILayout.Box("Mesh property is driven by the ProBuilder component.", EditorStyles.helpBox);
            var guiEnabled = GUI.enabled;

            GUI.enabled = false;
            var guiStateMixed = EditorGUI.showMixedValue;

            EditorGUI.showMixedValue = targets.Length > 1;
            EditorGUILayout.ObjectField(Styles.sharedMesh, m_Mesh.mesh, typeof(Mesh), false);
            EditorGUI.showMixedValue = guiStateMixed;
            GUI.enabled = guiEnabled;

            Vector3 bounds = m_MeshRenderer != null ? m_MeshRenderer.bounds.size : Vector3.zero;

            EditorGUILayout.Vector3Field("Object Size (read only)", bounds);

            serializedObject.Update();
            EditorGUI.BeginChangeCheck();
            LightmapStaticSettings();
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }

#if DEVELOPER_MODE
            GUILayout.Space(4);

            GUILayout.Label("Compiled Mesh Information", EditorStyles.boldLabel);

            MeshFilter filter;
            Mesh       sharedMesh = null;

            if (m_Mesh.TryGetComponent(out filter) && (sharedMesh = filter.sharedMesh) != null)
            {
                GUILayout.Label("Vertex Count: " + sharedMesh.vertexCount);
                GUILayout.Label("Submesh Count: " + sharedMesh.subMeshCount);
            }
            else
            {
                GUILayout.Label("No compiled mesh", EditorStyles.centeredGreyMiniLabel);
            }

            GUILayout.Space(4);

            GUILayout.Label("HideFlags & Driven Properties", EditorStyles.boldLabel);

            if (filter)
            {
                GUILayout.Label($"MeshFilter {filter.hideFlags}");
            }
            else
            {
                GUILayout.Label($"MeshFilter (null)");
            }

            MeshCollider collider;

            if (m_Mesh.TryGetComponent(out collider))
            {
                GUILayout.Label($"MeshCollider.m_Mesh {DrivenPropertyManagerInternal.IsDriven(collider, "m_Mesh")}");
            }

            GUILayout.Space(4);

            GUILayout.Label("Identifiers", EditorStyles.boldLabel);
            EditorGUI.showMixedValue = targets.Length > 1;
            EditorGUILayout.IntField("ProBuilderMesh", m_Mesh.GetInstanceID());
            EditorGUILayout.IntField("UnityEngine.Mesh", sharedMesh != null ? sharedMesh.GetInstanceID() : -1);
            EditorGUILayout.TextField("UnityEngine.Mesh.name", sharedMesh != null ? sharedMesh.name : "null");
            EditorGUI.showMixedValue = false;
#endif
        }
Пример #2
0
 static string GetPropertyId(ProBuilderMesh mesh, string property)
 {
     return(string.Format("{0}.{1}", mesh.GetInstanceID(), property));
 }