-
Notifications
You must be signed in to change notification settings - Fork 13
/
ActionEditor_screens.rpy
3222 lines (2880 loc) · 169 KB
/
ActionEditor_screens.rpy
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
screen _new_action_editor(opened=None, time=0, previous_time=None, in_graphic_mode=[], layer="master"):
python:
if _viewers.at_clauses_flag:
renpy.notify(_("ActionEditor can't show images with 'at clause'"))
_viewers.at_clauses_flag = False
int_format = "{:> .0f}"
float_format = "{:> .2f}"
pos_format = "(abs={:> .0f}, rel={:> .2f})"
generate_changed = _viewers.generate_changed
get_value = _viewers.get_value
get_default = _viewers.get_default
current_scene = _viewers.current_scene
scene_keyframes = _viewers.scene_keyframes
sound_keyframes = _viewers.sound_keyframes
all_keyframes = _viewers.all_keyframes
change_time = _viewers.change_time
get_sorted_keyframes = _viewers.get_sorted_keyframes
current_time = _viewers.current_time
edit_value = _viewers.edit_value
reset = _viewers.reset
is_force_plus = _viewers.is_force_plus
force_wide_range = _viewers.force_wide_range
props_sets = _viewers.props_sets
keyframes_exist = _viewers.keyframes_exist
generate_sound_menu = _viewers.generate_sound_menu
generate_menu = _viewers.generate_menu
is_wide_range = _viewers.is_wide_range
DraggableValue = _viewers.DraggableValue
TimeLine = _viewers.TimeLine
perspective_enabled = _viewers.perspective_enabled
check_new_position_type = _viewers.check_new_position_type
if opened is None:
opened = {}
for s in range(0, len(scene_keyframes)):
if s not in opened:
opened[s] = []
indent = " "
xpos, ypos = get_value((None, layer, "xpos"), default=True), get_value((None, layer, "ypos"), default=True)
xmove_amount1 = 0.1
ymove_amount1 = 0.1
xmove_amount2 = 0.3
ymove_amount2 = 0.3
if isinstance(xpos, int):
xmove_amount1 = int(xmove_amount1*config.screen_width)
xmove_amount2 = int(xmove_amount2*config.screen_width)
xvalue_range = persistent._wide_range
elif isinstance(xpos, float):
xvalue_range = persistent._narrow_range
elif check_new_position_type(xpos):
xmove_amount1 = renpy.atl.position.from_any(int(xmove_amount1*config.screen_width))
xmove_amount2 = renpy.atl.position.from_any(int(xmove_amount2*config.screen_width))
xvalue_range = renpy.atl.position.from_any(persistent._wide_range)
if isinstance(ypos, int):
ymove_amount1 = int(ymove_amount1*config.screen_height)
ymove_amount2 = int(ymove_amount2*config.screen_height)
yvalue_range = persistent._wide_range
elif isinstance(ypos, float):
yvalue_range = persistent._narrow_range
elif check_new_position_type(ypos):
ymove_amount1 = renpy.atl.position.from_any(int(ymove_amount1*config.screen_height))
ymove_amount2 = renpy.atl.position.from_any(int(ymove_amount2*config.screen_height))
yvalue_range = renpy.atl.position.from_any(persistent._wide_range)
key "hide_windows" action NullAction()
if get_value((None, layer, "perspective"), scene_keyframes[0][1], True) is not False:
if _viewers.fps_keymap:
key "s" action Function(generate_changed((None, layer, "ypos")), ypos + ymove_amount1 + yvalue_range)
key "w" action Function(generate_changed((None, layer, "ypos")), ypos - ymove_amount1 + yvalue_range)
key "a" action Function(generate_changed((None, layer, "xpos")), xpos - xmove_amount1 + xvalue_range)
key "d" action Function(generate_changed((None, layer, "xpos")), xpos + xmove_amount1 + xvalue_range)
key "S" action Function(generate_changed((None, layer, "ypos")), ypos + ymove_amount2 + yvalue_range)
key "W" action Function(generate_changed((None, layer, "ypos")), ypos - ymove_amount2 + yvalue_range)
key "A" action Function(generate_changed((None, layer, "xpos")), xpos - xmove_amount2 + xvalue_range)
key "D" action Function(generate_changed((None, layer, "xpos")), xpos + xmove_amount2 + xvalue_range)
else:
key "j" action Function(generate_changed((None, layer, "ypos")), ypos + ymove_amount1 + yvalue_range)
key "k" action Function(generate_changed((None, layer, "ypos")), ypos - ymove_amount1 + yvalue_range)
key "h" action Function(generate_changed((None, layer, "xpos")), xpos - xmove_amount1 + xvalue_range)
key "l" action Function(generate_changed((None, layer, "xpos")), xpos + xmove_amount1 + xvalue_range)
key "J" action Function(generate_changed((None, layer, "ypos")), ypos + ymove_amount2 + yvalue_range)
key "K" action Function(generate_changed((None, layer, "ypos")), ypos - ymove_amount2 + yvalue_range)
key "H" action Function(generate_changed((None, layer, "xpos")), xpos - xmove_amount2 + xvalue_range)
key "L" action Function(generate_changed((None, layer, "xpos")), xpos + xmove_amount2 + xvalue_range)
if perspective_enabled(layer):
key "rollback" action Function(generate_changed((None, layer, "zpos")), get_value((None, layer, "zpos"), default=True)+100+persistent._wide_range)
key "rollforward" action Function(generate_changed((None, layer, "zpos")), get_value((None, layer, "zpos"), default=True)-100+persistent._wide_range)
if time:
timer time+_viewers.return_margin action [Show("_new_action_editor", opened=opened, in_graphic_mode=in_graphic_mode, layer=layer), \
Function(_viewers.return_start_time, previous_time)]
key "game_menu" action [Show("_new_action_editor", opened=opened, in_graphic_mode=in_graphic_mode, layer=layer), \
Function(change_time, previous_time)]
$play_action = [SensitiveIf(get_sorted_keyframes(current_scene) or len(scene_keyframes) > 1), SelectedIf(time > 0), \
_viewers.pause, \
Show("_new_action_editor", opened=opened, in_graphic_mode=in_graphic_mode, layer=layer)]
else:
key "game_menu" action Confirm("Close Editor?", Return())
$play_action = [SensitiveIf(get_sorted_keyframes(current_scene) or len(scene_keyframes) > 1), SelectedIf(time > 0), \
[If(get_sorted_keyframes(current_scene) or len(scene_keyframes) > 1, Function(_viewers.play, play=True))], \
Show("_new_action_editor", opened=opened, time=_viewers.get_animation_delay(), previous_time=current_time, in_graphic_mode=in_graphic_mode, layer=layer)]
if persistent._show_camera_icon:
if _viewers.aspect_16_9:
$xpos = int(config.screen_width * (1 - _viewers.preview_size) / 2)
$ypos = 0
else:
$xpos = 0
$ypos = 0
add _viewers.ImagePins(layer) xpos xpos ypos ypos
key "K_SPACE" action play_action
key "action_editor" action NullAction()
$state=_viewers.get_image_state(layer)
$tag_list = []
for tag, z in _viewers.zorder_list[current_scene][layer]:
if tag in state:
$tag_list.append(tag)
add _viewers.screen_background
if persistent._viewer_sideview:
add DynamicDisplayable(_viewers.get_sideview, 0)
add DynamicDisplayable(_viewers.get_sideview, 1)
add DynamicDisplayable(_viewers.get_sideview, 2)
frame:
style_group "new_action_editor"
align (1., 0.)
vbox:
xfill False
text "absolute" xalign 1.
add DynamicDisplayable(_viewers.absolute_pos) xalign 1.
text "fraction" xalign 1.
add DynamicDisplayable(_viewers.rel_pos) xalign 1.
frame:
pos (1., _viewers.preview_size)
anchor (1., 1.)
style_group "new_action_editor"
vbox:
style_group "new_action_editor_a"
textbutton _("option") action Show("_action_editor_option")
textbutton _("show image pins") action ToggleField(persistent, "_show_camera_icon")
textbutton _("scene editor") action [SensitiveIf(len(scene_keyframes) > 1), Show("_scene_editor")]
hbox:
xalign 1.
textbutton _("remove keys") action [
SensitiveIf(current_time in get_sorted_keyframes(current_scene)),
Function(_viewers.remove_all_keyframe, current_time), renpy.restart_interaction]
textbutton _("move keys") action [
SensitiveIf(current_time in get_sorted_keyframes(current_scene)),
SelectedIf(False), SetField(_viewers, "moved_time", current_time), Show("_move_keyframes")]
hbox:
xalign 1.
textbutton _("<") action Function(_viewers.prev_time)
textbutton _(">") action Function(_viewers.next_time)
textbutton _("play") action play_action
textbutton _("clipboard") action Function(_viewers.put_clipboard)
textbutton _("close") action Return()
frame:
style_group "new_action_editor"
ymaximum 1 - _viewers.preview_size
yalign 1.0
padding (0, 0, 0, 0)
vbox:
hbox:
ymaximum _viewers.time_column_height
hbox:
style_group "new_action_editor_c"
imagebutton:
idle DynamicDisplayable(_viewers.show_current_time_idle)
hover DynamicDisplayable(_viewers.show_current_time_hover)
action Function(_viewers.edit_time)
xalign 1.
size_group None
bar value _viewers.CurrentTime(persistent._time_range):
xalign 1. yalign .5 style "new_action_editor_bar"
if in_graphic_mode:
$key = in_graphic_mode[0]
if key[0] is None:
$kind = "camera"
else:
$kind = "image"
$value = get_value(key, default=True)
$f = generate_changed(key)
$use_wide_range = is_wide_range(key)
if isinstance(value, float) or (check_new_position_type(value) and value.absolute == 0):
$value_format = float_format
elif isinstance(value, int) or (check_new_position_type(value) and value.relative == 0):
$value_format = int_format
elif check_new_position_type(value):
$value_format = pos_format
hbox:
#他と同時にグラフィックモードで表示するとタイムバーが反応しないことがある
hbox:
style_group "new_action_editor_c"
textbutton " [key]" action None text_color "#FFF"
add DraggableValue(value_format, key, f, is_force_plus(key[2]))
fixed:
# ysize int(config.screen_height*(1-_viewers.preview_size)-_viewers.time_column_height)
ysize None
add TimeLine(current_scene, kind, key=key, changed=f, opened=opened, in_graphic_mode=in_graphic_mode)
else:
viewport:
mousewheel True
scrollbars "vertical"
has vbox
for s, ks in enumerate(all_keyframes):
if s != current_scene:
hbox:
hbox:
style_group "new_action_editor_c"
textbutton "+ "+"scene[s]":
action [SelectedIf(current_scene == s), Function(_viewers.change_scene, s)]
fixed:
add TimeLine(s, None)
else:
hbox:
hbox:
style_group "new_action_editor_c"
textbutton "- "+"scene[s]" action SelectedIf(current_scene == s)
fixed:
add TimeLine(s, None)
for l in _viewers.get_layers():
if l != layer:
hbox:
hbox:
style_group "new_action_editor_c"
textbutton _(indent+"+ "+l):
action Show("_new_action_editor", opened=opened, in_graphic_mode=in_graphic_mode, layer=l)
# fixed:
# add TimeLine(s, "camera", key=(None, layer, None))
else:
hbox:
hbox:
style_group "new_action_editor_c"
textbutton _(indent+"- "+l):
action SelectedIf(l == layer)
# fixed:
# add TimeLine(s, None)
if (None, layer, None) not in opened[s]:
hbox:
hbox:
style_group "new_action_editor_c"
if persistent._open_only_one_page:
$new_opened = {s:[(None, layer, None)]}
else:
$new_opened = opened.copy()
$new_opened[s] = new_opened[s] + [(None, layer, None)]
textbutton _(indent*2+"+ "+"camera"):
action [SensitiveIf(get_value((None, layer, "perspective"), scene_keyframes[s][1], True) is not False),
Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)]
fixed:
add TimeLine(s, "camera", key=(None, layer, None))
else:
hbox:
hbox:
style_group "new_action_editor_c"
$new_opened = opened.copy()
$new_opened[s] = opened[s].copy()
$new_opened[s].remove((None, layer, None))
textbutton _(indent*2+"- "+"camera"):
action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
textbutton _("clipboard"):
action Function(_viewers.put_camera_clipboard, layer=layer)
size_group None
style_group "new_action_editor_b"
fixed:
add TimeLine(s, "camera", key=(None, layer, None))
for props_set_name, props_set in props_sets:
if (None, layer, props_set_name) in opened[s]:
hbox:
hbox:
style_group "new_action_editor_c"
$new_opened = opened.copy()
$new_opened[s] = opened[s].copy()
$new_opened[s].remove((None, layer, props_set_name))
textbutton indent*3+"- " + props_set_name action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
fixed:
add TimeLine(s, "camera", key=(None, layer, None), props_set=props_set)
for p in _viewers.expand_props_set(props_set, (None, layer, None), s):
$key = (None, layer, p)
$value = get_value(key, default=True)
$f = generate_changed(key)
$use_wide_range = is_wide_range(key, s)
if isinstance(value, float) or (check_new_position_type(value) and value.absolute == 0):
$value_format = float_format
elif isinstance(value, int) or (check_new_position_type(value) and value.relative == 0):
$value_format = int_format
elif check_new_position_type(value):
$value_format = pos_format
$shown_p = p
if p.count("_") == 3:
$sign, num1, num2, p2 = p.split("_")
if sign in ("matrixtransform", "matrixcolor"):
$shown_p = p2
hbox:
if p == "perspective":
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [p]":
action None text_color "#FFF"
textbutton "[value]":
action [SelectedIf(keyframes_exist(key)),
Function(_viewers.edit_any, key, time=scene_keyframes[current_scene][1])]
size_group None
elif p == "function":
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [p]":
action None text_color "#FFF"
textbutton "[value[0]]":
action [SelectedIf(keyframes_exist(key)),
Function(_viewers.edit_function, key)]
size_group None
elif p in _viewers.any_props:
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [p]":
action None text_color "#FFF"
if isinstance(value, str):
$caption = "'[value]'"
else:
$caption = "[value]"
textbutton caption:
action [SelectedIf(keyframes_exist(key)),
Function(_viewers.edit_any, key)]
size_group None
elif p in _viewers.boolean_props:
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [p]":
action None text_color "#FFF"
textbutton "[value]":
action [SelectedIf(keyframes_exist(key)),
Function(_viewers.toggle_boolean_property, key)]
size_group None
else:
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [shown_p]" action None text_color "#FFF"
add DraggableValue(value_format, key, f, is_force_plus(p))
# if key not in in_graphic_mode:
if p not in _viewers.boolean_props | {"function", "perspective"}:
fixed:
add TimeLine(s, "camera", key=key, changed=f, opened=opened)
# else:
# fixed:
# ysize int(config.screen_height*(1-_viewers.preview_size)-_viewers.time_column_height)
# add TimeLine(s, "camera", key=key, changed=f, use_wide_range=use_wide_range, opened=opened, in_graphic_mode=in_graphic_mode)
else:
hbox:
hbox:
style_group "new_action_editor_c"
if persistent._open_only_one_page:
$new_opened = {s:[(None, layer, None), (None, layer, props_set_name)]}
else:
$new_opened = opened.copy()
$new_opened[s] = new_opened[s] + [(None, layer, props_set_name)]
textbutton indent*3+"+ "+props_set_name action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
fixed:
add TimeLine(s, "camera", key=(None, layer, None), props_set=props_set)
for tag in tag_list:
if (tag, layer, None) not in opened[s]:
hbox:
hbox:
style_group "new_action_editor_c"
if persistent._open_only_one_page:
$new_opened = {s:[(tag, layer, None)]}
else:
$new_opened = opened.copy()
$new_opened[s] = new_opened[s] + [(tag, layer, None)]
textbutton indent*2+"+ "+"{}".format(tag):
action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
fixed:
add TimeLine(s, "image", key=(tag, layer, None))
else:
hbox:
hbox:
style_group "new_action_editor_c"
$new_opened = opened.copy()
$new_opened[s] = opened[s].copy()
$new_opened[s].remove((tag, layer, None))
textbutton indent*2+"- "+"{}".format(tag):
action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
textbutton _("clipboard"):
action Function(_viewers.put_image_clipboard, tag, layer)
style_group "new_action_editor_b"
size_group None
fixed:
add TimeLine(s, "image", key=(tag, layer, None))
for props_set_name, props_set in props_sets:
if (tag, layer, props_set_name) not in opened[s]:
hbox:
hbox:
style_group "new_action_editor_c"
if persistent._open_only_one_page:
$new_opened = {s:[(tag, layer, None), (tag, layer, props_set_name)]}
else:
$new_opened = opened.copy()
$new_opened[s] = new_opened[s] + [(tag, layer, props_set_name)]
textbutton indent*3+"+ "+props_set_name:
action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
fixed:
add TimeLine(s, "image", key=(tag, layer, None), props_set=props_set)
else:
hbox:
hbox:
style_group "new_action_editor_c"
$new_opened = opened.copy()
$new_opened[s] = opened[s].copy()
$new_opened[s].remove((tag, layer, props_set_name))
textbutton indent*3+"- " + props_set_name:
action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
fixed:
add TimeLine(s, "image", key=(tag, layer, None), props_set=props_set)
for p in _viewers.expand_props_set(props_set, (tag, layer, None), s):
$key = (tag, layer, p)
$value = get_value(key, default=True)
$f = generate_changed(key)
$use_wide_range = is_wide_range(key, s)
if isinstance(value, float) or (check_new_position_type(value) and value.absolute == 0):
$value_format = float_format
elif isinstance(value, int) or (check_new_position_type(value) and value.relative == 0):
$value_format = int_format
elif check_new_position_type(value):
$value_format = pos_format
$shown_p = p
if p.count("_") == 3:
$sign, num1, num2, p2 = p.split("_")
if sign in ("matrixtransform", "matrixcolor"):
$shown_p = p2
hbox:
if p == "child":
vbox:
xfill False
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [value[0]]":
action [SelectedIf(keyframes_exist((tag, layer, "child"))),
Function(_viewers.change_child, tag, layer, default=value[0])]
size_group None
text_language "unicode"
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" with [value[1]]":
action [
SelectedIf(keyframes_exist((tag, layer, "child"))),
Function(_viewers.edit_transition, tag, layer)]
size_group None
text_language "unicode"
elif p == "function":
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [p]":
action None text_color "#FFF"
textbutton "[value[0]]":
action [SelectedIf(keyframes_exist(key)),
Function(_viewers.edit_function, key)]
size_group None
elif p in _viewers.any_props:
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [p]":
action None text_color "#FFF"
if isinstance(value, str):
$caption = "'[value]'"
else:
$caption = "[value]"
textbutton caption:
action [SelectedIf(keyframes_exist(key)),
Function(_viewers.edit_any, key)]
size_group None
elif p in _viewers.boolean_props:
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [p]":
action None text_color "#FFF"
textbutton "[value]":
action [SelectedIf(keyframes_exist(key)),
Function(_viewers.toggle_boolean_property, key)]
size_group None
else:
hbox:
style_group "new_action_editor_c"
textbutton indent*4+" [shown_p]":
action None text_color "#FFF"
add DraggableValue(value_format, key, f, is_force_plus(p))
if p not in _viewers.boolean_props | {"function", "perspective"}:
fixed:
# if key not in in_graphic_mode:
add TimeLine(s, "image", key=key, changed=f, opened=opened)
# else:
# ysize int(config.screen_height*(1-_viewers.preview_size)-_viewers.time_column_height)
# add TimeLine(s, (tag, layer), key=key, changed=f, use_wide_range=use_wide_range, opened=opened, in_graphic_mode=in_graphic_mode)
$new_opened = opened.copy()
$new_opened[s] = opened[s].copy()
$new_opened[s] = [o for o in opened if not isinstance(o, tuple) or o[0] != tag]
textbutton _(indent*4+" remove"):
action [ Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer),
Function(_viewers.remove_image, layer, tag)]
size_group None
textbutton _(indent*2+"+(add image)"):
action Function(_viewers.add_image, layer)
style_group "new_action_editor_c"
textbutton _("+(add scene)"):
action _viewers.add_scene
style_group "new_action_editor_c"
if "sounds" not in opened:
hbox:
hbox:
style_group "new_action_editor_c"
if persistent._open_only_one_page:
$new_opened = {"sounds":True}
else:
$new_opened = opened.copy()
$new_opened["sounds"] = True
textbutton _("+ "+"sounds"):
action [SensitiveIf(persistent._viewer_channel_list),
Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)]
fixed:
add TimeLine(s, "sounds")
else:
hbox:
style_group "new_action_editor_c"
$new_opened = opened.copy()
$del new_opened["sounds"]
textbutton _(indent*2+"- "+"sounds"):
action Show("_new_action_editor", opened=new_opened, in_graphic_mode=in_graphic_mode, layer=layer)
textbutton _("clipboard"):
action Function(_viewers.put_sound_clipboard)
size_group None
style_group "new_action_editor_b"
for channel in sound_keyframes:
hbox:
hbox:
style_group "new_action_editor_c"
textbutton indent*2+" [channel]":
action None text_color "#FFF"
size_group None
fixed:
add TimeLine(s, "sounds", key=channel, use_wide_range=None)
hbox:
$value = "None"
$sorted_play_times = sorted(list(sound_keyframes[channel].keys()))
for t in sorted_play_times:
if current_time >= t:
$value = sound_keyframes[channel][t]
textbutton indent*3+" [value]":
action [SelectedIf(keyframes_exist(channel, is_sound=True)),
Function(_viewers.edit_playing_file, channel, current_time)]
size_group None
init -998 python in _viewers:
return_margin = 0.5
time_column_height = 30
key_xsize = 22
key_ysize = 22
key_half_xsize = 22 // 2
key_half_ysize = 22 // 2
time_line_background_color = "#222"
key_child = Transform(rotate=45)(Solid("#77A", xsize=16, ysize=16))
key_hovere_child = Transform(rotate=45)(Solid("#AAD", xsize=16, ysize=16))
warperkey_child = Transform(rotate=45)(Solid("#07A", xsize=16, ysize=16))
warperkey_hovere_child = Transform(rotate=45)(Solid("#4AD", xsize=16, ysize=16))
knot_child = Transform(rotate=45)(Solid("#04A", xsize=16, ysize=16))
knot_hovere_child = Transform(rotate=45)(Solid("#48D", xsize=16, ysize=16))
insensitive_key_child = Transform(rotate=45)(Solid("#447", xsize=16, ysize=16))
insensitive_key_hovere_child = Transform(rotate=45)(Solid("#669", xsize=16, ysize=16))
interpolate_key_child = Solid("#BBB", xsize=4, ysize=4) #, xoffset=key_half_xsize-2, yoffset=key_half_ysize-2)
c_box_size = 320
timeline_ysize = 27
init python in _viewers:
box = Fixed()
if aspect_16_9:
box.add(Solid(preview_background_color, xsize=config.screen_width, ysize=(1-preview_size), ypos=preview_size))
box.add(Solid(preview_background_color, xsize=(1-preview_size)/2, ysize=preview_size, xpos=0.))
box.add(Solid(preview_background_color, xsize=(1-preview_size)/2, ysize=preview_size, xalign=1.))
else:
box.add(Solid(preview_background_color, xsize=config.screen_width, ysize=(1-preview_size), ypos=preview_size))
box.add(Solid(preview_background_color, xsize=(1-preview_size), ysize=preview_size, xalign=1.))
screen_background = box
init -996:
style new_action_editor_frame:
background None
style new_action_editor_button:
size_group "action_editor"
background None
idle_background None
insensitive_background None
ysize None
padding (1, 1, 1, 1)
margin (1, 1)
style new_action_editor_text:
color "#CCC"
outlines [ (absolute(2), "#000", absolute(0), absolute(0)) ]
size 16
style draggable_value is new_action_editor_text
style hover_draggable_value is draggable_value:
underline True
style insensitive_draggable_value is draggable_value:
insensitive_color "#888"
if _viewers.check_version(22062600):
style new_action_editor_text language "unicode"
style new_action_editor_button_text is new_action_editor_text:
hover_underline True
selected_color "#FFF"
insensitive_color "#888"
style new_action_editor_label:
xminimum 110
style new_action_editor_vbox xfill True
style new_action_editor_bar is slider:
# ysize _viewers.timeline_ysize
xoffset _viewers.key_half_xsize
xsize config.screen_width-_viewers.c_box_size-50-_viewers.key_half_xsize
style new_action_editor_a_button:
take new_action_editor_button
size_group None
xalign 1.
style new_action_editor_a_button_text is new_action_editor_button_text
style new_action_editor_a_bar is new_action_editor_bar
style new_action_editor_fixed:
xsize config.screen_width-_viewers.c_box_size-50+_viewers.key_half_xsize
ysize _viewers.key_ysize
yalign .5
# style new_action_editor_drag:
# xanchor .5
style new_action_editor_b_button:
take new_action_editor_button
size_group "new_action_editor_b"
xminimum 90
style new_action_editor_b_button_text is new_action_editor_button_text:
xalign 1.0
style new_action_editor_c_text is new_action_editor_text
style new_action_editor_c_button is new_action_editor_button:
size_group "new_action_editor_c"
style new_action_editor_c_button_text is new_action_editor_button_text
style new_action_editor_c_bar is new_action_editor_bar
style new_action_editor_c_hbox:
size_group "new_action_editor_c"
xsize _viewers.c_box_size
ysize _viewers.key_ysize
style _viewers_alternate_menu_frame:
background "#222"
style _viewers_alternate_menu_button is new_action_editor_button
style _viewers_alternate_menu_button_text is new_action_editor_button_text:
insensitive_color "#AAA"
# tab="images"/"camera", layer="master",
screen _action_editor(tab="camera", layer="master", opened=0, time=0, page=0):
python:
if _viewers.at_clauses_flag:
renpy.notify(_("ActionEditor can't show images with 'at clause'"))
_viewers.at_clauses_flag = False
int_format = "{:> .0f}"
float_format = "{:> .2f}"
pos_format = "(abs={:> .0f}, rel={:> .2f})"
generate_changed = _viewers.generate_changed
get_value = _viewers.get_value
get_default = _viewers.get_default
current_scene = _viewers.current_scene
scene_keyframes = _viewers.scene_keyframes
all_keyframes = _viewers.all_keyframes
change_time = _viewers.change_time
get_sorted_keyframes = _viewers.get_sorted_keyframes
current_time = _viewers.current_time
edit_value = _viewers.edit_value
reset = _viewers.reset
is_force_plus = _viewers.is_force_plus
is_wide_range = _viewers.is_wide_range
props_sets = _viewers.props_sets
props_groups = _viewers.props_groups
keyframes_exist = _viewers.keyframes_exist
perspective_enabled = _viewers.perspective_enabled
check_new_position_type = _viewers.check_new_position_type
exclusive_check = _viewers.exclusive_check
play_action = [SensitiveIf(get_sorted_keyframes(current_scene) or len(scene_keyframes) > 1), \
SelectedIf(False), Function(_viewers.play, play=True), \
Show("_action_editor", tab=tab, layer=layer, opened=opened, page=page, time=_viewers.get_animation_delay())]
xpos, ypos = get_value((None, layer, "xpos"), default=True), get_value((None, layer, "ypos"), default=True)
xmove_amount1 = 0.1
ymove_amount1 = 0.1
xmove_amount2 = 0.3
ymove_amount2 = 0.3
xvalue_range = yvalue_range = persistent._wide_range
if isinstance(xpos, int):
xmove_amount1 = int(xmove_amount1*config.screen_width)
xmove_amount2 = int(xmove_amount2*config.screen_width)
else:
xvalue_range = persistent._narrow_range
if isinstance(ypos, int):
ymove_amount1 = int(ymove_amount1*config.screen_height)
ymove_amount2 = int(ymove_amount2*config.screen_height)
else:
yvalue_range = persistent._narrow_range
key "K_SPACE" action play_action
key "action_editor" action NullAction()
key "hide_windows" action NullAction()
if get_value((None, layer, "perspective"), scene_keyframes[0][1], True) is not False:
if _viewers.fps_keymap:
key "s" action Function(generate_changed((None, layer, "ypos")), ypos + ymove_amount1 + yvalue_range)
key "w" action Function(generate_changed((None, layer, "ypos")), ypos - ymove_amount1 + yvalue_range)
key "a" action Function(generate_changed((None, layer, "xpos")), xpos - xmove_amount1 + xvalue_range)
key "d" action Function(generate_changed((None, layer, "xpos")), xpos + xmove_amount1 + xvalue_range)
key "S" action Function(generate_changed((None, layer, "ypos")), ypos + ymove_amount2 + yvalue_range)
key "W" action Function(generate_changed((None, layer, "ypos")), ypos - ymove_amount2 + yvalue_range)
key "A" action Function(generate_changed((None, layer, "xpos")), xpos - xmove_amount2 + xvalue_range)
key "D" action Function(generate_changed((None, layer, "xpos")), xpos + xmove_amount2 + xvalue_range)
else:
key "j" action Function(generate_changed(None, layer, "ypos"), ypos + ymove_amount1 + yvalue_range)
key "k" action Function(generate_changed(None, layer, "ypos"), ypos - ymove_amount1 + yvalue_range)
key "h" action Function(generate_changed(None, layer, "xpos"), xpos - xmove_amount1 + xvalue_range)
key "l" action Function(generate_changed(None, layer, "xpos"), xpos + xmove_amount1 + xvalue_range)
key "J" action Function(generate_changed(None, layer, "ypos"), ypos + ymove_amount2 + yvalue_range)
key "K" action Function(generate_changed(None, layer, "ypos"), ypos - ymove_amount2 + yvalue_range)
key "H" action Function(generate_changed(None, layer, "xpos"), xpos - xmove_amount2 + xvalue_range)
key "L" action Function(generate_changed(None, layer, "xpos"), xpos + xmove_amount2 + xvalue_range)
if perspective_enabled(layer):
key "rollback" action Function(generate_changed((None, layer, "zpos")), get_value((None, layer, "zpos"), default=True)+100+persistent._wide_range)
key "rollforward" action Function(generate_changed((None, layer, "zpos")), get_value((None, layer, "zpos"), default=True)-100+persistent._wide_range)
if time:
timer time+1 action [Show("_action_editor", tab=tab, layer=layer, opened=opened, page=page), \
Function(change_time, current_time), renpy.restart_interaction]
key "game_menu" action [Show("_action_editor", tab=tab, layer=layer, opened=opened, page=page), \
Function(change_time, current_time)]
key "hide_windows" action NullAction()
else:
key "game_menu" action Return()
python:
state_list = [tag for tag, z in _viewers.zorder_list[current_scene][layer]]
page_list = []
if len(state_list) > _viewers.tab_amount_in_page:
for i in range(0, len(state_list)//_viewers.tab_amount_in_page):
page_list.append(state_list[i*_viewers.tab_amount_in_page:(i+1)*_viewers.tab_amount_in_page])
if len(state_list)%_viewers.tab_amount_in_page != 0:
page_list.append(state_list[len(state_list)//_viewers.tab_amount_in_page*_viewers.tab_amount_in_page:])
else:
page_list.append(state_list)
state=_viewers.get_image_state(layer)
if get_value((None, layer, "perspective"), scene_keyframes[current_scene][1], True) is False and tab == "camera":
tab = state_list[0]
frame:
style_group "action_editor"
if time:
at _no_show()
has vbox
hbox:
style_group "action_editor_a"
textbutton _("time: [current_time:>05.2f] s") action Function(_viewers.edit_time)
textbutton _("<") action Function(_viewers.prev_time)
textbutton _(">") action Function(_viewers.next_time)
textbutton _("play") action play_action
bar adjustment ui.adjustment(range=persistent._time_range, value=current_time, changed=change_time):
xalign 1. yalign .5 style "action_editor_bar"
hbox:
style_group "action_editor_a"
textbutton _("option") action Show("_action_editor_option")
textbutton _("remove keyframes"):
action [SensitiveIf(current_time in get_sorted_keyframes(current_scene)), \
Function(_viewers.remove_all_keyframe, current_time), renpy.restart_interaction]
textbutton _("move keyframes"):
action [SensitiveIf(current_time in get_sorted_keyframes(current_scene)), \
SelectedIf(False), SetField(_viewers, "moved_time", current_time), Show("_move_keyframes")]
textbutton _("hide") action HideInterface()
textbutton _("clipboard") action Function(_viewers.put_clipboard)
textbutton _("x") action Return()
hbox:
style_group "action_editor_a"
textbutton _("scene") action [SensitiveIf(len(scene_keyframes) > 1), Show("_scene_editor")]
for i, ks in enumerate(all_keyframes):
textbutton "[i]" action [SelectedIf(current_scene == i), Function(_viewers.change_scene, i), Show("_action_editor")]
textbutton _("+") action _viewers.add_scene
hbox:
style_group "action_editor_a"
xfill False
for l in _viewers.get_layers():
textbutton "{}".format(l):
action [SelectedIf(l == layer), Show("_action_editor", layer=l, page=page)]
hbox:
style_group "action_editor_a"
xfill False
textbutton _("<"):
action [SensitiveIf(page != 0), Show("_action_editor", tab=tab, layer=layer, page=page-1), renpy.restart_interaction]
textbutton _("camera"):
action [SensitiveIf(get_value((None, layer, "perspective"), scene_keyframes[current_scene][1], True) is not False),
SelectedIf(tab == "camera"), Show("_action_editor", tab="camera", layer=layer)]
for n in page_list[page]:
textbutton "{}".format(n):
action [SelectedIf(n == tab), Show("_action_editor", tab=n, layer=layer, page=page)]
textbutton _("+"):
action Function(_viewers.add_image, layer)
textbutton _(">"):
action [SensitiveIf(len(page_list) != page+1), Show("_action_editor", tab=tab, layer=layer, page=page+1), renpy.restart_interaction]
vbox:
hbox:
xfill False
xalign 1.
if tab == "camera":
textbutton _("clipboard") action Function(_viewers.put_camera_clipboard, layer=layer) size_group None
# textbutton _("reset") action [_viewers.camera_reset, renpy.restart_interaction] size_group None
else:
textbutton _("remove") action [
SensitiveIf(tab in _viewers.image_state[current_scene][layer]),
Show("_action_editor", tab="camera", layer=layer, opened=opened, page=page),
Function(_viewers.remove_image, layer, tab)] size_group None
textbutton _("clipboard"):
action Function(_viewers.put_image_clipboard, tab, layer)
size_group None
# textbutton _("reset") action [_viewers.image_reset, renpy.restart_interaction] size_group None
viewport:
mousewheel True
scrollbars "vertical"
has vbox
if tab == "camera":
for i, (props_set_name, props_set) in enumerate(props_sets):
if i == opened:
textbutton "- " + props_set_name action [SelectedIf(True), NullAction()]
for p in _viewers.expand_props_set(props_set, (None, layer, None), current_scene):
$key = (None, layer, p)
$value = get_value(key, default=True)
$f = generate_changed(key)
$use_wide_range = is_wide_range(key)
if use_wide_range:
$value_range = persistent._wide_range
$bar_page = 1
else:
$value_range = persistent._narrow_range
$bar_page = .05
if isinstance(value, float) or (check_new_position_type(value) and value.absolute == 0):
$value_format = float_format
elif isinstance(value, int) or (check_new_position_type(value) and value.relative == 0):
$value_format = int_format
elif check_new_position_type(value):
$value_format = pos_format
$shown_p = p
if p.count("_") == 3:
$sign, num1, num2, p2 = p.split("_")
if sign in ("matrixtransform", "matrixcolor"):
$shown_p = p2
hbox:
textbutton " [shown_p]":
action [SensitiveIf((None, layer, p) in all_keyframes[current_scene]),
SelectedIf(keyframes_exist(key)), Show("_edit_keyframe", key=key, change_func=f)]
if p == "perspective":
textbutton "[value]":
action [SelectedIf(get_value(key, scene_keyframes[current_scene][1], True)),
Function(_viewers.edit_any, key, time=scene_keyframes[current_scene][1])]
elif p == "function":
textbutton "[value[0]]":
action [SelectedIf(get_value(key, scene_keyframes[current_scene][1], True)),
Function(_viewers.edit_function, key)]
elif p in _viewers.any_props:
if isinstance(value, str):
$caption = "'[value]'"
else:
$caption = "[value]"
textbutton caption:
action [SelectedIf(get_value(key, scene_keyframes[current_scene][1], True)),
Function(_viewers.edit_any, key)]
elif p in _viewers.boolean_props:
textbutton "[value]":
action [SelectedIf(get_value(key, scene_keyframes[current_scene][1], True)),
Function(_viewers.toggle_boolean_property, key)]
else:
if isinstance(value, (int, float)):
if is_force_plus(p):
$bar_value = value
else:
$bar_value = value + value_range
$value_range = value_range*2
textbutton value_format.format(value):
action [Function(edit_value, f, use_wide_range=use_wide_range, default=value, force_plus=is_force_plus(p)), SensitiveIf(exclusive_check(key))]
alternate [Function(reset, key), SensitiveIf(exclusive_check(key))] style_group "action_editor_b"
bar adjustment ui.adjustment(range=value_range, value=bar_value, page=bar_page, changed=f):
xalign 1. yalign .5 style "action_editor_bar"
elif check_new_position_type(value):
textbutton value_format.format(value.absolute, value.relative):
action [Function(edit_value, f, use_wide_range=use_wide_range, default=value, force_plus=is_force_plus(p)), SensitiveIf(exclusive_check(key))]
alternate [Function(reset, key), SensitiveIf(exclusive_check(key))] style_group "action_editor_b"
else:
hbox:
textbutton "+ "+props_set_name:
action Show("_action_editor", tab=tab, layer=layer, opened=i, page=page)
else:
for i, (props_set_name, props_set) in enumerate(props_sets):
if i == opened:
textbutton "- " + props_set_name action [SelectedIf(True), NullAction()]
for p in _viewers.expand_props_set(props_set, (tab, layer, None), current_scene):
$key = (tab, layer, p)
$value = get_value(key, default=True)
$f = generate_changed(key)
$use_wide_range = is_wide_range(key)
if use_wide_range:
$value_range = persistent._wide_range
$bar_page = 1
else:
$value_range = persistent._narrow_range
$bar_page = .05
if isinstance(value, float) or (check_new_position_type(value) and value.absolute == 0):
$value_format = float_format
elif isinstance(value, int) or (check_new_position_type(value) and value.relative == 0):
$value_format = int_format
elif check_new_position_type(value):
$value_format = pos_format
$shown_p = p
if p.count("_") == 3:
$sign, num1, num2, p2 = p.split("_")
if sign in ("matrixtransform", "matrixcolor"):
$shown_p = p2
hbox:
textbutton " [shown_p]":
action [SensitiveIf(key in all_keyframes[current_scene]),
SelectedIf(keyframes_exist(key)),
Show("_edit_keyframe", key=key, change_func=f)]
if p == "child":
textbutton "[value[0]]":
action [SelectedIf(keyframes_exist((tab, layer, "child"))),
Function(_viewers.change_child, tab, layer, default=value[0])]
size_group None
textbutton "with" action None size_group None
textbutton "[value[1]]":
action [SensitiveIf(key in all_keyframes[current_scene]),
SelectedIf(keyframes_exist((tab, layer, "child"))),
Function(_viewers.edit_transition, tab, layer)]
size_group None
elif p == "function":
textbutton "[value[0]]":
action [SelectedIf(get_value(key, scene_keyframes[current_scene][1], True)),
Function(_viewers.edit_function, key)]
elif p in _viewers.any_props:
if isinstance(value, str):
$caption = "'[value]'"
else:
$caption = "[value]"
textbutton caption:
action [SelectedIf(get_value(key, scene_keyframes[current_scene][1], True)),
Function(_viewers.edit_any, key)]
elif p in _viewers.boolean_props:
textbutton "[value]":
action [SelectedIf(get_value(key, scene_keyframes[current_scene][1], True)),
Function(_viewers.toggle_boolean_property, key)]
else:
if isinstance(value, (int, float)):
if is_force_plus(p):
$bar_value = value
else:
$bar_value = value + value_range
$value_range = value_range*2
textbutton value_format.format(value):
action [Function(edit_value, f, use_wide_range=use_wide_range, default=value, force_plus=is_force_plus(p)), SensitiveIf(exclusive_check(key))]
alternate [Function(reset, key), SensitiveIf(exclusive_check(key))] style_group "action_editor_b"
bar adjustment ui.adjustment(range=value_range, value=bar_value, page=bar_page, changed=f):
xalign 1. yalign .5 style "action_editor_bar"
elif check_new_position_type(value):
textbutton value_format.format(value.absolute, value.relative):
action [Function(edit_value, f, use_wide_range=use_wide_range, default=value, force_plus=is_force_plus(p)), SensitiveIf(exclusive_check(key))]
alternate [Function(reset, key), SensitiveIf(exclusive_check(key))] style_group "action_editor_b"
else:
hbox:
textbutton "+ "+props_set_name:
action Show("_action_editor", tab=tab, layer=layer, opened=i, page=page)
transform _no_show():
alpha 0
init -997:
style action_editor_frame:
background "#0003"
style action_editor_button:
size_group "action_editor"
background None
idle_background None
insensitive_background None