override protected void BuildGizmo() { gizmo.SetName("SnapDragGizmo"); float fAlpha = 0.5f; srcMaterial = MaterialUtil.CreateTransparentMaterial(ColorUtil.SelectionGold, fAlpha); srcHoverMaterial = MaterialUtil.CreateStandardMaterial(ColorUtil.SelectionGold); // generate snap target set Snaps = SnapSet.CreateStandard(Scene); Snaps.IgnoreSet.AddRange(this.targets); Snaps.PreRender(parentScene.ActiveCamera.GetPosition()); // [TODO] this should iterate through targets... Debug.Assert(this.targets.Count == 1); // [TODO] should maybe be using GetBoundingBox now?? Bounds b = this.targets[0].GetLocalBoundingBox(); float h = b.extents[1]; // object origin add_snap_source(Vector3.zero, "obj_origin", Snaps); add_snap_source(Vector3.zero + h * Vector3.up, "obj_top", Snaps); add_snap_source(Vector3.zero - h * Vector3.up, "obj_base", Snaps); gizmo.Hide(); }
public SnapDrawPrimitivesTool(FScene scene) { this.scene = scene; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new SnapDrawPrimitivesTool_MouseBehavior(scene.Context) { Priority = 5 }); behaviors.Add( new SnapDrawPrimitivesTool_SpatialDeviceBehavior(scene.Context) { Priority = 5 }); // generate snap target set Snaps = SnapSet.CreateStandard(scene); Snaps.EnableSnapSegments = true; // shut off transform gizmo scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType); scene.SelectionChangedEvent += Scene_SelectionChangedEvent; // initialize active set with input selection Scene_SelectionChangedEvent(null, null); }
public RevolveTool(FScene scene, List <SceneObject> targets) { this.scene = scene; behaviors = new InputBehaviorSet(); // TODO is this where we should be doing this?? behaviors.Add( new RevolveTool_MouseBehavior(scene.Context) { Priority = 5 }); behaviors.Add( new RevolveTool_SpatialDeviceBehavior(scene.Context) { Priority = 5 }); // generate snap target set Snaps = SnapSet.CreateStandard(scene); Snaps.EnableSnapSegments = false; Snaps.EnableSnapPoints = false; // shut off transform gizmo //scene.ActiveController.TransformManager.SetOverrideGizmoType(TransformManager.NoGizmoType); scene.SelectionChangedEvent += Scene_SelectionChangedEvent; // initialize active set with input selection Scene_SelectionChangedEvent(null, null); if (targets != null) { if (targets.Count == 2 && targets[0] is PolyCurveSO && targets[1] is PolyCurveSO) { PolyCurveSO curveSO = targets[0] as PolyCurveSO; PolyCurveSO axisSO = targets[1] as PolyCurveSO; set_curve(curveSO, true); set_axis(axisSO, true); } else { SceneObject foundCurveSO = targets.Find((so) => { return(so is PolyCurveSO); }); if (foundCurveSO != null) { set_curve(foundCurveSO as PolyCurveSO, false); } SceneObject otherSO = targets.Find((so) => { return(!(so is PolyCurveSO)); }); if (otherSO != null) { set_axis(otherSO, false); } } } }
public RemoteGrabBehavior(Cockpit cockpit) { this.cockpit = cockpit; EnableSnapping = true; // build snap target set Snaps = SnapSet.CreateStandard(cockpit.Scene); SnapHelper = new PreRenderHelper("remote_grab_snap_helper") { PreRenderF = () => { Snaps.PreRender(cockpit.ActiveCamera.GetPosition()); } }; cockpit.Scene.SelectionChangedEvent += ActiveScene_SelectionChangedEvent; cockpit.Scene.ChangedEvent += ActiveScene_ChangedEvent; }