-
Notifications
You must be signed in to change notification settings - Fork 1
/
maxwellLightLister.ms
2877 lines (2403 loc) · 183 KB
/
maxwellLightLister.ms
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
/*
Maxwell light lister additions
History:
2012-04-15 | v1 | initial release | Eric Mehl
2012-04-16 | v1.1 | fixed bug with scanning the scene for multi-materials | EM
2012-04-17 | v1.2 | added ability to change material name in the light lister
2016-02-16 | v2.0 | by Carlos Monteagudo Mañas and Pedro Zuñeda Garrido
--*********************************************************************************************
***********************************************************************************************
Maxwell Light Lister v2.0
-- Created: Feb 16 2016
-- Version: 3ds max 2016
-- Script: Maxwell Light Lister script 3.0
-- Authors: Carlos Monteagudo Mañas and Pedro Zuñeda Garrido
History (Maxwell Light Lister v2.0):
-- Added new Maxwell lights: Mxlights (Support for types: Area, IES and Spot)
-- Fixed dependence between Lum.Type DropDownList items and LuminanceType parameters of Maxwell Material Emitters
-- Added new Cameras Panel (Support for Maxwell parameters related to lighting)
***********************************************************************************************
--*********************************************************************************************
TO DO:
* Add support for sky lights - waiting for fix to max plugin by Next Limit to expose variables needed
*/
-- MacroScript File
-- Created: Jan 15 2002
-- Last Modified: May 05 2007
-- Light Lister Script 2.8
-- Version: 3ds max 6
-- Author: Alexander Esppeschit Bicalho [discreet]
--***********************************************************************************************
-- MODIFY THIS AT YOUR OWN RISK
/* History
- added support for mr_Sky, mr_SkyPortal, and mr_Sun (LAM)
- fixed mentalray shadow map list bug by zhangy
- Added product switcher: this macro file can be shared with all Discreet products
- 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 - maxwellLLister.UIControlList not reset, contained deleted node (LAM)
- Added support for MultiProduct (IFDEFs for #VIZR) (AB)
- Added support to Global Shadow Generator - when a Global Shadow Generator is changed, the Refresh button is
highlighted to warn the user he needs a refresh
- Fixed problem when launching the Light Lister when lights have manipulators enabled
- Added LineOffset and YOffset to help Japanese/Chinese localization
*/
/*
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.
maxwellLLister.maxLightsRC.addControl #checkbox (("ControlName" + maxwellLLister.count as string) as name) "" \
paramStr:("checked:" + (maxwellLLister.LightIndex[maxwellLLister.count][1].Property as string) + " offset:[8,-22] width:18")
maxwellLLister.maxLightsRC.addHandler (("ControlName" + maxwellLLister.count as string) as name) #'changed state' filter:on \
codeStr:("maxwellLLister.LightIndex[" + maxwellLLister.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 Maxwell_Light_List enabledIn:#("max", "viz", "vizr") category:"Barreira" internalCategory:"Barreira" ButtonText:"Light Lister..." tooltip:"Maxwell Light Lister" Icon:#("hypothetical_icons",2)
(
Debug = false
struct maxwellLightListerStruct (onExecute,onIsChecked,onCloseDialogs,version, \
GlobalLightParameters, LightInspectorSetup, LightInspectorFloater, ShadowPlugins, ShadowPluginsName, \
maxwellLightsList, maxwellLightTypeStrings, maxwellColorStrings, maxwellLuminanceTypeStrings, maxwellUnitStrings, \
maxwellEnviroStrings, maxwellEnviroLights, maxwellLightMatPairs, \
maxLightsList, LSLightsList, SkyLightsList, SunLightsList, enableUIElements, \
LuminairesList, maxLightsRC, CreateLightRollout, UIControlList, DeleteCallback, disableUIElements, \
MxLightsList, MxLightsSpotList, GlobalCameraParameters, camerasList, maxwellLightFallOffTypes, \
LightInspectorListRollout, LLUndoStr, count, lbcount, lightIndex, decayStrings, totalLightCount, \
miLightsList, getLightProp, setLightProp, setShdProp, getShdProp, fnShadowClass, enableRefreshBtn, \
mrSkyLightsList, mrSunLightsList, mrSkyPortalLightsList, MRSkyPortal_ShadowSamples, MRSkyPortal_Modes, \
yOffset, LineOffset)
local CamStrings
local currentCam = 1
local exposure_state
-- Enable/disable camera items
local fstop_enabled = true
local shutterSpeed_enabled = true
local exposureValue_enabled = true
global maxwellLLister, LListerYOffset
if maxwellLLister == undefined or Debug == true then (
maxwellLLister = maxwellLightListerStruct()
)
-- Strings for Localization
maxwellLLister.decayStrings = #("None","Inverse","Inv. Square")
maxwellLLister.maxwellLightTypeStrings = #("Color + Luminance","Temperature","MXI/HDR Texture")
maxwellLLister.maxwellLightFallOffTypes = #("Linear","Square Root","Sinusoidal", "Squared Sinusoidal", "Quadratic", "Cubic")
maxwellLLister.maxwellColorStrings = #("RGB","Correlated")
maxwellLLister.maxwellLuminanceTypeStrings = #("Watts + Efficacy","Intensity")
maxwellLLister.maxwellUnitStrings = #("Lumen","Lux","Candela","Luminance")
maxwellLLister.maxwellEnviroStrings = #("Sky Dome", "Physical Sky")
maxwellLLister.LLUndoStr = "LightLister"
local dialogUp = false
-- End Strings
-- Positioning to help localization
LListerYOffset = 0
maxwellLLister.yOffset = LListerYOffset
maxwellLLister.LineOffset = 0
-- 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 wrapString inString =
(
local string1In = "\\"
local string1Out = "\\\\"
local string2In = "\""
local string2Out = "\\\""
local temp_text_string = substituteString inString string1In string1Out
temp_text_string = substituteString temp_text_string string2In string2Out
temp_text_string = string2In + temp_text_string + string2In
temp_text_string -- return value
)
fn disableUIElements array1 =
(
for i in array1 do
execute ("maxLightsRollout." + i as string + ".enabled = false")
)
maxwellLLister.disableUIElements = disableUIElements
fn enableRefreshBtn lightobj =
(
if (maxwellLLister.GetLightProp lightObj #useGlobalShadowSettings) == true do
(
maxwellLLister.LightInspectorSetup.BtnReload.Checked = true
)
)
maxwellLLister.enableRefreshBtn = enableRefreshBtn
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
)
maxwellLLister.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
)
maxwellLLister.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
)
maxwellLLister.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
maxwellLLister.enableRefreshBtn obj
)
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
maxwellLLister.enableRefreshBtn obj
)
else undefined
else undefined
)
maxwellLLister.setShdProp = setShdProp
fn fnShadowClass obj =
(
classof (maxwellLLister.getLightProp obj #shadowGenerator)
)
maxwellLLister.fnShadowClass = fnShadowClass
-- Collect Shadow Plugins
/* -- Removed Automatic Shadow Plugin Collection
maxwellLLister.ShadowPlugins = (subtractFromArray shadow.classes #(Missing_Shadow_Type))
qSort maxwellLLister.ShadowPlugins (fn namesort v1 v2 = if ((v1 as string)as name) > ((v2 as string)as name) then 1 else 0)
maxwellLLister.ShadowPluginsName = for i in maxwellLLister.ShadowPlugins collect i as string
*/
-- Hardcoded shadow plugins to the ones available
maxwellLLister.ShadowPlugins = #(Adv__Ray_Traced, mental_ray_Shadow_Map, Area_Shadows, shadowMap, raytraceShadow)
maxwellLLister.ShadowPluginsName = #("Adv. Ray Traced", "mental_ray_Shadow_Map", "Area Shadows", "Shadow Map", "Raytrace Shadow")
/* -- uncomment if you want the Blur Shadows
maxwellLLister.ShadowPlugins = #(Adv__Ray_Traced, mental_ray_Shadow_Map, Area_Shadows, Blur_Adv__Ray_Traced, shadowMap, raytraceShadow)
maxwellLLister.ShadowPluginsName = #("Adv. Ray Traced", "mental_ray_Shadow_Map", "Area Shadows", "Blur Adv. Ray Traced","Shadow Map", "Raytrace Shadow")
*/
maxwellLLister.MRSkyPortal_ShadowSamples =
(
for i = 1 to 10
collect (2^i) as string
)
maxwellLLister.MRSkyPortal_Modes = #("Existing", "Envir.", "Custom") -- correspond to mode values of 2, 0, 1
/********************************************************************************************************************************************************************/
/********************************************************************************************************************************************************************/
/********************************************************************************************************************************************************************/
/********************************************************************************************************************************************************************/
/********************************************************************************************************************************************************************/
/********************************************************************************************************************************************************************/
-- Main Function
local CreateLightRollout
fn createLightRollout myCollection selectionOnly:false =
(
maxwellLLister.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, Target_Linear, Free_Point, Target_Point,
Free_Sphere, Target_Sphere, Free_Disc, Target_Disc, Free_Cylinder, Target_Cylinder)
Luminaires = #(Luminaire)
mrLights = #(miAreaLight, miAreaLightomni)
mrSkyLight = #(mr_sky)
mrSunLight = #(mr_sun)
mrSkyPortalLight = #(mr_sky_portal)
maxwellLights = #(Maxwell_Material, MxLight)
-- Scene parser
SceneLights = MyCollection as array
sceneMaxLights = #()
sceneLSLights = #()
sceneSkyLights = #()
sceneSunLights = #()
sceneLuminaires = #()
scenemiLights = #()
scenemrSkyLights = #()
scenemrSunLights = #()
scenemrSkyPortalLights = #()
sceneMaxwellLights = #()
sceneMaxwellEnviroLights = false
sceneMxLights = #()
sceneMxLightsSpot = #()
--print SceneLights
for i in SceneLights do
(
LightClass = classof i
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 mrSkyLight LightClass != 0 do (
append scenemrSkyLights i
)
if findItem mrSunLight LightClass != 0 do (
append scenemrSunLights i
)
if findItem mrSkyPortalLight LightClass != 0 do (
append scenemrSkyPortalLights i
)
if findItem maxwellLights LightClass != 0 do (
if i.LobeType == 0 then
append sceneMxLights i
else if i.LobeType == 2 then
append sceneMxLightsSpot i
)
)
if classof renderers.current == MaxwellRenderer then
(
maxwellLLister.maxwellLightMatPairs = #() -- this will be an array storing two element arrays that have 1: emitter instance 2: parent material instance
-- collect maxwell lights by scanning materials
for mat in sceneMaterials do
(
if (classof mat) == Maxwell_Material then
(
lyrs = mat.Layers
for i in lyrs do
(
if (i.Emitter != undefined) then
(
i.Emitter.name = mat.name --change the name of the emitter to the material name so it is available for creating controls
append sceneMaxwellLights #(i.Emitter) --append the actual emitter instance, and wrap it in an array to be consistent with other light entries
append maxwellLLister.maxwellLightMatPairs #(i.Emitter,mat)
)
)
)
else if (classof mat) == MultiMaterial then --handle lights that are embedded in multi sub materials
(
for j in mat.materialList where (classof j) == Maxwell_Material do
(
lyrs = j.Layers
for i in lyrs do
(
if (i.Emitter != undefined) then
(
i.Emitter.name = mat.name --change the name of the emitter to the material name so it is available for creating controls
append sceneMaxwellLights #(i.Emitter) --append the actual emitter instance, and wrap it in an array to be consistent with other light entries
append maxwellLLister.maxwellLightMatPairs #(i.Emitter,j)
)
)
)
)
)
sceneMaxwellEnviroLights = true
renderSceneDialog.close() --max won't update the changes to the render scene dialog if it is open.
)
-- Collect Light Instances and build array to be displayed
tmpParser = #( \
tmpsceneMaxLights = copyArray sceneMaxLights, \
tmpscenemiLights = copyArray scenemiLights, \
tmpscenemrSkyLights = copyArray scenemrSkyLights, \
tmpscenemrSunLights = copyArray scenemrSunLights, \
tmpscenemrSkyPortalLights = copyArray scenemrSkyPortalLights, \
tmpsceneLSLights = copyArray sceneLSLights, \
tmpsceneSkyLights = copyArray sceneSkyLights, \
tmpsceneSunLights = copyArray sceneSunLights, \
tmpsceneLuminaires = copyArray sceneLuminaires, \
tmpsceneMxLights = copyArray sceneMxLights, \
tmpsceneMxLightsSpot = copyArray sceneMxLightsSpot \
)
ListParser = #( \
maxwellLLister.maxLightsList = #(), \
maxwellLLister.miLightsList = #(), \
maxwellLLister.mrSkyLightsList = #(), \
maxwellLLister.mrSunLightsList = #(), \
maxwellLLister.mrSkyPortalLightsList = #(), \
maxwellLLister.LSLightsList = #(), \
maxwellLLister.SkyLightsList = #(), \
maxwellLLister.SunLightsList = #(), \
maxwellLLister.LuminairesList = #(), \
maxwellLLister.MxLightsList = #(), \
maxwellLLister.MxLightsSpotList = #() \
)
maxwellLLister.maxwellLightsList = copyArray sceneMaxwellLights --no need to filter the maxwell list, so directly add it here and omit from tmpParser list
maxwellLLister.maxwellEnviroLights = sceneMaxwellEnviroLights
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 classof k != classof tmpNode or (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)
)
)
mwELights = 0
if maxwellLLister.maxwellEnviroLights then
(
mwElights = 5
) --hard coded since each environment light is listed even if it is unused
maxwellLLister.totalLightCount = maxwellLLister.maxLightsList.count + \
maxwellLLister.LSLightsList.count + \
maxwellLLister.SkyLightsList.count + \
maxwellLLister.SunLightsList.count + \
maxwellLLister.LuminairesList.count + \
maxwellLLister.miLightsList.count + \
maxwellLLister.mrSkyLightsList.count + \
maxwellLLister.mrSkyPortalLightsList.count + \
maxwellLLister.mrSunLightsList.count + \
maxwellLLister.maxwellLightsList.count + \
maxwellLLister.MxLightsList.count + \
mwELights
--print maxwellLLister.totalLightCount
-- 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())
*/
maxwellLLister.maxLightsRC = rolloutCreator "maxLightsRollout" "Lights" -- Localize the 2nd string only
maxwellLLister.maxLightsRC.setSourceDefinitionScriptFilename (getSourceFileName())
maxwellLLister.maxLightsRC.begin()
-- print maxwellLLister.maxLightsRC.str.count
maxwellLLister.maxLightsRC.addText "fn clearCheckButtons = for i in maxwellLLister.LightInspectorListRollout.controls do if classof i == checkButtonControl do if i.checked do i.checked = false\n"
maxwellLLister.count = 1
maxwellLLister.lbCount = 1
maxwellLLister.LightIndex = #()
maxwellLLister.UIControlList = #(#(),#())
fn WriteTitle hasShadow:true hasDecay:false hasSize:false isLuminaire:false isMRSky:false isMRSun:false isMRSkyPortal:false Multip:"Multiplier" isMaxwellLight:false isMxLight:false isMxLightSpot:false = -- Localize this string
(
-- Start Localization
local lbName
fn lbName =
(
if maxwellLLister.lbCount == undefined do
maxwellLLister.lbCount = 1
maxwellLLister.lbCount += 1
("LB" + maxwellLLister.lbCount as string) as name
)
if isLuminaire == false do
maxwellLLister.maxLightsRC.addControl #label (lbname()) "On" paramStr:(" align:#left offset:[8," + (-3 + maxwellLLister.yOffset + maxwellLLister.LineOffset) as string + "]")
local labeloffset = if isLuminaire == false then -18 else -3
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Name" paramStr:(" align:#left offset:[28," + (labelOffset + maxwellLLister.yOffset) as string + "]")
if ProductAppID == #VIZR then
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) Multip paramStr:(" align:#left offset:[182,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[240,"+ (-18 + maxwellLLister.yOffset) as string + "]")
)
else if isMaxwellLight == false then
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) Multip paramStr:(" align:#left offset:[102,"+ (-18 + maxwellLLister.yOffset) as string + "]")
if not (isMRSky or isMRSun) do
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[160,"+ (-18+ maxwellLLister.yOffset) as string + "]")
)
if hasShadow do
(
if ProductAppID == #VIZR then
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Shadows" paramStr:" align:#left offset:[270,-18]"
else
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Shadows" paramStr:(" align:#left offset:[190,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Map Size" paramStr:(" align:#left offset:[332,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Bias" paramStr:(" align:#left offset:[390,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Sm.Range" paramStr:(" align:#left offset:[443,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Transp." paramStr:(" align:#left offset:[495,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Int." paramStr:(" align:#left offset:[535,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Qual." paramStr:(" align:#left offset:[570,"+ (-18 + maxwellLLister.yOffset) as string + "]")
)
)
if hasDecay and ProductAppID != #VIZR do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Decay" paramStr:(" align:#left offset:[612,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Start" paramStr:(" align:#left offset:[690,"+ (-18+ maxwellLLister.yOffset) as string + "]")
)
if hasSize and ProductAppID != #VIZR do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Length" paramStr:(" align:#left offset:[612,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Width/Radius" paramStr:(" align:#left offset:[671,"+ (-18 + maxwellLLister.yOffset) as string + "]")
)
if isMRSky do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Haze" paramStr:(" align:#left offset:[161,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "H Height" paramStr:(" align:#left offset:[218,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "H Blur" paramStr:(" align:#left offset:[277,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Ground" paramStr:(" align:#left offset:[333,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Night" paramStr:(" align:#left offset:[382,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Redness" paramStr:(" align:#left offset:[420,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Saturation" paramStr:(" align:#left offset:[480,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "UseAerialPersp" paramStr:(" align:#left offset:[540,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "AerialPersp" paramStr:(" align:#left offset:[620,"+ (-18 + maxwellLLister.yOffset) as string + "]")
)
if isMRSun do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Shadows" paramStr:(" align:#left offset:[159,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Softness" paramStr:(" align:#left offset:[211,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Samples" paramStr:(" align:#left offset:[258,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Targeted" paramStr:(" align:#left offset:[304,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Distance" paramStr:(" align:#left offset:[353,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Inherit" paramStr:(" align:#left offset:[426,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Haze" paramStr:(" align:#left offset:[463,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "H Height" paramStr:(" align:#left offset:[513,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Redness" paramStr:(" align:#left offset:[561,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Saturation" paramStr:(" align:#left offset:[609,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Use Targ" paramStr:(" align:#left offset:[663,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Radius" paramStr:(" align:#left offset:[712,"+ (-18 + maxwellLLister.yOffset) as string + "]")
)
if isMRSkyPortal do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Shadows" paramStr:(" align:#left offset:[190,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Extend" paramStr:(" align:#left offset:[240,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Samples" paramStr:(" align:#left offset:[280,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Length" paramStr:(" align:#left offset:[335,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Width" paramStr:(" align:#left offset:[408,"+ (-18+ maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Flip Flux" paramStr:(" align:#left offset:[478,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Visible" paramStr:(" align:#left offset:[525,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Transparency" paramStr:(" align:#left offset:[560,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Source" paramStr:(" align:#left offset:[640,"+ (-18 + maxwellLLister.yOffset) as string + "]")
)
if isMaxwellLight do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Light Type" paramStr:(" align:#left offset:[102,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color Type" paramStr:(" align:#left offset:[160,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Emission" paramStr:(" align:#left offset:[215,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[223,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Correlated" paramStr:(" align:#left offset:[265,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[277,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Lum. Type" paramStr:(" align:#left offset:[330,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Watts" paramStr:(" align:#left offset:[395,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Efficacy" paramStr:(" align:#left offset:[445,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Luminance" paramStr:(" align:#left offset:[495,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "IES" paramStr:(" align:#left offset:[625,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Intensity" paramStr:(" align:#left offset:[610,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Temp." paramStr:(" align:#left offset:[670,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "MXI / HDR" paramStr:(" align:#left offset:[720,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Intensity" paramStr:(" align:#left offset:[723,"+ (-6 + maxwellLLister.yOffset) as string + "]")
)
if isMxLight do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Light Type" paramStr:(" align:#left offset:[102,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color Type" paramStr:(" align:#left offset:[160,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Emission" paramStr:(" align:#left offset:[215,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[223,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Correlated" paramStr:(" align:#left offset:[265,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[277,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Lum. Type" paramStr:(" align:#left offset:[330,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Watts" paramStr:(" align:#left offset:[395,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Efficacy" paramStr:(" align:#left offset:[445,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Luminance" paramStr:(" align:#left offset:[495,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "IES" paramStr:(" align:#left offset:[625,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Intensity" paramStr:(" align:#left offset:[610,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Temp." paramStr:(" align:#left offset:[670,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "MXI / HDR" paramStr:(" align:#left offset:[720,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Intensity" paramStr:(" align:#left offset:[723,"+ (-6 + maxwellLLister.yOffset) as string + "]")
)
if isMxLightSpot do
(
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Fall-off Type" paramStr:(" align:#left offset:[540,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color Type" paramStr:(" align:#left offset:[100,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Emission" paramStr:(" align:#left offset:[155,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) " Color" paramStr:(" align:#left offset:[160,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Correlated" paramStr:(" align:#left offset:[200,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Color" paramStr:(" align:#left offset:[210,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Lum. Type" paramStr:(" align:#left offset:[265,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Watts" paramStr:(" align:#left offset:[328,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Efficacy" paramStr:(" align:#left offset:[382,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Luminance" paramStr:(" align:#left offset:[435,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) " " paramStr:(" align:#left offset:[625,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Cone Angle" paramStr:(" align:#left offset:[606,"+ (-6 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Fall-Off" paramStr:(" align:#left offset:[670,"+ (-18 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) " " paramStr:(" align:#left offset:[720,"+ (-30 + maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addControl #label (lbname()) "Blur" paramStr:(" align:#left offset:[732,"+ (-6 + maxwellLLister.yOffset) as string + "]")
)
-- End Localization
)
fn CreateControls hasShadow:true hasDecay:false hasSize:false Multiplier:#multiplier ColorType:#Color isLuminaire:false isMRSky:false isMRSun:false isMRSkyPortal:false isMaxwellLight:false isMxLight:false isMxLightSpot:false = -- AB: Jun 20, 2002
(
-- Selection Checkbox
if isMaxwellLight == false then
(
local isLightSelected = false
for i in maxwellLLister.LightIndex[maxwellLLister.count] where (not isLightSelected) do
isLightSelected = i.isSelected
)
maxwellLLister.UIControlList[1][maxwellLLister.count] = maxwellLLister.LightIndex[maxwellLLister.count][1]
maxwellLLister.UIControlList[2][maxwellLLister.Count] = #() --this needs to execute for all luminaires
if isMaxwellLight == false then --use the checkbutton for traditional lights
(
maxwellLLister.maxLightsRC.addControl #checkbutton (("LightSel" + maxwellLLister.count as string) as name) "" \
paramStr:("checked:" + (isLightSelected as string) + " offset:[-5,"+ (-2+ maxwellLLister.yOffset + maxwellLLister.LineOffset) as string + "] align:#left" +\
" width:10 height:20 ")
maxwellLLister.maxLightsRC.addHandler (("LightSel" + maxwellLLister.count as string) as name) #'changed state' filter:on \
codeStr: \
(
"clearCheckButtons();if state then (max modify mode;select maxwellLLister.LightIndex[" + maxwellLLister.count as string + "];LightSel" + (maxwellLLister.count as string) + ".checked = true); else max select none"
)
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightSel" + maxwellLLister.count as string) as name)
)
else --for maxwell lights, use a regular button since it's a little unclear how to elegantly handle the 'selected' state
(
maxwellLLister.maxLightsRC.addControl #button (("LightSel" + maxwellLLister.count as string) as name) "" \
paramStr:(" offset:[-5,"+ (-2+ maxwellLLister.yOffset + maxwellLLister.LineOffset) as string + "] align:#left" +" width:10 height:20 ")
maxwellLLister.maxLightsRC.addHandler (("LightSel" + maxwellLLister.count as string) as name) #pressed filter:on \
codeStr: \
(
"for i in maxwellLLister.maxwellLightMatPairs do (" + \
" if i[1] == maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] then (selset = for j in objects where (j.material == i[2]) collect j;select selSet))"
) -- first find out which material this emitter is part of (using previously stored emitter / material pair array) then scan all objects and select those with the right material
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightSel" + maxwellLLister.count as string) as name)
)
-- On/Off
if isLuminaire == false do
(
if isMxLight == true or isMxLightSpot == true then(
maxwellLLister.maxLightsRC.addControl #checkbox (("LightOn" + maxwellLLister.count as string) as name) "" \
paramStr:("checked:" + ((maxwellLLister.GetlightProp maxwellLLister.LightIndex[maxwellLLister.count][1].baseObject #enabled) as string) + " offset:[8,"+ (-22+ maxwellLLister.yOffset) as string + "] width:18")
maxwellLLister.maxLightsRC.addHandler (("LightOn" + maxwellLLister.count as string) as name) #'changed state' filter:on \
codeStr:("maxwellLLister.setLightProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1].baseObject #enabled state")
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightOn" + maxwellLLister.count as string) as name)
)else(
maxwellLLister.maxLightsRC.addControl #checkbox (("LightOn" + maxwellLLister.count as string) as name) "" \
paramStr:("checked:" + ((maxwellLLister.GetlightProp maxwellLLister.LightIndex[maxwellLLister.count][1] #enabled) as string) + " offset:[8,"+ (-22+ maxwellLLister.yOffset) as string + "] width:18")
maxwellLLister.maxLightsRC.addHandler (("LightOn" + maxwellLLister.count as string) as name) #'changed state' filter:on \
codeStr:("maxwellLLister.setLightProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] #enabled state")
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightOn" + maxwellLLister.count as string) as name)
)
)
-- Light Name
local isUsingEdittextOffset = 0, editTextSize = 75, vizRoffset = 0
if ProductAppID == #vizR do
(editTextSize += 80; vizRoffset += 80)
if maxwellLLister.LightIndex[maxwellLLister.count].count == 1 then
(
local wrappedName = wrapString maxwellLLister.LightIndex[maxwellLLister.count][1].name
maxwellLLister.maxLightsRC.addControl #edittext (("LightName" + maxwellLLister.count as string) as name) "" \
paramStr:(" text:" + wrappedName + " width:" + editTextSize as string + \
" height:16 offset:[23,"+ (-21+ maxwellLLister.yOffset) as string + "] height:21")
if isMaxwellLight == false then --code for normal light is the same
(
maxwellLLister.maxLightsRC.addHandler (("LightName" + maxwellLLister.count as string) as name) #'entered txt' filter:on \
codeStr:("maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1].name = txt")
)
else
(
maxwellLLister.maxLightsRC.addHandler (("LightName" + maxwellLLister.count as string) as name) #'entered txt' filter:on \
codeStr: \
(
"for i in maxwellLLister.maxwellLightMatPairs do (" + \
" if i[1] == maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] then (i[2].name = txt))"
) -- first find out which material this emitter is part of (using previously stored emitter / material pair array), then change the material's name
)
isUsingEdittextOffset = 4
)
else --I think this only executes for Luminaires, but I'm not 100% sure - EM
(
theNames = for j in maxwellLLister.LightIndex[maxwellLLister.count] collect j.name
sort theNames
namelist = "#("
for j in 1 to theNames.count do
(
local wrappedName = wrapString theNames[j]
append namelist wrappedName
if j != theNames.count do
append namelist ","
)
append namelist ")"
maxwellLLister.maxLightsRC.addControl #dropDownList (("LightName" + maxwellLLister.count as string) as name) "" filter:on\
paramStr:(" items:" + NameList + " width:" + ((editTextSize-2) as string) + " offset:[27,"+ (-22+ maxwellLLister.yOffset) as string + "] ")
)
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightName" + maxwellLLister.count as string) as name)
-- Light Multiplier
-- AB: Jun 20, 2002
-- Increased Limits for the spinners from 10,000 to 1,000,000
if isMaxwellLight == false and isMxLight == false and isMxLightSpot == false then
(
if Multiplier == #multiplier or Multiplier == #skymult then
(
local lowerLimit = -1000000
local upperLimit = 1000000
if isMRSky do
(
lowerLimit = 0
upperLimit = 15
)
if isMRSun do
(
lowerLimit = 0
upperLimit = 10
)
if isMRSkyPortal do
(
lowerLimit = 0
)
maxwellLLister.maxLightsRC.addControl #spinner (("LightMult" + maxwellLLister.count as string) as name) "" \
paramStr:("range:[" + lowerLimit as string + "," + upperLimit as string + "," + \
(maxwellLLister.getLightProp maxwellLLister.LightIndex[maxwellLLister.count][1] Multiplier) as string + "] type:#float " + \
"fieldwidth:45 align:#left offset:[" + (100 + vizRoffset) as string + \
"," + (isUsingEdittextOffset-24+maxwellLLister.yOffset) as string + "] enabled:" + \
((if isProperty maxwellLLister.LightIndex[maxwellLLister.count][1] Multiplier then \
if maxwellLLister.LightIndex[maxwellLLister.count][1].multiplier.controller != undefined then \
maxwellLLister.LightIndex[maxwellLLister.count][1].multiplier.controller.keys.count >= 0 else true \
else try(if isProperty maxwellLLister.LightIndex[maxwellLLister.count][1].delegate Multiplier then \
if maxwellLLister.LightIndex[maxwellLLister.count][1].delegate.multiplier.controller != undefined then \
maxwellLLister.LightIndex[maxwellLLister.count][1].delegate.multiplier.controller.keys.count >= 0 else true) catch(true)\
) as string))
maxwellLLister.maxLightsRC.addHandler (("LightMult" + maxwellLLister.count as string) as name) #'changed val' filter:on \
codeStr:("maxwellLLister.setLightProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] #"+ multiplier + " val")
)
else if Multiplier == #intensity then
(
maxwellLLister.maxLightsRC.addControl #spinner (("LightMult" + maxwellLLister.count as string) as name) "" \
paramStr:("range:[-1000000,1000000," + (maxwellLLister.LightIndex[maxwellLLister.count][1].intensity as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[" + (100 + vizRoffset) as string + \
"," + (isUsingEdittextOffset-24+maxwellLLister.yoffset) as string + "] enabled:" + \
((if isProperty maxwellLLister.LightIndex[maxwellLLister.count][1] #intensity then \
if maxwellLLister.LightIndex[maxwellLLister.count][1].intensity.controller != undefined then \
maxwellLLister.LightIndex[maxwellLLister.count][1].intensity.controller.keys.count >= 0 else true \
else try(if isProperty maxwellLLister.LightIndex[maxwellLLister.count][1].delegate #intensity then \
if maxwellLLister.LightIndex[maxwellLLister.count][1].delegate.intensity.controller != undefined then \
maxwellLLister.LightIndex[maxwellLLister.count][1].delegate.intensity.controller.keys.count >= 0 else true) catch(true)\
) as string))
maxwellLLister.maxLightsRC.addHandler (("LightMult" + maxwellLLister.count as string) as name) #'changed val' filter:on \
codeStr:("maxwellLLister.setLightProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] #intensity val")
)
else if Multiplier == #dimmer then
(
maxwellLLister.maxLightsRC.addControl #spinner (("LightMult" + maxwellLLister.count as string) as name) "" \
paramStr:("range:[-1000000,1000000," + (maxwellLLister.LightIndex[maxwellLLister.count][1].dimmer as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[" + (100 + vizRoffset) as string + "," + \
(isUsingEdittextOffset-24+maxwellLLister.yOffset) as string + "]")
maxwellLLister.maxLightsRC.addHandler (("LightMult" + maxwellLLister.count as string) as name) #'changed val' filter:on \
codeStr:("maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1].dimmer = val")
)
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightMult" + maxwellLLister.count as string) as name)
-- Light Color
-- AB: Jun 20, 2002
-- Added ColorType parameter to the function, so I can call FilterColor for Photometric Lights
if ColorType == #Color or ColorType == #FilterColor or ColorType == #rgbFilter then
(
maxwellLLister.maxLightsRC.addControl #colorpicker (("LightCol" + maxwellLLister.count as string) as name) "" \
paramStr:("color:" + (maxwellLLister.getLightProp maxwellLLister.LightIndex[maxwellLLister.count][1] ColorType) as string + \
" offset:[" + (158 + vizRoffset) as string + ","+ (-23+ maxwellLLister.yOffset) as string + "] width:25")
maxwellLLister.maxLightsRC.addHandler (("LightCol" + maxwellLLister.count as string) as name) #'changed val' filter:on \
codeStr:("maxwellLLister.setLightProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] #" + ColorType as string + " val")
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightCol" + maxwellLLister.count as string) as name)
)
)
if hasShadow do
(
-- Shadow On/Off
maxwellLLister.maxLightsRC.addControl #checkbox (("LightShdOn" + maxwellLLister.count as string) as name) "" \
paramStr:("checked:" + (maxwellLLister.getLightProp maxwellLLister.LightIndex[maxwellLLister.count][1].baseObject #castshadows as string)+ \
" offset:[" + (190 + vizRoffset) as string + ","+ (-22+ maxwellLLister.yOffset) as string + "] width:15")
maxwellLLister.maxLightsRC.addHandler (("LightShdOn" + maxwellLLister.count as string) as name) #'changed state' filter:on \
codeStr:("maxwellLLister.setLightProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1].baseobject #castshadows state")
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightShdOn" + maxwellLLister.count as string) as name)
-- Shadow Plugin
if ProductAppID != #VIZR do
(
local LLshadowClass = maxwellLLister.fnShadowClass maxwellLLister.LightIndex[maxwellLLister.count][1]
local LLshadowGen = (maxwellLLister.getLightProp maxwellLLister.LightIndex[maxwellLLister.count][1] #shadowGenerator)
maxwellLLister.maxLightsRC.addControl #dropDownList (("LightShd" + maxwellLLister.count as string) as name) "" filter:on\
paramStr:(" items:" + maxwellLLister.ShadowPluginsName as string + " width:110 offset:[210,"+ (-24+ maxwellLLister.yOffset) as string + "]" + \
"selection:(finditem maxwellLLister.ShadowPlugins (maxwellLLister.fnShadowClass maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1]))")
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightShd" + maxwellLLister.count as string) as name)
-- Light Map Size
local mapSizeTmp = 512
if LLshadowClass == shadowMap do
mapSizeTmp = LLshadowGen.mapSize
maxwellLLister.maxLightsRC.addControl #spinner (("LightMapSiz" + maxwellLLister.count as string) as name) "" \
paramStr:("range:[0,10000," + (mapSizeTmp as string) + "] type:#integer " + \
"fieldwidth:45 align:#left offset:[330,"+ (-24+ maxwellLLister.yOffset) as string + "] enabled:" \
+ (LLshadowClass == shadowMap or LLShadowClass == mental_ray_shadow_map) as string)
maxwellLLister.maxLightsRC.addHandler (("LightMapSiz" + maxwellLLister.count as string) as name) #'changed val' filter:on \
codeStr:("maxwellLLister.setShdProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] #mapSize val")
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightMapSiz" + maxwellLLister.count as string) as name)
-- Light Bias
local BiasTmp = \
case 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
default: 1.0
)
maxwellLLister.maxLightsRC.addControl #spinner (("LightBias" + maxwellLLister.count as string) as name) "" \
paramStr:("range:[0,10000," + (BiasTmp as string) + "] type:#float " + \
"fieldwidth:45 align:#left offset:[388,"+ (-21+ maxwellLLister.yOffset) as string + "] enabled:" \
+ (LLShadowClass == shadowMap or LLShadowClass == raytraceShadow or LLShadowClass == Blur_Adv__Ray_Traced or\
LLShadowClass == Area_Shadows or LLShadowClass == Adv__Ray_Traced) as string)
maxwellLLister.maxLightsRC.addHandler (("LightBias" + maxwellLLister.count as string) as name) #'changed val' filter:on \
codeStr: \
(
"local propname = case (maxwellLLister.fnShadowClass maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1]) of\n" + \
"(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 maxwellLLister.SetShdProp maxwellLLister.LightIndex[" + maxwellLLister.count as string + "][1] propName val"
)
append maxwellLLister.UIControlList[2][maxwellLLister.Count] (("LightBias" + maxwellLLister.count as string) as name)
-- Light Sample Range
local smpRangeTmp = 4.0
local smpRangeStr = "#samplerange" --fix the mr shadow sample problem here.
if LLShadowClass == shadowMap then smpRangeTmp = LLShadowGen.samplerange
else if LLShadowClass == mental_ray_Shadow_Map do
(