private void CreateProperty(string type, AnimNodeData node) { if (node.IsPublic) { CreateProperty(type, node.Name, node.Comment); } else { CreateVariable(type, node.Name); } }
private void SetSharedParameters(AnimNodeData node) { SetProperty(node, "Name", string.Format("\"{0}\"", node.Name)); if (node is AnimNodeBlendBaseData) { if (((AnimNodeBlendBaseData)node).NewLayer)// default is false { SetProperty(node, "NewLayer", "true"); } } CreateEvents(node); }
private void CreateEvents(AnimNodeData node) { // create BecameRelevant event handler and assign it to BecameRelevant event if (node.BecameRelevant) { string eventName = node.Name + "_BecameRelevant"; Add(new Method("void", eventName, "", AnimNodeEventParams) { IsPartial = true }); _CreateTreeMethodBody.AppendLine(string.Format("this.{0}.BecameRelevant += new EventHandler({1});", Variable.GetName(node.Name), eventName)); } // create CeaseRelevant event handler and assign it to CeaseRelevant event if (node.CeaseRelevant) { string eventName = node.Name + "_CeaseRelevant"; Add(new Method("void", eventName, "", AnimNodeEventParams) { IsPartial = true }); _CreateTreeMethodBody.AppendLine(string.Format("this.{0}.CeaseRelevant += new EventHandler({1});", Variable.GetName(node.Name), eventName)); } }
private void SetProperty(AnimNodeData node, string pName, object pValue) { _CreateTreeMethodBody.AppendLine(SetProperty(node.Name, pName, pValue)); }
private void ProcessNodes() { foreach (var node in _Tree) { switch (node.NodeType) { case AnimNodeType.Sequence: CreateSequence((AnimNodeSequenceData)node); break; case AnimNodeType.Override: CreateOverride((AnimNodeOverrideData)node); break; case AnimNodeType.Blend1D: CreateBlend1D((AnimNodeBlend1DData)node); break; case AnimNodeType.Blend2D: CreateBlend2D((AnimNodeBlend2DData)node); break; case AnimNodeType.Additive: CreateAdditiveBlending((AnimNodeAdditiveBlendingData)node); break; case AnimNodeType.BlendByIndex: CreateBlendByIndex((AnimNodeBlendByIndexData)node); break; //case AnimNodeType.SubTree: // CreateSubTree((AnimNodeSubTreeData)node); // break; } } // left one line empty _CreateTreeMethodBody.AppendLine(); foreach (var connection in _Tree.Connections) { if (connection.Start != null && connection.End != null && connection.End.NodeType != AnimNodeType.Root) { //if (connection.Start.NodeType == AnimNodeType.SubTree) //{ // _CreateTreeMethodBody.AppendLine(string.Format("this.{0}[{1}] = this.{2}.Root;", Variable.GetName(connection.End.Name), connection.EndConnectorIndex, Variable.GetName(connection.Start.Name))); //} //else //{ _CreateTreeMethodBody.AppendLine(string.Format("this.{0}[{1}] = this.{2};", Variable.GetName(connection.End.Name), connection.EndConnectorIndex, Variable.GetName(connection.Start.Name))); //} } } // left one line empty _CreateTreeMethodBody.AppendLine(); // return root AnimNodeData root = null; foreach (var node in _Tree) { if (node.NodeType == AnimNodeType.Root) { foreach (var connection in _Tree.Connections) { if (connection.End == node) { root = connection.Start; break; } } break; } } if (root != null) { //if (root.NodeType == AnimNodeType.SubTree) //{ // _CreateTreeMethodBody.AppendLine(string.Format("return this.{0}.Root;", Variable.GetName(root.Name))); //} //else //{ _CreateTreeMethodBody.AppendLine(string.Format("return this.{0};", Variable.GetName(root.Name))); //} } else { _CreateTreeMethodBody.AppendLine("return null;"); } }