Esempio n. 1
0
 public void Generate(IChiselGenerator generator)
 {
     if (!generator.Generate(ref brushContainer))
     {
         brushContainer.Reset();
     }
     CalculatePlanes();
     SetDirty();
     ChiselBrushContainerAssetManager.NotifyContentsModified(this);
 }
        public virtual void UpdateGenerator()
        {
            // BrushMeshes of generators must always be unique
            if (!brushContainerAsset ||
                !ChiselBrushContainerAssetManager.IsBrushMeshUnique(brushContainerAsset))
            {
                brushContainerAsset = ChiselBrushContainerAsset.Create("Generated " + NodeTypeName);
            }

            UpdateGeneratorInternal();

            UpdateBrushMeshInstances();
        }
        public virtual void UpdateGenerator()
        {
            // BrushMeshes of generators must always be unique
            if (!brushContainerAsset ||
                !ChiselBrushContainerAssetManager.IsBrushMeshUnique(brushContainerAsset))
            {
                brushContainerAsset      = UnityEngine.ScriptableObject.CreateInstance <ChiselBrushContainerAsset>();
                brushContainerAsset.name = "Generated " + NodeTypeName;
            }

            UpdateGeneratorInternal();

            UpdateBrushMeshInstances();
        }
 public bool Generate(IChiselGenerator generator)
 {
     Profiler.BeginSample("Generate");
     try
     {
         if (!generator.Generate(ref brushContainer))
         {
             Profiler.BeginSample("Reset");
             brushContainer.Reset();
             Profiler.EndSample();
             return(false);
         }
     }
     finally { Profiler.EndSample(); }
     Profiler.BeginSample("CalculatePlanes");
     CalculatePlanes();
     Profiler.EndSample();
     SetDirty();
     Profiler.BeginSample("NotifyContentsModified");
     ChiselBrushContainerAssetManager.NotifyContentsModified(this);
     Profiler.EndSample();
     return(true);
 }
        public virtual void UpdateGenerator()
        {
            // BrushMeshes of generators must always be unique
            Profiler.BeginSample("ChiselBrushContainerAsset.Create");
            try
            {
                if (!brushContainerAsset ||
                    !ChiselBrushContainerAssetManager.IsBrushMeshUnique(brushContainerAsset))
                {
                    brushContainerAsset = ChiselBrushContainerAsset.Create("Generated " + NodeTypeName);
                }
            }
            finally { Profiler.EndSample(); }

            Profiler.BeginSample("UpdateGeneratorInternal");
            try { UpdateGeneratorInternal(); }
            finally { Profiler.EndSample(); }

            brushContainerAsset.SetDirty();

            Profiler.BeginSample("UpdateBrushMeshInstances");
            try { UpdateBrushMeshInstances(); }
            finally { Profiler.EndSample(); }
        }
Esempio n. 6
0
 // returns false if it was already dirty
 public new bool SetDirty()
 {
     return(ChiselBrushContainerAssetManager.SetDirty(this));
 }
Esempio n. 7
0
 internal void OnValidate()
 {
     ChiselBrushContainerAssetManager.NotifyContentsModified(this);
 }
Esempio n. 8
0
 internal void OnDisable()
 {
     ChiselBrushContainerAssetManager.Unregister(this);
 }
Esempio n. 9
0
 internal void OnEnable()
 {
     ChiselBrushContainerAssetManager.Register(this);
 }
Esempio n. 10
0
 static void OnChiselBrushMaterialsReset()
 {
     ChiselBrushContainerAssetManager.RegisterAllSurfaces();
 }
Esempio n. 11
0
        static void OnChiselBrushMaterialsReset()
        {
            // TODO: what about the previously registered surfaces for this brush??

            ChiselBrushContainerAssetManager.RegisterAllSurfaces();
        }