I will check this out...

And yes... maybe I am confused on what is going on ...

The issue I am having is that is I searching for all the 'mesh'
objects in the scene, once I find one, I look for it's transform node,
and take the tx,ty,tz data from that and save that info to a file.
The problem is that when they are grouped and instanced, I am not
getting the info that tells me that I have an instanced node and that
I need to look for more transform data.  Because I get an entry in my
txt file for all the nodes in the scene, but O am getting duplicate
transform data.  So my thought was to take the world trans info from
the instanced group and add that to the transform data that I have
collected.  But I am hoping there is a much better way of doing this.

Here is some of the code that I had before.


from pymel import *   # safe to import into main namespace


def exportGeo(objFolderPath):
    obj = "OBJexport"
    for x in ls(type='mesh'): #find the mesh's in the scene
        print x
        select(x, add=1) #select them
        #for mesh in ls(sl=1):
        print x
        objTransName = []
        objTransName = listRelatives(x, ap=1)  # build a list of their
parents. Ideally the transform nodes
        if len(objTransName)>1: #test to see if there is more that one
Transform node for the mesh (instance)
            select(cl=1)
            for instance in objTransName:
                select(instance) #select transform node
                objTransName = str(instance)
                print objTransName
                objTransName = re.sub("[\[\]\(\)']", "", objTransName)
#strip out bad chars
                print objTransName
                objFileName = os.path.join(objFolderPath, "%s" % (objTransName))
                exportSelected(objFileName, pr = 1, typ = obj, es = 1,
op="groups=1;ptgroups=1;materials=1;smoothing=1;normals=1")

        else:
            objTransName = str(objTransName)
            objTransName = re.sub("[\[\]\(\)']", "", objTransName)
            objTransName = re.sub("Transform", "", objTransName)
            #print objTransName
            objFileName = os.path.join(objFolderPath, "%s" % (objTransName))
            exportSelected(objFileName, pr = 1, typ = obj, es = 1,
op="groups=1;ptgroups=1;materials=1;smoothing=1;normals=1")
            select(cl=1)




exportGeo(objFolderPath)



print "Exit"

-------

I have stripped a bit out there... but ideally that helps explain the
issue I a dealing with.   I am assuming that this is something very
stupid and is dealt with all the time, I am just not very fammiliar
with all of this, and am looking for the best way to get all this
info.  I also have locators that I am going to be doing this for as
well.  This is what sent me down the path for looking into the
isInstanced() function.



Thank you!

Sincerely,

Justin

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to