[Sidefx-houdini-list] Callback for python scripts

Joe Barrow joe at primalpictures.com
Tue Feb 17 04:31:56 EST 2009


That's great,

Thanks very much

Jb 

-----Original Message-----
From: sidefx-houdini-list-bounces at sidefx.com
[mailto:sidefx-houdini-list-bounces at sidefx.com] On Behalf Of Graham
Thompson
Sent: 16 February 2009 19:05
To: sidefx-houdini-list at sidefx.com
Subject: Re: [Sidefx-houdini-list] Callback for python scripts

You can either pass it as a string argument, or evaluate the parameter
in your function.  For example

To get the group name and pass as an arg to your function you can do

hou.pwd().hdaModule().loadMats.loadMats(hou.pwd().evalParm("MyGroup"))


To get the group name in your function body you can use kwargs to get
the instance of the node and then eval the parm.

def loadMats(kwargs):
    mynode = kwargs["node"]
    mygroup = mynode.evalParm("MyGroup")

    ...

hou.pwd().hdaModule().loadMats.loadMats(kwargs)


On Mon, Feb 16, 2009 at 10:23 AM, Joe Barrow <joe at primalpictures.com>
wrote:

> Thanks very much,
>
> That's exactly what I was after.
>
> How do I go about feeding an argument into my script ?
>
> I have a group in another argument that I want to apply it to (defined

> as chs("./MyGroup") in old speak) and my callback line says
>
> hou.pwd().hdaModule().loadMats.loadMats('MyGroup')
>
> - I need to specify what MyGroup is, is there a simple way of doing 
> this or do I have to define a path back to it and then squeeze it into

> my callback line ?
>
> My brain hurts
>
> Jb
>
>
>
> -----Original Message-----
> From: sidefx-houdini-list-bounces at sidefx.com
> [mailto:sidefx-houdini-list-bounces at sidefx.com] On Behalf Of guillaume

> laforge
> Sent: 16 February 2009 17:31
> To: sidefx-houdini-list at sidefx.com
> Subject: Re: [Sidefx-houdini-list] Callback for python scripts
>
> Hi,
>
> You can use the hdaModule() to get your function. For example, if your

> node is inside a digital asset, you can use "MyPyFunction" like this :
> pwd().parent().hdaModule().MyPyFunction()
>
> Hope this help
>
> Cheers
>
> --
>
> Guillaume Laforge
> 3d Technical Director
> http://www.alamaison.fr
>
> On Mon, Feb 16, 2009 at 6:19 PM, Joe Barrow <joe at primalpictures.com>
> wrote:
> >
> > How do I access an embedded python script in an HDA?
> >
> > In hscript I would use opdef:.?myScript.cmd in the callback 
> > parameter,
>
> > what is the python equivalent?
> >
> > Thanks
> >
> > Joe Barrow
> >
> > ____________________________________________________________________
> > __ This communication is from Primal Pictures Ltd., a company 
> > registered
> in England and Wales with registration No. 02622298 and registered
> office: 4th Floor, Tennyson House, 159-165 Great Portland Street, 
> London, W1W 5PA, UK. VAT registration No. 648874577.
> >
> > This e-mail is confidential and may be privileged. It may be read,
> copied and used only by the intended recipient. If you have received 
> it in error, please contact the sender immediately by return e-mail or

> by telephoning +44(0)20 7637 1010. Please then delete the e-mail and 
> do not disclose its contents to any person.
> > This email has been scanned for Primal Pictures by the MessageLabs
> Email Security System.
> > ____________________________________________________________________
> > __ _______________________________________________
> > Sidefx-houdini-list mailing list
> > Sidefx-houdini-list at sidefx.com
> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>
> ______________________________________________________________________
> This communication is from Primal Pictures Ltd., a company registered 
> in England and Wales with registration No. 02622298 and registered 
> office: 4th Floor, Tennyson House, 159-165 Great Portland Street,
London, W1W 5PA, UK.
> VAT registration No. 648874577.
>
> This e-mail is confidential and may be privileged. It may be read, 
> copied and used only by the intended recipient. If you have received 
> it in error, please contact the sender immediately by return e-mail or

> by telephoning
> +44(0)20 7637 1010. Please then delete the e-mail and do not disclose 
> +its
> contents to any person.
> This email has been scanned for Primal Pictures by the MessageLabs 
> Email Security System.
> ______________________________________________________________________
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>
_______________________________________________
Sidefx-houdini-list mailing list
Sidefx-houdini-list at sidefx.com
https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list

______________________________________________________________________
This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577.

This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person.
This email has been scanned for Primal Pictures by the MessageLabs Email Security System.
______________________________________________________________________



More information about the Sidefx-houdini-list mailing list