1
1
export script_name = " Shapery"
2
2
export script_description = " Does several types of shape manipulations from the simplest to the most complex"
3
- export script_version = " 2.5.8 "
3
+ export script_version = " 2.6.0 "
4
4
export script_author = " ILLTeam"
5
5
export script_namespace = " ILL.Shapery"
6
6
7
7
haveDepCtrl, DependencyControl = pcall require , " l0.DependencyControl"
8
8
9
- local depctrl, Clipper , ILL , Aegi , Ass , Config , Line , Curve , Path , Point , Util , Math , Table , Util
9
+ local depctrl, Clipper , ILL
10
10
if haveDepCtrl
11
11
depctrl = DependencyControl {
12
12
feed : " https://raw.githubusercontent.com/TypesettingTools/ILL-Aegisub-Scripts/main/DependencyControl.json" ,
@@ -19,19 +19,18 @@ if haveDepCtrl
19
19
}
20
20
{
21
21
" ILL.ILL"
22
- version : " 1.4 .5"
22
+ version : " 1.6 .5"
23
23
url : " https://github.com/TypesettingTools/ILL-Aegisub-Scripts/"
24
24
feed : " https://raw.githubusercontent.com/TypesettingTools/ILL-Aegisub-Scripts/main/DependencyControl.json"
25
25
}
26
26
}
27
27
}
28
28
Clipper , ILL = depctrl\ requireModules!
29
- { : Aegi , : Ass , : Config , : Line , : Curve , : Path , : Point , : Util , : Math , : Table , : Util } = ILL
30
29
else
31
30
Clipper = require " clipper2.clipper2"
32
31
ILL = require " ILL.ILL"
33
- { : Aegi , : Ass , : Config , : Line , : Curve , : Path , : Point , : Util , : Math , : Table , : Util } = ILL
34
32
33
+ { : Aegi , : Ass , : Config , : Line , : Curve , : Path , : Point , : Util , : Math , : Table , : Util } = ILL
35
34
clipboard = require " aegisub.clipboard"
36
35
37
36
checkPathClockWise = ( path) ->
@@ -504,6 +503,23 @@ ShaperyMacrosDialog = (macro) ->
504
503
ass\ setLine l, s
505
504
else
506
505
ass\ warning s, " Expected a shape"
506
+ when " Shape morph"
507
+ if l. isShape
508
+ if n < 2 or n > 2
509
+ ass\ error s, " Expected two selected lines"
510
+ ass\ removeLine l, s
511
+ Line . callBackExpand ass, l, nil , ( line) ->
512
+ { px, py} = line. data. pos
513
+ line. shape = Path ( line. shape) \ move( px, py) \ export !
514
+ table.insert lines, line
515
+ if i == n
516
+ a = Path lines[ 1 ] . shape
517
+ b = Path lines[ 2 ] . shape
518
+ Line . callBackFBF ass, lines[ 1 ] , ( line, frame_index, end_frame, j, n) ->
519
+ line. shape = a\ morph( b, ( j - 1 ) / ( n - 1 )) \ export !
520
+ ass\ insertLine line, s
521
+ else
522
+ ass\ warning s, " Expected a shape"
507
523
when " Shape merge"
508
524
if l. isShape
509
525
{ : color1, : color3, : color4, : alpha, : alpha1, : alpha2, : alpha3, : alpha4} = l. data
@@ -536,6 +552,45 @@ ShaperyMacrosDialog = (macro) ->
536
552
mergeShapesObj[ code] = { : i, pos : l. data. pos, line : lcopy, shape : table.concat clip}
537
553
else
538
554
ass\ warning s, " Expected a shape"
555
+ when " Shape blend"
556
+ if l. isShape
557
+ if n < 2
558
+ ass\ error s, " Expected one or more selected lines"
559
+ Line . callBackExpand ass, l, nil , ( line, j) ->
560
+ { x, y} = l. data. pos
561
+ newPath = Path line. shape
562
+ newPath\ move x, y
563
+ line. tags\ remove " move"
564
+ line. tags\ insert {{ " pos" , { 0 , 0 }} , true }
565
+ line. data. pos = { 0 , 0 }
566
+ table.insert mergeShapesObj, { tags : line. tags, path : newPath}
567
+ if j == 1 and i == 1
568
+ lines. line = Table . copy line
569
+ if i == n
570
+ ass\ deleteLines l, sel
571
+ prev = mergeShapesObj[ 1 ]
572
+ preb = prev. path\ boundingBox!
573
+ sumw = preb. width
574
+ maxh = preb. height
575
+ buff = {}
576
+ for j = 2 , # mergeShapesObj
577
+ buff[ j] = mergeShapesObj[ j] . path\ boundingBox!
578
+ maxh = math.max maxh, buff[ j] . height
579
+ text = prev. tags\ get! .. prev. path\ move( 0 , - maxh + preb. height) \ export !
580
+ for j = 2 , # mergeShapesObj
581
+ curr = mergeShapesObj[ j]
582
+ tags = Table . copy curr. tags
583
+ tags\ difference prev. tags
584
+ tags\ insert " \\ p1"
585
+ curr. path\ move - sumw, - maxh + buff[ j] . height
586
+ text ..= tags\ get! .. curr. path\ export !
587
+ sumw += buff[ j] . width
588
+ prev = curr
589
+ lines. line. text = ILL . Text text
590
+ lines. line. isShape = false
591
+ ass\ insertLine lines. line, s
592
+ else
593
+ ass\ warning s, " Expected a shape"
539
594
when " Shape without holes"
540
595
if l. isShape
541
596
newShape = Path !
@@ -627,13 +682,13 @@ ShaperyMacrosDialog = (macro) ->
627
682
628
683
if haveDepCtrl
629
684
depctrl\ registerMacros {
630
- { " Pathfinder" , " " , PathfinderDialog }
631
- { " Offsetting" , " " , OffsettingDialog }
632
- { " Manipulate" , " " , ManipulateDialog }
633
- { " Transform" , " " , TransformDialog }
634
- { " Utilities" , " " , UtilitiesDialog }
635
- { " Cut Contour" , " " , CutContourDialog }
636
- { " Config" , " " , ConfigDialog }
685
+ { " Pathfinder" , " " , PathfinderDialog }
686
+ { " Offsetting" , " " , OffsettingDialog }
687
+ { " Manipulate" , " " , ManipulateDialog }
688
+ { " Transform" , " " , TransformDialog }
689
+ { " Utilities" , " " , UtilitiesDialog }
690
+ { " Cut Contour" , " " , CutContourDialog }
691
+ { " Config" , " " , ConfigDialog }
637
692
}
638
693
639
694
depctrl\ registerMacros {
@@ -643,6 +698,8 @@ if haveDepCtrl
643
698
{ " Shape to clip" , " " , ShaperyMacrosDialog " Shape to clip" }
644
699
{ " Shape to clip (clipboard)" , " " , ShaperyMacrosDialog " Shape to clip (clipboard)" }
645
700
{ " Shape merge" , " " , ShaperyMacrosDialog " Shape merge" }
701
+ { " Shape blend" , " " , ShaperyMacrosDialog " Shape blend" }
702
+ { " Shape morph" , " " , ShaperyMacrosDialog " Shape morph" }
646
703
{ " Shape trim" , " " , ShaperyMacrosDialog " Shape trim" }
647
704
{ " Shape to 0,0" , " " , ShaperyMacrosDialog " Shape to 0,0" }
648
705
{ " Shape to pos" , " " , ShaperyMacrosDialog " Shape to pos" }
@@ -652,20 +709,22 @@ if haveDepCtrl
652
709
{ " Shape bounding box" , " " , ShaperyMacrosDialog " Shape bounding box" }
653
710
} , " : Shapery macros :"
654
711
else
655
- aegisub. register_macro " #{script_name}/Pathfinder" , " " , PathfinderDialog
656
- aegisub. register_macro " #{script_name}/Offsetting" , " " , OffsettingDialog
657
- aegisub. register_macro " #{script_name}/Manipulate" , " " , ManipulateDialog
658
- aegisub. register_macro " #{script_name}/Transform" , " " , TransformDialog
659
- aegisub. register_macro " #{script_name}/Utilities" , " " , UtilitiesDialog
660
- aegisub. register_macro " #{script_name}/Cut Contour" , " " , CutContourDialog
661
- aegisub. register_macro " #{script_name}/Config" , " " , ConfigDialog
712
+ aegisub. register_macro " #{script_name}/Pathfinder" , " " , PathfinderDialog
713
+ aegisub. register_macro " #{script_name}/Offsetting" , " " , OffsettingDialog
714
+ aegisub. register_macro " #{script_name}/Manipulate" , " " , ManipulateDialog
715
+ aegisub. register_macro " #{script_name}/Transform" , " " , TransformDialog
716
+ aegisub. register_macro " #{script_name}/Utilities" , " " , UtilitiesDialog
717
+ aegisub. register_macro " #{script_name}/Cut Contour" , " " , CutContourDialog
718
+ aegisub. register_macro " #{script_name}/Config" , " " , ConfigDialog
662
719
663
720
aegisub. register_macro " : Shapery macros :/Shape expand" , " " , ShaperyMacrosDialog " Shape expand"
664
721
aegisub. register_macro " : Shapery macros :/Shape clipper" , " " , ShaperyMacrosDialog " Shape clipper"
665
722
aegisub. register_macro " : Shapery macros :/Clip to shape" , " " , ShaperyMacrosDialog " Clip to shape"
666
723
aegisub. register_macro " : Shapery macros :/Shape to clip" , " " , ShaperyMacrosDialog " Shape to clip"
667
724
aegisub. register_macro " : Shapery macros :/Shape to clip (clipboard)" , " " , ShaperyMacrosDialog " Shape to clip (clipboard)"
668
725
aegisub. register_macro " : Shapery macros :/Shape merge" , " " , ShaperyMacrosDialog " Shape merge"
726
+ aegisub. register_macro " : Shapery macros :/Shape blend" , " " , ShaperyMacrosDialog " Shape blend"
727
+ aegisub. register_macro " : Shapery macros :/Shape morph" , " " , ShaperyMacrosDialog " Shape morph"
669
728
aegisub. register_macro " : Shapery macros :/Shape trim" , " " , ShaperyMacrosDialog " Shape trim"
670
729
aegisub. register_macro " : Shapery macros :/Shape to 0,0" , " " , ShaperyMacrosDialog " Shape to 0,0"
671
730
aegisub. register_macro " : Shapery macros :/Shape to pos" , " " , ShaperyMacrosDialog " Shape to pos"
0 commit comments