Exemplo n.º 1
0
        public static DashGraph GetGraphAtPath(DashGraph p_graph, string p_path)
        {
            if (string.IsNullOrWhiteSpace(p_path))
            {
                return(p_graph);
            }

            List <string> split        = p_path.Split('/').ToList();
            DashGraph     currentGraph = p_graph;

            foreach (string id in split)
            {
                SubGraphNode node = currentGraph.GetNodeById(id) as SubGraphNode;
                if (node == null)
                {
                    Debug.LogWarning("Cannot retrieve subgraph at invalid graph path " + p_path);
                    return(null);
                }

                currentGraph = node.GetSubGraphInstance();
            }

            return(currentGraph);
        }
Exemplo n.º 2
0
        bool ResolveReference(string p_name, IAttributeDataCollection p_collection, out object p_result)
        {
            if (!p_name.StartsWith("$"))
            {
                p_result = null;
                return(false);
            }

            string name = p_name.Substring(1);

            object value = _graph.GetNodeById(name).GetModel();

            if (value != null)
            {
                p_result = value;
                return(true);
            }

            hasErrorInResolving = true;
            errorMessage        = "Invalid node reference " + name;

            p_result = null;
            return(false);
        }