コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public static void ClearScene()
 {
     defaultScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);
     CSGManager.Clear();
     ChiselNodeHierarchyManager.Reset();
     ChiselNodeHierarchyManager.Update();
 }
コード例 #3
0
 private static void OnEditorApplicationUpdate()
 {
     if (EditorApplication.isPlayingOrWillChangePlaymode)
     {
         return;
     }
     ChiselNodeHierarchyManager.Update();
     ChiselGeneratedModelMeshManager.UpdateModels();
     ChiselNodeEditorBase.HandleCancelEvent();
 }
コード例 #4
0
        private static void OnEditorApplicationUpdate()
        {
#if !USE_MANAGED_CSG_IMPLEMENTATION
            // TODO: remove this once we've moved to managed implementation of CSG algorithm
            if (!loggingMethodsRegistered)
            {
                Editors.NativeLogging.RegisterUnityMethods();
                loggingMethodsRegistered = true;
            }
#endif

            //Grid.HoverGrid = null;
            ChiselNodeHierarchyManager.Update();
            ChiselGeneratedModelMeshManager.UpdateModels();
            ChiselNodeEditorBase.HandleCancelEvent();
        }
コード例 #5
0
 private static void OnEditorApplicationUpdate()
 {
     if (EditorApplication.isPlayingOrWillChangePlaymode)
     {
         return;
     }
     try
     {
         ChiselNodeHierarchyManager.Update();
         ChiselGeneratedModelMeshManager.UpdateModels();
         ChiselNodeEditorBase.HandleCancelEvent();
     }
     catch (Exception ex)
     {
         Debug.LogError(ex);
     }
 }
コード例 #6
0
        void OnGUI()
        {
            ChiselNodeHierarchyManager.Update();
            if (styles == null)
            {
                UpdateStyles();
            }

            var selectedTransforms = new HashSet <Transform>();

            foreach (var transform in Selection.transforms)
            {
                selectedTransforms.Add(transform);
            }

            var totalCount = GetVisibleItems(ChiselNodeHierarchyManager.sceneHierarchies);

            var itemArea = position;

            itemArea.x = 0;
            itemArea.y = 0;

            var totalRect = position;

            totalRect.x      = 0;
            totalRect.y      = 0;
            totalRect.width  = position.width - kScrollWidth;
            totalRect.height = (totalCount * kItemHeight) + (2 * kPadding);

            var itemRect = position;

            itemRect.x      = 0;
            itemRect.y      = kPadding;
            itemRect.height = kItemHeight;

            m_ScrollPos = GUI.BeginScrollView(itemArea, m_ScrollPos, totalRect);
            {
                Rect visibleArea = itemArea;
                visibleArea.x += m_ScrollPos.x;
                visibleArea.y += m_ScrollPos.y;

                AddFoldOuts(ref itemRect, ref visibleArea, selectedTransforms, ChiselNodeHierarchyManager.sceneHierarchies);
            }
            GUI.EndScrollView();
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
 private static void OnEditorApplicationUpdate()
 {
     ChiselNodeHierarchyManager.Update();
     ChiselGeneratedModelMeshManager.UpdateModels();
     ChiselNodeEditorBase.HandleCancelEvent();
 }