public static List <List <VNActor.Actor> > getSelectedChars(VNNeoController game) { var mtreeman = game.studio.treeNodeCtrl; var ar = new List <VNActor.Actor>(); foreach (var node in mtreeman.selectNodes) { var ochar = NeoOCI.create_from_treenode(node); if (ochar.objctrl is OCIChar) { VNActor.Actor chara = (VNActor.Actor)ochar; ar.Add(chara); } } var am = new List <VNActor.Actor>(); var af = new List <VNActor.Actor>(); foreach (var chara in ar) { if (chara.Sex == 0) { am.Add(chara); } else { af.Add(chara); } } return(new List <List <VNActor.Actor> > { af, am }); }
public static Folder createFldIfNo(string txt, Folder parent, int childNum) { Folder fld; if (parent.treeNodeObject.child.Count <= childNum) { //print "create folder! %s" % txt fld = Folder.add(txt); fld.set_parent(parent); return(fld); } else { var chld = parent.treeNodeObject.child[childNum]; fld = NeoOCI.create_from_treenode(chld) as Folder; if (chld.textName != txt) { //print "hit! upd folder! %s" % txt fld.name = txt; //return fld } else { //print "hit!! no creation! %s" % txt } return(fld); } }
public static void _dump_item_tree(StreamWriter f, NeoOCI item, int level) { var txt1 = ""; if (item is Item) { txt1 = item_dump((Item)item); } else if (item is Folder) { txt1 = folder_dump((Folder)item); } if (item.treeNodeObject.childCount > 0) { txt1 += ", 'ch': ["; _print_dump(f, txt1, level); // print all child foreach (var childt in item.treeNodeObject.child) { var child = NeoOCI.create_from_treenode(childt); _dump_item_tree(f, child, level + 1); } _print_dump(f, "]},", level); } else { _print_dump(f, txt1 + "}", level); } }
public static VNActor.Actor getSelectedChar(VNNeoController game) { var mtreeman = game.studio.treeNodeCtrl; var ar = new List <VNActor.Actor>(); foreach (var node in mtreeman.selectNodes) { var ochar = NeoOCI.create_from_treenode(node); if (ochar.objctrl is OCIChar) { VNActor.Actor chara = (VNActor.Actor)ochar; ar.Add(chara); } } return(ar[0]); }
public static void restrict_to_child(Folder fld, int numchilds) { if (fld.treeNodeObject.child.Count > numchilds) { var ar = fld.treeNodeObject.child; var ar2 = new List <NeoOCI>(); foreach (var treeobj in ar) { ar2.Add(NeoOCI.create_from_treenode(treeobj)); } foreach (var i in Enumerable.Range(0, ar2.Count)) { if (i >= numchilds) { Console.WriteLine(String.Format("deleted! {0}", i.ToString())); ar2[i].delete(); } } } }
public static List <Item> getSelectedItems(VNNeoController game) { var mtreeman = game.studio.treeNodeCtrl; var ar = new List <Item>(); foreach (var node in mtreeman.selectNodes) { var oitem = NeoOCI.create_from_treenode(node); if (oitem.objctrl is OCIItem) { Item prop = (Item)oitem; ar.Add(prop); } } if (ar.Count > 0) { return(ar); } else { throw new Exception("No items selected"); } }
public static List <NeoOCI> get_selected_objs() { var mtreeman = StudioController.Instance.studio.treeNodeCtrl; var ar = new List <NeoOCI>(); foreach (var node in mtreeman.selectNodes) { var ochar = NeoOCI.create_from_treenode(node); if (ochar is VNActor.Actor chara) { ar.Add(chara); } else if (ochar is Prop prop) { ar.Add(prop); } else { throw new Exception("Invalid object"); } } return(ar); }
public static void LoadTrackedActorsAndProps() { List <OCIFolder> folders = scene_get_all_folders_raw(); AllActors.Clear(); AllProps.Clear(); foreach (OCIFolder fld in folders) { string fldName = fld.name; if (fldName.StartsWith(actor_folder_prefix)) { string actorAlias; string actorColor = "ffffff"; string actorTitle = null; // analysis actor tag var tagElements = fldName.Split(':'); if (tagElements.Length == 2) { actorAlias = tagElements[1]; } else if (tagElements.Length == 3) { actorAlias = tagElements[1]; actorColor = tagElements[2]; } else { actorAlias = tagElements[1]; actorColor = tagElements[2]; actorTitle = tagElements[3]; } if (!AllActors.ContainsKey(actorAlias)) { var hsociChar = NeoOCI.create_from_treenode(fld.treeNodeObject.parent.parent.parent); if (hsociChar is VNActor.Actor chara) { if (actorTitle is null) { actorTitle = hsociChar.text_name; } AllActors[actorAlias] = chara; //register_char(actorAlias, actorColor, actorTitle); StudioController.Instance.GetLogger.LogDebug("Registered actor: '" + actorAlias + "' as " + actorTitle + " (#" + actorColor + ")"); } } } else if (fldName.StartsWith(prop_folder_prefix)) { // analysis props tag string propAlias = fldName.Substring(prop_folder_prefix.Length).Trim(); // register props if (!AllProps.ContainsKey(propAlias)) { NeoOCI oci = NeoOCI.create_from_treenode(fld.treeNodeObject.parent); if (oci is Prop propOci) { AllProps[propAlias] = propOci; StudioController.Instance.GetLogger.LogDebug("Registered prop: '" + Utils.to_roman(propAlias) + "' as " + Utils.to_roman(oci.text_name)); } } } else if (fldName.StartsWith(light_folder_prefix)) { string propAlias = fldName.Substring(light_folder_prefix.Length).Trim(); // register props if (!AllProps.ContainsKey(propAlias)) { NeoOCI oci = NeoOCI.create_from_treenode(fld.treeNodeObject.child[0]); if (oci is VNActor.Light propOci) { AllProps[propAlias] = propOci; StudioController.Instance.GetLogger.LogDebug("Registered light: '" + Utils.to_roman(propAlias) + "' as " + Utils.to_roman(oci.text_name)); } } } } }