//-------------------------------------------------------------------------------------------------- public override void EnrichContextMenu(CustomMenuItems itemList) { if (Entity.Sketch != null) { itemList.AddCommand(SketchCommands.StartSketchEditor, Entity.Sketch); } }
//-------------------------------------------------------------------------------------------------- public override void EnrichContextMenu(CustomMenuItems itemList) { void __AddIfExecutable(IActionCommand command, object param) { if (SketchCommands.CreateConstraint.CanExecute(param)) { itemList.AddCommand(SketchCommands.CreateConstraint, param); } } //-------------------------------------------------------------------------------------------------- itemList.AddCommand(SketchCommands.CloseSketchEditor, null); itemList.AddGroup("Create Segment"); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.Line); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.PolyLine); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.Bezier2); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.Bezier3); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.Circle); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.ArcCenter); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.ArcRim); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.EllipseCenter); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.EllipticalArcCenter); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.Segments.Rectangle); itemList.CloseGroup(); itemList.AddGroup("Create Constraint"); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Fixed); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.LineLength); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Angle); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.CircleRadius); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Equal); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Perpendicular); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Parallel); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Concentric); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Horizontal); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Vertical); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.HorizontalDistance); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.VerticalDistance); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.Tangent); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.PointOnSegment); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.PointOnMidpoint); __AddIfExecutable(SketchCommands.CreateConstraint, SketchCommands.Constraints.SmoothCorner); itemList.CloseGroup(); itemList.AddCommand(SketchCommands.SplitElement); itemList.AddGroup("Convert Segment"); __AddIfExecutable(SketchCommands.ConvertSegment, SketchCommands.Segments.Line); __AddIfExecutable(SketchCommands.ConvertSegment, SketchCommands.Segments.Bezier); __AddIfExecutable(SketchCommands.ConvertSegment, SketchCommands.Segments.Arc); __AddIfExecutable(SketchCommands.ConvertSegment, SketchCommands.Segments.EllipticalArc); itemList.CloseGroup(); itemList.AddCommand(SketchCommands.RecenterGrid); }
public void OnImportsSatisfied() { contextMenu.Items.Remove(customMenuItem); if (CustomMenuItems.Count() > 0) { contextMenu.Items.Add(customMenuItem); foreach (var importedCustomMenuItem in CustomMenuItems) { customMenuItem.Items.Add(importedCustomMenuItem); } } }
public override void OnInspectorGUI() { EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); { base.OnInspectorGUI(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Execute", GUILayout.Height(40))) { CustomMenuItems.BuildAssetDetailConfig(); EditorUtility.DisplayDialog("Finished", "Finished", "OK"); } if (GUILayout.Button("Filter", GUILayout.Height(40))) { List <string> files = new List <string>(); AssetGroupCreater group = target as AssetGroupCreater; files.AddRange(group.GetAssetPaths()); listViewer = new EGUIListView <string>(); listViewer.Header = "Asset List"; listViewer.OnDrawItem = (rect, index) => { Rect indexRect = new Rect(rect.x, rect.y, 20, rect.height); EditorGUI.PrefixLabel(indexRect, new GUIContent("" + index)); Rect itemRect = new Rect(rect.x + indexRect.width, rect.y, rect.width - indexRect.width, rect.height); EditorGUI.LabelField(itemRect, listViewer.GetItem(index)); }; listViewer.AddItems(files.ToArray()); } EGUILayout.DrawHorizontalLine(); if (listViewer != null) { Rect lastRect = EditorGUILayout.GetControlRect(false, 300, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); if (Event.current.type == EventType.Repaint) { listViewer.OnGUI(lastRect); } } } EditorGUILayout.EndVertical(); }
//-------------------------------------------------------------------------------------------------- public override void EnrichContextMenu(CustomMenuItems itemList) { itemList.AddCommand(SketchCommands.CloseSketchEditor, null); itemList.AddGroup("Create Segment"); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.Line); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.PolyLine); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.Bezier2); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.Bezier3); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.Circle); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.ArcCenter); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.ArcRim); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.EllipseCenter); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.EllipticalArcCenter); itemList.AddCommand(SketchCommands.CreateSegment, SketchCommands.SegmentCreator.Rectangle); itemList.CloseGroup(); itemList.AddGroup("Create Constraint"); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Fixed); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.LineLength); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Angle); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.CircleRadius); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Equal); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Perpendicular); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Parallel); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Concentric); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Horizontal); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Vertical); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.HorizontalDistance); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.VerticalDistance); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.Tangent); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.PointOnSegment); itemList.AddCommand(SketchCommands.CreateConstraint, SketchCommands.Constraints.PointOnMidpoint); itemList.CloseGroup(); itemList.AddCommand(SketchCommands.RecenterGrid); }
//-------------------------------------------------------------------------------------------------- public override void EnrichContextMenu(CustomMenuItems itemList) { itemList.AddCommand(SketchCommands.StartSketchEditor, Entity); itemList.AddCommand(ModelCommands.CreateExtrude, Entity); itemList.AddCommand(ModelCommands.CreateRevolve, Entity); }
//-------------------------------------------------------------------------------------------------- public override void EnrichContextMenu(CustomMenuItems itemList) { _ShapePanel.EnrichMainContextMenu(itemList); }
//-------------------------------------------------------------------------------------------------- public void EnrichMainContextMenu(CustomMenuItems itemList) { _SelectedEditor?.EnrichContextMenu(itemList); }