View difference between Paste ID: yR5PXwG3 and iY7Dv6v5
SHOW: | | - or go back to the newest paste.
1-
#### 1st Script 
1+
#### 1st Script
2
import maya.cmds as cmds
3
import sys
4
 
5
sys.path.append(('D:/Scripts/maya/scripts/Daz_Toolkit/Fin'))
6
sys.path.append(('D:/Scripts/maya/scripts/Daz_Toolkit/Fin/Modules'))
7
syspaths = sys.path
8
9-
import DazManager
9+
## Modules should be lower case name for clarity
10-
reload(DazManager)
10+
import dazManager
11
reload(dazManager)
12-
from DazManager import *
12+
 
13
from dazManager import *
14
start()
15
 
16
#### 2nd Script
17-
import LightEditor
17+
# dazManager.py
18-
reload(LightEditor)
18+
19
## the functools.partial function is used for created 
20-
from LightEditor import *
20+
## closure callbacks from a callable and some arguments
21
from functools import partial 
22
23
## Modules should be lower case name for clarity
24-
	def LIT_Value(Slider,Attribute,a,b):
24+
import lightEditor
25-
		LightEditor.LIT_Value(Slider,Attribute,a,b)	
25+
reload(lightEditor)
26
 
27
 
28-
	if cmds.window('DM Tools', exists=True):
28+
29-
		cmds.deleteUI('DM Tools')
29+
    if cmds.window('DM Tools', exists=True):
30-
	if cmds.dockControl('DMTOOLSDock', exists=True):
30+
            cmds.deleteUI('DM Tools')
31-
		cmds.deleteUI('DMTOOLSDock')
31+
32-
	VrayWindow = cmds.window('DM Tools', title='Daz Tools v0.1')
32+
    if cmds.dockControl('DMTOOLSDock', exists=True):
33-
	BaseLayout = cmds.scrollLayout( 'scrollLayout',w=300,h=500)
33+
            cmds.deleteUI('DMTOOLSDock')
34-
	allowedAreas = ['right', 'left']
34+
35-
	vrayDock = cmds.dockControl('DMTOOLSDock', l='Daz Tools v0.1', area='left', content=VrayWindow, allowedArea=allowedAreas,floating=1)
35+
    ## local variables and attributes should be lower case
36-
	cmds.setParent(BaseLayout)
36+
    vrayWindow = cmds.window('DM Tools', title='Daz Tools v0.1')
37-
	tabs = cmds.tabLayout()
37+
    baseLayout = cmds.scrollLayout( 'scrollLayout',w=300,h=500)
38-
	child1 = cmds.rowColumnLayout("Lights",numberOfColumns=2, columnWidth=[(1, 100), (2, 150)])
38+
    allowedAreas = ['right', 'left']
39-
	cmds.radioCollection()
39+
    vrayDock = cmds.dockControl('DMTOOLSDock', l='Daz Tools v0.1', area='left', 
40-
	lightsAll=cmds.radioButton( label='All Lights')
40+
                                content=vrayWindow, allowedArea=allowedAreas, floating=1)
41-
	lightsSel=cmds.radioButton( label='Selected Lights')
41+
    cmds.setParent(baseLayout)
42-
	cmds.text("Intentisy Multiplier",align='right')
42+
    tabs = cmds.tabLayout()
43-
	LITIntensityMultiplier=cmds.floatSliderGrp(field=True,cc='LIT_Value(LITIntensityMultiplier,"intensityMult",lightsAll,lightsSel)',dc='LIT_Value(LITIntensityMultiplier,"intensityMult",lightsAll,lightsSel)',maxValue=1000,pre=2,cw2=(60,20))
43+
    child1 = cmds.rowColumnLayout("Lights", numberOfColumns=2, columnWidth=[(1, 100), (2, 150)])
44
    cmds.radioCollection()
45
    lightsAll = cmds.radioButton( label='All Lights')
46
    lightsSel = cmds.radioButton( label='Selected Lights')
47
    cmds.text("Intentisy Multiplier", align='right')
48
49-
def LIT_Value(Slider,Attribute,a,b):
49+
    # first create our control so that we have a valid path back to it.
50-
	rb0 =  cmds.radioButton(a,q = True,sl=1)
50+
    litIntensityMultiplier = cmds.floatSliderGrp(field=True, maxValue=1000, pre=2, cw2=(60,20))
51-
	rb1 =  cmds.radioButton(b,q = True,sl=1)
51+
52-
	if rb0==True:
52+
    # Use partial to create a callback on the float slider
53-
		print "True"
53+
    cbk = partial(lightEditor.lit_value, litIntensityMultiplier, "intensityMult", lightsAll, lightsSel)
54-
	if rb1==True:
54+
    cmds.floatSliderGrp(litIntensityMultiplier, e=True, cc=cbk, dc=cbk)     
55-
		print "False"
55+
56
57
#### 3rd Script
58
# lightEditor.py
59
60
# lower case function names
61
# use *args at the end to catch all remaining args that 
62
# Maya throws at us.
63
def lit_value(slider, attribute, a, b, *args):
64
    rb0 = cmds.radioButton(a, q=True, sl=1)
65
    rb1 = cmds.radioButton(b, q=True, sl=1)
66
    # Truth test a boolean by just "if foo" 
67
    # instead of directly testing equality
68
    # against True or False
69
    if rb0:
70
        print "True"
71
    if rb1:
72
        print "False"