Skip to content

Commit c0ea9aa

Browse files
committed
updated editing lights/audio nodes/presentable objects on scene, some improvements.
1 parent 0e0b3e1 commit c0ea9aa

65 files changed

Lines changed: 976 additions & 347 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/ss/editor/control/transform/EditorTransformSupport.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import com.jme3.renderer.Camera;
88
import com.jme3.scene.Node;
99
import com.jme3.scene.Spatial;
10+
import com.ss.editor.annotation.FromAnyThread;
11+
import com.ss.editor.annotation.JMEThread;
1012
import com.ss.editor.util.LocalObjects;
1113
import org.jetbrains.annotations.NotNull;
1214
import org.jetbrains.annotations.Nullable;
@@ -92,6 +94,7 @@ enum TransformationMode {
9294
GLOBAL {
9395

9496
@Override
97+
@JMEThread
9598
public void prepareToRotate(@NotNull final Node parent, @NotNull final Node child,
9699
@NotNull final Transform transform, @NotNull final Camera camera) {
97100
parent.setLocalRotation(Quaternion.IDENTITY);
@@ -100,6 +103,7 @@ public void prepareToRotate(@NotNull final Node parent, @NotNull final Node chil
100103

101104
@NotNull
102105
@Override
106+
@JMEThread
103107
protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull final PickedAxis pickedAxis,
104108
@NotNull final Camera camera) {
105109

@@ -113,6 +117,7 @@ protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull fin
113117
}
114118

115119
@Override
120+
@JMEThread
116121
public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
117122
@NotNull final Transform transform, @NotNull final Camera camera) {
118123
parent.setLocalTranslation(Vector3f.ZERO);
@@ -123,6 +128,7 @@ public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
123128

124129
@NotNull
125130
@Override
131+
@JMEThread
126132
public Quaternion getToolRotation(@NotNull final Transform transform, @NotNull final Camera camera) {
127133
return Quaternion.IDENTITY;
128134
}
@@ -133,6 +139,7 @@ public Quaternion getToolRotation(@NotNull final Transform transform, @NotNull f
133139
VIEW {
134140

135141
@Override
142+
@JMEThread
136143
public void prepareToRotate(@NotNull final Node parent, @NotNull final Node child,
137144
@NotNull final Transform transform, @NotNull final Camera camera) {
138145
parent.setLocalRotation(Quaternion.IDENTITY);
@@ -141,6 +148,7 @@ public void prepareToRotate(@NotNull final Node parent, @NotNull final Node chil
141148

142149
@NotNull
143150
@Override
151+
@JMEThread
144152
protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull final PickedAxis pickedAxis,
145153
@NotNull final Camera camera) {
146154

@@ -155,6 +163,7 @@ protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull fin
155163

156164
@NotNull
157165
@Override
166+
@JMEThread
158167
protected Vector3f getPickedVector(@NotNull final Transform transform, @NotNull final PickedAxis pickedAxis,
159168
@NotNull final Camera camera) {
160169

@@ -168,6 +177,7 @@ protected Vector3f getPickedVector(@NotNull final Transform transform, @NotNull
168177
}
169178

170179
@Override
180+
@JMEThread
171181
public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
172182
@NotNull final Transform transform, @NotNull final Camera camera) {
173183
parent.setLocalRotation(camera.getRotation());
@@ -178,6 +188,7 @@ public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
178188

179189
@NotNull
180190
@Override
191+
@JMEThread
181192
public Quaternion getToolRotation(@NotNull final Transform transform, @NotNull final Camera camera) {
182193
return camera.getRotation();
183194
}
@@ -187,6 +198,7 @@ public Quaternion getToolRotation(@NotNull final Transform transform, @NotNull f
187198
private static final TransformationMode[] VALUES = values();
188199

189200
@NotNull
201+
@FromAnyThread
190202
public static TransformationMode valueOf(final int index) {
191203
return VALUES[index];
192204
}
@@ -199,6 +211,7 @@ public static TransformationMode valueOf(final int index) {
199211
* @return the tool rotation.
200212
*/
201213
@NotNull
214+
@JMEThread
202215
public Quaternion getToolRotation(@NotNull final Transform transform, @NotNull final Camera camera) {
203216
return transform.getRotation();
204217
}
@@ -211,6 +224,7 @@ public Quaternion getToolRotation(@NotNull final Transform transform, @NotNull f
211224
* @param transform the base transform.
212225
* @param camera the camera.
213226
*/
227+
@JMEThread
214228
public void prepareToRotate(@NotNull final Node parent, @NotNull final Node child,
215229
@NotNull final Transform transform, @NotNull final Camera camera) {
216230
parent.setLocalRotation(transform.getRotation());
@@ -225,6 +239,7 @@ public void prepareToRotate(@NotNull final Node parent, @NotNull final Node chil
225239
* @param transform the base transform.
226240
* @param camera the camera.
227241
*/
242+
@JMEThread
228243
public void prepareToScale(@NotNull final Node parent, @NotNull final Node child,
229244
@NotNull final Transform transform, @NotNull final Camera camera) {
230245
parent.setLocalScale(transform.getScale());
@@ -239,6 +254,7 @@ public void prepareToScale(@NotNull final Node parent, @NotNull final Node child
239254
* @param transform the base transform.
240255
* @param camera the camera.
241256
*/
257+
@JMEThread
242258
public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
243259
@NotNull final Transform transform, @NotNull final Camera camera) {
244260
parent.setLocalTranslation(transform.getTranslation());
@@ -256,6 +272,7 @@ public void prepareToMove(@NotNull final Node parent, @NotNull final Node child,
256272
* @return the axis vector.
257273
*/
258274
@NotNull
275+
@JMEThread
259276
protected Vector3f getPickedVector(@NotNull final Transform transform, @NotNull final PickedAxis pickedAxis,
260277
@NotNull final Camera camera) {
261278

@@ -275,6 +292,7 @@ protected Vector3f getPickedVector(@NotNull final Transform transform, @NotNull
275292
* @return the axis vector.
276293
*/
277294
@NotNull
295+
@JMEThread
278296
protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull final PickedAxis pickedAxis,
279297
@NotNull final Camera camera) {
280298

@@ -292,13 +310,15 @@ protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull fin
292310
* @return the center of transformation.
293311
*/
294312
@Nullable
313+
@JMEThread
295314
Transform getTransformCenter();
296315

297316
/**
298317
* Sets picked axis.
299318
*
300319
* @param axis the picked axis.
301320
*/
321+
@JMEThread
302322
void setPickedAxis(@NotNull final PickedAxis axis);
303323

304324
/**
@@ -307,63 +327,73 @@ protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull fin
307327
* @return the picked axis.
308328
*/
309329
@NotNull
330+
@JMEThread
310331
PickedAxis getPickedAxis();
311332

312333
/**
313334
* Gets the transform mode.
314335
*
315336
* @return the transform mode.
316337
*/
317-
@NotNull EditorTransformSupport.TransformationMode getTransformationMode();
338+
@NotNull
339+
@JMEThread
340+
EditorTransformSupport.TransformationMode getTransformationMode();
318341

319342
/**
320343
* Gets collision plane.
321344
*
322345
* @return the collision plane.
323346
*/
324347
@Nullable
348+
@JMEThread
325349
Node getCollisionPlane();
326350

327351
/**
328352
* Set delta of transformation.
329353
*
330354
* @param transformDeltaX the x delta.
331355
*/
356+
@JMEThread
332357
void setTransformDeltaX(float transformDeltaX);
333358

334359
/**
335360
* Set delta of transformation.
336361
*
337362
* @param transformDeltaY the y delta.
338363
*/
364+
@JMEThread
339365
void setTransformDeltaY(float transformDeltaY);
340366

341367
/**
342368
* Set delta of transformation.
343369
*
344370
* @param transformDeltaZ the z delta.
345371
*/
372+
@JMEThread
346373
void setTransformDeltaZ(float transformDeltaZ);
347374

348375
/**
349376
* Get delta of transformation.
350377
*
351378
* @return the delta x.
352379
*/
380+
@JMEThread
353381
float getTransformDeltaX();
354382

355383
/**
356384
* Get delta of transformation.
357385
*
358386
* @return the delta y.
359387
*/
388+
@JMEThread
360389
float getTransformDeltaY();
361390

362391
/**
363392
* Get delta of transformation.
364393
*
365394
* @return the delta z.
366395
*/
396+
@JMEThread
367397
float getTransformDeltaZ();
368398

369399
/**
@@ -372,13 +402,15 @@ protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull fin
372402
* @return the model to transform.
373403
*/
374404
@Nullable
405+
@JMEThread
375406
Spatial getToTransform();
376407

377408
/**
378409
* Notify transformed.
379410
*
380411
* @param spatial the model which was transformed.
381412
*/
413+
@JMEThread
382414
void notifyTransformed(@NotNull final Spatial spatial);
383415

384416
/**
@@ -387,5 +419,6 @@ protected Vector3f getScaleAxis(@NotNull final Transform transform, @NotNull fin
387419
* @return the camera.
388420
*/
389421
@NotNull
422+
@JMEThread
390423
Camera getCamera();
391424
}

src/main/java/com/ss/editor/control/transform/ScaleToolControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void processTransform() {
104104
// scale object
105105
float disCursor = cursorPos.distance(selectedCoords);
106106
float disDelta = delta2d.distance(selectedCoords);
107-
float scaleValue = cursorPos.distance(delta2d) * 0.007f;
107+
float scaleValue = (float) (cursorPos.distance(delta2d) * 0.01f * Math.sqrt(baseScale.length()));
108108

109109
if (disCursor > disDelta) {
110110
baseScale.addLocal(pickedVector.mult(scaleValue, local.nextVector()));

src/main/java/com/ss/editor/model/undo/EditorOperationControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private Array<EditorOperation> getToRedo() {
6565
}
6666

6767
/**
68-
* @return the editor with supporting endo/redo.
68+
* @return the editor with supporting undo/redo.
6969
*/
7070
@NotNull
7171
private UndoableEditor getEditor() {

src/main/java/com/ss/editor/model/undo/editor/ModelChangeConsumer.java

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.jme3.scene.Node;
44
import com.jme3.scene.Spatial;
55
import com.ss.editor.annotation.FXThread;
6-
6+
import com.ss.editor.annotation.JMEThread;
77
import org.jetbrains.annotations.NotNull;
88
import org.jetbrains.annotations.Nullable;
99

@@ -23,6 +23,26 @@ public interface ModelChangeConsumer extends ChangeConsumer {
2323
@FXThread
2424
Spatial getCurrentModel();
2525

26+
/**
27+
* Notify about changed property from JME thread.
28+
*
29+
* @param object the object
30+
* @param propertyName the property name
31+
*/
32+
@JMEThread
33+
void notifyJMEChangeProperty(@NotNull Object object, @NotNull String propertyName);
34+
35+
/**
36+
* Notify about changed property from JME thread.
37+
*
38+
* @param object the object
39+
* @param propertyName the property name
40+
*/
41+
@FXThread
42+
default void notifyFXChangeProperty(@NotNull Object object, @NotNull String propertyName) {
43+
notifyFXChangeProperty(null, object, propertyName);
44+
}
45+
2646
/**
2747
* Notify about changed property.
2848
*
@@ -31,64 +51,64 @@ public interface ModelChangeConsumer extends ChangeConsumer {
3151
* @param propertyName the property name
3252
*/
3353
@FXThread
34-
void notifyChangeProperty(@Nullable Object parent, @NotNull Object object, @NotNull String propertyName);
54+
void notifyFXChangeProperty(@Nullable Object parent, @NotNull Object object, @NotNull String propertyName);
3555

3656
/**
37-
* Notify about changed property count.
57+
* Notify about changed property count from FX thread.
3858
*
3959
* @param parent the parent
4060
* @param object the object
4161
*/
4262
@FXThread
43-
void notifyChangePropertyCount(@Nullable Object parent, @NotNull Object object);
63+
void notifyFXChangePropertyCount(@Nullable Object parent, @NotNull Object object);
4464

4565
/**
46-
* Notify about added child.
66+
* Notify about added child from FX thread.
4767
*
4868
* @param parent the parent
4969
* @param added the added
5070
* @param index the index
5171
*/
5272
@FXThread
53-
void notifyAddedChild(@NotNull Object parent, @NotNull Object added, int index);
73+
void notifyFXAddedChild(@NotNull Object parent, @NotNull Object added, int index);
5474

5575
/**
56-
* Notify about removed child.
76+
* Notify about removed child from FX thread.
5777
*
5878
* @param parent the parent
5979
* @param removed the removed
6080
*/
6181
@FXThread
62-
void notifyRemovedChild(@NotNull Object parent, @NotNull Object removed);
82+
void notifyFXRemovedChild(@NotNull Object parent, @NotNull Object removed);
6383

6484
/**
65-
* Notify about replaced child.
85+
* Notify about replaced child from FX thread.
6686
*
6787
* @param parent the parent
6888
* @param oldChild the old child
6989
* @param newChild the new child
7090
*/
7191
@FXThread
72-
void notifyReplaced(@NotNull Node parent, @NotNull Spatial oldChild, @NotNull Spatial newChild);
92+
void notifyFXReplaced(@NotNull Node parent, @NotNull Spatial oldChild, @NotNull Spatial newChild);
7393

7494
/**
75-
* Notify about replaced child.
95+
* Notify about replaced child from FX thread.
7696
*
7797
* @param parent the parent
7898
* @param oldChild the old child
7999
* @param newChild the new child
80100
*/
81101
@FXThread
82-
void notifyReplaced(@NotNull Object parent, @Nullable Object oldChild, @Nullable Object newChild);
102+
void notifyFXReplaced(@NotNull Object parent, @Nullable Object oldChild, @Nullable Object newChild);
83103

84104
/**
85-
* Notify about moved child.
105+
* Notify about moved child from FX thread.
86106
*
87107
* @param prevParent the prev parent
88108
* @param newParent the new parent
89109
* @param child the child
90110
* @param index the index
91111
*/
92112
@FXThread
93-
void notifyMoved(@NotNull Node prevParent, @NotNull Node newParent, @NotNull Spatial child, int index);
113+
void notifyFXMoved(@NotNull Node prevParent, @NotNull Node newParent, @NotNull Spatial child, int index);
94114
}

0 commit comments

Comments
 (0)