* added flixel-animate to libs * I BROKE THE OFFSETS FUCK . * yes it does blehtty wdym?? * Removed flxanimate entirely + Fixed transition + Fixed offsets * Deleted caches (relaunching actions) * frameOffset for atlases (need testing) * useRenderTexture added to xml * Fixed atlases for mods * a simple redirect so old mods wont break that badly (#879) * Update FunkinSprite.hx * remove trace * Fixed ghosts for atlases * usable character editor (not entirely fixed) * fixed zoomFactor + temp fix for atlas popping * early structure for character editor atlas anim display * zoomFactor for atlases * Animate Atlas character editor previews * FlxAnimateSettings specification * fixed animation swapping on atlas characters * OH YEA BABY NEW FLXANIMATE UPDATE THAT MADE CODE 50X SIMPLER **AGAIN** 💖 /pos * Added label checkbox in Character Editor * Fixed culling issues with FlxAnimate (fr this time) * fixed some atlases * HOW THE FUCK * gf sad fix + AliasMacro (for backwards comp, manual impl for now) * Fixed pop-ins * Update Character.hx * applyStageMatrix * FlxAnimate pull request merge (empty commit) * flixel-animate** i'm clumsy asf i meant the lib not the class name fuck * Update libs.xml * Merge changes from main (#892) * repair ScriptableShader.shader = null (#877) * optimize updateInput (#878) * optimize updateInput * resize optimize * __notePerStrum optimize * Update StrumLine.hx * NoteGroup optimize (#881) * NoteGroup optimize * CoolUtil.bound faster * makes commit with github desktop W FRAKITS * Use fastSinCos for notes (#889) * Update Strum.hx * Update Strum.hx --------- Co-authored-by: HEIHUAa <112499486+HEIHUAa@users.noreply.github.com> Co-authored-by: Frakits <90983918+Frakits@users.noreply.github.com> --------- Co-authored-by: Kolze <53307233+KolzeYT@users.noreply.github.com> Co-authored-by: HEIHUAa <112499486+HEIHUAa@users.noreply.github.com> Co-authored-by: Frakits <90983918+Frakits@users.noreply.github.com>
134 lines
4.4 KiB
Haxe
134 lines
4.4 KiB
Haxe
package funkin.backend.system.macros;
|
|
|
|
#if macro
|
|
import sys.io.File;
|
|
import haxe.macro.ComplexTypeTools;
|
|
import haxe.macro.Printer;
|
|
import haxe.macro.Expr.Position;
|
|
import haxe.macro.Context;
|
|
import haxe.macro.Expr.Field;
|
|
import haxe.macro.Expr;
|
|
|
|
class AliasMacro {
|
|
public static var aliasMetadata:Metadata = [{
|
|
name: ":keep",
|
|
pos: Context.currentPos()
|
|
},{
|
|
name: ":dox",
|
|
pos: Context.currentPos(),
|
|
params: [
|
|
{
|
|
expr: EConst(CIdent("hide")),
|
|
pos: Context.currentPos()
|
|
}
|
|
]
|
|
}];
|
|
|
|
public static function build():Array<Field> {
|
|
#if display
|
|
return Context.getBuildFields();
|
|
#end
|
|
|
|
var fields = Context.getBuildFields();
|
|
var ogFieldCount = fields.length;
|
|
|
|
for(i in 0...ogFieldCount) {
|
|
var field = fields[i];
|
|
if (field.meta == null) continue;
|
|
|
|
var previousAliases:Array<{name:String, pos:Position}> = [];
|
|
for(meta in field.meta) {
|
|
if (meta.name == ":alias" && meta.params != null) {
|
|
for(p in meta.params) {
|
|
switch(p.expr) {
|
|
case EConst(CString(s, kind)):
|
|
previousAliases.push({
|
|
name: s,
|
|
pos: p.pos
|
|
});
|
|
default:
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (previousAliases.length == 0) continue;
|
|
|
|
var ghostAccess = field.access.copy();
|
|
ghostAccess.remove(AOverride);
|
|
ghostAccess.remove(APublic);
|
|
|
|
for(alias in previousAliases) {
|
|
var ghostField:Field = {
|
|
name: alias.name,
|
|
pos: alias.pos,
|
|
kind: null,
|
|
access: ghostAccess,
|
|
meta: aliasMetadata
|
|
};
|
|
|
|
switch(field.kind) {
|
|
case FFun(f):
|
|
var args:Array<Expr> = [for(a in f.args) {
|
|
expr: EConst(CIdent(a.name)),
|
|
pos: Context.currentPos()
|
|
}];
|
|
|
|
ghostField.kind = FFun({
|
|
args: f.args,
|
|
params: f.params,
|
|
ret: f.ret,
|
|
expr: macro return $i{field.name}($a{args})
|
|
});
|
|
|
|
default:
|
|
var type = null;
|
|
switch(field.kind) {
|
|
case FVar(t, e):
|
|
type = t;
|
|
case FProp(get, set, t, e):
|
|
type = t;
|
|
default:
|
|
}
|
|
ghostField.kind = FProp("get", "set", type, null);
|
|
|
|
fields.push({
|
|
name: 'get_${alias.name}',
|
|
kind: FFun({
|
|
args: [],
|
|
expr: macro return $i{field.name},
|
|
ret: type
|
|
}),
|
|
pos: alias.pos,
|
|
meta: aliasMetadata
|
|
});
|
|
fields.push({
|
|
name: 'set_${alias.name}',
|
|
kind: FFun({
|
|
args: [{
|
|
name: '_${field.name}',
|
|
type: type
|
|
}],
|
|
expr: macro return ($i{field.name} = $i{'_${field.name}'}),
|
|
ret: type
|
|
}),
|
|
pos: alias.pos,
|
|
meta: aliasMetadata
|
|
});
|
|
}
|
|
|
|
fields.push(ghostField);
|
|
}
|
|
|
|
var docFooter = '_Aliases: ${[for(alias in previousAliases) '`${alias.name}`'].join(", ")}_';
|
|
if (field.doc != null)
|
|
field.doc += '\n\n$docFooter';
|
|
else
|
|
field.doc = docFooter;
|
|
}
|
|
trace(fields);
|
|
|
|
return fields;
|
|
}
|
|
}
|
|
#end |