Here are the examples of the csharp api UnityEngine.GUILayout.Space(float) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1005 Examples
19
View Source File : PublishView.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
public override void OnGUI()
{
GUILayout.BeginHorizontal(Styles.AuthHeaderBoxStyle);
{
GUILayout.Label(PublishToGithubLabel, EditorStyles.boldLabel);
}
GUILayout.EndHorizontal();
EditorGUI.BeginDisabledGroup(isBusy);
{
if (connections.Length > 1)
{
EditorGUI.BeginChangeCheck();
{
selectedConnection = EditorGUILayout.Popup("Connections:", selectedConnection, connectionLabels);
}
if (EditorGUI.EndChangeCheck())
{
selectedClient = GetApiClient(connections[selectedConnection]);
ownersNeedLoading = true;
Redraw();
}
}
selectedOwner = EditorGUILayout.Popup(SelectedOwnerLabel, selectedOwner, owners);
repoName = EditorGUILayout.TextField(RepositoryNameLabel, repoName);
repoDescription = EditorGUILayout.TextField(DescriptionLabel, repoDescription);
togglePrivate = EditorGUILayout.Toggle(CreatePrivateRepositoryLabel, togglePrivate);
var repoPrivacyExplanation = togglePrivate ? PrivateRepoMessage : PublicRepoMessage;
EditorGUILayout.HelpBox(repoPrivacyExplanation, MessageType.None);
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
EditorGUI.BeginDisabledGroup(!IsFormValid);
if (GUILayout.Button(PublishViewCreateButton))
{
GUI.FocusControl(null);
isBusy = true;
var organization = owners[selectedOwner] == connections[selectedConnection].Username ? null : owners[selectedOwner];
var cleanRepoDescription = repoDescription.Trim();
cleanRepoDescription = string.IsNullOrEmpty(cleanRepoDescription) ? null : cleanRepoDescription;
selectedClient.CreateRepository(repoName, cleanRepoDescription, togglePrivate, (repository, ex) =>
{
if (ex != null)
{
Logger.Error(ex, "Repository Create Error Type:{0}", ex.GetType().ToString());
error = GetPublishErrorMessage(ex);
isBusy = false;
return;
}
UsageTracker.IncrementPublishViewButtonPublish();
if (repository == null)
{
Logger.Warning("Returned Repository is null");
isBusy = false;
return;
}
Repository.RemoteAdd("origin", repository.CloneUrl)
.Then(Repository.Push("origin"))
.ThenInUI(Finish)
.Start();
}, organization);
}
EditorGUI.EndDisabledGroup();
}
GUILayout.EndHorizontal();
GUILayout.Space(10);
if (error != null)
EditorGUILayout.HelpBox(error, MessageType.Error);
GUILayout.FlexibleSpace();
}
EditorGUI.EndDisabledGroup();
}
19
View Source File : SettingsView.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
public override void OnGUI()
{
scroll = GUILayout.BeginScrollView(scroll);
{
userSettingsView.OnGUI();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
if (Repository != null)
{
OnRepositorySettingsGUI();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
}
gitPathView.OnGUI();
OnPrivacyGui();
OnGeneralSettingsGui();
OnLoggingSettingsGui();
}
GUILayout.EndScrollView();
DoProgressGUI();
}
19
View Source File : BranchesView.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
private void OnTreeGUI(Rect rect)
{
var treeRenderRect = new Rect(0f, 0f, 0f, 0f);
if (treeLocals != null && treeRemotes != null)
{
treeLocals.FolderStyle = Styles.Foldout;
treeLocals.TreeNodeStyle = Styles.TreeNode;
treeLocals.ActiveTreeNodeStyle = Styles.ActiveTreeNode;
treeLocals.FocusedTreeNodeStyle = Styles.FocusedTreeNode;
treeLocals.FocusedActiveTreeNodeStyle = Styles.FocusedActiveTreeNode;
treeRemotes.FolderStyle = Styles.Foldout;
treeRemotes.TreeNodeStyle = Styles.TreeNode;
treeRemotes.ActiveTreeNodeStyle = Styles.ActiveTreeNode;
treeRemotes.FocusedTreeNodeStyle = Styles.FocusedTreeNode;
treeRemotes.FocusedActiveTreeNodeStyle = Styles.FocusedActiveTreeNode;
var treeHadFocus = treeLocals.SelectedNode != null;
treeRenderRect = treeLocals.Render(rect, scroll,
node => { },
node => {
if (node.IsFolder)
return;
if (node.IsActive)
return;
SwitchBranch(node.Path);
},
node => {
if (node.IsFolder)
return;
var menu = CreateContextMenuForLocalBranchNode(node);
menu.ShowAsContext();
});
if (treeHadFocus && treeLocals.SelectedNode == null)
treeRemotes.Focus();
else if (!treeHadFocus && treeLocals.SelectedNode != null)
treeRemotes.Blur();
if (treeLocals.RequiresRepaint)
Redraw();
treeHadFocus = treeRemotes.SelectedNode != null;
treeRenderRect.y += Styles.TreePadding;
var treeRemoteDisplayRect = new Rect(rect.x, treeRenderRect.y, rect.width, rect.height);
treeRenderRect = treeRemotes.Render(treeRemoteDisplayRect, scroll,
node => { },
node => {
if (node.IsFolder)
return;
CheckoutRemoteBranch(node.Path);
},
node => {
if (node.IsFolder)
return;
var menu = CreateContextMenuForRemoteBranchNode(node);
menu.ShowAsContext();
});
if (treeHadFocus && treeRemotes.SelectedNode == null)
treeLocals.Focus();
else if (!treeHadFocus && treeRemotes.SelectedNode != null)
treeLocals.Blur();
if (treeRemotes.RequiresRepaint)
Redraw();
}
GUILayout.Space(treeRenderRect.y - rect.y);
}
19
View Source File : ChangesView.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
private void OnTreeGUI(Rect rect)
{
if (treeChanges != null)
{
treeChanges.FolderStyle = Styles.Foldout;
treeChanges.TreeNodeStyle = Styles.TreeNode;
treeChanges.ActiveTreeNodeStyle = Styles.ActiveTreeNode;
treeChanges.FocusedTreeNodeStyle = Styles.FocusedTreeNode;
treeChanges.FocusedActiveTreeNodeStyle = Styles.FocusedActiveTreeNode;
var treeRenderRect = treeChanges.Render(rect, treeScroll,
node => { },
node => { },
node => {
var menu = CreateContextMenu(node);
menu.ShowAsContext();
});
if (treeChanges.RequiresRepaint)
Redraw();
GUILayout.Space(treeRenderRect.y - rect.y);
}
}
19
View Source File : GitHubEnterpriseAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
public override void OnGUI()
{
HandleEnterPressed();
EditorGUIUtility.labelWidth = 90f;
scroll = GUILayout.BeginScrollView(scroll);
{
GUILayout.BeginHorizontal(Styles.AuthHeaderBoxStyle);
{
GUILayout.Label(Authreplacedle, Styles.HeaderRepoLabelStyle);
}
GUILayout.EndHorizontal();
GUILayout.BeginVertical();
{
if (!hreplacederverMeta)
{
OnGUIHost();
}
else
{
EditorGUILayout.Space();
EditorGUI.BeginDisabledGroup(true);
{
GUILayout.BeginHorizontal();
{
serverAddress = EditorGUILayout.TextField(ServerAddressLabel, serverAddress, Styles.TextFieldStyle);
}
GUILayout.EndHorizontal();
}
EditorGUI.EndDisabledGroup();
if (!need2fa)
{
if (verifiablePreplacedwordAuthentication)
{
OnGUIUserPreplacedwordLogin();
}
else
{
OnGUITokenLogin();
}
if (OAuthCallbackManager.IsRunning)
{
GUILayout.Space(Styles.BaseSpacing + 3);
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button("Sign in with your browser", Styles.HyperlinkStyle))
{
GUI.FocusControl(null);
Application.OpenURL(oAuthOpenUrl);
}
}
GUILayout.EndHorizontal();
}
}
else
{
OnGUI2FA();
}
}
}
GUILayout.EndVertical();
}
GUILayout.EndScrollView();
}
19
View Source File : GitHubEnterpriseAuthenticationView.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
private void OnGUITokenLogin()
{
EditorGUI.BeginDisabledGroup(isBusy);
{
ShowMessage();
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
{
token = EditorGUILayout.TextField(TokenLabel, token, Styles.TextFieldStyle);
}
GUILayout.EndHorizontal();
ShowErrorMessage();
GUILayout.Space(Styles.BaseSpacing + 3);
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button("Back"))
{
GUI.FocusControl(null);
BackToGetServerMeta();
}
if (GUILayout.Button(LoginButton) || (!isBusy && enterPressed))
{
GUI.FocusControl(null);
isBusy = true;
GetAuthenticationService(serverAddress)
.LoginWithToken(token, DoTokenResult);
}
}
GUILayout.EndHorizontal();
}
EditorGUI.EndDisabledGroup();
}
19
View Source File : GitPathView.cs
License : MIT License
Project Creator : github-for-unity
License : MIT License
Project Creator : github-for-unity
public override void OnGUI()
{
// Install path
GUILayout.Label(GitInstallreplacedle, EditorStyles.boldLabel);
EditorGUI.BeginDisabledGroup(IsBusy || Parent.IsBusy);
{
GUILayout.BeginVertical();
{
GUILayout.BeginHorizontal();
{
EditorGUI.BeginChangeCheck();
{
gitPath = EditorGUILayout.TextField(PathToGit, gitPath);
gitPath = gitPath != null ? gitPath.Trim() : gitPath;
if (GUILayout.Button(BrowseButton, EditorStyles.miniButton, GUILayout.Width(Styles.BrowseButtonWidth)))
{
GUI.FocusControl(null);
var newPath = EditorUtility.OpenFilePanel(GitInstallBrowsereplacedle,
!String.IsNullOrEmpty(gitPath) ? gitPath.ToNPath().Parent : "",
Environment.ExecutableExtension.TrimStart('.'));
if (!string.IsNullOrEmpty(newPath))
{
gitPath = newPath.ToNPath().ToString();
}
}
}
if (EditorGUI.EndChangeCheck())
{
changingManually = ViewHasChanges;
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
EditorGUI.BeginChangeCheck();
{
gitLfsPath = EditorGUILayout.TextField(PathToGitLfs, gitLfsPath);
gitLfsPath = gitLfsPath != null ? gitLfsPath.Trim() : gitLfsPath;
if (GUILayout.Button(BrowseButton, EditorStyles.miniButton, GUILayout.Width(Styles.BrowseButtonWidth)))
{
GUI.FocusControl(null);
var newPath = EditorUtility.OpenFilePanel(GitInstallBrowsereplacedle,
!String.IsNullOrEmpty(gitLfsPath) ? gitLfsPath.ToNPath().Parent : "",
Environment.ExecutableExtension.TrimStart('.'));
if (!string.IsNullOrEmpty(newPath))
{
gitLfsPath = newPath.ToNPath().ToString();
}
}
}
if (EditorGUI.EndChangeCheck())
{
changingManually = ViewHasChanges;
errorMessage = "";
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
GUILayout.BeginHorizontal();
{
EditorGUI.BeginDisabledGroup(!changingManually && !resetToBundled && !resetToSystem);
{
if (GUILayout.Button(GitPathSaveButton, GUILayout.ExpandWidth(false)))
{
GUI.FocusControl(null);
isBusy = true;
ValidateAndSetGitInstallPath();
}
}
EditorGUI.EndDisabledGroup();
// disable the button if the paths are already pointing to the bundled git
// both on windows, only lfs on mac
EditorGUI.BeginDisabledGroup(
(!Environment.IsWindows || gitPath == installDetails.GitExecutablePath) &&
gitLfsPath == installDetails.GitLfsExecutablePath);
{
if (GUILayout.Button(SetToBundledGitButton, GUILayout.ExpandWidth(false)))
{
GUI.FocusControl(null);
if (Environment.IsWindows)
gitPath = installDetails.GitExecutablePath;
gitLfsPath = installDetails.GitLfsExecutablePath;
resetToBundled = ViewHasChanges;
resetToSystem = false;
changingManually = false;
errorMessage = "";
}
}
EditorGUI.EndDisabledGroup();
//Find button - for attempting to locate a new install
if (GUILayout.Button(FindSystemGitButton, GUILayout.ExpandWidth(false)))
{
GUI.FocusControl(null);
isBusy = true;
new FuncTask<GitInstaller.GitInstallationState>(TaskManager.Token, () =>
{
var gitInstaller = new GitInstaller(Environment, Manager.ProcessManager, TaskManager.Token);
return gitInstaller.FindSystemGit(new GitInstaller.GitInstallationState());
})
{ Message = "Locating git..." }
.FinallyInUI((success, ex, state) =>
{
if (success)
{
if (state.GitIsValid)
{
gitPath = state.GitExecutablePath;
}
if (state.GitLfsIsValid)
{
gitLfsPath = state.GitLfsExecutablePath;
}
}
else
{
Logger.Error(ex);
}
isBusy = false;
resetToBundled = false;
resetToSystem = ViewHasChanges;
changingManually = false;
errorMessage = "";
Redraw();
})
.Start();
}
}
GUILayout.EndHorizontal();
if (!String.IsNullOrEmpty(errorMessage))
{
GUILayout.BeginHorizontal();
{
GUILayout.Label(errorMessage, Styles.ErrorLabel);
}
GUILayout.EndHorizontal();
}
}
EditorGUI.EndDisabledGroup();
}
19
View Source File : CRTEffectInspector.cs
License : MIT License
Project Creator : GlaireDaggers
License : MIT License
Project Creator : GlaireDaggers
public override void OnInspectorGUI()
{
serializedObject.Update();
videoMode.enumValueIndex = EditorGUILayout.Popup("Video Mode", videoMode.enumValueIndex, videoModes);
showQuantizeRGB.target = videoMode.enumValueIndex != (int)VideoType.VGAFast;
using (var group = new EditorGUILayout.FadeGroupScope(showQuantizeRGB.faded))
{
if (group.visible)
{
GUILayout.Space(10f);
EditorGUILayout.LabelField("Quantize RGB", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(quantizeRGB);
showRGBBits.target = quantizeRGB.boolValue;
using (var group2 = new EditorGUILayout.FadeGroupScope(showRGBBits.faded))
{
if (group2.visible)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(rBits);
EditorGUILayout.PropertyField(gBits);
EditorGUILayout.PropertyField(bBits);
EditorGUI.indentLevel--;
}
}
}
}
GUILayout.Space(10f);
EditorGUILayout.LabelField("Display Properties", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(displaySizeX);
EditorGUILayout.PropertyField(displaySizeY);
EditorGUILayout.PropertyField(stretchToFillScreen);
EditorGUILayout.PropertyField(aspectRatio);
GUILayout.Space(10f);
EditorGUILayout.PropertyField(enableCurvature);
showTVCurvatureProperties.target = enableCurvature.boolValue;
using (var group = new EditorGUILayout.FadeGroupScope(showTVCurvatureProperties.faded))
{
if (group.visible)
{
EditorGUILayout.PropertyField(curvature);
EditorGUILayout.PropertyField(tvOverlay);
}
}
GUILayout.Space(10f);
EditorGUILayout.PropertyField(enablePixelMask);
showPixelMaskProperties.target = enablePixelMask.boolValue;
using (var group = new EditorGUILayout.FadeGroupScope(showPixelMaskProperties.faded))
{
if (group.visible)
{
EditorGUILayout.PropertyField(pixelMaskTexture);
EditorGUILayout.PropertyField(pixelMaskRepeatX);
EditorGUILayout.PropertyField(pixelMaskRepeatY);
EditorGUILayout.PropertyField(pixelMaskBrightness);
}
}
EditorGUI.indentLevel--;
GUILayout.Space(10f);
EditorGUILayout.LabelField("Rolling Sync Flicker", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(enableRollingFlicker);
showRollingFlickerProperties.target = enableRollingFlicker.boolValue;
using (var group = new EditorGUILayout.FadeGroupScope(showRollingFlickerProperties.faded))
{
if (group.visible)
{
EditorGUILayout.PropertyField(rollingFlickerStrength);
EditorGUILayout.PropertyField(rollingFlickerSyncTime);
}
}
EditorGUI.indentLevel--;
bool showNTSCFlickerProps = videoMode.enumValueIndex != (int)VideoType.VGA && videoMode.enumValueIndex != (int)VideoType.VGAFast;
showNTSCFlickerProperties.target = showNTSCFlickerProps;
GUILayout.Space(10f);
showRFNoise.target = videoMode.enumValueIndex == (int)VideoType.RF;
using (var group = new EditorGUILayout.FadeGroupScope(showRFNoise.faded))
{
if (group.visible)
{
EditorGUILayout.LabelField("RF Noise", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(rfNoise);
EditorGUI.indentLevel--;
GUILayout.Space(10f);
}
}
using (var group = new EditorGUILayout.FadeGroupScope(showNTSCFlickerProperties.faded))
{
if (group.visible)
{
EditorGUILayout.LabelField("YIQ Filter", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
iqScaleX.floatValue = EditorGUILayout.Slider("Chroma Scale X", iqScaleX.floatValue, 0f, 1f);
iqScaleY.floatValue = EditorGUILayout.Slider("Chroma Scale Y", iqScaleY.floatValue, 0f, 1f);
iqOffsetX.floatValue = EditorGUILayout.Slider("Chroma Offset X", iqOffsetX.floatValue, -0.5f, 0.5f);
iqOffsetY.floatValue = EditorGUILayout.Slider("Chroma Offset Y", iqOffsetY.floatValue, -0.5f, 0.5f);
if (videoMode.enumValueIndex == (int)VideoType.RF || videoMode.enumValueIndex == (int)VideoType.Composite)
{
lumaSharpen.floatValue = EditorGUILayout.Slider("Luma Sharpness", lumaSharpen.floatValue, 0f, 4f);
}
EditorGUI.indentLevel--;
if (videoMode.enumValueIndex != (int)VideoType.Component)
{
GUILayout.Space(10f);
EditorGUILayout.LabelField("NTSC Scanline Flicker", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(enableBurstCountAnimation);
showAntiFlicker.target = enableBurstCountAnimation.boolValue;
using (var group2 = new EditorGUILayout.FadeGroupScope(showAntiFlicker.faded))
{
if (group2.visible)
{
EditorGUILayout.PropertyField(antiFlicker);
}
}
EditorGUI.indentLevel--;
}
}
}
serializedObject.ApplyModifiedProperties();
}
19
View Source File : UnityStorageLogDrawer.cs
License : GNU General Public License v3.0
Project Creator : grygus
License : GNU General Public License v3.0
Project Creator : grygus
public static bool Foldout(bool foldout, string content, GUIStyle style, int leftMargin = DEFAULT_FOLDOUT_MARGIN)
{
BeginHorizontal();
GUILayout.Space(leftMargin);
foldout = EditorGUILayout.Foldout(foldout, content, style);
EndHorizontal();
return foldout;
}
19
View Source File : Demo.cs
License : MIT License
Project Creator : harshitjuneja
License : MIT License
Project Creator : harshitjuneja
private void OnGUI()
{
GUILayout.BeginVertical(GUILayout.Width(Screen.width));
GUILayout.BeginHorizontal();
if (GUILayout.Button("Previous character (Q)"))
{
m_cameraLogic.PreviousTarget();
}
if (GUILayout.Button("Next character (E)"))
{
m_cameraLogic.NextTarget();
}
GUILayout.EndHorizontal();
GUILayout.Space(16);
for(int i = 0; i < m_animations.Length; i++)
{
if(i == 0) { GUILayout.BeginHorizontal(); }
if(GUILayout.Button(m_animations[i]))
{
for(int j = 0; j < m_animators.Length; j++)
{
m_animators[j].SetTrigger(m_animations[i]);
}
}
if(i == m_animations.Length - 1) { GUILayout.EndHorizontal(); }
else if (i == (m_animations.Length / 2)) { GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); }
}
GUILayout.Space(16);
Color oldColor = GUI.color;
GUI.color = Color.black;
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label("WASD or arrows: Move");
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label("Left Shift: Walk");
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label("Space: Jump");
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUI.color = oldColor;
GUILayout.EndVertical();
}
19
View Source File : ExportSettingsEditor.cs
License : MIT License
Project Creator : Hello-Meow
License : MIT License
Project Creator : Hello-Meow
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(5);
EditorGUILayout.PropertyField(_name, new GUIContent("Mod Name*:"));
EditorGUILayout.PropertyField(_author, new GUIContent("Author:"));
EditorGUILayout.PropertyField(_version, new GUIContent("Version:"));
EditorGUILayout.PropertyField(_description, new GUIContent("Description:"), GUILayout.Height(60));
GUILayout.Space(5);
_platforms.intValue = platforms.DoMaskField("Platforms*:", _platforms.intValue);
_content.intValue = content.DoMaskField("Content*:", _content.intValue);
LogUtility.logLevel = (LogLevel)EditorGUILayout.EnumPopup("Log Level:", LogUtility.logLevel);
bool enabled = GUI.enabled;
GUILayout.BeginHorizontal();
GUI.enabled = false;
EditorGUILayout.TextField("Output Directory*:", GetShortString(_outputDirectory.stringValue));
GUI.enabled = enabled;
if (GUILayout.Button("...", GUILayout.Width(30)))
{
string selectedDirectory = EditorUtility.SaveFolderPanel("Choose output directory", _outputDirectory.stringValue, "");
if (!string.IsNullOrEmpty(selectedDirectory))
_outputDirectory.stringValue = selectedDirectory;
Repaint();
}
GUILayout.EndHorizontal();
GUILayout.Space(20);
EditorGUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
}
19
View Source File : BhapticsVRCEditorInspector.cs
License : Apache License 2.0
Project Creator : HerpDerpinstine
License : Apache License 2.0
Project Creator : HerpDerpinstine
public override void OnInspectorGUI()
{
if (script == null)
return;
if (script.anim == null)
{
EditorGUILayout.HelpBox("BhapticsVRCEditor / Required Animator component & avatar.", MessageType.Error);
return;
}
if (script.anim.avatar == null)
{
EditorGUILayout.HelpBox("BhapticsVRCEditor / Required Animator component & avatar.", MessageType.Error);
return;
}
if (script.avatarDescriptor == null)
{
EditorGUILayout.HelpBox("BhapticsVRCEditor / Required VRC AvatarDescriptor component.", MessageType.Error);
return;
}
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUIStyle deviceIconStyle = new GUIStyle(GUI.skin.label);
deviceIconStyle.margin = new RectOffset(20, 20, 12, 5);
GUIStyle deviceOnIconStyle = new GUIStyle(GUI.skin.label);
deviceOnIconStyle.margin = new RectOffset(20, 20, 12, 5);
for (int i = 0; i < script.deviceIcons.Length; ++i)
{
if (script.deviceIcons[i] != null)
{
var deviceTypeIndex = script.ConvertIconIndexToDeviceTypeIndex(i);
if (deviceTypeIndex == -1)
{
continue;
}
if (script.deviceGameObjects[deviceTypeIndex] == null)
{
if (GUILayout.Button(new GUIContent(script.deviceIcons[i], "CLICK: Add object"), deviceIconStyle, GUILayout.Width(50), GUILayout.Height(50)))
{
script.selectedDeviceType = (BhapticsDeviceType)deviceTypeIndex;
script.AddDevicePrefab(script.selectedDeviceType.ToString());
Debug.Log("BhapticsVRCEditor / <color=green>Add </color>" + script.selectedDeviceType.ToString() + " Object");
}
}
else
{
if (GUILayout.Button(script.deviceOnIcons[i], deviceOnIconStyle, GUILayout.Width(50), GUILayout.Height(50)))
{
script.selectedDeviceType = (BhapticsDeviceType)deviceTypeIndex;
OnSceneGUI();
}
}
if (Screen.width < 580 && i == script.deviceIcons.Length / 2 - 1)
{
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
}
}
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(5);
if (GUILayout.Button("Finish Editor", GUILayout.Height(30)))
{
Undo.DestroyObjectImmediate(script);
}
EditorGUILayout.HelpBox("If you finished setup, press [Finish Editor] button.", MessageType.Info);
GUILayout.Space(2);
if (Event.current != null && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete)
{
script.DestroyDevicePrefab(script.selectedDeviceType.ToString());
Debug.Log("BhapticsVRCEditor / <color=red>Delete </color>" + script.selectedDeviceType.ToString() + " Object");
Event.current.Use();
return;
}
}
19
View Source File : BhapticsVRCEditorInspector.cs
License : Apache License 2.0
Project Creator : HerpDerpinstine
License : Apache License 2.0
Project Creator : HerpDerpinstine
void OnSceneGUI()
{
if (script == null)
{
return;
}
if (!script.enabled)
return;
if (script.anim == null)
{
return;
}
if (script.anim.avatar == null)
{
return;
}
if (script.avatarDescriptor == null)
{
return;
}
if (Event.current != null && Event.current.type == EventType.Layout)
{
HandleUtility.AddDefaultControl(0);
}
Handles.BeginGUI();
GUIStyle windowStyle = new GUIStyle("Window");
windowStyle.margin.left = 15;
GUILayout.BeginVertical("Bhaptics VRC Editor", windowStyle, GUILayout.Width(300), GUILayout.MaxHeight(10), GUILayout.ExpandHeight(true));
GUILayout.BeginHorizontal();
GUIStyle topMarginStyle = new GUIStyle(GUI.skin.label);
topMarginStyle.margin.top = 0;
GUILayout.Label("Device Type", topMarginStyle, GUILayout.Width(80));
GUILayout.BeginVertical();
script.selectedDeviceType = (BhapticsDeviceType)EditorGUILayout.EnumPopup(string.Empty, script.selectedDeviceType, GUILayout.ExpandWidth(true), GUILayout.MinWidth(10));
GUILayout.EndVertical();
script.selectedDevice = script.deviceGameObjects[(int)script.selectedDeviceType] == null ? null : script.deviceGameObjects[(int)script.selectedDeviceType].transform;
if (script.selectedDevice != null)
{
GUIStyle selectButtonStyle = new GUIStyle(GUI.skin.button);
selectButtonStyle.margin.top = 0;
if (GUILayout.Button("Select", selectButtonStyle, GUILayout.Width(50)))
{
Selection.activeGameObject = script.selectedDevice.gameObject;
}
}
GUILayout.EndHorizontal();
if (script.selectedDevice == null)
{
GUILayout.Space(10);
script.symmetry = false;
GUIStyle addButtonStyle = new GUIStyle(GUI.skin.button);
addButtonStyle.richText = true;
if (GUILayout.Button("<color=green>Add</color> " + script.selectedDeviceType + " Object", addButtonStyle, GUILayout.Height(30)))
{
script.AddDevicePrefab(script.selectedDeviceType.ToString());
Debug.Log("BhapticsVRCEditor / <color=green>Add </color>" + script.selectedDeviceType.ToString() + " Object");
return;
}
}
else
{
GUILayout.Space(2);
if (previousGameObject != script.selectedDevice)
{
previousGameObject = script.selectedDevice;
Camera[] cams = script.selectedDevice.GetComponentsInChildren<Camera>(true);
foreach (Camera cam in cams)
if (cam.gameObject.name.ToLowerInvariant().Contains("dummy"))
{
IsVisualized = cam.gameObject.active;
break;
}
}
GUILayout.BeginHorizontal();
GUILayout.Label("Visible Mode", GUILayout.Width(80));
GUIStyle visualButtonStyle = new GUIStyle(GUI.skin.button);
visualButtonStyle.margin.top = 1;
if (GUILayout.Button(IsVisualized ? "Visualized" : "Hidden", visualButtonStyle, GUILayout.Width(100), GUILayout.Height(18)))
{
IsVisualized = !IsVisualized;
MeshRenderer[] render = script.selectedDevice.GetComponentsInChildren<MeshRenderer>(true);
foreach (MeshRenderer renderer in render)
if (renderer.gameObject == script.selectedDevice.gameObject)
renderer.enabled = IsVisualized;
else
renderer.gameObject.SetActive(IsVisualized);
SkinnedMeshRenderer[] render2 = script.selectedDevice.GetComponentsInChildren<SkinnedMeshRenderer>(true);
foreach (SkinnedMeshRenderer renderer in render2)
if (renderer.gameObject == script.selectedDevice.gameObject)
renderer.enabled = IsVisualized;
else
renderer.gameObject.SetActive(IsVisualized);
Camera[] cams = script.selectedDevice.GetComponentsInChildren<Camera>(true);
foreach (Camera cam in cams)
if (cam.gameObject.name.ToLowerInvariant().Contains("dummy"))
cam.gameObject.SetActive(IsVisualized);
string visual = "<color=green>Visualized</color>";
string hide = "<color=red>Hidden</color>";
Debug.Log($"BhapticsVRCEditor / Change Visible Mode {(!IsVisualized ? visual : hide)} -> {(IsVisualized ? visual : hide)}");
return;
}
GUILayout.EndHorizontal();
var isLeft = script.selectedDevice.name.Contains("Left");
var isRight = script.selectedDevice.name.Contains("Right");
if (isLeft || isRight)
{
GUILayout.BeginHorizontal();
GUILayout.Label("Symmetry", GUILayout.Width(80));
script.symmetry = EditorGUILayout.Toggle(script.symmetry);
GUILayout.EndHorizontal();
if (script.symmetry)
{
if (isLeft)
{
script.symmetryDevice = script.FindDeviceObject(script.selectedDevice.name.Replace("Left", "Right"));
}
else if (isRight)
{
script.symmetryDevice = script.FindDeviceObject(script.selectedDevice.name.Replace("Right", "Left"));
}
if (script.symmetryDevice == null)
{
EditorGUILayout.HelpBox("Symmetry object is not found! Create one.", MessageType.Error);
}
}
else
{
script.symmetryDevice = null;
}
}
else
{
script.symmetryDevice = null;
}
GUILayout.BeginHorizontal();
GUILayout.Label("Edit Mode", GUILayout.Width(80));
GUILayout.BeginVertical();
GUIStyle boldStyle = new GUIStyle(GUI.skin.label);
boldStyle.fontStyle = FontStyle.Bold;
GUIStyle tooltipStyle = new GUIStyle(GUI.skin.label);
tooltipStyle.richText = true;
tooltipStyle.padding.top = -3;
if (Tools.current == Tool.Move)
{
GUILayout.Label("Position", boldStyle, GUILayout.Width(60));
GUILayout.Label("<size=9>*shortcut = </size><b>[W]</b><size=9> E R</size>", tooltipStyle);
}
else if (Tools.current == Tool.Rotate)
{
GUILayout.Label("Rotation", boldStyle, GUILayout.Width(60));
GUILayout.Label("<size=9>*shortcut = W </size><b>[E]</b><size=9> R</size>", tooltipStyle);
}
else if (Tools.current == Tool.Scale)
{
GUILayout.Label("Scale", boldStyle, GUILayout.Width(60));
GUILayout.Label("<size=9>*shortcut = W E </size><b>[R]</b>", tooltipStyle);
}
else
{
GUILayout.Label("Etc");
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.Label("Position", GUILayout.Width(80));
script.selectedDevice.localPosition = EditorGUILayout.Vector3Field("", script.RoundVector3(script.selectedDevice.localPosition), GUILayout.Width(200));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Rotation", GUILayout.Width(80));
script.selectedDevice.localEulerAngles = EditorGUILayout.Vector3Field("", script.RoundVector3(script.selectedDevice.localEulerAngles), GUILayout.Width(200));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Scale", GUILayout.Width(80));
script.selectedDevice.localScale = EditorGUILayout.Vector3Field("", script.RoundVector3(script.selectedDevice.localScale), GUILayout.Width(200));
var cameras = script.selectedDevice.GetComponentsInChildren<Camera>(true);
for (int i = 0; i < cameras.Length; ++i)
FixCameraScaling(cameras[i]);
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUIStyle deleteButtonStyle = new GUIStyle(GUI.skin.button);
deleteButtonStyle.richText = true;
if (GUILayout.Button("<color=red>Delete</color> " + script.selectedDeviceType + " Object [Del]", deleteButtonStyle, GUILayout.Height(30)))
{
Undo.DestroyObjectImmediate(script.selectedDevice.gameObject);
Debug.Log("BhapticsVRCEditor / <color=red>Delete </color>" + script.selectedDeviceType.ToString() + " Object");
return;
}
}
GUILayout.Space(2);
GUILayout.EndVertical();
Handles.EndGUI();
Color buttonColor = new Color(0.9f, 0.9f, 0.3f);
Color defaultColor = new Color(0.6f, 0.6f, 0.6f);
Handles.color = buttonColor;
for (int i = 0; i < script.deviceGameObjects.Length; ++i)
{
if (script.deviceGameObjects[i] == null)
{
continue;
}
if (script.selectedDevice != null && script.selectedDevice == script.deviceGameObjects[i].transform)
{
continue;
}
var buttonSize = HandleUtility.GetHandleSize(script.deviceGameObjects[i].transform.position) / 10f;
if (Handles.Button(script.deviceGameObjects[i].transform.position, Quaternion.idenreplacedy, buttonSize, buttonSize, Handles.DotHandleCap))
{
script.selectedDeviceType = (BhapticsDeviceType)i;
return;
}
}
Handles.color = defaultColor;
if (script.selectedDevice != null)
{
try
{
if (Tools.current == Tool.Move)
{
Handles.CubeHandleCap(0, script.selectedDevice.position, Quaternion.idenreplacedy, HandleUtility.GetHandleSize(script.selectedDevice.position) / 7f, EventType.Repaint);
script.selectedDevice.position = Handles.PositionHandle(script.selectedDevice.position, script.selectedDevice.rotation);
}
else if (Tools.current == Tool.Rotate)
{
script.selectedDevice.rotation = Handles.RotationHandle(script.selectedDevice.rotation, script.selectedDevice.position);
}
else if (Tools.current == Tool.Scale)
{
script.selectedDevice.localScale = Handles.ScaleHandle(script.selectedDevice.localScale, script.selectedDevice.position, script.selectedDevice.rotation,
HandleUtility.GetHandleSize(script.selectedDevice.position));
var cameras = script.selectedDevice.GetComponentsInChildren<Camera>(true);
for (int i = 0; i < cameras.Length; ++i)
FixCameraScaling(cameras[i]);
}
}
catch (Exception e)
{
}
if (script.symmetry && script.symmetryDevice != null)
{
script.symmetryDevice.position = Vector3.Reflect(script.selectedDevice.position - script.transform.position, script.transform.right);
script.symmetryDevice.eulerAngles = Vector3.Reflect(script.selectedDevice.eulerAngles, script.transform.up);
script.symmetryDevice.localScale = script.selectedDevice.localScale;
var symmetryCameras = script.symmetryDevice.GetComponentsInChildren<Camera>(true);
for (int i = 0; i < symmetryCameras.Length; ++i)
FixCameraScaling(symmetryCameras[i]);
Undo.RecordObjects(new Transform[] { script.selectedDevice, script.symmetryDevice }, "Change TargetObject and SymmetryTargetObject");
}
else
{
Undo.RecordObject(script.selectedDevice, "Change TargetObject");
}
if (Event.current != null && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete)
{
script.DestroyDevicePrefab(script.selectedDeviceType.ToString());
Debug.Log("BhapticsVRCEditor / <color=red>Delete </color>" + script.selectedDeviceType.ToString() + " Object");
Event.current.Use();
return;
}
}
}
19
View Source File : PanelCanvasEditor.cs
License : MIT License
Project Creator : Hertzole
License : MIT License
Project Creator : Hertzole
public override void OnInspectorGUI()
{
if (ancreplaceddPanelGUIStyle == null)
{
ancreplaceddPanelGUIStyle = new GUIStyle("box")
{
alignment = TextAnchor.MiddleCenter,
clipping = TextClipping.Clip
};
}
if (justClickedAncreplaceddPanel != null && Event.current.type == EventType.Layout)
{
selectedAncreplaceddPanel = justClickedAncreplaceddPanel;
selectedAncreplaceddPanelTabs = selectedAncreplaceddPanel.panel.tabs;
justClickedAncreplaceddPanel = null;
}
serializedObject.Update();
reorderableListIndex = 0;
bool multiObjectEditing = targets.Length > 1;
bool guiEnabled = !EditorApplication.isPlaying || replacedetDatabase.Contains(((PanelCanvas)serializedObject.targetObject).gameObject);
GUI.enabled = guiEnabled;
GUILayout.BeginVertical();
EditorGUILayout.LabelField("= Properties =", EditorStyles.boldLabel);
EditorGUILayout.PropertyField(panelPrefab);
EditorGUILayout.PropertyField(leaveFreeSpace);
EditorGUI.indentLevel++;
GUI.enabled = guiEnabled && leaveFreeSpace.boolValue;
EditorGUILayout.PropertyField(minimumFreeSpace);
GUI.enabled = guiEnabled;
EditorGUI.indentLevel--;
EditorGUILayout.PropertyField(preventDetachingLastDockedPanel);
EditorGUILayout.PropertyField(panelResizableAreaLength);
EditorGUILayout.PropertyField(canvasAnchorZoneLength);
EditorGUILayout.PropertyField(panelAnchorZoneLength);
GUILayout.Space(10f);
EditorGUILayout.LabelField("= Free Panels =", EditorStyles.boldLabel);
if (multiObjectEditing)
{
GUILayout.Label("Multi-object editing not supported");
}
else if (!guiEnabled)
{
GUILayout.Label("Can't edit in Play mode");
}
else
{
List<PanelCanvas.PanelProperties> initialPanelsUnancreplacedd = settings.InitialPanelsUnancreplacedd;
int selectedReorderableListIndex = -1;
for (int i = 0; i < initialPanelsUnancreplacedd.Count; i++)
{
if (DrawReorderableListFor(initialPanelsUnancreplacedd[i]))
{
selectedReorderableListIndex = i;
}
if (i < initialPanelsUnancreplacedd.Count - 1)
{
// Draw a horizontal line to separate the panels
GUILayout.Space(5f);
GUILayout.Box(GUIContent.none, GUILayout.ExpandWidth(true), GUILayout.Height(2f));
}
GUILayout.Space(5f);
}
GUILayout.BeginHorizontal();
if (GUILayout.Button("Add New", GUILayout.Height(1.35f * EditorGUIUtility.singleLineHeight)))
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Add Free Panel");
initialPanelsUnancreplacedd.Add(new PanelCanvas.PanelProperties());
}
if (selectedReorderableListIndex < 0)
{
GUI.enabled = false;
}
if (GUILayout.Button("Remove Selected", GUILayout.Height(1.35f * EditorGUIUtility.singleLineHeight)))
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Remove Free Panel");
initialPanelsUnancreplacedd.RemoveAt(selectedReorderableListIndex);
}
GUI.enabled = guiEnabled;
GUILayout.EndHorizontal();
}
GUILayout.Space(13f);
EditorGUILayout.LabelField("= Docked Panels =", EditorStyles.boldLabel);
if (multiObjectEditing)
{
GUILayout.Label("Multi-object editing not supported");
}
else if (!guiEnabled)
{
GUILayout.Label("Can't edit in Play mode");
}
else
{
PanelCanvas.AncreplaceddPanelProperties initialPanelsAncreplacedd = settings.InitialPanelsAncreplacedd;
Rect previewRect = EditorGUILayout.GetControlRect(false, ANCreplacedD_PANELS_PREVIEW_HEIGHT);
DrawAncreplaceddPanelsPreview(previewRect, initialPanelsAncreplacedd);
if (selectedAncreplaceddPanel != null)
{
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(5f);
EditorGUILayout.LabelField("Selected panel:", EditorStyles.boldLabel);
if (selectedAncreplaceddPanelTabs != settings.InitialPanelsAncreplacedd.panel.tabs)
{
string initialSizeLabel = selectedAncreplaceddPanel.initialSize == Vector2.zero ? "Initial Size (not set):" : "Initial Size:";
EditorGUI.BeginChangeCheck();
Vector2 panelInitialSize = EditorGUILayout.Vector2Field(initialSizeLabel, selectedAncreplaceddPanel.initialSize);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject((PanelCanvas)target, "Change Initial Size");
selectedAncreplaceddPanel.initialSize = panelInitialSize;
}
DrawReorderableListFor(selectedAncreplaceddPanel.panel);
}
else
{
GUILayout.Label("- nothing -");
}
PanelDirection direction = ShowDirectionButtons("Dock new panel inside: ");
if (direction != PanelDirection.None)
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Dock New Panel");
selectedAncreplaceddPanel.subPanels.Add(new PanelCanvas.AncreplaceddPanelProperties() { anchorDirection = direction });
}
if (selectedAncreplaceddPanelTabs != settings.InitialPanelsAncreplacedd.panel.tabs)
{
GUILayout.Space(5f);
if (GUILayout.Button("Remove Selected", GUILayout.Height(1.35f * EditorGUIUtility.singleLineHeight)))
{
RemoveAncreplaceddPanel(settings.InitialPanelsAncreplacedd, selectedAncreplaceddPanel);
}
}
GUILayout.EndVertical();
}
GUILayout.Space(6f);
PanelDirection rootDirection = ShowDirectionButtons("Dock new panel to canvas: ");
if (rootDirection != PanelDirection.None)
{
Undo.IncrementCurrentGroup();
Undo.RecordObject((PanelCanvas)target, "Dock New Panel");
settings.InitialPanelsAncreplacedd.subPanels.Insert(0, new PanelCanvas.AncreplaceddPanelProperties() { anchorDirection = rootDirection });
}
}
GUI.enabled = true;
GUILayout.EndVertical();
serializedObject.ApplyModifiedProperties();
}
19
View Source File : EditorGUIHelper.cs
License : MIT License
Project Creator : Hertzole
License : MIT License
Project Creator : Hertzole
public static void DrawFancyFoldout(SerializedProperty foldoutProperty, string replacedle, bool indent, Action drawCallback)
{
DrawSplitter();
bool state = foldoutProperty.isExpanded;
state = DrawHeaderFoldout(replacedle, state);
if (state)
{
if (indent)
{
EditorGUI.indentLevel++;
}
drawCallback();
if (indent)
{
EditorGUI.indentLevel--;
}
GUILayout.Space(2f);
}
foldoutProperty.isExpanded = state;
}
19
View Source File : GoldPlayerProjectSettingsProvider.cs
License : MIT License
Project Creator : Hertzole
License : MIT License
Project Creator : Hertzole
public override void OnGUI(string searchContext)
{
if (settings == null)
{
settings = GoldPlayerProjectSettings.Instance;
}
using (new SettingsGUIScope())
{
EditorGUILayout.LabelField("Editor", EditorStyles.boldLabel);
EditorGUIAdaption uiAdapation = settings.GUIAdapation;
EditorGUI.BeginChangeCheck();
uiAdapation = (EditorGUIAdaption)EditorGUILayout.EnumPopup(uiAdapationContent, uiAdapation);
if (EditorGUI.EndChangeCheck())
{
settings.GUIAdapation = uiAdapation;
}
GUILayout.Space(16f);
EditorGUILayout.LabelField("Scene View", EditorStyles.boldLabel);
bool showGizmos = settings.ShowGroundCheckGizmos;
EditorGUI.BeginChangeCheck();
showGizmos = EditorGUILayout.Toggle(showGroundGizmosContent, showGizmos);
if (EditorGUI.EndChangeCheck())
{
settings.ShowGroundCheckGizmos = showGizmos;
}
GUILayout.Space(16f);
EditorGUILayout.LabelField("Disable Components", EditorStyles.boldLabel);
EditorGUILayout.HelpBox("Disabling components strips them out of your game. This is much more recommended than outright removing script files.", MessageType.Info);
settings.DisableInteraction = EditorGUILayout.Toggle("Disable Interaction", settings.DisableInteraction);
settings.DisableUI = EditorGUILayout.Toggle("Disable uGUI", settings.DisableUI);
settings.DisableGraphics = EditorGUILayout.Toggle("Disable Graphics", settings.DisableGraphics);
settings.DisableAnimator = EditorGUILayout.Toggle("Disable Animator", settings.DisableAnimator);
settings.DisableAudioExtras = EditorGUILayout.Toggle("Disable Audio Extras", settings.DisableAudioExtras);
settings.DisableObjectBob = EditorGUILayout.Toggle("Disable Object Bob", settings.DisableObjectBob);
EditorGUILayout.Space();
DrawApplyButton();
GUILayout.Space(16f);
EditorGUILayout.LabelField("Optimizations", EditorStyles.boldLabel);
settings.DisableOptimizations = EditorGUILayout.Toggle(disableOptimizationsContent, settings.DisableOptimizations);
EditorGUILayout.Space();
DrawApplyButton();
}
}
19
View Source File : ALEProjectSettings.cs
License : MIT License
Project Creator : Hertzole
License : MIT License
Project Creator : Hertzole
public override void OnGUI(string searchContext)
{
if (settings == null)
{
settings = ALESettings.Get();
}
using (new GUILayout.HorizontalScope())
{
GUILayout.Space(6f);
using (new GUILayout.VerticalScope())
{
EditorGUIHelper.DrawHeaderLayout("Wrappers");
bool applyTransform = settings.ApplyTransformWrapper;
EditorGUI.BeginChangeCheck();
applyTransform = EditorGUILayout.Toggle("Apply Transform", applyTransform);
if (EditorGUI.EndChangeCheck())
{
settings.ApplyTransformWrapper = applyTransform;
settings.EditorSave();
}
bool applyRigidbody = settings.ApplyRigidbodyWrapper;
EditorGUI.BeginChangeCheck();
applyRigidbody = EditorGUILayout.Toggle("Apply Rigidbody", applyRigidbody);
if (EditorGUI.EndChangeCheck())
{
settings.ApplyRigidbodyWrapper = applyRigidbody;
settings.EditorSave();
}
}
}
}
19
View Source File : OSCPacketEditableDrawer.cs
License : MIT License
Project Creator : hizzlehoff
License : MIT License
Project Creator : hizzlehoff
private void DrawBundle(OSCBundle bundle)
{
var defaultColor = GUI.color;
if (bundle.Packets.Count > 0)
{
var removePacket = (OSCPacket) null;
foreach (var bundlePacket in bundle.Packets)
{
using (new GUILayout.HorizontalScope())
{
EditorGUILayout.LabelField(bundlePacket.GetType().Name + ":", EditorStyles.boldLabel);
GUI.color = Color.red;
if (GUILayout.Button("x", GUILayout.Height(EditorGUIUtility.singleLineHeight),GUILayout.Width(20)))
{
removePacket = bundlePacket;
}
GUI.color = defaultColor;
}
using (new GUILayout.VerticalScope(OSCEditorStyles.Box))
{
DrawLayout(bundlePacket);
}
GUILayout.Space(10);
}
if (removePacket != null)
{
bundle.Packets.Remove(removePacket);
if (_valueTypeTemp.ContainsKey(removePacket))
_valueTypeTemp.Remove(removePacket);
}
}
else
{
using (new GUILayout.VerticalScope(OSCEditorStyles.Box))
{
EditorGUILayout.LabelField(_bundleEmptyContent, OSCEditorStyles.CenterLabel);
}
}
// ADD PACKET
using (new GUILayout.HorizontalScope(OSCEditorStyles.Box))
{
GUI.color = Color.green;
if (GUILayout.Button(_addBundleContent))
{
bundle.AddPacket(new OSCBundle());
}
if (GUILayout.Button(_addMessageContent))
{
bundle.AddPacket(new OSCMessage("/address"));
}
GUI.color = defaultColor;
}
}
19
View Source File : OSCPanelConsole.cs
License : MIT License
Project Creator : hizzlehoff
License : MIT License
Project Creator : hizzlehoff
private void DrawToolbar(Rect contentRect)
{
GUILayout.BeginArea(new Rect(0, 0, contentRect.width, 18));
EditorGUILayout.BeginVertical();
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
var clearButton = GUILayout.Button(_clearContent, EditorStyles.toolbarButton, GUILayout.Height(45f));
GUILayout.Space(5f);
ShowReceived = GUILayout.Toggle(ShowReceived, _recevedContent, EditorStyles.toolbarButton);
ShowTransmitted = GUILayout.Toggle(ShowTransmitted, _transmittedContent, EditorStyles.toolbarButton);
GUILayout.FlexibleSpace();
GUILayout.Space(5f);
_filterDrawer.Draw();
GUILayout.Space(5f);
TrackLast = GUILayout.Toggle(TrackLast, _trackLastContent, EditorStyles.toolbarButton);
GUILayout.Space(5f);
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
GUILayout.EndArea();
if (clearButton)
{
OSCWindowConsole.Clear();
SelectedMessage = null;
}
}
19
View Source File : OSCPanelMapping.cs
License : MIT License
Project Creator : hizzlehoff
License : MIT License
Project Creator : hizzlehoff
protected override void DrawContent(ref Rect contentRect)
{
var defaultColor = GUI.color;
var createMapButton = false;
var createMessageButton = false;
using (new GUILayout.HorizontalScope(EditorStyles.toolbar))
{
createMapButton = GUILayout.Button(_createContent, EditorStyles.toolbarButton);
GUILayout.Space(5);
if (GUILayout.Button(_openContent, EditorStyles.toolbarDropDown))
{
GUIContent[] popupItems;
string[] patches;
GetMappingreplacedets(out popupItems, out patches);
var customMenuRect = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0);
EditorUtility.DisplayCustomMenu(customMenuRect, popupItems, -1, OpenMapBundle, patches);
}
GUILayout.FlexibleSpace();
if (_currentMapBundle != null)
GUILayout.Label(string.Format("Name: {0}", _currentMapBundle.name));
}
var expand = contentRect.width > 810;
if (_currentMapBundle != null)
{
using (var scroll = new GUILayout.ScrollViewScope(_scrollPosition))
{
GUILayout.Label(string.Format("Path: {0}", replacedetDatabase.GetreplacedetPath(_currentMapBundle)));
if (_currentMapBundle.Messages.Count > 0)
{
_deleteMessage = null;
foreach (var mapMessage in _currentMapBundle.Messages)
{
DrawMapMessage(mapMessage, expand);
}
if (_deleteMessage != null) _currentMapBundle.Messages.Remove(_deleteMessage);
}
else
{
using (new GUILayout.HorizontalScope(OSCEditorStyles.Box))
{
GUILayout.Label(_emptyContent, OSCEditorStyles.CenterLabel);
}
}
using (new GUILayout.HorizontalScope(OSCEditorStyles.Box))
{
GUI.color = Color.green;
createMessageButton = GUILayout.Button(_addAddressContent);
GUI.color = defaultColor;
}
// ACTIONS
if (createMessageButton)
{
_currentMapBundle.Messages.Add(new OSCMapMessage
{
Address = "/address/" + _currentMapBundle.Messages.Count
});
}
if (_deleteMessage != null)
{
_currentMapBundle.Messages.Remove(_deleteMessage);
}
_scrollPosition = scroll.scrollPosition;
}
}
else
{
EditorGUILayout.LabelField(_infoContent, OSCEditorStyles.CenterLabel, GUILayout.Height(contentRect.height));
}
if (createMapButton) CreateMapBundle();
}
19
View Source File : OSCPanelPacketEditor.cs
License : MIT License
Project Creator : hizzlehoff
License : MIT License
Project Creator : hizzlehoff
protected override void DrawContent(ref Rect contentRect)
{
using (new GUILayout.VerticalScope())
{
// TOOLBAR
using (new GUILayout.HorizontalScope(EditorStyles.toolbar))
{
if (GUILayout.Button(_createContent, EditorStyles.toolbarDropDown))
{
var customMenuRect =
new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0);
EditorUtility.DisplayCustomMenu(customMenuRect, _createPopureplacedems, -1, CreatePacket, null);
}
GUILayout.Space(5);
if (GUILayout.Button(_openContent, EditorStyles.toolbarButton))
{
OpenPacket();
}
if (GUILayout.Button(_saveContent, EditorStyles.toolbarButton))
{
SavePacket();
}
if (CurrentPacket != null)
{
GUILayout.Space(5);
if (GUILayout.Button(_generateCodeContent, EditorStyles.toolbarButton))
{
GenerateSharpCode();
}
}
GUILayout.FlexibleSpace();
if (CurrentPacket != null)
GUILayout.Label(string.Format("Name: {0}", PacketName));
}
if (CurrentPacket != null && CurrentPacket != null)
{
_scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition);
_packetDrawer.DrawLayout(CurrentPacket);
EditorGUILayout.EndScrollView();
}
else
{
EditorGUILayout.LabelField(_infoContent, OSCEditorStyles.CenterLabel, GUILayout.Height(contentRect.height));
}
}
}
19
View Source File : OSCEditorInterface.cs
License : MIT License
Project Creator : hizzlehoff
License : MIT License
Project Creator : hizzlehoff
public static void LogoLayout()
{
if (OSCEditorTextures.IronWall == null)
return;
GUILayout.Space(10);
EditorGUILayout.Space();
var rect = GUILayoutUtility.GetRect(0, 0);
var width = OSCEditorTextures.IronWall.width * 0.2f;
var height = OSCEditorTextures.IronWall.height * 0.2f;
rect.x = rect.width * 0.5f - width * 0.5f;
rect.y = rect.y + rect.height * 0.5f - height * 0.5f;
rect.width = width;
rect.height = height;
GUI.DrawTexture(rect, OSCEditorTextures.IronWall);
EditorGUILayout.Space();
GUILayout.Space(5);
}
19
View Source File : OSCReflectionMemberDrawer.cs
License : MIT License
Project Creator : hizzlehoff
License : MIT License
Project Creator : hizzlehoff
public void DrawLayout()
{
// Get positions.
var height = EditorGUIUtility.singleLineHeight;
var targetPosition = GUILayoutUtility.GetRect(0f, height, GUILayout.ExpandWidth(true));
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); // Add space betwen fields.
var memberPosition = GUILayoutUtility.GetRect(0f, height, GUILayout.ExpandWidth(true));
// Draw elements.
DrawTarget(targetPosition);
DrawMember(memberPosition);
}
19
View Source File : HotkeyAndTimeOptions.cs
License : MIT License
Project Creator : hsinyuhcan
License : MIT License
Project Creator : hsinyuhcan
private void OnGUIHotkey()
{
if (!string.IsNullOrEmpty(_waitingHotkeyName) && HotkeyHelper.ReadKey(out BindingKeysData newKey))
{
Mod.Core.Hotkeys.SetHotkey(_waitingHotkeyName, newKey);
_waitingHotkeyName = null;
}
IDictionary<string, BindingKeysData> hotkeys = Mod.Core.Hotkeys.Hotkeys;
using (new GUILayout.HorizontalScope())
{
using (new GUILayout.VerticalScope())
{
foreach (KeyValuePair<string, BindingKeysData> item in hotkeys)
{
GUIHelper.ToggleButton(item.Value != null, Local[item.Key], _labelStyle, GUILayout.ExpandWidth(false));
}
}
GUILayout.Space(10f);
using (new GUILayout.VerticalScope())
{
foreach (BindingKeysData key in hotkeys.Values)
{
GUILayout.Label(HotkeyHelper.GetKeyText(key));
}
}
GUILayout.Space(10f);
using (new GUILayout.VerticalScope())
{
foreach (string name in hotkeys.Keys)
{
bool waitingThisHotkey = _waitingHotkeyName == name;
if (GUILayout.Button(Local["Menu_Btn_Set"], waitingThisHotkey ? _downButtonStyle : _buttonStyle))
{
if (waitingThisHotkey)
_waitingHotkeyName = null;
else
_waitingHotkeyName = name;
}
}
}
using (new GUILayout.VerticalScope())
{
string hotkeyToClear = default;
foreach (string name in hotkeys.Keys)
{
if (GUILayout.Button(Local["Menu_Btn_Clear"], _buttonStyle))
{
hotkeyToClear = name;
if (_waitingHotkeyName == name)
_waitingHotkeyName = null;
}
}
if (!string.IsNullOrEmpty(hotkeyToClear))
Mod.Core.Hotkeys.SetHotkey(hotkeyToClear, null);
}
using (new GUILayout.VerticalScope())
{
foreach (KeyValuePair<string, BindingKeysData> item in hotkeys)
{
if (item.Value != null && !HotkeyHelper.CanBeRegistered(item.Key, item.Value))
{
GUILayout.Label(Local["Menu_Txt_Duplicated"].Color(RGBA.yellow));
}
else
{
GUILayout.Label(string.Empty);
}
}
}
GUILayout.FlexibleSpace();
}
ToggleFiveFootStepOnRightClickGround =
GUIHelper.ToggleButton(ToggleFiveFootStepOnRightClickGround,
Local["Menu_Opt_ToggleFiveFootStepOnRightClickGround"], _buttonStyle, GUILayout.ExpandWidth(false));
}
19
View Source File : LanguageSelection.cs
License : MIT License
Project Creator : hsinyuhcan
License : MIT License
Project Creator : hsinyuhcan
private void OnGUICurrent()
{
GUILayout.Label(string.Format(Local["Menu_Txt_Language"], Local.Language), _labelStyle, GUILayout.ExpandWidth(false));
GUILayout.Label(string.Format(Local["Menu_Txt_Version"], Local.Version), _labelStyle, GUILayout.ExpandWidth(false));
GUILayout.Label(string.Format(Local["Menu_Txt_Contributors"], Local.Contributors), _labelStyle, GUILayout.ExpandWidth(false));
using (new GUILayout.HorizontalScope())
{
GUILayout.Label(Local["Menu_Txt_HomePage"], _labelStyle, GUILayout.ExpandWidth(false));
if (!string.IsNullOrEmpty(Local.HomePage))
{
GUIHelper.Hyperlink(Local.HomePage, Color.white, Color.cyan, _linkStyle);
}
}
GUILayout.Space(5f);
string fileName = Local.FileName ?? "Default.json";
void Export()
{
_exportMessage = Local.Export(fileName, e => Mod.Error(e)) ? null : string.Format(Local["Menu_Txt_FaildToExport"], fileName);
}
if (GUILayout.Button(string.Format(Local["Menu_Btn_Export"], fileName), _buttonStyle, GUILayout.ExpandWidth(false)))
{
Export();
}
if (GUILayout.Button(string.Format(Local["Menu_Btn_SortAndExport"], fileName) +
Local["Menu_Cmt_SortAndExport"].Color(RGBA.silver), _buttonStyle, GUILayout.ExpandWidth(false)))
{
Local.Sort();
Export();
}
if (!string.IsNullOrEmpty(_exportMessage))
{
GUILayout.Label(_exportMessage.Color(RGBA.yellow), _labelStyle, GUILayout.ExpandWidth(false));
}
}
19
View Source File : BonesControlEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
void DrawBoneControl(BonesControl target, KneadType type)
{
EditorGUILayout.Space();
using (var scope1 = new EditorGUI.ChangeCheckScope())
{
foldout[(int)type] = EditorGUILayout.Foldout(foldout[(int)type], BonesControl.GetLabel(type));
if (foldout[(int)type])
{
target.UnlockTransformElement(type);
using (var scope = new EditorGUILayout.HorizontalScope())
{
string minValue = target.GetBonesValue(BonesControl.StoreType.StoreMinValue, type).ToString();
if (GUILayout.Button(minValue))
{
target.SaveBonesValue(BonesControl.StoreType.StoreMinValue, type);
MakeSceneDirty();
}
using (var ccs = new EditorGUI.ChangeCheckScope())
{
target.progress[(int)type] = EditorGUILayout.Slider(target.progress[(int)type], -1, 1);
if (ccs.changed) target.UpdateProgress(type);
}
minValue = target.GetBonesValue(BonesControl.StoreType.StoreMaxValue, type).ToString();
if (GUILayout.Button(minValue))
{
target.SaveBonesValue(BonesControl.StoreType.StoreMaxValue, type);
MakeSceneDirty();
}
}
}
GUILayout.Space(2);
if (scope1.changed)
{
MakeSceneDirty();
}
}
}
19
View Source File : LODAsset.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
public LodUtil.Direct GUI(LodUtil.Direct direct)
{
if (meshes != null && go != null)
{
scroll = GUILayout.BeginScrollView(scroll);
GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
GUILayout.Label(go.name, LODGUI.totalStyle);
direct = (LodUtil.Direct)EditorGUILayout.EnumPopup(direct, GUILayout.MaxWidth(80));
if (GUILayout.Button("Visualize Bounds", GUILayout.MaxWidth(110)))
{
LodUtil.AttachCollider(go);
}
GUILayout.EndHorizontal();
GUILayout.Label("total verts: " + vertCnt + " tris: " + triCnt, LODGUI.totalStyle);
GUILayout.BeginHorizontal();
GUILayout.BeginVertical();
int i = 0;
foreach (var mesh in meshes)
{
GUILayout.BeginHorizontal();
GUIMesh(mesh);
GUILayout.BeginVertical();
GUILayout.Space(24);
GUILayout.Label(mesh.name);
GUILayout.Label("verts: " + mesh.vertexCount);
GUILayout.Label("tris: " + mesh.triangles.Length / 3);
GUILayout.Label("bounds: " + mesh.bounds);
GUILayout.BeginHorizontal();
var render = renders[i++];
var desc = "render bones: " + render.bones.Length + " matrix:" + mesh.bindposes.Length + " weights:" + mesh.boneWeights.Length;
if (GUILayout.Button(desc, UnityEngine.GUI.skin.label) || string.IsNullOrEmpty(boneInfo)) BoneInfo(render);
GUILayout.EndHorizontal();
desc = "skin ";
if (has(mesh.uv)) desc += "uv ";
if (has(mesh.uv2)) desc += "uv2 ";
if (has(mesh.uv3)) desc += "uv3 ";
if (has(mesh.uv4)) desc += "uv4 ";
if (has(mesh.normals)) desc += "normal ";
if (has(mesh.tangents)) desc += "tangent ";
if (has(mesh.colors)) desc += "color ";
if (mesh.subMeshCount > 1) desc += "submesh ";
GUILayout.Label(desc);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUILayout.Label(boneInfo);
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
else
{
GUILayout.Label("no gameobject attached");
}
return direct;
}
19
View Source File : LodDataEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void GuiButtons()
{
GUILayout.Space(8);
GUILayout.BeginHorizontal();
if (GUILayout.Button("Add"))
{
LodUtil.Add<LodNode>(ref odData.nodes, new LodNode("role"));
}
if (GUILayout.Button("Save"))
{
odData.Save();
}
GUILayout.EndHorizontal();
}
19
View Source File : LodWindow.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void OnGUI()
{
var initiallyEnabled = GUI.enabled;
if (SelectedLOD >= m_NumberOfLODs)
{
SelectedLOD = m_NumberOfLODs - 1;
}
GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.Label("Select Role: ");
role_pop = EditorGUILayout.Popup(role_pop, roles);
GUILayout.Space(8);
if (GUILayout.Button("load"))
{
LoadRole(lodNode);
UpdateInfo();
}
if (GUILayout.Button("save"))
{
float[] levels = m_LODs.Where(x => x.screenPercentage > 0 && x.screenPercentage < 1).Select(x => x.screenPercentage).ToArray();
string prefab = lodNode.prefab;
config.AddorUpdate(prefab, levels);
config.Save();
LodExport.Export(m_LODs.ToArray(), lodNode);
LodUtil.ReLoad(m_LODs, lodNode);
return;
}
GUILayout.EndHorizontal();
GUILayout.Space(18);
var sliderBarPosition = GUILayoutUtility.GetRect(0, LODGUI.kSliderBarHeight, GUILayout.ExpandWidth(true));
var lods = LODGUI.CreateLODInfos(m_NumberOfLODs, sliderBarPosition,
i => string.Format("LOD {0}", i),
i => m_LODs[i].screenPercentage);
DrawLODLevelSlider(sliderBarPosition, lods);
GUILayout.Space(LODGUI.kSliderBarBottomMargin);
if (QualitySettings.lodBias != 1.0f)
EditorGUILayout.HelpBox(string.Format("Active LOD bias is {0:0.0#}. Distances are adjusted accordingly.", QualitySettings.lodBias), MessageType.Warning);
GUILayout.Space(8);
GUILayout.Label(SelectedLOD < 0 ? "Culled" : "LOD " + SelectedLOD, LODGUI.selectStyle);
GUILayout.Space(8);
if (SelectedLOD >= 0)
{
var direct = m_LODs[SelectedLOD].GUI(m_direct);
if (m_direct != direct)
{
m_direct = direct;
UpdateBehavic();
}
}
GUILayout.EndVertical();
}
19
View Source File : LodWindow.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void OnGUI()
{
var initiallyEnabled = GUI.enabled;
if (SelectedLOD >= m_NumberOfLODs)
{
SelectedLOD = m_NumberOfLODs - 1;
}
GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.Label("Select Role: ");
role_pop = EditorGUILayout.Popup(role_pop, roles);
GUILayout.Space(8);
if (GUILayout.Button("load"))
{
LoadRole(lodNode);
UpdateInfo();
}
if (GUILayout.Button("save"))
{
float[] levels = m_LODs.Where(x => x.screenPercentage > 0 && x.screenPercentage < 1).Select(x => x.screenPercentage).ToArray();
string prefab = lodNode.prefab;
config.AddorUpdate(prefab, levels);
config.Save();
LodExport.Export(m_LODs.ToArray(), lodNode);
LodUtil.ReLoad(m_LODs, lodNode);
return;
}
GUILayout.EndHorizontal();
GUILayout.Space(18);
var sliderBarPosition = GUILayoutUtility.GetRect(0, LODGUI.kSliderBarHeight, GUILayout.ExpandWidth(true));
var lods = LODGUI.CreateLODInfos(m_NumberOfLODs, sliderBarPosition,
i => string.Format("LOD {0}", i),
i => m_LODs[i].screenPercentage);
DrawLODLevelSlider(sliderBarPosition, lods);
GUILayout.Space(LODGUI.kSliderBarBottomMargin);
if (QualitySettings.lodBias != 1.0f)
EditorGUILayout.HelpBox(string.Format("Active LOD bias is {0:0.0#}. Distances are adjusted accordingly.", QualitySettings.lodBias), MessageType.Warning);
GUILayout.Space(8);
GUILayout.Label(SelectedLOD < 0 ? "Culled" : "LOD " + SelectedLOD, LODGUI.selectStyle);
GUILayout.Space(8);
if (SelectedLOD >= 0)
{
var direct = m_LODs[SelectedLOD].GUI(m_direct);
if (m_direct != direct)
{
m_direct = direct;
UpdateBehavic();
}
}
GUILayout.EndVertical();
}
19
View Source File : F4VectorDrawer.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor)
{
EditorGUI.LabelField(position, label, EditorStyles.boldLabel);
position.y += 17.0f;
Vector4 value = prop.vectorValue;
EditorGUI.BeginChangeCheck();
float oldLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 0f;
DrawSlider(ref position, label0, min0, max0, ref value, 0);
DrawSlider(ref position, label1, min1, max1, ref value, 1);
DrawSlider(ref position, label2, min2, max2, ref value, 2);
DrawSlider(ref position, label3, min3, max3, ref value, 3);
EditorGUIUtility.labelWidth = oldLabelWidth;
EditorGUI.showMixedValue = false;
if (EditorGUI.EndChangeCheck())
{
prop.vectorValue = value;
}
GUILayout.Space(64);
}
19
View Source File : BonesControlEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
void DrawBoneControlRot(BonesControl target, KneadType type)
{
EditorGUILayout.Space();
using (var scope1 = new EditorGUI.ChangeCheckScope())
{
foldout[(int)type] = EditorGUILayout.Foldout(foldout[(int)type], BonesControl.GetLabel(type));
if (foldout[(int)type])
{
target.UnlockTransformElement(type);
float angle;
Vector3 axis;
GUILayout.Label("Min Value");
target.MRotation[0].ToAngleAxis(out angle, out axis);
EditorGUILayout.Vector3Field("Axis", axis);
EditorGUILayout.FloatField("Angle", angle);
GUILayout.Label("Max Value");
target.MRotation[1].ToAngleAxis(out angle, out axis);
EditorGUILayout.Vector3Field("Axis", axis);
EditorGUILayout.FloatField("Angle", angle);
using (var scope = new EditorGUILayout.HorizontalScope())
{
if (GUILayout.Button("SaveMin"))
{
target.SaveBonesValue(BonesControl.StoreType.StoreMinValue, type);
MakeSceneDirty();
}
using (var ccs = new EditorGUI.ChangeCheckScope())
{
target.progress[(int)type] = EditorGUILayout.Slider(target.progress[(int)type], -1, 1);
if (ccs.changed) target.UpdateProgress(type);
}
if (GUILayout.Button("SaveMax"))
{
target.SaveBonesValue(BonesControl.StoreType.StoreMaxValue, type);
MakeSceneDirty();
}
}
}
GUILayout.Space(2);
if (scope1.changed)
{
MakeSceneDirty();
}
}
}
19
View Source File : ColorGradingEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
void DoStandardModeGUI(bool hdr)
{
if (!hdr)
{
PropertyField(m_LdrLut);
PropertyField(m_LdrLutContribution);
var lut = (target as ColorGrading).ldrLut.value;
CheckLutImportSettings(lut);
}
if (hdr)
{
EditorGUILayout.Space();
EditorUtilities.DrawHeaderLabel("Tonemapping");
PropertyField(m_Tonemapper);
if (m_Tonemapper.value.intValue == (int)Tonemapper.Custom)
{
DrawCustomToneCurve();
PropertyField(m_ToneCurveToeStrength);
PropertyField(m_ToneCurveToeLength);
PropertyField(m_ToneCurveShoulderStrength);
PropertyField(m_ToneCurveShoulderLength);
PropertyField(m_ToneCurveShoulderAngle);
PropertyField(m_ToneCurveGamma);
}
}
EditorGUILayout.Space();
EditorUtilities.DrawHeaderLabel("White Balance");
PropertyField(m_Temperature);
PropertyField(m_Tint);
EditorGUILayout.Space();
EditorUtilities.DrawHeaderLabel("Tone");
if (hdr)
PropertyField(m_PostExposure);
PropertyField(m_ColorFilter);
PropertyField(m_HueShift);
PropertyField(m_Saturation);
if (!hdr)
PropertyField(m_Brightness);
PropertyField(m_Contrast);
EditorGUILayout.Space();
int currentChannel = GlobalSettings.currentChannelMixer;
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.PrefixLabel("Channel Mixer", GUIStyle.none, Styling.headerLabel);
EditorGUI.BeginChangeCheck();
{
using (new EditorGUILayout.HorizontalScope())
{
GUILayoutUtility.GetRect(9f, 18f, GUILayout.ExpandWidth(false)); // Dirty hack to do proper right column alignement
if (GUILayout.Toggle(currentChannel == 0, EditorUtilities.GetContent("Red|Red output channel."), EditorStyles.miniButtonLeft)) currentChannel = 0;
if (GUILayout.Toggle(currentChannel == 1, EditorUtilities.GetContent("Green|Green output channel."), EditorStyles.miniButtonMid)) currentChannel = 1;
if (GUILayout.Toggle(currentChannel == 2, EditorUtilities.GetContent("Blue|Blue output channel."), EditorStyles.miniButtonRight)) currentChannel = 2;
}
}
if (EditorGUI.EndChangeCheck())
GUI.FocusControl(null);
}
GlobalSettings.currentChannelMixer = currentChannel;
if (currentChannel == 0)
{
PropertyField(m_MixerRedOutRedIn);
PropertyField(m_MixerRedOutGreenIn);
PropertyField(m_MixerRedOutBlueIn);
}
else if (currentChannel == 1)
{
PropertyField(m_MixerGreenOutRedIn);
PropertyField(m_MixerGreenOutGreenIn);
PropertyField(m_MixerGreenOutBlueIn);
}
else
{
PropertyField(m_MixerBlueOutRedIn);
PropertyField(m_MixerBlueOutGreenIn);
PropertyField(m_MixerBlueOutBlueIn);
}
EditorGUILayout.Space();
EditorUtilities.DrawHeaderLabel("Trackballs");
using (new EditorGUILayout.HorizontalScope())
{
PropertyField(m_Lift);
GUILayout.Space(4f);
PropertyField(m_Gamma);
GUILayout.Space(4f);
PropertyField(m_Gain);
}
EditorGUILayout.Space();
EditorUtilities.DrawHeaderLabel("Grading Curves");
DoCurvesGUI(hdr);
}
19
View Source File : ColorGradingEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
void DrawCustomToneCurve()
{
EditorGUILayout.Space();
// Reserve GUI space
using (new GUILayout.HorizontalScope())
{
GUILayout.Space(EditorGUI.indentLevel * 15f);
m_CustomToneCurveRect = GUILayoutUtility.GetRect(128, 80);
}
if (Event.current.type != EventType.Repaint)
return;
// Prepare curve data
float toeStrength = m_ToneCurveToeStrength.value.floatValue;
float toeLength = m_ToneCurveToeLength.value.floatValue;
float shoulderStrength = m_ToneCurveShoulderStrength.value.floatValue;
float shoulderLength = m_ToneCurveShoulderLength.value.floatValue;
float shoulderAngle = m_ToneCurveShoulderAngle.value.floatValue;
float gamma = m_ToneCurveGamma.value.floatValue;
m_HableCurve.Init(
toeStrength,
toeLength,
shoulderStrength,
shoulderLength,
shoulderAngle,
gamma
);
float endPoint = m_HableCurve.whitePoint;
// Background
m_RectVertices[0] = PointInRect(0f, 0f, endPoint);
m_RectVertices[1] = PointInRect(endPoint, 0f, endPoint);
m_RectVertices[2] = PointInRect(endPoint, k_CustomToneCurveRangeY, endPoint);
m_RectVertices[3] = PointInRect(0f, k_CustomToneCurveRangeY, endPoint);
Handles.DrawSolidRectangleWithOutline(m_RectVertices, Color.white * 0.1f, Color.white * 0.4f);
// Vertical guides
if (endPoint < m_CustomToneCurveRect.width / 3)
{
int steps = Mathf.CeilToInt(endPoint);
for (var i = 1; i < steps; i++)
DrawLine(i, 0, i, k_CustomToneCurveRangeY, 0.4f, endPoint);
}
// Label
Handles.Label(m_CustomToneCurveRect.position + Vector2.right, "Custom Tone Curve", EditorStyles.miniLabel);
// Draw the acual curve
var vcount = 0;
while (vcount < k_CustomToneCurveResolution)
{
float x = endPoint * vcount / (k_CustomToneCurveResolution - 1);
float y = m_HableCurve.Eval(x);
if (y < k_CustomToneCurveRangeY)
{
m_CurveVertices[vcount++] = PointInRect(x, y, endPoint);
}
else
{
if (vcount > 1)
{
// Extend the last segment to the top edge of the rect.
var v1 = m_CurveVertices[vcount - 2];
var v2 = m_CurveVertices[vcount - 1];
var clip = (m_CustomToneCurveRect.y - v1.y) / (v2.y - v1.y);
m_CurveVertices[vcount - 1] = v1 + (v2 - v1) * clip;
}
break;
}
}
if (vcount > 1)
{
Handles.color = Color.white * 0.9f;
Handles.DrawAAPolyLine(2f, vcount, m_CurveVertices);
}
}
19
View Source File : EditorUtilities.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
public static void DrawFixMeBox(string text, Action action)
{
replacedert.IsNotNull(action);
EditorGUILayout.HelpBox(text, MessageType.Warning);
GUILayout.Space(-32);
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.FlexibleSpace();
if (GUILayout.Button("Fix", GUILayout.Width(60)))
action();
GUILayout.Space(8);
}
GUILayout.Space(11);
}
19
View Source File : PostProcessEffectBaseEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
protected void PropertyField(SerializedParameterOverride property, GUIContent replacedle)
{
// Check for DisplayNameAttribute first
var displayNameAttr = property.GetAttribute<DisplayNameAttribute>();
if (displayNameAttr != null)
replacedle.text = displayNameAttr.displayName;
// Add tooltip if it's missing and an attribute is available
if (string.IsNullOrEmpty(replacedle.tooltip))
{
var tooltipAttr = property.GetAttribute<TooltipAttribute>();
if (tooltipAttr != null)
replacedle.tooltip = tooltipAttr.tooltip;
}
// Look for a compatible attribute decorator
AttributeDecorator decorator = null;
Attribute attribute = null;
foreach (var attr in property.attributes)
{
// Use the first decorator we found
if (decorator == null)
{
decorator = EditorUtilities.GetDecorator(attr.GetType());
attribute = attr;
}
// Draw unity built-in Decorators (Space, Header)
if (attr is PropertyAttribute)
{
if (attr is SpaceAttribute)
{
EditorGUILayout.GetControlRect(false, (attr as SpaceAttribute).height);
}
else if (attr is HeaderAttribute)
{
var rect = EditorGUILayout.GetControlRect(false, 24f);
rect.y += 8f;
rect = EditorGUI.IndentedRect(rect);
EditorGUI.LabelField(rect, (attr as HeaderAttribute).header, Styling.headerLabel);
}
}
}
bool invalidProp = false;
if (decorator != null && !decorator.IsAutoProperty())
{
if (decorator.OnGUI(property.value, property.overrideState, replacedle, attribute))
return;
// Attribute is invalid for the specified property; use default unity field instead
invalidProp = true;
}
using (new EditorGUILayout.HorizontalScope())
{
// Override checkbox
var overrideRect = GUILayoutUtility.GetRect(17f, 17f, GUILayout.ExpandWidth(false));
overrideRect.yMin += 4f;
EditorUtilities.DrawOverrideCheckbox(overrideRect, property.overrideState);
// Property
using (new EditorGUI.DisabledScope(!property.overrideState.boolValue))
{
if (decorator != null && !invalidProp)
{
if (decorator.OnGUI(property.value, property.overrideState, replacedle, attribute))
return;
}
// Default unity field
if (property.value.hasVisibleChildren
&& property.value.propertyType != SerializedPropertyType.Vector2
&& property.value.propertyType != SerializedPropertyType.Vector3)
{
GUILayout.Space(12f);
EditorGUILayout.PropertyField(property.value, replacedle, true);
}
else
{
EditorGUILayout.PropertyField(property.value, replacedle);
}
}
}
}
19
View Source File : PostProcessLayerEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
void DoToolkit()
{
EditorUtilities.DrawSplitter();
m_ShowToolkit.boolValue = EditorUtilities.DrawHeader("Toolkit", m_ShowToolkit.boolValue);
if (m_ShowToolkit.boolValue)
{
GUILayout.Space(2);
if (GUILayout.Button(EditorUtilities.GetContent("Export frame to EXR..."), EditorStyles.miniButton))
{
var menu = new GenericMenu();
menu.AddItem(EditorUtilities.GetContent("Full Frame (as displayed)"), false, () => ExportFrameToExr(ExportMode.FullFrame));
menu.AddItem(EditorUtilities.GetContent("Disable post-processing"), false, () => ExportFrameToExr(ExportMode.DisablePost));
menu.AddItem(EditorUtilities.GetContent("Break before Color Grading (Linear)"), false, () => ExportFrameToExr(ExportMode.BreakBeforeColorGradingLinear));
menu.AddItem(EditorUtilities.GetContent("Break before Color Grading (Log)"), false, () => ExportFrameToExr(ExportMode.BreakBeforeColorGradingLog));
menu.ShowAsContext();
}
if (GUILayout.Button(EditorUtilities.GetContent("Select all layer volumes|Selects all the volumes that will influence this layer."), EditorStyles.miniButton))
{
var volumes = RuntimeUtilities.GetAllSceneObjects<PostProcessVolume>()
.Where(x => (m_VolumeLayer.intValue & (1 << x.gameObject.layer)) != 0)
.Select(x => x.gameObject)
.Cast<UnityEngine.Object>()
.ToArray();
if (volumes.Length > 0)
Selection.objects = volumes;
}
if (GUILayout.Button(EditorUtilities.GetContent("Select all active volumes|Selects all volumes currently affecting the layer."), EditorStyles.miniButton))
{
var volumes = new List<PostProcessVolume>();
PostProcessManager.instance.GetActiveVolumes(m_Target, volumes);
if (volumes.Count > 0)
{
Selection.objects = volumes
.Select(x => x.gameObject)
.Cast<UnityEngine.Object>()
.ToArray();
}
}
GUILayout.Space(3);
}
}
19
View Source File : PostProcessLayerEditor.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
void DoCustomEffectSorter()
{
EditorUtilities.DrawSplitter();
m_ShowCustomSorter.boolValue = EditorUtilities.DrawHeader("Custom Effect Sorting", m_ShowCustomSorter.boolValue);
if (m_ShowCustomSorter.boolValue)
{
bool isInPrefab = false;
// Init lists if needed
if (m_CustomLists == null)
{
// In some cases the editor will refresh before components which means
// components might not have been fully initialized yet. In this case we also
// need to make sure that we're not in a prefab as sorteBundles isn't a
// serializable object and won't exist until put on a scene.
if (m_Target.sortedBundles == null)
{
isInPrefab = string.IsNullOrEmpty(m_Target.gameObject.scene.name);
if (!isInPrefab)
{
// sortedBundles will be initialized and ready to use on the next frame
Repaint();
}
}
else
{
// Create a reorderable list for each injection event
m_CustomLists = new Dictionary<PostProcessEvent, ReorderableList>();
foreach (var evt in Enum.GetValues(typeof(PostProcessEvent)).Cast<PostProcessEvent>())
{
var bundles = m_Target.sortedBundles[evt];
var listName = ObjectNames.NicifyVariableName(evt.ToString());
var list = new ReorderableList(bundles, typeof(SerializedBundleRef), true, true, false, false);
list.drawHeaderCallback = (rect) =>
{
EditorGUI.LabelField(rect, listName);
};
list.drawElementCallback = (rect, index, isActive, isFocused) =>
{
var sbr = (SerializedBundleRef)list.list[index];
EditorGUI.LabelField(rect, sbr.bundle.attribute.menuItem);
};
list.onReorderCallback = (l) =>
{
EditorUtility.SetDirty(m_Target);
};
m_CustomLists.Add(evt, list);
}
}
}
GUILayout.Space(5);
if (isInPrefab)
{
EditorGUILayout.HelpBox("Not supported in prefabs.", MessageType.Info);
GUILayout.Space(3);
return;
}
bool anyList = false;
if (m_CustomLists != null)
{
foreach (var kvp in m_CustomLists)
{
var list = kvp.Value;
// Skip empty lists to avoid polluting the inspector
if (list.count == 0)
continue;
list.DoLayoutList();
anyList = true;
}
}
if (!anyList)
{
EditorGUILayout.HelpBox("No custom effect loaded.", MessageType.Info);
GUILayout.Space(3);
}
}
}
19
View Source File : EditorTransformTrack.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
protected override void OnInspectorTrack()
{
base.OnInspectorTrack();
if (track.parent == null) EditorGUILayout.HelpBox("no parent bind", MessageType.Warning);
GUILayout.Label("time: " + SeqenceWindow.inst.seqence.Time.ToString("f2"));
bool recd = track.record;
Vector3 pos = target.transform.localPosition;
float rot = target.transform.localEulerAngles.y;
if (recd)
{
EditorGUI.BeginChangeCheck();
using (new GUIColorOverride(Color.red))
{
pos = EditorGUILayout.Vector3Field("pos", pos);
rot = EditorGUILayout.FloatField("rotY", rot);
}
if (EditorGUI.EndChangeCheck())
{
target.transform.localPosition = pos;
var v3 = target.transform.localEulerAngles;
v3.y = rot;
target.transform.localEulerAngles = v3;
AddItem(SeqenceWindow.inst.seqence.Time);
}
}
else
{
pos = EditorGUILayout.Vector3Field("pos", pos);
rot = EditorGUILayout.FloatField("rotY", rot);
}
folder = EditorGUILayout.Foldout(folder, "frames");
if (Data?.time != null)
{
if (folder)
{
EditorGUILayout.Space();
for (int i = 0; i < Data.time.Length; i++)
{
GUILayout.BeginHorizontal();
GUILayout.Space(16);
GUILayout.Label((i + 1) + ". time: " + Data.time[i].ToString("f2"), SeqenceStyle.replacedleStyle);
GUILayout.FlexibleSpace();
if (GUILayout.Button("x", GUI.skin.label, GUILayout.MaxWidth(20)))
{
(track as XTransformTrack).RmItemAt(i);
SeqenceWindow.inst.Repaint();
GUIUtility.ExitGUI();
}
GUILayout.EndHorizontal();
pos = Data.pos[i];
pos = EditorGUILayout.Vector3Field("pos", pos);
rot = Data.pos[i].w;
rot = EditorGUILayout.FloatField("rotY", rot);
Data.pos[i] = new Vector4(pos.x, pos.y, pos.z, rot);
EditorGUILayout.Space();
}
}
}
else
{
EditorGUILayout.HelpBox("not config time frame", MessageType.Warning);
}
}
19
View Source File : AssetConfig.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
public void OnGUI()
{
folder = EditorGUILayout.Foldout(folder, type.ToString());
if (folder)
{
type = (MarkType) EditorGUILayout.EnumPopup("type: ", type);
ico = (Texture2D) EditorGUILayout.ObjectField("ico: ", ico, typeof(Texture2D), false);
GUILayout.Space(4);
}
}
19
View Source File : AssetConfig.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void GuiButtons()
{
GUILayout.Space(8);
GUILayout.BeginVertical();
if (conf.marks != null)
{
foreach (var mark in conf.marks)
{
mark.OnGUI();
}
}
GUILayout.BeginHorizontal();
if (GUILayout.Button("AddMark"))
{
AddMark();
}
if (GUILayout.Button("Save"))
{
OnSave();
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
19
View Source File : SeqenceInspector.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void GUIMark()
{
var seqence = SeqenceWindow.inst.seqence;
var marks = seqence?.trackTrees?[0].marks;
if (marks != null && (emarks == null || emarks.Length != marks.Length))
{
int len = marks.Length;
emarks = new EditorMark[len];
for (int i = 0; i < len; i++)
{
emarks[i] = (EditorMark) TypeUtilities.InitEObject(marks[i]);
}
}
if (emarks != null)
{
using (new GUIColorOverride(Color.green))
{
markF = EditorGUILayout.Foldout(markF, "marks", SeqenceStyle.boldFoldStyle);
}
if (markF)
{
foreach (var mark in emarks)
{
mark.Inspector();
}
}
}
GUILayout.Space(4);
}
19
View Source File : SeqenceInspector.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void GUITracks()
{
var trees = SeqenceWindow.inst.tree;
if (trees?.hierachy != null)
{
foreach (var track in trees.hierachy)
{
ISeqenceInspector gui = (ISeqenceInspector) track;
gui.OnInspector();
GUILayout.Space(4);
}
}
}
19
View Source File : DefaultGraphRenderer.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void DrawLegend(GraphSettings graphSettings, Rect legendArea)
{
EditorGUI.DrawRect(legendArea, s_LegendBackground);
// Add a border around legend area
legendArea.x += s_BorderSize;
legendArea.width -= s_BorderSize * 2;
legendArea.y += s_BorderSize;
legendArea.height -= s_BorderSize * 2;
GUILayout.BeginArea(legendArea);
GUILayout.BeginVertical();
if (graphSettings.showInspector)
{
GUILayout.Label("Inspector", m_SubreplacedleStyle);
if (m_SelectedNode != null)
{
using (var scrollView = new EditorGUILayout.ScrollViewScope(m_ScrollPos))
{
m_ScrollPos = scrollView.scrollPosition;
GUILayout.Label(m_SelectedNode.ToString(), m_InspectorStyle);
}
}
else
{
GUILayout.Label("Click on a node\nto display its details.");
}
}
GUILayout.FlexibleSpace();
if (graphSettings.showLegend)
{
GUILayout.Label("Legend", m_SubreplacedleStyle);
foreach (var pair in m_LegendForType)
{
DrawLegendEntry(pair.Value.color, pair.Value.label, false);
}
DrawLegendEntry(Color.gray, "Playing", true);
GUILayout.Space(20);
GUILayout.Label("Edge weight", m_SubreplacedleStyle);
GUILayout.BeginHorizontal();
GUILayout.Label("0");
GUILayout.FlexibleSpace();
GUILayout.Label("1");
GUILayout.EndHorizontal();
DrawEdgeWeightColorBar(legendArea.width);
GUILayout.Space(20);
}
GUILayout.EndVertical();
GUILayout.EndArea();
}
19
View Source File : CharacterWindow.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void OnGUI()
{
GUILayout.Label("Select a character", SeqenceStyle.replacedleStyle);
GUILayout.Space(4);
search = GuiSearch(search);
var chars = chInfo.characters;
GUILayout.BeginVertical(GUI.skin.label);
for (int i = 0; i < chars.Length; i++)
{
string desc = (i + 1) + ". " + Desc(chars[i]);
if (MatchSearch(chars[i]))
{
if (GUILayout.Button(desc, SeqenceStyle.btnLableStyle))
{
character = chars[i];
Close();
}
}
}
GUILayout.EndVertical();
}
19
View Source File : DefaultGraphRenderer.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
private void DrawLegendEntry(Color color, string label, bool active)
{
GUILayout.Space(5);
GUILayout.BeginHorizontal(GUILayout.Height(20));
Rect legendIconRect = GUILayoutUtility.GetRect(1, 1, GUILayout.Width(20), GUILayout.Height(20));
DrawRect(legendIconRect, color, string.Empty, active);
GUILayout.Label(label, m_LegendLabelStyle);
GUILayout.EndHorizontal();
}
19
View Source File : EditorMark.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
public void Inspector()
{
GUILayout.BeginHorizontal();
GUIContent cont = SeqenceWindow.inst.state.config.GetIcon(baseMarker.type);
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("- " + baseMarker.type, SeqenceStyle.replacedleStyle);
GUILayout.Space(4);
GUILayout.Box(cont, GUIStyle.none, GUILayout.MaxWidth(10), GUILayout.MaxHeight(12));
GUILayout.EndHorizontal();
baseMarker.time = EditorGUILayout.FloatField(" time", baseMarker.time);
baseMarker.reverse = EditorGUILayout.Toggle(" reverse", baseMarker.reverse);
OnInspector();
EditorGUI.indentLevel--;
}
19
View Source File : EditorTrack.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
protected void GUIHeader()
{
var tmp = RenderHead;
tmp.y += tmp.height / 4;
GUILayout.BeginArea(tmp);
GUILayout.BeginHorizontal();
GUILayout.Space(5);
GUILayout.Label(trackHeader);
OnGUIHeader();
if (track.mute)
{
if (GUILayout.Button(SeqenceStyle.muteContent, SeqenceStyle.icoStyle)) track.SetFlag(TrackMode.Mute, false);
}
if (track.locked)
{
if (GUILayout.Button(SeqenceStyle.lockContent, SeqenceStyle.icoStyle)) track.SetFlag(TrackMode.Lock, false);
}
if (warn)
{
GUILayout.Label(SeqenceStyle.warn_ico, GUILayout.MaxWidth(20));
}
var tree = SeqenceWindow.inst.tree;
if (track.hasChilds)
{
GUILayout.Space(4);
if (GUILayout.Button(SeqenceStyle.sequenceSelectorIcon, SeqenceStyle.bottomShadow))
{
if (showChild)
tree.RmChildTrack(track);
else
tree.AddChildTracks(track);
showChild = !showChild;
}
}
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
19
View Source File : SeqenceWindow_Toolbar.cs
License : MIT License
Project Creator : huailiang
License : MIT License
Project Creator : huailiang
void TransportToolbarGUI()
{
GUILayout.BeginHorizontal();
GUILayout.BeginHorizontal(GUILayout.Width(WindowConstants.playmodeWidth));
{
PlayModeGUI();
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(GUILayout.Width(WindowConstants.sliderWidth));
{
GotoBeginingSequenceGUI();
PreviousEventButtonGUI();
PlayButtonGUI();
NextEventButtonGUI();
GotoEndSequenceGUI();
GUILayout.FlexibleSpace();
TimeCodeGUI();
}
GUILayout.EndHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label(state.Name);
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal(GUILayout.Width(WindowConstants.sliderWidth));
{
NewButtonGUI();
OpenButtonGUI();
SaveButtonGUI();
GUILayout.Space(4);
InspectGUI();
}
GUILayout.EndHorizontal();
GUILayout.EndHorizontal();
}
19
View Source File : GUIHelper.cs
License : MIT License
Project Creator : huanzi-qch
License : MIT License
Project Creator : huanzi-qch
public static void DrawArea(Rect area, bool drawHeader, Action action)
{
Setup();
// Draw background
GUI.Box(area, string.Empty);
GUILayout.BeginArea(area);
if (drawHeader)
{
GUIHelper.DrawCenteredText(SampleSelector.SelectedSample.DisplayName);
GUILayout.Space(5);
}
if (action != null)
action();
GUILayout.EndArea();
}
See More Examples