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

Importing mods models #457

Closed
2 tasks done
BoBikDied opened this issue Aug 15, 2023 · 6 comments
Closed
2 tasks done

Importing mods models #457

BoBikDied opened this issue Aug 15, 2023 · 6 comments

Comments

@BoBikDied
Copy link

Did the issue happen after restarting Blender?

  • Yes, the issue indeed continued after restarting Blender

Check known issues

  • I have checked known issues, and my problem is different

What happened?

When attempting to import a JSON model from mods (specifically from the mod "Create"), the following error was displayed:
https://drive.google.com/file/d/1lkH1f8-m7b3FOLLsRjINtaaXeNKfC89C/view?usp=sharing

What steps are needed to produce the bug?

  1. File - Import - .json
    2)Import .json model from mod

What version of MCprep are you using?

MCprep 3.4.3

What version of Blender are you using?

I tried to do this on different versions of Blender(3.3 - 3.6)

@StandingPadAnimations
Copy link
Collaborator

From the error, it seems like the texture couldn't be found in the default resource pack (all vanilla textures). Modded blocks aren't supported at the moment, unless you add their textures with the proper name into the MCprep resource pack folder.

@zNightlord
Copy link
Contributor

Beside the mod stuffs, this also addressed something else.
I think it shouldn't raise that texture exception, since this is from import from json 2 operators shared the same code also the same add_material before #398 it didn't raise anything as far as i remember it and let the user manually assign the textures, unless we treat this unfindable/ empty texture as a bug rather a feature.

@StandingPadAnimations
Copy link
Collaborator

StandingPadAnimations commented Aug 15, 2023

The exception is raised because MCprep checks textures based on block name, which in turn is derived from material name (there's also a JSON file for material names to blocks):

https://github.com/Moo-Ack-Productions/MCprep/blob/master/MCprep_addon/materials/generate.py#L116-L123

As far as I can tell, JSON models should define textures anyway, so no need to mess with all global textures (which is overwritten during updates). Modded blocks however will always be a weird area because there's simply too many mods, so I think it's best if we don't support modded blocks explicitly (any support MCprep appears to have will entirely be unintentional)

@zNightlord
Copy link
Contributor

The exception is raised because MCprep checks textures based on block name, which in turn is derived from material name (there's also a JSON file for material names to blocks):

https://github.com/Moo-Ack-Productions/MCprep/blob/master/MCprep_addon/materials/generate.py#L116-L123

As far as I can tell, JSON models should define textures anyway, so no need to mess with all global textures (which is overwritten during updates). Modded blocks however will always be a weird area because there's simply too many mods, so I think it's best if we don't support modded blocks explicitly (any support MCprep appears to have will entirely be unintentional)

Yes, I'm aware of that and mentioned 2 things share the same code, one for block in vanilla and this, the thing is json importer shouldn't depend on the main global resource pack.

The behavior before for json importer should be is can't find valid texture for json, leave it empty. So if the user know what that texture is manually reassign it.

if os.path.isfile(path):

I wouldn't label it as modded block rather geometry that is in a correct json structure to import.
Java modded blocks using the same system as what vanilla resourcepack no mod, if you look inside the mod resources it contains that similiar resourcepack assets path so.

@StandingPadAnimations
Copy link
Collaborator

Ahh, mcmodel uses its own function for materials. In that case, I would have a popup with the following:

The JSON file you are importing is referring to a texture that is not in 
vanilla Minecraft, would you like to import the model without textures 
and handle it yourself?

[YES] [NO]

And let the user edit the material to have a texture. Sure, it means they'll have to be somewhat comfortable with nodes, but that's expected from Blender users anyway. It also means a user could use texture painting, if they so wished.

@zNightlord
Copy link
Contributor

This should import without raising error now so. Close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants