-
Notifications
You must be signed in to change notification settings - Fork 4
Custom models for custom bones #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 26.1
Are you sure you want to change the base?
Changes from all commits
cc92a45
c401bba
09b05e8
d6cb68d
c1f060a
a903eeb
d780a93
cdb0511
e742d10
3fbcde3
7e88bcb
5b18ce2
4154b21
f2534d3
42e45b8
0335f1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package com.zigythebird.playeranimcore.animation; | ||
|
|
||
| import com.google.gson.*; | ||
| import com.zigythebird.playeranimcore.math.Vec3f; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| import java.lang.reflect.Type; | ||
| import java.util.Base64; | ||
|
|
||
| public record CustomModelBone(Vec3f pivot, byte @Nullable [] texture, @Nullable JsonArray elements) { | ||
| public static class Deserializer implements JsonDeserializer<CustomModelBone> { | ||
| @Override | ||
| public CustomModelBone deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext ctx) throws JsonParseException { | ||
| JsonObject obj = json.getAsJsonObject(); | ||
| return new CustomModelBone( | ||
| ctx.deserialize(obj.get("pivot"), Vec3f.class), | ||
| obj.has("texture") ? Base64.getDecoder().decode(obj.get("texture").getAsString()) : null, | ||
| obj.getAsJsonArray("elements") | ||
| ); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.zigythebird.playeranimcore.bindings; | ||
|
|
||
| public interface PlatformModel { | ||
| void invalidate(); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this method ever called in the core module? I can't find any instance of it
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be called when the animation ends to remove textures from RAM |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.zigythebird.playeranimcore.bones; | ||
|
|
||
| import com.zigythebird.playeranimcore.bindings.PlatformModel; | ||
| import com.zigythebird.playeranimcore.math.Vec3f; | ||
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| public class CustomBone extends PlayerAnimBone { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not a big fan of the name, but not sure what to replace it with
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, we can't
do it yourself then
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I said I am open to it, not that I want to do it! |
||
| private final Vec3f pivot; | ||
|
|
||
| @Nullable | ||
| private final PlatformModel model; | ||
|
|
||
| public CustomBone(String name, Vec3f pivot, @Nullable PlatformModel model) { | ||
| super(name); | ||
| this.pivot = pivot; | ||
| this.model = model; | ||
| } | ||
|
|
||
| public Vec3f getPivot() { | ||
| return this.pivot; | ||
| } | ||
|
|
||
| public @Nullable PlatformModel getModel() { | ||
| return this.model; | ||
| } | ||
| } | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.