public NodeMEntity(mEntity entity, Node node, PortOrientation orientation) { this.orientation = orientation; entityName = entity.entityName; parent = node; foreach (IComponent c in entity.components) { NodeIComponent comp = new NodeIComponent(c, node, orientation); comp.parentEntity = this; components.Add(comp); } // tree = PropertyTree.Create(components); // if (nodeName=="") { if (orientation == PortOrientation.Out) { port = node.AddDynamicOutput(typeof(bool)); } else { port = node.AddDynamicInput(typeof(bool)); } nodeName = port.fieldName; } Debug.Log(port.fieldName); style = new NodeMEntityStyle(); style.unfolded = false; style.portVisible = false; }
public void drawComponent(NodeIComponent component) { SirenixEditorGUI.BeginBoxHeader(); component.style.unfolded = SirenixEditorGUI.Foldout(component.style.unfolded, component.component.GetType().ToString()); Rect rect = GUILayoutUtility.GetLastRect(); SirenixEditorGUI.EndBoxHeader(); NodeEditorGUILayout.AddPortField(component.port); if (component.style.unfolded) { SirenixEditorGUI.BeginBox(); if (component.tree == null) { GUILayout.Label("the tree is null somehow"); } if (component.tree != null) { component.tree.Draw(false); } else { component.tree = PropertyTree.Create(component.component); component.tree.Draw(false); } //Debug.Log(component.tree.WeakTargets); SirenixEditorGUI.EndBox(); } }
public void init(mEntity entity, Node node, PortOrientation orientation) { // port = CreateInstance("NodePort") as NodePort; this.orientation = orientation; this.entity = entity; entityName = entity.entityName; parent = node; Debug.Log("entity components: " + entity.components.Count); foreach (IComponent c in entity.components) { // NodeIComponent comp = CreateInstance("NodeIComponent") as NodeIComponent; // AssetDatabase.SaveAssets(); // comp.init(c, node, this, orientation); NodeIComponent comp = new NodeIComponent(c, node, orientation); comp.parentEntity = this; Debug.Log(comp); components.Add(comp); } // tree = PropertyTree.Create(components); // if (port == null) { if (orientation == PortOrientation.Out) { port = node.AddDynamicOutput(typeof(bool)); } else { port = node.AddDynamicInput(typeof(bool)); } } style = new NodeMEntityStyle(); style.unfolded = false; style.portVisible = false; AssetDatabase.SaveAssets(); }