public void WriteCommonObjectNode(JsonScopeObjectWriter scope, Object3DElem el)
        {
            scope.WriteKeyValue("uuid", el.Uuid);
            scope.WriteKeyValue("type", el.Type);
            scope.WriteKeyValue("name", el.Name);
            scope.WriteKeyValue("matrix", el.Matrix);
            scope.WriteKeyValue("visible", el.Visible);

            if (el.HasUserData())
            {
                writer.WritePropertyName("userData");
                WriteUserdata(el);
            }

            if (el.ChildCount > 0)
            {
                writer.WritePropertyName("children");
                using (var s = new JsonScopeArrayWriter(writer)) {
                    foreach (var child in el.Children)
                    {
                        child.Accept(this);
                    }
                }
            }
        }
Exemple #2
0
        public void ReplaceChild(Object3DElem prev, Object3DElem next)
        {
            Debug.Assert(next.Parent == null);
            Debug.Assert(prev.Parent == this);

            var idx = children.FindIndex(delegate(Object3DElem el) { return(el == prev); });

            children[idx] = next;
            prev.Parent   = null;
            next.Parent   = this;
        }
Exemple #3
0
        public void CopyAttributes(Object3DElem other)
        {
            this.guid        = other.guid;
            this.Visible     = other.Visible;
            this.UnityMatrix = other.UnityMatrix;
            this.Name        = other.Name;
            this.userdata    = new Dictionary <string, object>(other.Userdata);

            this.varGroupDict = new Dictionary <string, List <ScriptVariable> >();
            foreach (var group in other.varGroupDict)
            {
                this.varGroupDict[group.Key] = new List <ScriptVariable>(group.Value);
            }
        }
        void WriteUserdata(Object3DElem el)
        {
            using (var s1 = new JsonScopeObjectWriter(writer)) {
                if (el.HasTag)
                {
                    s1.WriteKeyValue("tag", el.Tag);
                }
                if (el.HasLayer)
                {
                    s1.WriteKeyValue("layer", el.Layer);
                }

                s1.WriteKeyValue("isStatic", el.IsStatic);

                foreach (var kv in el.VarGroupDict)
                {
                    writer.WritePropertyName(kv.Key);
                    WriteScriptVariableGroup(kv.Value);
                }
            }
        }
 public void AddChild(Object3DElem n)
 {
     Debug.Assert(n.Parent == null);
     children.Add(n);
     n.Parent = this;
 }
        public void ReplaceChild(Object3DElem prev, Object3DElem next)
        {
            Debug.Assert(next.Parent == null);
            Debug.Assert(prev.Parent == this);

            var idx = children.FindIndex(delegate (Object3DElem el) { return el == prev; });
            children[idx] = next;
            prev.Parent = null;
            next.Parent = this;
        }
 public void RemoveChild(Object3DElem n)
 {
     Debug.Assert(n.Parent == this);
     n.Parent = null;
     children.Remove(n);
 }
        public void CopyAttributes(Object3DElem other)
        {
            this.guid = other.guid;
            this.Visible = other.Visible;
            this.UnityMatrix = other.UnityMatrix;
            this.Name = other.Name;
            this.userdata = new Dictionary<string, object>(other.Userdata);

            this.varGroupDict = new Dictionary<string, List<ScriptVariable>>();
            foreach(var group in other.varGroupDict) {
                this.varGroupDict[group.Key] = new List<ScriptVariable>(group.Value);
            }
        }
Exemple #9
0
 public void RemoveChild(Object3DElem n)
 {
     Debug.Assert(n.Parent == this);
     n.Parent = null;
     children.Remove(n);
 }
Exemple #10
0
 public void AddChild(Object3DElem n)
 {
     Debug.Assert(n.Parent == null);
     children.Add(n);
     n.Parent = this;
 }