それは私のスクリプトです:
import maya.cmds as cmds
def changeLightIntensity(percentage=1.0):
"""
Changes the intensity of each light the scene by percentage.
Parameters:
percentage - Percentage to change each light's intensity. Default value is 1.
Returns:
Nothing.
"""
#The is command is the list command. It is used to list various nodes
#in the current scene. You can also use it to list selected nodes.
lightInScene = cmds.ls(type='light')
#If there are no lights in the scene, there is no point running this script
if not lightInScene:
raise RunTimeError, 'There are no lights in the scene!'
#Loop through each light
for light in lightInScene:
#The getAttr command is used to get attribute values of a node
currentIntensity = cmds.getAttr('%s.intensity' % light)
#Calculate a new intensity
newIntensity = currentIntensity * percentage
#Change the lights intensity to the new intensity
cmds.setAttr('%s.intensity' % light, newIntensity)
#Report to the user what we just did
print 'Changed the intensity of light %s from %.3f to %.3f' % (light, currentIntensity, newIntensity)
import samples.lightIntensity as lightIntensity
lightIntensity.changelightIntensity(1.2)
私のエラー:
ImportError: samples.lightIntensity という名前のモジュールがありません
どうしたの?私はこれを行うことができますか?解決策は何ですか?
ありがとう!