Skip to content

Commit

Permalink
[Animation] Remove empty mode blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
num0005 committed Aug 15, 2019
1 parent 309cf84 commit 2add61a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
26 changes: 26 additions & 0 deletions BlamLib/BlamLib/Blam/Halo2/Tags/Code/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,34 @@ internal override bool Reconstruct(BlamLib.Blam.CacheFile c)
death_and_damage.Elements.RemoveAll(damage_anim => damage_anim.directions.IsEmpty());
return true;
}

public bool IsEmpty()
{
return actions.IsEmpty() && overlays.IsEmpty() && death_and_damage.IsEmpty() && transitions.IsEmpty() &&
high_precache.IsEmpty() && low_precache.IsEmpty();
}
}

internal override bool Reconstruct(BlamLib.Blam.CacheFile c)
{
weapon_type.Elements.RemoveAll(type => type.IsEmpty());
return true;
}
}

internal override bool Reconstruct(BlamLib.Blam.CacheFile c)
{
weapon_class.Elements.RemoveAll(weapon_class =>
weapon_class.weapon_ik.IsEmpty() && weapon_class.weapon_type.IsEmpty()
);
return true;
}
}

internal override bool Reconstruct(BlamLib.Blam.CacheFile c)
{
modes.Elements.RemoveAll(mode => mode.mode_ik.IsEmpty() && mode.weapon_class.IsEmpty());
return true;
}
}

Expand Down
27 changes: 18 additions & 9 deletions BlamLib/BlamLib/Blam/Halo2/Tags/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@ public precache_list_block() : base(1)
public TI.Block<animation_entry_block> overlays;
public TI.Block<damage_animation_block> death_and_damage;
public TI.Block<animation_transition_block> transitions;
public TI.Block<precache_list_block> high_precache;
public TI.Block<precache_list_block> low_precache;
#endregion

#region Ctor
Expand All @@ -937,36 +939,42 @@ public weapon_type_block() : base(7)
Add(overlays = new TI.Block<animation_entry_block>(this, 256));
Add(death_and_damage = new TI.Block<damage_animation_block>(this, 8));
Add(transitions = new TI.Block<animation_transition_block>(this, 256));
Add(/*high precache = */ new TI.Block<precache_list_block>(this, 1024));
Add(/*low precache = */ new TI.Block<precache_list_block>(this, 1024));
Add(high_precache = new TI.Block<precache_list_block>(this, 1024));
Add(low_precache = new TI.Block<precache_list_block>(this, 1024));
}
#endregion
}
#endregion

#region Fields
public TI.StringId label;
public TI.Block<weapon_type_block> weapon_type;
public TI.Block<animation_ik_block> weapon_ik;
#endregion

#region Ctor
public weapon_class_block() : base(3)
{
Add(/*label = */ new TI.StringId());
Add(/*weapon type = */ new TI.Block<weapon_type_block>(this, 64));
Add(/*weapon ik = */ new TI.Block<animation_ik_block>(this, 8));
Add(label = new TI.StringId());
Add(weapon_type = new TI.Block<weapon_type_block>(this, 64));
Add(weapon_ik = new TI.Block<animation_ik_block>(this, 8));
}
#endregion
}
#endregion

#region Fields
public TI.StringId label;
public TI.Block<weapon_class_block> weapon_class;
public TI.Block<animation_ik_block> mode_ik;
#endregion

#region Ctor
public animation_mode_block() : base(3)
{
Add(/*label = */ new TI.StringId());
Add(/*weapon class = */ new TI.Block<weapon_class_block>(this, 64));
Add(/*mode ik = */ new TI.Block<animation_ik_block>(this, 8));
Add(label = new TI.StringId());
Add(weapon_class = new TI.Block<weapon_class_block>(this, 64));
Add(mode_ik = new TI.Block<animation_ik_block>(this, 8));
}
#endregion
}
Expand Down Expand Up @@ -1021,12 +1029,13 @@ public object_animation_block() : base(6)
#endregion

#region Fields
TI.Block<animation_mode_block> modes;
#endregion

#region Ctor
public animation_graph_contents_struct() : base(3)
{
Add(/*modes = */ new TI.Block<animation_mode_block>(this, 512));
Add(modes = new TI.Block<animation_mode_block>(this, 512));
Add(/*vehicle suspension = */ new TI.Block<vehicle_suspension_block>(this, 32));
Add(/*object overlays = */ new TI.Block<object_animation_block>(this, 32));
}
Expand Down

0 comments on commit 2add61a

Please sign in to comment.