Exemplo n.º 1
0
def createDirectlight():

    direcLight_nameGrp = 'directLight_Grp'

    if cmds.objExists('directLight'):
        cmds.delete('directLight')

    if not cmds.objExists(direcLight_nameGrp):
        direcLight_nameGrp  = cmds.group(empty=True, name=direcLight_nameGrp)

    create_DirectLight      = cmds.CreateDirectionalLight()
    directLight_new_Name    = cmds.rename(create_DirectLight, 'directLight')
    directLight_Shape       = cmds.listRelatives(directLight_new_Name, shapes=True)
    direcLight_Parent       = cmds.listRelatives(directLight_Shape, parent=True)

    if not direcLight_Parent == direcLight_nameGrp:
        cmds.parent(direcLight_Parent, direcLight_nameGrp)

    cmds.setAttr(directLight_Shape[0] + '.shadowColor', 1, 1, 1, type='double3')
    cmds.setAttr(directLight_Shape[0] + '.intensity', 0.6)
    cmds.xform(directLight_new_Name, rotation=[30, -30, -90])

    return direcLight_nameGrp
Exemplo n.º 2
0
def setSun():
    cmds.CreateDirectionalLight()
    sun = 'directionalLight1'
    cmds.setAttr( sun + '.rotateX', -40 )
Exemplo n.º 3
0
    def createUI(self):
        cmds.scrollLayout(childResizable=True, minChildWidth=800)

        cmds.columnLayout(adjustableColumn=True,
                          columnAlign="right",
                          rowSpacing=10)

        cmds.rowLayout(numberOfColumns=9,
                       columnAttach=[(1, 'both', 10), (2, 'both', 5),
                                     (3, 'both', 5), (4, 'both', 5),
                                     (5, 'both', 5), (6, 'both', 5),
                                     (7, 'both', 5), (8, 'both', 5),
                                     (9, 'both', 5)])
        cmds.text(label='Create Light:')
        selectCommand = 'import maya.cmds as cmds\ncmds.select(\'' + 'directionalLightShape1' + '\')'
        cmds.nodeIconButton(
            style='iconOnly',
            command=lambda *args: cmds.CreateDirectionalLight(),
            image1='directionallight.png')
        cmds.nodeIconButton(style='iconOnly',
                            command=lambda *args: cmds.CreatePointLight(),
                            image1='pointlight.png')
        cmds.nodeIconButton(style='iconOnly',
                            command=lambda *args: cmds.CreateSpotLight(),
                            image1='spotlight.png')
        cmds.nodeIconButton(style='iconOnly',
                            command=lambda *args: cmds.CreateAreaLight(),
                            image1='arealight.png')
        cmds.nodeIconButton(style='iconOnly',
                            command=lambda *args: mutils.createLocator(
                                'aiAreaLight', asLight=True),
                            image1='AreaLightShelf.png')
        cmds.nodeIconButton(style='iconOnly',
                            command=lambda *args: mutils.createLocator(
                                'aiSkyDomeLight', asLight=True),
                            image1='SkydomeLightShelf.png')
        cmds.nodeIconButton(style='iconOnly',
                            command=lambda *args: mutils.createLocator(
                                'aiPhotometricLight', asLight=True),
                            image1='PhotometricLightShelf.png')
        cmds.nodeIconButton(style='iconOnly',
                            command=lambda *args: self.doCreateMeshLight(),
                            image1='MeshLightShelf.png')
        cmds.setParent('..')
        cmds.separator()
        cmds.setParent('..')

        cmds.columnLayout(adjustableColumn=True,
                          columnAlign="right",
                          rowSpacing=10)

        cmds.rowLayout(numberOfColumns=6,
                       adjustableColumn=2,
                       columnWidth6=[50, 160, 160, 180, 180, 110],
                       columnAttach=[(1, 'both', 5), (2, 'both', 5),
                                     (3, 'both', 5), (4, 'both', 5),
                                     (5, 'both', 5), (6, 'both', -5)])
        cmds.text(label='Select')
        cmds.text(label='Light Name')
        cmds.text(label='Color')
        cmds.text(label='Intensity')
        cmds.text(label='Exposure')
        cmds.rowLayout(numberOfColumns=2,
                       columnWidth2=[60, 50],
                       columnAttach=[(1, 'both', 0), (2, 'both', 5)])
        cmds.text(label='Samples')
        cmds.text(label='Enable')
        cmds.setParent('..')

        cmds.setParent('..')
        cmds.separator()
        cmds.setParent('..')

        self.column = cmds.columnLayout(adjustableColumn=True,
                                        columnAlign="right",
                                        rowSpacing=10)

        self.refreshControls()
        '''for element in self.listElements:
Exemplo n.º 4
0
def createArnoldMenu():
    # Add an Arnold menu in Maya main window
    if not pm.about(b=1):
        pm.menu('ArnoldMenu',
                label='Arnold',
                parent='MayaWindow',
                tearOff=True)

        pm.menuItem('ArnoldStandIn',
                    label='StandIn',
                    parent='ArnoldMenu',
                    subMenu=True,
                    tearOff=True)
        pm.menuItem('ArnoldCreateStandIn',
                    parent='ArnoldStandIn',
                    label="Create",
                    c=lambda *args: createStandIn())
        pm.menuItem('ArnoldCreateStandInFile',
                    parent='ArnoldStandIn',
                    optionBox=True,
                    c=lambda *args: doCreateStandInFile())
        pm.menuItem('ArnoldExportStandIn',
                    parent='ArnoldStandIn',
                    label='Export',
                    c=lambda *args: doExportStandin())
        pm.menuItem('ArnoldExportOptionsStandIn',
                    parent='ArnoldStandIn',
                    optionBox=True,
                    c=lambda *args: doExportOptionsStandin())

        pm.menuItem('ArnoldLights',
                    label='Lights',
                    parent='ArnoldMenu',
                    subMenu=True,
                    tearOff=True)

        pm.menuItem(
            'ArnoldAreaLights',
            parent='ArnoldLights',
            label="Area Light",
            c=lambda *args: mutils.createLocator('aiAreaLight', asLight=True))
        pm.menuItem('SkydomeLight',
                    parent='ArnoldLights',
                    label="Skydome Light",
                    c=lambda *args: mutils.createLocator('aiSkyDomeLight',
                                                         asLight=True))
        pm.menuItem('ArnoldMeshLight',
                    parent='ArnoldLights',
                    label='Mesh Light',
                    c=lambda *args: doCreateMeshLight())
        pm.menuItem('PhotometricLights',
                    parent='ArnoldLights',
                    label="Photometric Light",
                    c=lambda *args: mutils.createLocator('aiPhotometricLight',
                                                         asLight=True))

        pm.menuItem(parent='ArnoldLights', divider=True)

        pm.menuItem('MayaDirectionalLight',
                    parent='ArnoldLights',
                    label="Maya Directional Light",
                    c=lambda *args: cmds.CreateDirectionalLight())
        pm.menuItem('MayaPointLight',
                    parent='ArnoldLights',
                    label="Maya Point Light",
                    c=lambda *args: cmds.CreatePointLight())
        pm.menuItem('MayaSpotLight',
                    parent='ArnoldLights',
                    label="Maya Spot Light",
                    c=lambda *args: cmds.CreateSpotLight())
        pm.menuItem('MayaQuadLight',
                    parent='ArnoldLights',
                    label="Maya Quad Light",
                    c=lambda *args: cmds.CreateAreaLight())

        pm.menuItem('ArnoldVolume',
                    label='Volume',
                    parent='ArnoldMenu',
                    c=lambda *args: createVolume())

        pm.menuItem('ArnoldFlush',
                    label='Flush Caches',
                    parent='ArnoldMenu',
                    subMenu=True,
                    tearOff=True)
        pm.menuItem('ArnoldFlushTexture',
                    parent='ArnoldFlush',
                    label="Textures",
                    c=lambda *args: cmds.arnoldFlushCache(textures=True))
        pm.menuItem('ArnoldFlushBackground',
                    parent='ArnoldFlush',
                    label="Skydome Lights",
                    c=lambda *args: cmds.arnoldFlushCache(skydome=True))
        pm.menuItem('ArnoldFlushQuads',
                    parent='ArnoldFlush',
                    label="Quad Lights",
                    c=lambda *args: cmds.arnoldFlushCache(quads=True))
        pm.menuItem('ArnoldFlushAll',
                    parent='ArnoldFlush',
                    label="All",
                    c=lambda *args: cmds.arnoldFlushCache(flushall=True))

        pm.menuItem('ArnoldUtilities',
                    label='Utilities',
                    parent='ArnoldMenu',
                    subMenu=True,
                    tearOff=True)
        pm.menuItem('ArnoldBakeGeo',
                    label='Bake Selected Geometry',
                    parent='ArnoldUtilities',
                    c=lambda *args: arnoldBakeGeo())
        pm.menuItem('ArnoldRenderToTexture',
                    label='Render Selection To Texture',
                    parent='ArnoldUtilities',
                    c=lambda *args: arnoldRenderToTexture())
        pm.menuItem('ArnoldTxManager',
                    label='Tx Manager',
                    parent='ArnoldUtilities',
                    c=lambda *args: arnoldTxManager())
        pm.menuItem('ArnoldLightManager',
                    label='Light Manager',
                    parent='ArnoldUtilities',
                    c=lambda *args: arnoldLightManager())

        pm.menuItem('ArnoldHelpMenu',
                    label='Help',
                    parent='ArnoldMenu',
                    subMenu=True,
                    tearOff=True)

        pm.menuItem(
            'ArnoldUserGuide',
            label='User Guide',
            parent='ArnoldHelpMenu',
            c=lambda *args: cmds.launch(
                webPage=
                'https://support.solidangle.com/display/AFMUG/Arnold+for+Maya+User+Guide'
            ))

        pm.menuItem(
            'ArnoldTutorials',
            label='Tutorials',
            parent='ArnoldHelpMenu',
            c=lambda *args: cmds.launch(
                webPage=
                'https://support.solidangle.com/display/mayatut/Arnold+for+Maya+Tutorials'
            ))

        pm.menuItem(
            'ArnoldVideos',
            label='Videos',
            parent='ArnoldHelpMenu',
            c=lambda *args: cmds.launch(
                webPage=
                'https://support.solidangle.com/display/AFMV/Arnold+for+Maya+Videos'
            ))

        pm.menuItem(divider=1, parent='ArnoldHelpMenu')

        pm.menuItem(
            'ArnoldSolidAngle',
            label='Solid Angle',
            parent='ArnoldHelpMenu',
            c=lambda *args: cmds.launch(webPage='https://www.solidangle.com'))

        pm.menuItem('ArnoldMailingLists',
                    label='Mailing Lists',
                    parent='ArnoldHelpMenu',
                    c=lambda *args: cmds.launch(
                        webPage='https://subscribe.solidangle.com'))

        pm.menuItem(
            'ArnoldAsk',
            label='Knowledge Base',
            parent='ArnoldHelpMenu',
            c=lambda *args: cmds.launch(webPage='https://ask.solidangle.com'))

        pm.menuItem('ArnoldSupportBlog',
                    label='Support Blog',
                    parent='ArnoldHelpMenu',
                    c=lambda *args: cmds.launch(
                        webPage='https://support.solidangle.com/blog/arnsupp'))

        pm.menuItem('ArnoldLicensing',
                    label='Licensing',
                    parent='ArnoldHelpMenu',
                    c=lambda *args: arnoldLicenseDialog())

        pm.menuItem(divider=1, parent='ArnoldHelpMenu')

        pm.menuItem(
            'ArnoldDeveloperGuide',
            label='Developer Guide',
            parent='ArnoldHelpMenu',
            c=lambda *args: cmds.launch(
                webPage=
                'https://support.solidangle.com/display/ARP/Arnoldpedia'))

        pm.menuItem('ArnoldExperimentalMenu',
                    label='Experimental',
                    parent='ArnoldMenu',
                    subMenu=True,
                    tearOff=True)

        pm.menuItem('ArnoldRender',
                    label='External RenderView',
                    parent='ArnoldExperimentalMenu',
                    subMenu=True,
                    tearOff=True)
        pm.menuItem('ArnoldSelectCamera',
                    label='Select Camera',
                    parent='ArnoldRender',
                    subMenu=True,
                    tearOff=False,
                    postMenuCommand=lambda *args: populateSelectCamera())
        populateSelectCamera()
        pm.menuItem('ArnoldStartRender',
                    label='Render',
                    parent='ArnoldRender',
                    c=lambda *args: startRender())
        pm.menuItem('ArnoldStartIPR',
                    label='IPR',
                    parent='ArnoldRender',
                    c=lambda *args: startIpr())
        pm.menuItem('ArnoldRefresh',
                    label='Refresh',
                    parent='ArnoldRender',
                    c=lambda *args: refreshRender())
        pm.menuItem('ArnoldStopRender',
                    label='Stop Render',
                    parent='ArnoldRender',
                    c=lambda *args: stopRender())

        pm.menuItem('ArnoldAbout',
                    label='About',
                    parent='ArnoldMenu',
                    c=lambda *args: arnoldAboutDialog())
Exemplo n.º 5
0
def _CleanUp(lightName, lightType, lightT, lightR, lightS, lightLinked):
    if cmds.objExists('LIGHTS_hrc') != True:
        cmds.group(name='LIGHTS_hrc', empty=True)

    if cmds.objExists(lightName):
        if cmds.objectType(lightName) == lightType:
            lightSucced = 1
            newLight = cmds.listRelatives(lightName, parent=True)[0]
        else:
            lightSucced = 0
            print "%s is not %s type of light, so information wont transfer" % (
                lightName, lightType)
    else:
        lightSucced = 1
        if lightType == 'ambientLight':
            cmds.rename(
                cmds.CreateAmbientLight(1, 0.45, 1, 1, 1, "0", 0, 0, 0, "1"),
                lightName)
            newLight = cmds.rename(lightName, lightName.replace('Shape', ''))
            cmds.rename(
                cmds.listRelatives(newLight, children=True)[0], lightName)
        elif lightType == 'directionalLight':
            cmds.rename(
                cmds.CreateDirectionalLight(1, 1, 1, 1, "0", 0, 0, 0, 0),
                lightName)
            newLight = cmds.rename(lightName, lightName.replace('Shape', ''))
            cmds.rename(
                cmds.listRelatives(newLight, children=True)[0], lightName)
        elif lightType == 'pointLight':
            cmds.rename(cmds.CreatePointLight(1, 1, 1, 1, 0, 0, 0, 0, 0, 1),
                        lightName)
            newLight = cmds.rename(lightName, lightName.replace('Shape', ''))
            cmds.rename(
                cmds.listRelatives(newLight, children=True)[0], lightName)
        elif lightType == 'spotLight':
            cmds.rename(
                cmds.CreateSpotLight(1, 1, 1, 1, 0, 40, 0, 0, 0, 0, 0, 0, 1,
                                     0), lightName)
            newLight = cmds.rename(lightName, lightName.replace('Shape', ''))
            cmds.rename(
                cmds.listRelatives(newLight, children=True)[0], lightName)
        elif lightType == 'areaLight':
            cmds.rename(cmds.CreateAreaLight(1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0),
                        lightName)
            newLight = cmds.rename(lightName, lightName.replace('Shape', ''))
            cmds.rename(
                cmds.listRelatives(newLight, children=True)[0], lightName)
        elif lightType == 'volumeLight':
            cmds.rename(cmds.CreateVolumeLight(1, 1, 1, 1, 0, 0, 0, 0, 0, 1),
                        lightName)
            newLight = cmds.rename(lightName, lightName.replace('Shape', ''))
            cmds.rename(
                cmds.listRelatives(newLight, children=True)[0], lightName)


#         newLight = cmds.createNode(lightType)
#         newLight = cmds.rename(newLight,lightName)
#         newLight = cmds.rename(cmds.listRelatives(newLight, parent=True)[0],lightName.replace('Shape',''))

    cmds.xform(newLight, translation=lightT, rotation=lightR, scale=lightS)

    if cmds.listRelatives(
            'LIGHTS_hrc',
            children=True) == None or newLight not in cmds.listRelatives(
                'LIGHTS_hrc', children=True):
        cmds.parent(newLight, 'LIGHTS_hrc')

    everything = cmds.ls()
    cmds.lightlink(b=True, light=lightName, object=everything)
    if lightLinked != "":
        for eachAsset in lightLinked:
            try:
                #             time.sleep(1)
                cmds.lightlink(light=lightName, object=eachAsset)
            except:
                #                 print eachAsset
                pass
    return lightSucced