public void init(IComponent c, Node node, NodeMEntity entity, PortOrientation orientation) { //port = CreateInstance("NodePort") as NodePort; parent = node; component = c; parentEntity = entity; // tree = PropertyTree.Create(component); if (orientation == PortOrientation.Out) { port = node.AddDynamicOutput(typeof(bool)); } else { port = node.AddDynamicInput(typeof(bool)); } style = new NodeIComponentStyle(); style.unfolded = false; style.portVisible = false; tree = PropertyTree.Create(component); AssetDatabase.SaveAssets(); }
public void drawEntity(NodeMEntity entity) { string name = "Entity"; if (entity.entityName != "") { name = entity.entityName; } if (entity.orientation == PortOrientation.In) { //SirenixEditorGUI. SirenixEditorGUI.BeginIndentedHorizontal(); SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); // rect = EditorGUI.PrefixLabel(rect, new GUIContent(" ")); rect = EditorGUI.PrefixLabel(rect, new GUIContent(name)); if (GUI.Button(rect.AlignRight(15), EditorIcons.ArrowDown.Raw)) { entity.style.unfolded = !entity.style.unfolded; } ; SirenixEditorGUI.EndBox(); SirenixEditorGUI.EndIndentedHorizontal(); // NodeEditorGUILayout.AddPortField(entity.port); } else { SirenixEditorGUI.BeginBox(); Rect rect = EditorGUILayout.GetControlRect(); EditorGUI.LabelField(rect.AlignRight(80), name); if (GUI.Button(rect.AlignLeft(15), EditorIcons.ArrowDown.Raw)) { entity.style.unfolded = !entity.style.unfolded; } ; SirenixEditorGUI.EndBox(); // NodeEditorGUILayout.AddPortField(entity.port); } // entity.style.unfolded = SirenixEditorGUI.Foldout(entity.style.unfolded, ""); if (entity.style.unfolded) { SirenixEditorGUI.BeginBox(); for (int i = 0; i < entity.components.Count; i++) { drawComponent(entity.components[i]); } SirenixEditorGUI.EndBox(); } else { NodeEditorGUILayout.AddPortField(entity.port); } }
public NodeFilter(List <mEntity> entities, Node node, PortOrientation orientation) { // port = CreateInstance("NodePort") as NodePort; this.orientation = orientation; //Debug.Log("Adding entities to new filter"); foreach (mEntity e in entities) { parent = node; NodeMEntity mE = new NodeMEntity(e, node, orientation); // NodeMEntity mE = CreateInstance("NodeMEntity") as NodeMEntity; // // as NodeMEntity; // mE.init(e, node, orientation); mE.parentFilter = this; filter.Add(mE); } if (port == null) { if (orientation == PortOrientation.Out) { port = node.AddDynamicOutput(typeof(bool)); } else { port = node.AddDynamicInput(typeof(bool)); } } style = new NodeFilterStyle(); style.unfolded = false; style.portVisible = true; }
public void init(List <mEntity> entities, Node node, PortOrientation orientation) { // port = CreateInstance("NodePort") as NodePort; this.orientation = orientation; filter = new List <NodeMEntity>(); style = new NodeFilterStyle(); //Debug.Log("Adding entities to new filter"); foreach (mEntity e in entities) { parent = node; NodeMEntity mE = new NodeMEntity(e, node, orientation); // NodeMEntity mE = CreateInstance("NodeMEntity") as NodeMEntity; // mE.init(e, node, orientation); mE.parentFilter = this; filter.Add(mE); } if (orientation == PortOrientation.Out) { port = node.AddDynamicOutput(typeof(bool)); } else { port = node.AddDynamicInput(typeof(bool)); } style = new NodeFilterStyle(); style.unfolded = false; style.portVisible = true; // EditorUtility.SetDirty(this); // EditorUtility.SetDirty(port); AssetDatabase.SaveAssets(); // AssetDatabase.Refresh(); // */ }
public bool Contains(NodeMEntity e) { // bool contains = true; bool found = false; foreach (NodeIComponent foreignC in e.components) { found = false; foreach (NodeIComponent localC in components) { if (localC.component.GetType().Equals(foreignC.component.GetType())) { found = true; } } if (!found) { return(false); } } return(true); }