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

Model JSON tweaks #469

Merged
merged 22 commits into from
Sep 9, 2023

Conversation

zNightlord
Copy link
Contributor

@zNightlord zNightlord commented Aug 25, 2023

Previously #453

This should take care of that issue in #457, I hope.
Need to find a nice way to check the namespace "minecraft" vanilla, no longer since there are cases can't really find minecraft vanilla texture
Use default no diffuse texture setup instead.

@zNightlord zNightlord marked this pull request as draft August 25, 2023 11:14
@zNightlord zNightlord marked this pull request as ready for review September 2, 2023 08:35
@zNightlord
Copy link
Contributor Author

Should be ready for review now.

@zNightlord
Copy link
Contributor Author

Should we move enum into one file because those are scattering everywhere now?

@TheDuckCow TheDuckCow added this to the v3.5.0 milestone Sep 3, 2023
@TheDuckCow
Copy link
Member

I need to do more of a review, but seeing we're getting into the nitty details of code style makes me think we're pretty close on this, and as I understand would greatly increase the reliability of being able to use the model importer (our top source of errors from users). As such, I've marked this for the 3.5.0 milestones, in the hopes we can wrap this up in the next week or two max to merge.

r, obj = add_model(os.path.normpath(self.filepath), name)
if r:
self.report(
{"ERROR"}, "The JSON defined is not valid for a Minecraft Java Edition model")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{"ERROR"}, "The JSON defined is not valid for a Minecraft Java Edition model")
{"ERROR"}, "The JSON model is not avalid JSON model as per Minecraft Java Edition standards")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about "The JSON model is not valid for Minecraft Java Edition"
Or something like "The JSON model does not contain any geometry elements" since it only return that because it doesn't have any geometry information.

r, obj = add_model(os.path.normpath(self.filepath), filename)
if r:
self.report(
{"ERROR"}, "The JSON defined is not valid for a Minecraft Java Edition model")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{"ERROR"}, "The JSON defined is not valid for a Minecraft Java Edition model")
{"ERROR"}, "The JSON model is not avalid JSON model as per Minecraft Java Edition standards")

Copy link
Collaborator

@StandingPadAnimations StandingPadAnimations left a comment

Choose a reason for hiding this comment

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

Couple of issues I noticed with enums and comments. Otherwise, mostly good.

I did see an instance where MCprep will force the user to use meshswap models over JSON models. That is unacceptable, the precedent is that we do not decide on the user's behalf anything related to imports unless it fixes an actual issue (Non-standard color spaces for OBJs, feature compatibility, etc.). Nowhere does that mean, “let's ignore the user's wish to use a JSON model because we already have a meshswap model”.

@zNightlord
Copy link
Contributor Author

zNightlord commented Sep 3, 2023

Couple of issues I noticed with enums and comments. Otherwise, mostly good.

I did see an instance where MCprep will force the user to use meshswap models over JSON models. That is unacceptable, the precedent is that we do not decide on the user's behalf anything related to imports unless it fixes an actual issue (Non-standard color spaces for OBJs, feature compatibility, etc.). Nowhere does that mean, “let's ignore the user's wish to use a JSON model because we already have a meshswap model”.

The issue is certain Minecraft "block" isn't really a normal block like most of the blocks in the Block model. Most of the blocks in #267 would be called as an entity block/tile and some cases like double block flower, tall grass... would it better to be a one mesh block through meshswap

@zNightlord zNightlord closed this Sep 3, 2023
@zNightlord zNightlord reopened this Sep 3, 2023
@zNightlord
Copy link
Contributor Author

I originally I would make fixed json version of those entity blocks but blend file would be better suitable for it, I'm expecting "why this shulker block, chest in block model can't do that open intersction and meshswap has another version of them that can open, interact"
accident press the close button

@StandingPadAnimations
Copy link
Collaborator

StandingPadAnimations commented Sep 5, 2023

I originally I would make fixed json version of those entity blocks but blend file would be better suitable for it, I'm expecting "why this shulker block, chest in block model can't do that open intersction and meshswap has another version of them that can open, interact" accident press the close button

If a user imports a JSON model and expects to have all entity interactions, that's an issue with the user not knowing how to use MCprep, not an issue where MCprep has to spoonfeed users the quote on quote "correct" model (Especially because we already have a meshswap spawner). For Steve's sake, it's called, "Import JSON Model", not, "Import JSON Model But We Force Meshswap Models for Certain Blocks". The latter sounds ridiculous, I know, but that's what's being implemented when we start assuming what the user wants.

What about the users that want blocks without any interaction features? (i.e. a regular block) Do we start telling them, "Sorry, but we don't want to give users the inconvinience of troubleshooting because of their mistake, so you'll have edit the MCprep code to properly import JSON models"? Sounds ridiculous, but again, that's what happens when we start to assume.

(I would love to quote one of my former architecture teachers regarding assuming, but it involves some language not really fit on the GitHub repo for a Minecraft animation workflow addon)

The whole idea behind importing JSON models in MCprep is to import a JSON model as is, without any additional features. Forcing meshswap models in JSON import defeats the purpose of JSON imports (again, we already have a meshswap spawner).

@zNightlord
Copy link
Contributor Author

Why would they expecting an interaction while those blocks only the entity tile blocks in the game. How would they import a modded entity block? Since they don't even have any geometry data inside it would be empty because entity block is through hardcoded model renderer (now there is Geckolib, we don't even support Bedrock format so Geckolib is not too)
For the interaction. They don't want it they could delete the rig armature so...

I know this is the hard one because of the terminology we use for this. #148
MCprep - Minecraft - Generic 3D terms
Meshswap - Block or Entity Tile block - Can be a model or a rigged model
JSON Block Model - Block - Model (no rig)

@StandingPadAnimations
Copy link
Collaborator

StandingPadAnimations commented Sep 5, 2023

If no geometry is defined in JSON models for entities, then it's simply more transparent to not include entities in the JSON importer. It's both disingenuous and frustrating to import meshswap models in the JSON importer. At this point, it's a decision between transparency vs. obscure behavior, which raises a red flag. If that means having to put a notice in the UI saying “Entities are under the Meshswap importer” (though I also see an entity spawner, so it should be obvious anyway), so be it. I'd rather have the JSON importer be transparent in what it can import than have to debug for hours wondering why it's importing undesired meshswap models, only to find that it's forced behavior.

At this route, I'd say:
A. Remove entities from JSON models
B. Check JSON models to see if they define geometry. If they don't, throw an error

I get it, we want to include every JSON model, but transparent behavior is preferred.

@TheDuckCow
Copy link
Member

So first want to acknowledge that this is a tricky subject, and indeed there's no singular correct answer. I do appreciate though the focus on what will make sense for users, and not obscuring functionality or extending lower level functions in ways that are not expected.

Copying some of my comments from discord, I could see us going a route that is more like creating a meta or uber operator that clearly indicators it's "doing multiple things", with lower level operations that can also be performed individually.

  • Higher level operation:
    • Meshswap world -> that's the name today, and true it is just "meshswap".
    • We could extend that or create a new operator which is to 3d-ify the world, using a combination of meshswap, json mode importing, etc. It could / should also be a bit more interactive (think: open gl, selecting boxes/voxels to convert, versus whole mesh selection) since rarely would someone intentionally try to swap and entire world at once for individual 3D models.. probably some area or cube selection would be relevant as there will always be performance overhead.
  • Lower level operations:
    • Meshswap spawner as-is
    • Importing a JSON model (ie if there's no data in the json file, there's nothing to import / it should be skipped)
    • Something that does what @zNightlord is describing that somehow brings more animation/content to these modded files (we'd need to chat more about what these explicit things are, and how we can represent this)

These are just some high level thoughts. In terms of the scope of this PR: we are talking abotu Model JSON tweaks, so let's try to keep the scope tight and just focus on the core changes. It becomes problematic if we start making each PR try to cover many different things, as any conversation like this derails reviewing and merging of earlier changes that would otherwise be good to go.

So in that sense, I'd like to ask - is there anything else in progress here? Or are we good to review with the intention that approval would mean as-is merging? Asking @zNightlord thanks!

@zNightlord
Copy link
Contributor Author

Yeah it should be ready for another review
I am just going along with removing the entity "fixed" blocks out of the ui list to prevent the issue for now.

For the modded block entity case, that is just an example for "Import JSON model" there are other json model structure that user would think they can import and have modded block geometry and rigged bones, animation.

Copy link
Collaborator

@StandingPadAnimations StandingPadAnimations left a comment

Choose a reason for hiding this comment

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

Just some name changes that are needed

mcprep_data_base.json Outdated Show resolved Hide resolved
MCprep_addon/spawner/mcmodel.py Outdated Show resolved Hide resolved
Adding blocks in Meshswap
@StandingPadAnimations
Copy link
Collaborator

Mergind into dev

@StandingPadAnimations StandingPadAnimations merged commit 25f8f6a into Moo-Ack-Productions:dev Sep 9, 2023
@StandingPadAnimations StandingPadAnimations mentioned this pull request Jan 19, 2024
2 tasks
@zNightlord zNightlord deleted the model-tweak branch January 26, 2024 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants