Forum: Poser Python Scripting


Subject: WIP: Poser <-> Blender Bridge

adp001 opened this issue on Dec 27, 2019 ยท 92 posts


adp001 posted Mon, 30 December 2019 at 5:16 PM

You are totally right. The whole thing got out of my control :)

Here is the correct part:

    def onImportModel(self, ev):
        try:
            sc = wx.FindWindowByName("CTRL_Scale")
            CONFIG["Scale"] = sc.GetValue()
            idx = self.figurelist.GetCurrentSelection()
            if idx < 0:
                ErrDialog("No figure selected.")
                return

            figurename = self.figurelist.GetString(idx)
            figure = poser.Scene().Figure(figurename.strip())
            morph_ctrl = wx.FindWindowByName("CTRL_MorphName")
            morphname = morph_ctrl.GetValue().strip() if morph_ctrl else "MORPH"

            obj = ev.GetEventObject()
            obj.SetBackgroundColour((0xff, 0, 0))
            obj.Update()
            do_import(figure, morphname)
            obj.SetBackgroundColour(STD_COLOR)

            check = wx.FindWindowByName("CTRL_RenumberMorph")
            if check and check.GetValue():
                morphname, _, nr = morphname.partition(" ")
                morphname += " " + str(int(nr or 0) + 1)
                morph_ctrl.SetValue(morphname)
        except Exception:
            raise
        finally:
            ev.Skip()