Skip to content
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

solve issue #1992: better messages in spatial assertions #1993

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions jme3-core/src/main/java/com/jme3/scene/Spatial.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public boolean checkCulling(Camera cam) {
}

CullHint cm = getCullHint();
assert cm != CullHint.Inherit;
assert cm != CullHint.Inherit : "CullHint should never be inherit. Problem spatial name: " + getName();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And never be \"inherit\".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as it stands. Double quotes don't add any clarity and might mislead the reader into thinking it's a String.

if (cm == Spatial.CullHint.Always) {
setLastFrustumIntersection(Camera.FrustumIntersect.Outside);
return false;
Expand Down Expand Up @@ -586,7 +586,7 @@ protected void updateWorldLightList() {
worldLights.update(localLights, null);
refreshFlags &= ~RF_LIGHTLIST;
} else {
assert (parent.refreshFlags & RF_LIGHTLIST) == 0;
assert (parent.refreshFlags & RF_LIGHTLIST) == 0 : "Illegal light list update. Problem spatial name: " + getName();
worldLights.update(localLights, parent.worldLights);
refreshFlags &= ~RF_LIGHTLIST;
}
Expand All @@ -599,7 +599,7 @@ protected void updateMatParamOverrides() {
if (parent == null) {
worldOverrides.addAll(localOverrides);
} else {
assert (parent.refreshFlags & RF_MATPARAM_OVERRIDE) == 0;
assert (parent.refreshFlags & RF_MATPARAM_OVERRIDE) == 0 : "Illegal mat param update. Problem spatial name: " + getName();
worldOverrides.addAll(parent.worldOverrides);
worldOverrides.addAll(localOverrides);
}
Expand Down Expand Up @@ -653,7 +653,7 @@ protected void updateWorldTransforms() {
refreshFlags &= ~RF_TRANSFORM;
} else {
// check if transform for parent is updated
assert ((parent.refreshFlags & RF_TRANSFORM) == 0);
assert ((parent.refreshFlags & RF_TRANSFORM) == 0) : "Illegal rf transform update. Problem spatial name: " + getName();
worldTransform.set(localTransform);
worldTransform.combineWithParent(parent.worldTransform);
refreshFlags &= ~RF_TRANSFORM;
Expand Down Expand Up @@ -811,7 +811,7 @@ public void addControlAt(int index, Control control) {

if (index < numControls) { // re-arrange the list directly
boolean success = controls.remove(control);
assert success;
assert success : "Surprising control remove failure. " + control.getClass().getSimpleName() + " from spatial " + getName();
stephengold marked this conversation as resolved.
Show resolved Hide resolved
controls.add(index, control);
}
}
Expand Down Expand Up @@ -952,7 +952,7 @@ public void updateGeometricState() {
if ((refreshFlags & RF_MATPARAM_OVERRIDE) != 0) {
updateMatParamOverrides();
}
assert refreshFlags == 0;
assert refreshFlags == 0 : "Illegal refresh flags state: " + refreshFlags + " for spatial " + getName();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be desirable to apply a little bit of formatting? I'm thinking Illegal \"refreshFlags\" state in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as it stands. Double quotes don't add any clarity and might mislead the reader into thinking it's a String.

}

/**
Expand Down