Here are the examples of the csharp api UnityEngine.GUILayoutUtility.GetRect(UnityEngine.GUIContent, UnityEngine.GUIStyle, params UnityEngine.GUILayoutOption[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
40 Examples
19
View Source File : BreadcrumbDrawer.cs
License : MIT License
Project Creator : BattleDawnNZ
License : MIT License
Project Creator : BattleDawnNZ
static Rect GetBreadcrumbLayoutRect(GUIContent content, GUIStyle style)
{
// the image makes the button far too big compared to non-image versions
var image = content.image;
content.image = null;
var size = style.CalcSizeWithConstraints(content, Vector2.zero);
content.image = image;
if (image != null)
size.x += size.y; // replacedumes square image, constrained by height
return GUILayoutUtility.GetRect(content, style, GUILayout.MaxWidth(size.x));
}
19
View Source File : MessageCenter.ShadowAndOutline.cs
License : GNU General Public License v3.0
Project Creator : BepInEx
License : GNU General Public License v3.0
Project Creator : BepInEx
public static void DrawLayoutShadow(GUIContent content, GUIStyle style, Color txtColor, Color shadowColor, Vector2 direction, params GUILayoutOption[] options) => DrawShadow(GUILayoutUtility.GetRect(content, style, options), content, style, txtColor, shadowColor, direction);
19
View Source File : MessageCenter.ShadowAndOutline.cs
License : GNU General Public License v3.0
Project Creator : BepInEx
License : GNU General Public License v3.0
Project Creator : BepInEx
public static bool DrawLayoutButtonWithShadow(GUIContent content, GUIStyle style, float shadowAlpha, Vector2 direction, params GUILayoutOption[] options) => DrawButtonWithShadow(GUILayoutUtility.GetRect(content, style, options), content, style, shadowAlpha, direction);
19
View Source File : SettingFieldDrawer.cs
License : GNU Lesser General Public License v3.0
Project Creator : BepInEx
License : GNU Lesser General Public License v3.0
Project Creator : BepInEx
private static void DrawComboboxField(SettingEntryBase setting, IList list, float windowYmax)
{
var buttonText = ObjectToGuiContent(setting.Get());
var dispRect = GUILayoutUtility.GetRect(buttonText, GUI.skin.button, GUILayout.ExpandWidth(true));
if (!_comboBoxCache.TryGetValue(setting, out var box))
{
box = new ComboBox(dispRect, buttonText, list.Cast<object>().Select(ObjectToGuiContent).ToArray(), GUI.skin.button, windowYmax);
_comboBoxCache[setting] = box;
}
else
{
box.Rect = dispRect;
box.ButtonContent = buttonText;
}
box.Show(id =>
{
if (id >= 0 && id < list.Count)
setting.Set(list[id]);
});
}
19
View Source File : Toggle.cs
License : MIT License
Project Creator : cabarius
License : MIT License
Project Creator : cabarius
public static bool Toggle(GUIContent label, bool value, GUIContent on, GUIContent off, GUIStyle stateStyle, GUIStyle labelStyle, bool isEmpty = false, params GUILayoutOption[] options) {
var state = value ? on : off;
var sStyle = new GUIStyle(stateStyle);
var lStyle = new GUIStyle(labelStyle) {
wordWrap = false
};
var stateSize = sStyle.CalcSize(state);
lStyle.fixedHeight = stateSize.y - 2;
var padding = new RectOffset(0, (int)stateSize.x + 5, 0, 0);
lStyle.padding = padding;
var rect = GUILayoutUtility.GetRect(label, lStyle, options);
#if false
var labelSize = lStyle.CalcSize(label);
var width = stateSize.x + 10 + stateSize.x;
var height = Mathf.Max(stateSize.y, labelSize.y);
var rect = GUILayoutUtility.GetRect(width, height);
int controlID = GUIUtility.GetControlID(s_ButtonHint, FocusType.Preplacedive, rect);
var eventType = Event.current.GetTypeForControl(controlID);
Logger.Log($"event: {eventType.ToString()} label: {label.text} w: {width} h: {height} rect: {rect} options: {options.Length}");
#endif
return Toggle(rect, label, value, isEmpty, on, off, stateStyle, labelStyle);
}
19
View Source File : OVRPlatformTool.cs
License : MIT License
Project Creator : IanPhilips
License : MIT License
Project Creator : IanPhilips
void OnGUI()
{
if (boldFoldoutStyle == null)
{
boldFoldoutStyle = new GUIStyle(EditorStyles.foldout);
boldFoldoutStyle.fontStyle = FontStyle.Bold;
}
EditorGUIUtility.labelWidth = DEFAULT_LABEL_WIDTH;
GUILayout.Label("OVR Platform Tool", EditorStyles.boldLabel);
this.replacedleContent.text = "OVR Platform Tool";
GUIContent TargetPlatformLabel = new GUIContent("Target Oculus Platform");
OVRPlatformToolSettings.TargetPlatform = (TargetPlatform)MakePopup(TargetPlatformLabel, (int)OVRPlatformToolSettings.TargetPlatform, platformOptions);
SetOVRProjectConfig(OVRPlatformToolSettings.TargetPlatform);
SetDirtyOnGUIChange();
commandMenuScroll = EditorGUILayout.BeginScrollView(commandMenuScroll, GUILayout.Height(Screen.height / 2));
{
// Add the UI Form
EditorGUI.BeginChangeCheck();
GUILayout.Space(15.0f);
// App ID
GUIContent AppIDLabel = new GUIContent("Oculus Application ID [?]: ",
"This AppID will be used when uploading the build.");
OVRPlatformToolSettings.AppID = MakeTextBox(AppIDLabel, OVRPlatformToolSettings.AppID);
// App Token
GUIContent AppTokenLabel = new GUIContent("Oculus App Token [?]: ",
"You can get your app token from your app's Oculus API Dashboard.");
appToken = MakePreplacedwordBox(AppTokenLabel, appToken);
// Release Channel
GUIContent ReleaseChannelLabel = new GUIContent("Release Channel [?]: ",
"Specify the releaes channel of the new build, you can rereplacedign to other channels after upload.");
OVRPlatformToolSettings.ReleaseChannel = MakeTextBox(ReleaseChannelLabel, OVRPlatformToolSettings.ReleaseChannel);
// Releaes Note
GUIContent ReleaseNoteLabel = new GUIContent("Release Note: ");
OVRPlatformToolSettings.ReleaseNote = MakeTextBox(ReleaseNoteLabel, OVRPlatformToolSettings.ReleaseNote);
// Platform specific fields
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Rift)
{
GUIContent BuildDirLabel = new GUIContent("Rift Build Directory [?]: ",
"The full path to the directory containing your Rift build files.");
OVRPlatformToolSettings.RiftBuildDirectory = MakeFileDirectoryField(BuildDirLabel, OVRPlatformToolSettings.RiftBuildDirectory,
"Choose Rifle Build Directory");
GUIContent BuildVersionLabel = new GUIContent("Build Version [?]: ",
"The version number shown to users.");
OVRPlatformToolSettings.RiftBuildVersion = MakeTextBox(BuildVersionLabel, OVRPlatformToolSettings.RiftBuildVersion);
GUIContent LaunchFileLabel = new GUIContent("Launch File Path [?]: ",
"The full path to the executable that launches your app.");
OVRPlatformToolSettings.RiftLaunchFile = MakeFileDirectoryField(LaunchFileLabel, OVRPlatformToolSettings.RiftLaunchFile,
"Choose Launch File", true, "exe");
}
else
{
GUIContent ApkPathLabel = new GUIContent("Build APK File Path [?]: ",
"The full path to the APK file.");
OVRPlatformToolSettings.ApkBuildPath = MakeFileDirectoryField(ApkPathLabel, OVRPlatformToolSettings.ApkBuildPath,
"Choose APK File", true, "apk");
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.OculusGoGearVR)
{
// Go and Gear VR specific fields
}
else if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Quest)
{
// Quest specific fields
}
}
showOptionalCommands = EditorGUILayout.Foldout(showOptionalCommands, "Optional Commands", boldFoldoutStyle);
if (showOptionalCommands)
{
IncrementIndent();
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Rift)
{
// Launch Parameters
GUIContent LaunchParamLabel = new GUIContent("Launch Parameters [?]: ",
"Specifies any arguments preplaceded to the launcher.");
OVRPlatformToolSettings.RiftLaunchParams = MakeTextBox(LaunchParamLabel, OVRPlatformToolSettings.RiftLaunchParams);
GUIContent FirewallExceptionLabel = new GUIContent("Firewall Exception [?]: ",
"Specifies if a Windows Firewall exception is required.");
OVRPlatformToolSettings.RiftFirewallException = MakeToggleBox(FirewallExceptionLabel, OVRPlatformToolSettings.RiftFirewallException);
GUIContent GamepadEmulationLabel = new GUIContent("Gamepad Emulation [?]: ",
"Specifies the type of gamepad emulation used by the Oculus Touch controllers.");
OVRPlatformToolSettings.RiftGamepadEmulation = (OVRPlatformToolSettings.GamepadType)MakePopup(GamepadEmulationLabel, (int)OVRPlatformToolSettings.RiftGamepadEmulation, gamepadOptions);
show2DCommands = EditorGUILayout.Foldout(show2DCommands, "2D", boldFoldoutStyle);
if (show2DCommands)
{
IncrementIndent();
// 2D Launch File
GUIContent LaunchFile2DLabel = new GUIContent("2D Launch File [?]: ",
"The full path to the executable that launches your app in 2D mode.");
OVRPlatformToolSettings.Rift2DLaunchFile = MakeFileDirectoryField(LaunchFile2DLabel, OVRPlatformToolSettings.Rift2DLaunchFile,
"Choose 2D Launch File", true, "exe");
// 2D Launch Parameters
GUIContent LaunchParam2DLabel = new GUIContent("2D Launch Parameters [?]: ",
"Specifies any arguments preplaceded to the launcher in 2D mode.");
OVRPlatformToolSettings.Rift2DLaunchParams = MakeTextBox(LaunchParam2DLabel, OVRPlatformToolSettings.Rift2DLaunchParams);
DecrementIndent();
}
showRedistCommands = EditorGUILayout.Foldout(showRedistCommands, "Redistributable Packages", boldFoldoutStyle);
if (showRedistCommands)
{
IncrementIndent();
for (int i = 0; i < OVRPlatformToolSettings.RiftRedistPackages.Count; i++)
{
GUIContent RedistPackageLabel = new GUIContent(OVRPlatformToolSettings.RiftRedistPackages[i].name);
OVRPlatformToolSettings.RiftRedistPackages[i].include = MakeToggleBox(RedistPackageLabel, OVRPlatformToolSettings.RiftRedistPackages[i].include);
}
DecrementIndent();
}
showExpansionFileCommands = EditorGUILayout.Foldout(showExpansionFileCommands, "Expansion Files", boldFoldoutStyle);
if (showExpansionFileCommands)
{
IncrementIndent();
// Language Pack Directory
GUIContent LanguagePackLabel = new GUIContent("Language Pack Directory [?]: ",
"The full path to the directory containing the language packs");
OVRPlatformToolSettings.LanguagePackDirectory = MakeFileDirectoryField(LanguagePackLabel, OVRPlatformToolSettings.LanguagePackDirectory,
"Choose Language Pack Directory");
}
}
else
{
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.OculusGoGearVR)
{
// Go and Gear VR specific optional fields
}
else if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Quest)
{
// Quest specific optional fields
}
showExpansionFileCommands = EditorGUILayout.Foldout(showExpansionFileCommands, "Expansion Files", boldFoldoutStyle);
if (showExpansionFileCommands)
{
IncrementIndent();
// OBB File Path
GUIContent ObbPathLabel = new GUIContent("OBB File Path [?]: ",
"The full path to the OBB file.");
OVRPlatformToolSettings.ObbFilePath = MakeFileDirectoryField(ObbPathLabel, OVRPlatformToolSettings.ObbFilePath,
"Choose OBB File", true, "obb");
}
}
if (showExpansionFileCommands)
{
// replacedets Directory
GUIContent replacedetsDirLabel = new GUIContent("replacedets Directory [?]: ",
"The full path to the directory with DLCs for this build.");
string replacedetsDirectory = MakeFileDirectoryField(replacedetsDirLabel, OVRPlatformToolSettings.replacedetsDirectory,
"Choose replacedets Directory");
if (replacedetsDirectory != OVRPlatformToolSettings.replacedetsDirectory)
{
OVRPlatformToolSettings.replacedetsDirectory = replacedetsDirectory;
OVRPlatformToolSettings.replacedetConfigs.Clear();
if (!string.IsNullOrEmpty(OVRPlatformToolSettings.replacedetsDirectory))
{
DirectoryInfo dirInfo = new DirectoryInfo(OVRPlatformToolSettings.replacedetsDirectory);
FileInfo[] replacedetFiles = dirInfo.GetFiles();
foreach (FileInfo f in replacedetFiles)
{
OVRPlatformToolSettings.replacedetConfigs.Add(new replacedetConfig(f.Name));
}
}
EditorUtility.SetDirty(OVRPlatformToolSettings.Instance);
}
// Display bordered replacedet configuration list
GUILayout.Space(3f);
Rect rect = GUILayoutUtility.GetRect(0, GetreplacedetConfigElementHeight() + (replacedET_CONFIG_BACKGROUND_PADDING * 2),
GUILayout.ExpandWidth(true));
rect.x += (EditorGUI.indentLevel * INDENT_SPACING + 5);
rect.width -= (EditorGUI.indentLevel * INDENT_SPACING + 10);
DrawreplacedetConfigList(rect);
DecrementIndent();
}
EditorGUI.indentLevel--;
}
if (EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(OVRPlatformToolSettings.Instance);
}
}
EditorGUILayout.EndScrollView();
GUILayout.Space(SINGLE_LINE_SPACING);
GUILayout.FlexibleSpace();
// Run OVR Lint Option
EditorGUIUtility.labelWidth = DEFAULT_LABEL_WIDTH;
GUIContent RunOvrLintLabel = new GUIContent("Run OVR Lint (Recommended) [?]: ",
"Run OVR Lint tool to ensure project is optimized for performance and meets Oculus packaging requirement for publishing.");
OVRPlatformToolSettings.RunOvrLint = MakeToggleBox(RunOvrLintLabel, OVRPlatformToolSettings.RunOvrLint);
// Add an Upload button
GUI.enabled = !activeProcess;
GUIContent btnTxt = new GUIContent("Upload");
var rt = GUILayoutUtility.GetRect(btnTxt, GUI.skin.button, GUILayout.ExpandWidth(false));
var btnYPos = rt.center.y;
rt.center = new Vector2(EditorGUIUtility.currentViewWidth / 2 - rt.width / 2 - buttonPadding, btnYPos);
if (GUI.Button(rt, btnTxt, GUI.skin.button))
{
OVRPlugin.SendEvent("oculus_platform_tool", "upload");
OVRPlatformTool.log = string.Empty;
OnUpload(OVRPlatformToolSettings.TargetPlatform);
}
// Add a cancel button
GUI.enabled = activeProcess;
btnTxt = new GUIContent("Cancel");
rt = GUILayoutUtility.GetRect(btnTxt, GUI.skin.button, GUILayout.ExpandWidth(false));
rt.center = new Vector2(EditorGUIUtility.currentViewWidth / 2 + rt.width / 2 + buttonPadding, btnYPos);
if (GUI.Button(rt, btnTxt, GUI.skin.button))
{
if (EditorUtility.DisplayDialog("Cancel Upload Process", "Are you sure you want to cancel the upload process?", "Yes", "No"))
{
if (ovrPlatUtilProcess != null)
{
ovrPlatUtilProcess.Kill();
OVRPlatformTool.log += "Upload process was canceled\n";
}
}
}
GUI.enabled = true;
GUILayout.FlexibleSpace();
GUILayout.Space(SINGLE_LINE_SPACING);
debugLogScroll = EditorGUILayout.BeginScrollView(debugLogScroll);
GUIStyle logBoxStyle = new GUIStyle();
logBoxStyle.margin.left = 5;
logBoxStyle.wordWrap = true;
logBoxStyle.normal.textColor = logBoxStyle.focused.textColor = EditorStyles.label.normal.textColor;
EditorGUILayout.SelectableLabel(OVRPlatformTool.log, logBoxStyle, GUILayout.Height(position.height - 30));
EditorGUILayout.EndScrollView();
}
19
View Source File : IMGUIUtils.cs
License : GNU Lesser General Public License v3.0
Project Creator : IllusionMods
License : GNU Lesser General Public License v3.0
Project Creator : IllusionMods
public static void DrawLayoutLabelWithShadow(GUIContent content, GUIStyle style, Color txtColor, Color shadowColor, Vector2 direction, params GUILayoutOption[] options)
{
DrawLabelWithShadow(GUILayoutUtility.GetRect(content, style, options), content, style, txtColor, shadowColor, direction);
}
19
View Source File : IMGUIUtils.cs
License : GNU Lesser General Public License v3.0
Project Creator : IllusionMods
License : GNU Lesser General Public License v3.0
Project Creator : IllusionMods
public static bool DrawLayoutButtonWithShadow(GUIContent content, GUIStyle style, float shadowAlpha, Vector2 direction, params GUILayoutOption[] options)
{
return DrawButtonWithShadow(GUILayoutUtility.GetRect(content, style, options), content, style, shadowAlpha, direction);
}
19
View Source File : ReadmeEditor.cs
License : MIT License
Project Creator : Interactml
License : MIT License
Project Creator : Interactml
bool LinkLabel(GUIContent label, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(label, LinkStyle, options);
Handles.BeginGUI();
Handles.color = LinkStyle.normal.textColor;
Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI();
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, label, LinkStyle);
}
19
View Source File : MoverInspector.cs
License : MIT License
Project Creator : m969
License : MIT License
Project Creator : m969
void DrawRaycastArrayPreview()
{
if(mover.sensorType == Sensor.CastType.RaycastArray)
{
Rect _space;
GUILayout.Space(5);
_space = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(100));
Rect background = new Rect(_space.x + (_space.width - _space.height)/2f, _space.y, _space.height, _space.height);
EditorGUI.DrawRect(background, Color.grey);
float point_size = 3f;
Vector3[] _previewPositions = mover.raycastArrayPreviewPositions;
Vector2 center = new Vector2(background.x + background.width/2f, background.y + background.height/2f);
if(_previewPositions != null && _previewPositions.Length != 0)
{
for(int i = 0; i < _previewPositions.Length; i++)
{
Vector2 position = center + new Vector2(_previewPositions[i].x, _previewPositions[i].z) * background.width/2f * 0.9f;
EditorGUI.DrawRect(new Rect(position.x - point_size/2f, position.y - point_size/2f, point_size, point_size), Color.white);
}
}
if(_previewPositions != null && _previewPositions.Length != 0)
GUILayout.Label("Number of rays = " + _previewPositions.Length, EditorStyles.centeredGreyMiniLabel );
}
}
19
View Source File : ShadowAndOutline.cs
License : Apache License 2.0
Project Creator : ManlyMarco
License : Apache License 2.0
Project Creator : ManlyMarco
public static void DrawLayoutShadow(GUIContent content, GUIStyle style, Color txtColor, Color shadowColor, Vector2 direction, params GUILayoutOption[] options)
{
DrawShadow(GUILayoutUtility.GetRect(content, style, options), content, style, txtColor, shadowColor, direction);
}
19
View Source File : VariableFieldDrawer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco
License : GNU General Public License v3.0
Project Creator : ManlyMarco
private static void DrawComboboxField(ICacheEntry setting, IList list, object value)
{
var buttonText = new GUIContent(value.ToString());
var dispRect = GUILayoutUtility.GetRect(buttonText, GUI.skin.button, GUILayout.ExpandWidth(true));
if (!_comboBoxCache.TryGetValue(setting, out var box))
{
box = new ComboBox(dispRect, buttonText, list.Cast<object>().Select(x => new GUIContent(x.ToString())).ToArray(), InterfaceMaker.CustomSkin.button, Inspector.MaxWindowY);
_comboBoxCache[setting] = box;
}
else
{
box.Rect = dispRect;
box.ButtonContent = buttonText;
}
box.Show(id =>
{
if (id >= 0 && id < list.Count)
setting.SetValue(list[id]);
});
}
19
View Source File : EditorUtils.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public bool ClickableImage(Texture2D image, params GUILayoutOption[] options)
{
if (image == null)
{
return false;
}
GUIContent content = new GUIContent(image);
var position = GUILayoutUtility.GetRect(content, Styles.clickImg, options);
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, content, Styles.clickImg);
}
19
View Source File : EditorUtils.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public bool ClickableText(GUIContent content, params GUILayoutOption[] options)
{
if (content == null)
{
return false;
}
var position = GUILayoutUtility.GetRect(content, Styles.body, options);
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, content, Styles.body);
}
19
View Source File : EditorUtils.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public bool ClickableTextCentered(GUIContent content, params GUILayoutOption[] options)
{
if (content == null)
{
return false;
}
var position = GUILayoutUtility.GetRect(content, Styles.centeredBody, options);
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, content, Styles.centeredBody);
}
19
View Source File : EditorUtils.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public bool ClickableImgDescriptionBold(GUIContent content, params GUILayoutOption[] options)
{
if (content == null)
{
return false;
}
var position = GUILayoutUtility.GetRect(content, Styles.imgDescriptionBold, options);
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, content, Styles.imgDescriptionBold);
}
19
View Source File : EditorUtils.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public void AbstractBorder(GUIContent label, Color color, params GUILayoutOption[] options)
{
if (label == null)
{
return;
}
var position = GUILayoutUtility.GetRect(label, Styles.body, options);
Handles.BeginGUI();
Color oldColor = Handles.color;
Handles.color = color;
Handles.DrawLine(new Vector3(position.xMin, position.y), new Vector3(position.xMax, position.y));
Handles.color = oldColor;
Handles.EndGUI();
}
19
View Source File : EditorUtils.cs
License : MIT License
Project Creator : naivetang
License : MIT License
Project Creator : naivetang
public bool ClickableHeadingNonLocalized(GUIContent content, params GUILayoutOption[] options)
{
if (content == null)
{
return false;
}
var position = GUILayoutUtility.GetRect(content, Styles.heading, options);
Handles.BeginGUI();
Color oldColor = Handles.color;
Handles.color = Styles.heading.normal.textColor;
Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = oldColor;
Handles.EndGUI();
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, content, Styles.heading);
}
19
View Source File : ShadowCascadeSplitGUI.cs
License : GNU Lesser General Public License v3.0
Project Creator : pepeizq
License : GNU Lesser General Public License v3.0
Project Creator : pepeizq
public static void HandleCascadeSliderGUI(ref float[] normalizedCascadeParreplacedions)
{
EditorGUILayout.BeginHorizontal();
GUILayout.Space(EditorGUI.indentLevel * 15f);
// get the inspector width since we need it while drawing the parreplacedion rects.
// Only way currently is to reserve the block in the layout using GetRect(), and then immediately drawing the empty box
// to match the call to GetRect.
// From this point on, we move to non-layout based code.
var sliderRect = GUILayoutUtility.GetRect(GUIContent.none
, s_CascadeSliderBG
, GUILayout.Height(kSliderbarTopMargin + kSliderbarHeight + kSliderbarBottomMargin)
, GUILayout.ExpandWidth(true));
GUI.Box(sliderRect, GUIContent.none);
EditorGUILayout.EndHorizontal();
float currentX = sliderRect.x;
float cascadeBoxStartY = sliderRect.y + kSliderbarTopMargin;
float cascadeSliderWidth = sliderRect.width - (normalizedCascadeParreplacedions.Length * kParreplacedionHandleWidth);
Color origTextColor = GUI.color;
Color origBackgroundColor = GUI.backgroundColor;
int colorIndex = -1;
// setup the array locally with the last parreplacedion
float[] adjustedCascadeParreplacedions = new float[normalizedCascadeParreplacedions.Length + 1];
System.Array.Copy(normalizedCascadeParreplacedions, adjustedCascadeParreplacedions, normalizedCascadeParreplacedions.Length);
adjustedCascadeParreplacedions[adjustedCascadeParreplacedions.Length - 1] = 1.0f - normalizedCascadeParreplacedions.Sum();
// check for user input on any of the parreplacedion handles
// this mechanism gets the current event in the queue... make sure that the mouse is over our control before consuming the event
int sliderControlId = GUIUtility.GetControlID(s_CascadeSliderId, FocusType.Preplacedive);
Event currentEvent = Event.current;
int hotParreplacedionHandleIndex = -1; // the index of any parreplacedion handle that we are hovering over or dragging
// draw each cascade parreplacedion
for (int i = 0; i < adjustedCascadeParreplacedions.Length; ++i)
{
float currentParreplacedion = adjustedCascadeParreplacedions[i];
colorIndex = (colorIndex + 1) % kCascadeColors.Length;
GUI.backgroundColor = kCascadeColors[colorIndex];
float boxLength = (cascadeSliderWidth * currentParreplacedion);
// main cascade box
Rect parreplacedionRect = new Rect(currentX, cascadeBoxStartY, boxLength, kSliderbarHeight);
GUI.Box(parreplacedionRect, GUIContent.none, s_CascadeSliderBG);
currentX += boxLength;
// cascade box percentage text
GUI.color = Color.white;
Rect textRect = parreplacedionRect;
var cascadeText = string.Format("{0}\n{1:F1}%", i, currentParreplacedion * 100.0f);
GUI.Label(textRect, cascadeText, s_TextCenteredStyle);
// no need to draw the parreplacedion handle for last box
if (i == adjustedCascadeParreplacedions.Length - 1)
break;
// parreplacedion handle
GUI.backgroundColor = Color.black;
Rect handleRect = parreplacedionRect;
handleRect.x = currentX;
handleRect.width = kParreplacedionHandleWidth;
GUI.Box(handleRect, GUIContent.none, s_CascadeSliderBG);
// we want a thin handle visually (since wide black bar looks bad), but a slightly larger
// hit area for easier manipulation
Rect handleHitRect = handleRect;
handleHitRect.xMin -= kParreplacedionHandleExtraHitAreaWidth;
handleHitRect.xMax += kParreplacedionHandleExtraHitAreaWidth;
if (handleHitRect.Contains(currentEvent.mousePosition))
hotParreplacedionHandleIndex = i;
// add regions to slider where the cursor changes to Resize-Horizontal
if (s_DragCache == null)
{
EditorGUIUtility.AddCursorRect(handleHitRect, MouseCursor.ResizeHorizontal, sliderControlId);
}
currentX += kParreplacedionHandleWidth;
}
GUI.color = origTextColor;
GUI.backgroundColor = origBackgroundColor;
EventType eventType = currentEvent.GetTypeForControl(sliderControlId);
switch (eventType)
{
case EventType.MouseDown:
if (hotParreplacedionHandleIndex >= 0)
{
s_DragCache = new DragCache(hotParreplacedionHandleIndex, normalizedCascadeParreplacedions[hotParreplacedionHandleIndex], currentEvent.mousePosition);
if (GUIUtility.hotControl == 0)
GUIUtility.hotControl = sliderControlId;
currentEvent.Use();
// Switch active scene view into shadow cascades visualization mode, once we start
// tweaking cascade splits.
if (s_RestoreSceneView == null)
{
s_RestoreSceneView = SceneView.lastActiveSceneView;
if (s_RestoreSceneView != null)
{
s_OldSceneDrawMode = s_RestoreSceneView.cameraMode;
#if UNITY_2019_1_OR_NEWER
s_OldSceneLightingMode = s_RestoreSceneView.sceneLighting;
#else
s_OldSceneLightingMode = s_RestoreSceneView.m_SceneLighting;
#endif
s_RestoreSceneView.cameraMode = SceneView.GetBuiltinCameraMode(DrawCameraMode.ShadowCascades);
}
}
}
break;
case EventType.MouseUp:
// mouseUp event anywhere should release the hotcontrol (if it belongs to us), drags (if any)
if (GUIUtility.hotControl == sliderControlId)
{
GUIUtility.hotControl = 0;
currentEvent.Use();
}
s_DragCache = null;
// Restore previous scene view drawing mode once we stop tweaking cascade splits.
if (s_RestoreSceneView != null)
{
s_RestoreSceneView.cameraMode = s_OldSceneDrawMode;
#if UNITY_2019_1_OR_NEWER
s_RestoreSceneView.sceneLighting = s_OldSceneLightingMode;
#else
s_RestoreSceneView.m_SceneLighting = s_OldSceneLightingMode;
#endif
s_RestoreSceneView = null;
}
break;
case EventType.MouseDrag:
if (GUIUtility.hotControl != sliderControlId)
break;
// convert the mouse movement to normalized cascade width. Make sure that we are safe to apply the delta before using it.
float delta = (currentEvent.mousePosition - s_DragCache.m_LastCachedMousePosition).x / cascadeSliderWidth;
bool isLeftParreplacedionHappy = ((adjustedCascadeParreplacedions[s_DragCache.m_ActiveParreplacedion] + delta) > 0.0f);
bool isRightParreplacedionHappy = ((adjustedCascadeParreplacedions[s_DragCache.m_ActiveParreplacedion + 1] - delta) > 0.0f);
if (isLeftParreplacedionHappy && isRightParreplacedionHappy)
{
s_DragCache.m_NormalizedParreplacedionSize += delta;
normalizedCascadeParreplacedions[s_DragCache.m_ActiveParreplacedion] = s_DragCache.m_NormalizedParreplacedionSize;
if (s_DragCache.m_ActiveParreplacedion < normalizedCascadeParreplacedions.Length - 1)
normalizedCascadeParreplacedions[s_DragCache.m_ActiveParreplacedion + 1] -= delta;
GUI.changed = true;
}
s_DragCache.m_LastCachedMousePosition = currentEvent.mousePosition;
currentEvent.Use();
break;
}
}
19
View Source File : RangeSlider.cs
License : GNU General Public License v3.0
Project Creator : Sauceke
License : GNU General Public License v3.0
Project Creator : Sauceke
public static void Create(ref float lower, ref float upper, float min, float max, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(GUIContent.none, sliderStyle, options);
int id = GUIUtility.GetControlID("Slider".GetHashCode(), FocusType.Preplacedive, position);
new RangeSlider(position, lower, upper, min, max, id).Handle(out lower, out upper);
}
19
View Source File : NeodroidEditorUtilities.cs
License : Apache License 2.0
Project Creator : sintefneodroid
License : Apache License 2.0
Project Creator : sintefneodroid
public static bool LinkLabel(GUIContent label,
GUIStyle link_style = null,
params GUILayoutOption[] options) {
if (link_style == null) {
link_style = _default_link_style;
}
var position = GUILayoutUtility.GetRect(label, link_style, options);
Handles.BeginGUI();
Handles.color = link_style.normal.textColor;
Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI();
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return GUI.Button(position, label, link_style);
}
19
View Source File : ReadmeEditor.cs
License : MIT License
Project Creator : SmallPlanet
License : MIT License
Project Creator : SmallPlanet
bool LinkLabel (GUIContent label, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(label, LinkStyle, options);
Handles.BeginGUI ();
Handles.color = LinkStyle.normal.textColor;
Handles.DrawLine (new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI ();
EditorGUIUtility.AddCursorRect (position, MouseCursor.Link);
return GUI.Button (position, label, LinkStyle);
}
19
View Source File : OVRPlatformTool.cs
License : MIT License
Project Creator : Tobbse
License : MIT License
Project Creator : Tobbse
void OnGUI()
{
if (boldFoldoutStyle == null)
{
boldFoldoutStyle = new GUIStyle(EditorStyles.foldout);
boldFoldoutStyle.fontStyle = FontStyle.Bold;
}
EditorGUIUtility.labelWidth = DEFAULT_LABEL_WIDTH;
GUILayout.Label("OVR Platform Tool", EditorStyles.boldLabel);
this.replacedleContent.text = "OVR Platform Tool";
GUIContent TargetPlatformLabel = new GUIContent("Target Oculus Platform");
OVRPlatformToolSettings.TargetPlatform = (TargetPlatform)MakePopup(TargetPlatformLabel, (int)OVRPlatformToolSettings.TargetPlatform, platformOptions);
SetOVRProjectConfig(OVRPlatformToolSettings.TargetPlatform);
SetDirtyOnGUIChange();
commandMenuScroll = EditorGUILayout.BeginScrollView(commandMenuScroll, GUILayout.Height(Screen.height / 2));
{
// Add the UI Form
EditorGUI.BeginChangeCheck();
GUILayout.Space(15.0f);
// App ID
GUIContent AppIDLabel = new GUIContent("Oculus Application ID [?]: ",
"This AppID will be used when uploading the build.");
OVRPlatformToolSettings.AppID = MakeTextBox(AppIDLabel, OVRPlatformToolSettings.AppID);
// App Token
GUIContent AppTokenLabel = new GUIContent("Oculus App Token [?]: ",
"You can get your app token from your app's Oculus API Dashboard.");
OVRPlatformToolSettings.AppToken = MakePreplacedwordBox(AppTokenLabel, OVRPlatformToolSettings.AppToken);
// Release Channel
GUIContent ReleaseChannelLabel = new GUIContent("Release Channel [?]: ",
"Specify the releaes channel of the new build, you can rereplacedign to other channels after upload.");
OVRPlatformToolSettings.ReleaseChannel = MakeTextBox(ReleaseChannelLabel, OVRPlatformToolSettings.ReleaseChannel);
// Releaes Note
GUIContent ReleaseNoteLabel = new GUIContent("Release Note: ");
OVRPlatformToolSettings.ReleaseNote = MakeTextBox(ReleaseNoteLabel, OVRPlatformToolSettings.ReleaseNote);
// Platform specific fields
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Rift)
{
GUIContent BuildDirLabel = new GUIContent("Rift Build Directory [?]: ",
"The full path to the directory containing your Rift build files.");
OVRPlatformToolSettings.RiftBuildDirectory = MakeFileDirectoryField(BuildDirLabel, OVRPlatformToolSettings.RiftBuildDirectory,
"Choose Rifle Build Directory");
GUIContent BuildVersionLabel = new GUIContent("Build Version [?]: ",
"The version number shown to users.");
OVRPlatformToolSettings.RiftBuildVersion = MakeTextBox(BuildVersionLabel, OVRPlatformToolSettings.RiftBuildVersion);
GUIContent LaunchFileLabel = new GUIContent("Launch File Path [?]: ",
"The full path to the executable that launches your app.");
OVRPlatformToolSettings.RiftLaunchFile = MakeFileDirectoryField(LaunchFileLabel, OVRPlatformToolSettings.RiftLaunchFile,
"Choose Launch File", true, "exe");
}
else
{
GUIContent ApkPathLabel = new GUIContent("Build APK File Path [?]: ",
"The full path to the APK file.");
OVRPlatformToolSettings.ApkBuildPath = MakeFileDirectoryField(ApkPathLabel, OVRPlatformToolSettings.ApkBuildPath,
"Choose APK File", true, "apk");
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.OculusGoGearVR)
{
// Go and Gear VR specific fields
}
else if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Quest)
{
// Quest specific fields
}
}
showOptionalCommands = EditorGUILayout.Foldout(showOptionalCommands, "Optional Commands", boldFoldoutStyle);
if (showOptionalCommands)
{
IncrementIndent();
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Rift)
{
// Launch Parameters
GUIContent LaunchParamLabel = new GUIContent("Launch Parameters [?]: ",
"Specifies any arguments preplaceded to the launcher.");
OVRPlatformToolSettings.RiftLaunchParams = MakeTextBox(LaunchParamLabel, OVRPlatformToolSettings.RiftLaunchParams);
GUIContent FirewallExceptionLabel = new GUIContent("Firewall Exception [?]: ",
"Specifies if a Windows Firewall exception is required.");
OVRPlatformToolSettings.RiftFirewallException = MakeToggleBox(FirewallExceptionLabel, OVRPlatformToolSettings.RiftFirewallException);
GUIContent GamepadEmulationLabel = new GUIContent("Gamepad Emulation [?]: ",
"Specifies the type of gamepad emulation used by the Oculus Touch controllers.");
OVRPlatformToolSettings.RiftGamepadEmulation = (OVRPlatformToolSettings.GamepadType)MakePopup(GamepadEmulationLabel, (int)OVRPlatformToolSettings.RiftGamepadEmulation, gamepadOptions);
show2DCommands = EditorGUILayout.Foldout(show2DCommands, "2D", boldFoldoutStyle);
if (show2DCommands)
{
IncrementIndent();
// 2D Launch File
GUIContent LaunchFile2DLabel = new GUIContent("2D Launch File [?]: ",
"The full path to the executable that launches your app in 2D mode.");
OVRPlatformToolSettings.Rift2DLaunchFile = MakeFileDirectoryField(LaunchFile2DLabel, OVRPlatformToolSettings.Rift2DLaunchFile,
"Choose 2D Launch File", true, "exe");
// 2D Launch Parameters
GUIContent LaunchParam2DLabel = new GUIContent("2D Launch Parameters [?]: ",
"Specifies any arguments preplaceded to the launcher in 2D mode.");
OVRPlatformToolSettings.Rift2DLaunchParams = MakeTextBox(LaunchParam2DLabel, OVRPlatformToolSettings.Rift2DLaunchParams);
DecrementIndent();
}
showRedistCommands = EditorGUILayout.Foldout(showRedistCommands, "Redistributable Packages", boldFoldoutStyle);
if (showRedistCommands)
{
IncrementIndent();
for (int i = 0; i < OVRPlatformToolSettings.RiftRedistPackages.Count; i++)
{
GUIContent RedistPackageLabel = new GUIContent(OVRPlatformToolSettings.RiftRedistPackages[i].name);
OVRPlatformToolSettings.RiftRedistPackages[i].include = MakeToggleBox(RedistPackageLabel, OVRPlatformToolSettings.RiftRedistPackages[i].include);
}
DecrementIndent();
}
showExpansionFileCommands = EditorGUILayout.Foldout(showExpansionFileCommands, "Expansion Files", boldFoldoutStyle);
if (showExpansionFileCommands)
{
IncrementIndent();
// Language Pack Directory
GUIContent LanguagePackLabel = new GUIContent("Language Pack Directory [?]: ",
"The full path to the directory containing the language packs");
OVRPlatformToolSettings.LanguagePackDirectory = MakeFileDirectoryField(LanguagePackLabel, OVRPlatformToolSettings.LanguagePackDirectory,
"Choose Language Pack Directory");
}
}
else
{
if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.OculusGoGearVR)
{
// Go and Gear VR specific optional fields
}
else if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Quest)
{
// Quest specific optional fields
}
showExpansionFileCommands = EditorGUILayout.Foldout(showExpansionFileCommands, "Expansion Files", boldFoldoutStyle);
if (showExpansionFileCommands)
{
IncrementIndent();
// OBB File Path
GUIContent ObbPathLabel = new GUIContent("OBB File Path [?]: ",
"The full path to the OBB file.");
OVRPlatformToolSettings.ObbFilePath = MakeFileDirectoryField(ObbPathLabel, OVRPlatformToolSettings.ObbFilePath,
"Choose OBB File", true, "obb");
}
}
if (showExpansionFileCommands)
{
// replacedets Directory
GUIContent replacedetsDirLabel = new GUIContent("replacedets Directory [?]: ",
"The full path to the directory with DLCs for this build.");
string replacedetsDirectory = MakeFileDirectoryField(replacedetsDirLabel, OVRPlatformToolSettings.replacedetsDirectory,
"Choose replacedets Directory");
if (replacedetsDirectory != OVRPlatformToolSettings.replacedetsDirectory)
{
OVRPlatformToolSettings.replacedetsDirectory = replacedetsDirectory;
OVRPlatformToolSettings.replacedetConfigs.Clear();
if (!string.IsNullOrEmpty(OVRPlatformToolSettings.replacedetsDirectory))
{
DirectoryInfo dirInfo = new DirectoryInfo(OVRPlatformToolSettings.replacedetsDirectory);
FileInfo[] replacedetFiles = dirInfo.GetFiles();
foreach (FileInfo f in replacedetFiles)
{
OVRPlatformToolSettings.replacedetConfigs.Add(new replacedetConfig(f.Name));
}
}
EditorUtility.SetDirty(OVRPlatformToolSettings.Instance);
}
// Display bordered replacedet configuration list
GUILayout.Space(3f);
Rect rect = GUILayoutUtility.GetRect(0, GetreplacedetConfigElementHeight() + (replacedET_CONFIG_BACKGROUND_PADDING * 2),
GUILayout.ExpandWidth(true));
rect.x += (EditorGUI.indentLevel * INDENT_SPACING + 5);
rect.width -= (EditorGUI.indentLevel * INDENT_SPACING + 10);
DrawreplacedetConfigList(rect);
DecrementIndent();
}
EditorGUI.indentLevel--;
}
if (EditorGUI.EndChangeCheck())
{
EditorUtility.SetDirty(OVRPlatformToolSettings.Instance);
}
}
EditorGUILayout.EndScrollView();
GUILayout.Space(SINGLE_LINE_SPACING);
GUILayout.FlexibleSpace();
// Add an Upload button
GUI.enabled = !activeProcess;
GUIContent btnTxt = new GUIContent("Upload");
var rt = GUILayoutUtility.GetRect(btnTxt, GUI.skin.button, GUILayout.ExpandWidth(false));
var btnYPos = rt.center.y;
rt.center = new Vector2(EditorGUIUtility.currentViewWidth / 2 - rt.width / 2 - buttonPadding, btnYPos);
if (GUI.Button(rt, btnTxt, GUI.skin.button))
{
OVRPlugin.SendEvent("oculus_platform_tool", "upload");
OVRPlatformTool.log = string.Empty;
OnUpload(OVRPlatformToolSettings.TargetPlatform);
}
// Add a cancel button
GUI.enabled = activeProcess;
btnTxt = new GUIContent("Cancel");
rt = GUILayoutUtility.GetRect(btnTxt, GUI.skin.button, GUILayout.ExpandWidth(false));
rt.center = new Vector2(EditorGUIUtility.currentViewWidth / 2 + rt.width / 2 + buttonPadding, btnYPos);
if (GUI.Button(rt, btnTxt, GUI.skin.button))
{
if (EditorUtility.DisplayDialog("Cancel Upload Process", "Are you sure you want to cancel the upload process?", "Yes", "No"))
{
if (ovrPlatUtilProcess != null)
{
ovrPlatUtilProcess.Kill();
OVRPlatformTool.log += "Upload process was canceled\n";
}
}
}
GUI.enabled = true;
GUILayout.FlexibleSpace();
GUILayout.Space(SINGLE_LINE_SPACING);
debugLogScroll = EditorGUILayout.BeginScrollView(debugLogScroll);
GUIStyle logBoxStyle = new GUIStyle();
logBoxStyle.wordWrap = true;
logBoxStyle.normal.textColor = logBoxStyle.focused.textColor = EditorStyles.label.normal.textColor;
EditorGUILayout.SelectableLabel(OVRPlatformTool.log, logBoxStyle, GUILayout.Height(position.height - 30));
EditorGUILayout.EndScrollView();
}
19
View Source File : DelightingToolVisualContainer.cs
License : MIT License
Project Creator : Unity-Technologies
License : MIT License
Project Creator : Unity-Technologies
public override void OnGUI()
{
var resizeHandleId = EditorGUIUtility.GetControlID(kResizeHandle, FocusType.Preplacedive);
GUILayout.BeginHorizontal();
GUILayout.BeginHorizontal(GUILayout.Width(m_SpliterPosition));
m_InspectorToolbar.OnGUI();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
m_CanvasToolbar.OnGUI();
GUILayout.EndHorizontal();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.BeginVertical(GUILayout.Width(m_SpliterPosition));
m_Inspector.OnGUI();
GUILayout.EndVertical();
m_SpliterPosition = EditorGUIXLayout.HorizontalHandle(resizeHandleId, m_SpliterPosition, kMinSplitterPosition, kMaxSplitterPosition);
m_Canvas.OnGUI();
GUILayout.EndHorizontal();
var progressRect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.Height(EditorGUIUtility.singleLineHeight));
if (GetValue(kLoadingShow))
EditorGUI.ProgressBar(progressRect, GetValue(kLoadingProgress), GetValue(kLoadingContent));
else
EditorGUI.ProgressBar(progressRect, 0, string.Empty);
}
19
View Source File : EditorGUIX.Canvas.cs
License : MIT License
Project Creator : Unity-Technologies
License : MIT License
Project Creator : Unity-Technologies
public static void Canvas(int controlId, ref Vector2 cameraPosition, ref float zoom, float[] zoomLevels = null, params GUILayoutOption[] options)
{
var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, options);
EditorGUIX.Canvas(controlId, rect, ref cameraPosition, ref zoom, zoomLevels);
}
19
View Source File : EditorGUIX.InputFields.cs
License : MIT License
Project Creator : Unity-Technologies
License : MIT License
Project Creator : Unity-Technologies
public static bool InspectorFoldout(bool value, GUIContent content, EditorGUIX.FieldIcon icon = EditorGUIX.FieldIcon.None)
{
var rect = GUILayoutUtility.GetRect(content, EditorGUIX.Styles.inspectorBackground, GUILayout.ExpandWidth(true));
return EditorGUIX.InspectorFoldout(rect, value, content, icon);
}
19
View Source File : EditorGUIX.Resize.cs
License : MIT License
Project Creator : Unity-Technologies
License : MIT License
Project Creator : Unity-Technologies
public static float VerticalHandle(int controlId, float size, float minSize = float.MinValue, float maxSize = float.MaxValue)
{
var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.Height(EditorGUIX.Styles.handleSize));
return EditorGUIX.VerticalHandle(controlId, rect, size, minSize, maxSize);
}
19
View Source File : EditorGUIX.Resize.cs
License : MIT License
Project Creator : Unity-Technologies
License : MIT License
Project Creator : Unity-Technologies
public static float HorizontalHandle(int controlId, float size, float minSize = float.MinValue, float maxSize = float.MaxValue)
{
var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Width(EditorGUIX.Styles.handleSize), GUILayout.ExpandHeight(true));
return EditorGUIX.HorizontalHandle(controlId, rect, size, minSize, maxSize);
}
19
View Source File : EditorGUIX.Dropzone.cs
License : MIT License
Project Creator : Unity-Technologies
License : MIT License
Project Creator : Unity-Technologies
public static bool DropZone(int controlId, Func<UnityObject[], string[], DragAndDropVisualMode> canAcceptCallback)
{
var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
return EditorGUIX.DropZone(controlId, rect, canAcceptCallback);
}
19
View Source File : EditorGUIX.Dropzone.cs
License : MIT License
Project Creator : Unity-Technologies
License : MIT License
Project Creator : Unity-Technologies
public static void DropZoneHint(GUIContent text = null, GUIContent icon = null)
{
var rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
EditorGUIX.DropZoneHint(rect, text, icon);
}
19
View Source File : EditorGUILayoutExtension.cs
License : MIT License
Project Creator : wqaetly
License : MIT License
Project Creator : wqaetly
private static Rect LinkLabelField_internal(GUIContent label, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(label, LinkStyle, options);
Handles.BeginGUI();
Handles.color = LinkStyle.normal.textColor;
Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI();
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return position;
}
19
View Source File : EditorGUILayoutExtension.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
private static Rect LinkLabelField_internal(GUIContent label, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(label, LinkStyle, options);
Handles.BeginGUI();
Handles.color = LinkStyle.normal.textColor;
Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI();
EditorGUIUtility.AddCursorRect(position, MouseCursor.Link);
return position;
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject[] DragDropAreaMulti(params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaMulti(rect);
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject[] DragDropAreaMulti(DragAndDropVisualMode _dropVisualMode, params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaMulti(rect, _dropVisualMode);
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject[] DragDropAreaMulti(Color _hightlightColor, params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaMulti(rect, _hightlightColor);
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject[] DragDropAreaMulti(DragAndDropVisualMode _dropVisualMode, Color _hightlightColor, params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaMulti(rect, _dropVisualMode, _hightlightColor);
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject DragDropAreaSingle(params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaSingle(rect);
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject DragDropAreaSingle(DragAndDropVisualMode _dropVisualMode, params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaSingle(rect, _dropVisualMode);
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject DragDropAreaSingle(Color _hightlightColor, params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaSingle(rect, _hightlightColor);
}
19
View Source File : EditorGUILayoutExtension_DragDropArea.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static UnityObject DragDropAreaSingle(Rect _rect, DragAndDropVisualMode _dropVisualMode, Color _hightlightColor, params GUILayoutOption[] _options)
{
Rect rect = GUILayoutUtility.GetRect(new GUIContent(), GUI.skin.label, _options);
return EditorGUIExtension.DragDropAreaSingle(rect, _dropVisualMode, _hightlightColor);
}