예제 #1
0
        /// <summary>
        /// Refreshes temporary material to see changes live when editing the surface.
        /// </summary>
        /// <returns>True if cannot refresh it, otherwise false.</returns>
        public bool RefreshTempMaterial()
        {
            // Early check
            if (_asset == null || _isWaitingForSurfaceLoad)
            {
                return(true);
            }

            // Check if surface has been edited
            if (_surface.IsEdited)
            {
                _surface.Save();
            }

            return(false);
        }
예제 #2
0
        /// <summary>
        /// Refreshes temporary material to see changes live when editing the surface.
        /// </summary>
        /// <returns>True if cannot refresh it, otherwise false.</returns>
        public bool RefreshTempMaterial()
        {
            // Early check
            if (_asset == null || _isWaitingForSurfaceLoad)
            {
                return(true);
            }

            // Check if surface has been edited
            if (_surface.IsEdited)
            {
                // Save surface
                var data = _surface.Save();
                if (data == null)
                {
                    // Error
                    Editor.LogError("Failed to save material surface");
                    return(true);
                }

                // Create material info
                MaterialInfo info;
                FillMaterialInfo(out info);

                // Save data to the temporary material
                if (_asset.SaveSurface(data, info))
                {
                    // Error
                    _surface.MarkAsEdited();
                    Editor.LogError("Failed to save material surface data");
                    return(true);
                }
            }

            return(false);
        }