[Sidefx-houdini-list] Run Script doesn't like Python???

Graham Thompson captainhammy at gmail.com
Tue Mar 23 17:44:34 EDT 2010


The ID is basically just some internal name/event.  In most cases the
event triggers an internal Houdini command.  You also use the ids to
map keyboard shortcuts to.

If you look in $HH/MainMenuMaster you'll see the "docs" for all this
stuff.  It shows you an example of running an external script as
opposed to running code.

      <scriptItem id="h.my_python_script">
        <label>My Python Script</label>
	<scriptPath>$HOME/script_file.py</scriptPath>
	<scriptArgs>arg_one arg_two arg_three</scriptArgs>
      </scriptItem>




2010/3/23 Pablo Giménez <pablogipi at gmail.com>:
> Cool it worked!
> One more thing, I have seen that every entry has an id.
> In your code snippet you put the python script directly in the XML file.
> Is there any way I can assign a python script to this id, I mean, the
> standar entries in the menu just have an id, so I guess there is some kind
> of combention about how to write a python script for an id entry from the
> menu, at least these standar entries are calling to comething isn't it?
> thx
>
>
> 2010/3/23 Graham Thompson <captainhammy at gmail.com>
>
>> It's just like most other config things you can have in Houdini: you
>> can have multiples.  Just copy the one in $HH and remove all the
>> entries or create a new one and just put your own entries in it and
>> stick it somewhere in the HOUDINI_PATH and you'll be good.
>>
>> 2010/3/23 Pablo Giménez <pablogipi at gmail.com>:
>> > Thanks Graham for the info.
>> > Is there any way to have your own MainMenuCommon that just add your
>> custom
>> > entries.
>> > I guess you are modifying the MainMenuCommon file in $HH or making a copy
>> to
>> > your home to override the one from the install location.
>> > I don't want to override the whole file, just have a file with a bunch of
>> > XML that add my own entries to the existing menu in Houdini.
>> > For instance in Maya I can use MEL to add entries to the main menu
>> created
>> > by the mel script shipped with the package.
>> > I want to do something similar with Houdini.
>> > thanks.
>> >
>> > 2010/3/22 Graham Thompson <captainhammy at gmail.com>
>> >
>> >> I ended up writing my own simple one and throwing it into
>> MainMenuCommon.
>> >>
>> >>      <scriptItem id="runpythonscript">
>> >>         <label>Run Python Script</label>
>> >> <modifyItem><insertAfter>h.source</insertAfter></modifyItem>
>> >> <scriptCode><![CDATA[filepath = hou.ui.selectFile(title="Select Python
>> >> script to run", pattern="*.py")
>> >> if len(filepath) is not 0:
>> >>     fullpath = hou.expandString(filepath)
>> >>     execfile(fullpath)]]></scriptCode>
>> >>       </scriptItem>
>> >>
>> >> 2010/3/22 Pablo Giménez <pablogipi at gmail.com>
>> >> >
>> >> > Hi.
>> >> > I am trying to source some python script using the File menu entry
>> "Run
>> >> > Script .."
>> >> > Seems it only works with HScript, no chance for Python scripts created
>> >> using
>> >> > the hou.Node.asCode() method.
>> >> > I can load these scripts using the python function execute() from a
>> >> python
>> >> > shell.
>> >> > Using version 10.0.312
>> >> > Thanks
>> >> >
>> >> > --
>> >> > Un saludo
>> >> > Best Regards
>> >> > Pablo Giménez
>> >> > _______________________________________________
>> >> > 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
>> >>
>> >
>> >
>> >
>> > --
>> > Un saludo
>> > Best Regards
>> > Pablo Giménez
>> > _______________________________________________
>> > 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
>>
>
>
>
> --
> Un saludo
> Best Regards
> Pablo Giménez
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list