public AddToGroupChange(FScene scene, GroupSO group, SceneObject so) { this.Scene = scene; this.Group = group; this.Objects = new List <SceneObject>() { so }; }
public AddToGroupChange(FScene scene, GroupSO group, TransformableSO so) { this.Scene = scene; this.Group = group; this.Objects = new List <TransformableSO>() { so }; }
public override OpStatus Apply() { if (created_group == null) { created_group = new GroupSO(); created_group.Create(); Scene.AddSceneObject(created_group, false); } else { Scene.RestoreDeletedSceneObject(created_group); } created_group.AddChildren(Objects); return(OpStatus.Success); }
public static GroupSO CreateGroupSO(TransformableSO so1, TransformableSO so2) { FScene scene = so1.GetScene(); if (scene.IsSelected(so1)) { scene.Deselect(so1); } if (scene.IsSelected(so2)) { scene.Deselect(so2); } GroupSO group = new GroupSO(); group.Create(); scene.AddSceneObject(group); group.AddChild(so1); group.AddChild(so2); return(group); }
public void Initialize(Cockpit cockpit) { cockpit.Name = "cadSceneCockpit"; // configure tracking SmoothCockpitTracker.Enable(cockpit); cockpit.TiltAngle = 10.0f; RegisterMessageHandlers(cockpit); // set up sphere layout SphereBoxRegion region3d = new SphereBoxRegion() { Radius = fCockpitRadiusPanel, HorzDegreeLeft = 50.0f, HorzDegreeRight = 15.0f, VertDegreeBottom = 40.0f, VertDegreeTop = 15.0f }; BoxContainer uiContainer = new BoxContainer(new BoxRegionContainerProvider(cockpit, region3d)); PinnedBoxes3DLayoutSolver layoutCalc = new PinnedBoxes3DLayoutSolver(uiContainer, region3d); PinnedBoxesLayout layout = new PinnedBoxesLayout(cockpit, layoutCalc) { StandardDepth = 0 // widgets are on sphere }; cockpit.AddLayout(layout, "PrimarySphere", true); HUDToggleGroup panelGroup = BuildPanels(cockpit); //BuildParameterPanel(cockpit); try { AddUndoRedo(cockpit); AddTransformToolToggleGroup(cockpit); AddFrameToggleGroup(cockpit); AddNavModeToggleGroup(cockpit); AddMenuButtonsGroup(cockpit); } catch (Exception e) { Debug.Log("[SetupCADCockpit.Initialize::buttons/etc] exception: " + e.Message); } // setup key handlers (need to move to behavior...) cockpit.AddKeyHandler(new CADKeyHandler(cockpit.Context) { PanelGroup = panelGroup }); // setup mouse handling cockpit.InputBehaviors.Add(new VRMouseUIBehavior(cockpit.Context) { Priority = 0 }); cockpit.InputBehaviors.Add(new VRGamepadUIBehavior(cockpit.Context) { Priority = 0 }); cockpit.InputBehaviors.Add(new VRSpatialDeviceUIBehavior(cockpit.Context) { Priority = 0 }); cockpit.InputBehaviors.Add(new TwoHandViewManipBehavior(cockpit) { Priority = 1 }); //cockpit.InputBehaviors.Add(new SpatialDeviceGrabViewBehavior(cockpit) { Priority = 2 }); cockpit.InputBehaviors.Add(new SpatialDeviceViewManipBehavior(cockpit) { Priority = 2 }); RemoteGrabBehavior grabBehavior = new RemoteGrabBehavior(cockpit) { Priority = 5 }; SecondaryGrabBehavior secondGrab = new SecondaryGrabBehavior(cockpit, grabBehavior) { Priority = 4 }; grabBehavior.OnEndGrab += (sender, target) => { if (secondGrab.InGrab && secondGrab.GrabbedSO is GroupSO) { cockpit.Context.RegisterNextFrameAction(() => { GroupSO group = secondGrab.GrabbedSO as GroupSO; AddToGroupChange change = new AddToGroupChange(cockpit.Scene, group, target); cockpit.Scene.History.PushChange(change, false); cockpit.Scene.ClearSelection(); cockpit.Scene.Select(group, false); }); } }; cockpit.InputBehaviors.Add(secondGrab); cockpit.InputBehaviors.Add(grabBehavior); cockpit.InputBehaviors.Add(new MouseMultiSelectBehavior(cockpit.Context) { Priority = 10 }); cockpit.InputBehaviors.Add(new GamepadMultiSelectBehavior(cockpit.Context) { Priority = 10 }); cockpit.InputBehaviors.Add(new SpatialDeviceMultiSelectBehavior(cockpit.Context) { Priority = 10 }); cockpit.InputBehaviors.Add(new MouseDeselectBehavior(cockpit.Context) { Priority = 999 }); cockpit.InputBehaviors.Add(new GamepadDeselectBehavior(cockpit.Context) { Priority = 999 }); cockpit.InputBehaviors.Add(new SpatialDeviceDeselectBehavior(cockpit.Context) { Priority = 999 }); cockpit.InputBehaviors.Add(new SceneRightClickBehavior(cockpit) { Priority = 20 }); cockpit.InputBehaviors.Add(new ClearBehavior(cockpit.Context) { Priority = 999 }); cockpit.InputBehaviors.Add(new UndoShortcutBehavior(cockpit.Context) { Priority = 999 }); cockpit.InputBehaviors.Add(new StickCycleBehavior(cockpit.Context) { Priority = 999, Side = CaptureSide.Left, Cycle = (n) => { panelGroup.SelectModulo(panelGroup.Selected - n); } }); //cockpit.OverrideBehaviors.Add(new ScreenCaptureBehavior() { Priority = 0, // ScreenshotPath = Environment.GetEnvironmentVariable("homepath") + "\\DropBox\\ScreenShots\\" }); cockpit.OverrideBehaviors.Add(new FBEncoderCaptureBehavior() { Priority = 0, ScreenshotPath = Environment.GetEnvironmentVariable("homepath") + "\\DropBox\\ScreenShots\\" }); // start auto-update check AutoUpdate.DoUpdateCheck(cockpit, 10.0f); }
public virtual void RestoreSOInfo(GroupSO so, TypedAttribSet attributes) { safe_set_property_s(attributes, IOStrings.ASOName, (s) => { so.Name = s; }); safe_set_property_s(attributes, IOStrings.ASOUuid, (s) => { so.__set_uuid(s, "0xDEADBEEF"); }); }