GetHeight() public méthode

public GetHeight ( ) : float
Résultat float
    public override float GetPropertyHeight(SerializedProperty property, UnityEngine.GUIContent label)
    {
        if (list == null)
        {
            list = getList(property.FindPropertyRelative("List"));
        }

        return(list.GetHeight());
    }
Exemple #2
0
        private void DrawBiomeSettings(bool helpEnabled)
        {
            m_biomePreset.m_orderNumber = m_editorUtils.IntField("OrderNumber", m_biomePreset.m_orderNumber, helpEnabled);
            Rect listRect = EditorGUILayout.GetControlRect(true, m_spawnerPresetList.GetHeight());

            m_spawnerPresetList.DoList(listRect);
            m_editorUtils.InlineHelp("SpawnerAdded", helpEnabled);


            if (m_biomePreset.m_spawnerPresetList.Count == 0)
            {
                GUILayout.Space(EditorGUIUtility.singleLineHeight);
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("NoSpawnersYet"), MessageType.Warning);
                GUILayout.Space(10);
                if (m_editorUtils.Button("CreateFirstSpawner"))
                {
                    GameObject spawnerObj = new GameObject("New Spawner");
                    Spawner    spawner    = spawnerObj.AddComponent <Spawner>();
                    spawner.m_createdfromBiomePreset = true;
                    Selection.activeGameObject       = spawnerObj;
                }
                GUILayout.Space(20);
            }
            else
            {
                GUILayout.Space(10);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (m_editorUtils.Button("CreateAdditionalSpawner", GUILayout.MaxWidth(200)))
                {
                    GameObject spawnerObj = new GameObject("New Spawner");
                    Spawner    spawner    = spawnerObj.AddComponent <Spawner>();
                    spawner.m_createdfromBiomePreset = true;
                    Selection.activeGameObject       = spawnerObj;
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            m_biomePreset.GaiaSceneCullingProfile = (GaiaSceneCullingProfile)m_editorUtils.ObjectField("GaiaSceneCullingProfile", m_biomePreset.GaiaSceneCullingProfile, typeof(GaiaSceneCullingProfile), false, helpEnabled);

#if UNITY_POST_PROCESSING_STACK_V2
            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            m_biomePreset.postProcessProfile = (PostProcessProfile)m_editorUtils.ObjectField("PostProcessingProfile", m_biomePreset.postProcessProfile, typeof(PostProcessProfile), false, helpEnabled);
#endif
            GUILayout.Space(EditorGUIUtility.singleLineHeight);


            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(m_biomePreset);
        }
        public void OnGUI(Rect rect)
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }

            //Event evt = Event.current;

            if (onGetNameAtIndex == null)
            {
                Debug.LogError("Ensure to set: 'onGetNameAtIndex'");
            }

            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && rect.Contains(evt.mousePosition))
            {
                m_HadKeyFocusAtMouseDown = m_ReorderableList.HasKeyboardControl();
            }

            if (m_FrameIndex != -1)
            {
                EnsureRowIsVisible(m_FrameIndex, rect.height);
                m_FrameIndex = -1;
            }

            GUILayout.BeginArea(rect);
            m_State.m_ScrollPos = GUILayout.BeginScrollView(m_State.m_ScrollPos);

            m_ReorderableList.DoLayoutList();

            GUILayout.EndScrollView();
            GUILayout.EndArea();
            AudioMixerDrawUtils.DrawScrollDropShadow(rect, m_State.m_ScrollPos.y, m_ReorderableList.GetHeight());

            KeyboardHandling();
            CommandHandling();
        }
				public override float GetPropertyHeight (SerializedProperty property, GUIContent label)
				{
						SerializedProperty onUPSerialized = property.FindPropertyRelative ("onUP");
						SerializedProperty onDOWNSerialized = property.FindPropertyRelative ("onDOWN");
						SerializedProperty onHOLDSerialized = property.FindPropertyRelative ("onHOLD");
			
		
					
						SerializedProperty elements;
						ReorderableList list;
						
						elements = onUPSerialized.FindPropertyRelative ("m_PersistentCalls.m_Calls");
						list = new ReorderableList (onUPSerialized.serializedObject, elements, false, true, true, true);
						
						list.elementHeight = 43f;//MAGIC NUMBER (see UnityEventDrawer onGUI and GetState)
						onUPSerializedPropertyHeight = list.GetHeight ();

					

						elements = onDOWNSerialized.FindPropertyRelative ("m_PersistentCalls.m_Calls");
						list = new ReorderableList (onDOWNSerialized.serializedObject, elements, false, true, true, true);
						list.elementHeight = 43f;

						onDOWNSerializedPropertyHeight = list.GetHeight ();


						elements = onHOLDSerialized.FindPropertyRelative ("m_PersistentCalls.m_Calls");
						list = new ReorderableList (onHOLDSerialized.serializedObject, elements, false, true, true, true);
						
						list.elementHeight = 43f;
						onHOLDSerializedPropertyHeight = list.GetHeight ();


						return onUPSerializedPropertyHeight + onDOWNSerializedPropertyHeight + onHOLDSerializedPropertyHeight
								+ 5 * 2f + 16f;//offset + EnumPopup
				}
Exemple #5
0
 public float GetHeight()
 {
     return(m_HeaderHeight + (Property.isExpanded && m_ReorderableList != null ? Constants.kHeaderPadding + m_ReorderableList.GetHeight() : 0.0f));
 }
        void DisplayUpdateGUI()
        {
            EditorGUILayout.IntPopup(m_UpdateMode, styles.updateModeStrings, styles.updateModeValues, styles.updateMode);

            EditorGUI.indentLevel++;

            if (m_UpdateMode.intValue == (int)CustomRenderTextureUpdateMode.Realtime)
            {
                EditorGUILayout.PropertyField(m_UpdatePeriod, styles.updatePeriod);
            }

            EditorGUILayout.PropertyField(m_DoubleBuffered, styles.doubleBuffered);
            EditorGUILayout.PropertyField(m_WrapUpdateZones, styles.wrapUpdateZones);

            bool isCubemap = true;

            foreach (Object o in targets)
            {
                CustomRenderTexture customRenderTexture = o as CustomRenderTexture;
                if (customRenderTexture != null && customRenderTexture.dimension != UnityEngine.Rendering.TextureDimension.Cube)
                {
                    isCubemap = false;
                }
            }

            if (isCubemap)
            {
                int newFaceMask     = 0;
                int currentFaceMask = m_CubeFaceMask.intValue;

                var AllRects = GUILayoutUtility.GetRect(0, EditorGUIUtility.singleLineHeight * 3 + EditorGUIUtility.standardVerticalSpacing * 2);
                EditorGUI.BeginProperty(AllRects, GUIContent.none, m_CubeFaceMask);

                Rect toggleRect = AllRects;
                toggleRect.width  = kToggleWidth;
                toggleRect.height = EditorGUIUtility.singleLineHeight;
                int faceIndex = 0;
                {
                    Rect labelRect = AllRects;
                    EditorGUI.LabelField(labelRect, styles.cubemapFacesLabel);

                    EditorGUI.BeginChangeCheck();
                    for (int i = 0; i < 3; ++i)
                    {
                        toggleRect.x = AllRects.x + EditorGUIUtility.labelWidth - kIndentSize;

                        {
                            for (int j = 0; j < 2; ++j)
                            {
                                bool value = EditorGUI.ToggleLeft(toggleRect, styles.cubemapFaces[faceIndex], (currentFaceMask & (1 << faceIndex)) != 0);
                                if (value)
                                {
                                    newFaceMask |= (int)(1 << faceIndex);
                                }
                                faceIndex++;

                                toggleRect.x += kToggleWidth;
                            }
                        }

                        toggleRect.y += EditorGUIUtility.singleLineHeight;
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_CubeFaceMask.intValue = newFaceMask;
                    }
                }
                EditorGUI.EndProperty();
            }


            EditorGUILayout.IntPopup(m_UpdateZoneSpace, styles.updateZoneSpaceStrings, styles.updateZoneSpaceValues, styles.updateZoneSpace);

            if (!multipleEditing)
            {
                Rect listRect = GUILayoutUtility.GetRect(0.0f, m_RectList.GetHeight() + kRListAddButtonOffset, GUILayout.ExpandWidth(true)); // kRListAddButtonOffset because reorderable list does not take the  +/- button at the bottom when computing its Rects making it half occulted by other GUI elements.
                // Reorderable list seems to not take indentLevel into account properly.
                float indentSize = kIndentSize;
                listRect.x     += indentSize;
                listRect.width -= indentSize;
                m_RectList.DoList(listRect);
            }
            else
            {
                EditorGUILayout.HelpBox("Update Zones cannot be changed while editing multiple Custom Textures.", MessageType.Info);
            }

            EditorGUI.indentLevel--;
        }
Exemple #7
0
 public float GetHeight()
 {
     return(m_HeaderHeight + (m_Foldout && m_ReorderableList != null ? Constants.kHeaderPadding + m_ReorderableList.GetHeight() : 0.0f));
 }