-
Notifications
You must be signed in to change notification settings - Fork 4
/
BatchCameraRender-functions-populating.ms
924 lines (833 loc) · 28.7 KB
/
BatchCameraRender-functions-populating.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
--########################--
--FUNCTIONS for batch camera render script
--########################--
--
--function to populate spinner fields with info from selected list items
fn populate_spinner_field cameraItems property_name rollout_control =
(
local spinner = rollout_control
--collect selected items
local selected_items = cameraItems
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
--fill elements path field
if isNotUndefined temp_string then
-- spinner.value = (temp_string as integer)
spinner.value = execute (temp_string as string)
else
spinner.indeterminate = true
)
else --multiple selection
(
prev_value = ""
diff_flag = false
for i=1 to selected_items.count while not diff_flag do
(
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if isNotUndefined temp_string then
(
--set previous value to first value
if i==1 then prev_value = temp_string
--show path if previous path and current are similar
if temp_string != prev_value then
(
diff_flag = true --set flag if values differ
spinner.indeterminate = true
)
else if not diff_flag then --if values are same and flag hasn't been set
spinner.value = execute (temp_string as string)
prev_value = temp_string
)
else
(
spinner.indeterminate = true
)
)
)
)
--function to populate ui textfield element from given listItems with property name
--this function automaticaly detects if one or several items are selected and
--sets correct textfield text value depend on the content of the listitem
--if the content is equal the this content is displayed, if not "varies" text is shown.
fn populate_text_fields cameraItems property_name rollout_control =
(
local uiTextField = rollout_control
--collect selected items
local selected_items = cameraItems
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
--fill elements path field
if isNotUndefined temp_string then
uiTextField.text = (temp_string as string)
else
uiTextField.text = "undefined"
)
else --multiple selection
(
prev_path = ""
path_diff_flag = false
for i=1 to selected_items.count while not path_diff_flag do
(
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if isNotUndefined temp_string then
(
--set previous value to first value
if i==1 then prev_path = temp_string
--show path if previous path and current are similar
if temp_string != prev_path then
(
path_diff_flag = true --set flag if values differ
uiTextField.text = "Varies"
)
else if not path_diff_flag then --if values are same and flag hasn't been set
uiTextField.text = temp_string
prev_path = temp_string
)
else
(
uiTextField.text = "Varies"
)
)
)
)
--function to populate checkbox from the one or multiple selection of the listview items
fn populate_checkbox_item cameraItems property_name rollout_control =
(
local uiCheckBox = rollout_control
local selected_items = cameraItems
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if isNotUndefined temp_string then
uiCheckBox.state = (temp_string as booleanclass)
else
(
if (classof uiCheckBox) != CheckButtonControl then
uiCheckBox.triState = 2
else
uiCheckBox.state = false
)
)
else --multiple selection
(
prev_state
state_diff_flag = false
for i=1 to selected_items.count while not state_diff_flag do
(
--populate checkbox state for multiple items checked
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if isNotUndefined temp_string then
(
temp_string = (temp_string as booleanclass)
--set previous value to first value
if i==1 then prev_state = temp_string
--show path if previous path and current are the similar
if temp_string != prev_state then
(
state_diff_flag = true --set flag if values differ
if (classof uiCheckBox) != CheckButtonControl then
uiCheckBox.triState = 2
else
uiCheckBox.state = false
)
else if not state_diff_flag then --if values are same and flag hasn't been set
(
uiCheckBox.state = temp_string
)
prev_state = temp_string
)
else
(
if (classof uiCheckBox) != CheckButtonControl then
uiCheckBox.triState = 2
else
uiCheckBox.state = false
)
)
)
)
--function to populate dropdown box with given item number
fn populate_dropdownbox_integer_item cameraItems property_name rollout_control =
(
local uiDropDownBox = rollout_control
--collect selected items
local selected_items = cameraItems
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if (isNotUndefined temp_string) then
uiDropDownBox.selection = (temp_string as integer)
else
uiDropDownBox.selection = 0
)
else --multiple selection
(
prev_state
state_diff_flag = false
for i=1 to selected_items.count while not state_diff_flag do
(
--populate checkbox state for multiple items checked
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if (isNotUndefined temp_string) then
(
--set previous value to first value
if i==1 then prev_state = temp_string
--show path if previous path and current are the similar
if temp_string != prev_state then
(
state_diff_flag = true --set flag if values differ
uiDropDownBox.selection = 0
)
else if not state_diff_flag then --if values are same and flag hasn't been set
uiDropDownBox.selection = (temp_string as integer)
prev_state = temp_string
)
else
(
uiDropDownBox.selection = 0
)
)
)
)
--function to populate dropdown box with given string
fn populate_combobox_string_item cameraItems property_name rollout_control =
(
local uiComboBox = rollout_control
--collect selected items
local selected_items = cameraItems
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if (isNotUndefined temp_string) then
(
if (uiComboBox.FindStringExact temp_string) != -1 then
uiComboBox.SelectedItem = temp_string
else
(
uiComboBox.Items.Add temp_string
uiComboBox.SelectedItem = temp_string
)
)
else
uiComboBox.SelectedIndex = 0
)
else --multiple selection
(
prev_state
state_diff_flag = false
for i=1 to selected_items.count while (not state_diff_flag) do
(
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
temp_string = temp_string as string
if i==1 then prev_state = temp_string
if temp_string != prev_state then
state_diff_flag = true
prev_state = temp_string
)
if state_diff_flag then
uiComboBox.SelectedIndex = -1
else
(
if (uiComboBox.FindStringExact temp_string) != -1 then
uiComboBox.SelectedItem = temp_string
else
(
uiComboBox.Items.Add temp_string
uiComboBox.SelectedItem = temp_string
)
)
)
)
--function to populate dropdown box with given string
fn populate_dropdownbox_string_item cameraItems property_name rollout_control =
(
local uiDropDownBox = rollout_control
--collect selected items
local selected_items = cameraItems
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if (isNotUndefined temp_string) then
uiDropDownBox.selection = finditem (uiDropDownBox.items) temp_string
else
uiDropDownBox.selection = 0
)
else --multiple selection
(
prev_state
state_diff_flag = false
for i=1 to selected_items.count while (not state_diff_flag) do
(
--populate checkbox state for multiple items checked
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself ("BatchCameraRender_" + property_name)
if (isNotUndefined temp_string) then
(
--set previous value to first value
if i==1 then prev_state = temp_string
--show path if previous path and current are the similar
if temp_string != prev_state then
(
state_diff_flag = true --set flag if values differ
uiDropDownBox.selection = 0
)
else if not state_diff_flag then --if values are same and flag hasn't been set
uiDropDownBox.selection = finditem (uiDropDownBox.items) temp_string
prev_state = temp_string
)
else
(
uiDropDownBox.selection = 0
)
)
)
)
--function to populate resolution dropdown box from listitem selection
fn populate_dropdownbox_resolution cameraItems rollout_control =
(
local uiDropDownBox = rollout_control
--collect selected items
local selected_items = cameraItems
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_width = getUserProperty obj_itself "BatchCameraRender_frame_width"
temp_height = getUserProperty obj_itself "BatchCameraRender_frame_heigth"
temp_string = (temp_width as string) + " x " + (temp_height as string)
if (isNotUndefined temp_string) then
uiDropDownBox.selection = finditem (uiDropDownBox.items) temp_string
else
uiDropDownBox.selection = 0
)
else --multiple selection
(
prev_state
state_diff_flag = false
for i=1 to selected_items.count while (not state_diff_flag) do
(
--populate checkbox state for multiple items checked
obj_itself = (selected_items[i]).tag.value
temp_width = getUserProperty obj_itself "BatchCameraRender_frame_width"
temp_height = getUserProperty obj_itself "BatchCameraRender_frame_heigth"
temp_string = (temp_width as string) + " x " + (temp_height as string)
if (isNotUndefined temp_string) then
(
--set previous value to first value
if i==1 then prev_state = temp_string
--show path if previous path and current are the similar
if temp_string != prev_state then
(
state_diff_flag = true --set flag if values differ
uiDropDownBox.selection = 0
)
else if not state_diff_flag then --if values are same and flag hasn't been set
uiDropDownBox.selection = finditem (uiDropDownBox.items) temp_string
prev_state = temp_string
)
else
(
uiDropDownBox.selection = 0
)
)
)
)
--populate frame range parameters
fn populate_framerange cameraItems =
(
lis = cameraItems
rendType1 = Frame_Range_Rollout.rendType1
rendType2 = Frame_Range_Rollout.rendType2
rendType3 = Frame_Range_Rollout.rendType3
rendType5 = Frame_Range_Rollout.rendType5
render_from = Frame_Range_Rollout.render_from
render_to = Frame_Range_Rollout.render_to
render_anim_from = Frame_Range_Rollout.render_anim_from
render_anim_to = Frame_Range_Rollout.render_anim_to
render_frames = Frame_Range_Rollout.render_frames
render_single = Frame_Range_Rollout.render_single
--exclude selected items
local selected_items = #()
for i in lis do
if i.selected then
append selected_items i
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string1 = getUserProperty obj_itself "BatchCameraRender_frames"
temp_string2 = getUserProperty obj_itself "BatchCameraRender_framerange_from"
temp_string5 = getUserProperty obj_itself "BatchCameraRender_anim_frame_range"
if (isNotUndefined temp_string5) then
( --render_frames
rendType1.state = 0
rendType2.state = 0
rendType3.state = 0
rendType5.state = 1
render_anim_from.enabled = render_anim_to.enabled = true
render_single.enabled = render_frames.enabled = render_from.enabled = render_to.enabled = false
temp_frame_range = get_key_range obj_itself
render_anim_from.text = (temp_frame_range[1].frame as integer) as string
render_anim_to.text = (temp_frame_range[2].frame as integer) as string
)
else if (isNotUndefined temp_string1) then
( --render_frames
rendType1.state = 0
rendType2.state = 0
rendType3.state = 1
rendType5.state = 0
render_frames.text = temp_string1 as string
render_from.enabled = render_to.enabled = false
render_frames.enabled = true
)
else if (isNotUndefined temp_string2) then
(
temp_string3 = getUserProperty obj_itself "BatchCameraRender_framerange_to"
if (temp_string2 as integer == temp_string3 as integer) then
( --single frame
rendType1.state = 1
rendType2.state = 0
rendType3.state = 0
rendType5.state = 0
render_from.enabled = render_to.enabled = render_frames.enabled = false
render_single.value = temp_string2 as integer
)
else
( --frame range
rendType1.state = 0
rendType2.state = 1
rendType3.state = 0
rendType5.state = 0
render_single.enabled = false
render_from.enabled = render_to.enabled = true
render_from.value = temp_string2 as integer
render_to.value = temp_string3 as integer
)
)
else
(
--resolution is undefined
case rendTimeType of
(
1: (
rendType1.state = 1
rendType2.state = 0
rendType3.state = 0
rendType5.state = 0
)
2: (
render_from.value = animationRange.start.frame as integer
render_to.value = animationRange.end.frame as integer
rendType1.state = 0
rendType2.state = 1
rendType3.state = 0
rendType5.state = 0
)
3: (
render_from.value = rendStart
render_to.value = rendEnd
rendType1.state = 0
rendType2.state = 1
rendType3.state = 0
rendType5.state = 0
)
4: (
render_frames.text = rendPickupFrames
rendType1.state = 0
rendType2.state = 0
rendType3.state = 1
rendType5.state = 0
)
)
-- rendType1.state = 0
-- rendType2.state = 0
-- rendType3.state = 0
-- rendType5.state = 0
)
)
else --multiple selection
(
)
)
fn populate_elements_options cameraItems=
(
lis = cameraItems
result_file_name = Render_Output_Rollout.result_file_name
elements_path = Render_Output_Rollout.elements_path
elements_state = Render_Output_Rollout.save_elements
not_save_elements = Render_Output_Rollout.not_save_elements
--exclude selected items
local selected_items = #()
for i in lis do
if i.selected then
append selected_items i
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself "BatchCameraRender_elements_output"
--fill elements path field
if (isNotUndefined temp_string) then
elements_path.text = (temp_string as string)
else
elements_path.text = "undefined"
--set state here
temp_string = getUserProperty obj_itself "BatchCameraRender_elements_state"
if (isNotUndefined temp_string) then
elements_state.state = (temp_string as booleanclass)
else
elements_state.triState = 2
--set not save RE here
temp_string = getUserProperty obj_itself "BatchCameraRender_not_save_elements"
if (isNotUndefined temp_string) then
not_save_elements.state = (temp_string as booleanclass)
else
not_save_elements.triState = 2
)
else --multiple selection
(
prev_path = ""
prev_state
path_diff_flag = false
state_diff_flag = false
for i=1 to selected_items.count while not path_diff_flag do
(
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself "BatchCameraRender_elements_output"
if (isNotUndefined temp_string) then
(
--set previous value to first value
if i==1 then prev_path = temp_string
--show path if previous path and current are the similar
if temp_string != prev_path then
(
path_diff_flag = true --set flag if values differ
elements_path.text = "Varies"
)
else if not path_diff_flag then --if values are same and flag hasn't been set
elements_path.text = temp_string
prev_path = temp_string
)
else
(
elements_path.text = "Varies"
)
--populate elemetns state for multiple items checked
temp_string = getUserProperty obj_itself "BatchCameraRender_elements_state"
if (isNotUndefined temp_string) then
(
temp_string = temp_string as booleanclass
--set previous value to first value
if i==1 then prev_state = temp_string
--show path if previous path and current are the similar
if temp_string != prev_state then
(
state_diff_flag = true --set flag if values differ
elements_state.triState = 2
)
else if not state_diff_flag then --if values are same and flag hasn't been set
elements_state.triState = if temp_string then 1 else 0
prev_state = temp_string
)
else
(
elements_state.triState = 2
)
--populate not_save_RE for multiple items checked
temp_string = getUserProperty obj_itself "BatchCameraRender_not_save_elements"
if (isNotUndefined temp_string) then
(
temp_string = temp_string as booleanclass
--set previous value to first value
if i==1 then prev_state = temp_string
--show path if previous path and current are the similar
if temp_string != prev_state then
(
state_diff_flag = true --set flag if values differ
not_save_elements.triState = 2
)
else if not state_diff_flag then --if values are same and flag hasn't been set
not_save_elements.triState = if temp_string then 1 else 0
prev_state = temp_string
)
else
(
not_save_elements.triState = 2
)
)
)
)
fn populate_filename_fields cameraItems=
(
--get selected items
--get filename from one item
--split to name and path
--compare to UIfield text
--if differs then enter "varies" text
--go to next item
result_file_name = Render_Output_Rollout.result_file_name
file_name = Render_Output_Rollout.file_name
file_path = Render_Output_Rollout.file_path
elements_path = Render_Output_Rollout.elements_path
--exclude selected items
local selected_items = #()
for i in cameraItems do
if i.selected then
append selected_items i
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string = getUserProperty obj_itself "BatchCameraRender_render_output"
if (isNotUndefined temp_string) then
(
--put parsed string in full text textfield
result_file_name.text = parse_file_name_template temp_string (compose_parsing_dictionary obj_itself)
file_name.text = filenameFromPath temp_string
file_path.text = getFilenamePath temp_string
)
else
(
result_file_name.text = "undefined"
file_name.text = "undefined"
file_path.text = "undefined"
)
)
else
(
prev_parsed_path = ""
prev_templated_path = ""
prev_path = ""
prev_file = ""
parsed_diff_flag = false
templated_diff_flag = false
path_diff_flag = false
file_diff_flag = false
temp_string = ""
for i=1 to selected_items.count do
(
obj_itself = (selected_items[i]).tag.value
temp_string = getUserProperty obj_itself "BatchCameraRender_render_output"
if (isNotUndefined temp_string) then
(
--if multiple items are selected
--show only similar parts of the filename
-- for the full path textfield consider parsed path string
parsed_path = parse_file_name_template temp_string (compose_parsing_dictionary obj_itself)
--init previous values for the first time
if i==1 then
(
prev_parsed_path = parsed_path
prev_templated_path = temp_string
prev_path = getFilenamePath temp_string
prev_file = filenameFromPath temp_string
)
--flag setting section
if parsed_path != prev_parsed_path then
parsed_diff_flag = true
if temp_string != prev_templated_path then
templated_diff_flag = true
if (getFilenamePath temp_string) != prev_path then
path_diff_flag = true
if (filenameFromPath temp_string) != prev_file then
file_diff_flag = true
prev_parsed_path = parsed_path
prev_templated_path = temp_string
prev_path = getFilenamePath temp_string
prev_file = filenameFromPath temp_string
)
else
(
result_file_name.text = "Varies"
file_name.text = "Varies"
file_path.text = "Varies"
parsed_diff_flag = true
templated_diff_flag = true
path_diff_flag = true
file_diff_flag = true
--put "undefined" text to UI fields
)
)
--set text fields after for loop
-- temp_string = temp_string as string -- as string added in case temp_string is not a string or undefined
if not parsed_diff_flag then
(
--if parsed full paths are similar show all parts
result_file_name.text = temp_string
file_name.text = filenameFromPath temp_string
file_path.text = getFilenamePath temp_string
)
else if not templated_diff_flag then
(
--check if template strings are similar
--show similar file names and folder name
result_file_name.text = "Varies"
file_name.text = filenameFromPath temp_string
file_path.text = getFilenamePath temp_string
)
else if not path_diff_flag then
(
--if full path varies but folder is similar
--show the folder path
--in other parts show "varies" text
result_file_name.text = "Varies"
file_name.text = "Varies"
file_path.text = getFilenamePath temp_string
)
else if not file_diff_flag then
(
--if folder path varies but filename is equal
--show the filename part
--in other parts show "varies" text
result_file_name.text = "Varies"
file_name.text = filenameFromPath temp_string
file_path.text = "Varies"
)
else
(
--if all parts are different
--show "varies" text in all parts
result_file_name.text = "Varies"
file_name.text = "Varies"
file_path.text = "Varies"
)
)
populate_elements_options cameraItems
--populate last render field
populate_text_fields cameraItems "lastRenderPath" Render_Output_Rollout.last_render_path
)
fn populate_light_state cameraItems=
(
lis = cameraItems
solo_lights = Light_Assignement_Rollout.light_box_solo
on_lights = Light_Assignement_Rollout.light_box_forceon
off_lights = Light_Assignement_Rollout.light_box_forceoff
--exclude selected items
local selected_items = #()
for i in lis do
if i.selected then
append selected_items i
if selected_items.count == 1 then
(
obj_itself = (selected_items[1]).tag.value
temp_string1 = getUserProperty obj_itself "BatchCameraRender_solo_lights"
temp_string2 = getUserProperty obj_itself "BatchCameraRender_on_lights"
temp_string3 = getUserProperty obj_itself "BatchCameraRender_off_lights"
if (isNotUndefined temp_string1) then
(
temparray = filterString temp_string1 ","
solo_lights.items = temparray
)
else
(
solo_lights.items = #()
)
if (isNotUndefined temp_string2) then
(
temparray = filterString temp_string2 ","
on_lights.items = temparray
)
else
(
on_lights.items = #()
)
if (isNotUndefined temp_string3) then
(
temparray = filterString temp_string3 ","
off_lights.items = temparray
)
else
(
off_lights.items = #()
)
)
)
fn populate_submit_scripts_section=
(
temp_state = getRootNodeData "BatchCameraRender_OnSubmitScriptEnable"
if isNotUndefinedOrEmpty temp_state then
Scripts_Rollout.enable_onsubmit.state = (temp_state as BooleanClass)
else
Scripts_Rollout.enable_onsubmit.tristate = 2
temp_state = getRootNodeData "BatchCameraRender_OnSubmitScript"
if isNotUndefinedOrEmpty temp_state then
Scripts_Rollout.onsubmit_script.text = (temp_state as string)
else
Scripts_Rollout.onsubmit_script.text = "undefined"
temp_state = getRootNodeData "BatchCameraRender_perCameraScriptEnable"
if isNotUndefinedOrEmpty temp_state then
Scripts_Rollout.enable_percamera_submit.state = (temp_state as BooleanClass)
else
Scripts_Rollout.enable_percamera_submit.tristate = 2
temp_state = getRootNodeData "BatchCameraRender_perCameraScript"
if isNotUndefinedOrEmpty temp_state then
Scripts_Rollout.percamera_submit_script.text = (temp_state as string)
else
Scripts_Rollout.percamera_submit_script.text = "undefined"
)
batchCameraRender_populateScripts = populate_submit_scripts_section
fn populate_script_rollout selectedItems =
(
populate_text_fields selectedItems "prerender_script" Scripts_Rollout.prerender_script
populate_checkbox_item selectedItems "prerender_enabled" Scripts_Rollout.enable_prerender
populate_text_fields selectedItems "postrender_script" Scripts_Rollout.postrender_script
populate_checkbox_item selectedItems "postrender_enabled" Scripts_Rollout.enable_postrender
)
--separate function to populate ui elements in vray rollout
fn populate_vray_options selectedItems =
(
--populate all vray properties for selected items.
--don't know if it's right.
--may be it would be more usefull to populate only properties that really exist in selected item's camera
for vray_property in BatchCam_VrayPropertiesMappingArray do
(
if vray_property.propertyType == "textfield" then
populate_text_fields selectedItems vray_property.propertyName vray_property.propertyUIelement
if vray_property.propertyType == "checkbox" then
populate_checkbox_item selectedItems vray_property.propertyName vray_property.propertyUIelement
if vray_property.propertyType == "dropdownlist" then
populate_dropdownbox_integer_item selectedItems vray_property.propertyName vray_property.propertyUIelement
)
)
fn populate_resolution_options selectedItems =
(
--populate image size fields
populate_spinner_field selectedItems "frame_width" Output_Size_Rollout.frame_width
populate_spinner_field selectedItems "frame_heigth" Output_Size_Rollout.frame_height
populate_spinner_field selectedItems "image_aspect" Output_Size_Rollout.image_aspect_spinner
--display selected resolution
populate_dropdownbox_resolution selectedItems Output_Size_Rollout.out_size_list
populate_checkbox_item selectedItems "region_enabled" Output_Size_Rollout.use_region
populate_spinner_field selectedItems "region_x" Output_Size_Rollout.region_x
populate_spinner_field selectedItems "region_y" Output_Size_Rollout.region_y
populate_spinner_field selectedItems "region_w" Output_Size_Rollout.region_w
populate_spinner_field selectedItems "region_h" Output_Size_Rollout.region_h
)
fn populate_scenestate_renderpreset selectedItems =
(
populate_combobox_string_item selectedItems "scene_state" Scene_States_Rollout.scene_states_list2
populate_dropdownbox_string_item selectedItems "render_preset" Scene_States_Rollout.render_preset_list
populate_dropdownbox_string_item selectedItems "state_set" Scene_States_Rollout.state_sets_list
)
fn populate_ui_elements selectedItems=
(
if selectedItems.count > 0 then
(
populate_resolution_options selectedItems
populate_scenestate_renderpreset selectedItems
populate_filename_fields selectedItems
populate_framerange selectedItems
populate_vray_options selectedItems
populate_script_rollout selectedItems
populate_light_state selectedItems
)
)