Skip to content

Commit c2ffe02

Browse files
committed
Merge remote-tracking branch 'origin/develop' into feature/IDEA_integration
# Conflicts: # build.gradle
2 parents 50d4f85 + d27de8f commit c2ffe02

19 files changed

+832
-30
lines changed

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ compileTestJava {
2323
targetCompatibility = 1.8
2424
options.compilerArgs += '-parameters'
2525
}
26+
2627
ext.applicationMainClass = "com.ss.editor.JFXApplication"
2728
ext.applicationVendor = "[email protected]"
2829
ext.applicationTitle = "jMonkeyBuilder"
29-
ext.jmeVersion = "upgrade_lwjgl3-SNAPSHOT"
30+
ext.jmeVersion = "3.3_branch-SNAPSHOT"
3031
ext.jme3_xbuf_version = '0.9.1'
3132
ext.lwjglVersion = "3.1.5"
3233
ext.junitPlatformVersion = "1.0.0"
@@ -60,8 +61,8 @@ dependencies {
6061
compile 'org.controlsfx:controlsfx:8.40.13'
6162

6263
compile 'com.github.JavaSaBr:RlibFX:4.1.3'
63-
compile 'com.github.JavaSaBr:RLib:6.6.0'
64-
compile 'com.github.JavaSaBr:JME3-JFX:1.7.0'
64+
compile 'com.github.JavaSaBr:RLib:6.7.0'
65+
compile 'com.github.JavaSaBr:JME3-JFX:1.7.1'
6566

6667
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
6768
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'

src/main/java/com/ss/editor/Messages.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,12 @@ public class Messages {
240240
public static final String MODEL_NODE_TREE_ACTION_ANIMATION_PLAY_SETTINGS;
241241
public static final String MODEL_NODE_TREE_ACTION_ANIMATION_STOP;
242242
public static final String MODEL_NODE_TREE_ACTION_ANIMATION_PAUSE;
243-
public static final String MODEL_NODE_TREE_ACTION_ANIMATION_MANUAL_EXTRAXT_SUB_ANIMATION;
243+
public static final String MODEL_NODE_TREE_ACTION_ANIMATION_MANUAL_EXTRACT_SUB_ANIMATION;
244244
public static final String MODEL_NODE_TREE_ACTION_CREATE_AUDIO_NODE;
245245
public static final String MODEL_NODE_TREE_ACTION_AUDIO_PLAY;
246246
public static final String MODEL_NODE_TREE_ACTION_AUDIO_STOP;
247+
public static final String MODEL_NODE_TREE_ACTION_COPY;
248+
public static final String MODEL_NODE_TREE_ACTION_PASTE;
247249
public static final String MODEL_NODE_TREE_ACTION_CREATE_TONEG0D_PARTICLE_EMITTER;
248250
public static final String MODEL_NODE_TREE_ACTION_CREATE_SOFT_TONEG0D_PARTICLE_EMITTER;
249251
public static final String MODEL_NODE_TREE_ACTION_CREATE_DEFAULT_PARTICLE_EMITTER;
@@ -918,10 +920,12 @@ public class Messages {
918920
MODEL_NODE_TREE_ACTION_ANIMATION_PLAY_SETTINGS = bundle.getString("ModelNodeTreeActionAnimationPlaySettings");
919921
MODEL_NODE_TREE_ACTION_ANIMATION_STOP = bundle.getString("ModelNodeTreeActionAnimationStop");
920922
MODEL_NODE_TREE_ACTION_ANIMATION_PAUSE = bundle.getString("ModelNodeTreeActionAnimationPause");
921-
MODEL_NODE_TREE_ACTION_ANIMATION_MANUAL_EXTRAXT_SUB_ANIMATION = bundle.getString("ModelNodeTreeActionAnimationManualExtractSubAnimation");
923+
MODEL_NODE_TREE_ACTION_ANIMATION_MANUAL_EXTRACT_SUB_ANIMATION = bundle.getString("ModelNodeTreeActionAnimationManualExtractSubAnimation");
922924
MODEL_NODE_TREE_ACTION_CREATE_AUDIO_NODE = bundle.getString("ModelNodeTreeActionCreateAudioNode");
923925
MODEL_NODE_TREE_ACTION_AUDIO_PLAY = bundle.getString("ModelNodeTreeActionAudioPlay");
924926
MODEL_NODE_TREE_ACTION_AUDIO_STOP = bundle.getString("ModelNodeTreeActionAudioStop");
927+
MODEL_NODE_TREE_ACTION_COPY = bundle.getString("ModelNodeTreeActionCopy");
928+
MODEL_NODE_TREE_ACTION_PASTE = bundle.getString("ModelNodeTreeActionPaste");
925929
MODEL_NODE_TREE_ACTION_CREATE_TONEG0D_PARTICLE_EMITTER = bundle.getString("ModelNodeTreeActionCreateToneg0dParticleEmitter");
926930
MODEL_NODE_TREE_ACTION_CREATE_SOFT_TONEG0D_PARTICLE_EMITTER = bundle.getString("ModelNodeTreeActionCreateSoftToneg0dParticleEmitter");
927931
MODEL_NODE_TREE_ACTION_CREATE_DEFAULT_PARTICLE_EMITTER = bundle.getString("ModelNodeTreeActionCreateDefaultParticleEmitter");

src/main/java/com/ss/editor/ui/control/layer/node/SceneLayerTreeNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public boolean hasChildren(@NotNull final NodeTree<?> nodeTree) {
8888

8989
@Override
9090
@FXThread
91-
public boolean canAccept(@NotNull final TreeNode<?> child, final boolean isCopy) {
92-
final Object element = child.getElement();
91+
public boolean canAccept(@NotNull final TreeNode<?> treeNode, final boolean isCopy) {
92+
final Object element = treeNode.getElement();
9393
return element instanceof Spatial && SceneLayer.getLayer((Spatial) element) != getElement();
9494
}
9595

src/main/java/com/ss/editor/ui/control/model/node/light/LightTreeNode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public LightTreeNode(@NotNull final T element, final long objectId) {
4343
public void changeName(@NotNull final NodeTree<?> nodeTree, @NotNull final String newName) {
4444
final T element = getElement();
4545
final ChangeConsumer consumer = notNull(nodeTree.getChangeConsumer());
46-
consumer.execute(new RenameLightOperation(element.getName(), newName, element));
46+
final String currentName = element.getName();
47+
consumer.execute(new RenameLightOperation(currentName == null ? "" : currentName, newName, element));
4748
}
4849

4950
@Override

src/main/java/com/ss/editor/ui/control/model/node/spatial/GeometryTreeNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public void add(@NotNull final TreeNode<?> child) {
7878
}
7979

8080
@Override
81-
public boolean canAccept(@NotNull final TreeNode<?> child, final boolean isCopy) {
82-
final Object element = child.getElement();
83-
return (element instanceof Material && isCopy) || super.canAccept(child, isCopy);
81+
public boolean canAccept(@NotNull final TreeNode<?> treeNode, final boolean isCopy) {
82+
final Object element = treeNode.getElement();
83+
return (element instanceof Material && isCopy) || super.canAccept(treeNode, isCopy);
8484
}
8585

8686
@Override

src/main/java/com/ss/editor/ui/control/model/node/spatial/NodeTreeNode.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ public boolean hasChildren(@NotNull final NodeTree<?> nodeTree) {
146146
}
147147

148148
@Override
149-
public boolean canAccept(@NotNull final TreeNode<?> child, final boolean isCopy) {
150-
if (child == this) return false;
149+
public boolean canAccept(@NotNull final TreeNode<?> treeNode, final boolean isCopy) {
150+
if (treeNode == this) return false;
151151

152-
final Object element = child.getElement();
152+
final Object element = treeNode.getElement();
153153

154154
if (element instanceof Spatial) {
155155
return GeomUtils.canAttach(getElement(), (Spatial) element, isCopy);
156156
}
157157

158-
return super.canAccept(child, isCopy);
158+
return super.canAccept(treeNode, isCopy);
159159
}
160160

161161
@Override

src/main/java/com/ss/editor/ui/control/model/node/spatial/SpatialTreeNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ public boolean canCopy() {
101101

102102
@Override
103103
@FXThread
104-
public boolean canAccept(@NotNull final TreeNode<?> child, final boolean isCopy) {
105-
final Object element = child.getElement();
106-
return element instanceof AbstractControl || super.canAccept(child, isCopy);
104+
public boolean canAccept(@NotNull final TreeNode<?> treeNode, final boolean isCopy) {
105+
final Object element = treeNode.getElement();
106+
return element instanceof AbstractControl || super.canAccept(treeNode, isCopy);
107107
}
108108

109109
@Override

src/main/java/com/ss/editor/ui/control/model/node/spatial/scene/SceneNodeTreeNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public boolean canMove() {
5555
}
5656

5757
@Override
58-
public boolean canAccept(@NotNull final TreeNode<?> child, final boolean isCopy) {
58+
public boolean canAccept(@NotNull final TreeNode<?> treeNode, final boolean isCopy) {
5959
return false;
6060
}
6161

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.ss.editor.ui.control.model.tree.action;
2+
3+
import static com.ss.editor.ui.control.tree.NodeTreeCell.DATA_FORMAT;
4+
import com.ss.editor.Messages;
5+
import com.ss.editor.annotation.FXThread;
6+
import com.ss.editor.model.undo.editor.ModelChangeConsumer;
7+
import com.ss.editor.ui.Icons;
8+
import com.ss.editor.ui.control.tree.NodeTree;
9+
import com.ss.editor.ui.control.tree.action.AbstractNodeAction;
10+
import com.ss.editor.ui.control.tree.node.TreeNode;
11+
import javafx.scene.image.Image;
12+
import javafx.scene.input.Clipboard;
13+
import javafx.scene.input.ClipboardContent;
14+
import org.jetbrains.annotations.NotNull;
15+
import org.jetbrains.annotations.Nullable;
16+
17+
/**
18+
* The action to copy a node in model.
19+
*
20+
* @author JavaSaBr
21+
*/
22+
public class CopyNodeAction extends AbstractNodeAction<ModelChangeConsumer> {
23+
24+
public CopyNodeAction(@NotNull final NodeTree<?> nodeTree, @NotNull final TreeNode<?> node) {
25+
super(nodeTree, node);
26+
}
27+
28+
@Override
29+
@FXThread
30+
protected @NotNull String getName() {
31+
return Messages.MODEL_NODE_TREE_ACTION_COPY;
32+
}
33+
34+
@Override
35+
@FXThread
36+
protected @Nullable Image getIcon() {
37+
return Icons.COPY_16;
38+
}
39+
40+
@Override
41+
@FXThread
42+
protected void process() {
43+
super.process();
44+
45+
final TreeNode<?> node = getNode();
46+
47+
final ClipboardContent content = new ClipboardContent();
48+
content.put(DATA_FORMAT, node.getObjectId());
49+
50+
final Clipboard clipboard = Clipboard.getSystemClipboard();
51+
clipboard.setContent(content);
52+
}
53+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.ss.editor.ui.control.model.tree.action;
2+
3+
import static com.ss.rlib.util.ObjectUtils.notNull;
4+
import com.ss.editor.Messages;
5+
import com.ss.editor.annotation.FXThread;
6+
import com.ss.editor.model.undo.editor.ModelChangeConsumer;
7+
import com.ss.editor.ui.Icons;
8+
import com.ss.editor.ui.control.tree.NodeTree;
9+
import com.ss.editor.ui.control.tree.action.AbstractNodeAction;
10+
import com.ss.editor.ui.control.tree.node.TreeNode;
11+
import javafx.scene.image.Image;
12+
import org.jetbrains.annotations.NotNull;
13+
import org.jetbrains.annotations.Nullable;
14+
15+
/**
16+
* The action to paste a node in model.
17+
*
18+
* @author JavaSaBr
19+
*/
20+
public class PasteNodeAction extends AbstractNodeAction<ModelChangeConsumer> {
21+
22+
/**
23+
* The copied node.
24+
*/
25+
@NotNull
26+
private final TreeNode<?> copiedNode;
27+
28+
public PasteNodeAction(@NotNull final NodeTree<?> nodeTree, @NotNull final TreeNode<?> node,
29+
@NotNull final TreeNode<?> copiedNode) {
30+
super(nodeTree, node);
31+
this.copiedNode = copiedNode;
32+
}
33+
34+
@Override
35+
@FXThread
36+
protected @NotNull String getName() {
37+
return Messages.MODEL_NODE_TREE_ACTION_PASTE;
38+
}
39+
40+
@Override
41+
@FXThread
42+
protected @Nullable Image getIcon() {
43+
return Icons.PASTE_16;
44+
}
45+
46+
@Override
47+
@FXThread
48+
protected void process() {
49+
super.process();
50+
51+
final ModelChangeConsumer changeConsumer = notNull(getNodeTree().getChangeConsumer());
52+
53+
final TreeNode<?> node = getNode();
54+
node.accept(changeConsumer, copiedNode.getElement(), true);
55+
}
56+
}

0 commit comments

Comments
 (0)