/* * Moonlight|3D Copyright (C) 2005 The Moonlight|3D team * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Created on Nov 21, 2005 */ package ml.backend.anim; import java.util.ArrayList; import ml.backend.og.Node; import ml.backend.selection.PathElement; import ml.core.exceptions.Exception; import ml.core.helper.NamedObject; public class Animation implements NamedObject, PathElement { private String name; private ArrayList tracks; private Manager animationManager; private double startTime, endTime; public Animation(Manager manager) { animationManager=manager; } public void setName(String name) { this.name=name; } public String getName() { return name; } public PathElement findChildElement(String childName) { for(AnimationTrack track : tracks) { if(track.getNodeName().equals(childName)) { return track; } } return null; } public void resetDefaults() throws Exception { ml.backend.og.Manager ogManager=animationManager.getDocument().getOGManager(); for(AnimationTrack track : tracks) { Node node=ogManager.getNodeByName(track.getNodeName()); node.getProperty(track.getPropertyName()).setValue(track.getDefaultValue()); } } public double getStartTime() { return startTime; } public void setStartTime(double startTime) { this.startTime=startTime; } public double getEndTime() { return endTime; } public void setEndTime(double endTime) { this.endTime=endTime; } public void setToTime(double time) throws Exception { ml.backend.og.Manager ogManager=animationManager.getDocument().getOGManager(); for(AnimationTrack track : tracks) { Node node=ogManager.getNodeByName(track.getNodeName()); node.getProperty(track.getPropertyName()).setValue(track.getValue(time)); } } public boolean isValidAppendixName(String appendix) { return false; } public Object getFromAppendix(String appendix) { return null; } }