Skip to content

Commit

Permalink
avoid using Minie's deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Feb 15, 2024
1 parent 7e5138b commit 5d2982d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/main/java/maud/PhysicsUtil.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2017-2023, Stephen Gold
Copyright (c) 2017-2024 Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -311,15 +311,15 @@ public static Transform transform(
* @return true if used/identical, otherwise false
*/
public static boolean usesShape(CollisionShape user, long shapeId) {
long id = user.getObjectId();
long id = user.nativeId();
boolean result = false;
if (id == shapeId) {
result = true;
} else if (user instanceof CompoundCollisionShape) {
CompoundCollisionShape compound = (CompoundCollisionShape) user;
ChildCollisionShape[] children = compound.listChildren();
for (ChildCollisionShape child : children) {
id = child.getShape().getObjectId();
id = child.getShape().nativeId();
if (id == shapeId) {
result = true;
break;
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/maud/model/cgm/CgmPhysics.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2018-2023, Stephen Gold
Copyright (c) 2018-2024 Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -186,7 +186,7 @@ public int countShapes() {
PhysicsJoint findJoint(long id) {
PhysicsJoint result = null;
for (PhysicsJoint joint : jointModelToView.keySet()) {
if (joint.getObjectId() == id) {
if (joint.nativeId() == id) {
result = joint;
break;
}
Expand All @@ -204,7 +204,7 @@ PhysicsJoint findJoint(long id) {
PhysicsCollisionObject findPco(long id) {
PhysicsCollisionObject result = null;
for (PhysicsCollisionObject pco : pcoModelToView.keySet()) {
if (pco.getObjectId() == id) {
if (pco.nativeId() == id) {
result = pco;
break;
}
Expand All @@ -222,15 +222,15 @@ PhysicsCollisionObject findPco(long id) {
CollisionShape findShape(long id) {
for (PhysicsCollisionObject pco : pcoModelToView.keySet()) {
CollisionShape shape = pco.getCollisionShape();
if (shape.getObjectId() == id) {
if (shape.nativeId() == id) {
return shape;
}
if (shape instanceof CompoundCollisionShape) {
CompoundCollisionShape ccs = (CompoundCollisionShape) shape;
ChildCollisionShape[] children = ccs.listChildren();
for (ChildCollisionShape child : children) {
CollisionShape childShape = child.getShape();
if (childShape.getObjectId() == id) {
if (childShape.nativeId() == id) {
return childShape;
}
}
Expand Down Expand Up @@ -286,7 +286,7 @@ public List<String> listJointNames(String namePrefix) {
List<String> result = new ArrayList<>(numJoints);

for (PhysicsJoint joint : jointModelToView.keySet()) {
long id = joint.getObjectId();
long id = joint.nativeId();
String name = Long.toHexString(id);
if (name.startsWith(namePrefix)) {
result.add(name);
Expand Down Expand Up @@ -508,7 +508,7 @@ void replaceInCompounds(CollisionShape oldModel, CollisionShape newModel,
assert newView != null;
assert !(newView instanceof CompoundCollisionShape);

long oldModelId = oldModel.getObjectId();
long oldModelId = oldModel.nativeId();
CollisionShape oldView = modelToView(oldModel);
Map<Long, CollisionShape> shapeMap = shapeMap();
for (CollisionShape modelShape : shapeMap.values()) {
Expand Down Expand Up @@ -567,14 +567,14 @@ Map<Long, CollisionShape> shapeMap() {
Map<Long, CollisionShape> result = new TreeMap<>();
for (PhysicsCollisionObject pco : pcoModelToView.keySet()) {
CollisionShape shape = pco.getCollisionShape();
long id = shape.getObjectId();
long id = shape.nativeId();
result.put(id, shape);
if (shape instanceof CompoundCollisionShape) {
CompoundCollisionShape ccs = (CompoundCollisionShape) shape;
ChildCollisionShape[] children = ccs.listChildren();
for (ChildCollisionShape child : children) {
CollisionShape childShape = child.getShape();
long childId = childShape.getObjectId();
long childId = childShape.nativeId();
result.put(childId, childShape);
}
}
Expand All @@ -591,18 +591,18 @@ Map<Long, CollisionShape> shapeMap() {
* @return a new set of IDs of collision objects and compound shapes
*/
Set<Long> userSet(CollisionShape usedShape) {
long usedId = usedShape.getObjectId();
long usedId = usedShape.nativeId();
Set<Long> result = new TreeSet<>();
for (PhysicsCollisionObject pco : pcoModelToView.keySet()) {
CollisionShape shape = pco.getCollisionShape();
if (shape == usedShape) {
long pcoId = pco.getObjectId();
long pcoId = pco.nativeId();
result.add(pcoId);
}
if (shape instanceof CompoundCollisionShape
&& shape != usedShape
&& PhysicsUtil.usesShape(shape, usedId)) {
long parentId = shape.getObjectId();
long parentId = shape.nativeId();
result.add(parentId);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/maud/model/cgm/SelectedJoint.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2017-2023, Stephen Gold
Copyright (c) 2017-2024 Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -134,7 +134,7 @@ public boolean isSelected() {
public String name() {
assert isSelected();

long id = selectedJoint.getObjectId();
long id = selectedJoint.nativeId();
String name = Long.toHexString(id);

return name;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/maud/model/cgm/SelectedLink.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2018-2023, Stephen Gold
Copyright (c) 2018-2024 Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -279,7 +279,7 @@ public String jointName() {
if (link != null && !(link instanceof TorsoLink)) {
PhysicsJoint joint = link.getJoint();
if (joint != null) {
long id = joint.getObjectId();
long id = joint.nativeId();
result = Long.toHexString(id);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/maud/model/cgm/SelectedShape.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2017-2023, Stephen Gold
Copyright (c) 2017-2024 Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -493,7 +493,7 @@ public Transform transform(Transform storeResult) {

Transform parent = new Transform();
for (ChildCollisionShape child : children) {
long id = child.getShape().getObjectId();
long id = child.getShape().nativeId();
if (id == userId) {
child.copyTransform(parent);
}
Expand Down Expand Up @@ -606,7 +606,7 @@ private long id() {
if (selectedShape == null) {
return -1L;
} else {
return selectedShape.getObjectId();
return selectedShape.nativeId();
}
}

Expand Down

0 comments on commit 5d2982d

Please sign in to comment.