@@ -58,6 +58,21 @@ def float2int( v, defaultValue = 0 ):
58
58
else :
59
59
return defaultValue
60
60
61
+ def getGroupValue ( sheet , row ):
62
+ group = XLSUtil .getCellFromColmnName ( sheet , row , "Group" )
63
+
64
+ # Since v0.0.5: Colmn "Group" check (+backward compatibility)
65
+ if ( group != None and hasattr ( group , "value" ) ):
66
+ # float to int saferty
67
+ group = float2int ( group .value ) - 1
68
+
69
+ if ( group < 0 ):
70
+ group = 0
71
+ else :
72
+ group = 0
73
+
74
+ return group
75
+
61
76
def genArticulation ( sheet ):
62
77
rowLength = sheet .nrows
63
78
@@ -67,18 +82,25 @@ def genArticulation( sheet ):
67
82
68
83
name = XLSUtil .getCellFromColmnName ( sheet , row , "Articulation" ).value .strip ()
69
84
artiType = XLSUtil .getCellFromColmnName ( sheet , row , "Articulation Type" ).value .strip ()
85
+ group = getGroupValue ( sheet , row )
70
86
87
+ # Must be required values to generate
71
88
if ( len ( name ) == 0 or len ( artiType ) == 0 ):
72
89
continue
73
90
74
- print ( "[Articulation] {name}, Type={type}" .format ( name = name , type = artiType ) )
91
+ print ( "[Articulation] {name}, Type={type}, Group={group}" .format (
92
+ name = name ,
93
+ type = artiType ,
94
+ group = group
95
+ ))
75
96
76
97
artiType = Constants .ARTICULATION_TYPE .index ( artiType ) # to integer format ( 0: Attribute 1: Direction).
77
98
78
99
ret += Template .ARTICULATION .format (
79
100
uuid1 = createUUID (),
80
101
type = artiType ,
81
- name = name
102
+ name = name ,
103
+ group = group
82
104
)
83
105
84
106
ret += Template .ARTICULATION_FOOTER
@@ -96,6 +118,7 @@ def genKeySwitch( sheet ):
96
118
name = XLSUtil .getCellFromColmnName ( sheet , row , "Name" ).value .strip ()
97
119
articulation = XLSUtil .getCellFromColmnName ( sheet , row , "Articulation" ).value .strip ()
98
120
color = XLSUtil .getCellFromColmnName ( sheet , row , "Color" ).value
121
+ group = getGroupValue ( sheet , row )
99
122
noteNo = XLSUtil .getCellFromColmnName ( sheet , row , "MIDI Note" ).value .strip ()
100
123
vel = XLSUtil .getCellFromColmnName ( sheet , row , "Velocity" ).value
101
124
ccNo = XLSUtil .getCellFromColmnName ( sheet , row , "CC No." ).value
@@ -130,7 +153,8 @@ def genKeySwitch( sheet ):
130
153
tmp = ""
131
154
tmp += Template .ARTICULATION_IN_SLOT_HEADER
132
155
tmp += Template .ARTICULATION_IN_SLOT .format (
133
- uuid1 = createUUID (), name = articulation
156
+ uuid1 = createUUID (), name = articulation ,
157
+ group = group
134
158
)
135
159
tmp += Template .ARTICULATION_IN_SLOT_FOOTER
136
160
articulation = tmp
0 commit comments