diff --git a/config.properties b/config.properties index e8758a9..20235be 100644 --- a/config.properties +++ b/config.properties @@ -1,12 +1,12 @@ -#Wed Jun 07 17:03:46 CEST 2023 -fxcFile=AUTO -dontAskAgain_saveAsMod=false +#Wed Feb 21 20:23:40 CET 2024 gameToExecute=GALACTIC_ADVENTURES -dontAskAgain_removeItem=false hasSelectedStyle=true pathSpore=AUTO +gameCommandLine= pathGA=AUTO -selectedStyle=Dark +dontAskAgain_saveAsMod=false +fxcFile=C\:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.22621.0\\x86\\fxc.exe isFirstTime=false +dontAskAgain_removeItem=false pathCustom= -gameCommandLine= +selectedStyle=Dark diff --git a/src/sporemodder/ProjectManager.java b/src/sporemodder/ProjectManager.java index dd6272a..3019154 100644 --- a/src/sporemodder/ProjectManager.java +++ b/src/sporemodder/ProjectManager.java @@ -1432,7 +1432,7 @@ public void unpackPresets(List presets, List converter if (failedPackages.isEmpty()) { infoLabel.setText("Finished! All presets were unpacked successfully. Below you can check a list of all the packages they include:"); } else { - infoLabel.setText("Finished! Some packages could not be unpaked; below there is a list with the packages the presets contains, the ones in red were missing:"); + infoLabel.setText("Finished! Some packages could not be unpacked; below there is a list with the packages the presets contains, the ones in red were missing:"); } boolean openedByDefault = true; diff --git a/src/sporemodder/view/editors/PropEditor.java b/src/sporemodder/view/editors/PropEditor.java index b6a8e7a..ac7b06d 100644 --- a/src/sporemodder/view/editors/PropEditor.java +++ b/src/sporemodder/view/editors/PropEditor.java @@ -28,6 +28,7 @@ import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.stage.Popup; +import org.fxmisc.richtext.NavigationActions; import sporemodder.DocumentationManager; import sporemodder.HashManager; import sporemodder.file.TextUtils; @@ -35,6 +36,8 @@ import sporemodder.file.prop.PropertyList; import sporemodder.view.UserInterface; +import java.util.Set; + public class PropEditor extends ArgScriptEditor { private static final int AUTOCOMPLETE_WIDTH = 400; @@ -107,6 +110,18 @@ public PropEditor() { hideAutocomplete(); } }); + autocompleteList.addEventFilter(KeyEvent.KEY_PRESSED, event -> { + Set discardedKeys = Set.of(KeyCode.SPACE, KeyCode.UP, KeyCode.LEFT, KeyCode.RIGHT, KeyCode.DOWN); + if (discardedKeys.contains(event.getCode())) { + event.consume(); + + if (event.getCode() == KeyCode.LEFT) { + getCodeArea().moveTo(getCodeArea().getCaretPosition() - 1); + } else if (event.getCode() == KeyCode.RIGHT) { + getCodeArea().moveTo(getCodeArea().getCaretPosition() + 1); + } + } + }); final CodeArea codeArea = getCodeArea(); @@ -116,7 +131,7 @@ public PropEditor() { codeArea.caretPositionProperty().addListener((obs, oldValue, newValue) -> { // The caret also moves when typing, but we don't want to close the popup there - if (caretMouseEvent && autocompletePopup.isShowing()) { + if (autocompletePopup.isShowing()) { if (newValue > currentWordEnd || newValue < currentWordStart) { hideAutocomplete(); } diff --git a/src/sporemodder/view/editors/RWModelViewer.java b/src/sporemodder/view/editors/RWModelViewer.java index f49fa26..ded5e03 100644 --- a/src/sporemodder/view/editors/RWModelViewer.java +++ b/src/sporemodder/view/editors/RWModelViewer.java @@ -28,6 +28,7 @@ import java.util.Map; import java.util.Stack; +import javafx.scene.control.*; import sporemodder.file.filestructures.FileStream; import sporemodder.file.filestructures.MemoryStream; import sporemodder.file.filestructures.StreamReader; @@ -39,13 +40,6 @@ import javafx.scene.PerspectiveCamera; import javafx.scene.SceneAntialiasing; import javafx.scene.SubScene; -import javafx.scene.control.Button; -import javafx.scene.control.ButtonType; -import javafx.scene.control.CheckBox; -import javafx.scene.control.Dialog; -import javafx.scene.control.ScrollPane; -import javafx.scene.control.TreeItem; -import javafx.scene.control.TreeView; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.PixelReader; @@ -72,23 +66,9 @@ import sporemodder.UIManager; import sporemodder.file.BoundingBox; import sporemodder.file.dds.DDSTexture; +import sporemodder.file.rw4.*; import sporemodder.file.rw4.Direct3DEnums.RWDECLUSAGE; -import sporemodder.file.rw4.MaterialStateCompiler; -import sporemodder.file.rw4.RWBBox; -import sporemodder.file.rw4.RWBaseResource; -import sporemodder.file.rw4.RWBlendShapeBuffer; -import sporemodder.file.rw4.RWCompiledState; import sporemodder.file.rw4.RWHeader.RenderWareType; -import sporemodder.file.rw4.RWIndexBuffer; -import sporemodder.file.rw4.RWMesh; -import sporemodder.file.rw4.RWMeshCompiledStateLink; -import sporemodder.file.rw4.RWMorphHandle; -import sporemodder.file.rw4.RWObject; -import sporemodder.file.rw4.RWRaster; -import sporemodder.file.rw4.RWTextureOverride; -import sporemodder.file.rw4.RWVertexBuffer; -import sporemodder.file.rw4.RWVertexElement; -import sporemodder.file.rw4.RenderWare; import sporemodder.file.shaders.MaterialStateLink; import sporemodder.util.ProjectItem; import sporemodder.util.Vector3; @@ -213,7 +193,8 @@ public Node getIcon(ProjectItem item) { private final ScrollPane propertiesContainer = new ScrollPane(); private final TreeView treeView = new TreeView<>(); private final CheckBox cbIgnoreAlpha = new CheckBox("Ignore alpha"); - + + private final TreeItem tiAnimations = new TreeItem("Animations"); private final TreeItem tiMorphs = new TreeItem("Morph Handles"); private final TreeItem tiTextures = new TreeItem("Textures"); private final TreeItem tiExternalTextures = new TreeItem("External Textures"); @@ -242,8 +223,9 @@ private RWModelViewer() { treeView.setRoot(rootItem); treeView.setShowRoot(false); treeView.setMaxHeight(TREE_VIEW_HEIGHT); - - rootItem.getChildren().add(tiMorphs); + + rootItem.getChildren().add(tiAnimations); + rootItem.getChildren().add(tiMorphs); rootItem.getChildren().add(tiTextures); rootItem.getChildren().add(tiExternalTextures); rootItem.getChildren().add(tiCompiledStates); @@ -734,6 +716,12 @@ private void fillTreeView() { itemsMap.put(name, item); tiMorphs.getChildren().add(item); } + + List animations = renderWare.getObjects(RWAnimations.class); + if (!animations.isEmpty()) { + nameMap.put("Animations", animations.get(0)); + itemsMap.put("Animations", tiAnimations); + } } } @@ -802,7 +790,7 @@ public boolean supportsEditHistory() { private void fillPropertiesPane(TreeItem item, String selectedName) { RWObject object = nameMap.get(selectedName); - + if (object instanceof RWMorphHandle) { fillMorphPane(item, selectedName, (RWMorphHandle) object); return; @@ -821,9 +809,25 @@ else if (object instanceof RWCompiledState) { }, "Error with compiled state."); // We don't return because we want to empty the properties container } + else if (object instanceof RWAnimations) { + fillAnimationsPane(item, (RWAnimations) object); + return; + } propertiesContainer.setContent(null); } + + private void fillAnimationsPane(TreeItem item, RWAnimations animations) { + PropertyPane pane = new PropertyPane(); + + for (int animationID : animations.animations.keySet()) { + Label label = new Label(HashManager.get().getFileName(animationID)); + label.getStyleClass().add("inspector-value-label"); + pane.add(label); + } + + propertiesContainer.setContent(pane.getNode()); + } private void fillExternalTexturePane(TreeItem item, String name, RWTextureOverride texture) { PropertyPane pane = new PropertyPane();