Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 06-05-2012 , 02:24 PM
Subscriber
Join Date: Dec 2004
Posts: 203

Maya remembering old variables... Memory Leak?

Today I have discovered something very odd, while using Maya's python scripting language. As I was trying to run a script, I noticed that I did not recieve an error stating that a variable was not defined inside one of my def functions. Instead I was getting old values from a previous script which I have pasted into my current script that I am working on. As I was baffled and cursing at my computer, I finally figured it out that this strange event was happening due to the variable being misspelled in the def function itself. (See the example below). So I am wondering, is this a memory leak, where Maya is not releasing the memory from old variables?
Code:
def getEdgeOrder(borderEdgeList, borderVertrList) :
    edgeList = {}
    for v in borderVertList:
        edgeList[v] = []
        print v
    
    #for edge in edgeList.items() :
    #    print edge
    return []
    
    nList = [[] for i in borderEdgeList]
    for edge in borderEdgeList:
        info = cmds.polyListComponentConversion(edge, tv = 1)
        info = cmds.filterExpand(info, sm = 31) 
        
        if info[1] not in edgeList[info[0]] : edgeList[info[0]].append(info[1])
        if info[0] not in edgeList[info[1]] : edgeList[info[1]].append(info[0])
        
    start = borderVertList[0]
    end = edgeList[start][1]
    last = edgeList[start][1]
    counter = 0
    e = []
    
    while start != end :
        counter = counter + 1
        #print edgeList[start]
        
        if counter >= len(borderEdgeList) :
            print "error"
            break
        elif edgeList[start][0] == last :
            x = edgeList[start][1]
        else :
            x = edgeList[start][0]
        
        e.append([start, x])
        last = start
        start = x
        
    e.append([end, borderVertList[0]])
    
    edgeOrder = []
    for a in e:
        cmds.select(a, r = 1)
        cmds.ConvertSelectionToContainedEdges();
        edgeOrder.append(cmds.ls(sl = 1))

    return edgeOrder

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads