internal void copySelectedStatusToTracking(List <string> exclude) { var elem = NeoOCI.create_from_selected(); if (elem is VNActor.Actor chara) { var tmp_status = chara.export_full_status(); var actors = game.AllActors; foreach (var key in actors.Keys) { VNActor.Actor actor = (VNActor.Actor)actors[key]; if (actor.text_name == chara.text_name) { /* TODO * foreach (var keyEx in exclude) * { * tmp_status.Remove(keyEx); * } */ actor.import_status(tmp_status); return; } } show_blocking_message_time_sc("Can't find tracking char with same name"); } else { show_blocking_message_time_sc("Can't copy status"); } }
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 VNActor.Actor scenef_get_actor(string id) { if (AllActors.ContainsKey(id)) { VNActor.Actor obj = AllActors[id]; return(obj); } return(null); }
// -------- scene with framework ------------ /* * public void scenef_register_actorsprops() * { * foreach (var obj in StudioAPI.GetSelectedObjects()) * { * if (obj is OCIItem item) * { * string id = "prp" + this._scenef_props.Count; * this._scenef_props[id] = new Item(item); // TODO dont make a new one each time * } * else if (obj is OCIChar chara) * { * string id = "act" + this._scenef_actors.Count; * this._scenef_actors[id] = new Actor(chara); * } * } * } */ /* * public void scenef_register_actorsprops() * { * string actorTitle = ""; * Console.WriteLine("-- Framework: register actors and props start --"); * var game = this; * // search for tag folder (-actor:,-prop:,-dlgFolder-) and load them into game automaticlly * // so this function must be called AFTER SCENE HAD BE LOADED!! * game._scenef_actors = new Dictionary<string, Actor> * { * }; * game._scenef_props = new Dictionary<string, Item> * { * }; * // get all from scene * var folders = game.scene_get_all_folders_raw(); * // load actors and props from -actor:/-prop: tag folder attach on char/item * string actorAlias; * string actorColor = "ffffff"; * string propAlias; * HSNeoOCI hsobj; * foreach (var fld in folders) * { * var ftn = fld.name; * if (ftn.StartsWith("-actor:")) * { * // analysis actor tag * var tagElements = ftn.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]; * } * // register actor * try * { * var hsociChar = HSNeoOCI.create_from_treenode(fld.treeNodeObject.parent.parent.parent); * if (hsociChar is Actor chara) * { * if (actorTitle is null) * { * actorTitle = hsociChar.text_name; * } * //game._scenef_actors[actorAlias] = Actor(hsociChar.objctrl) * //adapted to multiple frameworks in 2.0 * game._scenef_actors[actorAlias] = chara.as_actor; * if (actorColor is string) * { * game.register_char(actorAlias, actorColor, actorTitle); * } * else * { * * } * Console.WriteLine("Registered actor: '" + Utils.to_roman(actorAlias) + "' as " + Utils.to_roman(actorTitle) + " (#" + actorColor.ToString() + ")"); * } * else * { * Console.WriteLine("Error in register char tag (not correct child) <" + Utils.to_roman(ftn) + ">"); * } * } * catch (Exception e) * { * Console.WriteLine("error in register char tag <" + Utils.to_roman(ftn) + ">: " + e.ToString()); * continue; * } * } * else if (ftn.StartsWith("-prop:")) * { * // analysis props tag * * propAlias = ftn.Substring("-prop:".Length).Trim(); * // register props * HSNeoOCI oci = HSNeoOCI.create_from_treenode(fld.treeNodeObject.parent); * * if (oci is Item prop) { * game._scenef_props[propAlias] = prop; * } * * Console.WriteLine("Registered prop: '" + Utils.to_roman(propAlias) + "' as " + Utils.to_roman(oci.text_name)); * } * else if (ftn.StartsWith("-propchild:")) * { * // analysis props tag * propAlias = ftn.Substring("-propchild:".Length).Trim(); * // register props * hsobj = HSNeoOCI.create_from_treenode(fld.treeNodeObject.child[0]); * game._scenef_props[propAlias] = (Item)hsobj; * Console.WriteLine("Registered prop: '" + Utils.to_roman(propAlias) + "' as " + Utils.to_roman(hsobj.text_name)); * } * else if (ftn.StartsWith("-propgrandpa:")) * { * // analysis props tag * propAlias = ftn.Substring("-propgrandpa:".Length).Trim(); * // register props * hsobj = HSNeoOCI.create_from_treenode(fld.treeNodeObject.parent.parent); * game._scenef_props[propAlias] = (Item)hsobj; * Console.WriteLine("Registered prop: '" + Utils.to_roman(propAlias) + "' as " + Utils.to_roman(hsobj.text_name)); * } * } * Console.WriteLine("-- Framework: register actors and props end --"); * } */ // ---- lip sync ------- TODO /* new public void set_text(string character, string text) * { * base.set_text(character, text); * if (this.isfAutoLipSync) * { * try * { * this._flipsync_text_handler(character, text); * } * catch (Exception e) * { * Console.WriteLine("Error in flipsync: " + e.ToString()); * } * } * }*/ /* public object _flipsync_text_handler(object character, object text) * { * vngelipsync.flipsync_text_handler(character, text); * } * * public object fake_lipsync_stop() * { * vngelipsync.fake_lipsync_stop(this); * }*/ // --------- sync_h --------- public void sync_h(VNActor.Actor female, VNActor.Actor male) { // if factor.isHAnime: female.AnimationOption = new VNActor.Actor.AnimeOption_s { height = female.Height, breast = female.Breast }; // if mactor.isHAnime: male.AnimationOption = new VNActor.Actor.AnimeOption_s { height = female.Height, breast = female.Breast }; }
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]); }
new public List <VNActor.Actor> scene_get_all_males() { var ar = new List <VNActor.Actor>(); var dobjctrl = this.studio.dicObjectCtrl; foreach (var key in dobjctrl.Keys) { var objctrl = dobjctrl[key]; if (objctrl is OCICharMale chara) { var pctrl = new VNActor.Actor(chara); ar.Add(pctrl); } } return(ar); }
// def getSelectedFolder(game, all=False): // mtreeman = game.studio.treeNodeCtrl // ar = [] // for node in mtreeman.selectNodes: // ofld = HSNeoOCI.create_from_treenode(node) // if isinstance(ofld.objctrl, OCIFolder): // ar.Add(PropSC(ofld.objctrl)) // if len(ar) > 0: // if all == False: // return ar[0] // else: // return ar // # else: // # raise Exception("No folders selected") // chara functions public static void char_import_status_diff_optimized(VNActor.Actor chara, VNActor.Actor.ActorData status) { /* TODO * var ofs = chara.export_full_status(); * var dfs = new Dictionary<string, object> * { * }; * foreach (var key in status.Keys) * { * if (!ofs.ContainsKey(key) || ofs[key] != status[key]) * { * dfs[key] = status[key]; * } * } * //return dfs * //print "Optimized import status diff, ", dfs * chara.import_status(dfs); */ chara.import_status(status); }
public static void scenef_reg_actor(string id, VNActor.Actor actor) { AllActors[id] = actor; }
public static void sceneConsoleTrackable() { GUILayout.BeginHorizontal(); GUILayout.BeginVertical(GUILayout.Width(ColumnWidth)); GUILayout.Label("Actors:"); tracking_actors_scroll = GUILayout.BeginScrollView(tracking_actors_scroll); var actors = Instance.game.AllActors; foreach (var actorid in actors.Keys) { VNActor.Actor actor = actors[actorid]; render_ui_for_tracking(actorid, actor); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.BeginVertical(GUILayout.Width(ColumnWidth)); GUILayout.Label("Props:"); tracking_props_scroll = GUILayout.BeginScrollView(tracking_props_scroll); var props = Instance.game.AllProps; foreach (var propid in props.Keys) { render_ui_for_tracking(propid, props[propid]); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.BeginVertical(GUILayout.Width(ColumnWidth)); if (GUILayout.Button("Track selected", GUILayout.Height(50), GUILayout.Width(ColumnWidth))) { Instance.addSelectedToTrack(); } if (GUILayout.Button("Untrack selected", GUILayout.Height(25), GUILayout.Width(ColumnWidth))) { if (Instance.promptOnDelete.Value) { warning_action = Instance.delSelectedFromTrack; warning_param = new WarningParam_s("Untrack and delete selected from scenes?", false); } else { Instance.delSelectedFromTrack(); } } if (GUILayout.Button("Refresh", GUILayout.Height(25), GUILayout.Width(ColumnWidth))) { SceneFolders.LoadTrackedActorsAndProps(); } if (!Instance.isSysTracking) { if (GUILayout.Button("Track scene settings", GUILayout.Height(25), GUILayout.Width(ColumnWidth))) { Instance.addSysTracking(); } } else { if (GUILayout.Button("Untrack scene settings", GUILayout.Height(25), GUILayout.Width(ColumnWidth))) { Instance.delSysTracking(); } } if (Instance.track_map) { if (GUILayout.Button("Stop tracking map selection", GUILayout.Height(25), GUILayout.Width(ColumnWidth))) { Instance.track_map = false; } } else { if (GUILayout.Button("Track map selection", GUILayout.Height(25), GUILayout.Width(ColumnWidth))) { Instance.track_map = true; } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); GUILayout.Label("Pro: Change selected char ID to "); //GUILayout.Label(" Who say:", GUILayout.Width(80)) Instance.newid = GUILayout.TextField(Instance.newid); if (GUILayout.Button("Change", GUILayout.Width(60))) { //sc.cam_whosay = sc.get_next_speaker(sc.cam_whosay, False) Instance.changeSelTrackID(Instance.newid); } GUILayout.EndHorizontal(); }