Skip to content

Possibility to save scene as "slim TXML" #776

@Stinkfist0

Description

@Stinkfist0

Writing down an idea we discussed with @jonnenauha some weeks ago. Adding a possibility to save the scene in a slimmer format could had its advantages from time to time.

Opportunities for saving space when writing TXML:

  1. omit default values of sync property (true) both for entities and components (for entities alternatively the sync value could be deducted from the entity ID),
  2. omit component type names,
  3. omit attributes with default values,
  4. omit types of static attributes,
  5. omit attribute names,
  6. no indentation, and
  7. write booleans as "1" and "0" instead of true and false.
    EDIT: 8. option to omit line endings also as suggested by @jonnenauha

A single entity example scene

<!DOCTYPE Scene>
<scene>
 <entity id="1" sync="true">
  <component typeId="20" type="Placeable" sync="true">
   <attribute value="-66.6853561,43.672966,-41.3164825,-12.0000153,-126.599899,0,1,1,1" type="Transform" id="transform" name="Transform"/>
   <attribute value="false" type="bool" id="drawDebug" name="Show bounding box"/>
   <attribute value="true" type="bool" id="visible" name="Visible"/>
   <attribute value="1" type="int" id="selectionLayer" name="Selection layer"/>
   <attribute value="" type="EntityReference" id="parentRef" name="Parent entity ref"/>
   <attribute value="" type="string" id="parentBone" name="Parent bone name"/>
  </component>
  <component typeId="26" type="Name" sync="true">
   <attribute value="FreeLookCameraSpawnPos" type="string" id="name" name="Name"/>
   <attribute value="" type="string" id="description" name="Description"/>
   <attribute value="" type="string" id="group" name="Group"/>
  </component>
 </entity>
</scene>

consisting of 985 characters (CRLF line endings) would become

<!DOCTYPE Scene>
<scene>
<entity id="1">
<component typeId="20">
<attribute value="-66.6853561,43.672966,-41.3164825,-12.0000153,-126.599899,0,1,1,1" id="transform"/>
</component>
<component typeId="26">
<attribute value="FreeLookCameraSpawnPos" id="name"/>
</component>
</entity>
</scene>

which is 301 characters, 30.56 % of the original TXML.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions