Beispiel #1
0
        public void SetParameterValue(string id, string parameter, object v)
        {
            string cid = id + "." + parameter;

            GraphParameterValue p = null;

            if (Parameters.TryGetValue(cid, out p))
            {
                if (p.IsFunction())
                {
                    FunctionGraph g = p.Value as FunctionGraph;
                    g.OnGraphUpdated -= Graph_OnGraphUpdated;
                    g.Dispose();
                }

                p.Value = v;
            }
            else
            {
                Parameters[cid] = new GraphParameterValue(parameter, v);
            }

            if (v is FunctionGraph)
            {
                (v as FunctionGraph).OnGraphUpdated += Graph_OnGraphUpdated;
            }

            Updated();
        }
Beispiel #2
0
        public void SetParameterValue(string id, string parameter, object v)
        {
            string cid = id + "." + parameter;

            GraphParameterValue p = null;

            if (Parameters.TryGetValue(cid, out p))
            {
                if (p.IsFunction())
                {
                    FunctionGraph g = p.Value as FunctionGraph;
                    g.OnGraphUpdated -= Graph_OnGraphUpdated;
                    g.Dispose();
                }

                if (v is float || v is int || v is double)
                {
                    p.Type = NodeType.Float;
                }
                else if (v is bool)
                {
                    p.Type = NodeType.Bool;
                }
                else if (v is MVector)
                {
                    p.Type = NodeType.Float4;
                }

                p.Value = v;
            }
            else
            {
                p = Parameters[cid] = new GraphParameterValue(parameter, v);

                if (v is float || v is int || v is double)
                {
                    p.Type = NodeType.Float;
                }
                else if (v is bool)
                {
                    p.Type = NodeType.Bool;
                }
                else if (v is MVector)
                {
                    p.Type = NodeType.Float4;
                }
            }

            if (v is FunctionGraph)
            {
                (v as FunctionGraph).OnGraphUpdated += Graph_OnGraphUpdated;
            }

            Updated();
        }
Beispiel #3
0
        public void RemoveParameterValue(string id, string parameter)
        {
            string cid = id + "." + parameter;

            GraphParameterValue p = null;

            if (Parameters.TryGetValue(cid, out p))
            {
                if (p.IsFunction())
                {
                    FunctionGraph g = p.Value as FunctionGraph;
                    g.OnGraphUpdated -= Graph_OnGraphUpdated;
                    g.Dispose();
                }
            }

            Parameters.Remove(cid);

            Updated();
        }