This repository was archived by the owner on Apr 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMacro_LightList.mcr
1439 lines (1109 loc) · 67 KB
/
Macro_LightList.mcr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- VRay Extended Light Lister
-- Modified from the original 3DSMax Light Lister by Anthony McLin
-- http://www.anthonymclin.com
-- version 1.5
-- August 13, 2007
-- Added checkbox for Affect Reflections for VRay Lights
-- Added checkbox for Shadows for VRay Lights
-- Requires VRay 1.5 Final Release
-- version 1.4
-- February 27, 2007
-- Added support for Vray Sun invisibility - this requires VRay 1.5rc3 or later
-- Verified compatibility with Max 9 32bit and 64bit
-- version 1.3
-- September 1, 2006
-- Condensed Layout for more efficiency
-- Add support for Subdivisions and Shadow Bias for VRay Lights
-- version 1.2
-- August 25, 2006
-- Added support for Units Type for VRay Lights
-- version 1.1
-- August 24, 2006
-- Added checkboxes for Affect Diffuse and Affect Specular for VRay Lights
-- Removed checkbox for Smooth Shadows for VRay Lights since that feature has been dropped
-- Version 1.0
-- August 23, 2006
-- Initial support added for VRay Lights and VRay Sun now that Vray 1.5 is out
-- MODIFIED BY MARC LORENZ, Jan 02 2004
-- plugins@angstraum.at, http://plugins.angstraum.at
--
-- ADDED VRAY LIGHTS AND SHADOWS
-- UNSUPPORTED, USE AT YOUR OWN RISK!!
-- MacroScript File
-- Created: Jan 15 2002
-- Last Modified: June 27 2003
-- Light Lister Script 2.5
-- Version: 3ds max 5
-- Author: Alexander Esppeschit Bicalho [discreet]
--***********************************************************************************************
-- MODIFY THIS AT YOUR OWN RISK
/* History
- Added Support to Mental Ray Lights and Plugin Script lights - this uses 4 functions to manage Delegate properties
- Added Support to Blur_Adv. Shadows and mental Ray shadows
- Enabled Luminaire support
- Enabled Deletion Callback
- Removed Blur Adv. Shadows from the UI (they're still in the Engine) since PF's spec calls for that
- Fixed divide by 0 on adding mr lights to the list
- Fixed an incorrect try/catch loop that would crash the script when radiosity was present
- Fixed crash on Refresh after deleting light - LLister.UIControlList not reset, contained deleted node (LAM)
*/
/*
macros.run "Lights and Cameras" "Light_list"
This Light Lister supports all new lights in 3ds max 5:
- Photometric Lights
- Skylights
- IES Sun
It also supports the new shadows types:
- Area Shadows
- Adv. Raytraced shadows
*/
/* Expanding the Light Lister -- AB Jun 20, 2002
This Light Lister does not automatically support new light or shadow plugins.
For them to be supported, you need to make several changes in the script:
-- Class Definitions
Here the classes for each light types are defined. If you want to add a new light type, add a new class entry and list the
classes in the array
In the end of the script, each class definition is scanned and generates the UI entries.
You'll also need to change the script to parse and collect all instances of your class, as is done with the current code.
-- Properties
The function CreateControls generates the dynamic rollout containing all spinners, properties, etc.
The controls are grouped by light type and handle special cases like different parameter names for MAX lights and Photometric
lights. The On/Off checkbox is an example of how to handle a control that is tied to a property in a scene light.
In the example below, ControlName is the control name and Property is the property you want to expose/access.
LLister.maxLightsRC.addControl #checkbox (("ControlName" + LLister.count as string) as name) "" \
paramStr:("checked:" + (LLister.LightIndex[LLister.count][1].Property as string) + " offset:[8,-22] width:18")
LLister.maxLightsRC.addHandler (("ControlName" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].Property = state")
Notice the controls are all aligned using Offset. If you add a new control, you need to reorganize the remaining controls.
-- Exposing Shadow Plugins
Shadow plugins are harder to expose because each shadow has a different set of parameters, or even different parameter
names. The framework to expose them is similar to the one to expose the properties, but you need to create special cases
for each shadowplugin or each property.
For instance, if your shadow plugin class is myShadow and it exposes a Bias Property called myShadowBias, you'll need to
change the Bias Control and the Shadow Dropdown. In the Bias Control, you need to read the Bias value, and change the
event so it checks for the correct class and sets the property.
In the Shadow Dropdown event, you need to set the control state and value acording to the shadow class.
In any case, make sure you keep a copy of the original Light Lister so you can come back to it in case you have problems
*/
macroScript Light_List
category:"Lights and Cameras"
internalcategory:"Lights and Cameras"
ButtonText:"Light Lister..."
tooltip:"Light Lister Tool"
Icon:#("Lights",7)
SilentErrors:(Debug != True)
(
struct LightListerStruct (GlobalLightParameters, LightInspectorSetup, LightInspectorFloater, LightInspectorListRollout, ShadowPlugins, \
ShadowPluginsName, VRayLightsList, VRaySunsList, maxLightsList, LSLightsList, SkyLightsList, SunLightsList, enableUIElements, \
LuminairesList, maxLightsRC, CreateLightRollout, UIControlList, DeleteCallback, disableUIElements,\
LightInspectorListRollout, LLUndoStr, count, lbcount, lightIndex, decayStrings, VRayLightUnitStrings, totalLightCount, \
miLightsList, getLightProp, setLightProp, setShdProp, getShdProp, fnShadowClass)
global LLister
if LLister == undefined or debug == true do LLister = LightListerStruct()
-- Strings for Localization
LLister.decayStrings = #("None","Inverse","Inv. Square")
LLister.VRayLightUnitStrings = #("Default (image)", "Luminous power (lm)", "Luminance (lm/m²/sr)", "Radiant power (W)", "Radiance (W/m²/sr)")
LLister.LLUndoStr = "LightLister"
-- End Strings
-- Useful Functions
fn subtractFromArray myArray mySub =
(
tmpArray = #()
for i in myArray do append tmpArray i
for i in mySub do (
itemNo = finditem tmpArray i
local newArray = #()
if itemNo != 0 do
(
for j in 1 to (itemNo-1) do append newArray tmpArray[j]
for j in (itemNo+1) to tmpArray.count do append newArray tmpArray[j]
tmpArray = newArray
)
)
tmpArray
)
fn SortNodeArrayByName myArray =
(
qsort myArray (fn myname v1 v2 = (if v1.name < v2.name then 0 else 1))
myArray
)
fn copyArray array1 = for i in array1 collect i
fn disableUIElements array1 = for i in array1 do execute ("maxLightsRollout." + i as string + ".enabled = false")
LLister.disableUIElements = disableUIElements
fn getLightProp obj prop =
(
if (isProperty obj prop) and not (isProperty obj #delegate) then
getProperty obj prop
else
if isProperty obj #delegate then
if isProperty obj.delegate prop then
getProperty obj.delegate prop
else undefined
else undefined
)
LLister.getLightProp = getLightProp
fn setLightProp obj prop val =
(
if (isProperty obj prop) and not (isProperty obj #delegate) then
setProperty obj prop val
else
if isProperty obj #delegate then
if isProperty obj.delegate prop then
setProperty obj.delegate prop val
else undefined
else undefined
)
LLister.setLightProp = setLightProp
fn getShdProp obj prop =
(
if (isProperty obj #shadowGenerator) and not (isProperty obj #delegate) then
if (isProperty obj.ShadowGenerator prop) do getProperty obj.ShadowGenerator prop
else
if isProperty obj #delegate then
if isProperty obj.delegate #ShadowGenerator then
if (isProperty obj.delegate.ShadowGenerator prop) do getProperty obj.delegate.ShadowGenerator prop
else undefined
else undefined
)
LLister.getShdProp = getShdProp
fn setShdProp obj prop val =
(
if (isProperty obj #shadowGenerator) and not (isProperty obj #delegate) then
if (isProperty obj.ShadowGenerator prop) do setProperty obj.ShadowGenerator prop val
else
if isProperty obj #delegate then
if isProperty obj.delegate #ShadowGenerator then
if (isProperty obj.delegate.ShadowGenerator prop) do setProperty obj.delegate.ShadowGenerator prop val
else undefined
else undefined
)
LLister.setShdProp = setShdProp
fn fnShadowClass obj = classof (LLister.getLightProp obj #shadowGenerator)
LLister.fnShadowClass = fnShadowClass
-- Collect Shadow Plugins
/* -- Removed Automatic Shadow Plugin Collection
LLister.ShadowPlugins = (subtractFromArray shadow.classes #(Missing_Shadow_Type))
qSort LLister.ShadowPlugins (fn namesort v1 v2 = if ((v1 as string)as name) > ((v2 as string)as name) then 1 else 0)
LLister.ShadowPluginsName = for i in LLister.ShadowPlugins collect i as string
*/
-- Hardcoded shadow plugins to the ones available
LLister.ShadowPlugins = #(Adv__Ray_Traced, mental_ray_Shadow_Map, Area_Shadows, shadowMap, raytraceShadow, VRayShadow)
LLister.ShadowPluginsName = #("Adv. Ray Traced", "mental_ray_Shadow_Map", "Area Shadows", "Shadow Map", "Raytrace Shadow", "VRayShadow")
/* -- uncomment if you want the Blur Shadows
LLister.ShadowPlugins = #(Adv__Ray_Traced, mental_ray_Shadow_Map, Area_Shadows, Blur_Adv__Ray_Traced, shadowMap, raytraceShadow)
LLister.ShadowPluginsName = #("Adv. Ray Traced", "mental_ray_Shadow_Map", "Area Shadows", "Blur Adv. Ray Traced","Shadow Map", "Raytrace Shadow")
*/
-- Main Function
local CreateLightRollout
fn createLightRollout myCollection selectionOnly:false =
(
LLister.LightInspectorSetup.pbar.visible = true
-- Class Definitions
maxLights = #(#TargetDirectionallight, #targetSpot, #Directionallight, #Omnilight, #freeSpot)
SkyLights = #(#IES_Sky, #Texture_Sky, #Skylight)
SunLights = #(#IES_Sun) -- AB: Jun 20, 2002
LSLights = #(#Free_Area, #Target_Area, #Free_Linear, #Free_Point, #Target_Point, #Target_Linear)
Luminaires = #(#Luminaire)
mrLights = #(#miAreaLight, #miAreaLightomni)
VRayLights = #(#VRayLight)
VRaySuns = #(#VRaySun)
-- Scene parser
SceneLights = MyCollection as array
sceneMaxLights = #()
sceneLSLights = #()
sceneSkyLights = #()
sceneSunLights = #()
sceneLuminaires = #()
scenemiLights = #()
sceneVRayLights = #()
sceneVRaySuns = #()
for i in SceneLights do
(
LightClass = ((classof i) as string) as name
if findItem MaxLights LightClass != 0 do append sceneMaxLights i
if findItem LSLights LightClass != 0 do append sceneLSLights i
if findItem SkyLights LightClass != 0 do append sceneSkyLights i
if findItem SunLights LightClass != 0 do append sceneSunLights i
if findItem Luminaires LightClass != 0 do append sceneLuminaires i
if findItem mrLights LightClass != 0 do append scenemiLights i
if findItem VRayLights LightClass != 0 do append sceneVRayLights i
if findItem VRaySuns LightClass != 0 do append sceneVRaySuns i
)
-- Collect Light Instances and build array to be displayed
tmpParser = #( \
tmpsceneMaxLights = copyArray sceneMaxLights, \
tmpscenemiLights = copyArray scenemiLights, \
tmpsceneLSLights = copyArray sceneLSLights, \
tmpsceneSkyLights = copyArray sceneSkyLights, \
tmpsceneSunLights = copyArray sceneSunLights, \
tmpsceneLuminaires = copyArray sceneLuminaires, \
tmpsceneVRayLights = copyArray sceneVRayLights, \
tmpsceneVRaySuns = copyArray sceneVRaySuns
)
ListParser = #( \
LLister.maxLightsList = #(), \
LLister.miLightsList = #(), \
LLister.LSLightsList = #(), \
LLister.SkyLightsList = #(), \
LLister.SunLightsList = #(), \
LLister.LuminairesList = #(), \
LLister.VRayLightsList = #(), \
LLister.VRaySunsList = #()
)
for i in 1 to tmpParser.count do
(
while tmpParser[i].count > 0 do
(
tmpNode = tmpParser[i][1].baseObject
depends = refs.dependents tmpNode
discard = #()
for k in depends do if (superclassof k != light and superclassof k != helper) do append discard k
for k in depends do
try
(
if classof k == DaylightAssemblyHead or classof k == ParamBlock2ParamBlock2 then
append discard k
else
if k.AssemblyMember and not k.AssemblyHead and classof k.parent != DaylightAssemblyHead do append discard k
)
catch()
depends2 = subtractFromArray depends discard
depends = SortNodeArrayByName depends2
if depends.count > 0 do append listParser[i] depends
tmpParser[i] = subtractFromArray tmpParser[i] (discard + depends)
)
)
LLister.totalLightCount = LLister.maxLightsList.count + \
LLister.LSLightsList.count + \
LLister.SkyLightsList.count + \
LLister.SunLightsList.count + \
LLister.LuminairesList.count + \
LLister.VRayLightsList.count + \
LLister.VRaySunsList.count + \
LLister.miLightsList.count
-- build controls and rollouts
-- MAX Lights
/*
Rollout Creator Example...
rci = rolloutCreator "myRollout" "My Rollout"
rci.begin()
rci.addControl #button #myButton "My Button" paramStr:"Height:60 width:70"
rci.addHandler #myButton #pressed filter:on codeStr:"MessageBox @Isn't this cool@ title:@Wow@"
createDialog (rci.end())
*/
LLister.maxLightsRC = rolloutCreator "maxLightsRollout" "Lights" -- Localize the 2nd string only
LLister.maxLightsRC.begin()
-- print LLister.maxLightsRC.str.count
LLister.maxLightsRC.addText "fn clearCheckButtons = for i in LLister.LightInspectorListRollout.controls do if classof i == checkButtonControl do if i.checked do i.checked = false\n"
LLister.count = 1
LLister.lbCount = 1
LLister.LightIndex = #()
LLister.UIControlList = #(#(),#())
fn WriteTitle hasShadow:true hasDecay:false hasSize:false hasColor:true isLuminaire:false Multip:"Multiplier" isVrayLight:false isVRaySun:false = -- Localize this string
(
-- Start Localization
local lbName
fn lbName =
(
if LLister.lbCount == undefined do LLister.lbCount = 1
LLister.lbCount += 1
("LB" + LLister.lbCount as string) as name
)
if isLuminaire == false do LLister.maxLightsRC.addControl #label (lbname()) "On" paramStr:"align:#left offset:[8,-3]"
local labeloffset = if isLuminaire == false then -18 else -3
LLister.maxLightsRC.addControl #label (lbname()) "Name" paramStr:(" align:#left offset:[28," + labelOffset as string + "]")
LLister.maxLightsRC.addControl #label (lbname()) Multip paramStr:(" align:#left offset:[102,-18]")
if hasColor do
(
LLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[160,-18]")
)
if hasShadow do
(
LLister.maxLightsRC.addControl #label (lbname()) "Shadows" paramStr:" align:#left offset:[190,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Map Size" paramStr:" align:#left offset:[332,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Bias" paramStr:" align:#left offset:[390,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Sm.Range" paramStr:" align:#left offset:[443,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Transp." paramStr:" align:#left offset:[495,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Int." paramStr:" align:#left offset:[535,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Qual." paramStr:" align:#left offset:[570,-18]"
)
if hasDecay do
(
LLister.maxLightsRC.addControl #label (lbname()) "Decay" paramStr:" align:#left offset:[612,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Start" paramStr:" align:#left offset:[690,-18]"
)
if hasSize do
(
LLister.maxLightsRC.addControl #label (lbname()) "Length" paramStr:" align:#left offset:[612,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Width" paramStr:" align:#left offset:[671,-18]"
)
-- Added for VRaySun labels:
if isVRaySun do
(
LLister.maxLightsRC.addControl #label (lbname()) "Turbidity" paramStr:" align:#left offset:[160,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Ozone" paramStr:" align:#left offset:[220,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Size Multiplier" paramStr:" align:#left offset:[280,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Shadow Subdivisions" paramStr:" align:#left offset:[360,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Shadow Bias" paramStr:" align:#left offset:[480,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Photon Emit Radius" paramStr:" align:#left offset:[560,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Invisible" paramStr:" align:#left offset:[668,-18]"
)
-- Added for VRayLight labels:
if isVRayLight do
(
LLister.maxLightsRC.addControl #label (lbname()) "Shdws." paramStr:" align:#left offset:[190,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Invisible" paramStr:" align:#left offset:[228,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Double" paramStr:" align:#left offset:[270,-36]"
LLister.maxLightsRC.addControl #label (lbname()) "Sided" paramStr:" align:#left offset:[273,0]"
LLister.maxLightsRC.addControl #label (lbname()) "No" paramStr:" align:#left offset:[317,-36]"
LLister.maxLightsRC.addControl #label (lbname()) "Decay" paramStr:" align:#left offset:[310,0]"
LLister.maxLightsRC.addControl #label (lbname()) "Skylight" paramStr:" align:#left offset:[345,-36]"
LLister.maxLightsRC.addControl #label (lbname()) "Portal" paramStr:" align:#left offset:[350,0]"
LLister.maxLightsRC.addControl #label (lbname()) "Store w/" paramStr:" align:#left offset:[390,-36]"
LLister.maxLightsRC.addControl #label (lbname()) "IRRMap" paramStr:" align:#left offset:[388,0]"
LLister.maxLightsRC.addControl #label (lbname()) "Diffuse" paramStr:" align:#left offset:[436,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Affect" paramStr:" align:#left offset:[473,-36]"
LLister.maxLightsRC.addControl #label (lbname()) "Spec." paramStr:" align:#left offset:[473,0]"
LLister.maxLightsRC.addControl #label (lbname()) "Reflct." paramStr:" align:#left offset:[505,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Units" paramStr:" align:#left offset:[560,-18]"
LLister.maxLightsRC.addControl #label (lbname()) "Sampling" paramStr:" align:#left offset:[660,-36]"
LLister.maxLightsRC.addControl #label (lbname()) "Subdivs" paramStr:" align:#left offset:[630,0]"
LLister.maxLightsRC.addControl #label (lbname()) "Shdw Bias" paramStr:" align:#left offset:[688,-18]"
)
-- End Localization
)
fn CreateControls hasShadow:true isVRayLight:false isVRaySun:false hasDecay:false hasSize:false Multiplier:#multiplier hasColor:true ColorType:#Color isLuminaire:false = -- AB: Jun 20, 2002
(
-- Selection Checkbox
local isLightSelected = false
for i in LLister.LightIndex[LLister.count] where (not isLightSelected) do isLightSelected = i.isSelected
LLister.UIControlList[1][LLister.count] = LLister.LightIndex[LLister.count][1]
LLister.UIControlList[2][LLister.Count] = #()
LLister.maxLightsRC.addControl #checkbutton (("LightSel" + LLister.count as string) as name) "" \
paramStr:("checked:" + (isLightSelected as string) + " offset:[-5,-2] align:#left" +\
" width:10 height:20 ")
LLister.maxLightsRC.addHandler (("LightSel" + LLister.count as string) as name) #'changed state' filter:on \
codeStr: \
(
"clearCheckButtons();if state then (max modify mode;select LLister.LightIndex[" + LLister.count as string + "];LightSel" + (LLister.count as string) + ".checked = true); else max select none"
)
append LLister.UIControlList[2][LLister.Count] (("LightSel" + LLister.count as string) as name)
-- On/Off
if isLuminaire == false do
(
LLister.maxLightsRC.addControl #checkbox (("LightOn" + LLister.count as string) as name) "" \
paramStr:("checked:" + ((LLister.GetlightProp LLister.LightIndex[LLister.count][1] #on) as string) + " offset:[8,-22] width:18")
LLister.maxLightsRC.addHandler (("LightOn" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #on state")
append LLister.UIControlList[2][LLister.Count] (("LightOn" + LLister.count as string) as name)
)
-- Light Name
local isUsingEdittextOffset = 0
if LLister.LightIndex[LLister.count].count == 1 then
(
LLister.maxLightsRC.addControl #edittext (("LightName" + LLister.count as string) as name) "" \
paramStr:(" text:\"" + LLister.LightIndex[LLister.count][1].name + "\" width:75 height:16 offset:[23,-21] height:21")
LLister.maxLightsRC.addHandler (("LightName" + LLister.count as string) as name) #'entered txt' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].name = txt")
isUsingEdittextOffset = 4
)
else
(
theNames = for j in LLister.LightIndex[LLister.count] collect j.name
sort theNames
namelist = "#("
for j in 1 to theNames.count do
(
append namelist ("\"" + theNames[j] + "\"")
if j != theNames.count do append namelist ","
)
append namelist ")"
LLister.maxLightsRC.addControl #dropDownList (("LightName" + LLister.count as string) as name) "" filter:on\
paramStr:(" items:" + NameList + " width:73 offset:[27,-22] ")
)
append LLister.UIControlList[2][LLister.Count] (("LightName" + LLister.count as string) as name)
-- Light Multiplier
-- AB: Jun 20, 2002
-- Increased Limits for the spinners from 10,000 to 1,000,000
if Multiplier == #multiplier then
(
LLister.maxLightsRC.addControl #spinner (("LightMult" + LLister.count as string) as name) "" \
paramStr:("range:[-1000000,1000000," + (LLister.getLightProp LLister.LightIndex[LLister.count][1] #multiplier) as string + "] type:#float " + \
"fieldwidth:45 align:#left offset:[100," + (isUsingEdittextOffset-24) as string + "] enabled:" + \
((if isProperty LLister.LightIndex[LLister.count][1] #multiplier then \
if LLister.LightIndex[LLister.count][1].multiplier.controller != undefined then \
LLister.LightIndex[LLister.count][1].multiplier.controller.keys.count >= 0 else true \
else try(if isProperty LLister.LightIndex[LLister.count][1].delegate #multiplier then \
if LLister.LightIndex[LLister.count][1].delegate.multiplier.controller != undefined then \
LLister.LightIndex[LLister.count][1].delegate.multiplier.controller.keys.count >= 0 else true) catch(true)\
) as string))
LLister.maxLightsRC.addHandler (("LightMult" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #multiplier val")
)
else if Multiplier == #intensity then
(
LLister.maxLightsRC.addControl #spinner (("LightMult" + LLister.count as string) as name) "" \
paramStr:("range:[-1000000,1000000," + (LLister.LightIndex[LLister.count][1].intensity as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[100," + (isUsingEdittextOffset-24) as string + "] enabled:" + \
((if isProperty LLister.LightIndex[LLister.count][1] #intensity then \
if LLister.LightIndex[LLister.count][1].intensity.controller != undefined then \
LLister.LightIndex[LLister.count][1].intensity.controller.keys.count >= 0 else true \
else try(if isProperty LLister.LightIndex[LLister.count][1].delegate #intensity then \
if LLister.LightIndex[LLister.count][1].delegate.intensity.controller != undefined then \
LLister.LightIndex[LLister.count][1].delegate.intensity.controller.keys.count >= 0 else true) catch(true)\
) as string))
LLister.maxLightsRC.addHandler (("LightMult" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #intensity val")
)
else if Multiplier == #dimmer then
(
LLister.maxLightsRC.addControl #spinner (("LightMult" + LLister.count as string) as name) "" \
paramStr:("range:[-1000000,1000000," + (LLister.LightIndex[LLister.count][1].dimmer as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[100," + (isUsingEdittextOffset-24) as string + "]")
LLister.maxLightsRC.addHandler (("LightMult" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].dimmer = val")
)
append LLister.UIControlList[2][LLister.Count] (("LightMult" + LLister.count as string) as name)
-- AMc: Aug 24, 2006
-- Extended ColorType to account for lights that don't have color settings, such as VRay Sun
if hasColor do
(
-- Light Color
-- AB: Jun 20, 2002
-- Added ColorType parameter to the function, so I can call FilterColor for Photometric Lights
if ColorType != #FilterColor then
(
LLister.maxLightsRC.addControl #colorpicker (("LightCol" + LLister.count as string) as name) "" \
paramStr:("color:" + (LLister.getLightProp LLister.LightIndex[LLister.count][1] #color) as string + \
" offset:[158,-23] width:25")
LLister.maxLightsRC.addHandler (("LightCol" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #color val")
)
else
(
LLister.maxLightsRC.addControl #colorpicker (("LightCol" + LLister.count as string) as name) "" \
paramStr:("color:" + (LLister.getLightProp LLister.LightIndex[LLister.count][1] #filterColor) as string + \
" offset:[158,-23] width:25")
LLister.maxLightsRC.addHandler (("LightCol" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #filterColor val")
)
append LLister.UIControlList[2][LLister.Count] (("LightCol" + LLister.count as string) as name)
)
if hasShadow do
(
-- Shadow On/Off
LLister.maxLightsRC.addControl #checkbox (("LightShdOn" + LLister.count as string) as name) "" \
paramStr:("checked:" + (LLister.getLightProp LLister.LightIndex[LLister.count][1].baseObject #castshadows as string)+ " offset:[190,-22] width:15")
LLister.maxLightsRC.addHandler (("LightShdOn" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1].baseobject #castshadows state")
append LLister.UIControlList[2][LLister.Count] (("LightShdOn" + LLister.count as string) as name)
-- Shadow Plugin
local LLshadowClass = LLister.fnShadowClass LLister.LightIndex[LLister.count][1]
local LLshadowGen = (LLister.getLightProp LLister.LightIndex[LLister.count][1] #shadowGenerator)
LLister.maxLightsRC.addControl #dropDownList (("LightShd" + LLister.count as string) as name) "" filter:on\
paramStr:(" items:" + LLister.ShadowPluginsName as string + " width:120 offset:[210,-24]" + \
"selection:(finditem LLister.ShadowPlugins (LLister.fnShadowClass LLister.LightIndex[" + LLister.count as string + "][1]))")
append LLister.UIControlList[2][LLister.Count] (("LightShd" + LLister.count as string) as name)
-- Light Map Size
local mapSizeTmp = 512
if LLshadowClass == shadowMap do
mapSizeTmp = LLshadowGen.mapSize
LLister.maxLightsRC.addControl #spinner (("LightMapSiz" + LLister.count as string) as name) "" \
paramStr:("range:[0,10000," + (mapSizeTmp as string) + "] type:#integer " + \
"fieldwidth:45 align:#left offset:[330,-24] enabled:" \
+ (LLshadowClass == shadowMap or LLShadowClass == mental_ray_shadow_map) as string)
LLister.maxLightsRC.addHandler (("LightMapSiz" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setShdProp LLister.LightIndex[" + LLister.count as string + "][1] #mapSize val")
append LLister.UIControlList[2][LLister.Count] (("LightMapSiz" + LLister.count as string) as name)
-- Light Bias
local BiasTmp = \
case classof LLshadowClass of
(
shadowMap: LLShadowGen.mapBias
raytraceShadow: LLShadowGen.raytraceBias
Area_Shadows: LLShadowGen.ray_Bias
Adv__Ray_Traced: LLShadowGen.ray_Bias
Blur_Adv__Ray_Traced: LLShadowGen.ray_Bias
VRayShadow: LLShadowGen.bias
default: 1.0
)
LLister.maxLightsRC.addControl #spinner (("LightBias" + LLister.count as string) as name) "" \
paramStr:("range:[0,10000," + (BiasTmp as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[388,-21] enabled:" \
+ (LLShadowClass == shadowMap or LLShadowClass == raytraceShadow or LLShadowClass == Blur_Adv__Ray_Traced or\
LLShadowClass == Area_Shadows or LLShadowClass == Adv__Ray_Traced or LLShadowClass == VRayShadow) as string)
LLister.maxLightsRC.addHandler (("LightBias" + LLister.count as string) as name) #'changed val' filter:on \
codeStr: \
(
"local propname = case (LLister.fnShadowClass LLister.LightIndex[" + LLister.count as string + "][1]) of\n" + \
"(VRayShadow:#bias; shadowMap:#mapbias; raytraceShadow:#raytraceBias; Area_Shadows:#ray_bias; Adv__Ray_Traced:#ray_bias; Blur_Adv__Ray_Traced:#ray_bias;default:0)\n" + \
"if propname != 0 do LLister.SetShdProp LLister.LightIndex[" + LLister.count as string + "][1] propName val"
)
append LLister.UIControlList[2][LLister.Count] (("LightBias" + LLister.count as string) as name)
-- Light Sample Range
local smpRangeTmp = 4.0
if LLShadowClass == shadowMap or LLShadowClass == mental_ray_Shadow_Map do
smpRangeTmp = LLShadowGen.samplerange
LLister.maxLightsRC.addControl #spinner (("LightSmpRange" + LLister.count as string) as name) "" \
paramStr:("range:[0,50," + (smpRangeTmp as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[446,-21] enabled:" + (LLShadowClass == shadowMap or LLShadowClass == mental_ray_shadow_map) as string)
LLister.maxLightsRC.addHandler (("LightSmpRange" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetShdProp LLister.LightIndex[" + LLister.count as string + "][1] #samplerange val")
append LLister.UIControlList[2][LLister.Count] (("LightSmpRange" + LLister.count as string) as name)
-- Transparency On/Off
LLister.maxLightsRC.addControl #checkbox (("LightTrans" + LLister.count as string) as name) "" \
paramStr:("checked:" + \
((if LLShadowClass == Area_Shadows or LLShadowClass == Adv__Ray_Traced or LLShadowClass == Blur_Adv__Ray_Traced then \
LLShadowGen.shadow_Transparent else false) as string) + \
" offset:[508,-20] width:15 enabled:" + \
((LLShadowClass == Area_Shadows or LLShadowClass == Adv__Ray_Traced or LLShadowClass == Blur_Adv__Ray_Traced) as string))
LLister.maxLightsRC.addHandler (("LightTrans" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.setShdProp LLister.LightIndex[" + LLister.count as string + "][1] #shadow_Transparent state")
append LLister.UIControlList[2][LLister.Count] (("LightTrans" + LLister.count as string) as name)
-- Integrity
LLister.maxLightsRC.addControl #spinner (("LightInteg" + LLister.count as string) as name) "" \
paramStr:("type:#integer fieldwidth:30 align:#left range:[1,15," + \
((if LLShadowClass == Area_Shadows or LLShadowClass == Blur_Adv__Ray_Traced or\
LLShadowClass == Adv__Ray_Traced then \
LLShadowGen.pass1 else 1) as string) + \
"] offset:[525,-21] width:15 enabled:" + \
((LLShadowClass == Area_Shadows or LLShadowClass == Blur_Adv__Ray_Traced or\
LLShadowClass == Adv__Ray_Traced) as string))
LLister.maxLightsRC.addHandler (("LightInteg" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setShdProp LLister.LightIndex[" + LLister.count as string + "][1] #pass1 val")
append LLister.UIControlList[2][LLister.Count] (("LightInteg" + LLister.count as string) as name)
-- Quality
LLister.maxLightsRC.addControl #spinner (("LightQual" + LLister.count as string) as name) "" \
paramStr:("type:#integer fieldwidth:30 align:#left range:[1,15," + \
((if LLShadowClass == Area_Shadows or LLShadowClass == Blur_Adv__Ray_Traced or \
LLShadowClass == Adv__Ray_Traced then \
LLShadowGen.pass2 else 2) as string) + \
"] offset:[568,-21] width:15 enabled:" + \
((LLShadowClass == Area_Shadows or LLShadowClass == Blur_Adv__Ray_Traced or \
LLShadowClass == Adv__Ray_Traced) as string))
LLister.maxLightsRC.addHandler (("LightQual" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setShdProp LLister.LightIndex[" + LLister.count as string + "][1] #pass2 val")
append LLister.UIControlList[2][LLister.Count] (("LightQual" + LLister.count as string) as name)
-- Shadow Plugin dropdown handler
LLister.maxLightsRC.addHandler (("LightShd" + LLister.count as string) as name) #'selected i' filter:on \
codeStr:(\
"LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #shadowGenerator (LLister.ShadowPlugins[i]());" + \
"local shdClass = LLister.fnShadowClass LLister.LightIndex[" + LLister.count as string + "][1]\n" + \
"LightMapSiz" + LLister.count as string + ".enabled = LightSmpRange" + LLister.count as string + ".enabled = (shdClass == shadowMap or shdClass == mental_ray_shadow_map)\n" + \
"LightTrans" + LLister.count as string + ".enabled = LightInteg" + LLister.count as string + ".enabled = LightQual" + LLister.count as string + ".enabled = " + \
"shdClass == Adv__Ray_Traced or shdClass == Blur_Adv__Ray_Traced or shdClass == Area_Shadows\n" + \
"LightBias" + LLister.count as string + ".enabled = (shdClass == Area_Shadows or shdClass == shadowMap or " + \
"shdClass == Blur_Adv__Ray_Traced or shdClass == VRayShadow or shdClass == raytraceShadow or shdClass == Adv__Ray_Traced)\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #mapSize) != undefined do LightMapSiz" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #sampleRange) != undefined do LightSmpRange" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #pass1) != undefined do LightInteg" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #pass2) != undefined do LightQual" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #mapBias) != undefined do LightBias" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #Bias) != undefined do LightBias" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #ray_Bias) != undefined do LightBias" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #raytraceBias) != undefined do LightBias" + \
LLister.count as string + ".value = val\n" + \
"if (val = LLister.getShdProp LLister.LightIndex[" + LLister.count as string + "][1] #shadow_Transparent) != undefined do LightTrans" + \
LLister.count as string + ".checked = val"
)
) -- end has Shadow
if isVRayLight do
(
-- Shadow On/Off
LLister.maxLightsRC.addControl #checkbox (("LightShdOn" + LLister.count as string) as name) "" \
paramStr:("checked:" + (LLister.getLightProp LLister.LightIndex[LLister.count][1].baseObject #castshadows as string)+ " offset:[190,-21] width:15")
LLister.maxLightsRC.addHandler (("LightShdOn" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1].baseobject #castshadows state")
append LLister.UIControlList[2][LLister.Count] (("LightShdOn" + LLister.count as string) as name)
-- Invisible checker
LLister.maxLightsRC.addControl #checkbox (("Invisible" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].invisible as string) + " offset:[235,-20]")
LLister.maxLightsRC.addHandler (("Invisible" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].invisible = state")
-- Double-Sided checker
LLister.maxLightsRC.addControl #checkbox (("DoubleSided" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].doubleSided as string) + " offset:[280,-20]")
LLister.maxLightsRC.addHandler (("DoubleSided" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].doubleSided = state")
-- No decay checker
LLister.maxLightsRC.addControl #checkbox (("NoDecay" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].noDecay as string) + " offset:[317,-20]")
LLister.maxLightsRC.addHandler (("NoDecay" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].noDecay = state")
-- Skylight Portal checker
LLister.maxLightsRC.addControl #checkbox (("SkylightPortal" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].SkylightPortal as string) + " offset:[358,-20]")
LLister.maxLightsRC.addHandler (("SkylightPortal" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].SkylightPortal = state")
-- Store with Irridiance Map checker
LLister.maxLightsRC.addControl #checkbox (("storeWithIrradMap" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].storeWithIrradMap as string) + " offset:[402,-20]")
LLister.maxLightsRC.addHandler (("storeWithIrradMap" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].storeWithIrradMap = state")
-- Affect Diffuse checker
LLister.maxLightsRC.addControl #checkbox (("affectDiffuse" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].affect_diffuse as string) + " offset:[452,-20]")
LLister.maxLightsRC.addHandler (("affectDiffuse" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].affect_diffuse = state")
-- Affect Specular checker
LLister.maxLightsRC.addControl #checkbox (("affectSpecular" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].affect_specular as string) + " offset:[480,-20]")
LLister.maxLightsRC.addHandler (("affectSpecular" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].affect_specular = state")
-- Affect Reflections checker
LLister.maxLightsRC.addControl #checkbox (("affectReflections" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].affect_reflections as string) + " offset:[512,-20]")
LLister.maxLightsRC.addHandler (("affectReflections" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].affect_reflections = state")
-- Units Type Selecter
LLister.maxLightsRC.addControl #dropDownList (("VRayLightUnitsType" + LLister.count as string) as name) "" filter:on\
paramStr:(" items:" + LLister.VRayLightUnitStrings as string + "width:80 offset:[540,-21]" +\
"selection:((LLister.getLightProp LLister.LightIndex[" + LLister.count as string + "][1] #normalizeColor) + 1)")
LLister.maxLightsRC.addHandler (("VRayLightUnitsType" + LLister.count as string) as name) #'selected i' filter:on \
codeStr:(\
"LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #normalizeColor (i-1) \n" +\
"if (val = LLister.getLightProp LLister.LightIndex[" + LLister.count as string + "][1] #multiplier) != undefined do LightMult" + \
LLister.count as string + ".value = val\n")
append LLister.UIControlList[2][LLister.Count] (("VRayLightUnitsType" + LLister.count as string) as name)
-- Subdivisions Spinner
LLister.maxLightsRC.addControl #spinner (("VRayLightSubdivisions" + LLister.count as string) as name) ""\
paramStr:("range:[1,1000," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #subdivs) as string) + "] type:#integer " + \
"fieldwidth:45 align:#left offset:[625,-25]")
LLister.maxLightsRC.addHandler (("VRayLightSubdivisions" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #subdivs val ")
append LLister.UIControlList[2][LLister.Count] (("VRayLightSubdivisions" + LLister.count as string) as name)
-- Shadow Bias Spinner
LLister.maxLightsRC.addControl #spinner (("VRayLightShadowBias" + LLister.count as string) as name) ""\
paramStr:("range:[-100000,100000," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #ShadowBias) as string) + "] type:#WorldUnits " + \
"fieldwidth:45 align:#left offset:[685,-21]")
LLister.maxLightsRC.addHandler (("VRayLightShadowBias" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #ShadowBias val ")
append LLister.UIControlList[2][LLister.Count] (("VRayLightShadowBias" + LLister.count as string) as name)
)
if isVRaySun do
(
-- On/Off checkbox, in VRay sun it's "enabled" instead of the usual "on"... so we mark it as a Luminare and generate the checkbox here
LLister.maxLightsRC.addControl #checkbox (("LightOn" + LLister.count as string) as name) "" \
paramStr:("checked:" + ((LLister.GetlightProp LLister.LightIndex[LLister.count][1] #enabled) as string) + " offset:[8,-22] width:18")
LLister.maxLightsRC.addHandler (("LightOn" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #enabled state")
append LLister.UIControlList[2][LLister.Count] (("LightOn" + LLister.count as string) as name)
-- Intensity, again VRay sun uses "intensity_multiplier" instead of "intensity" or "multiplier"... so we handle it differently
LLister.maxLightsRC.addControl #spinner (("LightMult" + LLister.count as string) as name) "" \
paramStr:("range:[0,1000000," + (LLister.getLightProp LLister.LightIndex[LLister.count][1] #intensity_multiplier) as string + "] type:#float " + \
"fieldwidth:45 align:#left offset:[100,-21] enabled:" + \
((if isProperty LLister.LightIndex[LLister.count][1] #intensity_multiplier then \
if LLister.LightIndex[LLister.count][1].intensity_multiplier.controller != undefined then \
LLister.LightIndex[LLister.count][1].intensity_multiplier.controller.keys.count >= 0 else true \
else try(if isProperty LLister.LightIndex[LLister.count][1].delegate #intensity_multiplier then \
if LLister.LightIndex[LLister.count][1].delegate.intensity_multiplier.controller != undefined then \
LLister.LightIndex[LLister.count][1].delegate.intensity_multiplier.controller.keys.count >= 0 else true) catch(true)\
) as string))
LLister.maxLightsRC.addHandler (("LightMult" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #intensity_multiplier val")
-- Turbidity selection
LLister.maxLightsRC.addControl #spinner (("SunTurbidity" + LLister.count as string) as name) ""\
paramStr:("range:[2,20," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #turbidity) as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[158,-21]")
LLister.maxLightsRC.addHandler (("SunTurbidity" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #turbidity val ")
append LLister.UIControlList[2][LLister.Count] (("SunTurbidity" + LLister.count as string) as name)
-- Ozone selection
LLister.maxLightsRC.addControl #spinner (("SunOzone" + LLister.count as string) as name) ""\
paramStr:("range:[0,1," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #ozone) as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[218,-21]")
LLister.maxLightsRC.addHandler (("SunOzone" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #ozone val ")
append LLister.UIControlList[2][LLister.Count] (("SunOzone" + LLister.count as string) as name)
-- Size Multiplier selection
LLister.maxLightsRC.addControl #spinner (("SunSize" + LLister.count as string) as name) ""\
paramStr:("range:[0,100000," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #size_multiplier) as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[280,-21]")
LLister.maxLightsRC.addHandler (("SunSize" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #size_multiplier val ")
append LLister.UIControlList[2][LLister.Count] (("SunSize" + LLister.count as string) as name)
-- Shadow Subdivisions Selection
LLister.maxLightsRC.addControl #spinner (("SunShadowSubdivs" + LLister.count as string) as name) ""\
paramStr:("range:[1,1000," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #shadow_subdivs) as string) + "] type:#integer " + \
"fieldwidth:45 align:#left offset:[360,-21]")
LLister.maxLightsRC.addHandler (("SunShadowSubdivs" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #shadow_subdivs val ")
append LLister.UIControlList[2][LLister.Count] (("SunShadowSubdivs" + LLister.count as string) as name)
-- Shadow Bias Selection
LLister.maxLightsRC.addControl #spinner (("SunShadowBias" + LLister.count as string) as name) ""\
paramStr:("range:[-100000,100000," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #shadow_bias) as string) + "] type:#worldunits " + \
"fieldwidth:45 align:#left offset:[480,-21]")
LLister.maxLightsRC.addHandler (("SunShadowBias" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #shadow_bias val ")
append LLister.UIControlList[2][LLister.Count] (("SunShadowBias" + LLister.count as string) as name)
-- Photon Emit Radius Selection
LLister.maxLightsRC.addControl #spinner (("SunPhotonEmitRadius" + LLister.count as string) as name) ""\
paramStr:("range:[0,100000," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #photon_emit_radius) as string) + "] type:#worldunits " + \
"fieldwidth:45 align:#left offset:[560,-21]")
LLister.maxLightsRC.addHandler (("SunPhotonEmitRadius" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.SetLightProp LLister.LightIndex[" + LLister.count as string + "][1] #photon_emit_radius val ")
append LLister.UIControlList[2][LLister.Count] (("SunPhotonEmitRadius" + LLister.count as string) as name)
-- Invisible checker
LLister.maxLightsRC.addControl #checkbox (("Invisible" + LLister.count as string) as name) "" \
paramStr:(" checked:" + (LLister.LightIndex[LLister.count][1].invisible as string) + " offset:[678,-20]")
LLister.maxLightsRC.addHandler (("Invisible" + LLister.count as string) as name) #'changed state' filter:on \
codeStr:("LLister.LightIndex[" + LLister.count as string + "][1].invisible = state")
)
if hasDecay do
(
-- Decay selection
LLister.maxLightsRC.addControl #dropDownList (("LightDecay" + LLister.count as string) as name) "" filter:on\
paramStr:(" items:" + LLister.decayStrings as string + " width:80 offset:[612,-24]" + \
"selection:(LLister.getLightProp LLister.LightIndex[" + LLister.count as string + "][1] #attenDecay)")
LLister.maxLightsRC.addHandler (("LightDecay" + LLister.count as string) as name) #'selected i' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #attenDecay i")
append LLister.UIControlList[2][LLister.Count] (("LightDecay" + LLister.count as string) as name)
-- Decay Start
LLister.maxLightsRC.addControl #spinner (("LightDecStart" + LLister.count as string) as name) "" \
paramStr:("range:[0,10000," + ((LLister.getLightProp LLister.LightIndex[LLister.count][1] #decayRadius) as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[690,-24]")
LLister.maxLightsRC.addHandler (("LightDecStart" + LLister.count as string) as name) #'changed val' filter:on \
codeStr:("LLister.setLightProp LLister.LightIndex[" + LLister.count as string + "][1] #decayRadius val")
append LLister.UIControlList[2][LLister.Count] (("LightDecStart" + LLister.count as string) as name)
) -- end hasDecay
if hasSize do
(