public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) { return; } m_cancelDrag = false; Clear(); // cached values. var op = new ManipulatorActiveOperation( "Move", DesignView.Context.As <ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Translation) != 0, Control.ModifierKeys == m_duplicateKey); m_originalValues = new Vec3F[op.NodeList.Count]; m_originalRotations = new Vec3F[op.NodeList.Count]; for (int k = 0; k < op.NodeList.Count; k++) { ITransformable node = op.NodeList[k]; m_originalValues[k] = node.Translation; m_originalRotations[k] = node.Rotation; } m_activeOp = op; }
public override void OnBeginDrag() { m_activeOp = null; var op = new ManipulatorActiveOperation( "Scale", DesignView.Context.As <ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Scale) != 0, false); m_isUniformScaling = false; m_originalValues = new Vec3F[op.NodeList.Count]; int k = 0; foreach (ITransformable node in op.NodeList) { m_originalValues[k++] = node.Scale; // if any of the selected nodes are marked as "UniformScale", then the // entire operation must be a uniform scale operaion if ((node.TransformationType & TransformationTypes.UniformScale) == TransformationTypes.UniformScale) { m_isUniformScaling = true; } } m_activeOp = op; }
public override void OnBeginDrag(ViewControl vc, Point scrPt) { if (m_hitRegion == HitRegion.None) { return; } var selectionCntx = DesignView.Context.As <ISelectionContext>(); var selection = selectionCntx.Selection; var transactionContext = DesignView.Context.As <ITransactionContext>(); m_activeOp = null; var op = new ManipulatorActiveOperation( "Rotate", DesignView.Context.As <ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Rotation) != 0, false); m_rotations = new Matrix4F[op.NodeList.Count]; for (int k = 0; k < op.NodeList.Count; k++) { ITransformable node = op.NodeList[k]; Matrix4F m = new Matrix4F(node.Transform); m.Translation = new Vec3F(0, 0, 0); m.Normalize(m); m_rotations[k] = m; } m_activeOp = op; }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) return; var selectionCntx = DesignView.Context.As<ISelectionContext>(); var selection = selectionCntx.Selection; var transactionContext = DesignView.Context.As<ITransactionContext>(); m_activeOp = null; var op = new ManipulatorActiveOperation( "Rotate", DesignView.Context.As<ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Rotation) != 0, false); m_rotations = new Matrix4F[op.NodeList.Count]; for (int k = 0; k < op.NodeList.Count; k++) { ITransformable node = op.NodeList[k]; Matrix4F m = new Matrix4F(node.Transform); m.Translation = new Vec3F(0, 0, 0); m.Normalize(m); m_rotations[k] = m; } m_activeOp = op; }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) { return; } Clear(); // cached values. var op = new ManipulatorActiveOperation( "Move Across Terrain", DesignView.Context.As <ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Translation) != 0, Control.ModifierKeys == m_duplicateKey); m_originalTranslations = new Vec3F[op.NodeList.Count]; m_originalHeights = new float[op.NodeList.Count]; using (var intersectionScene = GameEngine.GetEditorSceneManager().GetIntersectionScene()) { for (int k = 0; k < op.NodeList.Count; k++) { Path <DomNode> path = new Path <DomNode>(op.NodeList[k].Cast <DomNode>().GetPath()); Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1); m_originalTranslations[k] = localToWorld.Translation; float heightAboveTerrain = 0.0f; float terrainHeight = 0.0f; if (GUILayer.EditorInterfaceUtils.GetTerrainHeight( out terrainHeight, intersectionScene, m_originalTranslations[k].X, m_originalTranslations[k].Y)) { heightAboveTerrain = m_originalTranslations[k].Z - terrainHeight; } m_originalHeights[k] = heightAboveTerrain; } } m_pendingStartPt = true; m_activeOp = op; }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) return; Clear(); // cached values. var op = new ManipulatorActiveOperation( "Move Across Terrain", DesignView.Context.As<ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Translation) != 0, Control.ModifierKeys == m_duplicateKey); m_originalTranslations = new Vec3F[op.NodeList.Count]; m_originalHeights = new float[op.NodeList.Count]; using (var intersectionScene = GameEngine.GetEditorSceneManager().GetIntersectionScene()) { for (int k = 0; k < op.NodeList.Count; k++) { Path<DomNode> path = new Path<DomNode>(op.NodeList[k].Cast<DomNode>().GetPath()); Matrix4F localToWorld = TransformUtils.CalcPathTransform(path, path.Count - 1); m_originalTranslations[k] = localToWorld.Translation; float heightAboveTerrain = 0.0f; float terrainHeight = 0.0f; if (GUILayer.EditorInterfaceUtils.GetTerrainHeight( out terrainHeight, intersectionScene, m_originalTranslations[k].X, m_originalTranslations[k].Y)) { heightAboveTerrain = m_originalTranslations[k].Z - terrainHeight; } m_originalHeights[k] = heightAboveTerrain; } } m_pendingStartPt = true; m_activeOp = op; }
public override void OnBeginDrag() { m_activeOp = null; var op = new ManipulatorActiveOperation( "Scale", DesignView.Context.As<ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Scale) != 0, false); m_isUniformScaling = false; m_originalValues = new Vec3F[op.NodeList.Count]; int k = 0; foreach (ITransformable node in op.NodeList) { m_originalValues[k++] = node.Scale; // if any of the selected nodes are marked as "UniformScale", then the // entire operation must be a uniform scale operaion if ((node.TransformationType & TransformationTypes.UniformScale) == TransformationTypes.UniformScale) m_isUniformScaling = true; } m_activeOp = op; }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) return; m_cancelDrag = false; Clear(); // cached values. var op = new ManipulatorActiveOperation( "Move", DesignView.Context.As<ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Translation) != 0, Control.ModifierKeys == m_duplicateKey); m_originalValues = new Vec3F[op.NodeList.Count]; m_originalRotations = new Vec3F[op.NodeList.Count]; for (int k = 0; k < op.NodeList.Count; k++) { ITransformable node = op.NodeList[k]; m_originalValues[k] = node.Translation; m_originalRotations[k] = node.Rotation; } m_activeOp = op; }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) return; m_activeOp = null; var op = new ManipulatorActiveOperation( "Extend", DesignView.Context.As<ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Scale) != 0, false); // to compute offset use bounding box in local space. Vec3F offset = Vec3F.ZeroVector;// 0.5f; // use bounding box in local space switch (m_hitRegion) { case HitRegion.XAxis: case HitRegion.YAxis: case HitRegion.ZAxis: offset = new Vec3F(-1, -1, -1); break; case HitRegion.NegXAxis: case HitRegion.NegYAxis: case HitRegion.NegZAxis: offset = new Vec3F(1, 1, 1); break; default: break; } m_isUniformScaling = false; m_originalScales = new Vec3F[op.NodeList.Count]; m_originalTranslations = new Vec3F[op.NodeList.Count]; m_pivotOffset = new Vec3F[op.NodeList.Count]; int k = 0; foreach (ITransformable node in op.NodeList) { // if any of the selected nodes are marked as "UniformScale", then the // entire operation must be a uniform scale operaion if ((node.TransformationType & TransformationTypes.UniformScale) == TransformationTypes.UniformScale) m_isUniformScaling = true; IBoundable boundable = node.As<IBoundable>(); Vec3F pivot = Vec3F.Mul(boundable.LocalBoundingBox.Radius, offset); m_pivotOffset[k] = pivot; m_originalScales[k] = node.Scale; Matrix4F mtrx = TransformUtils.CalcTransform( Vec3F.ZeroVector, node.Rotation, node.Scale, pivot ); m_originalTranslations[k] = node.Translation - mtrx.Translation; k++; } m_activeOp = op; }
public override void OnEndDrag(ViewControl vc, Point scrPt) { if (m_activeOp != null) { m_activeOp.FinishTransaction(); m_activeOp = null; } m_originalScales = null; m_originalTranslations = null; m_hitRegion = HitRegion.None; m_scale = new Vec3F(1, 1, 1); }
public override void OnBeginDrag(ViewControl vc, Point scrPt) { if (m_hitRegion == HitRegion.None) { return; } m_activeOp = null; var op = new ManipulatorActiveOperation( "Extend", DesignView.Context.As <ISelectionContext>(), (ITransformable node) => (node.TransformationType & TransformationTypes.Scale) != 0, false); // to compute offset use bounding box in local space. Vec3F offset = Vec3F.ZeroVector;// 0.5f; // use bounding box in local space switch (m_hitRegion) { case HitRegion.XAxis: case HitRegion.YAxis: case HitRegion.ZAxis: offset = new Vec3F(-1, -1, -1); break; case HitRegion.NegXAxis: case HitRegion.NegYAxis: case HitRegion.NegZAxis: offset = new Vec3F(1, 1, 1); break; default: break; } m_isUniformScaling = false; m_originalScales = new Vec3F[op.NodeList.Count]; m_originalTranslations = new Vec3F[op.NodeList.Count]; m_pivotOffset = new Vec3F[op.NodeList.Count]; int k = 0; foreach (ITransformable node in op.NodeList) { // if any of the selected nodes are marked as "UniformScale", then the // entire operation must be a uniform scale operaion if ((node.TransformationType & TransformationTypes.UniformScale) == TransformationTypes.UniformScale) { m_isUniformScaling = true; } IBoundable boundable = node.As <IBoundable>(); Vec3F pivot = Vec3F.Mul(boundable.LocalBoundingBox.Radius, offset); m_pivotOffset[k] = pivot; m_originalScales[k] = node.Scale; Matrix4F mtrx = TransformUtils.CalcTransform( Vec3F.ZeroVector, node.Rotation, node.Scale, pivot ); m_originalTranslations[k] = node.Translation - mtrx.Translation; k++; } m_activeOp = op; }
/// <summary> /// Clear local cache</summary> private void Clear() { m_activeOp = null; m_originalTranslations = null; m_originalHeights = null; }
public override void OnEndDrag(ViewControl vc, Point scrPt) { if (m_activeOp != null) { m_activeOp.FinishTransaction(); m_activeOp = null; } m_hitRegion = HitRegion.None; m_rotations = null; }
/// <summary> /// Clear local cache</summary> private void Clear() { m_activeOp = null; m_originalValues = null; m_originalRotations = null; }