[PyQt] Trying to import and use externally generated python script

James Polk jpolk5001 at yahoo.com
Thu Mar 17 16:53:55 GMT 2011


Greetings All,

I have what appears to be an import phenomena that I can't seem to make work,
and was hoping someone here can help solve and explain...

The snippet below is output from Maya2011 as what's called a "precomp" script,
but it is from top to bottom a Python script.  It is output from Maya, and intended to
be input into an image compositing program such as Nuke, and/or Maya's new Composite
program.  The details of the data aren't important, but essentially it deals with how
image sequences should be handled,etc.

The snippet below is just a sample of the actual script.  It basically contains a
a couple of Class definitions, and each Class has it's own set of dedicated functions,
most of them to return certain information about the database.
Below the class and function definitions are actual data, that is laid out in such a way
(it seems to me) to be loaded/input into the class and functions...etc...

I'm actually attempting to use the data/class/functions in this file in a custom PyQt
application that performs other operations on the data.  I'm parsing this file to get
what's called "renderLayer" information.  But rather than simply parsing, it occurs to me
that I should be able to just import this file as a .py file and run/exec/etc...
My problem is,...if I just import it as is, nothing seems to happen so to speak, lol..
The data that is defined doesn't appear to have been defined at all, so I can't use the
functions,etc.  What's missing? How can I import this into python and utilize/access
the data?  Do I just need a "main"...and/or an "exec_()"  ?

Any and all suggestions and advice is most greatly appreciated,
Cheers,
-Jim

#----------  snip -------------------------------------------------------------------------
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-


#-------------------------------------------------------------------------------
#
class RenderLayer:

    def getName(self):
        return self.name

    def getVersion(self):
        return self.version

    def getDescription(self):
        return self.description

        etc,etc
          .
          .
          .

#-------------------------------------------------------------------------------
# Render Layers

LayerNumberOne____CameraNumOne = RenderLayer()
LayerNumberOne____CameraNumOne.name = u"LayerNumberOne"
LayerNumberOne____CameraNumOne.anchor = u"LayerNumberOne"
LayerNumberOne____CameraNumOne.version = int(1)
LayerNumberOne____CameraNumOne.description = u""
LayerNumberOne____CameraNumOne.note = u''''''
LayerNumberOne____CameraNumOne.compositingOrder = int(5)
LayerNumberOne____CameraNumOne.blendMode = RenderLayer.BlendMode.Normal
LayerNumberOne____CameraNumOne.renderWidth = int(3000)
LayerNumberOne____CameraNumOne.renderHeight = int(1688)
LayerNumberOne____CameraNumOne.renderPixelRatio = float(1)
LayerNumberOne____CameraNumOne.templateFilePath = u""
LayerNumberOne____CameraNumOne.selectedForImport = bool(1)
LayerNumberOne____CameraNumOne.renderPasses = [ BeautyPass, DiffusePass, SpecularPass, EtcPass, EtcPass]

LayerNumberTwo____CameraNumTwo = RenderLayer()
etc,etc
   .

# ---------  snip ---------------------------------------------------------------------






      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110317/0ae988c2/attachment.html>


More information about the PyQt mailing list