Skip to content

Commit d087092

Browse files
committed
bugfixing.
1 parent af61c14 commit d087092

26 files changed

+111
-75
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/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> {

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* The implementation of the {@link PropertyControl} to edit a color values.
1919
*
20-
* @param <C> the type parameter
20+
* @param <C> the change
2121
* @param <T> the type parameter
2222
* @author JavaSaBr
2323
*/
@@ -89,7 +89,10 @@ protected void reload() {
8989
*/
9090
@FxThread
9191
private void updateValue() {
92-
if (isIgnoreListener()) return;
92+
93+
if (isIgnoreListener()) {
94+
return;
95+
}
9396

9497
final ColorPicker colorPicker = getColorPicker();
9598
final ColorRGBA newColor = UiUtils.from(colorPicker.getValue());

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
/**
1818
* The default implementation of the property control.
1919
*
20-
* @param <C> the type parameter
21-
* @param <D> the type parameter
22-
* @param <T> the type parameter
20+
* @param <C> the change consumer's type.
21+
* @param <D> the edited object's type.
22+
* @param <T> the edited property's type.
2323
* @author JavaSaBr
2424
*/
2525
public class DefaultPropertyControl<C extends ChangeConsumer, D, T> extends PropertyControl<C, D, T> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
/**
1111
* The default implementation of the property control.
1212
*
13-
* @param <C> the type parameter
14-
* @param <D> the type parameter
15-
* @param <T> the type parameter
13+
* @param <C> the change consumer's type.
14+
* @param <D> the edited object's type.
15+
* @param <T> the edited property's type.
1616
* @author JavaSaBr
1717
*/
1818
public class DefaultSinglePropertyControl<C extends ChangeConsumer, D, T> extends DefaultPropertyControl<C, D, T> {

0 commit comments

Comments
 (0)