Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add scripts for automated export of .ajmodel files #64

Merged
merged 57 commits into from
Jan 17, 2024
Merged

Conversation

aidant19
Copy link
Collaborator

@aidant19 aidant19 commented Jan 10, 2024

Summary

This PR addresses #8 and adds three files:

  • bb-cli.js
  • ajexport.js
  • config.json

The bb-cli.js script must be loaded from file as a plugin within Blockbench and can then be used to execute scripts from the command line. Usage is as follows:

blockbench.exe --bb-cli {path_to_script}

NOTE: Since the scripts are executed from the Blockbench directory, the script must either be moved to the BB directory or a full path must be provided.

The ajexport.js script is a script that automatically exports .ajmodel files indicated by a directory with the config.json file. The config file is also used to provide the target data pack and resource pack files, as well as locate the assets necessary for Animated Java / Blockbench export. These currently must be changed manually.

NOTE: Currently, the ajexport.js script requires a modified version of Animated Java that exposes the safeExportProject() function to the AJ API. A repository containing such a modification can be found here:

https://github.com/aidant19/animated-java


Test plan

Not currently planned at this stage.

Reproducing in-game

N/A

Preview

ajexport

Supplemental changes

  • fix json prettier rules config
  • enable linting rules for eslint (object-shorthand and prefer-const)
  • supplement readme with automated export instructions
  • add blockbench and ajexport paths to package-scripts.js
  • add yarn start export script
  • delete mouth model

Copy link
Owner

@TheAfroOfDoom TheAfroOfDoom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lotta stuff as a start, mostly small things and pretty easy though.

have more stuff in the pipeline, but just focus on these for now

.editorconfig Show resolved Hide resolved
omega-flowey.code-workspace Outdated Show resolved Hide resolved
omega-flowey.code-workspace Outdated Show resolved Hide resolved
scripts/ajexport.js Outdated Show resolved Hide resolved
scripts/ajexport.js Outdated Show resolved Hide resolved
scripts/bb-cli.js Outdated Show resolved Hide resolved
scripts/bb-cli.js Outdated Show resolved Hide resolved
scripts/bb-cli.js Outdated Show resolved Hide resolved
scripts/config.json Outdated Show resolved Hide resolved
scripts/config.json Outdated Show resolved Hide resolved
@aidant19
Copy link
Collaborator Author

aidant19 commented Jan 11, 2024

Requested changes made to PR. Does not significantly alter functionality, but significant improvements made to formatting consistency, readability, and code integrity.

Of note:

  • ajexport.js now exports its main code as an async function and is able to await each export. bb-cli is now able to properly await its conclusion and then exit.
  • scripts now exist in package-scripts/modules

New supplemental change:
eslint enforces const requirement

Copy link
Owner

@TheAfroOfDoom TheAfroOfDoom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few more small things relating to the code quality/style.

let's also add to the README.md setup section how to configure e.g. config.json, load the bb-cli plugin into Blockbench, and run the script.


can we also add labels to the new tickets? #65 and #66

they're both devops and enhancement imo

package-scripts/modules/ajexport.js Outdated Show resolved Hide resolved
scripts/ajexport.js Outdated Show resolved Hide resolved
package-scripts/modules/ajexport.js Outdated Show resolved Hide resolved
package-scripts/modules/config.json Outdated Show resolved Hide resolved
package-scripts/modules/bb-cli.js Outdated Show resolved Hide resolved
package-scripts/modules/bb-cli.js Outdated Show resolved Hide resolved
package-scripts/modules/ajexport.js Outdated Show resolved Hide resolved
package-scripts/modules/ajexport.js Outdated Show resolved Hide resolved
package-scripts/modules/ajexport.js Outdated Show resolved Hide resolved
package-scripts/modules/ajexport.js Outdated Show resolved Hide resolved
@TheAfroOfDoom TheAfroOfDoom changed the title Adds scripts that enable automated export of Animated Java files adds scripts that enable automated export of Animated Java files Jan 15, 2024
@TheAfroOfDoom TheAfroOfDoom changed the title adds scripts that enable automated export of Animated Java files add scripts that enable automated export of Animated Java files Jan 15, 2024
@TheAfroOfDoom TheAfroOfDoom changed the title add scripts that enable automated export of Animated Java files add scripts for automated export of .ajmodel files Jan 15, 2024
Copy link
Owner

@TheAfroOfDoom TheAfroOfDoom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some extra stuff after trying to run locally. got it working, changes are in commit names.

most notably fixed the recursive file search thing. also added a yarn script so we can run the thing more easily: yarn start export (5dde75e (#64))


LGTM. i'm gonna start further work on this on another branch

package-scripts/modules/ajexport.js Outdated Show resolved Hide resolved
@aidant19
Copy link
Collaborator Author

LGTM and works locally

- bb-cli.js to allow for command line functionality with blockbench
- ajexport.js & associated config file for automated animated java exporting, to be passed to blockbench and executed from command line
- Currently requires a modified version of animated java
- specifies prettier
- also auto-changed other formatting? (unclear cause)
- Changing default formatter for json seems to have changed the workspace file which then defaulted to using json default formatting which then changed the formatting of the workspace file :)))
- re-added spacing in workspace
- moved json and jsonc formatter declaration
aidant19 and others added 26 commits January 16, 2024 22:05
- add linting support for modules
- ajexport script exported as async (now properly handled by bb-cli)
- reverted old workspace file changes (user settings issue resolved)
- was accidentally added during `friendliness-pellets` development: ca544f5#diff-596e795db462b6f907d978c7c1f0b55f7143b20a2a020cfef06c11074e1e9211
- good example of why we need #8 done to avoid thoose accidents
- should be no difference functionally
Copy link
Owner

@TheAfroOfDoom TheAfroOfDoom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thx for rebasing correctly

@aidant19 aidant19 merged commit 6848faf into main Jan 17, 2024
5 checks passed
@aidant19 aidant19 deleted the 8-aj-cli-export branch January 17, 2024 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants