public override void OnInspectorGUI() { if (SVNActiveForObject()) { DrawDefaultGameObjectGUI(); EditorGUILayout.BeginVertical(SVNGUIControls.GetSVNBox(mSVNStatus)); DrawSVNStatusGUI(); if (EditorUtility.GetPrefabType(mGameObject) != PrefabType.None) { DrawPrefabGUI(); } EditorGUILayout.EndVertical(); } }
void DrawSVNStatusGUI() { SVNUtility.RefreshEditableObject(mGameObject); //GUILayout.Label("prefab type: " + EditorUtility.GetPrefabType(gameObject) + " svn: " + svnStatus.lockStatus); EditorGUILayout.BeginHorizontal(); bool isModified = mSVNStatus.fileStatus == ESVNFileStatus.Modified; string labelPrefix = ""; labelPrefix += (isModified ? "*" : ""); labelPrefix += "[" + SVNGUIControls.GetObjectTypeName(mGameObject) + "] "; labelPrefix += SVNGUIControls.GetLockStatusMessage(mSVNStatus); var labelContent = new GUIContent(labelPrefix, mAssetpath); GUILayout.Label(labelContent, SVNGUIControls.GetLockStatusStyle(mSVNStatus)); EditorGUILayout.EndHorizontal(); }
void DrawPrefabGUI() { var prefabType = EditorUtility.GetPrefabType(mGameObject); var prefabParent = EditorUtility.GetPrefabParent(mGameObject) as GameObject; EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); GUIStyle buttonStyle = EditorStyles.toolbarButton; bool showAddCommit = SVNUtility.IsPrefab(mGameObject, true, false, false); bool showLockByPass = SVNUtility.IsPrefab(mGameObject, true, false, false); bool showRevert = SVNUtility.IsPrefab(mGameObject) && SVNUtility.HaveAssetControl(mSVNStatus); SVNGUIControls.SVNStatusGUI(buttonStyle, mSVNStatus, mGameObject, showAddCommit, showLockByPass, showRevert); if (!SVNUtility.IsPrefabParent(mGameObject)) { if (SVNUtility.IsPrefab(mGameObject, true, false, true)) // non-model prefabs { if (GUILayout.Button("Apply", buttonStyle)) { SVNUtility.ApplyPrefab(mGameObject); SVNCommands.UpdateLocalSVNStatus(); } } if (SVNUtility.IsPrefab(mGameObject, true, false, true)) // non-model prefabs { if (GUILayout.Button("Disconnect", buttonStyle)) { SVNUtility.DisconnectPrefab(mGameObject); } } if (prefabParent != null) // has a prefab parent (prefab on disk) { if (GUILayout.Button("Select", buttonStyle)) { SVNUtility.SelectPrefab(mGameObject); } } } EditorGUILayout.EndHorizontal(); }