|
1 | 1 | // License MIT
|
2 |
| -// Copyright 2023 Defold Foundation (www.defold.com |
| 2 | +// Copyright 2023 Defold Foundation (www.defold.com) |
3 | 3 |
|
4 | 4 | package com.dynamo.bob.pipeline.tp;
|
5 | 5 |
|
|
14 | 14 | import com.dynamo.bob.pipeline.BuilderUtil;
|
15 | 15 | import com.dynamo.bob.pipeline.ProtoUtil;
|
16 | 16 |
|
17 |
| -import com.dynamo.bob.Builder; |
| 17 | +import com.dynamo.bob.ProtoBuilder; |
18 | 18 | import com.dynamo.bob.BuilderParams;
|
19 | 19 | import com.dynamo.bob.CompileExceptionError;
|
20 | 20 | import com.dynamo.bob.ProtoParams;
|
|
30 | 30 | // Formats
|
31 | 31 |
|
32 | 32 | // BOB
|
| 33 | +import com.dynamo.gamesys.proto.AtlasProto; |
33 | 34 | import com.dynamo.graphics.proto.Graphics.TextureImage;
|
34 | 35 | import com.dynamo.graphics.proto.Graphics.TextureProfile;
|
35 | 36 | import com.dynamo.gamesys.proto.TextureSetProto.TextureSet; // Final engine format
|
|
45 | 46 |
|
46 | 47 | @ProtoParams(srcClass = AtlasDesc.class, messageClass = AtlasDesc.class)
|
47 | 48 | @BuilderParams(name="TexturePackerAtlas", inExts=".tpatlas", outExt = ".a.texturesetc")
|
48 |
| -public class AtlasBuilder extends Builder<Void> { |
| 49 | +public class AtlasBuilder extends ProtoBuilder<AtlasDesc.Builder> { |
49 | 50 |
|
50 | 51 | static final String TEMPLATE_PATH = "texturepacker/editor/resources/templates/template.tpatlas";
|
51 | 52 |
|
52 | 53 | @Override
|
53 |
| - public Task<Void> create(IResource input) throws IOException, CompileExceptionError { |
54 |
| - |
55 |
| - // Since these template files currently get compiled by bob |
56 |
| - if (input.getPath().equals(TEMPLATE_PATH)) |
57 |
| - { |
58 |
| - Task.TaskBuilder<Void> taskBuilder = Task.<Void>newBuilder(this); |
59 |
| - return taskBuilder.build(); |
60 |
| - } |
61 |
| - |
62 |
| - Task.TaskBuilder<Void> taskBuilder = Task.<Void>newBuilder(this) |
| 54 | + public Task create(IResource input) throws IOException, CompileExceptionError { |
| 55 | + Task.TaskBuilder taskBuilder = Task.newBuilder(this) |
63 | 56 | .setName(params.name())
|
64 | 57 | .addInput(input)
|
65 | 58 | .addOutput(input.changeExt(params.outExt()))
|
66 | 59 | .addOutput(input.changeExt(".texturec"));
|
67 | 60 |
|
68 |
| - AtlasDesc.Builder builder = AtlasDesc.newBuilder(); |
69 |
| - ProtoUtil.merge(input, builder); |
| 61 | + AtlasDesc.Builder builder = getSrcBuilder(input); |
70 | 62 |
|
71 | 63 | BuilderUtil.checkResource(this.project, input, "file", builder.getFile());
|
72 | 64 |
|
@@ -338,13 +330,9 @@ static public void renameAnimations(AtlasDesc.Builder builder, String renamePatt
|
338 | 330 | }
|
339 | 331 |
|
340 | 332 | @Override
|
341 |
| - public void build(Task<Void> task) throws CompileExceptionError, IOException { |
| 333 | + public void build(Task task) throws CompileExceptionError, IOException { |
342 | 334 |
|
343 |
| - AtlasDesc.Builder builder = AtlasDesc.newBuilder(); |
344 |
| - ProtoUtil.merge(task.input(0), builder); |
345 |
| - if (task.input(0).getPath().equals(TEMPLATE_PATH)) { |
346 |
| - return; |
347 |
| - } |
| 335 | + AtlasDesc.Builder builder = getSrcBuilder(task.firstInput()); |
348 | 336 |
|
349 | 337 | Info.Atlas infoAtlas = Loader.load(task.input(1).getContent());
|
350 | 338 |
|
|
0 commit comments