Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
<DEFANGED_script >Python and the PPG global variable?

<DEFANGED_script >Python and the PPG global variable?

2005-04-27       - By Patrick Boucher

 Back
Reply:     1     2     3     4     5  

Jerry Gamache wrote:
> The nifty func.toString() from jscript does not translate directly into str
(func) in Python. You ended up calling OnInit as you were running the setup
script and it is normal that PPG is not defined there.
>
> You have some options:
>
> 1- Pass all the logic inlined in a string:
>
> # Put all the PPG logic inside a triple quoted string.
> # Can be difficult to debug since syntax errors will
> # not be found until the PPG is opened.
> oLayout.Logic = """
>
> def OnInit():
>   Application.LogMessage(str(dir(PPG)))
>
> def Cons_OnChanged():
>   Application.LogMessage(str(dir(PPG)))
>  
> """
>
> 2- Grab the function text from an imported module:
>
> import inspect
> import myPPGHandlers
>
> # Grab the code directly from the imported module:
> # Easier to debug since syntax errors will get caught
> # when importing the module, and easier to manage since
> # everything is in a module.
> oLayout.Logic = inspect.getsource(myPPGHandlers.OnInit) + \
>        inspect.getsource(myPPGHandlers.cons_OnChanged)
>
> I currently don't think you can get the source code of a function defined in
the setup code since that code is very quickly compiled into bytecode and the
actual source text is discarded. This means that the code text must reside in a
file somewhere and the import/inspect combo is you solution here.
>
>
>
> ---
> Unsubscribe? Mail Majordomo@(protected) with the following text in body:
> unsubscribe xsi
>

When creating a custom scripted operator, is there any way to use the
same kind of layout logic mechanism as a self-installable PPG?

I'm usisng your #2 technique on a tip from one of my coworkers but I'd
rather everything be callback based.

--
Patrick Boucher
TD - Coder - Resident geek
Buzz Image Group
Tel 514.848.0579
Fax 514.848.6371

www.buzzimage.com
www.xsi-blog.com
---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi