public ObjectSelectionGizmo(int id, Gizmo gizmo) { _id = id; _gizmo = gizmo; _boxScaleGizmo = gizmo.GetFirstBehaviourOfType <BoxGizmo>(); _transformGizmo = gizmo.GetFirstBehaviourOfType <ObjectTransformGizmo>(); _extrudeGizmo = gizmo.GetFirstBehaviourOfType <ObjectExtrudeGizmo>(); }
protected void CheckRequiredBehaviours(List <Type> reqBehaviourTypes) { foreach (var bhvType in reqBehaviourTypes) { var behaviour = Gizmo.GetFirstBehaviourOfType(bhvType); if (behaviour == null) { ThrowReqBehaviourExeception(bhvType); break; } } }
private bool RegisterGizmo(int gizmoId, Gizmo gizmo) { if (IsGizmoRegistered(gizmoId) || IsGizmoRegistered(gizmo)) { return(false); } _allGizmos.Add(new ObjectSelectionGizmo(gizmoId, gizmo)); ObjectTransformGizmo transformGizmo = gizmo.GetFirstBehaviourOfType <ObjectTransformGizmo>(); if (transformGizmo != null) { _objectTransformGizmos.Add(transformGizmo); transformGizmo.SetTargetObjects(_targetObjectCollection); } var moveGizmo = gizmo.GetFirstBehaviourOfType <MoveGizmo>(); if (moveGizmo != null) { moveGizmo.SharedSettings2D = MoveGizmoSettings2D; moveGizmo.SharedSettings3D = MoveGizmoSettings3D; moveGizmo.SharedLookAndFeel2D = MoveGizmoLookAndFeel2D; moveGizmo.SharedLookAndFeel3D = MoveGizmoLookAndFeel3D; moveGizmo.SharedHotkeys = MoveGizmoHotkeys; moveGizmo.SetVertexSnapTargetObjects(_targetObjectCollection); if (transformGizmo != null) { transformGizmo.SharedSettings = ObjectMoveGizmoSettings; } } var rotationGizmo = gizmo.GetFirstBehaviourOfType <RotationGizmo>(); if (rotationGizmo != null) { rotationGizmo.SharedSettings3D = RotationGizmoSettings3D; rotationGizmo.SharedLookAndFeel3D = RotationGizmoLookAndFeel3D; rotationGizmo.SharedHotkeys = RotationGizmoHotkeys; if (transformGizmo != null) { transformGizmo.SharedSettings = ObjectRotationGizmoSettings; } } var scaleGizmo = gizmo.GetFirstBehaviourOfType <ScaleGizmo>(); if (scaleGizmo != null) { scaleGizmo.SharedSettings3D = ScaleGizmoSettings3D; scaleGizmo.SharedLookAndFeel3D = ScaleGizmoLookAndFeel3D; scaleGizmo.SharedHotkeys = ScaleGizmoHotkeys; scaleGizmo.SetScaleGuideTargetObjects(_targetObjectCollection); if (transformGizmo != null) { transformGizmo.SharedSettings = ObjectScaleGizmoSettings; } } var boxScaleGizmo = gizmo.GetFirstBehaviourOfType <BoxGizmo>(); if (boxScaleGizmo != null) { boxScaleGizmo.SharedSettings3D = BoxScaleGizmoSettings3D; boxScaleGizmo.SharedLookAndFeel3D = BoxScaleGizmoLookAndFeel3D; boxScaleGizmo.SharedHotkeys = BoxScaleGizmoHotkeys; } var universalGizmo = gizmo.GetFirstBehaviourOfType <UniversalGizmo>(); if (universalGizmo != null) { universalGizmo.SharedSettings2D = UniversalGizmoSettings2D; universalGizmo.SharedSettings3D = UniversalGizmoSettings3D; universalGizmo.SharedLookAndFeel2D = UniversalGizmoLookAndFeel2D; universalGizmo.SharedLookAndFeel3D = UniversalGizmoLookAndFeel3D; universalGizmo.SharedHotkeys = UniversalGizmoHotkeys; universalGizmo.SetMvVertexSnapTargetObjects(_targetObjectCollection); universalGizmo.SetScaleGuideTargetObjects(_targetObjectCollection); if (transformGizmo != null) { transformGizmo.SharedSettings = ObjectUniversalGizmoSettings; } } var extrudeGizmo = gizmo.GetFirstBehaviourOfType <ObjectExtrudeGizmo>(); if (extrudeGizmo != null) { extrudeGizmo.SharedLookAndFeel3D = ExtrudeGizmoLookAndFeel3D; extrudeGizmo.SharedHotkeys = ExtrudeGozmoHotkeys; extrudeGizmo.SetExtrudeTargets(_targetObjectCollection); } gizmo.PostEnabled += OnGizmoPostEnabled; return(true); }