IEnumerator changeDiameter() { yield return(new WaitForSeconds(5)); strokeSketchObject.SetStrokeDiameter(.1f); yield return(new WaitForSeconds(2)); strokeSketchObject.DeleteControlPoint(); strokeSketchObject.DeleteControlPoint(); }
public void Undo() { StrokeSketchObject.DeleteControlPoint(); if (this.StrokeSketchObject.getNumberOfControlPoints() == 0) { SketchWorld.ActiveSketchWorld.DeleteObject(this.StrokeSketchObject); } }
public bool Execute() { this.OldControlPoint = StrokeSketchObject.GetControlPoints()[StrokeSketchObject.getNumberOfControlPoints() - 1]; StrokeSketchObject.DeleteControlPoint(); if (this.StrokeSketchObject.getNumberOfControlPoints() == 0) { SketchWorld.ActiveSketchWorld.DeleteObject(this.StrokeSketchObject); } return(true); }
private void SketchWorldSerializationTest() { strokeSketchObject.AddControlPoint(new Vector3(-2, 1, 0)); strokeSketchObject.AddControlPoint(Vector3.one); strokeSketchObject.AddControlPoint(new Vector3(2, 2, 0)); strokeSketchObject.AddControlPoint(new Vector3(2, 1, 0)); //lineSketchObject.gameObject.GetComponent<MeshRenderer>().material = twoSidedMaterial; strokeSketchObject.gameObject.GetComponent <MeshRenderer>().material = ropeMaterial; strokeSketchObject.SetStrokeCrossSection(CircularCrossSection.GenerateVertices(4), CircularCrossSection.GenerateVertices(4, 1f), .4f); //lineSketchObject.setLineDiameter(.7f); //StartCoroutine(changeDiameter()); strokeSketchObject2.AddControlPoint(new Vector3(1, 0, 0)); strokeSketchObject2.AddControlPoint(new Vector3(2, 1, 1)); strokeSketchObject2.AddControlPoint(new Vector3(3, 2, 0)); strokeSketchObject2.AddControlPoint(new Vector3(4, 4, 4)); strokeSketchObject2.DeleteControlPoint(); strokeSketchObject2.DeleteControlPoint(); strokeSketchObject2.DeleteControlPoint(); strokeSketchObject2.DeleteControlPoint(); strokeSketchObject2.DeleteControlPoint(); strokeSketchObject2.AddControlPoint(new Vector3(1, 0, 0)); strokeSketchObject2.AddControlPoint(new Vector3(2, 1, 1)); strokeSketchObject2.AddControlPoint(new Vector3(3, 2, 0)); strokeSketchObject2.AddControlPoint(new Vector3(4, 4, 4)); strokeSketchObject2.GetComponent <MeshRenderer>().material.color = Color.blue; strokeSketchObject2.gameObject.GetComponent <MeshRenderer>().material = ropeMaterial; patchSketchObject.transform.position += new Vector3(3, 0, 0); patchSketchObject.Width = 3; patchSketchObject.AddPatchSegment(new List <Vector3> { new Vector3(0, 0, 0), new Vector3(1, 0, 0), new Vector3(2, 0, 0) }); patchSketchObject.AddPatchSegment(new List <Vector3> { new Vector3(0, 0, 1), new Vector3(1, 2, 1), new Vector3(2, 0, 1) }); patchSketchObject.AddPatchSegment(new List <Vector3> { new Vector3(0, 0, 2), new Vector3(1, 0, 2), new Vector3(2, 0, 2) }); (List <Vector3> points, List <Quaternion> rotations) = RibbonTest.GetPointTransformation(ControlPointParent); ribbonSketchObject.SetControlPoints(points, rotations); SketchWorld.AddObject(ribbonSketchObject); //lineSketchObject2.minimumControlPointDistance = 2f; //lineSketchObject2.addControlPointContinuous(new Vector3(3, 1, 0)); GameObject groupGO = new GameObject("sketchObjectGroup", typeof(SketchObjectGroup)); SketchObjectGroup group = groupGO.GetComponent <SketchObjectGroup>(); group.defaults = this.defaults; SketchWorld.AddObject(strokeSketchObject); group.AddToGroup(strokeSketchObject2); group.AddToGroup(patchSketchObject); group.transform.position += new Vector3(2.568f, 5.555f, 1.123f); SketchWorld.AddObject(group); string worldXmlPath = System.IO.Path.Combine(Application.dataPath, "SketchWorldTest.xml"); SketchWorld.SaveSketchWorld(worldXmlPath); SketchWorld2.LoadSketchWorld(worldXmlPath); SerializeBrushCollection(); //SketchObjectGroupData groupData = group.GetData(); //string xmlFilePath = Serializer.WriteTestXmlFile<SketchObjectGroupData>(groupData); //Serializer.DeserializeFromXmlFile<SketchObjectGroupData>(out SketchObjectGroupData readGrouptData, xmlFilePath); //Debug.Log(readGrouptData.SketchObjects[0].GetType()); //SketchObjectGroup deserGroup = Instantiate(defaults.SketchObjectGroupPrefab).GetComponent<SketchObjectGroup>(); //deserGroup.ApplyData(readGrouptData); //deserGroup.transform.position += new Vector3(3, 0, 0); }