public void OnNodeSelected(uint hash, VariantMap eventData) { Node node = eventData.Get("Node").GetNode(); Component comp = eventData.Get("Component").GetComponent(); if (comp != null) { Selection = new object[] { comp }; } else if (node != null) { Selection = new object[] { node }; } }
public void OnNodeDeleted(uint hash, VariantMap eventData) { Node node = eventData.Get("Node").GetNode(); Component comp = eventData.Get("Component").GetComponent(); if (comp != null) { if (NodeDeleted != null) { NodeDeleted(comp, new EventArgs { }); } } else if (node != null) { if (NodeDeleted != null) { NodeDeleted(node, new EventArgs { }); } } }
public void OnSceneLoaded(uint eventType, VariantMap eventData) { Scene = eventData.Get("Scene").GetScene(); if (SceneChanged != null) { SceneChanged(Scene, new EventArgs { }); } if (TreeRootChanged != null) { TreeRootChanged(this, new EventArgs { }); } }
public static VariantMapList Get(object src, PropertyDescriptor desc, VariantMap map) { Scene scene = src as Scene; if (scene == null) { Node nd = src as Node; if (nd == null) { UrhoBackend.Component cp = src as UrhoBackend.Component; scene = cp.GetScene(); } else { scene = nd.GetScene(); } } VariantMapList keys = new VariantMapList(desc, src); List <string> varNames = new List <string>(Enum.GetNames(typeof(VariantType))); List <StringHash> hashes = map.Keys(); foreach (StringHash sh in hashes) { Variant v = map.Get(sh); string value = v.ToString(); VariantType vt = (VariantType)varNames.IndexOf(v.GetVarType()); VariantMapRecord rec = new VariantMapRecord(keys) { ExplicitKey = sh, Type = (VariantType)v.GetVarTypeID(), Value = v.ToString() }; if (scene != null) { rec.Key = VariableUtils.GetVariableName(scene, rec.ExplicitKey); } rec.Enabled = true; keys.Add(rec); } return(keys); }