public void SetBrushOnRibbonSketchObject()
        {
            ICommand addCommand = new AddPointAndRotationCommand(this.Ribbon, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 45));

            Invoker.ExecuteCommand(addCommand);

            addCommand = new AddPointAndRotationCommand(this.Ribbon, new Vector3(1, 1, 1), Quaternion.Euler(0, 0, -45));
            Invoker.ExecuteCommand(addCommand);

            addCommand = new AddPointAndRotationCommand(this.Ribbon, new Vector3(1, 1, 1), Quaternion.Euler(45, 0, 0));
            Invoker.ExecuteCommand(addCommand);

            Assert.AreEqual(3 * 3, this.Ribbon.GetComponent <MeshFilter>().sharedMesh.vertexCount);

            RibbonBrush brush = this.Ribbon.GetBrush() as RibbonBrush;

            brush.SketchMaterial.AlbedoColor = Color.cyan;
            brush.CrossSectionVertices.Add(Vector3.one);
            ICommand SetBrushCommand = new SetBrushCommand(this.Ribbon, brush);

            Invoker.ExecuteCommand(SetBrushCommand);

            Assert.AreEqual(4 * 3, this.Ribbon.GetComponent <MeshFilter>().sharedMesh.vertexCount);
            Assert.AreEqual(Color.cyan, this.Ribbon.GetComponent <MeshRenderer>().sharedMaterial.color);
            RibbonBrush updatedBrush = this.Ribbon.GetBrush() as RibbonBrush;

            Assert.AreEqual(Color.cyan, updatedBrush.SketchMaterial.AlbedoColor);
        }
        public Brush GetBrush()
        {
            RibbonBrush brush = new RibbonBrush();

            brush.SketchMaterial       = new SketchMaterialData(meshRenderer.sharedMaterial);
            brush.CrossSectionScale    = RibbonMesh.Scale;
            brush.CrossSectionVertices = RibbonMesh.GetCrossSection();
            return(brush);
        }
Exemple #3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         NotesImage.Dispose();
         RibbonBrush.Dispose();
         SyncLinePen.Dispose();
     }
 }