Exemplo n.º 1
0
def __readTemplate(stream, instructions):

    filename = str(stream.readQString())
    if stream.licFileVersion >= 15:
        TemplatePage.separatorsVisible = stream.readBool()

    # Read in the entire abstractPart dictionary
    global partDict, colorDict
    colorDict = instructions.colorDict
    partDict = {}
    for unused in __readPartDictionary(stream, instructions):
        pass

    submodelPart = __readSubmodel(stream, None)
    template = __readPage(stream, instructions.mainModel, instructions, submodelPart)
    template.submodelPart = submodelPart

    if stream.licFileVersion >= 12:

        class T(object):
            pass

        t = template.staticInfo = T()
        t.page, t.csi, t.pli, t.smp = T(), T(), T(), T()
        __readStaticInfo(stream, t.page, t.csi, t.pli, t.smp)

    if stream.licFileVersion >= 5:
        values = []
        for unused in range(stream.readInt32()):
            values.append(stream.readFloat())
        LicGLHelpers.setLightParameters(*values)

    for part in template.submodelPart.parts:
        if partDict.has_key(part.filename):
            part.abstractPart = partDict[part.filename]
        else:
            part.abstractPart = AbstractPart(part.filename)

        template.steps[0].csi.addPart(part)

    for abstractPart in partDict.values():
        if abstractPart.glDispID == LicGLHelpers.UNINIT_GL_DISPID:
            abstractPart.createGLDisplayList()

    for glItem in template.glItemIterator():
        if hasattr(glItem, "createGLDisplayList"):
            glItem.createGLDisplayList()

    template.submodelPart.createGLDisplayList()
    template.submodelItem.setAbstractPart(template.submodelPart)
    template.postLoadInit(filename)
    return template
Exemplo n.º 2
0
def __readTemplate(stream, instructions):

    filename = str(stream.readQString())
    if stream.licFileVersion >= 15:
        TemplatePage.separatorsVisible = stream.readBool()

    # Read in the entire abstractPart dictionary
    global partDict, colorDict
    colorDict = instructions.colorDict
    partDict = {}
    for unused in __readPartDictionary(stream, instructions):
        pass

    submodelPart = __readSubmodel(stream, None)
    template = __readPage(stream, instructions.mainModel, instructions, submodelPart)
    template.submodelPart = submodelPart

    if stream.licFileVersion >= 12:
        class T(object):
            pass
        t = template.staticInfo = T()
        t.page, t.csi, t.pli, t.smp = T(), T(), T(), T()
        __readStaticInfo(stream, t.page, t.csi, t.pli, t.smp)

    if stream.licFileVersion >= 5:
        values = []
        for unused in range(stream.readInt32()):
            values.append(stream.readFloat())
        LicGLHelpers.setLightParameters(*values)

    for part in template.submodelPart.parts:
        if partDict.has_key(part.filename):
            part.abstractPart = partDict[part.filename]
        else:
            part.abstractPart = AbstractPart(part.filename)

        template.steps[0].csi.addPart(part)

    for abstractPart in partDict.values():
        if abstractPart.glDispID == LicGLHelpers.UNINIT_GL_DISPID:
            abstractPart.createGLDisplayList()

    for glItem in template.glItemIterator():
        if hasattr(glItem, 'createGLDisplayList'):
            glItem.createGLDisplayList()

    template.submodelPart.createGLDisplayList()
    template.submodelItem.setAbstractPart(template.submodelPart)
    template.postLoadInit(filename)
    return template
Exemplo n.º 3
0
 def changeLightValues(self, newValues):
     LicGLHelpers.setLightParameters(*newValues)
     self.update()
Exemplo n.º 4
0
 def changeLightValues(self, newValues):
     LicGLHelpers.setLightParameters(*newValues)
     self.update()