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-28       - By Jerry Gamache

 Back
Reply:     1     2     3     4     5  

inspect.getsource( module.function ) returns the source code for a single
function, but if all the functions in a module are of interest to your PPG you
might want to try:

layout.Logic = inspect.getsource( myPPGModule )

To get all the code from myPPGModule.py in one single call.

-- --Original Message-- --
From: owner-xsi@(protected) [mailto:owner-xsi@(protected)]On Behalf
Of Patrick Boucher
Posted At: Wednesday, April 27, 2005 10:32 PM
Posted To: xsi
Conversation: <DEFANGED_script>Python and the PPG global variable?
Subject: Re: <DEFANGED_script>Python and the PPG global variable?


Aloys Baillet wrote:
> Sorry Patrick, but I don't think it's possible...
> What you can also do is to put all the code of the scripted operator in
> a separate file, and call XSIFactory.CreateScriptedOpFromFile. But in
> this case you have to know where is installed the file (what I usually
> do is to take the current PluginItem and ask its FileName property to
> find out where I am in the filesystem, then point at the scripted op
> file. The advantage of this method is that you can add as many helper
> function in your code without having to add them in the operator code
> with the inspect.getsource function...
> Cheers,
>
> Aloys

That's what I'm doing as well....

in my custom command:
myOpFile = os.path.join(myCmd.OriginPath, 'myOpFile.py')
op = XSIFactory.CreateScriptedOpFromFile('MyOp', myOpFile, 'Python')
layout = op.PPGLayout
layout.Language = "Python"
layout.Logic = inspect.getsource(foo) + inspect.getsource(bar)

I was just hoping there was a sexier/more practical way to do so.

If there's customOperator.Code and customOperator.FileName might be nice
to have PPGLayout.Logic and PPGLayout.LogicFileName. One could assign
the same file or different files to each to have all CustomOp code
outside the scene. One could also imagine a world where if the
PPGLayout.Logic is empty the system falls back to looking at
customOperator.Code for the UI event handlers...

Thanks for the help!

--
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

---
Unsubscribe? Mail Majordomo@(protected) with the following text in body:
unsubscribe xsi