internal bool Initialize(UpdateRenderPackageParams initParams)
        {
            if (initParams == null)
                throw new ArgumentNullException("initParams");
            if (initParams.Node == null)
                throw new ArgumentNullException("initParams.Node");
            if (initParams.EngineController == null)
                throw new ArgumentNullException("initParams.EngineController");
            if (initParams.DrawableIds == null)
                throw new ArgumentNullException("initParams.DrawableIds");

            var nodeModel = initParams.Node;
            if (!nodeModel.IsUpdated && (!nodeModel.RequiresRecalc))
                return false; // Not has not been updated at all.

            drawableIds = initParams.DrawableIds;
            if (!drawableIds.Any())
                return false; // Nothing to be drawn.

            displayLabels = nodeModel.DisplayLabels;
            isNodeSelected = nodeModel.IsSelected;
            maxTesselationDivisions = initParams.MaxTesselationDivisions;
            engineController = initParams.EngineController;
            previewIdentifierName = initParams.PreviewIdentifierName;

            nodeGuid = nodeModel.GUID;
            return true;
        }
Esempio n. 2
0
        internal bool Initialize(UpdateRenderPackageParams initParams)
        {
            if (initParams == null)
            {
                throw new ArgumentNullException("initParams");
            }
            if (initParams.Node == null)
            {
                throw new ArgumentNullException("initParams.Node");
            }
            if (initParams.EngineController == null)
            {
                throw new ArgumentNullException("initParams.EngineController");
            }
            if (initParams.DrawableIds == null)
            {
                throw new ArgumentNullException("initParams.DrawableIds");
            }

            var nodeModel = initParams.Node;

            if (!nodeModel.IsUpdated)
            {
                return(false); // Not has not been updated at all.
            }
            // If a node is in either of the following states, then it will not
            // produce any geometric output. Bail after clearing the render packages.
            if (nodeModel.IsInErrorState || !nodeModel.IsVisible)
            {
                return(false);
            }

            // Without AstIdentifierForPreview, a node cannot have MirrorData.
            if (string.IsNullOrEmpty(nodeModel.AstIdentifierForPreview.Value))
            {
                return(false);
            }

            drawableIds = initParams.DrawableIds;
            if (!drawableIds.Any())
            {
                return(false); // Nothing to be drawn.
            }
            displayLabels         = nodeModel.DisplayLabels;
            isNodeSelected        = nodeModel.IsSelected;
            factory               = initParams.RenderPackageFactory;
            engineController      = initParams.EngineController;
            previewIdentifierName = initParams.PreviewIdentifierName;

            nodeGuid = nodeModel.GUID;
            return(true);
        }
Esempio n. 3
0
        internal bool Initialize(UpdateRenderPackageParams initParams)
        {
            if (initParams == null)
            {
                throw new ArgumentNullException("initParams");
            }
            if (initParams.Node == null)
            {
                throw new ArgumentNullException("initParams.Node");
            }
            if (initParams.EngineController == null)
            {
                throw new ArgumentNullException("initParams.EngineController");
            }
            if (initParams.DrawableIds == null)
            {
                throw new ArgumentNullException("initParams.DrawableIds");
            }

            var nodeModel = initParams.Node;

            if (!nodeModel.IsUpdated && (!nodeModel.RequiresRecalc))
            {
                return(false); // Not has not been updated at all.
            }
            drawableIds = initParams.DrawableIds;
            if (!drawableIds.Any())
            {
                return(false); // Nothing to be drawn.
            }
            displayLabels           = nodeModel.DisplayLabels;
            isNodeSelected          = nodeModel.IsSelected;
            maxTesselationDivisions = initParams.MaxTesselationDivisions;
            engineController        = initParams.EngineController;
            previewIdentifierName   = initParams.PreviewIdentifierName;

            nodeGuid = nodeModel.GUID;
            return(true);
        }
        internal bool Initialize(UpdateRenderPackageParams initParams)
        {
            if (initParams == null)
                throw new ArgumentNullException("initParams");
            if (initParams.Node == null)
                throw new ArgumentNullException("initParams.Node");
            if (initParams.EngineController == null)
                throw new ArgumentNullException("initParams.EngineController");
            if (initParams.DrawableIds == null)
                throw new ArgumentNullException("initParams.DrawableIds");

            var nodeModel = initParams.Node;
            if (!nodeModel.IsUpdated)
                return false; // Not has not been updated at all.

            // If a node is in either of the following states, then it will not 
            // produce any geometric output. Bail after clearing the render packages.
            if (nodeModel.IsInErrorState || !nodeModel.IsVisible)
                return false;

            // Without AstIdentifierForPreview, a node cannot have MirrorData.
            if (string.IsNullOrEmpty(nodeModel.AstIdentifierForPreview.Value))
                return false;

            drawableIds = initParams.DrawableIds;
            if (!drawableIds.Any())
                return false; // Nothing to be drawn.

            displayLabels = nodeModel.DisplayLabels;
            isNodeSelected = nodeModel.IsSelected;
            factory = initParams.RenderPackageFactory;
            engineController = initParams.EngineController;
            previewIdentifierName = initParams.PreviewIdentifierName;

            nodeGuid = nodeModel.GUID;
            return true;
        }
Esempio n. 5
0
            RequestVisualUpdateAsyncCore(IScheduler scheduler, EngineController engine, IRenderPackageFactory factory)
        {
            var initParams = new UpdateRenderPackageParams()
            {
                Node = this,
                RenderPackageFactory = factory,
                EngineController = engine,
                DrawableIds = GetDrawableIds(),
                PreviewIdentifierName = AstIdentifierForPreview.Name
            };

            var task = new UpdateRenderPackageAsyncTask(scheduler);
            if (task.Initialize(initParams))
            {
                task.Completed += OnRenderPackageUpdateCompleted;
                scheduler.ScheduleForExecution(task);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// When called, the base implementation of this method schedules an 
        /// UpdateRenderPackageAsyncTask to regenerate its render packages 
        /// asynchronously. Derived classes can optionally override this method 
        /// to prevent render packages to be generated if they do not require 
        /// geometric preview.
        /// </summary>
        /// <param name="maxTesselationDivisions">The maximum number of 
        /// tessellation divisions to use for regenerating render packages.</param>
        /// 
        protected virtual void RequestVisualUpdateCore(int maxTesselationDivisions)
        {
            var initParams = new UpdateRenderPackageParams()
            {
                Node = this,
                MaxTesselationDivisions = maxTesselationDivisions,
                EngineController = Workspace.DynamoModel.EngineController,
                DrawableIds = GetDrawableIds(),
                PreviewIdentifierName = AstIdentifierForPreview.Name
            };

            var scheduler = Workspace.DynamoModel.Scheduler;
            var task = new UpdateRenderPackageAsyncTask(scheduler);
            if (task.Initialize(initParams))
            {
                task.Completed += OnRenderPackageUpdateCompleted;
                scheduler.ScheduleForExecution(task);
            }
        }