예제 #1
0
        /// <summary>
        /// Creates a RenderTask for the currently connected nodes, not yet executed
        /// </summary>
        public RenderTask GetRenderTask(RenderManagerSettings settings = null, Action <RenderSubTask, Bitmap> onResultUpdated = null, Action <RenderSubTask, Bitmap> onTileReceived = null)
        {
            CurrentTask = new RenderTask(Nodes.ToList(), SessionID, Version, FileID, settings);

            if (onResultUpdated != null)
            {
                CurrentTask.OnResultUpdated += onResultUpdated;
            }
            if (onTileReceived != null)
            {
                CurrentTask.OnTileProcessed += onTileReceived;
            }

            return(CurrentTask);
        }
예제 #2
0
        /// <summary>
        /// Render with provided settings on connected prepared nodes
        /// </summary>
        public async Task <Bitmap> Render(RenderManagerSettings settings = null, Action <RenderSubTask, Bitmap> onResultUpdated = null, Action <RenderSubTask, Bitmap> onTileReceived = null)
        {
            if (CurrentTask != null)
            {
                throw new InvalidOperationException("Already rendering..");
            }
            try
            {
                CurrentTask = GetRenderTask(settings, onResultUpdated, onTileReceived);

                return(await CurrentTask.Render());
            }
            finally
            {
                CurrentTask = null;
            }
        }
        /// <summary>
        /// Creates a RenderTask for the currently connected nodes, not yet executed
        /// </summary>
        public RenderTask GetRenderTask(string file, RenderManagerSettings settings = null, Action <RenderSubTask, Bitmap> onResultUpdated = null, Action <RenderSubTask, Bitmap> onTileReceived = null)
        {
            BlendFarmFileSession session = GetOrCreateSession(file);

            CurrentTask = new RenderTask(Nodes.ToList(), session.SessionID, Version, session.FileID, settings);

            if (onResultUpdated != null)
            {
                CurrentTask.OnResultUpdated += onResultUpdated;
            }
            if (onTileReceived != null)
            {
                CurrentTask.OnTileProcessed += onTileReceived;
            }

            return(CurrentTask);
        }