Do you expose any way in the API to set your global settings programmatically

Issue #2056 resolved
Joe Morris @ FAST Animation Studio Toolz created an issue

I looked around I couldn't find anything specific if you don't do that could you create a function where I could set settings based on name to a specified value...

Best Regards!

Comments (14)

  1. Joe Morris @ FAST Animation Studio Toolz reporter

    I know I could set them using normal python roots but I think it would be good overall for your end users to have that exposed because I could think of many many reasons to have that functionality.

  2. Joe Morris @ FAST Animation Studio Toolz reporter

    Awesome thank you!! did you just add that… Or was it already there just wondering if I need to reinstall the latest development version

  3. Joe Morris @ FAST Animation Studio Toolz reporter

    OK it turns out that when I run the code below it appears to send it properly but I'm not sure at what's level it sends it because right after I sent this in the console confirms it……………………. I go to global settings and it's still set to material for shellmethod………….I redrew all areas with this well tested function which is all I ever need to do to make sure a property's been updated on ui…..but it still doesn't show in your global properties can I be confident after I set this that the code following it inside the same function such as easy import DAZ will import the character with whatever settings I set with the Set global setting function…….. since you are setting a global setting I would think that it would be A little better if it instantly showed up in your global settings as showing the proper change meaning that if it is necessary to do some sort of redraw that maybe you could do that inside the function itself unless you feel from experience that it's important to make sure the end user maintains that responsibility so can always be aware of any redrawing that's going on… That way they can be aware of possible processor overload if they get and set global settings multiple times in a loop what I would do is make it optional to do the redrawing if that's the issue and maybe I'm just not redrawing it right by adding another function property that people could set when they run these…..

    import bpy
    def tag_redraw_areas():
    for window in bpy.context.window_manager.windows:
    for area in window.screen.areas:
    if area.type in {"VIEW_3D"}:
    area.tag_redraw()

    def update_shell_method():
    # Ensure DAZ import setup
    bpy.ops.fast.show_console()
    result = bpy.ops.fast.attempt_import_daz()
    if "CANCELLED" in result:
    return

    try:
        import import_daz
    except ModuleNotFoundError:
    
        return
    current_shell_method = import_daz.get_global_setting("ShellMethod")
    print(f"Current ShellMethod: {current_shell_method}")
    # Set the global setting for ShellMethod
    import_daz.set_global_setting("ShellMethod", 'Geometry Nodes')
    tag_redraw_areas()
    

    update_shell_method()

  4. Joe Morris @ FAST Animation Studio Toolz reporter

    OK the reason was is you have a different property name for geometry nodes for shell method it isGEONODES…. As an end user of your product I was thinking that the precise property name that I chose on the global settings interface was the precise property name that I would use of course I assumed that experimental wouldn't be added to the property name so that's what I entered I'm thinking for user experience and ease of use of your api that would be the best way to go about it To make whatever the name of the property that you set the actual name that's used in code otherwise if you made the actual name available on the tooltip obviously … That would be another way I went ahead and saved the settings in global settings and looked at how you had it listed there but not a hundred percent sure if novice users to your api would know to do that,,,

  5. Joe Morris @ FAST Animation Studio Toolz reporter

    And I don't know if I should make another issue for this or if we could talk about it here I got it to work with the above idea but the L4N4 character that we were talking about before when I used the geometry nodes setting for shell method it didn’t look the same as in DAZ it looked better it didn't look like you know a deformed girl her skin was all gray but also I think if your code was designed so that if there was a least a setting you could set in global settings to make that it always look as close to texture shaded mode in DAZ you know along with a message on the tool tip saying that you would be sacrificing maybe some viewport performance… And I assume that you tested this with the geometry node setting on the L4 and four before you told me about the setting is there possibly something I'm doing wrong i'm in texture mode of solid mode I tried all other modes and you know it didn’t look the same way as it does in DAZ texture shaded mode but being in texture mode of solid mode after importing with the geometry node setting was the best version she basically just had gray skin which is closer to a robot but in D a Z she looked a lot like a robot...

  6. Joe Morris @ FAST Animation Studio Toolz reporter

    OK just to summarize the new global settings do work awesome they work apart from the normal adding of a settings file… Allowing you to set the settings in line after you've already imported your settings file so you can make quick changes apart from your settings file which is great and I figured out a new way to approach this it doesn't change your global settings which I think logically it should but illogically is actually better because now I don't have to worry about cleanup and going to your global settings to reset this setting now so now that I figured out the name of GEONODES I think this is a pretty good system.

  7. Thomas Larsson repo owner

    Unfortunately the python names of the enums are not displayed in the tooltip. The available enums are listed in the docs for bpy.ops.daz.global_settings, which is the operator that opens the global settings window. In particular, note the line

    shellMethod (enum in ['MATERIAL', 'GEONODES', 'IGNORE', 'MESH']) - Method for geometry shells

    You could use that operator to set settings too, but that is unwieldy unless you want to use the defaults except for a few settings.

  8. Joe Morris @ FAST Animation Studio Toolz reporter

    O K thank you very much for the information I appreciate it!!…. Any idea why the L4N4 girl when I import with the geometry node setting on doesn't look the same as it does in DAZ texture shaded mode?? … She basically just has a gray skin it looks way better than the deformed skin texture ….but…I think that would make your add on truly more awesome if it was just automatic or easily setable and always look the same as texture shaded mode in DAZ I'm sure people would be willing to sacrifice some performance in order to be assured that their characters match up especially if they use alternative characters like this robot a lot…. That would just be one more step that you can implement it to make you're addon even more the best representation of DAZ in blender

  9. Alessandro Padovani

    Because in solid mode, even with geonodes, you only get the diffuse texture not the alpha map, you need the material preview for that. This is a limit with the blender solid mode not something Thomas can fix. Again solid mode is intended as a basic preview for animation where materials and textures aren’t important.

  10. Log in to comment