Parsing Update

This commit is contained in:
Josef 2026-03-20 14:31:31 +01:00
parent d0662fe91c
commit 1863399a04
309 changed files with 9030 additions and 573 deletions

201
Icons/UIRule.svg Normal file
View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="16"
viewBox="0 0 16 16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="UIRule.svg"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs8"><linearGradient
inkscape:collect="never"
id="linearGradient52847"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop52843" /><stop
style="stop-color:#a6a6a6;stop-opacity:0;"
offset="1"
id="stop52845" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient52837"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop52833" /><stop
style="stop-color:#202020;stop-opacity:1;"
offset="0.45217207"
id="stop52854" /><stop
style="stop-color:#434343;stop-opacity:1;"
offset="0.56019127"
id="stop52852" /><stop
style="stop-color:#2f2f2f;stop-opacity:1;"
offset="0.65142226"
id="stop52850" /><stop
style="stop-color:#494949;stop-opacity:1;"
offset="1"
id="stop52835" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient52829"><stop
style="stop-color:#a6ff71;stop-opacity:1;"
offset="0"
id="stop52825" /><stop
style="stop-color:#00ce3f;stop-opacity:1;"
offset="1"
id="stop52827" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient3074"><stop
style="stop-color:#e26708;stop-opacity:1;"
offset="0"
id="stop3070" /><stop
style="stop-color:#bb3c00;stop-opacity:1;"
offset="1"
id="stop3072" /></linearGradient><radialGradient
xlink:href="#linearGradient45008"
id="radialGradient3076"
cx="30.688875"
cy="30.069115"
fx="30.688875"
fy="30.069115"
r="14.05412"
gradientUnits="userSpaceOnUse" /><linearGradient
xlink:href="#linearGradient45008"
id="linearGradient45010"
x1="-31.87768"
y1="22.065159"
x2="-31.87768"
y2="48.78738"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(101.16951,-6.5921995)" /><linearGradient
id="linearGradient45008"><stop
style="stop-color:#e14500;stop-opacity:1;"
offset="0"
id="stop45004" /><stop
style="stop-color:#e17900;stop-opacity:1;"
offset="0.59811592"
id="stop45012" /><stop
style="stop-color:#e19c00;stop-opacity:1;"
offset="1"
id="stop45006" /></linearGradient><linearGradient
xlink:href="#linearGradient45008"
id="linearGradient46715"
x1="31.917692"
y1="47.524929"
x2="31.917692"
y2="22.632998"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1.7923447e-6)" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient52829"
id="radialGradient52831"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763"
gradientTransform="matrix(1.4262952,0,0,1.3978826,-12.547099,-12.127595)"
gradientUnits="userSpaceOnUse" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient52837"
id="linearGradient52839"
x1="30.535707"
y1="49.245953"
x2="30.584797"
y2="23.731167"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.55406055,0,0,0.55406055,14.322436,9.5153603)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient52847"
id="linearGradient52841"
x1="37.60751"
y1="35.228773"
x2="41.117046"
y2="35.228773"
gradientUnits="userSpaceOnUse" /></defs><sodipodi:namedview
id="namedview6"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
showgrid="false"
inkscape:zoom="11.313709"
inkscape:cx="13.832776"
inkscape:cy="9.1039994"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g6492" /><g
id="g2210"
transform="matrix(0.54328517,0,0,0.54328517,-9.4489315,-11.300948)"><rect
style="fill:url(#radialGradient52831);fill-opacity:1;stroke:none;stroke-width:1.91428;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="rect18059"
width="28.875259"
height="28.300053"
x="17.679815"
y="21.376339"
ry="3.1061034" /><rect
style="opacity:0.460317;fill:#262626;stroke:none;stroke-width:55.2196;stroke-linecap:round;stroke-linejoin:round;stroke-dashoffset:3.6;paint-order:stroke fill markers"
id="rect22643"
width="1.840654"
height="1.840654"
x="-24.942825"
y="-13.826168"
ry="5.5219617" /><g
id="g6492"><rect
style="fill:#000000;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers;fill-opacity:1"
id="rect6340"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6346"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g><g
id="g6498"
transform="translate(0,7.8802994)"
style="opacity:0.62637363"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6494"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6496"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g><g
id="g6504"
transform="translate(0,15.760599)"
style="opacity:0.62637363"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6500"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6502"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g></g></svg>

After

Width:  |  Height:  |  Size: 7.8 KiB

43
Icons/UIRule.svg.import Normal file
View File

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b53un3tjulppj"
path="res://.godot/imported/UIRule.svg-dd35f8a9b19c4e01c4e95c28eb989981.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Icons/UIRule.svg"
dest_files=["res://.godot/imported/UIRule.svg-dd35f8a9b19c4e01c4e95c28eb989981.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

414
Icons/UIRuleSet.svg Normal file
View File

@ -0,0 +1,414 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="16"
viewBox="0 0 16 16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="UIRuleSet.svg"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
xml:space="preserve"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs8"><linearGradient
inkscape:collect="never"
id="linearGradient52847"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop52843" /><stop
style="stop-color:#a6a6a6;stop-opacity:0;"
offset="1"
id="stop52845" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient52837"><stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop52833" /><stop
style="stop-color:#202020;stop-opacity:1;"
offset="0.45217207"
id="stop52854" /><stop
style="stop-color:#434343;stop-opacity:1;"
offset="0.56019127"
id="stop52852" /><stop
style="stop-color:#2f2f2f;stop-opacity:1;"
offset="0.65142226"
id="stop52850" /><stop
style="stop-color:#494949;stop-opacity:1;"
offset="1"
id="stop52835" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient52829"><stop
style="stop-color:#a6ff71;stop-opacity:1;"
offset="0"
id="stop52825" /><stop
style="stop-color:#00ce3f;stop-opacity:1;"
offset="1"
id="stop52827" /></linearGradient><linearGradient
inkscape:collect="never"
id="linearGradient3074"><stop
style="stop-color:#e26708;stop-opacity:1;"
offset="0"
id="stop3070" /><stop
style="stop-color:#bb3c00;stop-opacity:1;"
offset="1"
id="stop3072" /></linearGradient><radialGradient
xlink:href="#linearGradient45008"
id="radialGradient3076"
cx="30.688875"
cy="30.069115"
fx="30.688875"
fy="30.069115"
r="14.05412"
gradientUnits="userSpaceOnUse" /><linearGradient
xlink:href="#linearGradient45008"
id="linearGradient45010"
x1="-31.87768"
y1="22.065159"
x2="-31.87768"
y2="48.78738"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(101.16951,-6.5921995)" /><linearGradient
id="linearGradient45008"><stop
style="stop-color:#e14500;stop-opacity:1;"
offset="0"
id="stop45004" /><stop
style="stop-color:#e17900;stop-opacity:1;"
offset="0.59811592"
id="stop45012" /><stop
style="stop-color:#e19c00;stop-opacity:1;"
offset="1"
id="stop45006" /></linearGradient><linearGradient
xlink:href="#linearGradient45008"
id="linearGradient46715"
x1="31.917692"
y1="47.524929"
x2="31.917692"
y2="22.632998"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(1.7923447e-6)" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient52829"
id="radialGradient52831"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763"
gradientTransform="matrix(0.59139069,0,0,0.57960986,6.120343,8.2897501)"
gradientUnits="userSpaceOnUse" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient52837"
id="linearGradient52839"
x1="30.535707"
y1="49.245953"
x2="30.584797"
y2="23.731167"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.55406055,0,0,0.55406055,14.322436,9.5153603)" /><linearGradient
inkscape:collect="never"
xlink:href="#linearGradient52847"
id="linearGradient52841"
x1="37.60751"
y1="35.228773"
x2="41.117046"
y2="35.228773"
gradientUnits="userSpaceOnUse" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient52829"
id="radialGradient8016"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.59139069,0,0,0.57960986,21.075656,8.2897501)"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient52829"
id="radialGradient8051"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.59139069,0,0,0.57960986,6.120343,8.2897501)"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient52829"
id="radialGradient8073"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.59139069,0,0,0.57960986,6.120343,8.2897501)"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763" /><radialGradient
inkscape:collect="never"
xlink:href="#linearGradient52829"
id="radialGradient8095"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.59139069,0,0,0.57960986,6.120343,8.2897501)"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763" /></defs><sodipodi:namedview
id="namedview6"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
showgrid="false"
inkscape:zoom="5.6568545"
inkscape:cx="-16.351844"
inkscape:cy="0.88388343"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g8071" /><g
id="g2210"
transform="matrix(0.54328517,0,0,0.54328517,-9.4489315,-11.300948)"><rect
style="opacity:0.460317;fill:#262626;stroke:none;stroke-width:55.2196;stroke-linecap:round;stroke-linejoin:round;stroke-dashoffset:3.6;paint-order:stroke fill markers"
id="rect22643"
width="1.840654"
height="1.840654"
x="-24.942825"
y="-13.826168"
ry="5.5219617" /><g
id="g6492" /><g
id="g8029"
transform="matrix(1.035544,0,0,1.035544,-0.60549555,-0.30971186)"><rect
style="fill:url(#radialGradient52831);fill-opacity:1;stroke:none;stroke-width:0.793728;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="rect18059"
width="11.972669"
height="11.734169"
x="18.653452"
y="22.181627"
ry="1.2878965" /><rect
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6340"
width="2.1378653"
height="2.2327683"
x="20.631182"
y="23.682613"
ry="1.1163841" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6346"
width="5.5808849"
height="1.7171954"
x="23.56654"
y="23.994223"
ry="0.8585977" /><g
id="g6498"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,16.585707)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6494"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6496"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g><g
id="g6504"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,19.853148)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6500"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect6502"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g></g><g
id="g8049"
transform="matrix(1.035544,0,0,1.035544,13.69009,-0.30971186)"><rect
style="fill:url(#radialGradient8051);fill-opacity:1;stroke:none;stroke-width:0.793728;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="rect8031"
width="11.972669"
height="11.734169"
x="18.653452"
y="22.181627"
ry="1.2878965" /><rect
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8033"
width="2.1378653"
height="2.2327683"
x="20.631182"
y="30.634645"
ry="1.1163841" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8035"
width="5.5808849"
height="1.7171954"
x="23.56654"
y="30.946257"
ry="0.8585977" /><g
id="g8041"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,16.585707)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8037"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8039"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g><g
id="g8047"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,13.293885)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8043"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8045"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g></g><g
id="g8071"
transform="matrix(1.035544,0,0,1.035544,-0.24810594,13.271094)"><rect
style="fill:url(#radialGradient8073);fill-opacity:1;stroke:none;stroke-width:0.793728;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="rect8053"
width="11.972669"
height="11.734169"
x="18.653452"
y="22.181627"
ry="1.2878965" /><rect
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8055"
width="2.1378653"
height="2.2327683"
x="20.631182"
y="30.477539"
ry="1.1163841" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8057"
width="5.5808849"
height="1.7171954"
x="23.56654"
y="30.789146"
ry="0.8585977" /><g
id="g8063"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,16.585707)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8059"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8061"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g><g
id="g8069"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,13.293885)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8065"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8067"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g></g><g
id="g8093"
transform="matrix(1.035544,0,0,1.035544,13.80922,13.271094)"><rect
style="fill:url(#radialGradient8095);fill-opacity:1;stroke:none;stroke-width:0.793728;stroke-linecap:round;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:1;paint-order:markers stroke fill"
id="rect8075"
width="11.972669"
height="11.734169"
x="18.653452"
y="22.181627"
ry="1.2878965" /><rect
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8077"
width="2.1378653"
height="2.2327683"
x="20.631182"
y="26.667667"
ry="1.1163841" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.763194;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8079"
width="5.5808849"
height="1.7171954"
x="23.56654"
y="26.979277"
ry="0.8585977" /><g
id="g8085"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,13.129329)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8081"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8083"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g><g
id="g8091"
transform="matrix(0.41463414,0,0,0.41463414,11.322799,19.853148)"
style="opacity:0.626374"><rect
style="fill:none;stroke:#000000;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8087"
width="5.1560278"
height="5.3849115"
x="22.449633"
y="24.996367"
ry="2.6924558" /><rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.84065;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-dashoffset:3.6;stroke-opacity:1;paint-order:stroke fill markers"
id="rect8089"
width="13.459782"
height="4.1414714"
x="29.529024"
y="25.747892"
ry="2.0707357" /></g></g></g></svg>

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bqo22c1m73dyu"
path="res://.godot/imported/UIRuleSet.svg-421bda2d7476eddcafe1e07da9c0badf.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Icons/UIRuleSet.svg"
dest_files=["res://.godot/imported/UIRuleSet.svg-421bda2d7476eddcafe1e07da9c0badf.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

110
Icons/UISelector.svg Normal file
View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="16"
viewBox="0 0 16 16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="UISelector.svg"
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs8">
<linearGradient
id="linearGradient3142">
<stop
style="stop-color:#d0ff71;stop-opacity:1;"
offset="0"
id="stop3138" />
<stop
style="stop-color:#57e253;stop-opacity:1;"
offset="0.70777082"
id="stop3144" />
<stop
style="stop-color:#00ac47;stop-opacity:1;"
offset="1"
id="stop3140" />
</linearGradient>
<linearGradient
inkscape:collect="never"
id="linearGradient3010">
<stop
style="stop-color:#61eb5c;stop-opacity:1;"
offset="0"
id="stop3006" />
<stop
style="stop-color:#61eb5c;stop-opacity:0;"
offset="1"
id="stop3008" />
</linearGradient>
<radialGradient
xlink:href="#linearGradient52829"
id="radialGradient52831"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763"
gradientTransform="matrix(0.77488503,0,0,0.75944889,-16.265584,-17.889689)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient52829">
<stop
style="stop-color:#a6ff71;stop-opacity:1;"
offset="0"
id="stop52825" />
<stop
style="stop-color:#00ce3f;stop-opacity:1;"
offset="1"
id="stop52827" />
</linearGradient>
<radialGradient
inkscape:collect="never"
xlink:href="#linearGradient52829"
id="radialGradient1831"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.77488503,0,0,0.75944889,24.936577,-7.3720413)"
cx="28.653395"
cy="30.427906"
fx="28.653395"
fy="30.427906"
r="14.43763" />
<radialGradient
xlink:href="#linearGradient3142"
id="radialGradient3012"
cx="34.411232"
cy="6.9380512"
fx="34.411232"
fy="6.9380512"
r="6.9478412"
gradientTransform="matrix(1.3704308,0,0,1.3673922,-40.629603,-3.0228913)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="namedview6"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#505050"
showgrid="false"
inkscape:zoom="5.181767"
inkscape:cx="30.97399"
inkscape:cy="-6.1754996"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
id="rect401"
style="color:#000000;fill:url(#radialGradient3012);fill-opacity:1;stroke-width:0.900682;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none;paint-order:markers stroke fill"
d="m 2.0179297,0.84117335 c -0.6071438,0 -1.12409494,0.51519135 -1.12409494,1.12233525 V 4.2257695 H 2.6952009 V 2.6425384 H 4.2661185 V 0.84117335 Z m 9.7667793,0 V 2.6425384 h 1.590268 v 1.5832311 h 1.801366 V 1.9635086 c 0,-0.6071439 -0.51695,-1.12233525 -1.124095,-1.12233525 z M 7.386845,3.0189963 A 4.9814516,4.9814516 0 0 0 4.9345934,3.9267159 L 5.8282399,4.8203614 A 3.7411636,3.7411636 0 0 1 7.386845,4.2644717 Z m 1.3334305,0.05981 v 1.271863 A 3.7411636,3.7411636 0 0 1 10.095929,5.0033124 L 10.97902,4.1219794 A 4.9814516,4.9814516 0 0 0 8.7202755,3.0788031 Z M 3.9635456,4.8379518 A 4.9814516,4.9814516 0 0 0 2.8904664,7.3201073 H 4.1482563 A 3.7411636,3.7411636 0 0 1 4.8448775,5.7192847 Z M 11.88498,5.1000648 10.987815,5.995471 a 3.7411636,3.7411636 0 0 1 0.517189,1.3246363 h 1.25603 A 4.9814516,4.9814516 0 0 0 11.88498,5.1000618 Z M 2.8922261,8.6535399 A 4.9814516,4.9814516 0 0 0 3.9776188,11.121622 L 4.8589507,10.24029 A 3.7411636,3.7411636 0 0 1 4.1552919,8.6535399 Z m 8.6110189,0 a 3.7411636,3.7411636 0 0 1 -0.518948,1.3228776 l 0.891887,0.8901285 a 4.9814516,4.9814516 0 0 0 0.883092,-2.2130061 z m -1.424908,2.3009631 a 3.7411636,3.7411636 0 0 1 -1.3580615,0.645608 v 1.270102 a 4.9814516,4.9814516 0 0 0 2.2446715,-1.030859 z m -4.2272288,0.177674 -0.895404,0.895406 A 4.9814516,4.9814516 0 0 0 7.386845,12.921229 V 11.677513 A 3.7411636,3.7411636 0 0 1 5.8511082,11.132178 Z M 0.89383476,11.74436 v 2.22356 c 0,0.607144 0.51695114,1.124094 1.12409494,1.124094 H 4.2661185 V 13.290649 H 2.6952009 V 11.74436 Z m 12.48114224,0 v 1.546289 h -1.590268 v 1.801365 h 2.267539 c 0.607145,0 1.124095,-0.51695 1.124095,-1.124094 v -2.22356 z" />
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://6rml2liif4ns"
path="res://.godot/imported/UISelector.svg-1da3b1c2f5d0e50773a94b5a365f6476.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Icons/UISelector.svg"
dest_files=["res://.godot/imported/UISelector.svg-1da3b1c2f5d0e50773a94b5a365f6476.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@ -3,208 +3,225 @@ using Godot;
using System.Collections.Generic;
namespace Rokojori
namespace Rokojori;
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Action.svg")]
public partial class Action : NetworkNode
{
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Action.svg")]
public partial class Action : NetworkNode
public enum ActionTriggerMode
{
public enum ActionTriggerMode
Only_When_Processing_In_Hierarchy,
Always
}
[Export]
public ActionTriggerMode triggerMode = ActionTriggerMode.Always;
#if !GD_SCRIPT_TRANSPILING
[ExportToolButton( "(?) Help", Icon = "Help") ]
public Callable openHelpButton => Callable.From( ()=>
{
#if TOOLS
Rokojori.Tools.OnlineDocs.Open( GetType() );
#endif
}
);
#endif
[ExportToolButton( "Trigger Action in Editor")]
public Callable TriggerActionButton => Callable.From( ()=> Trigger() );
#if !GD_SCRIPT_TRANSPILING
public static bool IsAction( Node n )
{
if ( n == null )
{
Only_When_Processing_In_Hierarchy,
Always
return false;
}
[Export]
public ActionTriggerMode triggerMode = ActionTriggerMode.Only_When_Processing_In_Hierarchy;
return n is Action || GDScriptAction.IsRJAction( n );
}
[ExportToolButton( "(?) Help", Icon = "Help") ]
public Callable openHelpButton => Callable.From( ()=>
public void LogInfoFor( Node n, string message )
{
var className = GDScriptNames.ExtractClassName( n );
RJLog.GDLog( $"{className}._onTrigger()", n, message );
}
#endif
public void Trigger()
{
if ( ! IsInstanceValid( this ) )
{
#if TOOLS
Rokojori.Tools.OnlineDocs.Open( GetType() );
#endif
}
);
[ExportToolButton( "Trigger Action in Editor")]
public Callable TriggerActionButton => Callable.From( ()=> Trigger() );
NetworkNodeSlot _seedSlot = new NetworkNodeSlot();
NetworkNodeSlot _dataSlot = new NetworkNodeSlot();
NetworkNodeSlot _seedAndDataSlot = new NetworkNodeSlot();
public static bool IsAction( Node n )
{
if ( n == null )
{
return false;
}
return n is Action || GDScriptAction.IsRJAction( n );
return;
}
public void LogInfoFor( Node n, string message )
if ( triggerMode == ActionTriggerMode.Only_When_Processing_In_Hierarchy && ! this.IsProcessingInHierarchy() )
{
var className = GDScriptNames.ExtractClassName( n );
RJLog.GDLog( $"{className}._onTrigger()", n, message );
return;
}
#if !GD_SCRIPT_TRANSPILING
protected override List<NetworkNodeMember> CreateNetworkNodeMembers()
_isNetworkedTrigger = false;
_sendsSeed = false;
_sendsData = false;
#endif
_OnTrigger();
#if !GD_SCRIPT_TRANSPILING
SendOverNetwork();
#endif
}
protected virtual void _OnTrigger()
{
}
#if !GD_SCRIPT_TRANSPILING
NetworkNodeSlot _seedSlot = new NetworkNodeSlot();
NetworkNodeSlot _dataSlot = new NetworkNodeSlot();
NetworkNodeSlot _seedAndDataSlot = new NetworkNodeSlot();
protected void SendOverNetwork()
{
// check which type
// seed data => type
// 0 0 => vanilla
// 1 0 => with seed
// 0 1 => with data
// 1 1 => with seed + data
}
protected override List<NetworkNodeMember> CreateNetworkNodeMembers()
{
return new List<NetworkNodeMember>()
{
return new List<NetworkNodeMember>()
{
_networkNodeSlot,
_seedSlot,
_dataSlot,
_seedAndDataSlot
};
}
_networkNodeSlot,
_seedSlot,
_dataSlot,
_seedAndDataSlot
};
}
public Action()
{
protected void _OnNetworkTrigger( int seed, BitView data )
{
_isNetworkedTrigger = true;
_receivedNetworkSeed = seed;
_receivedNetworkData = data;
}
_OnTrigger();
public void Trigger()
{
if ( ! IsInstanceValid( this ) )
{
return;
}
_isNetworkedTrigger = false;
}
if ( triggerMode == ActionTriggerMode.Only_When_Processing_In_Hierarchy && ! this.IsProcessingInHierarchy() )
{
return;
}
bool _isNetworkedTrigger = false;
int _receivedNetworkSeed = -1;
int _sendingNetworkSeed = -1;
_isNetworkedTrigger = false;
_sendsSeed = false;
_sendsData = false;
_OnTrigger();
bool _sendsSeed = false;
bool _sendsData = false;
SendOverNetwork();
BitView _sendingNetworkData;
BitView _receivedNetworkData;
}
public bool isNetworkedTrigger => _isNetworkedTrigger;
protected void SendOverNetwork()
{
// check which type
// 0 0 => vanilla
// 1 0 => with seed
// 0 1 => with data
// 1 1 => with seed + data
}
static readonly int maxNetworkSeed = Mathf.RoundToInt( Mathf.Pow( 2, 30 ) );
protected void _OnNetworkTrigger( int seed, BitView data )
{
_isNetworkedTrigger = true;
_receivedNetworkSeed = seed;
_receivedNetworkData = data;
_OnTrigger();
_isNetworkedTrigger = false;
}
bool _isNetworkedTrigger = false;
int _receivedNetworkSeed = -1;
int _sendingNetworkSeed = -1;
bool _sendsSeed = false;
bool _sendsData = false;
BitView _sendingNetworkData;
BitView _receivedNetworkData;
public bool isNetworkedTrigger => _isNetworkedTrigger;
static readonly int maxNetworkSeed = Mathf.RoundToInt( Mathf.Pow( 2, 30 ) );
protected int networkSeed
{
get
{
if ( _isNetworkedTrigger )
{
return _receivedNetworkSeed;
}
if ( _sendsSeed )
{
return _sendingNetworkSeed;
}
_sendingNetworkSeed = GodotRandom.Get().IntegerExclusive( 0, maxNetworkSeed );
_sendsSeed = true;
return _sendingNetworkSeed;
}
}
protected BitView GetNetworkData( BitView view )
protected int networkSeed
{
get
{
if ( _isNetworkedTrigger )
{
return _receivedNetworkData;
return _receivedNetworkSeed;
}
_sendingNetworkData = view;
_sendsData = true;
return _sendingNetworkData;
}
protected virtual void _OnTrigger()
{
}
public static void Trigger( Action action )
{
if ( action == null )
if ( _sendsSeed )
{
return;
return _sendingNetworkSeed;
}
action.Trigger();
}
_sendingNetworkSeed = GodotRandom.Get().IntegerExclusive( 0, maxNetworkSeed );
_sendsSeed = true;
public static void TriggerAll( Action[] actions, Node target, bool triggerDirectChildren, Action caller = null )
{
if ( actions != null )
{
for ( int i = 0; i < actions.Length; i++ )
{
Action.Trigger( actions[ i ] );
}
}
if ( ! triggerDirectChildren )
{
return;
}
Nodes.ForEachDirectChild<Action>( target, ( a ) => Trigger( a ) );
}
public static void TriggerAll( Action action, Node target, bool triggerDirectChildren )
{
if ( action != null )
{
Action.Trigger( action );
}
if ( ! triggerDirectChildren )
{
return;
}
Nodes.ForEachDirectChild<Action>( target, ( a ) => Trigger( a ) );
return _sendingNetworkSeed;
}
}
protected BitView GetNetworkData( BitView view )
{
if ( _isNetworkedTrigger )
{
return _receivedNetworkData;
}
_sendingNetworkData = view;
_sendsData = true;
return _sendingNetworkData;
}
public static void Trigger( Action action )
{
if ( action == null )
{
return;
}
action.Trigger();
}
public static void TriggerAll( Action[] actions, Node target, bool triggerDirectChildren, Action caller = null )
{
if ( actions != null )
{
for ( int i = 0; i < actions.Length; i++ )
{
Action.Trigger( actions[ i ] );
}
}
if ( ! triggerDirectChildren )
{
return;
}
Nodes.ForEachDirectChild<Action>( target, ( a ) => Trigger( a ) );
}
public static void TriggerAll( Action action, Node target, bool triggerDirectChildren )
{
if ( action != null )
{
Action.Trigger( action );
}
if ( ! triggerDirectChildren )
{
return;
}
Nodes.ForEachDirectChild<Action>( target, ( a ) => Trigger( a ) );
}
#endif
}

View File

@ -0,0 +1,17 @@
using Godot;
namespace Rokojori;
[Tool]
[GlobalClass]
public partial class MusicChannel:Resource
{
[Export]
public string playerName = "";
[Export]
public StringName audioBus = "";
}

View File

@ -0,0 +1 @@
uid://cs3ypfgd1r603

View File

@ -0,0 +1,89 @@
using Godot;
namespace Rokojori;
[Tool]
[GlobalClass]
public partial class MusicChannelPlayer:Node
{
[Export]
public MusicChannel channel;
[Export]
public MusicData currentMusic;
[Export]
public AudioStreamPlayer currentPlayer;
public void TweenVolume( AudioStreamPlayer target, float duration, float toVolume, bool clear, System.Action onReady = null )
{
var tl = TimeLineManager.Ensure( null );
var start = tl.position;
var fromVolume = target.VolumeLinear;
TimeLineManager.ScheduleSpanIn( tl, 0, duration,
( span, type )=>
{
if ( ! GodotObject.IsInstanceValid( target ) )
{
return;
}
var lerpedVolume = Mathf.Lerp( fromVolume, toVolume, span.phase );
target.VolumeLinear = lerpedVolume;
if ( type == TimeLineSpanUpdateType.End && clear )
{
if ( clear )
{
ClearAudioPlayer( target );
}
if ( onReady != null )
{
onReady();
}
}
},
this
);
}
async void ClearAudioPlayer( AudioStreamPlayer target )
{
await this.RequestNextFrame();
target.DeleteSelf();
}
public void SchedulePlayer( MusicData nextMusic, float duration, System.Action onReady )
{
if ( currentMusic != null )
{
this.LogInfo( "Muting:", currentMusic );
TweenVolume( currentPlayer, duration, 0f, true );
currentMusic = null;
currentPlayer = null;
}
this.LogInfo( "Playing:", nextMusic );
var name = FilePath.Absolute( nextMusic.audio.ResourcePath ).fileName;
var nextPlayer = this.CreateChild<AudioStreamPlayer>( "Player " + name );
nextPlayer.VolumeLinear = 0f;
nextPlayer.Stream = nextMusic.audio;
nextPlayer.PitchScale = MathAudio.SemitonesToFrequencyScaler( nextMusic.pitchSemitonesOffset );
nextPlayer.Bus = channel.audioBus;
currentMusic = nextMusic;
currentPlayer = nextPlayer;
TweenVolume( nextPlayer, duration, nextMusic.volume, false, onReady );
nextPlayer.Play();
}
}

View File

@ -0,0 +1 @@
uid://nwt0qlwimulf

View File

@ -0,0 +1,26 @@
using Godot;
namespace Rokojori;
[Tool]
[GlobalClass]
public partial class MusicData: Resource
{
[Export]
public Godot.AudioStream audio;
[Export( PropertyHint.Range, "0,1")]
public float volume = 1f;
[Export( PropertyHint.Range, "-36,36")]
public float pitchSemitonesOffset = 0f;
public override string ToString()
{
var prefix = pitchSemitonesOffset == 0 ? "+/-" : pitchSemitonesOffset > 0 ? "+" : "";
return "MusicData: " + (100 * volume)._FF() + "% (" + prefix + pitchSemitonesOffset + " st) " + audio.ResourcePath;
}
}

View File

@ -0,0 +1 @@
uid://b5443aoeefkin

View File

@ -0,0 +1,42 @@
using System;
using Godot;
namespace Rokojori;
[Tool]
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Tween.svg")]
public partial class ScheduleMusic:SequenceAction
{
[Export]
public float duration = 0;
[Export]
public MusicData musicData;
[Export]
public MusicChannel channel;
protected override void _OnTrigger()
{
this.LogInfo( "Scheduling:", musicData );
var id = DispatchStart();
var audioManager = Unique<AudioManager>.Get();
var player = audioManager.GetPlayer( channel );
player.SchedulePlayer(
musicData, Mathf.Max( 0.0f, duration), ()=>
{
DispatchEnd( id );
}
);
}
}

View File

@ -0,0 +1 @@
uid://tnm5c1nt0plk

View File

@ -0,0 +1,55 @@
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class CompositorEffectSetting:NumberAppSetting
{
[Export]
public float userRangeToEffectRange = 1f/100f;
[Export]
public CompositorEffect compositorEffect;
[Export]
public string effectSettingName = "";
public enum TargetType
{
Float,
Int,
Bool
}
[Export]
public TargetType targetType = TargetType.Float;
public override void ApplyValue( App app )
{
var stringValue = app.GetSetting( id );
var floatValue = RegexUtility.ParseFloat( stringValue );
var effectValue = floatValue * userRangeToEffectRange;
var member = effectSettingName;
if ( TargetType.Float == targetType )
{
ReflectionHelper.SetValue( compositorEffect, member, effectValue );
}
else if ( TargetType.Int == targetType )
{
ReflectionHelper.SetValue( compositorEffect, member, (int)effectValue );
}
else if ( TargetType.Bool == targetType )
{
ReflectionHelper.SetValue( compositorEffect, member, effectValue > 0 );
}
}
}
}

View File

@ -0,0 +1 @@
uid://fvqabvh4as0i

View File

@ -1,13 +1,46 @@
[gd_resource type="Resource" script_class="AppSettingsCategory" load_steps=5 format=3 uid="uid://4iqfk01k81nc"]
[gd_resource type="Resource" script_class="AppSettingsCategory" load_steps=13 format=3 uid="uid://4iqfk01k81nc"]
[ext_resource type="Script" uid="uid://b3kfbhiwqt26o" path="res://addons/rokojori_action_library/Runtime/App/Settings/AppSettingsCategory.cs" id="1_g7ii0"]
[ext_resource type="Resource" uid="uid://0itt52s066qp" path="res://addons/rokojori_action_library/Runtime/App/Settings/Presets/Graphics/UI Scale Setting.tres" id="2_xi6qd"]
[ext_resource type="Resource" uid="uid://bpfrw7y8jx2wp" path="res://addons/rokojori_action_library/Runtime/App/Settings/Presets/Graphics/Graphics Label.tres" id="3_g7ii0"]
[ext_resource type="Resource" uid="uid://cec7500hcn1e0" path="res://addons/rokojori_action_library/Runtime/App/Settings/Presets/Graphics/Resolution Scale Setting.tres" id="3_xi6qd"]
[ext_resource type="Resource" uid="uid://bd8cja8453an4" path="res://Rendering/FX-Anti-Aliasing.tres" id="4_27xtl"]
[ext_resource type="Script" uid="uid://bgw3wuqxbwrb0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/AntiAliasing/FXAA/FXAAEffect.cs" id="5_fe0r4"]
[ext_resource type="Script" uid="uid://fvqabvh4as0i" path="res://addons/rokojori_action_library/Runtime/App/Settings/NumberSetting/CompositorEffectSetting.cs" id="6_ajjd7"]
[ext_resource type="Resource" uid="uid://osfjg5u2jb4f" path="res://addons/rokojori_action_library/Runtime/Localization/DataBase/Numberic/Percantage-Suffix.tres" id="7_4upb4"]
[ext_resource type="Script" uid="uid://bvj322mokkq63" path="res://addons/rokojori_action_library/Runtime/Localization/LocaleText.cs" id="8_pdrnl"]
[sub_resource type="CompositorEffect" id="CompositorEffect_b71pn"]
resource_local_to_scene = false
resource_name = ""
enabled = true
effect_callback_type = 4
needs_motion_vectors = false
needs_normal_roughness = false
script = ExtResource("5_fe0r4")
amount = 4.0
compositorEffectID = ExtResource("4_27xtl")
metadata/_custom_type_script = "uid://bgw3wuqxbwrb0"
[sub_resource type="Resource" id="Resource_nhpaj"]
script = ExtResource("8_pdrnl")
en = "FX Anti-Aliasing"
metadata/_custom_type_script = "uid://bvj322mokkq63"
[sub_resource type="Resource" id="Resource_6o5ni"]
script = ExtResource("6_ajjd7")
compositorEffect = SubResource("CompositorEffect_b71pn")
effectSettingName = "amount"
max = 400.0
defaultValue = 100.0
stepSize = 10.0
suffix = ExtResource("7_4upb4")
title = SubResource("Resource_nhpaj")
metadata/_custom_type_script = "uid://fvqabvh4as0i"
[resource]
script = ExtResource("1_g7ii0")
title = ExtResource("3_g7ii0")
id = "graphics"
settings = [ExtResource("3_xi6qd"), ExtResource("2_xi6qd")]
settings = [ExtResource("2_xi6qd"), ExtResource("3_xi6qd"), SubResource("Resource_6o5ni")]
metadata/_custom_type_script = "uid://b3kfbhiwqt26o"

View File

@ -12,6 +12,24 @@ namespace Rokojori
Dictionary<AudioFlag,float> _lastPlayTime = new Dictionary<AudioFlag, float>();
[Export]
public MusicChannelPlayer[] players = [];
public MusicChannelPlayer GetPlayer( MusicChannel channel )
{
var player = players.Find( p => p.channel == channel );
if ( player == null )
{
player = this.CreateChild<MusicChannelPlayer>( channel.playerName );
player.channel = channel;
players = players.Add( player );
}
return player;
}
public float GetLastPlayed( AudioFlag selectorFlag )
{
if ( ! _lastPlayTime.ContainsKey( selectorFlag ) )

View File

@ -20,6 +20,8 @@ namespace Rokojori
[Export]
public int priority = 0;
public int combinedPriority => ! enabled ? -1 : priority;
[Export]
public PostProcessVolumeEffect[] effects;

View File

@ -90,18 +90,18 @@ namespace Rokojori
continue;
}
if ( volumes[ i ].priority < priorities[ j ] )
if ( volumes[ i ].combinedPriority < priorities[ j ] )
{
continue;
}
if ( priorities[ j ] < volumes[ i ].priority )
if ( priorities[ j ] < volumes[ i ].combinedPriority )
{
valueWeights[ j ] = 0f;
floatValues[ j ].SetFloatValue( 0f );
}
priorities[ j ] = volumes[ i ].priority;
priorities[ j ] = volumes[ i ].combinedPriority;
var value = floatValues[ j ].GetFloatValue();
@ -200,18 +200,18 @@ namespace Rokojori
continue;
}
if ( volumes[ i ].priority < priorities[ j ] )
if ( volumes[ i ].combinedPriority < priorities[ j ] )
{
continue;
}
if ( priorities[ j ] < volumes[ i ].priority )
if ( priorities[ j ] < volumes[ i ].combinedPriority )
{
valueWeights[ j ] = 0f;
colorValues[ j ].value = new Color( 0, 0, 0, 0 );
}
priorities[ j ] = volumes[ i ].priority;
priorities[ j ] = volumes[ i ].combinedPriority;
var weight = volumes[ i ].combinedWeight;

View File

@ -45,7 +45,7 @@ namespace Rokojori
{
get
{
if ( _fileName == null)
if ( _fileName == null )
{
_fileName = Path.GetFileNameWithoutExtension( path );
}

View File

@ -0,0 +1,18 @@
using Godot;
using System.Collections.Generic;
using System;
using System.Threading.Tasks;
using System.Reflection;
namespace Rokojori
{
public static class ControlExtensions
{
public static Vector2 GetCenter( this Control control )
{
return control.Position + control.Size * 0.5f;
}
}
}

View File

@ -0,0 +1 @@
uid://b1efhjod1yomf

View File

@ -470,6 +470,23 @@ namespace Rokojori
return null;
}
public T GetParentWithType<T>( N node )
{
var p = Parent( node );
while ( p != null )
{
if ( p is T t )
{
return t;
}
p = Parent( p );
}
return default(T);
}
public int GetAncestorDistance( N child, N ancestor )
{
if ( ancestor == null )

View File

@ -13,6 +13,35 @@ namespace Rokojori
X, Y, Z
}
public static float ComputeLineDistance( IEnumerable<Vector3> points )
{
return ComputeLineDistance( points, ( p ) => p );
}
public static float ComputeLineDistance<T>( IEnumerable<T> points, System.Func<T,Vector3> getPosition )
{
var distance = 0f;
Vector3? before = null;
foreach ( var p in points )
{
if ( before == null )
{
before = getPosition( p );
continue;
}
var b = (Vector3)before;
var position = getPosition( p );
distance += ( b - position ).Length();
before = position;
}
return distance;
}
public static float LookingAtEachOtherAngle( Vector3 lookDirectionA, Vector3 lookDirectionB )
{
return Dot( lookDirectionA, lookDirectionB );

View File

@ -0,0 +1,62 @@
using Godot;
using Rokojori;
using System.Collections.Generic;
namespace Rokojori
{
[Tool, GlobalClass]
public partial class AltByAngle_SplineUpGen:SplineUpGeneratorStrategy
{
[Export]
public Vector3 alternativeUp;
[Export( PropertyHint.Range, "0,90")]
public float angleThresholdDegrees = 5f;
[Export]
public bool forceFromPositions = false;
public override Vector3 ComputeUp(
int numReferences,
System.Func<int,Vector3> getPosition,
System.Func<int,Vector3> getForward,
System.Func<int,Vector3> getUp
)
{
var usePositions = forceFromPositions || getForward == null;
if ( numReferences <= 0 || usePositions && numReferences == 1 )
{
return Vector3.Up;
}
var forward = usePositions ? ( getPosition( 1 ) - getPosition( 0 ) ) : getForward( 0 );
var forwardNormalized = forward.Normalized();
var xzLength = forwardNormalized.XZ().Length();
if ( xzLength == 0 )
{
return alternativeUp;
}
var yawDir = new Vector2( xzLength, Mathf.Abs( forwardNormalized.Y ) );
var angle = yawDir.Angle();
if ( angle > angleThresholdDegrees )
{
return Vector3.Up;
}
var amount = 1f - ( angle / angleThresholdDegrees );
var slerped = Vector3.Up.Slerp( alternativeUp, amount );
return slerped;
}
}
}

View File

@ -0,0 +1 @@
uid://d0yj01q8hppot

View File

@ -0,0 +1,24 @@
using Godot;
using Rokojori;
using System.Collections.Generic;
namespace Rokojori
{
[Tool, GlobalClass]
public partial class Constant_SplineUpGen:SplineUpGeneratorStrategy
{
[Export]
public Vector3 constantUp;
public override Vector3 ComputeUp(
int getNumReferences,
System.Func<int,Vector3> getPosition,
System.Func<int,Vector3> getForward,
System.Func<int,Vector3> getUp
)
{
return constantUp;
}
}
}

View File

@ -0,0 +1 @@
uid://c257amlha7moj

View File

@ -0,0 +1,19 @@
using Godot;
using Rokojori;
using System.Collections.Generic;
namespace Rokojori
{
[Tool, GlobalClass]
public abstract partial class SplineUpGeneratorStrategy:Resource
{
public abstract Vector3 ComputeUp(
int getNumReferences,
System.Func<int,Vector3> getPosition,
System.Func<int,Vector3> getForward,
System.Func<int,Vector3> getUp
);
}
}

View File

@ -0,0 +1 @@
uid://vl5tkdm7lnc0

View File

@ -0,0 +1,24 @@
using Godot;
using Rokojori;
using System.Collections.Generic;
namespace Rokojori
{
[Tool, GlobalClass]
public partial class WorldUp_SplineUpGen:SplineUpGeneratorStrategy
{
public static readonly WorldUp_SplineUpGen instance = new WorldUp_SplineUpGen();
public override Vector3 ComputeUp(
int getNumReferences,
System.Func<int,Vector3> getPosition,
System.Func<int,Vector3> getForward,
System.Func<int,Vector3> getUp
)
{
return Vector3.Up;
}
}
}

View File

@ -0,0 +1 @@
uid://d3x1tsjce28xe

View File

@ -375,6 +375,20 @@ namespace Rokojori
return selection;
}
public T FromWeightedElements<T>( IList<T> elements, Func<T,float> getWeight )
{
var weights = new List<float>( elements.Count );
foreach ( var e in elements )
{
weights.Add( getWeight( e ) );
}
var index = IndexFromUnnormalizedWeights( weights );
return elements[ index ];
}
public int IndexFromUnnormalizedWeights( List<float> weights, float sumWeights = 0 )
{
if ( sumWeights <= 0 )

View File

@ -53,6 +53,12 @@ namespace Rokojori
[Export( PropertyHint.Range, "0,1") ]
public float normalEdgeAmountMax = 0.15f;
[Export( PropertyHint.Range, "0,1") ]
public float normalZFilterWeight = 1f;
[Export]
public float normalZDiffWeight = 1.0f;
[Export]
public float zTreshold = 0.1f;
@ -77,6 +83,9 @@ namespace Rokojori
[Export ]
public Vector2 zOutput = new Vector2( 0f, 1f );
[Export( PropertyHint.Range, "0,1") ]
public float debugViewZ = 0;
RG_ScreenColorTexure screenColorTexture;
RG_ScreenDepthTexture screenDepthTexture;
@ -186,7 +195,12 @@ namespace Rokojori
rimContrast,
rimStrength,
Mathf.Pow( 10f, outlineWidth ),
edgeDistanceFade
edgeDistanceFade,
debugViewZ,
normalZFilterWeight,
normalZDiffWeight,
0f
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dpagciclpro4l"
path="res://.godot/imported/good-graphics.png-71a1fa2dc0da1570f69568e7db0767eb.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow Assets/good-graphics.png"
dest_files=["res://.godot/imported/good-graphics.png-71a1fa2dc0da1570f69568e7db0767eb.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://drfvhbwh15gkg"
path="res://.godot/imported/star-glow-blur.png-142c3c2b394a06f53c56fa99ae68e47e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow Assets/star-glow-blur.png"
dest_files=["res://.godot/imported/star-glow-blur.png-142c3c2b394a06f53c56fa99ae68e47e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cb7n8cuuqqgn1"
path="res://.godot/imported/star-glow.png-183351a5bd2df4d5391efd4f3d4d6420.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow Assets/star-glow.png"
dest_files=["res://.godot/imported/star-glow.png-183351a5bd2df4d5391efd4f3d4d6420.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -4,8 +4,9 @@
[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="2_bfksq"]
[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="3_eyvih"]
[ext_resource type="Script" uid="uid://t5g1g1uv5yrj" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Overlay/TextureOverlay/TextureOverlayEffect.cs" id="4_chktd"]
[ext_resource type="Texture2D" uid="uid://cqaqvhmyuo56d" path="res://VFX/Compositor Effects/Star Glow/star-glow-blur.png" id="5_1gqhf"]
[ext_resource type="Texture2D" uid="uid://cb7n8cuuqqgn1" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow Assets/star-glow.png" id="5_chktd"]
[ext_resource type="Script" uid="uid://cqkrgyuerq50a" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Distortion/EllispeDistortion/EllipseDistortionEffect.cs" id="6_t8xaw"]
[ext_resource type="Texture2D" uid="uid://drfvhbwh15gkg" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorVFXPresets/Glow/Rainbow Star Glow Assets/star-glow-blur.png" id="7_1gqhf"]
[ext_resource type="Script" uid="uid://6jkixa201wux" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Glow/ChromaticBloom/ChromaticBloomEffect.cs" id="7_g2w8j"]
[ext_resource type="Script" uid="uid://pevgspwywsxi" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Color/HSLAdjustment/HSLAdjustmentEffect.cs" id="8_bfeok"]
[ext_resource type="Script" uid="uid://ckixweetchlo0" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorVFXPreset.cs" id="9_fgrt2"]
@ -27,16 +28,15 @@ script = ExtResource("1_e74ec")
member = "opacity"
curve = SubResource("Curve_xhmdb")
[sub_resource type="Resource" id="Resource_1ntwo"]
[sub_resource type="Resource" id="Resource_mdsx3"]
script = ExtResource("2_bfksq")
[sub_resource type="Resource" id="Resource_5jnfl"]
script = ExtResource("3_eyvih")
owner = SubResource("Resource_1ntwo")
owner = SubResource("Resource_mdsx3")
[sub_resource type="Gradient" id="Gradient_qf8q3"]
offsets = PackedFloat32Array(0.34812286, 0.70307165, 0.8988327)
colors = PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1, 16.420414, 16.420414, 16.420414, 1)
offsets = PackedFloat32Array(0.60144925, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_cqn6v"]
gradient = SubResource("Gradient_qf8q3")
@ -44,10 +44,7 @@ use_hdr = true
fill = 1
fill_from = Vector2(0.5, 0.50427353)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_g6idi"]
load_path = "res://.godot/imported/star-glow.png-61f0458024aeba1668f3516b3db84782.ctex"
[sub_resource type="CompositorEffect" id="CompositorEffect_e74ec"]
[sub_resource type="CompositorEffect" id="CompositorEffect_wpvj8"]
resource_local_to_scene = false
resource_name = ""
enabled = true
@ -55,10 +52,10 @@ effect_callback_type = 4
needs_motion_vectors = false
needs_normal_roughness = false
script = ExtResource("4_chktd")
opacity = 0.0
opacity = 0.5578947
blendMode = 1
overlayTexture = SubResource("CompressedTexture2D_g6idi")
overlayTint = Color(1, 1, 1, 0.050980393)
overlayTexture = ExtResource("5_chktd")
overlayTint = Color(1, 1, 1, 0.33333334)
tiling = Vector2(9, 5.0625)
scrolling = Vector2(0.22, 0.012)
maskTexture = SubResource("GradientTexture2D_cqn6v")
@ -82,7 +79,7 @@ curve = SubResource("Curve_xhmdb")
[sub_resource type="Resource" id="Resource_qf8q3"]
script = ExtResource("3_eyvih")
owner = SubResource("Resource_1ntwo")
owner = SubResource("Resource_mdsx3")
[sub_resource type="Gradient" id="Gradient_7ucn0"]
offsets = PackedFloat32Array(0.08171206, 0.57587546, 1)
@ -94,7 +91,7 @@ use_hdr = true
fill = 1
fill_from = Vector2(0.5, 0.50427353)
[sub_resource type="CompositorEffect" id="CompositorEffect_bfksq"]
[sub_resource type="CompositorEffect" id="CompositorEffect_ysmsc"]
resource_local_to_scene = false
resource_name = ""
enabled = true
@ -102,10 +99,10 @@ effect_callback_type = 4
needs_motion_vectors = false
needs_normal_roughness = false
script = ExtResource("4_chktd")
opacity = 0.0
opacity = 0.5578947
blendMode = 1
overlayTexture = ExtResource("5_1gqhf")
overlayTint = Color(1, 1, 1, 0.21568628)
overlayTexture = ExtResource("7_1gqhf")
overlayTint = Color(1, 1, 1, 0)
tiling = Vector2(1, 0.5625)
scrolling = Vector2(-0.1, -0.01)
maskTexture = SubResource("GradientTexture2D_su8gi")
@ -126,9 +123,9 @@ curve = SubResource("Curve_nxurn")
[sub_resource type="Resource" id="Resource_slvrs"]
script = ExtResource("3_eyvih")
owner = SubResource("Resource_1ntwo")
owner = SubResource("Resource_mdsx3")
[sub_resource type="CompositorEffect" id="CompositorEffect_eyvih"]
[sub_resource type="CompositorEffect" id="CompositorEffect_t5au6"]
resource_local_to_scene = false
resource_name = ""
enabled = true
@ -136,7 +133,7 @@ effect_callback_type = 4
needs_motion_vectors = false
needs_normal_roughness = false
script = ExtResource("6_t8xaw")
distortionAmount = 0.0
distortionAmount = 0.12
ellipseScale = 1.138
ringsDistribution = 0.7727
animationTargets = [SubResource("Resource_35pef")]
@ -151,12 +148,13 @@ point_count = 3
script = ExtResource("1_e74ec")
member = "amount"
curve = SubResource("Curve_71075")
curveScale = 0.2
[sub_resource type="Resource" id="Resource_bhyc7"]
script = ExtResource("3_eyvih")
owner = SubResource("Resource_1ntwo")
owner = SubResource("Resource_mdsx3")
[sub_resource type="CompositorEffect" id="CompositorEffect_chktd"]
[sub_resource type="CompositorEffect" id="CompositorEffect_ixqtu"]
resource_local_to_scene = false
resource_name = ""
enabled = true
@ -164,11 +162,11 @@ effect_callback_type = 4
needs_motion_vectors = false
needs_normal_roughness = false
script = ExtResource("7_g2w8j")
amount = 0.0
amount = 0.1691
num = 3
distortionAmount = 0.4369
distortionAngle = 168.8496
distortionAngleSpeed = 10.0
distortionAngleSpeed = 40.0
smearingSteps = 24
smearing = 1.2171
redShift = 0.2239
@ -196,9 +194,9 @@ curve = SubResource("Curve_su8gi")
[sub_resource type="Resource" id="Resource_7jt2s"]
script = ExtResource("3_eyvih")
owner = SubResource("Resource_1ntwo")
owner = SubResource("Resource_mdsx3")
[sub_resource type="CompositorEffect" id="CompositorEffect_1gqhf"]
[sub_resource type="CompositorEffect" id="CompositorEffect_m7r8b"]
resource_local_to_scene = false
resource_name = ""
enabled = true
@ -206,7 +204,7 @@ effect_callback_type = 4
needs_motion_vectors = false
needs_normal_roughness = false
script = ExtResource("8_bfeok")
amount = 0.0
amount = 1.0
saturationOffset = 30.0
saturationGamma = 37.9747
lightnessOffset = 2.0
@ -217,5 +215,5 @@ metadata/_custom_type_script = "uid://pevgspwywsxi"
[resource]
script = ExtResource("9_fgrt2")
effects = [SubResource("CompositorEffect_e74ec"), SubResource("CompositorEffect_bfksq"), SubResource("CompositorEffect_eyvih"), SubResource("CompositorEffect_chktd"), SubResource("CompositorEffect_1gqhf")]
effects = [SubResource("CompositorEffect_wpvj8"), SubResource("CompositorEffect_ysmsc"), SubResource("CompositorEffect_t5au6"), SubResource("CompositorEffect_ixqtu"), SubResource("CompositorEffect_m7r8b")]
metadata/_custom_type_script = "uid://ckixweetchlo0"

View File

@ -1,8 +1,7 @@
[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=36 format=3 uid="uid://0blw3yhjw7y0"]
[gd_resource type="Resource" script_class="CompositorVFXPreset" load_steps=35 format=3 uid="uid://0blw3yhjw7y0"]
[ext_resource type="Script" uid="uid://cx5qcow1mmd11" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/CompositorEffectOwner.cs" id="1_0ail8"]
[ext_resource type="Script" uid="uid://dvvfvlutisecy" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/AnimationTargets/CompFXMemberCurveTarget.cs" id="1_4xviq"]
[ext_resource type="Resource" uid="uid://bwhnq7w0tpgv" path="res://VFX/Action FX Compositor Effect Layer.tres" id="2_4xviq"]
[ext_resource type="Script" uid="uid://comuvej4dr22k" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffectReferences/RokojoriCompositorEffectID.cs" id="2_tc21q"]
[ext_resource type="Script" uid="uid://bx4j8ic80vl7f" path="res://addons/rokojori_action_library/Runtime/Rendering/Compositor/CompositorEffects/Edge/DepthOutlines/DepthOutlinesEffect.cs" id="3_dryyw"]
[ext_resource type="Texture2D" uid="uid://c30nul6romace" path="res://addons/rokojori_action_library/Runtime/Procedural/Noise/RGB 3D Noise.png" id="5_orb2s"]
@ -26,7 +25,6 @@ script = ExtResource("1_0ail8")
[sub_resource type="Resource" id="Resource_p64cs"]
script = ExtResource("2_tc21q")
owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq")
[sub_resource type="Curve" id="Curve_7axlu"]
_data = [Vector2(0, 1), 0.0, -18.573792, 0, 0, Vector2(0.07774799, 0.15679264), -0.687919, -0.687919, 0, 0, Vector2(1, 0), -0.069252, 0.0, 0, 0]
@ -91,7 +89,6 @@ metadata/_custom_type_script = "uid://dvvfvlutisecy"
[sub_resource type="Resource" id="Resource_hpfyh"]
script = ExtResource("2_tc21q")
owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq")
[sub_resource type="Gradient" id="Gradient_frwbc"]
offsets = PackedFloat32Array(1)
@ -135,7 +132,6 @@ metadata/_custom_type_script = "uid://dvvfvlutisecy"
[sub_resource type="Resource" id="Resource_gxlxg"]
script = ExtResource("2_tc21q")
owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq")
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_4n83u"]
load_path = "res://.godot/imported/RGB 3D Noise.png-daebfe00d2f3fcd5d3bc528f8a3972e1.ctex"
@ -172,7 +168,6 @@ metadata/_custom_type_script = "uid://balixgskgouhm"
[sub_resource type="Resource" id="Resource_3tnad"]
script = ExtResource("2_tc21q")
owner = SubResource("Resource_4xviq")
layer = ExtResource("2_4xviq")
[sub_resource type="CompositorEffect" id="CompositorEffect_hdnet"]
resource_local_to_scene = false

View File

@ -57,6 +57,11 @@ uniform Parameters
float outlineWidth;
float edgeDistanceFade;
float debugViewZ;
float normalFilterWeight;
float normalZDiffWeight;
float pad3;
} parameters;
@ -144,6 +149,28 @@ float mapClamped( float value, float inMin, float inMax, float outMin, float out
return mix( outMin, outMax, normalizeToRange01( value, inMin, inMax ) );
}
float edgeFilter( vec3 nA, vec3 nB, float zA, float zB, float zScale )
{
float dotValue = dot( nA, nB );
float angleAmount = max( 0.0, 1.0 - dotValue );
angleAmount = smoothstep( parameters.normalEdgeZMin, parameters.normalEdgeZMax, angleAmount );
// Same direction => ( 1 - 0 ) => 1, edge
// Not same direction => ( 1 - 1 ) => 0, no edge
float normalizedZDiff = abs( zA - zB ) * parameters.normalZDiffWeight * zScale;
// 1 => big z distance
// 0 => close z
float zDiffAmount = clamp( normalizedZDiff, 0.0, 1.0 );
// 0 distance => close => edge
// 1 distance => far => no edge
float invZDIff = 1.0 - zDiffAmount;
return clamp( angleAmount + invZDIff, 0.0, 1.0 );
}
void main( )
{
ivec2 size = imageSize( outputImage );
@ -220,12 +247,35 @@ void main( )
float normalEdge = 0.0;
normalEdge = max( normalEdge, 1.0 - dot( n11, n01 ) );
normalEdge = max( normalEdge, 1.0 - dot( n11, n21 ) );
normalEdge = max( normalEdge, 1.0 - dot( n11, n10 ) );
normalEdge = max( normalEdge, 1.0 - dot( n11, n12 ) );
// float zDiffNormalizer = parameters.normalZDiffWeight;
float edgeWeight = smoothstep( parameters.normalEdgeZMin, parameters.normalEdgeZMax, normalEdge );
// float zDiffAmount01 = max( 0.0, 1.0 - abs( z11 - z01 ) * zDiffNormalizer );
// float zDiffAmount21 = max( 0.0, 1.0 - abs( z11 - z21 ) * zDiffNormalizer );
// float zDiffAmount10 = max( 0.0, 1.0 - abs( z11 - z10 ) * zDiffNormalizer );
// float zDiffAmount12 = max( 0.0, 1.0 - abs( z11 - z12 ) * zDiffNormalizer );
// normalEdge = max( normalEdge, 1.0 - ( dot( n11, n01 ) * zDiffAmount01 ) );
// normalEdge = max( normalEdge, 1.0 - ( dot( n11, n21 ) * zDiffAmount21 ) );
// normalEdge = max( normalEdge, 1.0 - ( dot( n11, n10 ) * zDiffAmount10 ) );
// normalEdge = max( normalEdge, 1.0 - ( dot( n11, n12 ) * zDiffAmount12 ) );
// normalEdge = max( normalEdge, edgeFilter( n11, n01, z11, z01, adaptiveScale ) );
// normalEdge = max( normalEdge, edgeFilter( n11, n21, z11, z21, adaptiveScale ) );
// normalEdge = max( normalEdge, edgeFilter( n11, n10, z11, z10, adaptiveScale ) );
// normalEdge = max( normalEdge, edgeFilter( n11, n12, z11, z12, adaptiveScale ) );
normalEdge += edgeFilter( n11, n01, z11, z01, adaptiveScale );
normalEdge += edgeFilter( n11, n21, z11, z21, adaptiveScale );
normalEdge += edgeFilter( n11, n10, z11, z10, adaptiveScale );
normalEdge += edgeFilter( n11, n12, z11, z12, adaptiveScale );
normalEdge /= 4.0;
// float edgeWeight = smoothstep( parameters.normalEdgeZMin, parameters.normalEdgeZMax, normalEdge );
float edgeWeight = normalEdge;
edgeWeight = mix( 1.0, edgeWeight, parameters.normalFilterWeight );
float edge = max( normalEdge * parameters.normalEdgeAmount, zEdge * parameters.zEdgeAmount * edgeWeight );
edge = clamp01( edge );
@ -241,6 +291,10 @@ void main( )
// originalColor.rgb = mix( originalColor.rgb, vec3( 0.0, 0.0, 0.0 ), shadowAmount );
vec4 mixedColor = mix( originalColor, edgeColor, parameters.amount * edge );
if ( parameters.debugViewZ > 0.0 )
{
mixedColor.rgb = mix( mixedColor.rgb, vec3( normalEdge * 1.0 ), parameters.debugViewZ );
}
imageStore( outputImage, xy, mixedColor );
}

View File

@ -192,7 +192,7 @@ directionUpTexture = ExtResource("6_0hfff")
[sub_resource type="Resource" id="Resource_40bf3"]
script = ExtResource("2_4sutq")
value = 0.7
value = 1.5
unit = "em"
[sub_resource type="Resource" id="Resource_xrtll"]
@ -274,7 +274,7 @@ backgroundTexture = ExtResource("21_hcyk3")
[resource]
script = ExtResource("1_urlfx")
fontSize = SubResource("Resource_40bf3")
iconHeightInEm = 1.5
iconHeightInEm = 3.0
mouseInputIcon = SubResource("Resource_34cgw")
keyboardKeys = SubResource("Resource_nkgsq")
keyboardModifiers = SubResource("Resource_wrdp7")

View File

@ -1,11 +1,18 @@
[gd_resource type="Resource" script_class="CombineSensor" load_steps=4 format=3 uid="uid://cqatyb80rpor0"]
[gd_resource type="Resource" script_class="CombineSensor" load_steps=6 format=3 uid="uid://cqatyb80rpor0"]
[ext_resource type="Script" uid="uid://eid0qnlvq4n1" path="res://addons/rokojori_action_library/Runtime/Sensors/CombineSensor.cs" id="1_u5wou"]
[ext_resource type="Script" uid="uid://e7fduwypgvwr" path="res://addons/rokojori_action_library/Runtime/Sensors/InputMapActionSensor.cs" id="2_ibucs"]
[ext_resource type="Script" uid="uid://cc8g4jmyrpehg" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Types/GamePadAxisIcon.cs" id="2_n3xai"]
[sub_resource type="Resource" id="Resource_yth0n"]
script = ExtResource("2_n3xai")
type = 1
metadata/_custom_type_script = "uid://cc8g4jmyrpehg"
[sub_resource type="Resource" id="Resource_n3xai"]
script = ExtResource("2_ibucs")
inputActionName = "ui_left"
inputIcons = [SubResource("Resource_yth0n")]
metadata/_custom_type_script = "uid://e7fduwypgvwr"
[resource]

View File

@ -1,11 +1,17 @@
[gd_resource type="Resource" script_class="CombineSensor" load_steps=4 format=3 uid="uid://dafu3alp6wr25"]
[gd_resource type="Resource" script_class="CombineSensor" load_steps=6 format=3 uid="uid://dafu3alp6wr25"]
[ext_resource type="Script" uid="uid://eid0qnlvq4n1" path="res://addons/rokojori_action_library/Runtime/Sensors/CombineSensor.cs" id="1_rqdfo"]
[ext_resource type="Script" uid="uid://e7fduwypgvwr" path="res://addons/rokojori_action_library/Runtime/Sensors/InputMapActionSensor.cs" id="2_oj4wy"]
[ext_resource type="Script" uid="uid://cc8g4jmyrpehg" path="res://addons/rokojori_action_library/Runtime/Sensors/InputIcons/Types/GamePadAxisIcon.cs" id="2_tuqbj"]
[sub_resource type="Resource" id="Resource_i2j76"]
script = ExtResource("2_tuqbj")
metadata/_custom_type_script = "uid://cc8g4jmyrpehg"
[sub_resource type="Resource" id="Resource_tuqbj"]
script = ExtResource("2_oj4wy")
inputActionName = "ui_right"
inputIcons = [SubResource("Resource_i2j76")]
metadata/_custom_type_script = "uid://e7fduwypgvwr"
[resource]

View File

@ -25,6 +25,8 @@ namespace Rokojori
return false;
}
this.LogInfo( "Checking Icon:", device.GetType().Name, icon.GetType().Name );
return device.ContainsIcon( icon );
}
}

View File

@ -45,6 +45,8 @@ namespace Rokojori
return ci.icons.Length == 1 && ContainsIcon( ci.icons[ 0 ] );
}
return ReflectionHelper.IsTypeOneOf( icon,
typeof( GamePadAxisIcon ),
typeof( GamePadButtonIcon )

View File

@ -6,7 +6,7 @@ namespace Rokojori
{
[Tool]
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorGroup.svg")]
public partial class SensorDevice: Resource
public abstract partial class SensorDevice: Resource
{
public virtual string GetInfo()

View File

@ -11,6 +11,13 @@ namespace Rokojori
[Export]
public Sensor sensor;
public static SensorIcon Create( Sensor sensor )
{
var si = new SensorIcon();
si.sensor = sensor;
return si;
}
public override bool Equals( object obj )
{
var value = obj as SensorIcon;

View File

@ -0,0 +1,9 @@
vec3 translation;
mat3 rotation;
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Vertex.gdshaderinc"
mat4 combined = createMat4FromBasisAndOrigin( rotation, translation );
MODELVIEW_MATRIX *= combined;
MODELVIEW_NORMAL_MATRIX *= rotation;

View File

@ -0,0 +1 @@
uid://k6hhfjejkh5p

View File

@ -0,0 +1,4 @@
// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Includes.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Transform.gdshaderinc"
#include "res://addons/rokojori_action_library/Runtime/Shading/Library/Bezier.gdshaderinc"

View File

@ -0,0 +1 @@
uid://c1f4jt1qpwk42

View File

@ -0,0 +1,24 @@
// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Includes.gdshaderinc"
// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Variables.gdshaderinc"
instance uniform vec3 startPosition;
instance uniform vec3 startForward;
instance uniform vec3 startUp;
instance uniform float startNormalizedDistance;
instance uniform vec3 endPosition;
instance uniform vec3 endForward;
instance uniform vec3 endUp;
instance uniform float endNormalizedDistance;
instance uniform float lineLength;
uniform float scaling:hint_range(0.0,2.0) = 1.0;
uniform int positionInterpolationMode = 0;
uniform float bezierCurvature:hint_range(0.0,0.5) = 0.3333333333;
uniform float rationalCurvature :hint_range(0.0,0.5) = 0.5;
uniform float rationalWeighting :hint_range(0.0,1.0) = 0.5;
uniform int rotationInterpolationMode = 0;
varying float normalizedDistance;
varying float t;

View File

@ -0,0 +1 @@
uid://buho4jxq4dkpl

View File

@ -0,0 +1,86 @@
// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Includes.gdshaderinc"
// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Variables.gdshaderinc"
// #include "res://addons/rokojori_action_library/Runtime/Shading/Library/LineVFX/LineVFX-Vertex.gdshaderinc"
// vec3 translation; mat3 rotation;
if ( positionInterpolationMode == 0 )
{
translation = mix( startPosition, endPosition, t );
}
else if ( positionInterpolationMode == 1 )
{
float controlLength = length( endPosition - startPosition ) * bezierCurvature;
vec3 c0 = startPosition + normalize( startForward ) * controlLength;
vec3 c1 = endPosition - normalize( endForward ) * controlLength;
translation = cubicBezier( t, startPosition, c0, c1, endPosition );
}
else if ( positionInterpolationMode == 2 )
{
float controlLength = length( endPosition - startPosition ) * rationalCurvature;
vec3 c0 = startPosition + normalize( startForward ) * controlLength;
vec3 c1 = endPosition - normalize( endForward ) * controlLength;
translation = rationalCubicBezier( t,
startPosition, c0, c1, endPosition,
1.0, rationalWeighting, rationalWeighting, 1.0
);
}
if ( rotationInterpolationMode == 0 )
{
vec3 forward = normalize( mix( startForward, endForward, t ) );
vec3 up = normalize( mix( startUp, endUp, t ) );
rotation = lookRotation( forward, up );
}
else if ( rotationInterpolationMode == 1 )
{
vec4 startRotation = quaternionFromLookRotation( startForward, startUp );
vec4 endRotation = quaternionFromLookRotation( endForward, endUp );
vec4 qRotation = quaternionSlerp( startRotation, endRotation, t );
rotation = quaternionToRotationMatrix( qRotation );
}
else if ( rotationInterpolationMode == 2 )
{
float controlLength = length( endPosition - startPosition ) * bezierCurvature;
vec3 c0 = startPosition + normalize( startForward ) * controlLength;
vec3 c1 = endPosition - normalize( endForward ) * controlLength;
vec3 forward = normalize( cubicBezierDerivative( t, startPosition, c0, c1, endPosition ) );
vec3 up = normalize( mix( startUp, endUp, t ) );
rotation = lookRotation( forward, up );
}
else if ( rotationInterpolationMode == 3 )
{
vec3 lineDirection = normalize( endPosition - startPosition );
vec3 forward = t < 0.5 ? mix( startForward, lineDirection, t * 2.0 ) :
mix( lineDirection, endForward, ( t - 0.5 ) * 2.0 );
vec3 up = normalize( mix( startUp, endUp, t ) );
rotation = lookRotation( forward, up );
}
else if ( rotationInterpolationMode == 4 )
{
bool isStart = t < 0.5;
vec3 lineDirection = normalize( endPosition - startPosition );
vec3 centerUp = normalize( mix( startUp, endUp, 0.5 ) );
vec3 forwardA = isStart ? startForward : lineDirection;
vec3 forwardB = isStart ? lineDirection : endForward;
vec3 upA = isStart ? startUp : centerUp;
vec3 upB = isStart ? centerUp : endUp;
vec4 rotationA = quaternionFromLookRotation( forwardA, upA );
vec4 rotationB = quaternionFromLookRotation( forwardB, upB );
float rt = isStart ? ( t * 2.0 ) : ( ( t -0.5 ) * 2.0 );
vec4 qRotation = quaternionSlerp( rotationA, rotationB, rt );
rotation = quaternionToRotationMatrix( qRotation );
}

View File

@ -0,0 +1 @@
uid://dairdipwvqk75

View File

@ -0,0 +1,177 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
namespace Rokojori;
public class GDScriptFromCSAST
{
public GDScriptGeneratorClass gdClass = new GDScriptGeneratorClass();
public string rokojoriPrefix = "RJ_";
public static string CStoGDVariable( string csName )
{
var sb = new StringBuilder();
var hasUnderscore = false;
var wordStarted = false;
for ( int i = 0; i < csName.Length; i++ )
{
if ( char.IsUpper( csName[ i ] ) )
{
if ( ! hasUnderscore && wordStarted )
{
sb.Append( "_" );
hasUnderscore = true;
}
sb.Append( char.ToLower( csName[ i ] ) );
wordStarted = true;
}
else
{
sb.Append( csName[ i ] );
hasUnderscore = csName[ i ] == '_';
if ( ! hasUnderscore )
{
wordStarted = true;
}
}
}
return sb.ToString();
}
public string GetClassName( string className, string ns )
{
if ( ns.StartsWith( "Rokojori" ) )
{
return rokojoriPrefix + className;
}
return className;
}
public void Convert( CSFileRoot root )
{
var walker = root.walker;
var csClass = walker.Find( root, n => n is CSClassDeclaration, true ) as CSClassDeclaration;
gdClass.name = GetClassName( csClass.GetClassName(), "Rokojori" );
if ( csClass.objectTail != null && csClass.objectTail.inheritanceDeclaration != null )
{
gdClass.extendingClassName = GetClassName( csClass.objectTail.GetExtendingObject(), "Rokojori" );
}
var atts = CSModifierAttributesParser.GetAttributes( csClass.attributeBrackets );
RJLog.Log( "Att:", atts.Map( a => "'" + a + "'" ) );
atts.ForEach(
( att )=>
{
if ( att == "Tool" )
{
gdClass.annotations.Add( "tool" );
}
else if ( att.StartsWith( "Icon" ) )
{
var lcAtt = ( att[ 0 ] + "" ).ToLower() + att.Substring( 1 );
gdClass.annotations.Add( lcAtt );
}
}
);
var members = new List<CSMemberDeclaration>();
walker.Iterate( csClass,
n =>
{
if ( n is CSEnumDeclaration en )
{
var enumType = new GDScriptGeneratorEnum();
enumType.name = en.objectName.match;
var values = en.objectBody.children.FilterType<ASTNode,CSEnumValueDeclaration>( );
enumType.values =values.Map( v => v.GetEnumName() );
gdClass.members.Add( enumType );
return;
}
if ( ! ( n is CSMemberDeclaration ) )
{
return;
}
var m = n as CSMemberDeclaration;
GDScriptGeneratorMember gdMember = null;
if ( m is CSFieldDeclaration f )
{
var gdField = new GDScriptGeneratorField();
gdField.name = CStoGDVariable( f.GetMemberName() );
gdField.memberType = f.GetMemberType();
gdMember = gdField;
}
else if ( m is CSMethodMemberDeclaration me )
{
var gdMethod = new GDScriptGeneratorMethod();
gdMethod.name = me.isContructor ? "_init" : CStoGDVariable( me.GetMemberName() );
gdMethod.memberType = me.GetMemberType();
gdMethod.isConstructor = me.isContructor;
if ( me.parametersContent != null )
{
me.parametersContent.children.ForEach(
( c ) =>
{
var p = c as CSParameterDeclaration;
var gdParameter = new GDScriptGeneratorParameter();
gdParameter.name = p.GetParameterName();
gdParameter.parameterType = p.GetParameterType();
gdMethod.parameters.Add( gdParameter );
if ( p.parameterValue != null )
{
gdParameter.parameterValue = p.GetParameterValue();
}
}
);
}
gdMember = gdMethod;
}
if ( gdMember == null )
{
return;
}
if ( CSModifierAttributesParser.IsExported( m.attributeBrackets ) )
{
gdMember.annotations.Add( "export" );
}
gdClass.members.Add( gdMember );
},
false
);
}
}

View File

@ -0,0 +1 @@
uid://cgi2d0hhd5d6t

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Rokojori;
public class GDScriptGenerator
{
public static readonly string GD_SCRIPT_TRANSPILING = "GD_SCRIPT_TRANSPILING";
public List<GDScriptGeneratorClass> gdClasses = new List<GDScriptGeneratorClass>();
public void Generate( string outputPath )
{
gdClasses.ForEach(
( gd )=>
{
var source = gd.Generate();
RJLog.Log( "GD Script from:", gd.name, "\n" + source );
var path = FilePath.Join( outputPath, gd.name + ".gd" );
RJLog.Log( "GD Script Save to:", path );
FilesSync.SaveUTF8( path, source );
}
);
}
}

View File

@ -0,0 +1 @@
uid://duym6hiqy40dh

View File

@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Rokojori;
public class GDScriptGeneratorClass
{
public List<string> annotations = [];
public string name;
public string extendingClassName;
public List<GDScriptGeneratorMember> members = [];
StringBuilder sb = new StringBuilder();
public string Generate()
{
sb.Append( "\n" );
annotations.ForEach(
annotation =>
{
sb.Append( "@" );
sb.Append( annotation );
sb.Append( "\n" );
}
);
AddClassHeader();
sb.Append( "\n" );
members.ForEach( m =>
{
m.Generate( sb );
sb.Append( "\n" );
});
return sb.ToString();
}
void AddClassHeader()
{
sb.Append( "class_name " + name );
if ( extendingClassName != null )
{
sb.Append( " extends " + extendingClassName );
}
sb.Append( "\n" );
}
}

View File

@ -0,0 +1 @@
uid://dvt4yeqpmmrur

View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Rokojori;
public class GDScriptGeneratorEnum:GDScriptGeneratorMember
{
public List<string> values = new List<string>();
public override void Generate( StringBuilder sb )
{
sb.Append( "enum " + name + "\n" );
sb.Append( "{\n" );
for ( int i = 0; i < values.Count; i ++ )
{
var ending = "\n";
if ( i != ( values.Count - 1 ) )
{
ending = ",\n";
}
sb.Append( " " + values[ i ] + ending );
}
sb.Append( "}\n" );
}
}

View File

@ -0,0 +1 @@
uid://eqbysvejll0q

View File

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Rokojori;
public class GDScriptGeneratorField:GDScriptGeneratorMember
{
public override void Generate( StringBuilder sb )
{
annotations.ForEach(
( an )=>
{
sb.Append( "@" );
sb.Append( an );
sb.Append( "\n" );
}
);
sb.Append( "var " + name + ": " + memberType + "; " );
}
}

View File

@ -0,0 +1 @@
uid://51c533ougel

View File

@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Rokojori;
public abstract class GDScriptGeneratorMember
{
public string name;
public string memberType;
public List<string> annotations = [];
public abstract void Generate( StringBuilder sb );
}

View File

@ -0,0 +1 @@
uid://bnl20gavp2hi2

View File

@ -0,0 +1,75 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Rokojori;
public class GDScriptGeneratorMethod:GDScriptGeneratorMember
{
public List<GDScriptGeneratorParameter> parameters = [];
public string body = "";
public bool isConstructor = false;
public override void Generate( StringBuilder sb )
{
sb.Append( "\n" );
sb.Append( "func " + name + "(" );
var first = true;
if ( parameters.Count > 0 )
{
sb.Append( " " );
}
parameters.ForEach(
( p ) =>
{
if ( first )
{
first = false;
}
else
{
sb.Append( ", " );
}
p.Generate( sb );
}
);
if ( parameters.Count > 0 )
{
sb.Append( " " );
}
if ( isConstructor )
{
sb.Append( "):\n" );
}
else
{
sb.Append( ") -> " + memberType + ":\n" );
}
if ( string.IsNullOrEmpty( body ) )
{
sb.Append( " pass" );
}
else
{
sb.Append( body );
}
sb.Append( "\n" );
sb.Append( "## ---");
sb.Append( "\n" );
}
}

View File

@ -0,0 +1 @@
uid://ddcgqrokie8en

View File

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Rokojori;
public class GDScriptGeneratorParameter
{
public string name;
public string parameterType;
public string parameterValue;
public void Generate( StringBuilder sb )
{
sb.Append( name + ": " + parameterType );
if ( parameterValue != null )
{
sb.Append( " = " + parameterValue );
}
}
}

View File

@ -0,0 +1 @@
uid://bg3fdqomodfh2

View File

@ -42,6 +42,10 @@ namespace Rokojori
public bool hasError => _hasError;
public virtual void Clear()
{
_hasError = false;
}
void AddMatcher( LexerMatcher matcher )
{
@ -74,6 +78,16 @@ namespace Rokojori
AddMatcher( type, new Regex( regex ), mode, nextMode );
}
public virtual bool HasVariableMatch( string type )
{
return LexerMatcherLibrary.CwordMatcher.type == type || LexerMatcherLibrary.CFunctionMatcher.type == type;
}
public static bool IsVariableMatchType( string type )
{
return LexerMatcherLibrary.CwordMatcher.type == type || LexerMatcherLibrary.CFunctionMatcher.type == type;
}
public LexerMatcher GetMatcher( string source, string mode ="" )
{
var matchers = _modes[ mode ];

View File

@ -12,11 +12,11 @@ namespace Rokojori
}
public class CSharpLexer:Lexer
public class CSLexer:Lexer
{
public static List<LexerEvent> Lex( string source )
{
var lexer = new CSharpLexer();
var lexer = new CSLexer();
var events = lexer.LexToList( source );
if ( lexer.hasError )
@ -38,7 +38,6 @@ namespace Rokojori
public static List<CSharpObjectDefinition> GetAllObjectDefinitions( List<LexerEvent> tokens )
{
var START = Trillean.True;
var END = Trillean.False;
var INSIDE = Trillean.Any;
@ -72,7 +71,7 @@ namespace Rokojori
return sequences.Map( s => new CSharpObjectDefinition{ type = s[ 0 ], name = s[ s.Count - 1 ] } );
}
public CSharpLexer()
public CSLexer()
{
AddAllMatchers(
LexerMatcherLibrary.SingleLineCommentMatcher,
@ -87,7 +86,7 @@ namespace Rokojori
LexerMatcherLibrary.WhiteSpaceMatcher,
LexerMatcherLibrary.LogicMatcher,
LexerMatcherLibrary.BracketMatcher,
LexerMatcherLibrary.AccessModifierMatcher,
LexerMatcherLibrary.CSAccessModifierMatcher,
LexerMatcherLibrary.ClassMatcher,
LexerMatcherLibrary.EnumMatcher,
LexerMatcherLibrary.StructMatcher,
@ -95,6 +94,8 @@ namespace Rokojori
LexerMatcherLibrary.RecordMatcher,
LexerMatcherLibrary.OperatorMatcher,
LexerMatcherLibrary.CFunctionMatcher,
LexerMatcherLibrary.UsingMatcher,
LexerMatcherLibrary.NamespaceMatcher,
LexerMatcherLibrary.CwordMatcher,
LexerMatcherLibrary.AnySymbolMatcher
);

View File

@ -18,6 +18,11 @@ namespace Rokojori
public static readonly LexerMatcher PHPWordMatcher =
new LexerMatcher( "PHPWord", @"\$?[a-zA-Z_]\w*" );
public static readonly LexerMatcher UsingMatcher =
new LexerMatcher( "Using", @"using" );
public static readonly LexerMatcher NamespaceMatcher =
new LexerMatcher( "Namespace", @"namespace" );
public static readonly LexerMatcher CSS_ClassSelectorMatcher =
new LexerMatcher( "CSS_ClassSelector", @"\.[a-zA-Z_](\w|\-)*" );
@ -58,7 +63,7 @@ namespace Rokojori
new LexerMatcher( "Logic", "if|else|switch|do|while|for|break|continue|return" );
public static readonly LexerMatcher OperatorMatcher =
new LexerMatcher( "Operator", "(?:\\=\\=)|(?:\\+\\+)|(?:\\-\\-)|(?:\\+\\=)|(?:\\*\\=)|(?:\\-\\=)|(?:\\/\\=)|\\+|\\-|\\*|\\/|\\^|\\||\\~|\\&|\\%|\\<|\\>|\\=|\\!|\\.|\\:|\\,|\\;" );
new LexerMatcher( "Operator", "(?:\\=\\=)|(?:\\+\\+)|(?:\\-\\-)|(?:\\+\\=)|(?:\\*\\=)|(?:\\-\\=)|(?:\\/\\=)|(?:\\=\\>)|\\+|\\-|\\*|\\/|\\^|\\|\\||\\||\\~|\\&\\&|\\&|\\%|\\<|\\>|\\=|\\!|\\.|\\:|\\,|\\;" );
public static readonly LexerMatcher BracketMatcher =
new LexerMatcher( "Bracket", @"\(|\)|\[|\]|\{|\}" );
@ -87,6 +92,9 @@ namespace Rokojori
public static readonly LexerMatcher AccessModifierMatcher =
new LexerMatcher( "AccessModifier", @"\b(?:public|protected|private|const)\b" );
public static readonly LexerMatcher CSAccessModifierMatcher =
new LexerMatcher( "AccessModifier", @"\b(?:public|protected|private|const|partial|internal|abstract|static|sealed|virtual|override|readonly|ref|unsafe|new)\b" );
public static readonly LexerMatcher SingleLineCommentMatcher =
new LexerMatcher( "SingleLineComment", @"//.*" );

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
namespace Rokojori;
public interface ASTFileRoot
{
public string GetFilePath();
public string GetSource();
public TextLinesMapper GetTextLinesMapper();
public Parser GetParser();
}

View File

@ -0,0 +1 @@
uid://blsoe8oknj2wy

View File

@ -0,0 +1,918 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
using System;
namespace Rokojori;
public abstract class ASTNode
{
Parser _parser;
public Parser parser
{
get
{
if ( _parser == null )
{
var root = this is ASTFileRoot ? (ASTFileRoot) this :
( ASTWalker.instance.GetParentWithType<ASTFileRoot>( this ) as ASTFileRoot );
_parser = root.GetParser();
}
return _parser;
}
}
public ASTNode parent;
public List<ASTNode> children = [];
int ComputeIndex( int index )
{
return index >= 0 ? index : ( children.Count + index );
}
public string CreateDebugTreeInfo()
{
var walker = ASTWalker.instance;
var end = walker.IterationEndOf( this );
var it = this;
var depthMap = new Dictionary<ASTNode,int>();
Func<ASTNode,int> GetDepth = null;
GetDepth = n =>
{
if ( depthMap.ContainsKey( n ) )
{
return depthMap[ n ];
}
if ( n.parent == null )
{
return 0;
}
var parentDepth = GetDepth( n.parent );
var ownDepth = parentDepth + 1;
depthMap[ n ] = ownDepth;
return ownDepth;
};
var lines = new List<string>();
while ( it != end )
{
var indent = " ".Repeat( GetDepth( it ) );
var info = indent + "-- [#" + it.childIndex + "] " + it.GetType();
if ( it is Token tk )
{
info += "'" + tk.match+ "'";
}
else
{
info += "(" + it.children.Count + ")";
}
lines.Add( info );
it = walker.NextNode( it );
}
return lines.Join( "\n");
}
public List<Token> GrabTokenRange( Token start, Token end, bool filter )
{
if ( start.parent != this || end.parent != this )
{
RJLog.Error( "Tokens are not children of this", GetType().Name, "start:", start, "end:", end );
return null;
}
var startIndex = start.childIndex;
var endIndex = end.childIndex;
// RJLog.Log( "Grabbing Child Range:", startIndex, "to", endIndex, " num children:", children.Count );
var unfiltered = children.Range( start.childIndex, end.childIndex );
var filtered = unfiltered.Filter( n => n is Token && ( ! filter || ! n.IsIgnoreToken() ) );
return filtered.Map( f => f as Token );
}
public void MergeChildren( int start, int length, ASTNode merger )
{
merger.parent = this;
merger.children = children.Sub( start, length );
merger.children.ForEach( c => c.parent = merger );
children.ReplaceRange( start, length, [ merger ] );
}
public T MergeInner<T>( int indexStart, int indexEnd ) where T:ASTNode,new()
{
var start = indexStart + 1;
var length = indexEnd - start;
return MergeChildrenWith<T>( start, length );
}
public T MergeOuter<T>( int indexStart, int indexEnd ) where T:ASTNode,new()
{
var start = indexStart;
var length = indexEnd - start + 1;
return MergeChildrenWith<T>( start, length );
}
public T MergeOuter<T>( ASTNode nodeStart, ASTNode nodeEnd ) where T:ASTNode,new()
{
if ( nodeStart.parent != this || nodeEnd.parent != this )
{
RJLog.Error( "Nodes are not child of this node:", this,
"start:", nodeStart, "start is child:", nodeStart.parent == this,
"end:", nodeEnd, "end is child:", nodeEnd.parent == this
);
return null;
}
var startIndex = nodeStart.childIndex;
var endIndex = children.FindIndex( startIndex, c => c == nodeEnd );
return MergeOuter<T>( startIndex, endIndex );
}
public T MergeInner<T>( ASTNode nodeStart, ASTNode nodeEnd ) where T:ASTNode,new()
{
if ( nodeStart.parent != this || nodeEnd.parent != this )
{
RJLog.Error( "Nodes are not child of this node:", this, "start:", nodeStart, "end:", nodeEnd );
return null;
}
var startIndex = nodeStart.childIndex;
var endIndex = children.FindIndex( startIndex, c => c == nodeEnd );
RJLog.Log( "Merging:", startIndex, endIndex );
if ( startIndex == -1 || endIndex == - 1 )
{
return null;
}
return MergeInner<T>( startIndex, endIndex );
}
public int childIndex => parent == null ? -1 : parent.children.IndexOf( this );
public int reverseIndexOffset => parent == null ? -1 :
( ( parent.children.Count - 1 ) - childIndex );
public string CombinedMatch()
{
if ( this is Token tk )
{
return tk.match;
}
var tokens = children.FilterType<ASTNode,Token>();
return tokens.Map( t => t.match ).Join( "" );
}
public void ExpandToPrevious( ASTNode previousSibling )
{
if ( parent == null || previousSibling == null || parent != previousSibling.parent )
{
RJLog.Error( "Invalid sibling", previousSibling?.GetType().Name ?? "null" );
return;
}
var start = previousSibling.childIndex;
var length = childIndex - start;
var beforeCount = children.Count;
var range = parent.children.Sub( start, length );
parent.children.RemoveRange( start, length );
range.ForEach( r => r.parent = this );
children.Prepend( range );
RJLog.Log( "Expanded from", beforeCount, "to", children.Count, "( " + length + " )" );
}
public ASTWalker walker => Singleton<ASTWalker>.Get();
public T GetParentWithType<T>()
{
return walker.GetParentWithType<T>( this );
}
public T MergeChildrenWith<T>( int start, int length ) where T:ASTNode, new()
{
var t = new T();
MergeChildren( start, length, t );
return t;
}
public int FindIndex( System.Func<ASTNode,bool> evaluator, int offset = 0, int end = -1, bool forward = true )
{
offset = ComputeIndex( offset );
end = ComputeIndex( end );
var change = forward ? 1 : -1;
end += change;
// RJLog.Log( "start:", offset, "end:", end, "direction:", change > 0 ? "forward" : "backwards", change, "children:", children.Count );
for ( int i = offset; i != end; i += change )
{
if ( evaluator( children[ i ] ) )
{
return i;
}
else
{
// RJLog.Log( "not matching", children[ i ] );
}
}
return -1;
}
public ASTNode FindNode( System.Func<ASTNode,bool> evaluator, int offset = 0 )
{
var index = FindIndex( evaluator, offset );
return index == -1 ? null : children[ index ];
}
public int ReverseFindBracketOpenerIndex( string open, string close, int closeIndex )
{
closeIndex --;
var count = 1;
// RJLog.Log( "ReverseFindBracketOpenerIndex", open, close, closeIndex );
for ( int i = closeIndex; i >= 0; i-- )
{
var child = children[ i ];
// RJLog.Log( "index", i, count, child );
if ( child.IsToken( LexerMatcherLibrary.BracketMatcher, open ) )
{
count --;
if ( count == 0 )
{
return i;
}
}
else if ( child.IsToken( LexerMatcherLibrary.BracketMatcher, close ) )
{
count ++;
}
// RJLog.Log( "index", i, count );
}
return -1;
}
public int FindBracketCloserIndex( string open, string close, int openIndex )
{
openIndex ++;
var count = 1;
// RJLog.Log( "ReverseFindBracketOpenerIndex", open, close, closeIndex );
for ( int i = openIndex; i < children.Count; i++ )
{
var child = children[ i ];
// RJLog.Log( "index", i, count, child );
if ( child.IsToken( LexerMatcherLibrary.BracketMatcher, close ) )
{
count --;
if ( count == 0 )
{
return i;
}
}
else if ( child.IsToken( LexerMatcherLibrary.BracketMatcher, open ) )
{
count ++;
}
// RJLog.Log( "index", i, count );
}
return -1;
}
public List<int> GetSeparatorIndices( string separator, int start, int end, List<TokenPredicateData> blockPredicates = null, Lexer lexer = null )
{
lexer = lexer ?? new CSLexer();
var hasBlockPredicated = blockPredicates != null;
var separatorPredicate = TokenPredicateData.Lexed( lexer, separator );
if ( ! hasBlockPredicated )
{
blockPredicates = new List<TokenPredicateData>();
blockPredicates.Add( TokenPredicateData.Lexed( lexer, "<" ) );
blockPredicates.Add( TokenPredicateData.Lexed( lexer, ">" ) );
blockPredicates.Add( TokenPredicateData.Lexed( lexer, "[" ) );
blockPredicates.Add( TokenPredicateData.Lexed( lexer, "]" ) );
blockPredicates.Add( TokenPredicateData.Lexed( lexer, "(" ) );
blockPredicates.Add( TokenPredicateData.Lexed( lexer, ")" ) );
blockPredicates.Add( TokenPredicateData.Lexed( lexer, "{" ) );
blockPredicates.Add( TokenPredicateData.Lexed( lexer, "}" ) );
}
var bcCounter = new List<int>();
for ( int i = 0; i < blockPredicates.Count; i+= 2 )
{
bcCounter.Add( 0 );
}
var inBlock = false;
var indices = new List<int>();
for ( int i = start + 1; i < end; i++ )
{
if ( children[ i ].IsIgnoreToken() )
{
continue;
}
if ( ! inBlock && separatorPredicate.Matches( children[ i ] ) )
{
indices.Add( i );
continue;
}
var bcIndex = blockPredicates.FindIndex( bc => bc.Matches( children[ i ] ) );
if ( bcIndex == -1 )
{
continue;
}
var index = bcIndex / 2;
var isUp = index * 2 == bcIndex;
var change = isUp ? 1 : -1;
bcCounter[ index ] += change;
var sum = 0; bcCounter.ForEach( b => sum += b );
inBlock = sum != 0;
}
return indices;
}
public void CreateSeperatedList<T>( string separator, Action<T> callback = null ) where T:ASTNode, new()
{
var indices = GetSeparatorIndices( separator, -1, children.Count );
indices.Insert( 0, -1 );
indices.Add( children.Count );
RJLog.Log( "Parameters Indices:", indices.Count, CombinedMatch() );
var nodes = new List<ASTNode>();
for ( int i = 0; i < indices.Count - 1; i++ )
{
var start = indices[ i ] + 1;
var end = indices[ i + 1 ] - 1;
var t = new T();
RJLog.Log( "Parameters Grabbing Indices:", start, end );
if ( start > end || start < 0 || end < 0 || start >= children.Count || end >= children.Count )
{
RJLog.Error( "Invalid seperation indices", this, CombinedMatch() );
throw new Exception();
}
if ( start == end )
{
t.children = [ children[ start ] ];
}
else
{
t.children = children.Range( start, end );
}
t.children.ForEach( c => c.parent = t );
nodes.Add( t );
t.parent = this;
}
children = nodes;
if ( callback != null )
{
children.ForEach( n => callback( n as T ) );
}
}
public Token FindBracketCloser( string open, string close, int openIndex )
{
var index = FindBracketCloserIndex( open, close, openIndex );
return index == -1 ? null : ( children[ index ] as Token );
}
public Token ReverseFindBracketOpener( string open, string close, int closeIndex )
{
var index = ReverseFindBracketOpenerIndex( open, close, closeIndex );
return index == -1 ? null : ( children[ index ] as Token );
}
public bool IsToken( LexerMatcher matcher, string match = null )
{
return this is Token tk && tk.Is( matcher, match );
}
public bool IsToken( string type, string match = null )
{
return this is Token tk && tk.Is( type, match );
}
public bool IsAnyTokenOf( LexerMatcher[] matchers )
{
return this is Token tk && tk.lexerEvent.IsAnyOf( matchers );
}
public bool IsAnyTokenOf( List<TokenPredicateData> predicates )
{
return this is Token && predicates.Find( p => p.Matches( this ) ) != null ;
}
public bool IsIgnoreToken()
{
return IsAnyTokenOf( LexerMatcherLibrary.Ignore );
}
public int IndexOffset( int index, int offset )
{
if ( offset < 0 )
{
while ( offset < 0 )
{
index = PreviousIndex( index );
offset ++;
}
}
else
{
while ( offset > 0 )
{
index = NextIndex( index );
offset--;
}
}
return index;
}
public int PreviousIndex( int index )
{
for ( int i = index - 1; i >= 0; i-- )
{
if ( children[ i ].IsIgnoreToken() )
{
continue;
}
return i;
}
return -1;
}
public ASTNode PreviousNode( int index )
{
return IndexToChildNode( PreviousIndex( index ) );
}
public int NextIndex( int index )
{
for ( int i = index + 1; i < children.Count; i++ )
{
if ( children[ i ].IsIgnoreToken() )
{
continue;
}
return i;
}
return -1;
}
public ASTNode NextNode( int index )
{
return IndexToChildNode( NextIndex( index ) );
}
ASTNode IndexToChildNode( int index )
{
return index == -1 ? null : children[ index ];
}
public Token FindToken( LexerMatcher matcher, int offset = 0 )
{
return FindToken( matcher, null, offset );
}
public Token FindToken( TokenPredicateData predicateData, int offset = 0 )
{
return FindToken( predicateData.type, predicateData.match, offset );
}
public Token FindToken( string type, string match, int offset = 0 )
{
return FindNode( n => n.IsToken( type, match ), offset ) as Token;
}
public Token FindToken( LexerMatcher matcher, string match, int offset = 0 )
{
return FindNode( n => n.IsToken( matcher, match ), offset ) as Token;
}
public int FindTokenIndex( LexerMatcher matcher, string match, int offset = 0, int end = -1, bool forward = true )
{
return FindIndex( n => n.IsToken( matcher, match ), offset, end, forward );
}
public int FindTokenIndex( string type, string match, int offset = 0, int end = -1, bool forward = true )
{
return FindIndex( n => n.IsToken( type, match ), offset, end, forward );
}
public int FindTokenIndex( LexerMatcher matcher, int offset = 0, int end = -1, bool forward = true )
{
return FindIndex( n => n.IsToken( matcher, null ), offset, end, forward );
}
public int ReverseFindTokenIndex( LexerMatcher matcher, int reverseOffset = 0)
{
return FindTokenIndex( matcher, -( 1 + reverseOffset ), 0, false );
}
public int ReverseFindTokenIndex( TokenPredicateData predicateData, int reverseOffset = 0 )
{
return FindTokenIndex( predicateData.type, predicateData.match, -( 1 + reverseOffset ), 0, false );
}
public Token ReverseFindToken( TokenPredicateData predicateData, int reverseOffset = 0 )
{
var index = ReverseFindTokenIndex( predicateData, reverseOffset );
return index == -1 ? null : ( children[ index ] as Token );
}
public List<Token> GetFilteredTokens( int offset = 0, int end = -1 )
{
var tokens = new List<Token>();
IterateTokens( tokens.Add, offset, end );
return tokens;
}
public void Iterate<T>( Action<T> action, Predicate<T> filter = null, int offset = 0, int end = -1, bool forward = true )
{
offset = ComputeIndex( offset );
end = ComputeIndex( end );
int change = forward ? 1 : -1;
end += change;
for ( int i = offset; i != end; i += change )
{
if ( children[ i ] is T t && ( filter == null || filter( t ) ) )
{
action( t );
}
}
}
public void IterateTokens( Action<Token> action, int start = 0, int end = -1, LexerMatcher[] ignoreMatchers = null, bool forward = true )
{
start = ComputeIndex( start );
end = ComputeIndex( end );
ignoreMatchers = ignoreMatchers ?? LexerMatcherLibrary.Ignore;
Iterate<Token>( action, ( t ) => ! t.IsAnyTokenOf( ignoreMatchers ), start, end, true );
}
public string GetTokenMatches( int offset = 0, int end = -1, LexerMatcher[] ignoreMatchers = null )
{
var sb = new StringBuilder();
IterateTokens(
( tk )=>
{
sb.Append( tk.match );
},
offset, end,
ignoreMatchers,
true
);
return sb.ToString();
}
public int SearchIndex( Predicate<ASTNode> searchPredicate, Predicate<ASTNode> ignore = null, int offset = 0, int end = -1, bool forward = true )
{
offset = ComputeIndex( offset );
end = ComputeIndex( end );
var change = forward ? 1 : -1;
end += change;
// RJLog.Log( "SearchIndex", offset, end, "Change", change );
if ( change > 0 && end < offset )
{
throw new System.Exception( "Invalid range, offset is higher than end: " + offset + " >> " + end );
}
else if ( change < 0 && end > offset )
{
throw new System.Exception( "Invalid range, offset is lower than end: " + offset + " >> " + end );
}
for ( int i = offset; i != end; i += change )
{
if ( searchPredicate( children[ i ] ) )
{
return i;
}
if ( ignore( children[ i ] ) )
{
continue;
}
return -1;
}
return -1;
}
public int SearchFilteredTokenIndex( LexerMatcher matcher, string match, int offset = 0 )
{
return SearchIndex(
( n ) => n.IsToken( matcher, match ),
( n ) => n.IsAnyTokenOf( LexerMatcherLibrary.Ignore ),
offset, -1,
true
);
}
public int SearchFilteredTokenIndex( string type, string match, int offset = 0 )
{
return SearchIndex(
( n ) => n.IsToken( type, match ),
( n ) => n.IsAnyTokenOf( LexerMatcherLibrary.Ignore ),
offset, -1,
true
);
}
public int SearchFilteredTokenIndex( Predicate<Token> predicate, int offset = 0 )
{
return SearchIndex(
( n ) => n is Token t && predicate( t ),
( n ) => n.IsAnyTokenOf( LexerMatcherLibrary.Ignore ),
offset, -1,
true
);
}
public int SearchFilteredTokenIndex( LexerMatcher matcher, int offset = 0 )
{
return SearchFilteredTokenIndex( matcher, null, offset );
}
public List<int> SearchFilteredSequence( List<Predicate<Token>> sequence, int offset = 0 )
{
var output = new List<int>();
for ( int i = 0; i < sequence.Count; i++ )
{
var next = SearchFilteredTokenIndex( sequence[ i ], offset );
if ( next == -1 )
{
// RJLog.Log( "Could not find sequence step", i, "at offset", offset );
return null;
}
// RJLog.Log( "Found sequence step", i, "at offset", offset, "in", next );
output.Add( next );
offset = next + 1;
}
return output;
}
public List<int> SearchFilteredRepeatSequence( List<Predicate<Token>> start, List<Predicate<Token>> sequence, List<Predicate<Token>> end, int offset = 0 )
{
// RJLog.Log( "==== SearchFilteredRepeatSequence", offset );
var output = new List<int>();
if ( start != null )
{
var startList = SearchFilteredSequence( start, offset );
if ( startList == null )
{
// RJLog.Log( "Start not matched", offset );
return null;
}
// RJLog.Log( "Start matched", offset );
output.AddRange( startList );
offset = output[ output.Count - 1 ] + 1;
// RJLog.Log( "Offset after start", offset );
}
if ( sequence.Count > 0 )
{
var repeatedNext = SearchFilteredSequence( sequence, offset );
if ( repeatedNext == null )
{
// RJLog.Log( "Repeat not matched", offset );
}
var maxSteps = 1000;
var steps = 0;
while ( repeatedNext != null && steps < maxSteps )
{
// RJLog.Log( "Repeat matched:",
// "offset", offset,
// "steps", steps
// );
output.AddRange( repeatedNext );
offset = output[ output.Count - 1 ] + 1;
repeatedNext = SearchFilteredSequence( sequence, offset );
steps ++;
}
// RJLog.Log( "Offset after repeat", offset );
}
if ( end != null )
{
var endList = SearchFilteredSequence( end, offset );
if ( endList == null )
{
// RJLog.Log( "End not matched", offset );
return null;
}
// RJLog.Log( "End matched", offset );
output.AddRange( endList );
}
return output;
}
public Token FindTriggerToken( int offset, List<TokenPredicateData> triggerPredicates, List<TokenPredicateData> blockPredicates )
{
var index = FindTriggerTokenIndex( offset, triggerPredicates, blockPredicates );
return index == -1 ? null : children[ index ] as Token;
}
static bool _IsInsideBlock( List<int> counters )
{
for ( int i = 0; i < counters.Count; i++ )
{
if ( counters[ i ] > 0 )
{
return true;
}
}
return false;
}
public int FindTriggerTokenIndex( int offset, List<TokenPredicateData> triggerPredicates, List<TokenPredicateData> blockPredicates )
{
var blockTypesCounter = new List<int>();
var insideBlock = false;
for ( int i = 0; i < blockPredicates.Count / 2; i++ )
{
blockTypesCounter.Add( 0 );
}
for ( int i = offset; i < children.Count; i++ )
{
var child = children[ i ];
if ( child.IsIgnoreToken() )
{
continue;
}
if ( ! insideBlock )
{
var triggerIndex = triggerPredicates.FindIndex( t => t.Matches( child ) );
// RJLog.Log( "Checking:", insideBlock, children[ i ], triggerIndex );
if ( triggerIndex != -1 )
{
return i;
}
}
else
{
// RJLog.Log( "Checking:", insideBlock, children[ i ] );
}
var blockIndex = blockPredicates.FindIndex( b => b.Matches( child ) );
if ( blockIndex == -1 )
{
continue;
}
var typeIndex = blockIndex / 2;
var change = typeIndex * 2 == blockIndex ? 1 : -1;
blockTypesCounter[ typeIndex ] += change;
insideBlock = _IsInsideBlock( blockTypesCounter );
// RJLog.Log( "bracket type:", typeIndex, "change:", change, "insideBlock:", insideBlock, "counters:", blockTypesCounter.Join( ", " ) );
}
return -1;
}
}

View File

@ -0,0 +1 @@
uid://c2sgo6erb113h

View File

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
namespace Rokojori;
public class ASTNodeList:ASTNode
{
}

View File

@ -0,0 +1 @@
uid://b7bdp0xuww804

View File

@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
using System;
namespace Rokojori;
public class ASTWalker:TreeWalker<ASTNode>
{
public static readonly ASTWalker instance = new ASTWalker();
public override ASTNode Parent( ASTNode node )
{
return node?.parent;
}
public override ASTNode ChildAt( ASTNode node, int index )
{
if ( node == null || index < 0 || index >= node.children.Count )
{
return null;
}
return node.children[ index ];
}
public override int NumChildren( ASTNode node )
{
return node?.children.Count ?? 0;
}
}

View File

@ -0,0 +1 @@
uid://dckstcta240bf

View File

@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
namespace Rokojori;
public interface EnumValueDeclaration
{
public string GetEnumName();
public string GetEnumValue();
}

View File

@ -0,0 +1 @@
uid://bm88qdxlr5bbl

View File

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
namespace Rokojori;
public interface ImportDeclaration
{
public string GetImportPath();
}

View File

@ -0,0 +1 @@
uid://bb50r0rlavqev

View File

@ -0,0 +1,55 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
using System;
namespace Rokojori;
public class ASTMatchResult
{
public ASTNode parent = null;
public int childOffset = -1;
public int resultStart = -1;
public int resultEnd = -1;
public bool matched = false;
public Token resultStartToken => ! matched ? null : parent.children[ resultStart ] as Token;
public Token resultEndToken => ! matched ? null : parent.children[ resultEnd ] as Token;
public void SetMatchedByLength( int matchLength )
{
resultStart = childOffset;
resultEnd = childOffset + ( matchLength - 1 );
matched = true;
}
public void SetMatched( int index, int endIndex = -1 )
{
resultStart = index;
resultEnd = endIndex == -1 ? index : endIndex;
matched = true;
}
public int matchLength => ( resultEnd - resultStart ) + 1;
public int childOffsetMatchLength => ( resultEnd - childOffset ) + 1;
public ASTMatchResult Clone()
{
var c = new ASTMatchResult();
c.parent = parent;
c.childOffset = childOffset;
c.resultStart = resultStart;
c.resultEnd = resultEnd;
c.matched = matched;
return c;
}
}

View File

@ -0,0 +1 @@
uid://d0oglqq8hrpqq

View File

@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
using System;
namespace Rokojori;
public abstract class ASTMatcher
{
public virtual int GetMatchLength( ASTNode parent, int childOffset )
{
var astResult = new ASTMatchResult();
astResult.parent = parent;
astResult.childOffset = childOffset;
Match( astResult );
return astResult.matched ? astResult.childOffsetMatchLength : -1;
}
public abstract void Match( ASTMatchResult result );
}

View File

@ -0,0 +1 @@
uid://djut8mpfu6sep

View File

@ -0,0 +1,98 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
using System;
namespace Rokojori;
public class BracketBlockMatcher:ASTMatcher
{
public TokenPredicateData blockStart;
public TokenPredicateData blockEnd;
public bool matchingAtStartIsMandatory = true;
public override void Match( ASTMatchResult result )
{
var parent = result.parent;
var childOffset = result.childOffset;
var count = 0;
if ( matchingAtStartIsMandatory && ! blockStart.Matches( parent.children[ childOffset ] ) )
{
return;
}
for ( int i = childOffset; i < parent.children.Count; i++ )
{
var child = parent.children[ i ];
if ( blockStart.Matches( child ) )
{
if ( count == 0 )
{
result.resultStart = i;
}
count ++;
}
else if ( blockEnd.Matches( child ) )
{
count --;
if ( count == 0 )
{
result.SetMatched( childOffset, i );
return;
}
}
else if ( count < 0 )
{
result.resultStart = -1;
return;
}
}
result.resultStart = -1;
return;
}
public override int GetMatchLength( ASTNode parent, int childOffset )
{
var count = 0;
if ( matchingAtStartIsMandatory && ! blockStart.Matches( parent.children[ childOffset ] ) )
{
return -1;
}
for ( int i = childOffset; i < parent.children.Count; i++ )
{
var child = parent.children[ i ];
if ( blockStart.Matches( child ) )
{
count ++;
}
else if ( blockEnd.Matches( child ) )
{
count --;
if ( count == 0 )
{
return ( i - childOffset + 1 );
}
}
else if ( count < 0 )
{
return -1;
}
}
return -1;
}
}

View File

@ -0,0 +1 @@
uid://c4niejh1k1gal

View File

@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using System.Globalization;
using Godot;
using System;
namespace Rokojori;
public class CombinedASTMatcher:ASTMatcher
{
public List<ASTMatcher> matchers;
public override void Match( ASTMatchResult result )
{
var offset = result.childOffset;
var end = -1;
for ( int i = 0; i < matchers.Count; i++ )
{
var subResult = result.Clone();
subResult.childOffset = offset;
matchers[ i ].Match( subResult );
end = subResult.resultEnd;
// var matchLength = matchers[ i ].GetMatchLength( result.parent, offset );
if ( ! subResult.matched )
{
return;
}
offset = subResult.resultEnd + 1;
// RJLog.Log( "Matched", i, matchers[ i ], "length:", matchLength, "combinedMatch:", combinedMatchLength, "offset:", matchOffset, ">>", offset );
}
result.SetMatched( result.childOffset, end );
return;
}
public override int GetMatchLength( ASTNode parent, int childOffset )
{
var offset = childOffset;
var combinedMatchLength = 0;
for ( int i = 0; i < matchers.Count; i++ )
{
var matchOffset = offset;
var matchLength = matchers[ i ].GetMatchLength( parent, offset );
if ( matchLength == -1 )
{
return -1;
}
combinedMatchLength += matchLength;
offset += matchLength;
RJLog.Log( "Matched", i, matchers[ i ], "length:", matchLength, "combinedMatch:", combinedMatchLength, "offset:", matchOffset, ">>", offset );
}
return combinedMatchLength;
}
}

View File

@ -0,0 +1 @@
uid://boxrq5cfmtlat

Some files were not shown because too many files have changed in this diff Show More