Skip to content

Commit 7513d7f

Browse files
committed
Merge remote-tracking branch 'github/develop' into develop
2 parents d13d650 + d087092 commit 7513d7f

31 files changed

+129
-108
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ext.applicationMainClass = "com.ss.editor.JfxApplication"
2828
ext.applicationVendor = "[email protected]"
2929
ext.applicationTitle = "jMonkeyBuilder"
3030
ext.jmeVersion = "v3.3.dev-SNAPSHOT"
31-
ext.jmbExtVersion = "2.1.0"
31+
ext.jmbExtVersion = "develop-SNAPSHOT"
3232
ext.jme3_xbuf_version = '0.9.1'
3333
ext.junitPlatformVersion = "1.0.0"
3434
ext.junitJupiterVersion = "5.0.0"
Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.ss.editor.part3d.editor.impl.scene.handler;
22

3-
import com.jme3.bullet.control.PhysicsControl;
4-
import com.jme3.bullet.control.RigidBodyControl;
53
import com.jme3.scene.Spatial;
6-
import com.ss.editor.util.ControlUtils;
7-
import com.ss.editor.util.NodeUtils;
4+
import com.ss.editor.extension.util.JmbExtUtils;
85
import org.jetbrains.annotations.NotNull;
96

107
import java.util.function.Consumer;
@@ -18,22 +15,6 @@ public class PhysicsControlTransformationHandler implements Consumer<Spatial> {
1815

1916
@Override
2017
public void accept(@NotNull final Spatial spatial) {
21-
NodeUtils.children(spatial)
22-
.flatMap(ControlUtils::controls)
23-
.filter(PhysicsControl.class::isInstance)
24-
.filter(ControlUtils::isEnabled)
25-
.forEach(control -> {
26-
if (control instanceof RigidBodyControl) {
27-
final RigidBodyControl bodyControl = (RigidBodyControl) control;
28-
final boolean kinematic = bodyControl.isKinematic();
29-
final boolean kinematicSpatial = bodyControl.isKinematicSpatial();
30-
bodyControl.setKinematic(true);
31-
bodyControl.setKinematicSpatial(true);
32-
bodyControl.clearForces();
33-
bodyControl.update(0);
34-
bodyControl.setKinematic(kinematic);
35-
bodyControl.setKinematicSpatial(kinematicSpatial);
36-
}
37-
});
18+
JmbExtUtils.resetPhysicsControlPositions(spatial);
3819
}
3920
}

src/main/java/com/ss/editor/part3d/editor/impl/scene/handler/ReactivatePhysicsControlsTransformationHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public void accept(@NotNull final Spatial spatial) {
2323
.filter(RigidBodyControl.class::isInstance)
2424
.map(RigidBodyControl.class::cast)
2525
.filter(RigidBodyControl::isEnabled)
26+
.filter(control -> Float.compare(control.getMass(), 0.0F) != 0)
2627
.filter(control -> !control.isActive())
2728
.forEach(PhysicsRigidBody::activate);
2829
}

src/main/java/com/ss/editor/plugin/api/editor/material/BaseMaterialFileEditor.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,6 @@
4444
public abstract class BaseMaterialFileEditor<T extends BaseMaterialEditor3DPart, S extends EditorMaterialEditorState, C extends ChangeConsumer> extends
4545
Advanced3DFileEditorWithSplitRightTool<T, S> {
4646

47-
private static class MaterialSettingsNodeTree<C extends ChangeConsumer> extends NodeTree<C> {
48-
49-
public MaterialSettingsNodeTree(@NotNull final Consumer<Array<Object>> selectionHandler, @Nullable final C consumer) {
50-
super(selectionHandler, consumer);
51-
}
52-
53-
@Override
54-
@FxThread
55-
protected @NotNull SelectionMode getSelectionMode() {
56-
return SelectionMode.SINGLE;
57-
}
58-
}
59-
6047
/**
6148
* The default state of editor light.
6249
*/
@@ -156,7 +143,7 @@ protected boolean handleKeyActionImpl(@NotNull final KeyCode keyCode, final bool
156143
protected void createToolComponents(@NotNull final EditorToolComponent container, @NotNull final StackPane root) {
157144
super.createToolComponents(container, root);
158145

159-
settingsTree = new MaterialSettingsNodeTree<>(this::selectedFromTree, getChangeConsumer());
146+
settingsTree = new NodeTree<>(this::selectedFromTree, getChangeConsumer(), SelectionMode.SINGLE);
160147
propertyEditor = new PropertyEditor<>(getChangeConsumer());
161148
propertyEditor.prefHeightProperty().bind(root.heightProperty());
162149

src/main/java/com/ss/editor/ui/control/layer/LayerNodeTree.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ public LayerNodeTree(@NotNull final Consumer<Array<Object>> selectionHandler, @N
2727
super(selectionHandler, consumer);
2828
}
2929

30-
@Override
31-
@FxThread
32-
protected @NotNull SelectionMode getSelectionMode() {
33-
return SelectionMode.SINGLE;
34-
}
35-
3630
@Override
3731
@FxThread
3832
protected @NotNull NodeTreeCell<SceneChangeConsumer, ?> createNodeTreeCell() {

src/main/java/com/ss/editor/ui/control/model/ModelNodeTree.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.ss.editor.ui.control.tree.NodeTree;
55
import com.ss.editor.ui.control.tree.action.impl.multi.RemoveElementsAction;
66
import com.ss.rlib.util.array.Array;
7+
import javafx.scene.control.SelectionMode;
78
import org.jetbrains.annotations.NotNull;
89
import org.jetbrains.annotations.Nullable;
910

@@ -22,6 +23,6 @@ public class ModelNodeTree extends NodeTree<ModelChangeConsumer> {
2223

2324
public ModelNodeTree(@NotNull final Consumer<Array<Object>> selectionHandler,
2425
@Nullable final ModelChangeConsumer consumer) {
25-
super(selectionHandler, consumer);
26+
super(selectionHandler, consumer, SelectionMode.MULTIPLE);
2627
}
2728
}

src/main/java/com/ss/editor/ui/control/property/PropertyControl.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
/**
3434
* The base implementation of the property control.
3535
*
36-
* @param <C> the type of a change consumer
37-
* @param <D> the type of an editing object
38-
* @param <T> the type of an editing property
36+
* @param <C> the type of a change consumer.
37+
* @param <D> the type of an editing object.
38+
* @param <T> the type of an editing property.
3939
* @author JavaSaBr
4040
*/
4141
public class PropertyControl<C extends ChangeConsumer, D, T> extends VBox implements UpdatableControl {
@@ -171,10 +171,11 @@ public PropertyControl(@Nullable final T propertyValue, @NotNull final String pr
171171
* @return the six object consumer
172172
*/
173173
@FromAnyThread
174-
public @NotNull SixObjectConsumer<@NotNull C, @NotNull D, @NotNull String, @Nullable T, @Nullable T, @NotNull BiConsumer<D, T>> newChangeHandler() {
174+
public @NotNull SixObjectConsumer<C, D, String, T, T, BiConsumer<D, T>> newChangeHandler() {
175175
return (changeConsumer, object, propName, newValue, oldValue, handler) -> {
176176

177-
final PropertyOperation<ChangeConsumer, D, T> operation = new PropertyOperation<>(object, propName, newValue, oldValue);
177+
final PropertyOperation<ChangeConsumer, D, T> operation =
178+
new PropertyOperation<>(object, propName, newValue, oldValue);
178179
operation.setApplyHandler(handler);
179180

180181
changeConsumer.execute(operation);
@@ -200,7 +201,11 @@ public void setEditObject(@NotNull final D editObject) {
200201
@FxThread
201202
public void setEditObject(@NotNull final D editObject, final boolean needReload) {
202203
setEditObject(editObject);
203-
if (!needReload) return;
204+
205+
if (!needReload) {
206+
return;
207+
}
208+
204209
setIgnoreListener(true);
205210
try {
206211
reload();

src/main/java/com/ss/editor/ui/control/property/impl/AudioKeyPropertyControl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
/**
3333
* The implementation of the {@link PropertyControl} to edit the {@link AudioData}.
3434
*
35+
* @param <C> the change consumer's type.
3536
* @author JavaSaBr
3637
*/
3738
public class AudioKeyPropertyControl<C extends ChangeConsumer> extends PropertyControl<C, AudioNode, AudioKey> {
@@ -148,14 +149,18 @@ private void addAudioData(@NotNull final Path file) {
148149
protected void processOpen() {
149150

150151
final AudioKey element = getPropertyValue();
151-
if (element == null) return;
152+
if (element == null) {
153+
return;
154+
}
152155

153156
final String assetPath = element.getName();
154157
if (StringUtils.isEmpty(assetPath)) return;
155158

156159
final Path assetFile = Paths.get(assetPath);
157160
final Path realFile = notNull(getRealFile(assetFile));
158-
if (!Files.exists(realFile)) return;
161+
if (!Files.exists(realFile)) {
162+
return;
163+
}
159164

160165
final RequestedOpenFileEvent event = new RequestedOpenFileEvent();
161166
event.setFile(realFile);

src/main/java/com/ss/editor/ui/control/property/impl/BooleanPropertyControl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
/**
2222
* The implementation of the {@link PropertyControl} to change boolean values.
2323
*
24-
* @param <C> the type of a {@link ChangeConsumer}
25-
* @param <T> the type of an editing object
24+
* @param <C> the type of a {@link ChangeConsumer}.
25+
* @param <T> the type of an editing object.
2626
* @author JavaSaBr
2727
*/
2828
public class BooleanPropertyControl<C extends ChangeConsumer, T> extends PropertyControl<C, T, Boolean> {

0 commit comments

Comments
 (0)