Skip to content

Commit 6d85fbd

Browse files
committed
force-lowercase all names
1 parent 68cd125 commit 6d85fbd

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

DenizenModelsConverter/BBModelReader.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static BBModel Interpret(string fileContent)
4545
foreach (JObject jElement in elements)
4646
{
4747
JObject jFaces = (JObject)jElement["faces"];
48-
string name = (string)jElement.GetRequired("name");
48+
string name = ((string)jElement.GetRequired("name")).ToLowerFast();
4949
string type = jElement.GetString("type", "cube");
5050
Guid id = Guid.Parse((string)jElement.GetRequired("uuid"));
5151
if (type != "cube")
@@ -92,9 +92,9 @@ public static BBModel Interpret(string fileContent)
9292
BBModel.Texture texture = new()
9393
{
9494
Path = (string)jTexture.GetRequired("path"),
95-
Name = (string)jTexture.GetRequired("name"),
96-
Folder = (string)jTexture.GetRequired("folder"),
97-
Namespace = (string)jTexture.GetRequired("namespace"),
95+
Name = ((string)jTexture.GetRequired("name")).ToLowerFast(),
96+
Folder = ((string)jTexture.GetRequired("folder")).ToLowerFast(),
97+
Namespace = ((string)jTexture.GetRequired("namespace")).ToLowerFast(),
9898
ID = (string)jTexture.GetRequired("id"),
9999
Mode = (string)jTexture.GetRequired("mode"),
100100
Particle = jTexture.GetBool("particle", false),
@@ -158,7 +158,7 @@ public static BBModel Interpret(string fileContent)
158158
BBModel.Animation animation = new()
159159
{
160160
UUID = Guid.Parse((string)jAnimation.GetRequired("uuid")),
161-
Name = (string)jAnimation.GetRequired("name"),
161+
Name = ((string)jAnimation.GetRequired("name")).ToLowerFast(),
162162
Loop = jAnimation.GetRequiredEnum<BBModel.Animation.LoopType>("loop"),
163163
Override = jAnimation.GetBool("override", false),
164164
AnimTimeUpdate = (string)jAnimation.GetRequired("anim_time_update"),
@@ -249,7 +249,7 @@ public static void AddOutlineChild(BBModel model, BBModel.Outliner outline, JTok
249249

250250
public static BBModel.Outliner ReadOutliner(BBModel model, JObject jOutliner, Dictionary<string, int> names)
251251
{
252-
string name = (string)jOutliner.GetRequired("name");
252+
string name = ((string)jOutliner.GetRequired("name")).ToLowerFast();
253253
int nameUsed = names.GetValueOrDefault(name, 0);
254254
names[name] = nameUsed + 1;
255255
if (nameUsed > 0)

scripts/dmodels.dsc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
# - run dmodels_end_animation def.root_entity:<[root]>
4949
# # To move the entity to a single frame of an animation (timespot is a decimal number of seconds from the start of the animation)
5050
# - run dmodels_move_to_frame def.root_entity:<[root]> def.animation:idle def.timespot:0.5
51+
# # To remove a model
52+
# - run dmodels_delete def.root_entity:<[root]>
5153
#
5254
################################################
5355

@@ -122,6 +124,14 @@ dmodels_spawn_model:
122124
- flag <entry[root].spawned_entity> dmodel_anim_part.<[id]>:->:<entry[spawned].spawned_entity>
123125
- determine <entry[root].spawned_entity>
124126

127+
dmodels_delete:
128+
type: task
129+
debug: false
130+
definitions: root_entity
131+
script:
132+
- remove <[root_entity].flag[dmodel_parts]>
133+
- remove <[root_entity]>
134+
125135
dmodels_reset_model_position:
126136
type: task
127137
debug: false

0 commit comments

Comments
 (0)