コード例 #1
0
        public void LoadGraph(string data, string CWD, bool readOnly = false)
        {
            Release();

            Graph = new ImageGraph("Untitled");

            if (string.IsNullOrEmpty(data))
            {
                return;
            }

            Original = Graph;

            Graph.CWD = CWD;
            Graph.FromJson(data);
            HdriManager.Selected = Graph.HdriIndex;

            Graph.OnGraphUpdated += Graph_OnGraphUpdated;

            Scale  = Graph.Zoom;
            XShift = Graph.ShiftX;
            YShift = Graph.ShiftY;

            ZoomLevel.Text = String.Format("{0:0}", Scale * 100);

            LoadGraphUI();
            ReadOnly = readOnly;

            Crumbs.Clear();

            BreadCrumb cb = new BreadCrumb(Crumbs, "Root", this, null);
        }
コード例 #2
0
        public void FromJson(string json, Graph parentGraph, MTGArchive archive = null)
        {
            LayerData d = JsonConvert.DeserializeObject <LayerData>(json);

            if (d == null)
            {
                return;
            }


            if (d.blendModes != null)
            {
                foreach (LayerPasses pass in d.blendModes.Keys)
                {
                    blendModes[pass] = d.blendModes[pass];
                }
            }
            if (d.opacityModes != null)
            {
                foreach (LayerPasses pass in d.opacityModes.Keys)
                {
                    opacityModes[pass] = d.opacityModes[pass];
                }
            }

            Name    = d.name;
            visible = d.visible;
            width   = d.width;
            height  = d.height;
            Id      = d.id;

            Graph temp = new ImageGraph(Name, width, height, parentGraph);

            temp.FromJson(d.core, archive);
            Core = temp;

            if (!string.IsNullOrEmpty(d.mask))
            {
                Node n = null;
                if (Core.NodeLookup.TryGetValue(d.mask, out n))
                {
                    Mask = n;
                }
            }

            if (parentGraph != null)
            {
                parentGraph.LayerLookup[Id] = this;
            }
        }
コード例 #3
0
        void PrepareGraph()
        {
            isDirty   = true;
            GraphInst = new ImageGraph(Name, width, height);
            GraphInst.AssignParentNode(this);
            GraphInst.FromJson(GraphData, child);

            GraphInst.AssignParameters(jsonParameters);
            GraphInst.AssignCustomParameters(jsonCustomParameters);
            GraphInst.AssignSeed(randomSeed);
            GraphInst.AssignPixelType(internalPixelType);
            GraphInst.OnGraphParameterUpdate += GraphInst_OnGraphParameterUpdate;
            //now do real initial resize
            GraphInst.ResizeWith(width, height);

            GraphInst.InitializeRenderTextures();
            //mark as readonly
            GraphInst.ReadOnly = true;

            //setup inputs and outputs
            Setup();
            loading = false;
        }