Ejemplo n.º 1
0
def getFocalParameters(lensTmp):
    # get the captor size
    fbxTmp = tde4.getLensFBackWidth(lensTmp)
    fbyTmp = tde4.getLensFBackHeight(lensTmp)

    # get lensTmp Parameters
    folcalParameter = dict()
    folcalParameter["filmW"] = fbxTmp
    folcalParameter["filmH"] = fbyTmp
    folcalParameter["focalLength"] = tde4.getLensFocalLength(lensTmp)
    folcalParameter["pixelAspect"] = tde4.getLensPixelAspect(lensTmp)  #TODO

    log.debug(folcalParameter)

    return folcalParameter
Ejemplo n.º 2
0
def getLensModelParameter(camera=None, lens=None, frame=None):
    lensModelParameter = dict()
    if frame is None and camera is None:
        # get the focusDistance
        focus = tde4.getLensFocus(lens)
        # get the focalLenght
        fotalLenght = tde4.getLensFocalLength(lens)

    else:
        # get the focusDistance
        focus = tde4.getCameraFocus(camera, frame)
        # get the focalLenght
        fotalLenght = tde4.getCameraFocalLength(camera, frame)

    model = tde4.getLensLDModel(lens)

    for parameterName in (getLDmodelParameterList(model)):
        varTemp = tde4.getLensLDAdjustableParameter(lens, parameterName,
                                                    fotalLenght, focus)
        lensModelParameter[parameterName] = varTemp

    lensModelParameter['model'] = model
    return lensModelParameter
Ejemplo n.º 3
0
def getDistorsionParametersFromLenClassic(lens, camShortName, focal_cm):
    lensInfo = TDELensInfo(lens)

    # get the focalLenght
    fotalLenght = tde4.getLensFocalLength(lens)
    # get the focusDistance
    focus = tde4.getLensFocus(lens)

    distorsionParameters = DistorsionParameters()
    distorsionParameters.Filter = 'Simon'
    distorsionParameters.tde4_focal_length_cm = repr(focal_cm)
    distorsionParameters.tde4_filmback_width_cm = repr(lensInfo.fback_w_cm)
    distorsionParameters.tde4_filmback_height_cm = repr(lensInfo.fback_h_cm)
    distorsionParameters.tde4_pixel_aspect = repr(lensInfo.p_aspect)
    paramDistortion = tde4.getLensLDAdjustableParameter(
        lens, 'Distortion', fotalLenght, focus)
    distorsionParameters.Distortion = repr(paramDistortion)
    paramASqueeze = tde4.getLensLDAdjustableParameter(lens,
                                                      'Anamorphic Squeeze',
                                                      fotalLenght, focus)
    distorsionParameters.Anamorphic_Squeeze = repr(paramASqueeze)
    paramCurvatureX = tde4.getLensLDAdjustableParameter(
        lens, 'Curvature X', fotalLenght, focus)
    distorsionParameters.Curvature_X = repr(paramCurvatureX)
    paramCurvatureY = tde4.getLensLDAdjustableParameter(
        lens, 'Curvature Y', fotalLenght, focus)
    distorsionParameters.Curvature_Y = repr(paramCurvatureY)
    paramQuarticDist = tde4.getLensLDAdjustableParameter(
        lens, 'Quartic Distortion', fotalLenght, focus)
    distorsionParameters.Quartic_Distortion = repr(paramQuarticDist)
    distorsionParameters.name = 'LD_3DE_Classic_LD_Model1_' + camShortName

    distorsionParameters.tde4_lens_center_offset_x_cm = '0'  # TODO
    distorsionParameters.tde4_lens_center_offset_y_cm = '0'  # TODO

    return distorsionParameters
tde4.setWidgetValue(req, "startframe_field", str(offset))

FootageWidth = tde4.getCameraImageWidth(cam)
FootageHeight = tde4.getCameraImageHeight(cam)

lens = tde4.getFirstLens()
CameraApertureWidth = tde4.getLensFBackWidth(lens) / 2.54
CameraApertureHeight = tde4.getLensFBackHeight(lens) / 2.54

#about lens distortion.
LensDistortionValid = False
camList = tde4.getCameraList()
for cam in camList:
    lens = tde4.getCameraLens(cam)
    for id in tde4.getLensList():
        focus = tde4.getLensFocalLength(id)
        lensmodel = tde4.getLensLDModel(id)
        focallength = tde4.getLensFocalLength(id)
        paraNumber = tde4.getLDModelNoParameters(lensmodel)
        for i in range(paraNumber):
            paraName = tde4.getLDModelParameterName(lensmodel, i)
            currentValue = tde4.getLensLDAdjustableParameter(
                id, paraName, focus, focallength)
            defaultValue = tde4.getLDModelParameterDefault(lensmodel, paraName)
            if currentValue != defaultValue:
                LensDistortionValid = True
                break

ret = tde4.postCustomRequester(req, "Export Maya (MEL-Script)...", 600, 0,
                               "Ok", "Cancel")
if ret == 1: