Audit-8 : strip anim core dead methods (-222 LOC)
TransformSheet (-53 LOC, 4 methods): getStartTransform, getInterpolatedRotation, getCorrectedModelCoord, extendsZCoord. Skipped: extend (live internal caller in transformToWorldCoordOriginAsDest), getInterpolationInfo (live internal callers in getInterpolatedTranslation / getInterpolatedTransform). ClientAnimator (-44 LOC, 6 methods): getAllLayers, iterVisibleLayers, isAiming, getOwner, getJumpAnimation, getPriorityFor. Also removed now-unused java.util.Collection import. Skipped: getCompositeLivingMotion (live callers in tick/forceResetBeforeAction/resetCompositeMotion), applyBindModifier (live internal callers in getPose/getComposedLayerPoseBelow/recursion), compareMotion (live caller in tick), compareCompositeMotion (live caller in tick), iterAllLayers (live callers in setSoftPause/renderDebuggingInfoForAllLayers), getLivingMotion (live internal callers in tick/forceResetBeforeAction). StaticAnimation (-125 LOC, 17 methods): getFileHash instance, idBetween, in(StaticAnimation[]), in(AnimationAccessor[]), setResourceLocation, invalidate, isInvalid, removeProperty, addEvents (both overloads), newTimePair, newConditionalTimePair, addState, removeState, addConditionalState, addStateRemoveOld, addStateIfNotExist. Also removed now-unused imports (Collection, Function, Stream). Skipped @Override/contract methods: getState, getStatesMap, modifyPose, doesHeadRotFollowEntityHead, getId, equals, getRegistryName, getCoord, getAccessor (all @Override DynamicAnimation/Object — removing breaks polymorphism contract). Skipped methods with live callers: getFileHash static (called in ctor line 116), addProperty (15+ external callers in registry and AnimationSubFileReader), getModifiedLinkState (3 callers in LinkAnimation), getSubAnimations (callers in AnimationManager and 5 internal self-calls), setAccessor (called by AnimationManager.apply line 352), loadAnimation (called by kept getAnimationClip), createSimulationData (implements InverseKinematicsProvider interface contract — hot-path risk skip). 20/20 rig tests GREEN.
This commit is contained in:
@@ -44,10 +44,6 @@ public class TransformSheet {
|
||||
this.keyframes = keyframes;
|
||||
}
|
||||
|
||||
public JointTransform getStartTransform() {
|
||||
return this.keyframes[0].transform();
|
||||
}
|
||||
|
||||
public Keyframe[] getKeyframes() {
|
||||
return this.keyframes;
|
||||
}
|
||||
@@ -120,17 +116,6 @@ public class TransformSheet {
|
||||
return vec3f;
|
||||
}
|
||||
|
||||
public Quaternionf getInterpolatedRotation(float currentTime) {
|
||||
InterpolationInfo interpolInfo = this.getInterpolationInfo(currentTime);
|
||||
|
||||
if (interpolInfo == InterpolationInfo.INVALID) {
|
||||
return new Quaternionf();
|
||||
}
|
||||
|
||||
Quaternionf quat = MathUtils.lerpQuaternion(this.keyframes[interpolInfo.prev].transform().rotation(), this.keyframes[interpolInfo.next].transform().rotation(), interpolInfo.delta);
|
||||
return quat;
|
||||
}
|
||||
|
||||
public JointTransform getInterpolatedTransform(float currentTime) {
|
||||
return this.getInterpolatedTransform(this.getInterpolationInfo(currentTime));
|
||||
}
|
||||
@@ -189,44 +174,6 @@ public class TransformSheet {
|
||||
}
|
||||
}
|
||||
|
||||
public TransformSheet getCorrectedModelCoord(LivingEntityPatch<?> entitypatch, Vec3 start, Vec3 dest, int startFrame, int endFrame) {
|
||||
TransformSheet transform = this.copyAll();
|
||||
float horizontalDistance = (float) dest.subtract(start).horizontalDistance();
|
||||
float verticalDistance = (float) Math.abs(dest.y - start.y);
|
||||
JointTransform startJt = transform.getKeyframes()[startFrame].transform();
|
||||
JointTransform endJt = transform.getKeyframes()[endFrame].transform();
|
||||
Vec3f jointCoord = new Vec3f(startJt.translation().x, verticalDistance, horizontalDistance);
|
||||
|
||||
startJt.translation().set(jointCoord);
|
||||
|
||||
for (int i = startFrame + 1; i < endFrame; i++) {
|
||||
JointTransform middleJt = transform.getKeyframes()[i].transform();
|
||||
middleJt.translation().set(MathUtils.lerpVector(startJt.translation(), endJt.translation(), transform.getKeyframes()[i].time() / transform.getKeyframes()[endFrame].time()));
|
||||
}
|
||||
|
||||
return transform;
|
||||
}
|
||||
|
||||
public TransformSheet extendsZCoord(float multiplier, int startFrame, int endFrame) {
|
||||
TransformSheet transform = this.copyAll();
|
||||
float extend = 0.0F;
|
||||
|
||||
for (int i = 0; i < endFrame + 1; i++) {
|
||||
Keyframe kf = transform.getKeyframes()[i];
|
||||
float prevZ = kf.transform().translation().z;
|
||||
kf.transform().translation().multiply(1.0F, 1.0F, multiplier);
|
||||
float extendedZ = kf.transform().translation().z;
|
||||
extend = extendedZ - prevZ;
|
||||
}
|
||||
|
||||
for (int i = endFrame + 1; i < transform.getKeyframes().length; i++) {
|
||||
Keyframe kf = transform.getKeyframes()[i];
|
||||
kf.transform().translation().add(0.0F, 0.0F, extend);
|
||||
}
|
||||
|
||||
return transform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the animation coord system to world coord system regarding origin point as @param worldDest
|
||||
*
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
package com.tiedup.remake.rig.anim.client;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -266,10 +265,6 @@ public class ClientAnimator extends Animator {
|
||||
}
|
||||
}
|
||||
|
||||
public AssetAccessor<? extends StaticAnimation> getJumpAnimation() {
|
||||
return this.livingAnimations.get(LivingMotions.JUMP);
|
||||
}
|
||||
|
||||
public Layer getCompositeLayer(Layer.Priority priority) {
|
||||
return this.baseLayer.compositeLayers.get(priority);
|
||||
}
|
||||
@@ -286,14 +281,6 @@ public class ClientAnimator extends Animator {
|
||||
});
|
||||
}
|
||||
|
||||
public Collection<Layer> getAllLayers() {
|
||||
List<Layer> layerList = Lists.newArrayList();
|
||||
layerList.add(this.baseLayer);
|
||||
layerList.addAll(this.baseLayer.compositeLayers.values());
|
||||
|
||||
return layerList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates all layers
|
||||
* @param task
|
||||
@@ -302,19 +289,7 @@ public class ClientAnimator extends Animator {
|
||||
task.accept(this.baseLayer);
|
||||
this.baseLayer.compositeLayers.values().forEach(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate layers that is visible by priority
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
public void iterVisibleLayers(Consumer<Layer> task) {
|
||||
task.accept(this.baseLayer);
|
||||
this.baseLayer.compositeLayers.values().stream()
|
||||
.filter(layer -> layer.isDisabled() || layer.animationPlayer.isEmpty() || !layer.priority.isHigherOrEqual(this.baseLayer.baseLayerPriority))
|
||||
.forEach(task);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Iterates all activated layers from the highest layer
|
||||
* when base layer = highest, iterates only base layer
|
||||
@@ -487,10 +462,6 @@ public class ClientAnimator extends Animator {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAiming() {
|
||||
return this.currentCompositeMotion == LivingMotions.AIM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playShootingAnimation() {
|
||||
if (this.compositeLivingAnimations.containsKey(LivingMotions.SHOT)) {
|
||||
@@ -547,16 +518,6 @@ public class ClientAnimator extends Animator {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public Layer.Priority getPriorityFor(AssetAccessor<? extends DynamicAnimation> playingAnimation) {
|
||||
for (Layer layer : this.baseLayer.compositeLayers.values()) {
|
||||
if (layer.animationPlayer.getRealAnimation().equals(playingAnimation)) {
|
||||
return layer.priority;
|
||||
}
|
||||
}
|
||||
|
||||
return this.baseLayer.priority;
|
||||
}
|
||||
|
||||
public LivingMotion currentMotion() {
|
||||
return this.currentMotion;
|
||||
}
|
||||
@@ -577,10 +538,6 @@ public class ClientAnimator extends Animator {
|
||||
return animationType.isAssignableFrom(this.baseLayer.animationPlayer.getAnimation().getClass()) ? Pair.of(this.baseLayer.animationPlayer, (T)this.baseLayer.animationPlayer.getAnimation()) : null;
|
||||
}
|
||||
|
||||
public LivingEntityPatch<?> getOwner() {
|
||||
return this.entitypatch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityState getEntityState() {
|
||||
TypeFlexibleHashMap<StateFactor<?>> stateMap = new TypeFlexibleHashMap<> (false);
|
||||
|
||||
@@ -6,14 +6,11 @@
|
||||
|
||||
package com.tiedup.remake.rig.anim.types;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
@@ -387,36 +384,6 @@ public class StaticAnimation extends DynamicAnimation implements InverseKinemati
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
public boolean idBetween(StaticAnimation a1, StaticAnimation a2) {
|
||||
return a1.getId() <= this.getId() && a2.getId() >= this.getId();
|
||||
}
|
||||
|
||||
public boolean in(StaticAnimation[] animations) {
|
||||
for (StaticAnimation animation : animations) {
|
||||
if (this.equals(animation)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean in(AnimationAccessor<? extends DynamicAnimation>[] animationProviders) {
|
||||
for (AnimationAccessor<? extends DynamicAnimation> animationProvider : animationProviders) {
|
||||
if (this.equals(animationProvider.get())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <A extends StaticAnimation> A setResourceLocation(String namespace, String path) {
|
||||
this.resourceLocation = ResourceLocation.fromNamespaceAndPath(namespace, "animmodels/animations/" + path + ".json");
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
public ResourceLocation getLocation() {
|
||||
return this.resourceLocation;
|
||||
}
|
||||
@@ -430,10 +397,6 @@ public class StaticAnimation extends DynamicAnimation implements InverseKinemati
|
||||
return this.armature;
|
||||
}
|
||||
|
||||
public String getFileHash() {
|
||||
return this.filehash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPlaySpeed(LivingEntityPatch<?> entitypatch, DynamicAnimation animation) {
|
||||
return 1.0F;
|
||||
@@ -467,44 +430,6 @@ public class StaticAnimation extends DynamicAnimation implements InverseKinemati
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <A extends StaticAnimation> A removeProperty(StaticAnimationProperty<?> propertyType) {
|
||||
this.properties.remove(propertyType);
|
||||
this.getSubAnimations().forEach((subAnimation) -> subAnimation.get().removeProperty(propertyType));
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("unchecked")
|
||||
public final <A extends StaticAnimation> A addEvents(StaticAnimationProperty<?> key, AnimationEvent<?, ?>... events) {
|
||||
this.properties.computeIfPresent(key, (k, v) -> {
|
||||
return Stream.concat(((Collection<?>)v).stream(), List.of(events).stream()).toList();
|
||||
});
|
||||
|
||||
this.properties.computeIfAbsent(key, (k) -> {
|
||||
return List.of(events);
|
||||
});
|
||||
|
||||
this.getSubAnimations().forEach((subAnimation) -> subAnimation.get().addEvents(key, events));
|
||||
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <A extends StaticAnimation> A addEvents(AnimationEvent<?, ?>... events) {
|
||||
this.properties.computeIfPresent(StaticAnimationProperty.TICK_EVENTS, (k, v) -> {
|
||||
return Stream.concat(((Collection<?>)v).stream(), List.of(events).stream()).toList();
|
||||
});
|
||||
|
||||
this.properties.computeIfAbsent(StaticAnimationProperty.TICK_EVENTS, (k) -> {
|
||||
return List.of(events);
|
||||
});
|
||||
|
||||
this.getSubAnimations().forEach((subAnimation) -> subAnimation.get().addEvents(events));
|
||||
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <V> Optional<V> getProperty(AnimationProperty<V> propertyType) {
|
||||
@@ -521,48 +446,6 @@ public class StaticAnimation extends DynamicAnimation implements InverseKinemati
|
||||
return this.getProperty(ClientAnimationProperties.LAYER_TYPE).orElse(LayerType.BASE_LAYER);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <A extends StaticAnimation> A newTimePair(float start, float end) {
|
||||
this.stateSpectrumBlueprint.newTimePair(start, end);
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <A extends StaticAnimation> A newConditionalTimePair(Function<LivingEntityPatch<?>, Integer> condition, float start, float end) {
|
||||
this.stateSpectrumBlueprint.newConditionalTimePair(condition, start, end);
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T, A extends StaticAnimation> A addState(StateFactor<T> factor, T val) {
|
||||
this.stateSpectrumBlueprint.addState(factor, val);
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T, A extends StaticAnimation> A removeState(StateFactor<T> factor) {
|
||||
this.stateSpectrumBlueprint.removeState(factor);
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T, A extends StaticAnimation> A addConditionalState(int metadata, StateFactor<T> factor, T val) {
|
||||
this.stateSpectrumBlueprint.addConditionalState(metadata, factor, val);
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T, A extends StaticAnimation> A addStateRemoveOld(StateFactor<T> factor, T val) {
|
||||
this.stateSpectrumBlueprint.addStateRemoveOld(factor, val);
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T, A extends StaticAnimation> A addStateIfNotExist(StateFactor<T> factor, T val) {
|
||||
this.stateSpectrumBlueprint.addStateIfNotExist(factor, val);
|
||||
return (A)this;
|
||||
}
|
||||
|
||||
public Object getModifiedLinkState(StateFactor<?> factor, Object val, LivingEntityPatch<?> entitypatch, float elapsedTime) {
|
||||
return val;
|
||||
}
|
||||
@@ -586,14 +469,6 @@ public class StaticAnimation extends DynamicAnimation implements InverseKinemati
|
||||
this.accessor = accessor;
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
this.accessor = null;
|
||||
}
|
||||
|
||||
public boolean isInvalid() {
|
||||
return this.accessor == null;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void renderDebugging(PoseStack poseStack, MultiBufferSource buffer, LivingEntityPatch<?> entitypatch, float playTime, float partialTicks) {
|
||||
// RIG : debug render des targets IK (RenderingTool.drawQuad) strippé.
|
||||
|
||||
Reference in New Issue
Block a user