-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90308f1
commit e87f9ab
Showing
10 changed files
with
180 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: msfsSceneryTools | ||
Type: Package | ||
Title: msfsSceneryTools | ||
Version: 0.1.1 | ||
Version: 0.1.2 | ||
Author: Vinícius Zendron | ||
Maintainer: Vinícius Zendron <[email protected]> | ||
Description: Tools to work with scenery creation in Microsoft Flight Simulator. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ export(fixCorruptedFiles) | |
export(fixLods) | ||
export(fixObjectsXML) | ||
export(isValidXML) | ||
export(objectsXmlGuids) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# msfsSceneryTools | ||
|
||
|
||
[![version](https://img.shields.io/badge/version-0.1.2-blue.svg)](https://semver.org) | ||
|
||
This package provides some functions to Microsoft Flight Simulator Scenery developers, especially those who extract photogrammetry data from other sources and need to do some cleaning and removing corrupted files. | ||
|
||
## Installation | ||
|
||
After installing R, just run the code above to install the latest version available: | ||
|
||
```r | ||
if (!require("remotes")) install.packages("remotes") | ||
remotes::install_github("viniciuszendron/msfsSceneryTools@main") | ||
``` | ||
|
||
## Changelog | ||
|
||
### Version 0.1.2 | ||
|
||
- Functions `fixLods` and `fixBinGltf` (both executed from `fixCorruptedFiles`) now removes all correspondent texture files (.png) from folder *texture*. Previously, only the corrupted .bin, .gltf and .xml were deleted, but the textures themselves were not. This behavior could make the final package bigger to the end user (as Flight Simulator editor does not remove them automatically). | ||
- New function: `objectsXmlGuids` (Get all guids identifiers registered in objects.xml file). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Install Package if not installed | ||
if (!require("remotes")) install.packages("remotes") | ||
if (!require("msfsSceneryTools")) remotes::install_github("viniciuszendron/msfsSceneryTools@main") | ||
|
||
# Check Package Version | ||
packageVersion("msfsSceneryTools") | ||
|
||
# Set main variables | ||
# Change these values to the values of your scenery! | ||
PackageSourcesDir <- "C:/.../PackageSources" | ||
modelLibDir <- "D:/.../PackageSources/modelLib" | ||
nlods <- 1 # Number of lods | ||
|
||
# Perform checks | ||
binGltfCheck <- msfsSceneryTools::checkAllFilesBinGltf(modelLibDir, nlods = nlods) | ||
lodsCheck <- msfsSceneryTools::checkAllLods(modelLibDir) | ||
|
||
# Check which files are INVALID | ||
invalidBinGltf <- Filter(function(x) isFALSE(x[[1]][1]), binGltfCheck) | ||
sapply(invalidBinGltf, "[[", 4) # Get guids of invalidBinGltf | ||
names(invalidBinGltf) | ||
invalidLods <- Filter(function(x) isFALSE(x[[1]][1]), lodsCheck) | ||
names(invalidLods) | ||
|
||
# Check which are VALID | ||
validBinGltf <- Filter(function(x) isTRUE(x[[1]][1]), binGltfCheck) | ||
names(validBinGltf) | ||
validLods <- Filter(function(x) isTRUE(x[[1]][1]), lodsCheck) | ||
names(validLods) | ||
|
||
# Fix both Lods and missing bin/gltf files | ||
msfsSceneryTools::fixCorruptedFiles(PackageSourcesDir, nlods = nlods) | ||
|
||
# Just check if there are no invalid files anymore | ||
invisible(msfsSceneryTools::checkAllFilesBinGltf(modelLibDir, nlods = nlods)) | ||
invisible(msfsSceneryTools::checkAllLods(modelLibDir)) | ||
|
||
|
||
# Now, it is time to build the scenery package and see if everything is fine. It should not return error or failed. | ||
# Code below is not necessary - debug only | ||
|
||
# Check if the exported package is OK | ||
library(magrittr) | ||
xmls <- dir(modelLibDir) %>% .[stringr::str_detect(., "xml")] | ||
count_xmls <- length(xmls) | ||
modelLibObjs <- xmls %>% stringr::str_remove_all(., stringr::fixed(".xml")) | ||
|
||
#dir_scene <- "D:/FSProjects/florianopolis-megapack/florianopolis-mega/PackageSources/scene" | ||
#objects.xml <- xml2::read_xml(file.path(dir_scene, "objects.xml")) | ||
#SceneryObjectNodes <- xml2::xml_find_all(objects.xml, ".//SceneryObject") | ||
#length(SceneryObjectNodes) | ||
|
||
outputDir <- "D:/FSProjects/maceio/Packages/flv-maceio" | ||
|
||
filesTEXTURE <- dir(file.path(outputDir, "scenery/flv/TEXTURE")) | ||
filesTEXTUREUnique <- filesTEXTURE %>% | ||
stringr::str_remove_all(., stringr::fixed(".PNG.DDS")) %>% | ||
stringr::str_remove_all(., stringr::fixed(".json")) %>% | ||
stringr::str_remove_all(., "_.*") %>% | ||
unique() | ||
|
||
modelLibObjs[!modelLibObjs %in% filesTEXTUREUnique] | ||
|
||
|
||
# Get all objects.xml nodes and compare | ||
guids <- objectsXmlGuids("D:/FSProjects/maceio/PackageSources/scene/objects.xml") | ||
|
||
guidsBinGltf <- sapply(binGltfCheck, "[[", 4) | ||
guidsLods <- sapply(lodsCheck, "[[", 2) | ||
length(lodsCheck) | ||
length(binGltfCheck) | ||
length(guids) | ||
|
||
all( | ||
length(lodsCheck) == length(binGltfCheck), | ||
length(guids) == length(lodsCheck), | ||
length(guids) == length(binGltfCheck) | ||
) | ||
|
||
guidsBinGltf[guidsBinGltf %in% guids] | ||
guids[guids %in% guidsBinGltf] | ||
guidsBinGltf[!guidsBinGltf %in% guids] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.