Esempio n. 1
0
        void OnGUI()
        {
            using (var horizonal = new EditorGUILayout.HorizontalScope("box")) {
                EditorGUILayout.LabelField ("delete unreference assets from buildsettings and resources");

                if (GUILayout.Button ("Delete", GUILayout.Width (120), GUILayout.Height (40)) && deleteAssets.Count != 0) {
                    RemoveFiles ();
                    Close ();
                }
            }

            using (var scrollScope = new EditorGUILayout.ScrollViewScope(scroll)) {
                scroll = scrollScope.scrollPosition;
                foreach (var asset in deleteAssets) {
                    if (string.IsNullOrEmpty (asset.path)) {
                        continue;
                    }

                    using (var horizonal = new EditorGUILayout.HorizontalScope()) {
                        asset.isDelete = EditorGUILayout.Toggle (asset.isDelete, GUILayout.Width (20));
                        var icon = AssetDatabase.GetCachedIcon (asset.path);
                        GUILayout.Label (icon, GUILayout.Width (20), GUILayout.Height (20));
                        if (GUILayout.Button (asset.path, EditorStyles.largeLabel)) {
                            Selection.activeObject = AssetDatabase.LoadAssetAtPath<Object> (asset.path);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
		void OnGUI ()
		{
			EditorGUILayout.LabelField ("target clip");
			EditorGUI.BeginChangeCheck ();
			controller = EditorGUILayout.ObjectField (controller, typeof(UnityEditor.Animations.AnimatorController), false) as UnityEditor.Animations.AnimatorController;
			if (EditorGUI.EndChangeCheck ()) {
				RefleshClipList (controller);
			}

			if (controller == null)
				return;

			EditorGUILayout.Space ();
			EditorGUILayout.HelpBox ("Type a new clip name", MessageType.None);
			EditorGUILayout.BeginVertical ("box");

			clipName = EditorGUILayout.TextField (clipName);

			if (clipList.Exists (item => item.name == clipName) || string.IsNullOrEmpty (clipName)) {
				//EditorGUILayout.LabelField ("can't create duplicate name or empty");
			} else {
				if (GUILayout.Button ("Add Clip")) {
					AddClip (clipName);
					clipName = string.Empty;
					RefleshClipList (controller);
					Repaint ();
				}
			}
			EditorGUILayout.EndVertical ();
			if (clipList.Count == 0)
				return;

			EditorGUILayout.Space ();

			using (var scrollView = new EditorGUILayout.ScrollViewScope (scroll)) {
				scroll = scrollView.scrollPosition;
				EditorGUILayout.HelpBox ("clips", MessageType.None);
				EditorGUILayout.BeginVertical ("box");

				foreach (var removeClip in clipList.ToArray()) {
					EditorGUILayout.BeginHorizontal ();

					EditorGUILayout.LabelField (removeClip.name);
					if (GUILayout.Button ("Remove Clip", GUILayout.Width (100))) {
						RemoveClip (removeClip);
						RefleshClipList (controller);
					}
					EditorGUILayout.EndHorizontal ();
				}
				EditorGUILayout.EndVertical ();


			}
		}
Esempio n. 3
0
		void OnGUI ()
		{
			EditorGUILayout.LabelField ("path", folderPath);
			oldName = EditorGUILayout.TextField ("old Name", oldName);
			newName = EditorGUILayout.TextField ("new Name",newName);

			if (GUILayout.Button ("Rename")) {
				Rename (folderPath, oldName, newName);
				AssetDatabase.Refresh (ImportAssetOptions.ForceUpdate);
			}

			if (isOpenTargets) {

				using( var scrollScope = new EditorGUILayout.ScrollViewScope(scroll) ){
					scroll = scrollScope.scrollPosition;
					var files = GetSelectedPath(folderPath, oldName);
					foreach (var file in files) {
						var obj = AssetDatabase.LoadAssetAtPath<Object> (file);
						Assert.IsTrue(obj != null, file);
						EditorGUILayout.ObjectField (obj, obj.GetType (), false);
					}
				}
			}
		}
        void OnGUI()
        {
            if (flg)
            {
                flg = false;
                PrefsLoad();
            }

            using (EditorGUILayout.ScrollViewScope scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition))
            {
                scrollPosition = scrollView.scrollPosition;
                using (new EditorGUILayout.VerticalScope())
                {
                    outputFolderName = EditorGUILayout.TextField("Output folder", outputFolderName);
                    pixelPerUnit = EditorGUILayout.IntField("Pixel per unit", pixelPerUnit);
                    interpolation = (Interpolation)EditorGUILayout.EnumPopup("Curve interpolation", interpolation);
                }
                if (GUILayout.Button("Import"))
                {
                    EditorApplication.delayCall += OpenFilePanel;
                }
            }
        }
        private void DrawGUINodeGraph()
        {
            background.Draw(graphRegion, scrollPos);

            using(var scrollScope = new EditorGUILayout.ScrollViewScope(scrollPos) ) {
                scrollPos = scrollScope.scrollPosition;

                // draw node window x N.
                {
                    BeginWindows();

                    nodes.ForEach(node => node.DrawNode());

                    EndWindows();
                }

                // draw connection input point marks.
                foreach (var node in nodes) {
                    node.DrawConnectionInputPointMark(currentEventSource, modifyMode == ModifyMode.CONNECTING);
                }

                // draw connections.
                foreach (var con in connections) {
                    var keyEnum = s_assetStreamMap.Keys.Where(c => c.Id == con.Id);
                    if (keyEnum.Any()) {
                        var assets = s_assetStreamMap[keyEnum.First()];
                        con.DrawConnection(nodes, assets);
                    } else {
                        con.DrawConnection(nodes, new Dictionary<string, List<Asset>>());
                    }
                }

                // draw connection output point marks.
                foreach (var node in nodes) {
                    node.DrawConnectionOutputPointMark(currentEventSource, modifyMode == ModifyMode.CONNECTING, Event.current);
                }

                // draw connecting line if modifing connection.
                switch (modifyMode) {
                case ModifyMode.CONNECTING: {
                        // from start node to mouse.
                        DrawStraightLineFromCurrentEventSourcePointTo(Event.current.mousePosition, currentEventSource);
                        break;
                    }
                case ModifyMode.SELECTING: {
                        GUI.DrawTexture(new Rect(selection.x, selection.y, Event.current.mousePosition.x - selection.x, Event.current.mousePosition.y - selection.y), selectionTex);
                        break;
                    }
                }

                // handle Graph GUI events
                HandleGraphGUIEvents();

                // set rect for scroll.
                if (nodes.Any()) {
                    GUILayoutUtility.GetRect(new GUIContent(string.Empty), GUIStyle.none, GUILayout.Width(spacerRectRightBottom.x), GUILayout.Height(spacerRectRightBottom.y));
                }
            }
            if(Event.current.type == EventType.Repaint) {
                var newRgn = GUILayoutUtility.GetLastRect();
                if(newRgn != graphRegion) {
                    graphRegion = newRgn;
                    Repaint();
                }
            }
        }
        protected void OnGUI()
        {
            GUI.skin.label.richText = true;
            
#if UNITY_5
            using (var verticalScope = new EditorGUILayout.VerticalScope())
            {
                using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition, GUILayout.Width(base.position.width), GUILayout.Height(base.position.height - 16)))
                {
                    scrollPosition = scrollView.scrollPosition;
#else
            {
                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition, false, true);
                {
#endif
                    GUILayout.Space(8f);

                    if (ShowAboutFirst)
                    {
                        this.DrawAboutCinemaSuiteSection();
                    }

                    Rect productsRect = EditorGUILayout.GetControlRect(GUILayout.Width(base.position.width - 22));
                    GUI.Box(new Rect(productsRect.x-4, productsRect.y, productsRect.width+8, productsRect.height), string.Empty, EditorStyles.toolbar);
                    showInstalledProducts.target = EditorGUI.Foldout(productsRect, showInstalledProducts.target, "Installed Products");

                    if (showInstalledProducts.target)
                    {
                        if (installedProducts.Count > 0)
                        {
                            foreach (ProductInfo product in installedProducts)
                            {
                                drawProduct(product);
                            }
                        }

                        
                    }

                    Rect availProductsRect = EditorGUILayout.GetControlRect(GUILayout.Width(base.position.width - 22));
                    GUI.Box(new Rect(availProductsRect.x - 4, availProductsRect.y, availProductsRect.width + 8, availProductsRect.height), string.Empty, EditorStyles.toolbar);
                    showAvailableProducts.target = EditorGUI.Foldout(availProductsRect, showAvailableProducts.target, "Available Products");

                    if (showAvailableProducts.target)
                    {
                        // Draw the available products
                        if (availableProducts.Count > 0)
                        {
                            foreach (ProductInfo product in availableProducts)
                            {
                                drawProduct(product);
                            }

                            GUILayout.Space(4f);
                        }
                    }

                    if (!ShowAboutFirst)
                    {
                        this.DrawAboutCinemaSuiteSection();
                    }
                }
#if !UNITY_5
                EditorGUILayout.EndScrollView();
#endif
            }


            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            bool tempShowOnStartup = EditorGUILayout.Toggle(new GUIContent("Show on Startup"), showOnStartup);
            if(tempShowOnStartup != showOnStartup)
            {
                showOnStartup = tempShowOnStartup;
                EditorPrefs.SetBool("CinemaSuite.WelcomeWindow.ShowOnStartup", showOnStartup);
            }
            EditorGUILayout.EndHorizontal();
        }