コード例 #1
0
        /// <summary>
        /// Execute Graph in Setup mode, and do not do Build.
        /// </summary>
        /// <returns>The graph.</returns>
        /// <param name="target">Target.</param>
        /// <param name="graph">Graph.</param>
        public static ExecuteGraphResult ExecuteGraphSetup(BuildTarget target, Model.ConfigGraph graph)
        {
            AssetGraphController c = new AssetGraphController(graph);

            c.Perform(target, false, true, true, null);
            return(new ExecuteGraphResult(target, graph, c.Issues));
        }
コード例 #2
0
ファイル: NodeGUI.cs プロジェクト: tuita520/AssetGraph
        public static NodeGUI CreateNodeGUI(AssetGraphController c, Model.NodeData data)
        {
            var newNode = ScriptableObject.CreateInstance <NodeGUI> ();

            newNode.Init(c, data);
            return(newNode);
        }
コード例 #3
0
        /// <summary>
        /// Executes the graph.
        /// </summary>
        /// <returns>The graph.</returns>
        /// <param name="target">Target.</param>
        /// <param name="graph">Graph.</param>
        public static ExecuteGraphResult ExecuteGraph(BuildTarget target, Model.ConfigGraph graph, bool clearRecord = false, Action <Model.NodeData, string, float> updateHandler = null)
        {
            if (clearRecord)
            {
                AssetProcessEventRecord.GetRecord().Clear(false);
            }

            string assetPath = AssetDatabase.GetAssetPath(graph);

            LogUtility.Logger.LogFormat(LogType.Log, "Executing graph:{0}", assetPath);

            AssetGraphController c = new AssetGraphController(graph);

            // perform setup. Fails if any exception raises.
            c.Perform(target, false, true, true, null);

            // if there is error reported, then run
            if (c.IsAnyIssueFound)
            {
                return(new ExecuteGraphResult(target, graph, c.Issues));
            }

            Model.NodeData lastNodeData = null;
            float          lastProgress = 0.0f;

            Action <Model.NodeData, string, float> defaultUpdateHandler = (Model.NodeData node, string message, float progress) => {
                if (node != null && lastNodeData != node)
                {
                    lastNodeData = node;
                    lastProgress = progress;

                    LogUtility.Logger.LogFormat(LogType.Log, "Processing {0}", node.Name);
                }
                if (progress > lastProgress)
                {
                    if (progress <= 1.0f)
                    {
                        LogUtility.Logger.LogFormat(LogType.Log, "{0} Complete.", node.Name);
                    }
                    else if ((progress - lastProgress) > 0.2f)
                    {
                        LogUtility.Logger.LogFormat(LogType.Log, "{0}: {1} % : {2}", node.Name, (int)progress * 100f, message);
                    }
                    lastProgress = progress;
                }
            };

            if (updateHandler == null)
            {
                updateHandler = defaultUpdateHandler;
            }

            // run datas.
            c.Perform(target, true, true, true, updateHandler);

            AssetDatabase.Refresh();

            return(new ExecuteGraphResult(target, graph, c.Issues));
        }
コード例 #4
0
ファイル: NodeGUI.cs プロジェクト: tuita520/AssetGraph
        public NodeGUI Duplicate(AssetGraphController controller, float newX, float newY)
        {
            var data = m_data.Duplicate();

            data.X = newX;
            data.Y = newY;
            return(CreateNodeGUI(controller, data));
        }
コード例 #5
0
        public bool PushController(AssetGraphController c)
        {
            if (m_controllers.Where(x => x.TargetGraph.GetGraphGuid() == c.TargetGraph.GetGraphGuid()).Any())
            {
                return(false);
            }

            m_controllers.Push(c);

            return(true);
        }
コード例 #6
0
ファイル: NodeGUI.cs プロジェクト: reforcehub/samunit
        private void Init(AssetGraphController c, Model.NodeData data)
        {
            m_nodeWindowId = 0;
            m_controller   = c;
            m_graph        = m_controller.TargetGraph;
            m_data         = data;
            name           = m_data.Name;

            m_baseRect = new Rect(m_data.X, m_data.Y, Model.Settings.GUI.NODE_BASE_WIDTH, Model.Settings.GUI.NODE_BASE_HEIGHT);

            m_nodeSyle = data.Operation.Object.InactiveStyle;
        }
コード例 #7
0
        public void LogError(NodeException e)
        {
            AssetGraphController gc = AssetGraphPostprocessor.Postprocessor.GetCurrentGraphController();

            if (gc == null)
            {
                throw new AssetGraphException("Error event attempt to log but no graph is in stack.");
            }

            var newEvent = AssetProcessEvent.CreateErrorEvent(e, gc.TargetGraph.GetGraphGuid());

            AddEvent(newEvent);
        }
コード例 #8
0
        public void LogModify(string assetGuid)
        {
            AssetGraphController gc = AssetGraphPostprocessor.Postprocessor.GetCurrentGraphController();

            if (gc == null)
            {
                throw new AssetGraphException("Modify event attempt to log but no graph is in stack.");
            }

            var newEvent = AssetProcessEvent.CreateModifyEvent(assetGuid, gc.TargetGraph.GetGraphGuid(), gc.CurrentNode);

            AddEvent(newEvent);
        }
コード例 #9
0
        public NodeException(string reason, string howToFix, AssetReference a)
        {
            AssetGraphController gc = AssetGraphPostprocessor.Postprocessor.GetCurrentGraphController();

            if (gc == null || gc.CurrentNode == null)
            {
                throw new AssetGraphException("Attempted to create NodeException outside node execution.");
            }

            this.Reason   = reason;
            this.HowToFix = howToFix;
            this.Node     = gc.CurrentNode;
            this.Asset    = a;
        }
コード例 #10
0
 public void PushController(AssetGraphController c)
 {
     m_controllers.Push(c);
 }
コード例 #11
0
ファイル: NodeGUI.cs プロジェクト: tuita520/AssetGraph
 public void OnUndoObject(AssetGraphController c)
 {
     m_data.ResetInstance();
     m_controller = c;
 }