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

3DViewer fails to cast NumberTangentInterpolator #6

Open
omega09 opened this issue Apr 4, 2017 · 1 comment
Open

3DViewer fails to cast NumberTangentInterpolator #6

omega09 opened this issue Apr 4, 2017 · 1 comment

Comments

@omega09
Copy link

omega09 commented Apr 4, 2017

In the 3DViewer sample, exporting a .ma model as .java fails due to a bad cast attempt.

In the file JavaSourceExporter, in the method private String toString(Interpolator interpolator) , there is a check if (interpolator instanceof NumberTangentInterpolator). However, the right side of the instanceof is com.javafx.experiments.utils3d.animation.NumberTangentInterpolator. The argument for the method is com.sun.scenario.animation.NumberTangentInterpolator. This causes the method to throw an UnsupportedOperationException even though the code for the classes is the same.

@omega09
Copy link
Author

omega09 commented Apr 5, 2017

A fix would be to add this type of interpolator to the method:

        // ...
        } else if (interpolator instanceof NumberTangentInterpolator) {
            NumberTangentInterpolator ti = (NumberTangentInterpolator)interpolator;
            return "Interpolator.TANGENT(Duration.millis("+ TickCalculation.toMillis((long)ti.getInTicks())+"d),"+ti.getInValue()
                    +"d,Duration.millis("+TickCalculation.toMillis((long)ti.getInTicks())+"d),"+ti.getOutValue()+"d)";
        } else if (interpolator instanceof com.sun.scenario.animation.NumberTangentInterpolator) {
        	com.sun.scenario.animation.NumberTangentInterpolator ti = (com.sun.scenario.animation.NumberTangentInterpolator)interpolator;
            return "Interpolator.TANGENT(Duration.millis("+ TickCalculation.toMillis((long)ti.getInTicks())+"d),"+ti.getInValue()
                    +"d,Duration.millis("+TickCalculation.toMillis((long)ti.getInTicks())+"d),"+ti.getOutValue()+"d)";
    	} else {
            throw new UnsupportedOperationException("Unknown Interpolator type: "+interpolator.getClass());
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant