Skip to main content

GMData

Struct GMData 

Source
pub struct GMData {
Show 34 fields pub meta: Metadata, pub animation_curves: GMAnimationCurves, pub audio_groups: GMAudioGroups, pub audios: GMAudios, pub backgrounds: GMBackgrounds, pub codes: GMCodes, pub embedded_images: GMEmbeddedImages, pub extensions: GMExtensions, pub feature_flags: GMFeatureFlags, pub filter_effects: GMFilterEffects, pub fonts: GMFonts, pub functions: GMFunctions, pub game_end_scripts: GMGameEndScripts, pub game_objects: GMGameObjects, pub general_info: GMGeneralInfo, pub global_init_scripts: GMGlobalInitScripts, pub language_info: GMLanguageInfo, pub options: GMOptions, pub particle_emitters: GMParticleEmitters, pub particle_systems: GMParticleSystems, pub paths: GMPaths, pub rooms: GMRooms, pub ui_nodes: GMRootUINodes, pub scripts: GMScripts, pub sequences: GMSequences, pub shaders: GMShaders, pub sounds: GMSounds, pub sprites: GMSprites, pub tags: GMTags, pub texture_group_infos: GMTextureGroupInfos, pub texture_page_items: GMTexturePageItems, pub texture_pages: GMTexturePages, pub timelines: GMTimelines, pub variables: GMVariables,
}
Expand description

The full GameMaker data struct, containing all information from a data file.

Fields§

§meta: Metadata

Some metadata about the GameMaker data file.

This is purposefully stored in another struct to make it distinct from chunk elements in GMData and not clutter the namespace.

§animation_curves: GMAnimationCurves§audio_groups: GMAudioGroups§audios: GMAudios§backgrounds: GMBackgrounds§codes: GMCodes§embedded_images: GMEmbeddedImages§extensions: GMExtensions§feature_flags: GMFeatureFlags§filter_effects: GMFilterEffects§fonts: GMFonts§functions: GMFunctions§game_end_scripts: GMGameEndScripts§game_objects: GMGameObjects§general_info: GMGeneralInfo§global_init_scripts: GMGlobalInitScripts§language_info: GMLanguageInfo§options: GMOptions§particle_emitters: GMParticleEmitters§particle_systems: GMParticleSystems§paths: GMPaths§rooms: GMRooms§ui_nodes: GMRootUINodes§scripts: GMScripts§sequences: GMSequences§shaders: GMShaders§sounds: GMSounds§sprites: GMSprites§tags: GMTags§texture_group_infos: GMTextureGroupInfos§texture_page_items: GMTexturePageItems§texture_pages: GMTexturePages§timelines: GMTimelines§variables: GMVariables

Implementations§

Source§

impl GMData

Source

pub fn toggle_debug(&mut self, enable: bool) -> Result<()>

Tries to enable or disable debug mode, based on the argument.

This function currently supports:

  • Undertale
  • NXTALE
  • Deltarune Chapter 1 (aka. SURVEY_PROGRAM)
  • Deltarune Chapter 1&2 Demo (Old)
  • Deltarune Chapter 1&2 LTS Demo (New)
  • Deltarune Chapters 1-4 (paid game)
Source

pub fn enable_debug(&mut self) -> Result<()>

Enables debug mode.

For more information, see Self::toggle_debug.

Source

pub fn disable_debug(&mut self) -> Result<()>

Disables debug mode.

For more information, see Self::toggle_debug.

Source§

impl GMData

Source

pub fn analyze_code(&self) -> CodeAnalysis

Analyzes some information about the bytecode used in this game.

For more information, see the analyze function in crate::gml::analysis.

Source§

impl GMData

Source

pub fn optimize_memory(&mut self)

Tries to reduce memory footprint by shrinking Vecs and HashMaps so they don’t take up unneeded space.

This function may be useful to call once after data deserialization in a long-lived application (such as a GUI/TUI where the GMData is stored indefinitely). It is also useful to call this function after changing formats of lots of texture pages.

You should probably not call this function frequently, as it consumes CPU power and will not meaningfully shrink your memory footprint by much if called repeatedly.

Note: This function logs a message at the end. If you do not want this, use GMData::optimize_memory_silent instead.

Source

pub fn optimize_memory_silent(&mut self)

Tries to reduce memory footprint by shrinking Vecs and HashMaps so they don’t take up unneeded space.

This is GMData::optimize_memory except it does not log anything.

Source§

impl GMData

Source

pub fn validate_names(&self) -> Result<()>

Validates all names of all named root elements. This checks for duplicates as well as name charset.

Source

pub fn deserialize_all_textures(&mut self) -> Result<()>

Deserializes all embedded texture pages, turning their underlying image data into DynamicImage.

This single-threaded implementation may take quite a while. If you care about performance, I would recommend making a custom multithreaded implementation (perhaps using the rayon crate).

Source

pub fn post_deserialize(&mut self) -> Result<()>

Runs some actions to fully verify integrity and to prepare the data file for editing.

Trait Implementations§

Source§

impl Clone for GMData

Source§

fn clone(&self) -> GMData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GMData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GMData

Source§

fn default() -> GMData

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.