예제 #1
0
def InitProps():
    #Add some widgets to the OIP
    vs.vsoAddWidget(Constants.kSettingsButt, Constants.kWidgetButton,
                    vs.GetPluginString(4000))

    vs.vsoAddWidget(Constants.kGeneralSeparator, Constants.kWidgetSeparator,
                    vs.GetPluginString(4011))

    vs.vsoAddParamWidget(Constants.kParamWidget_LabelID, 'IDLabel', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_LabelID, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_Width, 'Width', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_Width, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_Height, 'Height', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_Height, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_ElvInWall, 'ElvInWall', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_ElvInWall, 1)
    ####################################
    vs.vsoAddWidget(Constants.kOpeningSeparator, Constants.kWidgetSeparator,
                    vs.GetPluginString(4012))
    ####################################
    vs.vsoAddParamWidget(Constants.kParamWidget_OpenTheWindow, 'OpenTheWindow',
                         '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_OpenTheWindow, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_OpeningAngle, 'OpeningAngle',
                         '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_OpeningAngle, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_Leaf, 'Leaf', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_Leaf, 1)
    #################################
    vs.vsoAddWidget(Constants.kCurtainsSeparator, Constants.kWidgetSeparator,
                    vs.GetPluginString(4013))
    #################################
    vs.vsoAddParamWidget(Constants.kParamWidget_HasCurts, 'HasCurts', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_HasCurts, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_LedgeType, 'LedgeType', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_LedgeType, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_LedgeMaterial, 'LedgeMaterial',
                         '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_LedgeMaterial, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_DrawTheCurts, 'DrawTheCurts',
                         '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_DrawTheCurts, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_CurtsColor, 'CurtsColor', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_CurtsColor, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_Pieces, 'Pieces', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_Pieces, 1)

    vs.vsoAddParamWidget(Constants.kParamWidget_Opacity, 'Opacity', '')
    vs.vsoWidgetSetIndLvl(Constants.kParamWidget_Opacity, 1)
예제 #2
0
def DialogHandler(item, data):
    if item == kDialogInitEvent:
        SetupDialog()

    elif item == kWidth or item == kHeight or item == kElevationInWall or item == kOpeningAngle:
        CheckData()

    elif item == kOpenTheWindow or item == kHasCurtains or item == kDrawTheCurts or item == kLeaf:
        index = vs.GetSelectedChoiceIndex(Constants.dialogId, kLeaf, 0)
        hasLeaf = not (index == 0)

        EnableItems(hasLeaf,
                    vs.GetBooleanItem(Constants.dialogId, kOpenTheWindow),
                    vs.GetBooleanItem(Constants.dialogId, kHasCurtains),
                    vs.GetBooleanItem(Constants.dialogId, kDrawTheCurts))

    elif item == kOpacitySlider:
        text = vs.GetPluginString(3054)
        text += ' ('
        text += str(data)
        text += '%): '

        vs.SetItemText(Constants.dialogId, kOpacityText, text)

    elif item == kOK:
        #The ok button of the dialog has been clicked
        OnOK()
예제 #3
0
 def __SetCurtainStyle( self ):
     isSuccessful, objName, objHand, recHand, wallHand = vs.GetCustomObjectInfo()
     if isSuccessful:
         if vs.IsNewCustomObject( objName ):
             refNum = -1
         else:
             refNum = vs.Name2Index( vs.GetRField( objHand, objName, "__CurtainTexture" ) )
         
         textureObj = Texture( vs.GetPluginString( 4020 ), refNum, self.__fColor, self.__fOpacity )
         textureIndex, textureName = textureObj.GetTexture()
             
         for pieceH in self.__fPiecesHandles:
             if pieceH:
                 vs.SetTextureRef( pieceH, textureIndex, 0 )
                 
         vs.SetRField( objHand, objName, "__CurtainTexture", textureName )
예제 #4
0
 def GetHelpStr(ndx):
     result = vs.GetPluginString( kTextStrTableID + ndx + 27 )
     return result
예제 #5
0
 def GetStr(ndx):
     result = vs.GetPluginString( kTextStrTableID + ndx - 1 )
     return result
예제 #6
0
def SetupDialog():
    for i in range(1,6):
        vs.AddChoice(Constants.dialogId,kLeaf,vs.GetPluginString(4000+i),i-1)
        
    vs.AddChoice(Constants.dialogId,kLedgeType,vs.GetPluginString(4006),0)
    vs.AddChoice(Constants.dialogId,kLedgeType,vs.GetPluginString(4007),1)
    
    vs.AddChoice(Constants.dialogId,kLedgeMaterial,vs.GetPluginString(4008),0)
    vs.AddChoice(Constants.dialogId,kLedgeMaterial,vs.GetPluginString(4009),1)
    vs.AddChoice(Constants.dialogId,kLedgeMaterial,vs.GetPluginString(4010),2)
    
    fraction, display, format, upi, name, squareName = vs.GetUnits()
    
    #######################################################
    value = vs.GetRField(Constants.h,kPluginName,'IDLabel')
    vs.SetEditInteger(Constants.dialogId, kIDLabel, vs.Str2Num(value))
    #######################################################    
    value = vs.GetRField(Constants.h,kPluginName,'Width')
    
    inches = 0
    if(format == 2 or format == 3):
         
        index = value.find("'")
        if index > -1:
            splitVal = value.split("'")
            inches += vs.Str2Num(splitVal[0])*12.0
             
            str = splitVal[1]
            index = str.find(name)
            if index > -1:
                str = str.replace(name, "")
                value = vs.Str2Num(str)
                inches += value
         
        else:
            index = value.find(name)
            if index > -1:
                value = value.replace(name,"")
                value = vs.Str2Num(value)
                inches += value
    else:
        index = value.find(name)
        if index > -1:
            value = value.replace(name, "")
            
        inches = vs.Str2Num(value)
    
    vs.SetEditReal(Constants.dialogId,kWidth,kEditRealDim,inches)
    #######################################################    
    value = vs.GetRField(Constants.h,kPluginName,'Height')
    
    inches = 0
    if(format == 2 or format == 3):
         
        index = value.find("'")
        if index > -1:
            splitVal = value.split("'")
            inches += vs.Str2Num(splitVal[0])*12.0
             
            str = splitVal[1]
            index = str.find(name)
            if index > -1:
                str = str.replace(name, "")
                value = vs.Str2Num(str)
                inches += value
         
        else:
            index = value.find(name)
            if index > -1:
                value = value.replace(name,"")
                value = vs.Str2Num(value)
                inches += value
    else:
        index = value.find(name)
        if index > -1:
            value = value.replace(name, "")
            
        inches = vs.Str2Num(value)
    
    vs.SetEditReal(Constants.dialogId,kHeight,kEditRealDim,inches)
    #######################################################    
    value = vs.GetRField(Constants.h,kPluginName,'ElvInWall')
    
    inches = 0
    if(format == 2 or format == 3):
         
        index = value.find("'")
        if index > -1:
            splitVal = value.split("'")
            inches += vs.Str2Num(splitVal[0])*12.0
             
            str = splitVal[1]
            index = str.find(name)
            if index > -1:
                str = str.replace(name, "")
                value = vs.Str2Num(str)
                inches += value
         
        else:
            index = value.find(name)
            if index > -1:
                value = value.replace(name,"")
                value = vs.Str2Num(value)
                inches += value
    else:
        index = value.find(name)
        if index > -1:
            value = value.replace(name, "")
            
        inches = vs.Str2Num(value)
    
    vs.SetEditReal(Constants.dialogId,kElevationInWall,kEditRealDim,inches)
    #######################################################    
    value = vs.GetRField(Constants.h, kPluginName, 'OpenTheWindow')
    vs.SetBooleanItem(Constants.dialogId, kOpenTheWindow   ,value =='True')
    #######################################################    
    value = vs.GetRField(Constants.h,kPluginName,'OpeningAngle')
    newNumber = vs.Str2Num(value)
    vs.SetEditReal(Constants.dialogId, kOpeningAngle, kEditRealAng,newNumber)  
    #######################################################    
    leafType = vs.GetRField(Constants.h,kPluginName,'Leaf')
    if leafType == 'None':
        vs.SelectChoice(Constants.dialogId, kLeaf, 0, True)
    elif leafType == '1(no glass)':
        vs.SelectChoice(Constants.dialogId, kLeaf, 1, True)
    elif leafType == '1(glass)':
        vs.SelectChoice(Constants.dialogId, kLeaf, 2, True)
    elif leafType == '2(no glass)':
        vs.SelectChoice(Constants.dialogId, kLeaf, 3, True)
    else:
        vs.SelectChoice(Constants.dialogId, kLeaf, 4, True)
    #######################################################        
    value = vs.GetRField(Constants.h,kPluginName,'HasCurts')
    vs.SetBooleanItem(Constants.dialogId, kHasCurtains, value =='True')
    #######################################################    
    ledgeType = vs.GetRField(Constants.h,kPluginName,'LedgeType')
    if ledgeType == 'Attach to wall':
        vs.SelectChoice(Constants.dialogId,kLedgeType,0,True)
    else:
        vs.SelectChoice(Constants.dialogId,kLedgeType,1,True)
    #######################################################              
    ledgeMaterial = vs.GetRField(Constants.h,kPluginName,'LedgeMaterial')
    if ledgeMaterial == 'Wood':
        vs.SelectChoice(Constants.dialogId,kLedgeMaterial,0,True)
    elif ledgeMaterial == 'Plastic':
        vs.SelectChoice(Constants.dialogId,kLedgeMaterial,1,True)
    else:
        vs.SelectChoice(Constants.dialogId,kLedgeMaterial,2,True)
    #######################################################        
    value = vs.GetRField(Constants.h,kPluginName,'DrawTheCurts')
    vs.SetBooleanItem(Constants.dialogId,kDrawTheCurts,value == 'True')
    #######################################################    
    colorIndex = vs.GetRField(Constants.h, kPluginName, '__CustomColor')
    vs.SetColorChoice(Constants.dialogId,kCurtsColor,vs.Str2Num(colorIndex))
    #######################################################    
    value = vs.GetRField(Constants.h,kPluginName,'Pieces')
    newNumber = vs.Str2Num(value)
    vs.SetEditInteger(Constants.dialogId, kPieces, newNumber)
    #######################################################    
    opacityText = vs.GetRField(Constants.h,kPluginName,'Opacity')
    vs.SetControlData(Constants.dialogId,kOpacitySlider,vs.Str2Num(opacityText))
    #######################################################    
    text = vs.GetPluginString(3054)
    text += ' ('
    text += opacityText
    text +='%): '
        
    vs.SetItemText(Constants.dialogId,kOpacityText,text)
    
    #######################################################
    hasCurtain = vs.GetBooleanItem(Constants.dialogId,kHasCurtains)
    drawTheCurtain = vs.GetBooleanItem(Constants.dialogId,kDrawTheCurts)
    
    index = vs.GetSelectedChoiceIndex(Constants.dialogId, kLeaf, 0)
    hasLeaf = not(index == 0)
    
    EnableItems(hasLeaf, vs.GetBooleanItem(Constants.dialogId,kOpenTheWindow), hasCurtain, drawTheCurtain)
    vs.SetSliderLiveUpdate(Constants.dialogId, kOpacitySlider, True)