Codename LogoCodename Logo

funkin.backend.utils.XMLUtil

APIWikiTools

Class made to make XML parsing easier. Used in Stage.hx, Character.hx, and more.

Static methods

View on GitHub

staticaddAnimToSprite(sprite:FlxSprite, animData:AnimData):ErrorCode

Adds an animation to a sprite.

Parameters:

sprite

The sprite

animData

The animation data (gotten from extractAnimFromXML)

View on GitHub

staticaddXMLAnimation(sprite:FlxSprite, anim:Access, loop:Bool = false):ErrorCode

Adds an XML animation to sprite.

Parameters:

sprite

Destination sprite

anim

Animation (Must be a anim XML node)

View on GitHub

staticapplyXMLProperty(object:Dynamic, property:Access):ErrorCode

Applies a property XML node to an object. The format for the XML is as follows:

<!-- float -->
<property name="name" type="float" value="value" />
<property name="name" type="number" value="value" />
<property name="name" type="f" value="value" />
<!-- string -->
<property name="name" type="string" value="value" />
<property name="name" type="str" value="value" />
<property name="name" type="text" value="value" />
<property name="name" type="s" value="value" />
<!-- int -->
<property name="name" type="int" value="value" />
<property name="name" type="integer" value="value" />
<property name="name" type="i" value="value" />
<!-- bool -->
<property name="name" type="bool" value="value" />
<property name="name" type="boolean" value="value" />
<property name="name" type="b" value="value" />
<!-- color -->
<property name="name" type="color" value="value" />
<property name="name" type="c" value="value" />

Parameters:

object

Object to which the xml property will be applied

property

property node.

Returns:

Error code (0 = OK, 1 = FAILED, 2 = MISSING_PROPERTY, 3 = TYPE_INCORRECT, 4 = VALUE_NULL, 5 = REFLECT_ERROR)

View on GitHub

staticinlinecreateSpriteFromXML(node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, ?cl:Class<FunkinSprite>, ?args:Array<Dynamic>, loadGraphic:Bool = true):FunkinSprite

Creates a new sprite based on a XML node.

Parameters:

node

The XML node

parentFolder

The parent folder

defaultAnimType

The default animation type

cl

The class to create (advanced)

args

The arguments to pass to the class (advanced)

View on GitHub

staticinlinedefaultForcedCheck(animName:String, sprite:FunkinSprite):Bool

View on GitHub

staticextractAnimFromXML(anim:Access, animType:XMLAnimType = NONE, loop:Bool = false):AnimData

Extracts an animation from an XML node.

Parameters:

anim

The animation node

animType

The animation type

loop

Whether the animation should loop

View on GitHub

staticfixSpacingInNode(node:Access):Access

Trims and removes spacing from the nodeValue in the XML

WARNING: will edit directly the node!

View on GitHub

staticinlinefixXMLText(text:String):String

View on GitHub

staticgetTextFormats(_node:OneOfTwo<Xml, Access>, ?currentFormat:Dynamic, ?parsedSegments:Array<TextFormat>):Array<TextFormat>

Gets the text formats from an XML node. The format for the XML is as follows:

<text>Hello <format color="#FF0000">World</format></text>

Parameters:

_node

The XML node

currentFormat

The current format

parsedSegments

The parsed segments

View on GitHub

staticloadSpriteFromXML(spr:FunkinSprite, node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, loadGraphic:Bool = true):FunkinSprite

Sets the properties of a sprite based on a XML node.

Parameters:

spr

The sprite

node

The XML node

parentFolder

The parent folder

defaultAnimType

The default animation type