Java Code Examples for com.jme3.scene.Spatial#getName()

The following examples show how to use com.jme3.scene.Spatial#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VehicleWheelTreeNode.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
@Override
@FromAnyThread
public @NotNull String getName() {
    final VehicleWheel element = getElement();
    final Spatial wheelSpatial = element.getWheelSpatial();
    return wheelSpatial != null ? Messages.MODEL_FILE_EDITOR_NODE_WHEEL + " [" + wheelSpatial.getName() + "]" :
            Messages.MODEL_FILE_EDITOR_NODE_WHEEL;
}
 
Example 2
Source File: SpatialSelector.java    From OpenRTS with MIT License 5 votes vote down vote up
public long getEntityId() {
	Spatial s = getGeometry(view.getRootNode());
	while (s != null && s.getName() != null) {
		Object o = s.getUserData(ModelPerformer.ENTITYID_USERDATA);
		if (o != null && EntityManager.isValidId((long) o)) {
			return (long) o;
		}
		s = s.getParent();
	}
	return EntityManager.NOT_VALID_ID;
}
 
Example 3
Source File: OBJLoaderTest.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static String toDiffFriendlyString(String indent, Spatial spatial) {
    if (spatial instanceof Geometry) {
        return indent + spatial.getName() + " (material: "+((Geometry) spatial).getMaterial().getName()+")\n";
    }
    if (spatial instanceof Node) {
        StringBuilder s = new StringBuilder();
        s.append(indent).append(spatial.getName()).append("\n");
        Node node = (Node) spatial;
        for (final Spatial child : node.getChildren()) {
            s.append(toDiffFriendlyString(indent + "  ", child));
        }
        return s.toString();
    }
    return indent + spatial + "\n";
}
 
Example 4
Source File: AnimationEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param channelIndex the index of the channel default is 0. Events on the
 * @param blendTime the time during the animation are gonna be blended
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, LoopMode loopMode, int channelIndex, float blendTime) {
    this.model = model;
    this.modelName = model.getName();
    this.animationName = animationName;
    this.loopMode = loopMode;
    initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
    this.channelIndex = channelIndex;
    this.blendTime = blendTime;
}
 
Example 5
Source File: ScaleTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ScaleTrack(Spatial spatial, Vector3f endScale, float initialDuration) {
    super(initialDuration);
    this.endScale = endScale;
    this.spatial = spatial;
    spatialName = spatial.getName();
}
 
Example 6
Source File: RotationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RotationTrack(Spatial spatial, Quaternion endRotation) {
    this.endRotation.set(endRotation);
    this.spatial = spatial;
    spatialName = spatial.getName();
}
 
Example 7
Source File: PositionTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public PositionTrack(Spatial spatial, Vector3f endPosition, float initialDuration, LoopMode loopMode) {
    super(initialDuration, loopMode);
    this.endPosition = endPosition;
    this.spatial = spatial;
    spatialName = spatial.getName();
}
 
Example 8
Source File: AnimationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AnimationTrack(Spatial model, String animationName) {
    modelName = model.getName();
    this.animationName = animationName;
}
 
Example 9
Source File: AnimationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AnimationTrack(Spatial model, String animationName, LoopMode loopMode) {
    super(loopMode);
    modelName = model.getName();
    this.animationName = animationName;
}
 
Example 10
Source File: AnimationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AnimationTrack(Spatial model, String animationName, float initialDuration, LoopMode loopMode) {
    super(initialDuration, loopMode);
    modelName = model.getName();
    this.animationName = animationName;
}
 
Example 11
Source File: AnimationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public AnimationTrack(Spatial model, String animationName, float initialDuration) {
    super(initialDuration);
    modelName = model.getName();
    this.animationName = animationName;
}
 
Example 12
Source File: RotationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RotationTrack(Spatial spatial, Quaternion endRotation, float initialDuration, LoopMode loopMode) {
    super(initialDuration, loopMode);
    this.endRotation.set(endRotation);
    this.spatial = spatial;
    spatialName = spatial.getName();
}
 
Example 13
Source File: RotationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RotationTrack(Spatial spatial, Quaternion endRotation, LoopMode loopMode) {
    super(loopMode);
    this.endRotation.set(endRotation);
    this.spatial = spatial;
    spatialName = spatial.getName();
}
 
Example 14
Source File: RotationTrack.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public RotationTrack(Spatial spatial, Quaternion endRotation, float initialDuration) {
    super(initialDuration);
    this.endRotation.set(endRotation);
    this.spatial = spatial;
    spatialName = spatial.getName();
}
 
Example 15
Source File: AnimationEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param channelIndex the index of the channel default is 0. Events on the
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, int channelIndex) {
    super(initialDuration);
    this.model = model;
    this.modelName = model.getName();
    this.animationName = animationName;
    this.channelIndex = channelIndex;
}
 
Example 16
Source File: AnimationEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param loopMode the loopMode
 * @see LoopMode
 * @param channelIndex the index of the channel default is 0. Events on the
 * same channelIndex will use the same channel.
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, LoopMode loopMode, int channelIndex) {
    super(initialDuration, loopMode);
    this.model = model;
    this.modelName = model.getName();
    this.animationName = animationName;
    this.channelIndex = channelIndex;
}
 
Example 17
Source File: AnimationEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param loopMode the loopMode
 * @see LoopMode
 * @param blendTime the time during the animation are gonna be blended
 * @see AnimChannel#setAnim(java.lang.String, float)
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, LoopMode loopMode, float blendTime) {
    super(initialDuration, loopMode);
    this.model = model;
    this.modelName = model.getName();
    this.animationName = animationName;
    this.blendTime = blendTime;
}
 
Example 18
Source File: AnimationEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 * @param blendTime the time during the animation are gonna be blended
 * @see AnimChannel#setAnim(java.lang.String, float)
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration, float blendTime) {
    super(initialDuration);
    this.model = model;
    this.modelName = model.getName();
    this.animationName = animationName;
    this.blendTime = blendTime;
}
 
Example 19
Source File: AnimationEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param loopMode the loopMode
 * @see LoopMode
 */
public AnimationEvent(Spatial model, String animationName, LoopMode loopMode) {
    super(loopMode);
    initialDuration = model.getControl(AnimControl.class).getAnimationLength(animationName);
    this.model = model;
    this.modelName = model.getName();
    this.animationName = animationName;
}
 
Example 20
Source File: AnimationEvent.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * creates an animation event
 *
 * @param model the model on which the animation will be played
 * @param animationName the name of the animation to play
 * @param initialDuration the initial duration of the event
 */
public AnimationEvent(Spatial model, String animationName, float initialDuration) {
    super(initialDuration);
    this.model = model;
    this.modelName = model.getName();
    this.animationName = animationName;
}