Skip to content

Commit

Permalink
Merge branch 'dev' into Issue-7753-generate-resource-graph-on-bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Sep 25, 2023
2 parents 440a46e + cda1546 commit 8ac9e29
Show file tree
Hide file tree
Showing 141 changed files with 592 additions and 37,152 deletions.
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ assignees: ''

---

_Is it a private platform, and a platform specific issue? (i.e. would it break your NDA?)<br>
Then please report your issue in the corresponding extension repository!_

**Describe the bug (REQUIRED)**
A clear and concise description of what the bug is.

Expand Down
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ assignees: ''

---

_Is it a private platform specific feature? (i.e. would it break your NDA?)<br>
Then please add your feature request in the corresponding extension repository!_

**Is your feature request related to a problem? Please describe (REQUIRED):**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ jobs:
{ name: 'Install Python', uses: actions/setup-python@v3, with: { python-version: 3.x, architecture: x64 } },
{ name: 'Install Java', uses: actions/setup-java@v3, with: { java-version: '17.0.5+8', distribution: 'temurin'} },
{ name: 'Install Leiningen', uses: DeLaGuardo/setup-clojure@master, with: { lein: 2.8.3 } },
{ name: 'Install dependencies', run: sudo apt-get install -y libopenal-dev libgl1-mesa-dev libglw1-mesa-dev freeglut3-dev },
{ name: 'Install dependencies', run: sudo apt-get install -y libgl1-mesa-dev libglw1-mesa-dev freeglut3-dev },
{
name: 'Build editor',
if: (github.event_name != 'repository_dispatch') || ((github.event_name == 'repository_dispatch') && (github.event.client_payload.skip_editor != true)),
Expand Down
8 changes: 8 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,13 @@ When the build has been uploaded it needs to be set live:

1. Find your upload in the list and change the value in the `Set build live on branch` to `default`

1. Update the Steam Community page with the release notes. Create a new post with the relase notes [using this link](https://steamcommunity.com/games/1365760/partnerevents/edit/). Write something like:

```
Defold 1.4.1 has been released
This new version can be downloaded by opening Defold and allowing the editor to self-update.
All releases can be downloaded at: https://github.com/defold/defold/releases
Official forum thread with complete update notes: https://forum.defold.com/t/defold-1-4-1-has-been-released/72246
```

4 changes: 2 additions & 2 deletions build_tools/waf_dynamo.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def asan_cxxflags(self):
self.env.append_value('CXXFLAGS', ['/fsanitize=address', '-D_DISABLE_VECTOR_ANNOTATION', '-DDM_SANITIZE_ADDRESS'])
self.env.append_value('CFLAGS', ['/fsanitize=address', '-D_DISABLE_VECTOR_ANNOTATION', '-DDM_SANITIZE_ADDRESS'])
# not a linker option
elif Options.options.with_ubsan and build_util.get_target_os() in ('macos','ios','android','ps4','ps5'):
elif Options.options.with_ubsan and build_util.get_target_os() in ('macos','ios','android','ps4','ps5','nx64'):
self.env.append_value('CXXFLAGS', ['-fsanitize=undefined', '-DDM_SANITIZE_UNDEFINED'])
self.env.append_value('CFLAGS', ['-fsanitize=undefined', '-DDM_SANITIZE_UNDEFINED'])
self.env.append_value('LINKFLAGS', ['-fsanitize=undefined'])
Expand Down Expand Up @@ -1725,7 +1725,7 @@ def detect(conf):
conf.env['LIB_OPENAL'] = ['OpenSLES']
elif platform in ('win32', 'x86_64-win32'):
conf.env['LIB_OPENAL'] = ['OpenAL32']
elif platform in ('x86_64-linux',):
elif platform in ('x86_64-linux','js-web','wasm-web'):
conf.env['LIB_OPENAL'] = ['openal']

conf.env['STLIB_DLIB'] = ['dlib', 'mbedtls', 'zip']
Expand Down
2 changes: 1 addition & 1 deletion ci/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def install_ext(platform = None):
call("python scripts/build.py install_ext %s" % ' '.join(opts))

def build_bob(channel, branch = None):
args = "python scripts/build.py install_ext sync_archive build_bob archive_bob".split()
args = "python scripts/build.py install_sdk install_ext sync_archive build_bob archive_bob".split()
opts = []
opts.append("--channel=%s" % channel)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ public void testObjectAnimations() throws Exception {
@Test
public void testSkeleton() throws Exception {

String[] boneIds = {"Bone", "Bone_001", "Bone_002", "Bone_003", "Bone_004"};
String[] parentIds = {null, "Bone", "Bone", "Bone", "Bone"};
String[] boneIds = {"root", "Bone_001", "Bone_002", "Bone_003", "Bone_004"};
String[] parentIds = {null, "root", "root", "root", "root"};

Rig.Skeleton.Builder skeleton = Rig.Skeleton.newBuilder();
ColladaUtil.loadSkeleton(load("bone_influences.dae"), skeleton, new ArrayList<String>());
Expand Down Expand Up @@ -808,29 +808,6 @@ public void testBlenderRotation() throws Exception {
}
}

/*
* Test that MeshSets and AnimationSets can have bones specified in different order.
*/
@Test
public void testBoneList() throws Exception {
Rig.MeshSet.Builder meshSetBuilder = Rig.MeshSet.newBuilder();
Rig.AnimationSet.Builder animSetBuilder = Rig.AnimationSet.newBuilder();
ColladaUtil.loadMesh(load("bonelist_mesh_test.dae"), meshSetBuilder);
ColladaUtil.loadAnimations(load("bonelist_anim_test.dae"), animSetBuilder, "", new ArrayList<String>());

int meshBoneListCount = meshSetBuilder.getBoneListCount();
int animBoneListCount = animSetBuilder.getBoneListCount();

assertEquals(3, meshBoneListCount);
assertEquals(3, animBoneListCount);

for (int i = 0; i < meshBoneListCount; i++) {
Long meshBone = meshSetBuilder.getBoneList(i);
Long animBone = animSetBuilder.getBoneList(i);
assertEquals(meshBone, animBone);
}
}

/*
* Test collada file with a bone animation that includes both translation and rotation.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// Copyright 2009-2014 Ragnar Svensson, Christian Murray
// Licensed under the Defold License version 1.0 (the "License"); you may not use
// this file except in compliance with the License.
//
//
// You may obtain a copy of the License, together with FAQs at
// https://www.defold.com/license
//
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
Expand Down Expand Up @@ -235,8 +235,7 @@ private ModelImporter.Scene loadBuiltScene(String path,
ModelUtil.loadSkeleton(scene, skeletonBuilder);

ArrayList<String> animationIds = new ArrayList<>();
ArrayList<ModelImporter.Bone> bones = ModelUtil.loadSkeleton(scene);
ModelUtil.loadAnimations(scene, bones, animSetBuilder, "top_anim", animationIds);
ModelUtil.loadAnimations(scene, animSetBuilder, "top_anim", animationIds);
}
return scene;
}
Expand Down Expand Up @@ -333,8 +332,8 @@ public void testBoneInfluences() throws Exception {
@Test
public void testSkeleton() throws Exception {

String[] boneIds = {"Bottom", "Middle", "Top"};
String[] parentIds = {null, "Bottom", "Middle"};
String[] boneIds = {"root", "Middle", "Top"};
String[] parentIds = {null, "root", "Middle"};

Rig.Skeleton.Builder skeletonBuilder = Rig.Skeleton.newBuilder();
ModelImporter.Scene scene = loadBuiltScene("bend2bones.gltf", skeletonBuilder);
Expand Down
1 change: 0 additions & 1 deletion com.dynamo.cr/com.dynamo.cr.bob/scripts/copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ mkdir -p libexec/armv7-android
mkdir -p libexec/arm64-android
mkdir -p libexec/js-web
mkdir -p libexec/wasm-web
mkdir -p libexec/arm64-nx64

SHA1=`git log --pretty=%H -n1`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public enum Platform {
Arm64Android("arm64", true, "android", new String[] {".so"}, "lib", "lib", ".so", new String[] {"android", "arm64-android"}, PlatformArchitectures.Android, "arm64-android"),
JsWeb( "js", true, "web", new String[] {".js"}, "", "lib", "", new String[] {"web", "js-web"}, PlatformArchitectures.Web, "js-web"),
WasmWeb( "wasm", true, "web", new String[] {".js", ".wasm"}, "", "lib", "", new String[] {"web", "wasm-web"}, PlatformArchitectures.Web, "wasm-web"),
Arm64NX64( "arm64", true, "nx64", new String[] {".nso"}, "", "", "", new String[] {"nx64", "arm64-nx64"}, PlatformArchitectures.NX64, "arm64-nx64"),
Arm64NX64( "arm64", true, "nx64", new String[] {".nss"}, "", "", "", new String[] {"nx64", "arm64-nx64"}, PlatformArchitectures.NX64, "arm64-nx64"),
X86_64PS4( "x86_64", true, "ps4", new String[] {".elf"}, "", "", "", new String[] {"ps4", "x86_64-ps4"}, PlatformArchitectures.PS4, "x86_64-ps4"),
X86_64PS5( "x86_64", true, "ps5", new String[] {".elf"}, "", "", "", new String[] {"ps5", "x86_64-ps5"}, PlatformArchitectures.PS5, "x86_64-ps5");

Expand Down
28 changes: 19 additions & 9 deletions com.dynamo.cr/com.dynamo.cr.bob/src/com/dynamo/bob/font/Fontc.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import com.dynamo.bob.pipeline.TextureGeneratorException;

import com.dynamo.bob.util.StringUtil;
import com.dynamo.bob.util.MurmurHash;
import com.dynamo.bob.font.BMFont.BMFontFormatException;
import com.dynamo.bob.font.BMFont.Char;
import com.dynamo.render.proto.Font.FontDesc;
Expand Down Expand Up @@ -160,15 +161,24 @@ public class Glyph {
public static long FontDescToHash(FontDesc fontDesc) {
FontDesc.Builder fontDescbuilder = FontDesc.newBuilder();

fontDescbuilder.mergeFrom(fontDesc)
.setMaterial("")
.clearOutlineAlpha()
.clearShadowAlpha()
.clearShadowX()
.clearShadowY()
.clearAlpha();

return fontDescbuilder.build().hashCode();
fontDescbuilder.mergeFrom(fontDesc);
FontDesc desc = fontDescbuilder.build();

// the list of parameters which affect the glyph_bank
String result = ""
+ desc.getFont()
+ desc.getSize()
+ desc.getAntialias()
+ desc.getOutlineWidth()
+ desc.getShadowBlur()
+ desc.getExtraCharacters()
+ desc.getOutputFormat()
+ desc.getAllChars()
+ desc.getCacheWidth()
+ desc.getCacheHeight()
+ desc.getRenderMode();

return MurmurHash.hash64(result);
}

// These values are the same as font_renderer.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ public static void collectAnimations(Task.TaskBuilder<Void> taskBuilder, Project
collectAnimations(taskBuilder, project, owner, subAnimSetDescBuilder);
}
}

if(!animSetDescBuilder.getSkeleton().isEmpty()) {
IResource skeleton = BuilderUtil.checkResource(project, owner, "skeleton", animSetDescBuilder.getSkeleton());
taskBuilder.addInput(skeleton);
}
}


Expand Down Expand Up @@ -92,7 +87,7 @@ private void validateAndAddFile(Task<Void> task, String path, ArrayList<String>
}

private void buildAnimations(Task<Void> task, ModelImporter.DataResolver dataResolver, AnimationSetDesc.Builder animSetDescBuilder, AnimationSet.Builder animationSetBuilder,
String parentId, ArrayList<ModelImporter.Bone> bones, ArrayList<String> animFiles) throws CompileExceptionError, IOException {
String parentId, ArrayList<String> animFiles) throws CompileExceptionError, IOException {
ArrayList<String> idList = new ArrayList<>(animSetDescBuilder.getAnimationsCount());

for(AnimationInstanceDesc instance : animSetDescBuilder.getAnimationsList()) {
Expand All @@ -103,7 +98,7 @@ private void buildAnimations(Task<Void> task, ModelImporter.DataResolver dataRes
InputStreamReader subAnimSetDescBuilderISR = new InputStreamReader(animFileIS);
AnimationSetDesc.Builder subAnimSetDescBuilder = AnimationSetDesc.newBuilder();
TextFormat.merge(subAnimSetDescBuilderISR, subAnimSetDescBuilder);
buildAnimations(task, dataResolver, subAnimSetDescBuilder, animationSetBuilder, FilenameUtils.getBaseName(animFile.getPath()), bones, animFiles);
buildAnimations(task, dataResolver, subAnimSetDescBuilder, animationSetBuilder, FilenameUtils.getBaseName(animFile.getPath()), animFiles);
continue;
}
IResource animFile = BuilderUtil.checkResource(this.project, task.input(0), "animation", instance.getAnimation());
Expand All @@ -126,7 +121,7 @@ private void buildAnimations(Task<Void> task, ModelImporter.DataResolver dataRes
if (isCollada)
loadColladaAnimations(animBuilder, animFileIS, animId, parentId);
else
loadModelAnimations(bones, animBuilder, animFileIS, dataResolver, animId, parentId, animFile.getPath(), animationIds);
loadModelAnimations(animBuilder, animFileIS, dataResolver, animId, parentId, animFile.getPath(), animationIds);

} catch (XMLStreamException e) {
throw new CompileExceptionError(animFile, e.getLocation().getLineNumber(), "Failed to load animation: " + e.getLocalizedMessage(), e);
Expand Down Expand Up @@ -169,7 +164,7 @@ static void loadColladaAnimations(AnimationSet.Builder animationSetBuilder, Inpu
animationSetBuilder.addAllAnimations(animBuilder.getAnimationsList());
}

static void loadModelAnimations(ArrayList<ModelImporter.Bone> bones, AnimationSet.Builder animationSetBuilder,
static void loadModelAnimations(AnimationSet.Builder animationSetBuilder,
InputStream is, ModelImporter.DataResolver dataResolver, String animId, String parentId,
String path, ArrayList<String> animationIds) throws IOException {

Expand All @@ -180,7 +175,7 @@ static void loadModelAnimations(ArrayList<ModelImporter.Bone> bones, AnimationSe

// Currently, by design choice, each file must only contain one animation.
// Our current approach is to choose the longest animation (to eliminate target poses etc)
ModelUtil.loadAnimations(scene, bones, animBuilder, animId, localAnimationIds);
ModelUtil.loadAnimations(scene, animBuilder, animId, localAnimationIds);

animationSetBuilder.addAllAnimations(animBuilder.getAnimationsList());

Expand Down Expand Up @@ -213,7 +208,7 @@ public byte[] getData(String path, String uri) {
};

// For the editor
static public void buildAnimations(List<String> paths, ArrayList<ModelImporter.Bone> bones, List<InputStream> streams, ModelImporter.DataResolver dataResolver, List<String> parentIds,
static public void buildAnimations(List<String> paths, List<InputStream> streams, ModelImporter.DataResolver dataResolver, List<String> parentIds,
AnimationSet.Builder animationSetBuilder, ArrayList<String> animationIds) throws IOException, CompileExceptionError {


Expand Down Expand Up @@ -241,31 +236,17 @@ static public void buildAnimations(List<String> paths, ArrayList<ModelImporter.B
if (isCollada)
loadColladaAnimations(animationSetBuilder, stream, animId, parentId);
else
loadModelAnimations(bones, animationSetBuilder, stream, dataResolver, animId, parentId, path, animationIds);
loadModelAnimations(animationSetBuilder, stream, dataResolver, animId, parentId, path, animationIds);

} catch (XMLStreamException e) {
throw new CompileExceptionError(String.format("File %s:%d: Failed to load animation: %s", path, e.getLocation().getLineNumber(), e.getLocalizedMessage()), e);
} catch (LoaderException e) {
throw new CompileExceptionError(String.format("File %s:%d: Failed to load animation: %s", path, -1, e.getLocalizedMessage()), e);
}

}
ModelUtil.setBoneList(animationSetBuilder, bones);
}
// END EDITOR SPECIFIC FUNCTIONS

public ArrayList<ModelImporter.Bone> buildSkeleton(IResource skeletonFile, ModelImporter.DataResolver dataResolver) throws IOException {
String suffix = BuilderUtil.getSuffix(skeletonFile.getPath());
if (suffix.equals("dae")) {
return ColladaUtil.loadSkeleton(skeletonFile.getContent()); // Until our model importer supports collada
}

ModelImporter.Scene skeletonScene = ModelUtil.loadScene(skeletonFile.getContent(), skeletonFile.getPath(), new ModelImporter.Options(), dataResolver);
ArrayList<ModelImporter.Bone> bones = ModelUtil.loadSkeleton(skeletonScene);

return bones;
}

@Override
public void build(Task<Void> task) throws CompileExceptionError, IOException {

Expand All @@ -274,14 +255,7 @@ public void build(Task<Void> task) throws CompileExceptionError, IOException {
AnimationSetDesc.Builder animSetDescBuilder = AnimationSetDesc.newBuilder();
TextFormat.merge(animSetDescISR, animSetDescBuilder);

IResource skeletonFile = BuilderUtil.checkResource(this.project, task.input(0), "skeleton", animSetDescBuilder.getSkeleton());

ResourceDataResolver dataResolver = new ResourceDataResolver(this.project);
ArrayList<ModelImporter.Bone> bones = buildSkeleton(skeletonFile, dataResolver);

if (bones.size() == 0) {
throw new CompileExceptionError(skeletonFile, -1, "No skeleton found in file!");
}

// evaluate hierarchy
AnimationSet.Builder animationSetBuilder = AnimationSet.newBuilder();
Expand All @@ -290,9 +264,7 @@ public void build(Task<Void> task) throws CompileExceptionError, IOException {
animFiles = new ArrayList<String>();
animFiles.add(task.input(0).getAbsPath());

buildAnimations(task, dataResolver, animSetDescBuilder, animationSetBuilder, "", bones, animFiles);

ModelUtil.setBoneList(animationSetBuilder, bones);
buildAnimations(task, dataResolver, animSetDescBuilder, animationSetBuilder, "", animFiles);

// write merged animationset
ByteArrayOutputStream out = new ByteArrayOutputStream(64 * 1024);
Expand Down
Loading

0 comments on commit 8ac9e29

Please sign in to comment.