コード例 #1
0
        public void DisplayCompilationErrors(State state)
        {
            VseUtility.RemoveLogEntries();
            if (ModelsToNodeMapping == null)
            {
                UpdateTopology();
            }

            var lastCompilationResult = state.CompilationResultModel.GetLastResult();

            if (lastCompilationResult?.errors == null)
            {
                return;
            }

            foreach (var error in lastCompilationResult.errors)
            {
                if (error.sourceNode != null && !error.sourceNode.Destroyed)
                {
                    var alignment = error.sourceNode is IStackModel
                        ? SpriteAlignment.TopCenter
                        : SpriteAlignment.RightCenter;

                    ModelsToNodeMapping.TryGetValue(error.sourceNode, out var graphElement);
                    if (graphElement != null)
                    {
                        AttachErrorBadge(graphElement, error.description, alignment, m_Store, error.quickFix);
                    }
                }

                var graphAsset     = (GraphAssetModel)m_Store.GetState().CurrentGraphModel?.AssetModel;
                var graphAssetPath = graphAsset ? AssetDatabase.GetAssetPath(graphAsset) : "<unknown>";
                VseUtility.LogSticky(error.isWarning ? LogType.Warning : LogType.Error, LogOption.None, $"{graphAssetPath}: {error.description}", $"{graphAssetPath}@{error.sourceNodeGuid}", graphAsset.GetInstanceID());
            }
        }
コード例 #2
0
ファイル: VseUIController.cs プロジェクト: substence/UnityVS3
        public void DisplayCompilationErrors(State state)
        {
            VseUtility.RemoveLogEntries();
            if (ModelsToNodeMapping == null)
            {
                UpdateTopology();
            }

            var lastCompilationResult = state.CompilationResultModel.GetLastResult();

            if (lastCompilationResult?.errors == null)
            {
                return;
            }

            foreach (var error in lastCompilationResult.errors)
            {
                if (!(error.sourceNode.Model is INodeModel model))
                {
                    continue;
                }

                var alignment = model is IStackModel
                    ? SpriteAlignment.TopCenter
                    : SpriteAlignment.RightCenter;

                ModelsToNodeMapping.TryGetValue(model, out var graphElement);
                if (graphElement != null)
                {
                    AttachErrorBadge(graphElement, error.description, alignment, m_Store, error.quickFix);
                }

                var graphAssetPath = AssetDatabase.GetAssetPath((GraphAssetModel)m_Store.GetState().CurrentGraphModel.AssetModel);
                VseUtility.LogSticky(LogType.Error, LogOption.None, $"{graphAssetPath}: {error.description}", graphAssetPath, error.sourceNodeId);
            }
        }