UnityEditor.ExposeTransformEditor.OnGUI C# (CSharp) Méthode

OnGUI() public méthode

public OnGUI ( ) : void
Résultat void
        public void OnGUI()
        {
            this.m_ExtraExposedTransformList.DoLayoutList();
        }

Usage Example

Exemple #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            string errors   = m_RigImportErrors.stringValue;
            string warnings = m_RigImportWarnings.stringValue;

            if (errors.Length > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("Error(s) found while importing rig in this animation file. Open \"Import Messages\" foldout below for more details", MessageType.Error);
            }
            else
            {
                if (warnings.Length > 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox("Warning(s) found while importing rig in this animation file. Open \"Import Messages\" foldout below for more details", MessageType.Warning);
                }
            }


            // Animation type
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Popup(m_AnimationType, Styles.AnimationTypeOpt, Styles.AnimationType);
            if (EditorGUI.EndChangeCheck())
            {
                m_AvatarSource.objectReferenceValue = null;

                if (m_AvatarSourceSerializedObject != null)
                {
                    m_AvatarSourceSerializedObject.Dispose();
                }
                m_AvatarSourceSerializedObject = null;

                if (animationType == ModelImporterAnimationType.Legacy)
                {
                    m_AnimationCompression.intValue = (int)ModelImporterAnimationCompression.KeyframeReduction;
                }
                else if (animationType == ModelImporterAnimationType.Generic || animationType == ModelImporterAnimationType.Human)
                {
                    m_AnimationCompression.intValue = (int)ModelImporterAnimationCompression.Optimal;
                }

                m_DstHasExtraRoot.boolValue = m_SrcHasExtraRoot.boolValue;
            }

            EditorGUILayout.Space();

            if (!m_AnimationType.hasMultipleDifferentValues)
            {
                // Show GUI depending on animation type
                if (animationType == ModelImporterAnimationType.Human)
                {
                    HumanoidGUI();
                }
                else if (animationType == ModelImporterAnimationType.Generic)
                {
                    GenericGUI();
                }
                else if (animationType == ModelImporterAnimationType.Legacy)
                {
                    LegacyGUI();
                }
            }

            if (animationType != ModelImporterAnimationType.None || m_AnimationType.hasMultipleDifferentValues)
            {
                EditorGUILayout.Popup(m_SkinWeightsMode, Styles.SkinWeightsModeOpt, Styles.SkinWeightsMode);

                if (m_SkinWeightsMode.intValue == (int)ModelImporterSkinWeights.Custom)
                {
                    EditorGUILayout.IntSlider(m_MaxBonesPerVertex, 1, 255, Styles.MaxBonesPerVertex);
                    EditorGUILayout.Slider(m_MinBoneWeight, 0.001f, 0.5f, Styles.MinBoneWeight);
                }

                int currentSkinWeights = m_SkinWeightsMode.intValue == (int)ModelImporterSkinWeights.Standard ? 4 : m_MaxBonesPerVertex.intValue;
                if ((int)QualitySettings.skinWeights < currentSkinWeights)
                {
                    var msg =
                        $"Skin Weights is set to {(int)QualitySettings.skinWeights} bones per vertex in Quality Settings. Some bone influences may not be rendered.";
                    EditorGUILayout.HelpBox(msg, MessageType.Info);
                }
            }

            EditorGUILayout.PropertyField(m_OptimizeBones, Styles.OptimizeBones);

            ShowUpdateReferenceClip();

            // OptimizeGameObject is only supported on our own avatar when animation type is not Legacy.
            if (m_AvatarSetup.intValue == (int)ModelImporterAvatarSetup.CreateFromThisModel && animationType != ModelImporterAnimationType.Legacy)
            {
                EditorGUILayout.PropertyField(m_OptimizeGameObjects);
                if (m_OptimizeGameObjects.boolValue &&
                    serializedObject.targetObjectsCount == 1) // SerializedProperty can't handle multiple string arrays properly.
                {
                    bool wasChanged = GUI.changed;
                    m_ExtraExposedTransformFoldout = EditorGUILayout.Foldout(m_ExtraExposedTransformFoldout, Styles.ExtraExposedTransform, true);
                    GUI.changed = wasChanged;
                    if (m_ExtraExposedTransformFoldout)
                    {
                        // Do not allow multi edit of exposed transform list if all rigs doesn't match
                        using (new EditorGUI.DisabledScope(!m_CanMultiEditTransformList))
                            using (new EditorGUI.IndentLevelScope())
                                m_ExposeTransformEditor.OnGUI();
                    }
                }
            }

            if (errors.Length > 0 || warnings.Length > 0)
            {
                EditorGUILayout.Space();

                importMessageFoldout = EditorGUILayout.Foldout(importMessageFoldout, Styles.ImportMessages, true);

                if (importMessageFoldout)
                {
                    if (errors.Length > 0)
                    {
                        EditorGUILayout.HelpBox(errors, MessageType.None);
                    }
                    else if (warnings.Length > 0)
                    {
                        EditorGUILayout.HelpBox(warnings, MessageType.None);
                    }
                }
            }
        }
All Usage Examples Of UnityEditor.ExposeTransformEditor::OnGUI