Moo-Ack-Productions / MCprep

Blender python addon to increase workflow for creating minecraft renders and animations
https://theduckcow.com/MCprep
GNU General Public License v3.0
283 stars 26 forks source link

Code to manually offset bmesh's scaling problem. It's messy in principle but it works perfectly. #452

Closed FigureOfStickman closed 1 year ago

FigureOfStickman commented 1 year ago

bmesh scale fix

Hi! I hope this isn't inappropriate. I've never really used GitHub before.

I added this bit of code in my copy of the addon to rescale spawned blocks so that they aren't 1.008m^3. It's been working great so far, so I thought you guys may want to check it out. It's been bothering my adderall-riddled brain and StandingPadAnimations said it was a known issue.

Here's a screenshot of the code I added to mcmodel.py and what it looks like in Blender. I guess it automatically applies the scale because the operation is being performed on the raw mesh, so that cleans it up a bit for the user.

moddedmcprep Screenshot 2023-07-25 at 11 45 52 AM

Quality checks

Describe any usage details

Not a rig, I hope it's still okay for me to submit this though.

What name should we use to credit you in the README.md file?

FigureOfStickman

What credit url should we use to reference you in the README.md file?

youtube.com/@figureofstickman6718

Confirmation

zNightlord commented 1 year ago

This is more a code thing so better off create a Pull Request. But first I think you could try out poking around mcmodel at line 66 I kinda talked about it in the Discord server. It is the source list of how the model verticies is made. For your way, the block model spawn isn't just for block model, you can import any Minecraft Java json model into and it will be slightly scale if you do that.

StandingPadAnimations commented 1 year ago

Thanks for submitting code! Like zNight said, this falls under Pull Requests (which are designed for code). I'd suggest reading https://github.com/Moo-Ack-Productions/MCprep/blob/dev/CONTRIBUTING.md for some more info.

One thing I'd suggest (just from looking) is checking to see if a particular dimension is close to 1m before resizing. Some blocks like slabs for example are 1m for X and Y, but not Z. Perhaps a simple "threshold" value that goes "if the dimension minus 1 is less then this threshold, then resize it to 1. Beyond that, I'll save further reviewing for a pull request