コード例 #1
0
        public void Save(EngineNS.IO.XndNode xndNode, bool newGuid)
        {
            //TODO..
            var att = xndNode.AddAttrib("TransformDataCollect");

            att.Version = 0;
            att.BeginWrite();
            att.Write(Datas.Count);
            for (int i = 0; i < Datas.Count; i++)
            {
                att.Write(Datas[i].offset);
            }

            att.EndWrite();

            for (int i = 0; i < Datas.Count; i++)
            {
                var subatt = xndNode.AddAttrib("TransformDataCollect_Angle_" + i);
                {
                    subatt.Version = 0;
                    subatt.BeginWrite();
                    subatt.Write(Datas[i].value.YawPitchRoll.X);
                    subatt.Write(Datas[i].value.YawPitchRoll.Y);
                    subatt.Write(Datas[i].value.YawPitchRoll.Z);
                    subatt.EndWrite();
                }
                var node = xndNode.AddNode("TransformDataCollect_Placement_" + i, 0, 0);
                Datas[i].value.Placement.Save2Xnd(node);
            }
        }
コード例 #2
0
            //public override void Write(XndNode xndNode)
            //{
            //    var att = xndNode.AddAttrib("ConstructionParams");
            //    att.Version = 0;
            //    att.BeginWrite();
            //    att.Write(ConstructParam);
            //    byte consType = (byte)ConstructType;
            //    att.Write(consType);
            //    att.WriteMetaObject(ParamInfo);
            //    att.EndWrite();
            //}
            public override void Read(EngineNS.IO.XndNode xndNode)
            {
                var att = xndNode.FindAttrib("ConstructionParams");

                if (att != null)
                {
                    att.BeginRead();
                    switch (att.Version)
                    {
                    case 0:
                        att.Read(out mConstructParam);
                        byte consType;
                        att.Read(out consType);
                        ConstructType = (CodeDomNode.MethodInvokeNode.enParamConstructType)consType;
                        if (ParamInfo == null)
                        {
                            ParamInfo = new CodeDomNode.MethodParamInfoAssist();
                        }
                        att.ReadMetaObject(ParamInfo);
                        break;

                    case 1:
                        att.ReadMetaObject(this);
                        break;
                    }
                    att.EndRead();
                }
            }
コード例 #3
0
        public void Load(EngineNS.IO.XndNode xndNode)
        {
            BezierPoints.Clear();
            var att = xndNode.FindAttrib("_bezierPts");

            if (att != null)
            {
                att.BeginRead();
                switch (att.Version)
                {
                case 0:
                {
                    int count;
                    att.Read(out count);
                    for (int i = 0; i < count; i++)
                    {
                        var bPt = att.ReadMetaObject() as BezierPoint;
                        if (bPt != null)
                        {
                            bPt.CalculateOpposite();
                            BezierPoints.Add(bPt);
                        }
                    }
                    att.Read(out mBezierWidth);
                    att.Read(out mBezierHeight);
                }
                break;
                }
                att.EndRead();
            }
        }
コード例 #4
0
        public override bool Save(EngineNS.IO.XndNode xndNode)
        {
            //xmlHolder.RootNode.AddAttrib("ViewBoxMain_X", Canvas.GetLeft(ViewBoxMain).ToString());
            //xmlHolder.RootNode.AddAttrib("ViewBoxMain_Y", Canvas.GetTop(ViewBoxMain).ToString());
            //xmlHolder.RootNode.AddAttrib("ViewBoxMain_Width", ViewBoxMain.ActualWidth.ToString());

            return(base.Save(xndNode));
        }
コード例 #5
0
        partial void Save_WPF(EngineNS.IO.XndNode xndNode)
        {
            var att = xndNode.AddAttrib("_commentNodeData_WPF");

            att.Version = 0;
            att.BeginWrite();
            att.Write((double)this.ActualWidth);
            att.Write((double)this.ActualHeight);
            att.EndWrite();
        }
コード例 #6
0
        public override void Save(EngineNS.IO.XndNode xndNode, bool newGuid)
        {
            var att = xndNode.AddAttrib("cubeTexData");

            att.Version = 0;
            att.BeginWrite();
            att.Write(TexturePath.Name);
            att.EndWrite();
            base.Save(xndNode, newGuid);
        }
コード例 #7
0
        public override async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            mIgnoreDirtySet = true;
            await base.Load(xndNode);

            mIgnoreDirtySet = false;

            // 读取完成之后显示全部节点
            FocusNodes(mCtrlNodeList.ToArray());
        }
コード例 #8
0
 public override void Save(EngineNS.IO.XndNode xndNode, bool newGuid)
 {
     if (mTemplateClassInstance != null)
     {
         var att = xndNode.AddAttrib("_funcDefParam");
         att.Version = 1;
         att.BeginWrite();
         CodeGenerateSystem.Base.PropertyClassGenerator.SaveClassInstanceProperties(mTemplateClassInstance, att);
         att.EndWrite();
     }
     base.Save(xndNode, newGuid);
 }
コード例 #9
0
        public static void SaveSnap(string fileName, Support.CBlobObject[] dataArray)
        {
            var xnd = EngineNS.IO.XndHolder.NewXNDHolder();

            EngineNS.IO.XndNode node = xnd.Node;
            for (int k = 0; k < dataArray.Length; k++)
            {
                var data = dataArray[k];
                var attr = node.AddAttrib($"Frame{k}");

                unsafe
                {
                    var        dataPtr = (byte *)data.Data.ToPointer();
                    PixelDesc *desc    = (PixelDesc *)dataPtr;

                    var descSize = sizeof(PixelDesc);

                    var srcBytes = data.ToBytes();
                    var tagBytes = new byte[srcBytes.Length - descSize];
                    for (int i = 0; i < tagBytes.Length; i += 4)
                    {
                        // bgra         rgba
                        tagBytes[i]     = srcBytes[i + 2 + descSize];
                        tagBytes[i + 1] = srcBytes[i + 1 + descSize];
                        tagBytes[i + 2] = srcBytes[i + descSize];
                        tagBytes[i + 3] = srcBytes[i + 3 + descSize];
                    }

                    fixed(byte *tagData = &tagBytes[0])
                    {
                        var bitmap    = new System.Drawing.Bitmap(desc->Width, desc->Height, desc->Stride, System.Drawing.Imaging.PixelFormat.Format32bppArgb, (IntPtr)tagData);
                        var memStream = new System.IO.MemoryStream();

                        bitmap.Save(memStream, System.Drawing.Imaging.ImageFormat.Png);

                        attr.BeginWrite();
                        var memArray = memStream.ToArray();

                        attr.Write(memArray, memArray.Length);
                        attr.EndWrite();
                    }
                }
            }
            var tmp = fileName + ".tmp";

            EngineNS.IO.XndHolder.SaveXND(tmp, xnd);
            CEngine.Instance.FileManager.MoveFile(tmp, fileName);
        }
コード例 #10
0
        public virtual bool Save(EngineNS.IO.XndNode xndNode)
        {
            var att = xndNode.AddAttrib("Head");
            int ver = 0;

            att.BeginWrite();
            att.Write(ver);
            att.Write(GUID);
            att.EndWrite();
            var childNodesCtrls = xndNode.AddNode("ChildNodesCtrls", 0, 0);

            foreach (var node in mCtrlNodeList)
            {
                var childXnd = childNodesCtrls.AddNode(node.GetType().Name, 0, 0);
                var childAtt = childXnd.AddAttrib("_nodeHead");
                childAtt.Version = 1;
                childAtt.BeginWrite();
                childAtt.Write(Program.GetNodeControlTypeSaveString(node.GetType()));
                //childAtt.Write(node.CSParam.ConstructParam);
                childAtt.EndWrite();

                node.CSParam.Write(childXnd);

                node.Save(childXnd, false);
            }

            var origionCtrlIdsAtt = xndNode.AddAttrib("OrigionCtrlIds");

            origionCtrlIdsAtt.BeginWrite();
            origionCtrlIdsAtt.Write((int)(mOrigionNodeControls.Count));
            foreach (var ctrl in mOrigionNodeControls)
            {
                origionCtrlIdsAtt.Write(ctrl.Id);
            }
            origionCtrlIdsAtt.EndWrite();

            IsDirty = false;

            if (CheckError() == false)
            {
                EditorCommon.MessageBox.Show("节点及链接有错误,请检查!");
                return(false);
            }

            return(true);
        }
コード例 #11
0
        public void Save(EngineNS.IO.XndNode xndNode)
        {
            var att = xndNode.AddAttrib("_bezierPts");

            att.Version = 0;
            att.BeginWrite();
            int count = BezierPoints.Count;

            att.Write(count);
            foreach (var bPt in BezierPoints)
            {
                att.WriteMetaObject(bPt);
            }
            att.Write(mBezierWidth);
            att.Write(mBezierHeight);
            att.EndWrite();
        }
コード例 #12
0
        partial void Load_WPF(EngineNS.IO.XndNode xndNode)
        {
            var att = xndNode.FindAttrib("_commentNodeData_WPF");

            if (att != null)
            {
                switch (att.Version)
                {
                case 0:
                {
                    double width, height;
                    att.Read(out width);
                    att.Read(out height);
                    this.Width  = width;
                    this.Height = height;
                }
                break;
                }
            }
        }
コード例 #13
0
        public async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            //Todo..
            var att = xndNode.FindAttrib("TransformDataCollect");

            att.BeginRead();

            int count = 0;

            att.Read(out count);
            for (int i = 0; i < count; i++)
            {
                var   data = new DataHelper();
                float offset;
                att.Read(out offset);
                data.offset = offset;
                Datas.Add(data);
            }
            att.EndRead();

            for (int i = 0; i < Datas.Count; i++)
            {
                var subatt = xndNode.FindAttrib("TransformDataCollect_Angle_" + i);
                if (subatt != null)
                {
                    if (subatt.Version == 0)
                    {
                        float Yaw, Pitch, Roll;
                        subatt.BeginRead();
                        subatt.Read(out Yaw);
                        subatt.Read(out Pitch);
                        subatt.Read(out Roll);
                        subatt.EndRead();
                        Datas[i].value.YawPitchRoll = new EngineNS.Vector3(Yaw, Pitch, Roll);
                    }
                }
                var node = xndNode.FindNode("TransformDataCollect_Placement_" + i);

                await Datas[i].value.Placement.LoadXnd(EngineNS.CEngine.Instance.RenderContext, Datas[i].value.Placement.Host, Datas[i].value.Placement.HostContainer, node);
            }
        }
コード例 #14
0
        public override async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            var att = xndNode.FindAttrib("tex2Ddata");

            if (att != null)
            {
                switch (att.Version)
                {
                case 0:
                {
                    att.BeginRead();
                    string name;
                    att.Read(out name);
                    TexturePath = EngineNS.RName.GetRName(name);
                    att.EndRead();
                }
                break;
                }
            }
            await base.Load(xndNode);
        }
コード例 #15
0
        public override async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            await base.Load(xndNode);

            if (mTemplateClassInstance != null)
            {
                var att = xndNode.FindAttrib("_funcDefParam");
                att.BeginRead();
                switch (att.Version)
                {
                case 0:
                    att.ReadMetaObject(mTemplateClassInstance);
                    break;

                case 1:
                    CodeGenerateSystem.Base.PropertyClassGenerator.LoadClassInstanceProperties(mTemplateClassInstance, att);
                    break;
                }
                att.EndRead();
            }
        }
コード例 #16
0
ファイル: ListGet.cs プロジェクト: huangdonghai/titan3d
            //public override void Write(EngineNS.IO.XndNode xndNode)
            //{
            //    var att = xndNode.AddAttrib("ConstructionParams");
            //    att.Version = 0;
            //    att.BeginWrite();
            //    att.Write(ConstructParam);
            //    att.Write(IsGetRef);
            //    att.EndWrite();
            //}
            public override void Read(EngineNS.IO.XndNode xndNode)
            {
                var att = xndNode.FindAttrib("ConstructionParams");

                if (att != null)
                {
                    att.BeginRead();
                    switch (att.Version)
                    {
                    case 0:
                        att.Read(out mConstructParam);
                        bool getRet;
                        att.Read(out getRet);
                        IsGetRef = getRet;
                        break;

                    case 1:
                        att.ReadMetaObject(this);
                        break;
                    }
                    att.EndRead();
                }
            }
コード例 #17
0
ファイル: CommentNode.cs プロジェクト: huangdonghai/titan3d
 public override void Save(EngineNS.IO.XndNode xndNode, bool newGuid)
 {
     Save_WPF(xndNode);
     base.Save(xndNode, newGuid);
 }
コード例 #18
0
ファイル: CommentNode.cs プロジェクト: huangdonghai/titan3d
 partial void Save_WPF(EngineNS.IO.XndNode xndNode);
コード例 #19
0
ファイル: CommentNode.cs プロジェクト: huangdonghai/titan3d
 partial void Load_WPF(EngineNS.IO.XndNode xndNode);
コード例 #20
0
        public virtual async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            IsLoading = true;

            var att = xndNode.FindAttrib("Head");

            att.BeginRead();
            int ver = 0;

            att.Read(out ver);
            att.Read(out mGuid);
            att.EndRead();

            ClearControlNodes();

            switch (ver)
            {
            case 0:
            {
                // 读取节点信息并创建节点
                var childNodesCtrls = xndNode.FindNode("ChildNodesCtrls");
                if (childNodesCtrls == null)
                {
                    return;
                }
                var xndChildNodes = childNodesCtrls.GetNodes();
                foreach (var cldNode in xndChildNodes)
                //foreach (XmlElement element in doc.DocumentElement.ChildNodes)
                {
                    Type ctrlType = null;
                    ConstructionParams csParam = null;
                    var childAtt = cldNode.FindAttrib("_nodeHead");
                    switch (childAtt.Version)
                    {
                    case 0:
                    {
                        childAtt.BeginRead();
                        string typeSaveName;
                        childAtt.Read(out typeSaveName);
                        ctrlType = Program.GetNodeControlTypeFromSaveString(typeSaveName);                //  Program.GetType(xmlNode.FindAttrib("Type").Value);
                        string constructParam;
                        childAtt.Read(out constructParam);
                        childAtt.EndRead();
                        if (ctrlType == null)
                        {
                            continue;
                        }
                        csParam = new ConstructionParams()
                        {
                            CSType             = this.CSType,
                            HostNodesContainer = this,
                            ConstructParam     = constructParam,
                        };
                    }
                    break;

                    case 1:
                    {
                        childAtt.BeginRead();
                        string typeSaveName;
                        childAtt.Read(out typeSaveName);
                        ctrlType = Program.GetNodeControlTypeFromSaveString(typeSaveName);                //  Program.GetType(xmlNode.FindAttrib("Type").Value);
                        childAtt.EndRead();
                        if (ctrlType == null)
                        {
                            continue;
                        }
                        csParam                    = BaseNodeControl.CreateConstructionParam(ctrlType);
                        csParam.CSType             = this.CSType;
                        csParam.HostNodesContainer = this;
                        csParam.Read(cldNode);
                    }
                    break;
                    }

                    SetConstructionParams_WPF(csParam);
                    CodeGenerateSystem.Base.BaseNodeControl nodeControl = AddNodeControl(ctrlType, csParam, double.NaN, double.NaN);
                    await nodeControl.Load(cldNode);
                }

                // 读取完成后根据id设置一遍链接节点
                foreach (var node in mCtrlNodeList)
                {
                    node.ConstructLinkInfo(this);
                }
                //foreach (var node in mCtrlNodeList)
                //{
                //    node.InitializeUsefulLinkDatas();
                //}

                IsLoading = false;
                IsDirty   = false;
                RefreshNodeProperty(null, ENodeHandleType.UpdateNodeControl);

                var origionCtrlIdsAtt = xndNode.FindAttrib("OrigionCtrlIds");
                if (origionCtrlIdsAtt != null)
                {
                    origionCtrlIdsAtt.BeginRead();
                    int count;
                    origionCtrlIdsAtt.Read(out count);
                    for (int i = 0; i < count; i++)
                    {
                        Guid oriId;
                        origionCtrlIdsAtt.Read(out oriId);
                        var ctrl = FindControl(oriId);
                        if (ctrl != null)
                        {
                            mOrigionNodeControls.Add(ctrl);
                        }
                    }
                    origionCtrlIdsAtt.EndRead();
                }
            }
            break;
            }

            AfterLoad_WPF();
            for (int i = 0; i < CtrlNodeList.Count; ++i)
            {
                CtrlNodeList[i].ContainerLoadComplete(this);
            }
            // 加载完后检查节点错误
            CheckError();
        }
コード例 #21
0
ファイル: CommentNode.cs プロジェクト: huangdonghai/titan3d
        public override async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            await base.Load(xndNode);

            Load_WPF(xndNode);
        }