/// <summary>
        /// draw a label with a yellow coloring
        /// </summary>
        /// <param name="warning"></param>
        public static void DrawWarning(string warning)
        {
            Color prevColor = GUI.color;

            GUI.color = MixedRealityInspectorUtility.WarningColor;
            EditorGUILayout.BeginVertical(EditorStyles.textArea);
            EditorGUILayout.LabelField(warning, EditorStyles.wordWrappedMiniLabel);
            EditorGUILayout.EndVertical();

            GUI.color = prevColor;
        }
        /// <summary>
        /// draw a notice area, normal coloring
        /// </summary>
        /// <param name="notice"></param>
        public static void DrawNotice(string notice)
        {
            Color prevColor = GUI.color;

            GUI.color = ColorTint100;
            EditorGUILayout.BeginVertical(EditorStyles.textArea);
            EditorGUILayout.LabelField(notice, EditorStyles.wordWrappedMiniLabel);
            EditorGUILayout.EndVertical();

            GUI.color = prevColor;
        }
    void DrawVariables()
    {
        if (templateParser_.variables.Count == 0) {
            return;
        }

        variablesFolded_.boolValue = Utils.Foldout("Variables", variablesFolded_.boolValue);
        if (!variablesFolded_.boolValue) return;

        ++EditorGUI.indentLevel;

        var constVars = new Dictionary<string, string>();

        foreach (var kv in templateParser_.variables) {
            var prop = FindProperty(variables_, kv.Key);
            if (prop == null) continue;
            var value = prop.FindPropertyRelative("value");

            var name = Utils.ToSpacedCamel(kv.Key);
            var constValue = ToConstVariable(kv.Key);
            string changedValue;

            if (constValue != null) {
                changedValue = constValue;
                constVars.Add(name, constValue);
            } else {
                if (kv.Value.Count <= 1) {
                    changedValue = EditorGUILayout.TextField(name, value.stringValue);
                } else {
                    var index = kv.Value.IndexOf(value.stringValue);
                    if (index == -1) index = 0;
                    index = EditorGUILayout.Popup(name, index, kv.Value.ToArray());
                    changedValue = kv.Value[index];
                }
            }

            if (value.stringValue != changedValue) {
                value.stringValue = changedValue;
            }
        }

        if (constVars.Count > 0) {
            constVarsFolded_ = EditorGUILayout.Foldout(constVarsFolded_, "Constants");
            if (constVarsFolded_) {
                ++EditorGUI.indentLevel;
                foreach (var kv in constVars) {
                    Utils.ReadOnlyTextField(kv.Key, kv.Value);
                }
                --EditorGUI.indentLevel;
            }
        }

        --EditorGUI.indentLevel;
    }
		void ToggleHightmapMode()
		{
			EditorGUILayout.BeginHorizontal();
			EditorGUI.BeginChangeCheck();
			m_Settings.HeightmapMode = (Heightmap.Mode)GUILayout.Toolbar((int)m_Settings.HeightmapMode, Styles.HeightmapToggles, Styles.ToggleButtonStyle, GUI.ToolbarButtonSize.Fixed);
			if (EditorGUI.EndChangeCheck())
			{
				GUIUtility.keyboardControl = 0;
			}
			EditorGUILayout.EndHorizontal();
		}
		/// <summary>
		/// Draws the content.
		/// </summary>
		protected override void DrawContent ()
		{
			UpdateCurrentScene ();
			EditorGUILayout.Space ();
			EditorGUILayout.BeginHorizontal ();
			{
				GUILayout.Space (20);
				_scrolls.DrawScrollable ("main", Content);
			}
			EditorGUILayout.EndHorizontal ();
		}
Exemple #6
0
        private void DrawHorizontalLine(int height)
        {
            var rect = EditorGUILayout.GetControlRect(false, height, EditorStyles.foldout);

            using (new Handles.DrawingScope(horizontalLineColor))
            {
                Handles.DrawLine(new Vector2(rect.x, rect.yMax), new Vector2(rect.xMax, rect.yMax));
            }

            GUILayout.Space(rect.height);
        }
Exemple #7
0
        public void EditorForBooleanCallbacks()
        {
            EditorGUILayout.HelpBox( "Callbacks will be run on all clients - not just the master client. They may also all get run once when joining the server (we'll do some magic to stop effects and sounds).", MessageType.Info );
            EditorGUILayout.Space();

            {
                CallbackEditor( "OnBooleanTrue" );
                CallbackEditor( "OnBooleanFalse" );
                CallbackEditor( "OnBooleanChanged" );
            }
        }
Exemple #8
0
        private void OnGUIHandler()
        {
            // Dirty repaint on eye dropper update to preview the color under the cursor
            if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == EventCommandNames.EyeDropperUpdate)
            {
                IncrementVersion(VersionChangeType.Repaint);
            }

            Color newColor = EditorGUILayout.ColorField(GUIContent.none, value, showEyeDropper, showAlpha, hdr);
            value = newColor;
        }
    private void DisplayForExampleFour()
    {
        obj       = EditorGUILayout.ObjectField(obj, typeof(GameObject), true) as GameObject;
        mat       = EditorGUILayout.ObjectField(mat, typeof(Material), false) as Material;
        audioClip = EditorGUILayout.ObjectField(audioClip, typeof(AudioClip), false) as AudioClip;

        var options = new[] { GUILayout.Width(64), GUILayout.Height(64) };

        tex    = EditorGUILayout.ObjectField(tex, typeof(Texture), false, options) as Texture;
        sprite = EditorGUILayout.ObjectField(sprite, typeof(Sprite), false, options) as Sprite;
    }
        public void OnGUI()
        {
            _autoSnapInstance.ShouldSnap       = EditorGUILayout.Toggle("Auto Snap", _autoSnapInstance.ShouldSnap);
            _autoSnapInstance.ShouldRotateSnap = EditorGUILayout.Toggle("Auto Snap Rotation", _autoSnapInstance.ShouldRotateSnap);
            _autoSnapInstance.SnapValueX       = EditorGUILayout.FloatField("Snap X Value", _autoSnapInstance.SnapValueX);
            _autoSnapInstance.SnapValueY       = EditorGUILayout.FloatField("Snap Y Value", _autoSnapInstance.SnapValueY);
            _autoSnapInstance.SnapValueZ       = EditorGUILayout.FloatField("Snap Z Value", _autoSnapInstance.SnapValueZ);
            _autoSnapInstance.SnapRotateValue  = EditorGUILayout.FloatField("Rotation Snap Value", _autoSnapInstance.SnapRotateValue);

            _autoSnapInstance.SavePreferences();
        }
Exemple #11
0
    public static void SetupLayerMaskField(Object target, GUIContent name, ref LayerMask layerMask, string[] layerMaskOptions, ref bool modified)
    {
        EditorGUI.BeginChangeCheck();
        int value = EditorGUILayout.MaskField(name, layerMask, layerMaskOptions);

        if (EditorGUI.EndChangeCheck())
        {
            Undo.RecordObject(target, "Changed " + name);
            layerMask = value;
        }
    }
 void DoHeader()
 {
     EditorGUILayout.BeginHorizontal();
     showHelp = GUILayout.Toggle(showHelp, "Toggle help", "Button");
     GUILayout.Label("FAE Tree Branch Shader", GUIHelper.Header);
     EditorGUILayout.EndHorizontal();
     if (showHelp)
     {
         EditorGUILayout.HelpBox("Please bear in mind, when using custom meshes, that most shader features require the Ambient Occlusion to be baked into the RGB vertex colors.", MessageType.Warning);
     }
 }
		void DrawFormatGUI ()
		{
			// ** Format GUI **
			EditorGUILayout.Space ();
			GUILayout.BeginHorizontal ("", GUIStyle.none);
			EditorGUILayout.LabelField (new GUIContent ("Format : ", "Texture format"), GUILayout.Width (65));
			texFormatIndex = EditorGUILayout.Popup (texFormatIndex, texFormats);
			EditorGUILayout.EndHorizontal ();
			EditorGUILayout.LabelField ("\"" + texFormatInfo [texFormatIndex] + "\"", EditorStyles.miniLabel);
			EditorGUILayout.Space();
		}
Exemple #14
0
		public static bool ToggleFoldout(SerializedProperty toggle, SerializedProperty foldout, string caption)
		{
			Separator(5);
			GUILayout.BeginHorizontal();
			toggle.boolValue = EditorGUILayout.Toggle(GUIContent.none, toggle.boolValue, GUILayout.Width(13));
			GUILayout.Space(13);
            foldout.boolValue = EditorGUI.Foldout(EditorGUILayout.GetControlRect(), foldout.boolValue, caption, true, richBoldFoldout);
			GUILayout.EndHorizontal();

			return toggle.boolValue;
		}
    public override void DrawNodePropertyEditor()
    {
        base.DrawNodePropertyEditor();
        //m_TexMode = (TexMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Colors", "3 components per texture or one"), m_TexMode, GUILayout.MaxWidth(200));

//        m_Value1 = RTEditorGUI.Slider(m_Value1, -100.0f, 100.0f);//,new GUIContent("Red", "Float"), m_R);
        m_RemapCurve  = EditorGUILayout.CurveField(m_RemapCurve);
        m_RemapCurveY = EditorGUILayout.CurveField(m_RemapCurveY);
        m_RepeatX.SliderLabel(this, "RepeatX"); //, 0.0f, 50.0f);//,new GUIContent("Red", "Float"), m_R);
        m_RepeatY.SliderLabel(this, "RepeatY"); //, 0.0f, 50.0f);//,new GUIContent("Red", "Float"), m_R);
    }
        /// <summary>
        /// draw a notice with red coloring
        /// </summary>
        /// <param name="error"></param>
        public static void DrawError(string error)
        {
            Color prevColor = GUI.color;

            GUI.color = MixedRealityInspectorUtility.ErrorColor;
            EditorGUILayout.BeginVertical(EditorStyles.textArea);
            EditorGUILayout.LabelField(error, EditorStyles.wordWrappedMiniLabel);
            EditorGUILayout.EndVertical();

            GUI.color = prevColor;
        }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        Brain myTarget = (Brain)target;

        GUILayout.Label("Current Action :", EditorStyles.boldLabel);
        if (myTarget._instructions != null)
        {
            EditorGUILayout.LabelField(">>> " + myTarget.NextAction());
        }
    }
	//public override Texture LoadImage() { return (Texture)EditorGUIUtility.LoadRequired("bend_help.png"); }

	public override bool Inspector()
	{
		MegaSpherify mod = (MegaSpherify)target;

#if !UNITY_5 && !UNITY_2017
		EditorGUIUtility.LookLikeControls();
#endif
		mod.percent = EditorGUILayout.FloatField("Percent", mod.percent);
		mod.FallOff = EditorGUILayout.FloatField("FallOff", mod.FallOff);
		return false;
	}
 void DrawBasics()
 {
     basicFolded_.boolValue = Utils.Foldout("Basic", basicFolded_.boolValue);
     if (basicFolded_.boolValue) {
         ++EditorGUI.indentLevel;
         EditorGUILayout.PropertyField(name_);
         EditorGUILayout.PropertyField(shader_);
         template_.Draw();
         --EditorGUI.indentLevel;
     }
 }
        public override bool OnDrawGUI()
        {
            base.OnDrawGUI();

            var state = this.showGrid;

            ME.ECSEditor.GUILayoutExt.FoldOut(ref state, "Grid", () => {
                ME.ECSEditor.GUILayoutExt.Box(6f, 2f, () => {
                    this.target.size     = EditorGUILayout.Vector3IntField("Grid Size", this.target.size);
                    this.target.nodeSize = EditorGUILayout.FloatField("Node Size", this.target.nodeSize);

                    this.target.initialPenalty     = EditorGUILayout.FloatField("Initial Penalty", this.target.initialPenalty);
                    this.target.initialHeight      = EditorGUILayout.FloatField("Initial Height", this.target.initialHeight);
                    this.target.diagonalCostFactor = EditorGUILayout.FloatField("Diagonal Cost Factor", this.target.diagonalCostFactor);
                    this.target.connectionsType    = (GridGraph.ConnectionsType)EditorGUILayout.EnumPopup("Connections Type", this.target.connectionsType);
                });
            });
            this.showGrid = state;

            state = this.showAgent;
            ME.ECSEditor.GUILayoutExt.FoldOut(ref state, "Agent", () => {
                ME.ECSEditor.GUILayoutExt.Box(6f, 2f, () => {
                    this.target.agentHeight = EditorGUILayout.FloatField("Agent Height", this.target.agentHeight);

                    this.target.checkMask            = ME.ECSEditor.GUILayoutExt.DrawLayerMaskField("Ground Mask", this.target.checkMask);
                    this.target.collisionMask        = ME.ECSEditor.GUILayoutExt.DrawLayerMaskField("Collision Mask", this.target.collisionMask);
                    this.target.collisionCheckRadius = EditorGUILayout.FloatField("Collision Check Radius", this.target.collisionCheckRadius);
                });
            });
            this.showAgent = state;

            state = this.showEditor;
            ME.ECSEditor.GUILayoutExt.FoldOut(ref state, "Editor", () => {
                ME.ECSEditor.GUILayoutExt.Box(6f, 2f, () => {
                    this.target.drawMode = (GridGraph.DrawMode)EditorGUILayout.EnumPopup("Draw Mode", this.target.drawMode);

                    if (this.target.drawMode == GridGraph.DrawMode.Penalty)
                    {
                        ME.ECSEditor.GUILayoutExt.DrawGradient(10f, Color.green, Color.red, this.target.minPenalty.ToString("0"), this.target.maxPenalty.ToString("0"));
                    }
                    else if (this.target.drawMode == GridGraph.DrawMode.Height)
                    {
                        ME.ECSEditor.GUILayoutExt.DrawGradient(10f, Color.black, Color.white, this.target.minHeight.ToString("0"), this.target.maxHeight.ToString("0"));
                    }

                    this.target.drawNonwalkableNodes        = EditorGUILayout.ToggleLeft("Draw Non-walkable Nodes", this.target.drawNonwalkableNodes);
                    this.target.drawConnections             = EditorGUILayout.ToggleLeft("Draw Connections", this.target.drawConnections);
                    this.target.drawConnectionsToUnwalkable = EditorGUILayout.ToggleLeft("Draw Connections to Non-walkable", this.target.drawConnectionsToUnwalkable);
                });
            });
            this.showEditor = state;

            return(false);
        }
        /// <summary>
        /// draw a notice with green coloring
        /// </summary>
        /// <param name="notice"></param>
        public static void DrawSuccess(string notice)
        {
            Color prevColor = GUI.color;

            GUI.color = MixedRealityInspectorUtility.SuccessColor;
            EditorGUILayout.BeginVertical(EditorStyles.textArea);
            EditorGUILayout.LabelField(notice, EditorStyles.wordWrappedMiniLabel);
            EditorGUILayout.EndVertical();

            GUI.color = prevColor;
        }
Exemple #22
0
		public static void Separator(int padding = 0)
		{
			if (padding != 0) GUILayout.Space(padding);

			Rect position = EditorGUILayout.GetControlRect(false, 1f);
			position = EditorGUI.PrefixLabel(position, GUIContent.none);
			Rect texCoords = new Rect(0f, 1f, 1f, 1f - 1f / line.normal.background.height);
			GUI.DrawTextureWithTexCoords(position, line.normal.background, texCoords);

			if (padding != 0) GUILayout.Space(padding);
		}
		public override void OnHeaderGUI(List<Object> found)
		{
			EditorGUIUtil.TextArea ("Exclude", ref exclude);
			EditorGUIUtil.Toggle("Exclude TexLoader", ref excludeTexLoader);
			EditorGUILayout.BeginHorizontal();
			EditorGUIUtil.TextField(null, ref filter);
			if (GUILayout.Button("Search")) {
				SetExclude(exclude);
				Search();
			}
			EditorGUILayout.EndHorizontal();
		}
    private bool AddReferenceEditor <T>(string name, string description, string tooltip = "")
    {
        var property = obj.FindProperty(name);

        property.objectReferenceValue = EditorGUILayout.ObjectField(
            new GUIContent(description, tooltip),
            property.objectReferenceValue,
            typeof(T),
            false);

        return(property.objectReferenceValue == null);
    }
Exemple #25
0
        public void EditorForButton()
        {
            EditorGUILayout.PropertyField( serializedObject.FindProperty( "Type" ), new GUIContent( "Button press style" ) );
            EditorGUILayout.PropertyField( serializedObject.FindProperty( "RepeatTime" ), new GUIContent( "Seconds before can press again" ) );

            if ( Button.Type == ButtonPressMode.OnWithTimedReset )
            {
                EditorGUILayout.PropertyField( serializedObject.FindProperty( "DelayBeforeReset" ), new GUIContent( "Reset to off after seconds" ) );
            }

            EditorGUILayout.PropertyField( serializedObject.FindProperty( "EnabledIf" ), new GUIContent( "Enabled If True" ) );
        }
	void OnGUI()
	{
		var Rect = this.position;
		Rect.x = 0;
		Rect.y = 0;
			
		//	draw camera selection
		{
			int SelectedCamera = 0;
			List<string> CameraNames = new List<string> ();
			CameraNames.Add ("null");

			//	add the other cameras in the scene
			foreach (Camera Cam in Camera.allCameras) {
				CameraNames.Add (Cam.name);
				if (mCamera == Cam)
					SelectedCamera = CameraNames.Count - 1;
			}

			int NewSelectedCamera = EditorGUILayout.Popup ( SelectedCamera, CameraNames.ToArray(), GUILayout.ExpandWidth (true));

			//	changed camera
			if (NewSelectedCamera != SelectedCamera) {
				if (NewSelectedCamera == 0) {
					mCamera = null;
				} else {
					mCamera = Camera.allCameras [NewSelectedCamera -1];
				}
			}
		}

		{
			if (GUILayout.Button ("Snap to display")) {
				SnapWindowToDisplay ();
			}
		}


		//	draw the content!
		{
			//	move the rect to go past all the previous controls
			var LastBottom = GUILayoutUtility.GetLastRect ().yMax;
			Rect.y += LastBottom;
			Rect.height -= LastBottom;

			UpdateRenderTexture (Rect);
			if (mRenderTexture == null) {
				GUI.Box (Rect, "No camera");
			} else {
				GUI.DrawTexture (Rect, mRenderTexture);
			}
		}
	}
Exemple #27
0
        public override void OnInspectorGUI()
        {
            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Debug -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            EditorGUILayout.HelpBox(
                "Press F9 while in-game to enable debug printout.\n" +
                "Used to display a printout of the SDK version and calibration info. Leave disabled--is controlled by quilt",
                MessageType.None
            );
        }
        void DrawShadows()
        {
            if (settings.isCompletelyBaked)
            {
                DrawBakedShadowParameters();
                return;
            }

            EditorGUILayout.PropertyField(m_AdditionalShadowData.resolution, s_Styles.shadowResolution);
            //EditorGUILayout.Slider(settings.shadowsBias, 0.001f, 1f, s_Styles.shadowBias);
            //EditorGUILayout.Slider(settings.shadowsNormalBias, 0.001f, 1f, s_Styles.shadowNormalBias);
            EditorGUILayout.Slider(m_AdditionalShadowData.viewBiasScale, 0.0f, 15.0f, s_Styles.viewBiasScale);
            EditorGUILayout.Slider(settings.shadowsNearPlane, 0.01f, 10f, s_Styles.shadowNearPlane);

            if (settings.isBakedOrMixed)
                DrawBakedShadowParameters();

            // There is currently no additional settings for shadow on directional light
            if (m_AdditionalLightData.showAdditionalSettings.boolValue)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Additional Settings", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;

                if (settings.lightType.enumValueIndex != (int)LightType.Directional)
                {
                    EditorGUILayout.PropertyField(m_AdditionalShadowData.fadeDistance, s_Styles.shadowFadeDistance);
                    EditorGUILayout.PropertyField(m_AdditionalShadowData.dimmer, s_Styles.shadowDimmer);
                }

                EditorGUILayout.Slider(m_AdditionalShadowData.viewBiasMin, 0.0f, 5.0f, s_Styles.viewBiasMin);
                //EditorGUILayout.PropertyField(m_AdditionalShadowData.viewBiasMax, s_Styles.viewBiasMax);
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.Slider(m_AdditionalShadowData.normalBiasMin, 0.0f, 5.0f, s_Styles.normalBiasMin);
                if (EditorGUI.EndChangeCheck())
                {
                    // Link min to max and don't expose normalBiasScale (useless when min == max)
                    m_AdditionalShadowData.normalBiasMax.floatValue = m_AdditionalShadowData.normalBiasMin.floatValue;
                }
                //EditorGUILayout.PropertyField(m_AdditionalShadowData.normalBiasMax, s_Styles.normalBiasMax);
                //EditorGUILayout.PropertyField(m_AdditionalShadowData.normalBiasScale, s_Styles.normalBiasScale);
                //EditorGUILayout.PropertyField(m_AdditionalShadowData.sampleBiasScale, s_Styles.sampleBiasScale);
                EditorGUILayout.PropertyField(m_AdditionalShadowData.edgeLeakFixup, s_Styles.edgeLeakFixup);
                if (m_AdditionalShadowData.edgeLeakFixup.boolValue)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(m_AdditionalShadowData.edgeToleranceNormal, s_Styles.edgeToleranceNormal);
                    EditorGUILayout.Slider(m_AdditionalShadowData.edgeTolerance, 0.0f, 1.0f, s_Styles.edgeTolerance);
                    EditorGUI.indentLevel--;
                }
                EditorGUI.indentLevel--;
            }
        }
        void DrawFeatures()
        {
            bool disabledScope = m_LightShape == LightShape.Line || (m_LightShape == LightShape.Rectangle && settings.isRealtime);

            using (new EditorGUI.DisabledScope(disabledScope))
            {
                bool shadowsEnabled = EditorGUILayout.Toggle(CoreEditorUtils.GetContent("Enable Shadows"), settings.shadowsType.enumValueIndex != 0);
                settings.shadowsType.enumValueIndex = shadowsEnabled ? (int)LightShadows.Hard : (int)LightShadows.None;
            }

            EditorGUILayout.PropertyField(m_AdditionalLightData.showAdditionalSettings);
        }
Exemple #30
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        ItemEvent itemEvent = (ItemEvent)target;

        _data = EditorGUILayout.ObjectField(_data, typeof(EquippableItemData), true) as EquippableItemData;
        if (GUILayout.Button("Raise ItemEvent"))
        {
            itemEvent.Raise(_data);
            _data = null;
        }
    }