/// <summary> /// Constructor /// </summary> /// <param name="ownerShape"></param> /// <param name="primaryStringId"></param> public LinkTargetPath(PathShape ownerShape, string primaryStringId) : base(ownerShape, "use path", primaryStringId) { this.iIndex = 0; // -1 would discard this in the entity. We don't need the index here }
/// <summary> /// Overridden function to create the shape instance /// </summary> /// <returns></returns> public override ShapeBase CreateShapeInstance() { PathShape shape = new PathShape("Path"); shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition; PathNodeShape node; for (int i=0;i<4;i++) { node = new PathNodeShape(); node.Position = shape.Position; node.y += ((float)i - 1.5f) * 200.0f * EditorManager.Settings.GlobalUnitScaling; node.ShapeName = "node" + i; node.SetParent(shape); } shape.SmoothAll(false); return shape; }
/// <summary> /// Constructor /// </summary> /// <param name="owner">owner shape</param> /// <param name="iInsert">node index to insert at</param> /// <param name="t">time value [0..1] position on the path</param> public HotSpotAddPathNode(PathShape owner, int iInsert, float t) : base(owner,@"Textures\Hotspot_add.dds",VisionColors.RGBA(255,255,255,180),VisionColors.White,8.0f) { _t = t; _iInsert = iInsert; if (_t<0.0f || t>1.0f) ToolTipText = "Append a path node here"; else ToolTipText = "Insert a path node here"; }
/// <summary> /// Overridden function to create the shape instance /// </summary> /// <returns></returns> public override ShapeBase CreateShapeInstance() { PathShape shape = new PathShape("Circle Path"); shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition; shape.Closed = true; // Magic number: http://www.tinaja.com/glib/ellipse4.pdf float fMagic = 0.551784f; float fRadius = 200.0f * EditorManager.Settings.GlobalUnitScaling; Vector3F rotCenter = shape.Position; Vector3F rotAngle = new Vector3F(0.0f, 0.0f, 0.0f); Matrix3F rotMatrix = new Matrix3F(); rotMatrix.FromEuler(rotAngle.X, rotAngle.Y, rotAngle.Z); PathNodeShape node; for (int i = 0; i < 4; i++) { node = new PathNodeShape(); node.Position = shape.Position; node.y -= fRadius; node.TangentIn = new Vector3F(node.TangentIn.X - fRadius * fMagic, 0.0f, 0.0f); node.TangentOut = new Vector3F(node.TangentOut.X + fRadius * fMagic, 0.0f, 0.0f); node.Position = shape.Position + rotMatrix * (node.Position - rotCenter); node.TangentIn = rotMatrix * (node.TangentIn); node.TangentOut = rotMatrix * (node.TangentOut); node.InType = PathNodeShape.PathNodeInOutType.Custom; node.OutType = PathNodeShape.PathNodeInOutType.Custom; node.ShapeName = "node" + i; node.SetParent(shape); rotAngle.X += 90.0f; rotMatrix.FromEuler(rotAngle.X, rotAngle.Y, rotAngle.Z); } return shape; }
public RecenterPivotAction(PathShape pathShape) : base(null) { Vector3F oldPathPos = pathShape.Position.Clone(); Vector3F newPathPos = new Vector3F(); // Calculate new position (center of all path nodes) for (int i = 1; i < pathShape.PathNodeCount; i++) newPathPos = newPathPos + pathShape.PathNodes[i].Position; newPathPos = newPathPos / (pathShape.PathNodeCount - 1); // Reposition path nodes for (int i = 1; i < pathShape.PathNodeCount; i++) { Vector3F oldPos = pathShape.PathNodes[i].Position.Clone(); Vector3F newPos = (oldPathPos - newPathPos) + oldPos; this.Add(new MoveShapeAction(pathShape.PathNodes[i], oldPos, newPos)); } // Reposition path shape this.Add(new MoveShapeAction(pathShape, oldPathPos, newPathPos)); // Action name GroupName = "Recenter Path Pivot"; }
public PathTimePicker(PathShape pathshape) { _pathShape = pathshape; }