Tue, Apr 16, 1:28 PM CDT

Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Mar 19 1:03 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Simple method to protect set parameters against changes.


adp001 ( ) posted Sat, 01 May 2021 at 5:35 PM · edited Sun, 10 March 2024 at 6:50 PM
def freeze(parm):
    assert isinstance(parm, poser.ParmType)
    v = parm.Value()
    parm.SetUpdateCallback(lambda a, b: v)

And the obvious counterpart:

def unfreeze(parm):
    assert isinstance(parm, poser.ParmType)
    parm.ClearUpdateCallback()

Unlike Poser's built-in method (Lock Object), this also allows morph parameters to be protected against accidental modification.

When using this method, you must be very careful not to delete any object without first removing the locks. Otherwise there is a danger of crashing.

The best way is to use it within an AddOn, where you are notified when objects are deleted (or added).




adp001 ( ) posted Sat, 01 May 2021 at 5:52 PM

Try this one:

def doFreeze():
    actor = poser.Scene().CurrentFigure().Actor("Hip")
    freeze(actor.ParameterByCode(poser.kParmCodeXTRAN))
    freeze(actor.ParameterByCode(poser.kParmCodeYTRAN))

Load a figure and run the script. Then grab the figures hip with the mouse and try to move it. It will move – but only in the (not blocked) Z-direction.

Don*t forget to unfreeze!




EldritchCellar ( ) posted Fri, 04 June 2021 at 3:31 PM

Nice.



W10 Pro, HP Envy X360 Laptop, Intel Core i7-10510U, NVIDIA GeForce MX250, Intel UHD, 16 GB DDR4-2400 SDRAM, 1 TB PCIe NVMe M.2 SSD

Mudbox 2022, Adobe PS CC, Poser Pro 11.3, Blender 2.9, Wings3D 2.2.5


My Freestuff and Gallery at ShareCG




Y-Phil ( ) posted Sat, 19 June 2021 at 7:00 AM
Online Now!

Thanks!

PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


adp001 ( ) posted Fri, 16 July 2021 at 11:36 AM

Seeams that my warning in the first message isn't needed anymore. I deleted props and figures with an active callback and nothing bad happend.




Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.