public override void SetDirty() { if (Node.Valid) { Node.SetDirty(); } }
static GeneratedMeshContents GeneratedMeshAndValidate(CSGTree tree, MeshQuery[] meshTypes, bool expectEmpty = false) { GeneratedMeshContents generatedMesh = null; GeneratedMeshDescription[] meshDescriptions = null; bool treeWasDirtyBefore = false; bool treeIsDirtyAfter = true; tree.SetDirty(); bool haveChanges = CSGManager.Flush(); // Note: optional if (haveChanges) { treeWasDirtyBefore = tree.Dirty; // Note: optional if (treeWasDirtyBefore) { meshDescriptions = tree.GetMeshDescriptions(meshTypes); if (meshDescriptions != null) { var meshDescription = meshDescriptions[0]; generatedMesh = tree.GetGeneratedMesh(meshDescription); } treeIsDirtyAfter = tree.Dirty; } } Assert.IsTrue(haveChanges); Assert.IsTrue(treeWasDirtyBefore); Assert.IsFalse(treeIsDirtyAfter); if (expectEmpty) { Assert.Null(meshDescriptions); Assert.Null(generatedMesh); } else { Assert.NotNull(meshDescriptions); Assert.NotNull(generatedMesh); Assert.AreEqual(meshDescriptions[0].meshQuery, meshTypes[0]); Assert.AreEqual(simpleMeshTypes.Length, meshDescriptions.Length); Assert.IsTrue(generatedMesh.description.vertexCount > 0 && generatedMesh.description.indexCount > 0); } return(generatedMesh); }