genericuser332321 Posted June 16, 2022 Posted June 16, 2022 Hello all; Long story short: Does anyone know how to pull specific Fusion Girl slider values for a given actor (player and NPC) into a Papyrus script? The full goal (I'll try to keep this brief): I'm currently running Fusion Girl (and Body Talk) with OCBP, but I've found that the available OCBP presets are not quite to my liking. I'm reasonably happy with a preset I've set up for myself, but I find that OCBP values that look "natural" are heavily dependent on body shape. As far as I can tell, the skeleton (ZeX V5) is identical for all NPCs (and the player character), so any body morphs simply change the shape of a body part around the skeleton rather than adjusting the skeleton itself, and the COG (and relative "mass") of each body part doesn't actually change. My goal is to tweak the OCBP script to pull in slider values from body morphs, and then use those values to modify values (like COG) for each individual; e.g., increasing the "Boobs Big" (or "Boobs Mellons", or "Boobs Yuge") sliders should increase the COG Y offset for Breast3, whereas decreasing those sliders (or increasing "Boobs Tiny" or "Boobs Small" or "Boobs Flat") should decrease the COG Y offset. Takosako has been nice enough to provide the OCBP code, and (as far as I can tell) the physics runs on each actor and skeleton node independently. Additionally, there appears to be some in-game NPC randomization based on the Looks Menu tri-slider, and any changes I make to NPCs using the FG sliders seem to be persistent, so I assume that NPCs have a set of slider values that are "baked into" the character and used to render the body. F4SE also seems to have a function to pull in the values from the tri-slider (GetBodyWeight()), so the basic functionality is there. However, GetBodyWeight() apparently doesn't take any parameters, and I assume it won't work with FG sliders directly. It looks like Thing.cpp (in the OCBP GitHub source) is the code that actually controls bone position, with lines 257 and on pulling in the values from the ocbp.ini file to define the motion. My aim would be to define a couple additional variables up at the top, pull in specific FG slider values for the current actor, and then use the variables as coefficients to modify the values coming in from ocbp.ini with a couple if/else statements to ensure that the coefficients are applied to the correct bones. I'm thinking something along the lines of (ignore the butchered syntax; I'm unfamiliar with Papyrus still): if(NiPoint3 == "Breast") { float cogCoefY = ((ActorBase.GetBodyWeight("Boobs Big") + ActorBase.GetBodyWeight("Boobs Yuge")) - (ActorBase.GetBodyWeight("Boobs Tiny") + (ActorBase.GetBodyWeight("Boobs Flat"))) cogOffsetY = (1+cogCoefY)*cogOffsetY } ... NiPoint3 target = (targetRot * NiPoint3(cogOffsetX, cogOffsetY, cogOffsetZ)) + origWorldPos; Overall, this seems like it should be possible, and it should be pretty straightforward if I can figure out a function to pull in specific slider values. An easier way would be to define a list of sliders to pull data from and return the mean of that list. Anybody have any insight into this? Also, I have Diverse Bodies installed, and I thought it worked with Fusion Girl, but it looks like it uses completely different sliders; does a Fusion Girl version (or patch) exist, or has anyone been able to get DB working with FG sliders? I'm looking into this myself (as well as Body Talk compatibility), but no sense in reinventing the wheel if it's already been done. 1
Karna5 Posted June 16, 2022 Posted June 16, 2022 I don't use OCBP (I use OCBPC) and also don't know if it's possible to pull morph values from actors (I'd be surprised if you could). But I can talk to your initial concern that the aesthetics of actors using OCBP/OCBPC is dependent on what preset you use. There should be a value in the OCBP/OCBPC configuration files called something like Gravity Compensation or the like. Find that value, and try adding about 40% to it. In OCBPC I had a problem with breasts sagging much too much and for a while was using the Breast Pushup mod to compensate for it (I can't find the link to that). But eventually I looked in the configuration files for OCBPC and noticed the gravity compensation setting, added a bunch to it, and now everything looks great whether the body preset is slender or large. 1
genericuser332321 Posted June 16, 2022 Author Posted June 16, 2022 (edited) 3 hours ago, Karna5 said: I don't use OCBP (I use OCBPC) and also don't know if it's possible to pull morph values from actors (I'd be surprised if you could). Hey, I appreciate the reply. I actually use OCBPC as well, but (as far as I can tell) it's effectively OCBP with collision sphere values provided in a separate configuration file, so I've been doing my testing with OCBP to try and perfect the physics before I incorporate collision; the fewer variables I'm dealing with at a time, the easier it is to tweak the settings. Having said that, I have spent a lot of time trying to perfect the physics (I think I'm currently at 12 hours or so), so between my own testing and the guide I'm getting a pretty good idea of what each setting does. Funny enough, I've already got so many hours in FO4 that at this point I almost prefer modding it to actually playing it. My preferred settings actually use quite low values, even relative to the "soft" presets, and my gravity bias is actually set to 2.0 (with 0.0 gravity correction). I get a little bit of sag, but it looks relatively natural. Plus, it can be somewhat compensated with the looks menu sliders as well. Overall, I think the settings look reasonably natural; large scale movements cause a lot of motion that settles quickly without being too springy, and smaller/smoother movements still give a bit of shimmy. I'm happy to share my preset after I do a bit more tweaking if there's any interest. My main concern is that each node is associated with a specific region of the body mesh, but the nodes stay in place regardless of how the mesh is adjusted using the sliders; e.g., Breast_CBP_L_04 might be right at the nipple given zeroed sliders, but could be a few inches ahead with small breasts, or could be in the middle of large breasts. Given that motion is defined at the node, this means that the relatively low amounts of motion (linear and rotational) exhibited by small breasts would look awkward on larger breasts (they would appear much too stiff), while motion that would be normal on larger breasts (more noticeable effects of gravity, larger momentum, more rotation) would look well out of place on smaller breasts. It's not an issue if you play with a single body morph for all NPCs as you can set OCBP appropriately for that, but I like to play with some variation in body types (also why I'm trying to get Diverse Bodies to work with FG and BT). Plus, if I can pull FG slider values into OCBP to tweak physics for each actor then I can adjust a whole bunch of other factors (e.g., how stiff/springy breasts are based on perkiness; how much rotation is appropriate given the size; maximum offset on a given axis). Plus, I don't like to do things the easy way, and this is somewhat of an amusing project for me, so I want to see how far I can take it. Edited June 16, 2022 by popeface 1
Karna5 Posted June 16, 2022 Posted June 16, 2022 That would be amazing and awesome if you end up figuring out how to have different settings for different sized breasts. The reason I had to increase the gravity correction is that while it was beautiful on large breasts with the normal settings, on flat breasts it looked outright horrible to have tiny breasts sagging instead of firmer. I as well have dozens of different body presets in my Fallout 4 game. I build nearly every outfit and mashup in the game with a different body preset. Your description of how you set the gravity sounds awesome, popeface, and I'd love to try those settings if you figure out how to do your goal. The only reason I hesitate at the moment is specifically of how bad it looks on flat breasts. In my opinion flat breasts need to be firmer and large breasts bouncier. Increasing the gravity correction let me have a game in which flat breasts don't sag and large breasts still bounce a lot, but it would be even more realistic if you achieve your goal and if I don't have to increase the gravity correction. 1
genericuser332321 Posted June 17, 2022 Author Posted June 17, 2022 22 hours ago, Karna5 said: Your description of how you set the gravity sounds awesome, popeface, and I'd love to try those settings if you figure out how to do your goal. I appreciate the vote of confidence; if/when I manage to get this working I’ll make a new thread to “announce” it and see if you’re willing to give it a trial run. On that note, I have found a few promising leads while digging through a variety of scripts, including vinfamy’s Diverse Bodies; in fact, DB actually seems to have most of the main pieces I need to accomplish this, but I need to dive a bit deeper and figure out how they all fit together. There’s a variable that holds a list of slider names, as well as a getMorph() function that takes a few arguments (including actor and slider name), so those two would be perfect for my needs. The issue is that I don’t know where the getMorph() function is defined, and the list of sliders is empty in the code and just has “auto” written at the end of the line, and I’m not familiar enough with Papyrus yet to know if it’s set to auto-populate the list based on the included sliders.json file when compiled, or if I need to define it elsewhere, or what. Next steps are to compile the DB Papyrus script with the FG slider file present (instead of the CBBE one that DB is based on) and see if that pulls in the correct sliders, and delve further into CBBE (and possibly Looks Menu/F4EE/F4SE) to see if I can figure out where the getMorph() function is defined. Should be a fun little mystery to solve. 1
genericuser332321 Posted June 17, 2022 Author Posted June 17, 2022 Big news sports fans! After some digging around, I've managed to locate the getMorph() (as well as setMorph() and updateMorphs()) in the BodyGen Papyrus script used by Looks Menu. Even better, I can pass a series of arguments to getMorph() to pull a value from a specific slider for males or females only, so (theoretically) I should be able to set up a list of sliders and pull the values from those sliders only. I'm currently trying to figure out how to get DB to work with Fusion Girl, but now that I've located those morph functions I'm able to get the DB script to compile, which is a step in the right direction. Based on the Looks Menu scripts, I may be able to pull in a list of morphs used by the specific actor; if I can assign that list to a variable, then I might be able to get DB to effectively work with any body gen flavour available (e.g., CBBE, FG, BodyTalk). Now that I seem to be gaining some ground on this, I'll try to get DB working as soon as I'm able (mostly to verify that I can use those functions and get slider data effectively), and then will likely work on a quick and dirty proof-of-concept OCBP script. 1
tzenrick Posted June 19, 2022 Posted June 19, 2022 I was going to mention looking to Len Anderson's Rad Morphing Redux. It modifies body morphs in-game based on PlayerRef rad levels. It also stores and resets followers as well, so I has all of the Get/Set routines in it. As far as integrating with CBP/OCBP/OCBPC I wouldn't have a clue, because I am useless with C/C++.
genericuser332321 Posted June 19, 2022 Author Posted June 19, 2022 3 hours ago, tzenrick said: I was going to mention looking to Len Anderson's Rad Morphing Redux. It modifies body morphs in-game based on PlayerRef rad levels. It also stores and resets followers as well, so I has all of the Get/Set routines in it. As far as integrating with CBP/OCBP/OCBPC I wouldn't have a clue, because I am useless with C/C++. Hmm, thanks for the suggestion. I did manage to locate the getMorph()/setMorph() functions, and I’m working my way through getting DB brought into the current era (that is, working with FG and BT3). I’m actually not that familiar with the programming side of modding, but I’m familiar enough with code in general (and have a good enough Google-fu) that I can mostly piece together what’s going on. Funny enough, even though I’m working on DB as a precursor to OCBP/OCBPC, I think it’s actually turning into a bigger overall project than I expected, especially with trying to keep the existing CBBE functionality while adding FG and BT3 compatibility. You are making me think about adding additional appearance changes based on other factors though (e.g., rads, hunger/thirst levels, sleep deprivation). Maybe after I’m done with this stuff.
Mr.Grajill Posted June 30, 2022 Posted June 30, 2022 Hey, I thought of this a few weeks ago, too. I'm looking for any progress, will you can share it with us when it's done ??
genericuser332321 Posted August 9, 2022 Author Posted August 9, 2022 No real progress unfortunately; things have been busy with life, so I haven't had a chance to get anything else done. Additionally, I'm not a programmer (I just dabble in code), so I'm mostly relying on my limited knowledge, the comments in the code, and the context to piece things together. Having said that, here's what I've put together so far (which may or may not be correct); bear with me for the very basic stuff (it'll remind me what I've been working on if I can't come back to it for a few months): - All of the scripts used by Fallout 4 are written using "Papyrus", which is Bethesda's proprietary scripting language (I can't recall what it's based in though). - Anything ending in .pex is the compiled file; anything ending in .psc is the source file. - Based on digging through some of the code for OCBP/F4SE available on GitHub and looking at the Papyrus source files, there's a relationship between the functions in the Papyrus script and the functions in the compiled library for the mod. For example, the OCBP_API.psc Papyrus source file lists "SetBoneToggle", "GetBoneToggle", and "ClearBoneToggles" functions, which are defined in PapyrusOCBP.cpp (which is compiled along with a bunch of other files into the cbp.dll file that ends up in the F4SE Plugins folder in your Fallout 4 Data folder). It also looks like PapyrusOCBP.cpp "registers" those functions as being in OCBP_API and "belonging to" PapyrusOCBP.cpp. - Based on my (limited) understanding of how the game actually runs on a computer, it seems like all of the files (.dll and .pex) are loaded into memory when you initially run the game; given what's in the .dll files vs the Papyrus scripts, my assumption is that the heavy lifting/background game processes are primarily handled by the functions in the .dll file, whereas the Papyrus scripts are effectively a subset of those scripts that are considered usable/modifiable by the end user. In other words, the .dll lists all of the functions (and all of the relationships between them) and does all of the background heavy lifting, whereas the Papyrus script just lists a few limited functions and arguments that end up having some noticeable effect in the game world. - It also looks like there's a couple different types of Papyrus files; there appears to be one type that names functions and arguments that are defined in the respective compiled library, and then there's ones that "extend" those files and define additional functions (which I assume are not in the compiled libraries). - With all of that in mind, the "Thing.cpp" file in OCBP is of particular interest, as that's the one that seems to actually deal with bone rotation/motion at the nodes. From what I've gathered, it only works on one actor at a time, so (theoretically) it should be possible to pass actor-specific values to it to get a "customized" effect for each actor. Further, there appears to be a function in that file that updates the configuration values to reflect the specific node it's dealing with (it only pulls in a single value for each configuration variable), so it should be possible to modify those values based on the current node; this seems like it could be a relatively simple set of "if/else" statements that basically say "if the current node is X, get the body morph values for these specific variables, and perform this transformation on these specific configuration variables" (e.g., if node == Breast_CBP_L_02, then use the values from these specific Body Morph sliders to divide/multiply/add/subtract these specific configuration variables by X amount). It might be easiest to figure out the transformation values in a separate function, and then just use a single value to update the configuration values (rather than trying to use all of the body morph values to update the configuration on the fly). - Technically, the game has to be able to get the Body Morph values for each actor separately considering that you can use Body Gen on any actor in the game (including all of the relevant LooksMenu sliders), and the BodyGen.psc Papyrus source code includes a couple functions to get morph data (one returns all of the morphs used by a specific actor, and another returns the value associated with a specific morph). It should be relatively straightforward to identify which morph values I'm interested in from either the FG/BT3 sliders, or by getting the morphs and dumping the data into a log file (although I'm not sure how to do the latter). Anyway, that's what I've managed to figure out so far. Where I need to do a bit more digging is to figure out how to pass info from BodyGen to OCBP. If I had the original configuration source code for BodyGen, I could probably just modify OCBP to include the relevant files and have it pull that data directly in the background, but that's not the case. The only thing I can think of is writing a Papyrus script that "extends" BodyGen that'll pull in the morph data and pass it to OCBP; however, I don't know if I can extend BodyGen with a Papyrus script that "belongs to" OCBP, or if I can extend both BodyGen and OCBP_API with one script. If I can extend BodyGen using a script that's registered in OCBP, then I could try to write a function in OCBP that uses the current node to pull in specific morph data from BodyGen. If I can't do that, but I can write a function to extend both OCBP_API and BodyGen, then I'll have to write a couple functions that pass the current node to the extended Papyrus script, then use the script to pull a series of values from BodyGen for updating the OCBP configuration, and then pass those values back to OCBP to update the configuration. If I can't extend both scripts at once, then I'll have to figure out something else. So that's where I'm at so far. If someone proficient with C/C++ and/or Papyrus wants to help me write the code to pass values from BodyGen to OCBP, then I'm more than happy to accept assistance; it'll take some tweaking to get the transformations working properly anyway, so if someone else is able to get the basic code in place then I can adjust it as needed.
Indarello Posted August 9, 2022 Posted August 9, 2022 (edited) 10 hours ago, genericuser332321 said: No real progress unfortunately; things have been busy with life, so I haven't had a chance to get anything else done. Additionally, I'm not a programmer (I just dabble in code), so I'm mostly relying on my limited knowledge, the comments in the code, and the context to piece things together. Having said that, here's what I've put together so far (which may or may not be correct); bear with me for the very basic stuff (it'll remind me what I've been working on if I can't come back to it for a few months): - All of the scripts used by Fallout 4 are written using "Papyrus", which is Bethesda's proprietary scripting language (I can't recall what it's based in though). - Anything ending in .pex is the compiled file; anything ending in .psc is the source file. - Based on digging through some of the code for OCBP/F4SE available on GitHub and looking at the Papyrus source files, there's a relationship between the functions in the Papyrus script and the functions in the compiled library for the mod. For example, the OCBP_API.psc Papyrus source file lists "SetBoneToggle", "GetBoneToggle", and "ClearBoneToggles" functions, which are defined in PapyrusOCBP.cpp (which is compiled along with a bunch of other files into the cbp.dll file that ends up in the F4SE Plugins folder in your Fallout 4 Data folder). It also looks like PapyrusOCBP.cpp "registers" those functions as being in OCBP_API and "belonging to" PapyrusOCBP.cpp. - Based on my (limited) understanding of how the game actually runs on a computer, it seems like all of the files (.dll and .pex) are loaded into memory when you initially run the game; given what's in the .dll files vs the Papyrus scripts, my assumption is that the heavy lifting/background game processes are primarily handled by the functions in the .dll file, whereas the Papyrus scripts are effectively a subset of those scripts that are considered usable/modifiable by the end user. In other words, the .dll lists all of the functions (and all of the relationships between them) and does all of the background heavy lifting, whereas the Papyrus script just lists a few limited functions and arguments that end up having some noticeable effect in the game world. - It also looks like there's a couple different types of Papyrus files; there appears to be one type that names functions and arguments that are defined in the respective compiled library, and then there's ones that "extend" those files and define additional functions (which I assume are not in the compiled libraries). - With all of that in mind, the "Thing.cpp" file in OCBP is of particular interest, as that's the one that seems to actually deal with bone rotation/motion at the nodes. From what I've gathered, it only works on one actor at a time, so (theoretically) it should be possible to pass actor-specific values to it to get a "customized" effect for each actor. Further, there appears to be a function in that file that updates the configuration values to reflect the specific node it's dealing with (it only pulls in a single value for each configuration variable), so it should be possible to modify those values based on the current node; this seems like it could be a relatively simple set of "if/else" statements that basically say "if the current node is X, get the body morph values for these specific variables, and perform this transformation on these specific configuration variables" (e.g., if node == Breast_CBP_L_02, then use the values from these specific Body Morph sliders to divide/multiply/add/subtract these specific configuration variables by X amount). It might be easiest to figure out the transformation values in a separate function, and then just use a single value to update the configuration values (rather than trying to use all of the body morph values to update the configuration on the fly). - Technically, the game has to be able to get the Body Morph values for each actor separately considering that you can use Body Gen on any actor in the game (including all of the relevant LooksMenu sliders), and the BodyGen.psc Papyrus source code includes a couple functions to get morph data (one returns all of the morphs used by a specific actor, and another returns the value associated with a specific morph). It should be relatively straightforward to identify which morph values I'm interested in from either the FG/BT3 sliders, or by getting the morphs and dumping the data into a log file (although I'm not sure how to do the latter). Anyway, that's what I've managed to figure out so far. Where I need to do a bit more digging is to figure out how to pass info from BodyGen to OCBP. If I had the original configuration source code for BodyGen, I could probably just modify OCBP to include the relevant files and have it pull that data directly in the background, but that's not the case. The only thing I can think of is writing a Papyrus script that "extends" BodyGen that'll pull in the morph data and pass it to OCBP; however, I don't know if I can extend BodyGen with a Papyrus script that "belongs to" OCBP, or if I can extend both BodyGen and OCBP_API with one script. If I can extend BodyGen using a script that's registered in OCBP, then I could try to write a function in OCBP that uses the current node to pull in specific morph data from BodyGen. If I can't do that, but I can write a function to extend both OCBP_API and BodyGen, then I'll have to write a couple functions that pass the current node to the extended Papyrus script, then use the script to pull a series of values from BodyGen for updating the OCBP configuration, and then pass those values back to OCBP to update the configuration. If I can't extend both scripts at once, then I'll have to figure out something else. So that's where I'm at so far. If someone proficient with C/C++ and/or Papyrus wants to help me write the code to pass values from BodyGen to OCBP, then I'm more than happy to accept assistance; it'll take some tweaking to get the transformations working properly anyway, so if someone else is able to get the basic code in place then I can adjust it as needed. If you want more help I suggest to write less text, because for example I dont have 15 min to read all this messages in order to help. I just went through topic name and may say that I suggest to focus in creating more simple mods then trying to do C++ coding if you are not really good at it, just to make better ocbp bounce depend on breast size? That does not worth the effort Edited August 9, 2022 by Indarello
genericuser332321 Posted August 9, 2022 Author Posted August 9, 2022 (edited) 4 hours ago, Indarello said: If you want more help I suggest to write less text, because for example I dont have 15 min to read all this messages in order to help. I just went through topic name and may say that I suggest to focus in creating more simple mods then trying to do C++ coding if you are not really good at it, just to make better ocbp bounce depend on breast size? That does not worth the effort Noted. The text in my previous post was partially A) to remind me of where I'm at if I can't come back to this for a couple months, B) to share what I found in case someone is interested in helping, and C) to provide info if I don't end up finishing this and someone is looking for something similar in the future. Taking 15 minutes to read that one post is certainly less time than I've spent digging through the files to piece all of that together. Your comment on it not being the effort for you is also noted. As for me, I've spent enough time making "simple" mods that I like a challenge. There's enough people tweaking weapon stats and making outfits that I may as well put my time towards something else. Edited August 9, 2022 by genericuser332321
AKawaiiTent Posted August 12, 2022 Posted August 12, 2022 (edited) BodyGen already has scripts for pulling the value of your sliders that you can put into any script. From the papyrusbodygen plugin " float GetMorph(StaticFunctionTag*, Actor * actor, bool isFemale, BSFixedString morph, BGSKeyword * keyword) { return g_bodyMorphInterface.GetMorph(actor, isFemale, morph, keyword); } " so you would simply set up a function like this Float function FindMyMorph() actor akActor = Game.GetPlayer() ;pulls the player character for the actor, you'd have to get creative to pull certain npcs. Float temporaryvariable = BodyGen.GetMorph(akActor, true,"Whatever the slider name is", ModKeyword) ;gets the value of the morph as a float and stores it as temporaryvariable. return (temporaryvariable) EndFunction Now we can just use the float function FindMyMorph and put it into any other functions later in the script. E.G. Function BoobiePill() actor akActor = Game.GetPlayer() Float Boobsize = YourScriptName.FindMyMorph() + 0.1 BodyGen.SetMorph(akActor, true, "boobs", YourKeyword, Boobsize) ;This would get your current boob size, and make it 0.1 or 10% of the slider bigger. EndFunction If your curious where to find other bodygen scripts that are usable, https://github.com/expired6978/F4SEPlugins/blob/master/f4ee/PapyrusBodyGen.cpp Edited August 12, 2022 by AKawaiiTent 1
AKawaiiTent Posted August 12, 2022 Posted August 12, 2022 As for finding the slider names for Fusion girl. The should be in a folder in F4SE/Plgins/F4EE/Sliders as a .json file. Unfortunately the only OCBP scripts that are there by default are for turning the tuning on and off. Which as far as i can tell just tells the game to check the ocbp.ini every X frames. 1
genericuser332321 Posted August 12, 2022 Author Posted August 12, 2022 11 hours ago, AKawaiiTent said: BodyGen already has scripts for pulling the value of your sliders that you can put into any script. Much obliged, I appreciate the input. I have the OCBP source files, so I'm going to try to modify a couple of them to see if I can add a bit of code to register a Papyrus script that extends the BodyGen script, and then pass a slider value to OCBP (e.g., pull the slider value, and if X = Y then return a value of TRUE to OCBP to do Z). If I can get proof-of-concept working, then everything else is just adding details and making the code look nice.
AKawaiiTent Posted August 12, 2022 Posted August 12, 2022 Something else i just thought of that might be useful to look at for reference is MCM. MCM has papyrus scripts that let you update the settings .ini file from in-game so there must be some way to send a variable from papyrus to an .ini
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now