public IEnumerator CreateBrushWithBrushContainerAssetWithBrushMaterial_ModifyBrushMaterial_BrushIsDirty() { using (var newBrushMaterial = ChiselBrushMaterial.CreateInstance()) { newBrushMaterial.LayerUsage = LayerUsageFlags.None; var newBrushContainerAsset = CreateBox(Vector3.one, newBrushMaterial); var brushGameObject = EditorUtility.CreateGameObjectWithHideFlags("Brush", HideFlags.None); var brush = brushGameObject.AddComponent <ChiselBrush>(); brush.BrushContainerAsset = newBrushContainerAsset; yield return(null); ChiselBrushContainerAssetManager.Update(); ChiselNodeHierarchyManager.Update(); newBrushMaterial.LayerUsage = LayerUsageFlags.Renderable; ChiselBrushContainerAssetManager.Update(); Assert.IsTrue(brush.Dirty); yield return(null); UnityEngine.Object.DestroyImmediate(brushGameObject); UnityEngine.Object.DestroyImmediate(newBrushContainerAsset); } }
public IEnumerator CreateBrushContainerAsset_IsPartOfManager() { var newBrushContainerAsset = ScriptableObject.CreateInstance <ChiselBrushContainerAsset>(); yield return(null); ChiselBrushContainerAssetManager.Update(); //Assert.False(ChiselBrushContainerAssetManager.IsInUpdateQueue(newBrushContainerAsset)); // should already be done Assert.True(ChiselBrushContainerAssetManager.IsRegistered(newBrushContainerAsset)); UnityEngine.Object.DestroyImmediate(newBrushContainerAsset); }
public IEnumerator CreateBrushContainerAsset_HasValidInstance() { using (var newBrushMaterial = ChiselBrushMaterial.CreateInstance()) { var newBrushContainerAsset = CreateBox(Vector3.one, newBrushMaterial); Assert.IsFalse(newBrushContainerAsset.Instances != null && newBrushContainerAsset.Instances[0].Valid); yield return(null); ChiselBrushContainerAssetManager.Update(); //Assert.False(ChiselBrushContainerAssetManager.IsInUpdateQueue(newBrushContainerAsset)); // should already be done Assert.IsTrue(newBrushContainerAsset.Instances != null && newBrushContainerAsset.Instances[0].Valid); UnityEngine.Object.DestroyImmediate(newBrushContainerAsset); } }
public IEnumerator CreateBrushContainerAsset_SetDirty_IsDirty() { var newBrushContainerAsset = ScriptableObject.CreateInstance <ChiselBrushContainerAsset>(); yield return(null); ChiselBrushContainerAssetManager.Update(); //Assert.False(ChiselBrushContainerAssetManager.IsInUpdateQueue(newBrushContainerAsset)); //Assert.False(ChiselBrushContainerAssetManager.IsInUnregisterQueue(newBrushContainerAsset)); Assert.True(ChiselBrushContainerAssetManager.IsRegistered(newBrushContainerAsset)); ChiselBrushContainerAssetManager.SetDirty(newBrushContainerAsset); //Assert.True(ChiselBrushContainerAssetManager.IsInUpdateQueue(newBrushContainerAsset)); Assert.True(ChiselBrushContainerAssetManager.IsDirty(newBrushContainerAsset)); UnityEngine.Object.DestroyImmediate(newBrushContainerAsset); }
public IEnumerator CreateBrushContainerAsset_Unregister_DoesNotHaveValidInstance() { using (var newBrushMaterial = ChiselBrushMaterial.CreateInstance()) { var newBrushContainerAsset = CreateBox(Vector3.one, newBrushMaterial); Assert.IsFalse(newBrushContainerAsset.Instances != null && newBrushContainerAsset.Instances[0].Valid); yield return(null); ChiselBrushContainerAssetManager.Update(); ChiselBrushContainerAssetManager.Unregister(newBrushContainerAsset); yield return(null); ChiselBrushContainerAssetManager.Update(); //Assert.False(ChiselBrushContainerAssetManager.IsInUpdateQueue(newBrushContainerAsset)); // should already be done Assert.IsFalse(newBrushContainerAsset.Instances != null && newBrushContainerAsset.Instances[0].Valid); } }
public IEnumerator CreateBrushWithBrushContainerAsset_GetUsedBrushContainerAssets_IsNotNull() { using (var newBrushMaterial = ChiselBrushMaterial.CreateInstance()) { var newBrushContainerAsset = CreateBox(Vector3.one, newBrushMaterial); var brushGameObject = EditorUtility.CreateGameObjectWithHideFlags("Brush", HideFlags.None); var brush = brushGameObject.AddComponent <ChiselBrush>(); brush.BrushContainerAsset = newBrushContainerAsset; yield return(null); ChiselBrushContainerAssetManager.Update(); ChiselNodeHierarchyManager.Update(); Assert.IsNotNull(brush.GetUsedGeneratedBrushes()); Assert.AreNotEqual(0, brush.GetUsedGeneratedBrushes()); yield return(null); UnityEngine.Object.DestroyImmediate(newBrushContainerAsset); } }