Skip to content

Commit c6a3e3c

Browse files
committed
Merge branch 'develop' into feature/updating_physics
2 parents b4de02f + 8bf2fc0 commit c6a3e3c

File tree

18 files changed

+228
-50
lines changed

18 files changed

+228
-50
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# jMonkeyBuilder 1.6.0 #
1+
# jMonkeyBuilder 1.6.1 #
22
### It's 3D Editor to prepare/work/create graphics content for jMonkeyEngine 3.2 ###
33

44
[![Join the chat at https://gitter.im/jME3-SpaceShift-Editor/Lobby](https://badges.gitter.im/jME3-SpaceShift-Editor/Lobby.svg)](https://gitter.im/jME3-SpaceShift-Editor/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

app.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.6.0
1+
1.6.1

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ apply plugin: 'idea'
1313
apply plugin: 'org.junit.platform.gradle.plugin'
1414

1515
group = 'com.spaceshift'
16-
version = '1.6.0'
16+
version = '1.6.1'
1717

1818
sourceCompatibility = 1.8
1919
targetCompatibility = 1.8

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,9 @@ public void update() {
413413
//System.out.println(cam.getRotation());
414414
//System.out.println(cam.getLocation());
415415

416-
super.update();
416+
if (Config.ENABLE_3D) {
417+
super.update();
418+
}
417419

418420
} catch (final AssetNotFoundException | RendererException | AssertionError | ArrayIndexOutOfBoundsException |
419421
NullPointerException | StackOverflowError | IllegalStateException | UnsupportedOperationException e) {

src/main/java/com/ss/editor/config/Config.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public final class Config {
4242
* The editor's version.
4343
*/
4444
@NotNull
45-
public static final Version APP_VERSION = new Version("1.6.0");
45+
public static final Version APP_VERSION = new Version("1.6.1");
4646

4747
/**
4848
* The string version.
@@ -114,6 +114,11 @@ public final class Config {
114114
*/
115115
public static boolean ENABLE_PBR;
116116

117+
/**
118+
* The flag to enable 3D part of this editor.
119+
*/
120+
public static boolean ENABLE_3D;
121+
117122
static {
118123

119124
final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
@@ -128,6 +133,7 @@ public final class Config {
128133
DEV_DEBUG_JFX_KEY_INPUT = vars.getBoolean("Dev.jfxKeyInput", false);
129134
DEV_DEBUG_JFX = vars.getBoolean("Dev.debugJFX", false);
130135
ENABLE_PBR = vars.getBoolean("Graphics.enablePBR", true);
136+
ENABLE_3D = vars.getBoolean("Graphics.enable3D", true);
131137

132138
GRAPHICS_DEVICE = device;
133139
OPERATING_SYSTEM = new OperatingSystem();

src/main/java/com/ss/editor/ui/component/asset/tree/ResourceTree.java

Lines changed: 97 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55
import static com.ss.editor.ui.util.UiUtils.hasFileInClipboard;
66
import static com.ss.rlib.util.ObjectUtils.notNull;
77
import com.ss.editor.annotation.BackgroundThread;
8-
import com.ss.editor.annotation.FxThread;
98
import com.ss.editor.annotation.FromAnyThread;
9+
import com.ss.editor.annotation.FxThread;
1010
import com.ss.editor.config.EditorConfig;
1111
import com.ss.editor.manager.ExecutorManager;
1212
import com.ss.editor.ui.FXConstants;
1313
import com.ss.editor.ui.component.asset.tree.context.menu.action.*;
1414
import com.ss.editor.ui.component.asset.tree.context.menu.filler.AssetTreeMultiContextMenuFiller;
1515
import com.ss.editor.ui.component.asset.tree.context.menu.filler.AssetTreeSingleContextMenuFiller;
16-
import com.ss.editor.ui.component.asset.tree.resource.FileResourceElement;
17-
import com.ss.editor.ui.component.asset.tree.resource.FolderResourceElement;
18-
import com.ss.editor.ui.component.asset.tree.resource.LoadingResourceElement;
19-
import com.ss.editor.ui.component.asset.tree.resource.ResourceElement;
16+
import com.ss.editor.ui.component.asset.tree.resource.*;
2017
import com.ss.editor.ui.util.UiUtils;
2118
import com.ss.rlib.function.IntObjectConsumer;
2219
import com.ss.rlib.util.StringUtils;
@@ -67,13 +64,17 @@ public class ResourceTree extends TreeView<ResourceElement> {
6764
final int firstLevel = getLevel(first);
6865
final int secondLevel = getLevel(second);
6966

70-
if (firstLevel != secondLevel) return firstLevel - secondLevel;
67+
if (firstLevel != secondLevel) {
68+
return firstLevel - secondLevel;
69+
}
7170

7271
final Path firstFile = notNull(first).getFile();
73-
final String firstName = firstFile.getFileName().toString();
72+
final Path firstFileFileName = firstFile.getFileName();
73+
final String firstName = firstFileFileName == null ? firstFile.toString() : firstFileFileName.toString();
7474

7575
final Path secondFile = notNull(second).getFile();
76-
final String secondName = secondFile.getFileName().toString();
76+
final Path secondFileName = secondFile.getFileName();
77+
final String secondName = secondFileName == null ? secondFile.toString() : secondFileName.toString();
7778

7879
return StringUtils.compareIgnoreCase(firstName, secondName);
7980
};
@@ -239,7 +240,10 @@ private void processChangedExpands(@NotNull final Number newValue) {
239240
}
240241

241242
final IntObjectConsumer<ResourceTree> expandHandler = getExpandHandler();
242-
if (expandHandler == null) return;
243+
if (expandHandler == null) {
244+
return;
245+
}
246+
243247
expandHandler.accept(newValue.intValue(), this);
244248
}
245249

@@ -269,7 +273,7 @@ private void lazyLoadChildren() {
269273
*/
270274
@BackgroundThread
271275
private void lazyLoadChildren(@NotNull final TreeItem<ResourceElement> treeItem,
272-
@Nullable final Consumer<@NotNull TreeItem<ResourceElement>> callback) {
276+
@Nullable final Consumer<TreeItem<ResourceElement>> callback) {
273277

274278
final ResourceElement element = treeItem.getValue();
275279
final Array<ResourceElement> children = element.getChildren(extensionFilter, isOnlyFolders());
@@ -288,10 +292,11 @@ private void lazyLoadChildren(@NotNull final TreeItem<ResourceElement> treeItem,
288292
@FxThread
289293
private void lazyLoadChildren(@NotNull final TreeItem<ResourceElement> treeItem,
290294
@NotNull final Array<ResourceElement> children,
291-
@Nullable final Consumer<@NotNull TreeItem<ResourceElement>> callback) {
295+
@Nullable final Consumer<TreeItem<ResourceElement>> callback) {
292296

293297
final ObservableList<TreeItem<ResourceElement>> items = treeItem.getChildren();
294298
if (items.size() != 1 || items.get(0).getValue() != LoadingResourceElement.getInstance()) {
299+
if (callback != null) callback.accept(treeItem);
295300
return;
296301
}
297302

@@ -397,7 +402,10 @@ private boolean isReadOnly() {
397402
*/
398403
@FxThread
399404
protected @Nullable ContextMenu getContextMenu(@NotNull final ResourceElement element) {
400-
if (isReadOnly()) return null;
405+
406+
if (isReadOnly()) {
407+
return null;
408+
}
401409

402410
final ContextMenu contextMenu = new ContextMenu();
403411
final ObservableList<MenuItem> items = contextMenu.getItems();
@@ -432,28 +440,57 @@ private boolean isReadOnly() {
432440
}
433441
}
434442

435-
if (items.isEmpty()) return null;
443+
if (items.isEmpty()) {
444+
return null;
445+
}
436446

437447
return contextMenu;
438448
}
439449

440450
/**
441-
* Fill the tree using the asset folder.
451+
* Fill the tree using the root folder.
442452
*
443-
* @param assetFolder the asset folder.
453+
* @param rootFolder the root folder.
444454
*/
445455
@FxThread
446-
public void fill(@NotNull final Path assetFolder) {
456+
public void fill(@NotNull final Path rootFolder) {
447457

448458
final Consumer<Boolean> onLoadHandler = getOnLoadHandler();
449-
if (onLoadHandler != null) onLoadHandler.accept(Boolean.FALSE);
459+
if (onLoadHandler != null) {
460+
onLoadHandler.accept(Boolean.FALSE);
461+
}
462+
463+
final TreeItem<ResourceElement> currentRoot = getRoot();
464+
if (currentRoot != null) {
465+
setRoot(null);
466+
}
467+
468+
showLoading();
469+
470+
EXECUTOR_MANAGER.addBackgroundTask(() -> startBackgroundFill(rootFolder));
471+
}
472+
473+
/**
474+
* Fill the tree using the list of root folders.
475+
*
476+
* @param rootFolders the list of root folder.
477+
*/
478+
@FxThread
479+
public void fill(@NotNull final Array<Path> rootFolders) {
480+
481+
final Consumer<Boolean> onLoadHandler = getOnLoadHandler();
482+
if (onLoadHandler != null) {
483+
onLoadHandler.accept(Boolean.FALSE);
484+
}
450485

451486
final TreeItem<ResourceElement> currentRoot = getRoot();
452-
if (currentRoot != null) setRoot(null);
487+
if (currentRoot != null) {
488+
setRoot(null);
489+
}
453490

454491
showLoading();
455492

456-
EXECUTOR_MANAGER.addBackgroundTask(() -> startBackgroundFill(assetFolder));
493+
EXECUTOR_MANAGER.addBackgroundTask(() -> startBackgroundFill(rootFolders));
457494
}
458495

459496
/**
@@ -554,9 +591,9 @@ private void showLoading() {
554591
* Start the background process of filling.
555592
*/
556593
@BackgroundThread
557-
private void startBackgroundFill(@NotNull final Path assetFolder) {
594+
private void startBackgroundFill(@NotNull final Path path) {
558595

559-
final ResourceElement rootElement = createFor(assetFolder);
596+
final ResourceElement rootElement = createFor(path);
560597
final TreeItem<ResourceElement> newRoot = new TreeItem<>(rootElement);
561598
newRoot.setExpanded(true);
562599

@@ -570,7 +607,34 @@ private void startBackgroundFill(@NotNull final Path assetFolder) {
570607
setRoot(newRoot);
571608

572609
final Consumer<Boolean> onLoadHandler = getOnLoadHandler();
573-
if (onLoadHandler != null) onLoadHandler.accept(Boolean.TRUE);
610+
if (onLoadHandler != null) {
611+
onLoadHandler.accept(Boolean.TRUE);
612+
}
613+
});
614+
}
615+
616+
/**
617+
* Start the background process of filling.
618+
*/
619+
@BackgroundThread
620+
private void startBackgroundFill(@NotNull final Array<Path> paths) {
621+
622+
final ResourceElement rootElement = new FoldersResourceElement(paths);
623+
final TreeItem<ResourceElement> newRoot = new TreeItem<>(rootElement);
624+
newRoot.setExpanded(true);
625+
626+
fill(newRoot);
627+
628+
if (!isLazyMode() && isNeedCleanup()) {
629+
cleanup(newRoot);
630+
}
631+
632+
EXECUTOR_MANAGER.addFxTask(() -> {
633+
setRoot(newRoot);
634+
final Consumer<Boolean> onLoadHandler = getOnLoadHandler();
635+
if (onLoadHandler != null) {
636+
onLoadHandler.accept(Boolean.TRUE);
637+
}
574638
});
575639
}
576640

@@ -594,7 +658,9 @@ private void startBackgroundRefresh(@NotNull final Path assetFolder) {
594658
expandedElements.forEach(element -> {
595659

596660
final TreeItem<ResourceElement> item = findItemForValue(newRoot, element);
597-
if (item == null) return;
661+
if (item == null) {
662+
return;
663+
}
598664

599665
item.setExpanded(true);
600666
});
@@ -610,7 +676,9 @@ private void startBackgroundRefresh(@NotNull final Path assetFolder) {
610676
restoreSelection();
611677

612678
final Consumer<Boolean> onLoadHandler = getOnLoadHandler();
613-
if (onLoadHandler != null) onLoadHandler.accept(Boolean.TRUE);
679+
if (onLoadHandler != null) {
680+
onLoadHandler.accept(Boolean.TRUE);
681+
}
614682
});
615683
}
616684

@@ -649,7 +717,9 @@ private void fill(@NotNull final TreeItem<ResourceElement> treeItem) {
649717

650718
final ResourceElement element = treeItem.getValue();
651719
final Array<String> extensionFilter = getExtensionFilter();
652-
if (!element.hasChildren(extensionFilter, isOnlyFolders())) return;
720+
if (!element.hasChildren(extensionFilter, isOnlyFolders())) {
721+
return;
722+
}
653723

654724
final ObservableList<TreeItem<ResourceElement>> items = treeItem.getChildren();
655725

@@ -957,7 +1027,6 @@ public void expandTo(@NotNull final Path file, final boolean needSelect) {
9571027
if (isLazyMode()) {
9581028

9591029
final TreeItem<ResourceElement> targetItem = findItemForValue(getRoot(), file);
960-
9611030
if (targetItem == null) {
9621031

9631032
TreeItem<ResourceElement> parentItem = null;
@@ -968,11 +1037,12 @@ public void expandTo(@NotNull final Path file, final boolean needSelect) {
9681037
if (parentItem != null) {
9691038
break;
9701039
}
1040+
9711041
parent = parent.getParent();
9721042
}
9731043

9741044
if (parentItem == null) {
975-
return;
1045+
parentItem = getRoot();
9761046
}
9771047

9781048
final TreeItem<ResourceElement> toLoad = parentItem;

src/main/java/com/ss/editor/ui/component/asset/tree/ResourceTreeCell.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected void updateItem(@Nullable final ResourceElement item, boolean empty) {
141141

142142
icon.setImage(ICON_MANAGER.getIcon(file, folder, true, DEFAULT_FILE_ICON_SIZE));
143143

144-
setText(fileName.toString());
144+
setText(fileName == null ? file.toString() : fileName.toString());
145145
setGraphic(icon);
146146
createToolTip();
147147
}

src/main/java/com/ss/editor/ui/component/asset/tree/resource/FolderResourceElement.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,11 @@ public boolean hasChildren(@NotNull final Array<String> extensionFilter, final b
9393

9494
return false;
9595
}
96+
97+
@Override
98+
public String toString() {
99+
return "FolderResourceElement{" +
100+
"file=" + file +
101+
'}';
102+
}
96103
}

0 commit comments

Comments
 (0)