lasa01 / Plumber

A Blender addon for importing Source 1 engine maps, models, materials and textures. This addon makes it possible to import full CS:GO, TF2, CS:S or other Source 1 game maps into Blender.
MIT License
390 stars 30 forks source link

Expose more data about props, models, and materials #186

Closed hisprofile closed 2 weeks ago

hisprofile commented 1 month ago

These are the changes I have made for the Source Engine Blender Collection. It helped massively with linking existing assets.

Merging these changes will allow people to use my porting scripts with the official tool, instead of my own version of it.

hisprofile commented 1 month ago

right now, the highest blender version it supports is 4.0. 4.1 introduced breakage when it came to using auto smoothed normals, but i don't think it's impossible for me to fix it if it's a matter of adding nodegroups to objects. as for the lowest, i'm not sure. 4.0 was the only version i used in this project for feature purposes. if there are no errors reported, it'd be difficult to know the lowest version, because we could have compared the error to any api changes in any versions

lasa01 commented 1 month ago

Yeah, I actually took a look at the Blender 4.1 support and looks like it is as simple as removing the mesh.shade_smooth() call for versions 4.1 and above. We already set custom normals for the meshes from the mdl, so shade_smooth() was only required to use those. I understood that with 4.1 the custom normals are automatically used, shade_smooth() doesn't need to be called anymore. I will push a fix for this soon.

I could also take a look at the minimum supported blender version, I believe the object["property"] = something is a fairly new syntax for setting the custom properties, so it should be mentioned in release notes somewhere.

hisprofile commented 1 month ago

Do you suppose this could be merged? The porting tools I've written depend on these properties for proper functionality between this addon and SourceIO. I'd prefer users to use an official build instead of my version

lasa01 commented 1 month ago

Yeah sure! Still some small things left to clean up.

There's still some changes to the utils.py file, the rest of them should be removed too (you can see from the files changed tab in this PR). Did you also change unknown_entity.py file, since there aren't any changes for it in the PR yet? Did you see all the comments I added?

I noticed that maybe you are using GitHub from the web to make the changes? That's ok if you don't know how to use git, but makes it easy to miss some changes you have made locally, and probably harder to make edits to the PR :D

I could also do the clean up at some point, but not sure when I have the time (and I can't make changes to the PR directly)

lasa01 commented 1 month ago

Looks like I was actually able to make changes to the PR. The code should be good now, and looks like it should work for Blender 3.0 and above. Still need to test a little bit before merging.

lasa01 commented 2 weeks ago

Tested this and looks good! Doesn't really seem to affect performance either. I will merge this now and create a new release.