com.jme3.scene.control.AbstractControl Java Examples

The following examples show how to use com.jme3.scene.control.AbstractControl. 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: SpatialTreeNode.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
@Override
@FxThread
public void accept(@NotNull final ChangeConsumer changeConsumer, @NotNull final Object object,
                   final boolean isCopy) {

    final T spatial = getElement();

    if (object instanceof AbstractControl) {

        final AbstractControl control = (AbstractControl) object;
        final Spatial prevParent = control.getSpatial();

        if (isCopy) {
            final AbstractControl clone = (AbstractControl) control.jmeClone();
            clone.setSpatial(null);
            changeConsumer.execute(new AddControlOperation(clone, spatial));
        } else {
            changeConsumer.execute(new MoveControlOperation(control, prevParent, spatial));
        }
    }

    super.accept(changeConsumer, object, isCopy);
}
 
Example #2
Source File: DefaultControlPropertyBuilder.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
@FxThread
protected @NotNull List<EditableProperty<?, ?>> getProperties(@NotNull AbstractControl control) {

    var result = new ArrayList<EditableProperty<?, ?>>();
    result.add(new SimpleProperty<>(BOOLEAN, Messages.MODEL_PROPERTY_IS_ENABLED, control,
        AbstractControl::isEnabled, AbstractControl::setEnabled));

    return result;
}
 
Example #3
Source File: ControlUtils.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Check enabled status of the control.
 *
 * @param control the control.
 * @return true if this control is enabled.
 */
@FromAnyThread
public static boolean isEnabled(@NotNull Control control) {
    if (control instanceof AbstractControl) {
        return ((AbstractControl) control).isEnabled();
    } else if (control instanceof PhysicsControl) {
        return ((PhysicsControl) control).isEnabled();
    } else {
        return true;
    }
}
 
Example #4
Source File: ControlUtils.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Change the enabled status of the control.
 *
 * @param control the control.
 * @param enabled true if the control should be enabled.
 */
@FromAnyThread
public static void setEnabled(@NotNull Control control, boolean enabled) {
    if (control instanceof AbstractControl) {
        ((AbstractControl) control).setEnabled(enabled);
    } else if (control instanceof PhysicsControl) {
        ((PhysicsControl) control).setEnabled(enabled);
    }
}
 
Example #5
Source File: SpatialTreeNode.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@Override
@FxThread
public boolean canAccept(@NotNull final TreeNode<?> treeNode, final boolean isCopy) {
    final Object element = treeNode.getElement();
    return element instanceof AbstractControl || super.canAccept(treeNode, isCopy);
}