Elaztek Developer Hub
Blamite Game Engine - Guerilla (Library)  00390.07.02.23.1947.blamite
The tag editor for the Blamite Game Engine.
BlamPluginField Class Reference

Class representing a plugin field. More...

#include <fields.h>

+ Inheritance diagram for BlamPluginField:

Public Member Functions

 BlamPluginField (BlamPlugin *_plugin, BlamTagFieldType _type)
 Constructs a new plugin field. More...
 
 BlamPluginField (BlamPluginField *_old_field)
 Constructs a new plugin field. More...
 
BlamTagFieldType GetType ()
 Retrieves the type of this field. More...
 
BlamPluginGetPlugin ()
 Retrieves the plugin this field is associated with. More...
 
virtual BlamTagFieldGenerateTagField (BlamTag *tag)
 Generates a new tag field from this plugin field. More...
 
virtual BlamTagFieldGenerateTagField (BlamTagField *existing_tag_field)
 Generates a new tag field from this plugin field. More...
 
virtual BlamTagFieldGenerateTagField (BlamTag *tag, void *address)
 Generates a new tag field from this plugin field. More...
 
virtual std::string GenerateXMLString ()
 Generates a string representing this plugin field. More...
 
virtual void UpdateOffsetData (int new_offset)
 Updates any offsets or lengths for the given field. More...
 
virtual std::string GenerateCppStructString (std::string line_prefix="", bool generate_doxygen_comments=true)
 Generates a string containing C++ code representing this plugin field. More...
 
virtual std::string GenerateCppClassString (std::string line_prefix="")
 Generates a string containing C++ code representing this plugin field. More...
 
virtual bool ParseXMLData (rapidxml::xml_node<> *field_node)
 Populates data within the plugin field from an XML node. More...
 
void ChangeType (BlamTagFieldType new_type)
 Changes the type of a plugin field. More...
 

Public Attributes

int offset = 0x0
 The offset of the field data. More...
 
int length = 0x0
 The length of the field data. More...
 
bool visible = true
 Whether or not the field is visible. More...
 
std::string display_name = ""
 The display name of the field. More...
 
std::string description = ""
 An optional description of the field. More...
 
std::string field_id = ""
 The ID of the field. More...
 
std::string input_hint = ""
 An additional piece of short text that can be used to suggest valid input for a field. More...
 
bool require_unused_visible = false
 If enabled, this field will only be visible when "Show Unused Fields" is enabled. More...
 
std::string default_value = ""
 The default text value for the field. More...
 

Detailed Description

Class representing a plugin field.

Plugin fields are used to store additional, non-data information related to a tag field. This information can include things display names, descriptions, and visibility. It also stores the offset and length of the data - which is required for tag compilation.

Constructor & Destructor Documentation

◆ BlamPluginField() [1/2]

BlamPluginField::BlamPluginField ( BlamPlugin _plugin,
BlamTagFieldType  _type 
)

Constructs a new plugin field.

Parameters
_plugin- The plugin this field should be associated with.
_type- The type of the field.
+ Here is the call graph for this function:

◆ BlamPluginField() [2/2]

BlamPluginField::BlamPluginField ( BlamPluginField _old_field)

Constructs a new plugin field.

Parameters
_old_field- The old field to load data from. Becomes invalid after construction.

Member Function Documentation

◆ ChangeType()

void BlamPluginField::ChangeType ( BlamTagFieldType  new_type)

Changes the type of a plugin field.

This method simply changes the internal type enum, and does not make any changes to the object class. See the note for more information.

Note
This is a DANGEROUS method and should almost never be used. It is intended ONLY for changing the field type in cases where the field class does not change - for instance, changing a bitfield8 to a bitfield32, an int64 to an int16, etc.

This method is NOT intended to be used to transform types fundamentally, such as transforming an integer into a float, or a dataref into a tag block. In situations like that, you should instead create an entirely new field and transfer data separately.

Parameters
new_type- The new type of the field.

◆ GenerateCppClassString()

std::string BlamPluginField::GenerateCppClassString ( std::string  line_prefix = "")
virtual

Generates a string containing C++ code representing this plugin field.

This method will generate a string containing C++ code that is intended for use within the BlamTagClass class. This class is used by the game engine to store a tag class layout, allowing for in-engine tools to present a tag data editing UI among other things.

Parameters
line_prefix- A string that should be placed before each line, such as a certain amount of indentation spaces.
Returns
A string containing C++ code representing the field and its data.

Reimplemented in BlamPluginField_Block, BlamPluginField_Comment, BlamPluginField_Bitfield, BlamPluginField_Enum, BlamPluginField_Dataref, BlamPluginField_Tagref, BlamPluginField_Ascii, BlamPluginField_Vector, BlamPluginField_Color, BlamPluginField_Float32, and BlamPluginField_Int.

◆ GenerateCppStructString()

std::string BlamPluginField::GenerateCppStructString ( std::string  line_prefix = "",
bool  generate_doxygen_comments = true 
)
virtual

Generates a string containing C++ code representing this plugin field.

This method will generate a string containing C++ code that is intended for use within the tag class data structure. This is intended to be used when exporting a tag class to C++ code.

Parameters
line_prefix- A string that should be placed before each line, such as a certain amount of indentation spaces.
Returns
A string containing C++ code representing the field and its data.

Reimplemented in BlamPluginField_Block, BlamPluginField_Bitfield, BlamPluginField_Comment, BlamPluginField_Enum, BlamPluginField_Dataref, BlamPluginField_Tagref, BlamPluginField_Ascii, BlamPluginField_Vector, BlamPluginField_Color, BlamPluginField_Float32, and BlamPluginField_Int.

◆ GenerateTagField() [1/3]

BlamTagField * BlamPluginField::GenerateTagField ( BlamTag tag)
virtual

Generates a new tag field from this plugin field.

With this overload, a brand new tag field is created with no value.

Parameters
tag- The tag the new field should belong to.
Returns
Pointer to the new tag field.

Reimplemented in BlamPluginField_Block, BlamPluginField_Bitfield, BlamPluginField_Comment, BlamPluginField_Enum, BlamPluginField_Dataref, BlamPluginField_Tagref, BlamPluginField_Ascii, BlamPluginField_Vector, BlamPluginField_Color, BlamPluginField_Float32, and BlamPluginField_Int.

+ Here is the caller graph for this function:

◆ GenerateTagField() [2/3]

BlamTagField * BlamPluginField::GenerateTagField ( BlamTag tag,
void *  address 
)
virtual

Generates a new tag field from this plugin field.

With this overload, a new field is created and its value(s) are read from the tag data. This should only be used when reading binary (compiled) tag files.

Parameters
tag- The tag the new field should belong to.
address- The address of the field value.
Returns
Pointer to the new tag field.

Reimplemented in BlamPluginField_Block, BlamPluginField_Bitfield, BlamPluginField_Enum, BlamPluginField_Dataref, BlamPluginField_Tagref, BlamPluginField_Ascii, BlamPluginField_Vector, BlamPluginField_Color, BlamPluginField_Float32, and BlamPluginField_Int.

◆ GenerateTagField() [3/3]

BlamTagField * BlamPluginField::GenerateTagField ( BlamTagField existing_tag_field)
virtual

Generates a new tag field from this plugin field.

With this overload, the tag field remains unchanged but has this plugin field assigned to it.

Parameters
existing_tag_field- The existing tag field to associate this plugin field with.
Returns
Pointer to the new tag field. Will be identical to existing_tag_field.

◆ GenerateXMLString()

std::string BlamPluginField::GenerateXMLString ( )
virtual

Generates a string representing this plugin field.

Returns
An XML string containing the field ID and other attributes.

Reimplemented in BlamPluginField_Block, BlamPluginField_Bitfield, BlamPluginField_Comment, BlamPluginField_Enum, BlamPluginField_Dataref, and BlamPluginField_Tagref.

+ Here is the call graph for this function:

◆ GetPlugin()

BlamPlugin * BlamPluginField::GetPlugin ( )

Retrieves the plugin this field is associated with.

Returns
A pointer to the plugin associated with this field.
+ Here is the caller graph for this function:

◆ GetType()

BlamTagFieldType BlamPluginField::GetType ( )

Retrieves the type of this field.

See BlamTagFieldType for details.

Returns
The type of this field.
+ Here is the caller graph for this function:

◆ ParseXMLData()

bool BlamPluginField::ParseXMLData ( rapidxml::xml_node<> *  field_node)
virtual

Populates data within the plugin field from an XML node.

This is intended for use when loading a plugin from an XML document.

Parameters
field_node- Pointer to the XML node to parse plugin field data from.
Returns
true if all required field data was parsed, otherwise returns false. If this returns false, this field should be deleted and should NOT be added to the plugin - as this indicates an issue with the original plugin file.

Reimplemented in BlamPluginField_Block, BlamPluginField_Comment, BlamPluginField_Bitfield, BlamPluginField_Enum, BlamPluginField_Dataref, and BlamPluginField_Tagref.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateOffsetData()

void BlamPluginField::UpdateOffsetData ( int  new_offset)
virtual

Updates any offsets or lengths for the given field.

In most cases, this simply updates the offset field to the new value. However, in some cases, additional steps may need to be performed, such as recalculating the entry size of a block. This method will also perform these operations as needed, depending on the plugin field type.

Parameters
new_offset- The new offset for the plugin field.

Reimplemented in BlamPluginField_Block.

Member Data Documentation

◆ default_value

std::string BlamPluginField::default_value = ""

The default text value for the field.

◆ description

std::string BlamPluginField::description = ""

An optional description of the field.

◆ display_name

std::string BlamPluginField::display_name = ""

The display name of the field.

◆ field_id

std::string BlamPluginField::field_id = ""

The ID of the field.

◆ input_hint

std::string BlamPluginField::input_hint = ""

An additional piece of short text that can be used to suggest valid input for a field.

◆ length

int BlamPluginField::length = 0x0

The length of the field data.

◆ offset

int BlamPluginField::offset = 0x0

The offset of the field data.

◆ require_unused_visible

bool BlamPluginField::require_unused_visible = false

If enabled, this field will only be visible when "Show Unused Fields" is enabled.

◆ visible

bool BlamPluginField::visible = true

Whether or not the field is visible.


The documentation for this class was generated from the following files: