private void ToolManager_OnToolActivationChanged(ITool tool, ToolSide eSide, bool bActivated) { if (bActivated == false && tool == ownerTool) { ownerTool.EndDraw(); } }
public override void UpdateHover(InputState input) { ToolSide eSide = context.ToolManager.FindSide(tool); Frame3f sideHandF = (eSide == ToolSide.Left) ? input.LeftHandFrame : input.RightHandFrame; sideHandF.Origin += SceneGraphConfig.VRHandTipOffset * sideHandF.Z; //update_last_hit(tool, input.vMouseWorldRay); tool.UpdateBrushPreview(sideHandF); Vector2f vStick = (eSide == ToolSide.Left) ? input.vLeftStickDelta2D : input.vRightStickDelta2D; if (Math.Abs(vStick[1]) > 0.5f) { tool.Radius.Add(fDimension.World(vStick[1] * resize_speed(ref input))); } // cycle brush on press+left/right bool stick_up = (eSide == ToolSide.Left) ? input.bLeftStickReleased : input.bRightStickReleased; if (stick_up && Math.Abs(vStick[0]) > 0.9) { int n = (int)tool.ActiveBrush; n = MathUtil.ModuloClamp(n + (vStick[0] < 0 ? -1 : 1), 2); tool.ActiveBrush = (SculptCurveTool.BrushTool)n; } }
public override void UpdateHover(InputState input) { ToolSide eSide = context.ToolManager.FindSide(tool); Frame3f sideHandF = (eSide == ToolSide.Left) ? input.LeftHandFrame : input.RightHandFrame; sideHandF.Origin += SceneGraphConfig.VRHandTipOffset * sideHandF.Z; tool.UpdatePlane(sideHandF); }
protected virtual void SendOnToolActivationChanged(ITool tool, ToolSide eSide, bool bActivated) { var tmp = OnToolActivationChanged; if (tmp != null) { tmp(tool, eSide, bActivated); } }
public bool ActivateTool(ToolSide eSide) { int nSide = (int)eSide; if (activeType[nSide] == null || activeBuilder[nSide] == null) { return(false); } // deactivate existing tool? I guess. if (activeTool[nSide] != null) { DeactivateTool(eSide); } // try to build tool for current selection List <SceneObject> selected = SceneUtil.FindObjectsOfType <SceneObject>(SceneManager.Scene.Selected, true); if (selected.Count > 1) { if (activeBuilder[nSide].IsSupported(ToolTargetType.MultipleObject, selected)) { activeTool[nSide] = activeBuilder[nSide].Build(SceneManager.Scene, selected); } } else if (selected.Count == 1) { if (activeBuilder[nSide].IsSupported(ToolTargetType.SingleObject, selected)) { activeTool[nSide] = activeBuilder[nSide].Build(SceneManager.Scene, selected); } } // if we did not get an active tool in above block, try starting Scene-level tool if (activeTool[nSide] == null) { var all_objects = SceneUtil.FindObjectsOfType <SceneObject>(SceneManager.Scene.SceneObjects, true); if (activeBuilder[nSide].IsSupported(ToolTargetType.Scene, all_objects)) { activeTool[nSide] = activeBuilder[nSide].Build(SceneManager.Scene, all_objects); } } if (activeTool[nSide] != null) { activeTool[nSide].Setup(); SendOnToolActivationChanged(activeTool[nSide], eSide, true); return(true); } else { return(false); } }
private void ToolManager_OnToolActivationChanged(ITool tool, ToolSide eSide, bool bActivated) { if (bActivated) { this.gameObject.SetVisible(false); } else { this.gameObject.SetVisible(true); } }
protected virtual void OnToolActivationChanged(ITool tool, ToolSide eSide, bool bActivated) { if (bActivated) { inputBehaviors.Add(tool.InputBehaviors); } else { inputBehaviors.Remove(tool.InputBehaviors); } }
public void DeactivateTool(ToolSide eSide) { int nSide = (int)eSide; if (activeTool[nSide] != null) { // shutdown tool ITool tool = activeTool[nSide]; tool.Shutdown(); activeTool[nSide] = null; SendOnToolActivationChanged(tool, eSide, false); } }
private void ToolManager_OnToolActivationChanged(ITool tool, ToolSide eSide, bool bActivated) { ITool curTool = CC.ActiveContext.ToolManager.ActiveRightTool; if (curTool == null) { ActiveToolPanel.SetVisible(false); } else { ActiveToolPanel.SetVisible(true); } }
public bool ActivateTool(ToolSide eSide) { int nSide = (int)eSide; if (activeType[nSide] == null || activeBuilder[nSide] == null) { return(false); } // deactivate existing tool? I guess. if (activeTool[nSide] != null) { DeactivateTool(eSide); } List <SceneObject> selected = new List <SceneObject>(SceneManager.Scene.Selected); if (selected.Count > 1) { if (activeBuilder[nSide].IsSupported(ToolTargetType.MultipleObject, selected)) { activeTool[nSide] = activeBuilder[nSide].Build(SceneManager.Scene, selected); } } else if (selected.Count == 1) { if (activeBuilder[nSide].IsSupported(ToolTargetType.SingleObject, selected)) { activeTool[nSide] = activeBuilder[nSide].Build(SceneManager.Scene, selected); } } if (activeTool[nSide] == null) { if (activeBuilder[nSide].IsSupported(ToolTargetType.Scene, null)) { activeTool[nSide] = activeBuilder[nSide].Build(SceneManager.Scene, null); } } if (activeTool[nSide] != null) { SendOnToolActivationChanged(activeTool[nSide], eSide, true); return(true); } else { return(false); } }
void on_tool_changed(ITool tool, ToolSide eSide, bool bActivated) { if (bActivated == false) { try { //toolInfo ti = toolButtonInfo.Find((x) => x.identifier == tool.TypeIdentifier); remove_indicator((int)eSide); if ((this.cockpit.Context.ActiveInputDevice & InputDevice.AnySpatialDevice) != 0) { cockpit.Context.SpatialController.ClearHandIcon((int)eSide); } } catch { } } }
public override void UpdateHover(InputState input) { ToolSide eSide = context.ToolManager.FindSide(tool); Frame3f sideHandF = (eSide == ToolSide.Left) ? input.LeftHandFrame : input.RightHandFrame; sideHandF.Origin += SceneGraphConfig.VRHandTipOffset * sideHandF.Z; //update_last_hit(tool, input.vMouseWorldRay); tool.UpdateSizePreview(sideHandF); Vector2f vStick = (eSide == ToolSide.Left) ? input.vLeftStickDelta2D : input.vRightStickDelta2D; if (vStick[1] != 0) { tool.Radius = tool.Radius + vStick[1] * 0.01f; } }
public void SetActiveToolType(string sType, ToolSide eSide) { if (ToolTypes.ContainsKey(sType) == false) { throw new ArgumentException("Toolmanager.SetActiveToolType : type " + sType + " is not registered!"); } int nSide = (int)eSide; if (activeType[nSide] == sType) { return; } activeType[nSide] = sType; activeBuilder[nSide] = ToolTypes[sType]; if (activeTool[nSide] != null) { DeactivateTool(eSide); } }
public bool HasActiveTool(ToolSide eSide) { return(activeTool[(int)eSide] != null); }
public ITool GetActiveTool(ToolSide eSide) { return(activeTool[(int)eSide]); }