No Python forum here? I need help with a small wxPython script



  • Well, if there is a Python forum here, it really is well hidden :D

    I need help with my first (ever!) script in wxPython (I used to use tkInter hitherto)
    It changes a simple colour, but neither the Preview Window nor the MarRoom UI will >>update<< after the script did it's job.

    For details, and the code, please look here:
    https://forum.smithmicro.com/topic/7939/mat-preset-to-change-only-colors-on-a-blender-node/17

    Any help from the wxPython guys would be greatly appreciated so that @perpetualrevision can get her "Messy Painter" freebie out of the door ASAP.

    Thank you!
    Karina :)


  • Poser Ambassadors

    I believe your symptom has nothing to do with wxPython. Failure to update the UI following a Python-caused material change is a common Poser weirdness that has not gotten fixed for years, despite raising the issue innumerable ways.

    There are a couple things you can try and I will tell you these. However, ultimately the only solution I know that completely works in every situation is to save the edited materials as a material collection and then load that collection. This is horrible but it always works. And if you are changing multiple props or figures (which I know you are) it is necessary to do this for each and every one.

    Anyway, here are the "official" methods (keep in mind they routinely do not work as advertised)

    After changing nodes in any way, you need to update the shader tree UI and/or the preview render with:

    material.ShaderTree().UpdatePreview()

    After changing things that would affect parameter dials or preview or probably anything at all:

    poser.Scene().Draw() # supposed to draw modified objects - yeah right
    poser.Scene().DrawAll() # supposed to redraw everything - haha good luck



  • Thank you @bagginsbill!

    Yes I already tried all these commands in various combinations, all to no avail.
    So you're probably right that this is (just another) Poser bug.
    I hoped it could be fixed in P11 (which it obviously isn't)

    At least now I learned that it's not a fault of my meagre scripting skills.
    Will try your suggestions anyway.
    Thank you
    Cheers
    K



  • Power cycling the computer has always worked for me ;-)


  • Poser Ambassadors

    @karina said in No Python forum here? I need help with a small wxPython script:

    Thank you @bagginsbill!

    Yes I already tried all these commands in various combinations, all to no avail.
    So you're probably right that this is (just another) Poser bug.
    I hoped it could be fixed in P11 (which it obviously isn't)

    At least now I learned that it's not a fault of my meagre scripting skills.
    Will try your suggestions anyway.
    Thank you
    Cheers
    K

    Uh - in your other thread you claimed the shader tree update preview did the trick. Here you claim you already tried this.

    Confused.



  • Yes you are right, and I claimed it here by mistake.
    In fact I thought I had tried it, but somehow I obviously messed up and (probably) deleted that line somewhere underway.

    Sorry for the misinformation, but after many hours searching the net for tutorials and code snippets my head was spinning, so it's a miracle I got anything working at all ;)

    Thank you again for looking at the script and pointing out the right solution.

    Karina


  • Poser Ambassadors

    Great. Thanks for making that clear. When other people look up this thread years from now (and they will) they will want to know this DID fix it.