-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAL_Check_Scene.js
More file actions
1124 lines (712 loc) · 28.5 KB
/
AL_Check_Scene.js
File metadata and controls
1124 lines (712 loc) · 28.5 KB
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
/****************************** C H E C K S C E N E **************************
/*Version du 18/12/2020
V 2
don't use embeded pivot
et separate coords.
Alexandre Cormier*/
/*www.alarigger.com*/
/*
limite le script à un groupe selectionne
*/
function AL_Check_Scene() {
/*VARIABLES*/
var cf = frame.current();
var root_node = "";
var relevent_types = ["READ", "COMPOSITE", "PEG"];
var nodes_to_treat = [];
var fix_list = []
var exclusionList= []
var TARGET = "GROUP";
var substituions_tab = {
columns: [],
drawings: [],
substitions: []
}
var scene_drawings =[];
var scene_composites =[];
var scene_pegs =[];
var scene_MC =[];
var Final_message = "Repport : \n";
var drawing_repport = "BAD DRAWINGS : ";
var message_bad_mc_list = "BAD MC \n";
var final_regex = /\b-GUIDE|\bGUI|\bTIGE_paupiere|\bOMBRE/g;
var OVEWRITE_KEYS = false;
/*FIX VAR*/
var available_fixes_list = [];
var available_types_list = [];
var selected_types = [];
var selected_fixes = [];
var typeBoxes = []
var fixBoxes = []
var fix_count = {}
var type_count = {}
/*EXECUTION*/
MessageLog.trace("-------AL_Check_Scene-------");
scene.beginUndoRedoAccum("AL_Check_Scene");
//fetch_nodes();
fetch_nodes_in_group();
reset_sub_tab()
Final_message += check_drawings();
Final_message += check_pegs()
Final_message += check_composites()
show_repport()
build_available_fixes_and_types_list()
inputDialog()
scene.endUndoRedoAccum();
MessageLog.trace("--------ENDLOG-");
/*FUNCTIONS*/
/*I N P U T D I A L O G*/
function inputDialog() {
MessageLog.trace("inputDialog")
var d = new Dialog
d.title = "CHECK SCENE";
d.width = 100;
var all_nodes = 0;
var inputL = new LineEdit;
var line1 = new Label();
var line2 = new Label();
var line3 = new Label();
var allBox = new CheckBox;
if (available_types_list.length + available_fixes_list.length > 0) {
var line1 = new Label();
line1.text = "\nTypes of nodes to fix : \n";
d.add(line1);
for (var t = 0; t < available_types_list.length; t++) {
var typeBox = new CheckBox
typeBox.text = available_types_list[t] + " ( " + type_count[available_types_list[t]] + " nodes )";
typeBox.nodetype = available_types_list[t];
typeBox.checked = false;
d.add(typeBox);
typeBoxes.push(typeBox);
all_nodes += type_count[available_types_list[t]];
}
var line2 = new Label();
line2.text = "\nTypes of fixes to apply : \n";
d.add(line2);
for (var f = 0; f < available_fixes_list.length; f++) {
var fixBox = new CheckBox
fixBox.text = available_fixes_list[f] + " ( " + fix_count[available_fixes_list[f]] + " nodes )";
fixBox.fixtype = available_fixes_list[f];
fixBox.checked = true;
d.add(fixBox);
fixBoxes.push(fixBox);
}
var inputL = new LineEdit;
inputL.label = "Exclude nodes with names containing : ";
d.add(inputL);
final_regex = "";
inputL.text = "EXCLUDE";
var line4 = new Label();
line4.text = "\n (more details on the detected issues are availes in the MessageLog) \n";
d.add(line4);
var line3 = new Label();
line3.text = "\n**************\n";
d.add(line3);
allBox.text = "FIX THEM ALL !" + " ( " + all_nodes + " nodes )";
allBox.checked = false;
d.add(allBox);
} else {
var line3 = new Label();
line3.text = "\n CONGRATULATION, THE "+TARGET+" IS CLEAN ! (according to the script) \n";
d.add(line3);
}
var rc = d.exec();
if (rc) {
if (allBox.checked != undefined && allBox.checked == true) {
selected_types = available_types_list;
selected_fixes = available_fixes_list;
} else {
for (var tb = 0; tb < typeBoxes.length; tb++) {
if (typeBoxes[tb].checked) {
selected_types.push(typeBoxes[tb].nodetype)
}
}
for (var fb = 0; fb < fixBoxes.length; fb++) {
if (fixBoxes[fb].checked) {
selected_fixes.push(fixBoxes[fb].fixtype)
}
}
}
if (inputL.text != "" && inputL.text != null) {
exclusionList = inputL.text.split(",");
MessageLog.trace("exclusionList : "+exclusionList)
}
treat_nodes();
}
}
function fetch_all_nodes() {
MessageLog.trace("fetch_nodes")
scene_drawings = node.getNodes([relevent_types[0]]);
scene_composites = node.getNodes([relevent_types[1]]);
scene_pegs = node.getNodes([relevent_types[2]]);
scene_MC = node.getNodes([relevent_types[3]]);
}
function fetch_nodes_in_group() {
MessageLog.trace("fetch_nodes_in_group");
//Rassemble les nodes à traiter
var groups_to_analyse = [];
var selected_nodes = selection.selectedNodes(0);
//MessageLog.trace(selected_nodes)
root_node = selected_nodes[0];
var parent_group = node.parentNode(root_node) ;
groups_to_analyse.push(parent_group);
if( selection.numberOfNodesSelected()>0){
var selected_nodes = selection.selectedNodes(0);
//Première boucle parmis les nodes selectionnés
for(var n = 0; n < selection.numberOfNodesSelected(); n++){
var currentNode = selected_nodes[n];
if(node.type(currentNode)=="GROUP"){
groups_to_analyse.push(currentNode);
}
}
var number_of_groups = groups_to_analyse.length;
//deuxième boucle recursive à travers les groupes
for (var g = 0 ; g < number_of_groups ; g ++){
currentGroup = groups_to_analyse[g];
var subNodesInGroup= node.numberOfSubNodes(currentGroup);
for (var sn = 0 ; sn < subNodesInGroup; sn++){
var sub_node_name = node.subNode(currentGroup,sn);
var sub_node = node.subNodeByName(currentGroup,sub_node_name);
var sub_node_type = node.type(sub_node_name);
var shortname = getShortName(sub_node_name)
switch(sub_node_type){
case relevent_types[0]:
scene_drawings.push(sub_node_name)
break;
case relevent_types[1] :
scene_composites.push(sub_node_name)
break;
case relevent_types[2] :
scene_pegs.push(sub_node_name)
break;
case relevent_types[3]:
scene_MC.push(sub_node_name)
break;
}
}
}
}else{
fetch_all_nodes();
TARGET = "SCENE";
}
}
function show_repport() {
Final_message += "";
MessageLog.trace(Final_message);
}
function check_drawings() {
drawing_repport = "\n\n ****** D R A W I N G S \n\n";
for (var i = 0; i < scene_drawings.length; i++) {
currentNode = scene_drawings[i];
var currentName = node.getName(currentNode)
var problemes_list = [];
if (node.getTextAttr(currentNode, cf, "canAnimate") == "Y") {
problemes_list.push("Animate using animation tool is ON !");
fix_list.push(new Fix("TURN OFF ANIMATE", currentNode));
}
if (node.getTextAttr(currentNode, cf, "useDrawingPivot") != "Don't Use Embedded Pivot") {
problemes_list.push("Pivot Embedded on parent peg !");
fix_list.push(new Fix("DONT USE PIVOT", currentNode));
}
if(keys_in_exposure(currentNode)==true){
problemes_list.push("Keys in exposure !");
fix_list.push(new Fix("REMOVE KEYS IN EXPOSURE", currentNode));
}
if (problemes_list.length > 0) {
var current_repport = currentName + "\n"
for (var p = 0; p < problemes_list.length; p++) {
current_repport += problemes_list[p] + "\n";
}
drawing_repport += "!-----> " + current_repport + "\n";
}
}
return drawing_repport;
}
function select_and_tag_node(n){
selection.addNodeToSelection(n);
node.setTimelineTag(n, true)
}
function keys_in_exposure(drawing) {
MessageLog.trace("-------look_for_keys_in_exposure-------");
var check = false;
var drawingcolumn = getDrawingColumn(drawing)
/*Checking every transform parameters*/
var linkedColumnX = node.linkedColumn(drawing,"offset.x");
var linkedColumnY = node.linkedColumn(drawing,"offset.y");
var linkedColumnZ = node.linkedColumn(drawing,"offset.z");
var linkedColumnSX = node.linkedColumn(drawing,"scale.x");
var linkedColumnSY = node.linkedColumn(drawing,"scale.y");
var linkedColumnAZ = node.linkedColumn(drawing,"rotation.anglez");
var linkedColumnSK = node.linkedColumn(drawing,"skew");
if(linkedColumnX!= ""){
check = true;
}
if (linkedColumnY!= ""){
check = true;
}
if (linkedColumnZ!= ""){
check = true
}
if(linkedColumnSX!= ""){
check = true;
}
if (linkedColumnSY!= ""){
check = true;
}
if (linkedColumnAZ!= ""){
check = true
}
if (linkedColumnSK!= ""){
check = true
}
MessageLog.trace(node.linkedColumn(drawing,"offset"))
MessageLog.trace(node.linkedColumn(drawing,"offset.x"))
MessageLog.trace(node.linkedColumn(drawing,"offset.y"))
return check;
}
function clear_keys_in_exposure(drawing,cf) {
MessageLog.trace("-------clear_keys_in_exposure-------");
//node.setTextAttr(drawing, "canAnimate", cf, "Y");
//node.setTextAttr(this.node_to_fix, "useDrawingPivot", cf, "Apply Embedded Pivot on Drawing Layer");
var linkedColumnX = node.linkedColumn(drawing,"offset.x");
var linkedColumnY = node.linkedColumn(drawing,"offset.y");
var linkedColumnZ = node.linkedColumn(drawing,"offset.z");
var linkedColumnSX = node.linkedColumn(drawing,"scale.x");
var linkedColumnSY = node.linkedColumn(drawing,"scale.y");
var linkedColumnAZ = node.linkedColumn(drawing,"rotation.anglez");
var linkedColumnSK = node.linkedColumn(drawing,"skew");
if(linkedColumnX!= ""&& column.isKeyFrame(linkedColumnX,0,cf)){
column.clearKeyFrame(linkedColumnX, f)
}
if(linkedColumnY!= "" && column.isKeyFrame(linkedColumnY,0,cf)){
column.clearKeyFrame(linkedColumnY, f)
}
if(linkedColumnZ!= "" && column.isKeyFrame(linkedColumnZ,0,cf)){
column.clearKeyFrame(linkedColumnZ, f)
}
if(linkedColumnSX!= ""&& column.isKeyFrame(linkedColumnSX,0,cf)){
column.clearKeyFrame(linkedColumnSX, f)
}
if(linkedColumnSY!= "" && column.isKeyFrame(linkedColumnSY,0,cf)){
column.clearKeyFrame(linkedColumnSY, f)
}
if(linkedColumnAZ!= "" && column.isKeyFrame(linkedColumnAZ,0,cf)){
column.clearKeyFrame(linkedColumnAZ, f)
}
if(linkedColumnSK!= "" && column.isKeyFrame(linkedColumnSK,0,cf)){
column.clearKeyFrame(linkedColumnAZ, f)
}
if(linkedColumnX!= ""){
node.unlinkAttr(drawing, "offset.x");
column.removeUnlinkedFunctionColumn (linkedColumnX)
}
if(linkedColumnY!= ""){
node.unlinkAttr(drawing, "offset.y");
column.removeUnlinkedFunctionColumn (linkedColumnY)
}
if(linkedColumnZ!= ""){
node.unlinkAttr(drawing, "offset.z");
column.removeUnlinkedFunctionColumn (linkedColumnZ)
}
if(linkedColumnSX!= ""){
node.unlinkAttr(drawing, "scale.x");
column.removeUnlinkedFunctionColumn (linkedColumnSX)
}
if(linkedColumnSY!= ""){
node.unlinkAttr(drawing,"scale.y");
column.removeUnlinkedFunctionColumn (linkedColumnSY)
}
if(linkedColumnAZ!= ""){
node.unlinkAttr(drawing, "rotation.anglez");
column.removeUnlinkedFunctionColumn (linkedColumnAZ)
}
if(linkedColumnSK!= ""){
node.unlinkAttr(drawing, "skew");
column.removeUnlinkedFunctionColumn (linkedColumnSK)
}
}
function getDrawingColumn(drawing) {
for (var i = 0; i < Timeline.numLayers; i++) {
if (Timeline.layerIsColumn(i)) {
var currentColumn = Timeline.layerToColumn(i);
if (column.type(currentColumn) == "DRAWING") {
var drawing_node = Timeline.layerToNode(i);
if (drawing_node == drawing) {
return currentColumn;
}
}
}
}
}
function check_composites() {
composites_repport = "\n\n ****** C O M P O S I T E S \n\n";
for (var i = 0; i < scene_composites.length; i++) {
currentNode = scene_composites[i];
var problemes_list = [];
var currentName = node.getName(currentNode)
if (node.getTextAttr(currentNode, cf, "compositeMode") != "Pass Through") {
problemes_list.push("not in passthrougth");
fix_list.push(new Fix("COMPOSITE IN PASS THROUGH", currentNode));
}
if (problemes_list.length > 0) {
var current_repport = currentName + "\n"
for (var p = 0; p < problemes_list.length; p++) {
current_repport += problemes_list[p] + "\n";
}
selection.addNodeToSelection(currentNode);
node.setTimelineTag(currentNode, true)
composites_repport += "!-----> " + current_repport + "\n";
//MessageBox.information("!-----> "+current_repport+"\n")
}
}
return composites_repport
}
/* P E G */
function get_separate(n){
var s_attr = "POSITION.SEPARATE";
var result = node.getTextAttr(n,frame.current(),"POSITION.SEPARATE");
if(result != null){
return result;
}
return false;
}
function set_separate_on(n){
var s_attr = "POSITION.SEPARATE";
node.setTextAttr(n,"POSITION.SEPARATE",frame.current(),"On");
}
function getAttributesNameList (snode){
//MessageLog.trace(arguments.callee.name)
var attrList = node.getAttrList(snode, frame.current(),"");
var name_list= Array();
for (var i=0; i<attrList.length; i++){
var attr = attrList[i];
var a_name = attr.keyword();
var sub_attr = attr.getSubAttributes()
name_list.push(a_name);
if(sub_attr.length > 0){
for (var j=0; j<sub_attr.length; j++){
attrList.push(sub_attr[j]);
var sub_attr_name = sub_attr[j].fullKeyword()
name_list.push(sub_attr_name);
}
}
}
return name_list;
}
function check_pegs() {
var pegs_repport = "\n\n ****** P E G S \n\n"
for (var i = 0; i < scene_pegs.length; i++) {
var problemes_list = [];
var currentNode = scene_pegs[i]
var currentName = node.getName(currentNode);
var keys = get_Keys(currentNode);
var rest = get_Rest(currentNode)
var separate = get_separate(currentNode);
MessageLog.trace("separate : ");
MessageLog.trace(separate);
if (rest.z > 2 && keys.z != 0) {
problemes_list.push("Z value is too high : " + rest.z)
fix_list.push(new Fix("CHANGE Z TO 0", currentNode));
}
if (rest.scalex != 1 && keys.scalex != 1) {
problemes_list.push("SCALE X value not egal to 1 : " + rest.scalex)
fix_list.push(new Fix("CHANGE SCALE X TO 1", currentNode));
}
if (rest.scaley != 1&& keys.scaley != 1) {
problemes_list.push("SCALE Y value not egal to 1: " + rest.scaley)
fix_list.push(new Fix("CHANGE SCALE Y TO 1", currentNode));
}
if (rest.skew != 0&& keys.skew != 0) {
problemes_list.push("SKEW values : " + rest.skew)
fix_list.push(new Fix("CHANGE SKEW TO 0", currentNode));
}
if (separate == "Off") {
problemes_list.push("SEPARATE OFF")
fix_list.push(new Fix("TURN SEPARATE ON", currentNode));
}
if (problemes_list.length > 0) {
var current_repport = node.getName(currentNode) + "\n"
for (var p = 0; p < problemes_list.length; p++) {
current_repport += problemes_list[p] + "\n";
}
selection.addNodeToSelection(currentNode);
node.setTimelineTag(currentNode, true)
pegs_repport += "!-----> " + current_repport + "\n" + "\n";
//MessageBox.information("!-----> "+current_repport+"\n")
}
}
return pegs_repport;
}
function get_Rest(peg) {
var Z = 0
var rest = {
z: 0,
scalex: 0,
scaley: 0,
skew: 0
}
rest.z = node.getTextAttr(peg, cf, "position.z");
rest.scalex = node.getTextAttr(peg, cf, "scale.x");
rest.scaley = node.getTextAttr(peg, cf, "scale.y");
rest.skew = node.getTextAttr(peg, cf, "SKEW");
return rest;
}
function get_linked_columns(_node){
var attr_colmun_list = Array();
var attrList = getAttributesNameList (_node);
for (var i=0; i<attrList.length; i++){
var attribute_name = attrList[i]
var linked_column = node.linkedColumn(_node,attribute_name)
if( linked_column !=""){
var att_col = {attr:attribute_name,col:linked_column};
attr_colmun_list.push(att_col);
}
}
return attr_colmun_list;
}
function get_Keys(peg) {
var sceneFrames = frame.numberOf();
var number_of_columns = column.numberOf()
var repport = "";
//those should sty at 0 or 1
var keys = {
z: 0,
scalex: 1,
scaley: 1,
skew: 0
}
var Z_key_values = []
var Scale_x_key_values = []
var Scale_y_key_values = []
var Skew_key_values = []
var linked_column = get_linked_columns(peg);
for (var f = 0; f < sceneFrames + 1; f++) {
for (var c = 0; c < linked_column.length; c++) {
var atcol = linked_column[c];
var cur_attribute = atcol.attr;
var cur_colmun = atcol.col;
switch (atcol.attr){
case("SCALE.X"):
keys.scalex*=column.getEntry(cur_colmun, 1, f)
break;
case("SCALE.Y"):
keys.scaley*=column.getEntry(cur_colmun, 1, f)
break;
case("SCALE.XY"):
break;
case("SKEW"):
keys.skew+=column.getEntry(cur_colmun, 1, f)
break;
case("POSITION.Z"):
keys.z*=column.getEntry(cur_colmun, 1, f)
break;
}
}
}
return keys;
}
/*************************************/
function treat_nodes() {
var repport = ""
MessageLog.trace("treat_nodes")
MessageLog.trace(fix_list.length)
MessageLog.trace("selected fixes :"+selected_fixes)
MessageLog.trace("selected types :"+selected_types)
for (var i = 0; i < fix_list.length; i++) {
current_fix = fix_list[i];
node_type = node.type(current_fix.node_to_fix)
/*Clear keyframes*/
for (var f = 0; f < frame.numberOf() + 1; f++) {
if (!check_name_pattern(current_fix.node_to_fix)) {
if (includes(selected_types,node_type) && includes(selected_fixes, current_fix.fixtype)) {
MessageLog.trace("fix "+i+"----"+current_fix)
current_fix.apply(f);
select_and_tag_node(current_fix.node_to_fix)
}
}
}
}
}
function build_available_fixes_and_types_list() {
var stored_nodes = []
MessageLog.trace("build_available_fixes_and_types_list")
for (var i = 0; i < fix_list.length; i++) {
current_fix = fix_list[i];
node_type = node.type(current_fix.node_to_fix)
if (!includes(available_fixes_list, current_fix.fixtype)) {
available_fixes_list.push(current_fix.fixtype)
}
if (!includes(available_types_list, node_type)) {
available_types_list.push(node_type)
}
/*COMPTE DES FIXES ET TYPES*/
if (!includes(stored_nodes, current_fix.node_to_fix)) {
if (node_type in type_count) {
type_count[node_type] += 1
} else {
type_count[node_type] = 1;
}
stored_nodes.push(current_fix.node_to_fix)
} else {
}
if (current_fix.fixtype in fix_count) {
fix_count[current_fix.fixtype] += 1
} else {
fix_count[current_fix.fixtype] = 1;
}
}
}
/* CLASS FIX */
function Fix(fixtype, node_to_fix) {
this.fixtype = fixtype;
this.node_to_fix = node_to_fix
this.apply = function(cf) {
MessageLog.trace("APPLY FIX")
var repport = this.fixtype + " ";
var linked_column ="";
switch (this.fixtype) {
case "TURN OFF ANIMATE":
node.setTextAttr(this.node_to_fix, "canAnimate", cf, "N");
break;
case "DONT USE PIVOT":
node.setTextAttr(this.node_to_fix, "useDrawingPivot", cf, "Don't Use Embedded Pivot");
break;
case "REMOVE KEYS IN EXPOSURE":
clear_keys_in_exposure(this.node_to_fix)
break;
case "CHANGE SCALE X TO 1":
node.setTextAttr(this.node_to_fix, "SCALE.X", cf, 1);
node.setTextAttr(this.node_to_fix, "SCALE.XY",cf, 1);
this.apply_to_column("SCALE.X",cf,1);
break;
case "CHANGE SKEW X TO 0":
node.setTextAttr(this.node_to_fix, "SKEW", cf, 1);
break;
case "CHANGE SCALE Y TO 1":
node.setTextAttr(this.node_to_fix, "SCALE", cf, 1);
node.setTextAttr(this.node_to_fix, "SCALE.Y", cf, 1);
node.setTextAttr(this.node_to_fix, "SCALE.XY", cf, 1);
this.apply_to_column("SCALE.Y",cf,1);
break;
case "CHANGE SKEW TO 0":
node.setTextAttr(this.node_to_fix, "SKEW", cf, 0);
this.apply_to_column("SKEW",cf,0);
break;
case "CHANGE Z TO 0":
node.setTextAttr(this.node_to_fix, "POSITION.Z", cf, 0);
this.apply_to_column("POSITION.Z",cf,0);
break;
case "COMPOSITE IN PASS THROUGH":
node.setTextAttr(this.node_to_fix, "compositeMode", cf, "Pass Through");
break;
case "TURN SEPARATE ON":
set_separate_on(this.node_to_fix);
break;
default:
MessageLog.trace("unknown fix type")
}
MessageLog.trace("___" + this.node_to_fix + "----- FIXED ------>" + repport)
return repport
}
this.apply_to_column = function(_attribute,cf,value){
var linked_column = node.linkedColumn(this.node_to_fix,_attribute)
if(column.isKeyFrame(linked_column,0,cf)){
column.setEntry(linked_column,0,cf,value);
}
}
}
function includes(array, item) {
for (var i = 0; i < array.length; i++) {
if (array[i] == item) {
return true;
}
}
return false;
}
function reset_sub_tab() {
substituions_tab = {
columns: [],
drawings: [],
substitions: []
};
}
function get_Attr_Keyframes(n, attr) {
var sceneFrames = frame.numberOf();
var numLayers = Timeline.numLayers;
var rapport = "";
keyframes_tabs = {
columns: [],
nodes: [],
keyframes: []
};
for (var i = 0; i < Timeline.numLayers; i++) {
if (Timeline.layerIsNode(i) && Timeline.layerToNode(i) == d) {