niftools / blender_niftools_addon

The Blender Niftools Addon is a Blender add-on to enable import and export of NetImmese File Formats including .nif, .kf, .egm.
http://www.niftools.org
Other
379 stars 103 forks source link

NiDitherProperty : accept property to allow import of additional DAOC nifs #604

Closed DigitalBox98 closed 10 months ago

DigitalBox98 commented 10 months ago

NiDitherProperty : accept property to allow import of additional DAOC nifs

@niftools/blender-niftools-addon-reviewer

Overview

Accept NiDitherProperty

Testing

Import of Afanc.nif from DAOC is now working

Candoran2 commented 10 months ago

Could you attach the nif in question?

Candoran2 commented 10 months ago

Also, I've redirected the pull request - PRs should go into develop. The combined changes (often of multiple PRs) then get pulled into master when it's release-ready.

DigitalBox98 commented 10 months ago

The file is attached for testing purpose

Afanc.nif.zip

Candoran2 commented 10 months ago

Do you think there's anyway to properly represent the function of the NiDitherProperty in Blender? In the xml its function is described as "NiDitherProperty allows the application to turn the dithering of interpolated colors and fog values on and off."

If not, it might be good to put as a comment in the process_nidither_property function to explain why it's basically empty.

That being said, an unknown property block should not prevent import of the nif - there should be a warning, but not an error. The attached nif imports for me even without the modification: image

DigitalBox98 commented 10 months ago

This is strange. With Blender 3.4.1 and add-on 0.14, I'm having the error below.

Are you really using the plugin without the fix ?

mob


The armature/bones are having issues and the below error log : Python: Traceback (most recent call last): File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/operators/nif_import_op.py", line 127, in execute return NifImport(self, context).execute() File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/nif_import.py", line 132, in execute self.import_root(root) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/nif_import.py", line 160, in import_root b_obj = self.import_branch(root_block) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/nif_import.py", line 236, in import_branch b_child = self.import_branch(n_child, b_armature=b_armature) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/nif_import.py", line 236, in import_branch b_child = self.import_branch(n_child, b_armature=b_armature) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/nif_import.py", line 201, in import_branch return self.objecthelper.import_geometry_object(b_armature, n_block) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/modules/nif_import/object/init.py", line 132, in import_geometry_object self.mesh.import_mesh(n_block, b_obj) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/modules/nif_import/geometry/mesh/init.py", line 94, in import_mesh self.mesh_prop_processor.process_property_list(n_block, b_obj) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/modules/nif_import/property/geometry/mesh.py", line 113, in process_property_list self.process_property(prop) File "/Applications/BlenderFondation/Blender.app/Contents/Resources/3.4/python/lib/python3.10/functools.py", line 889, in wrapper return dispatch(args[0].class)(*args, **kw) File "/Users/mick/Library/Application Support/Blender/3.4/scripts/addons/io_scene_niftools/modules/nif_import/property/geometry/mesh.py", line 119, in process_property NifLog.warn(f"Unknown property block found : {prop.name:s}") TypeError: unsupported format string passed to bytes.format

Candoran2 commented 10 months ago

Are you really using the plugin without the fix ?

Yes. However, I am using addon version 0.1.0, which has an updated library. Part of that means that prop.name is a string instead of bytes, and therefore it doesn't error in the line posted in your log (as you can see, it's supposed NifLog.warn rather than causing an error).

If you want to use that, you'll also need to know how to create the generated module. It's explained here: https://github.com/niftools/blender_niftools_addon/issues/566#issuecomment-1566743313

DigitalBox98 commented 10 months ago

Is this latest version supposed to be updatable from 0.0.14 ? When trying to update to 0.1.0 directly in Blender I have the below error :

error
Candoran2 commented 10 months ago

Is this latest version supposed to be updatable from 0.0.14 ?

Hm. It is supposed to be, but to be honest I haven't ever really worked on that system, nor have I tested it.

The alternative, as always, is to uninstall and remove the old version, then restart Blender and install the new version.

DigitalBox98 commented 10 months ago

I have uninstalled the previous version and installed the 0.1.0 version but I have the below error :

error

To make it working : I have downloaded the zip, extract it and then zip it again. It's now working.

There's something in the zip from the release preventing to install the add-on. I have attached the file which is working fine for me to analyze the differences : io_scene_niftools.zip

DigitalBox98 commented 10 months ago

And to go back to original topic : yes now the NIF is correctly imported with just warnings. So I will close my PR proposal

Candoran2 commented 10 months ago

There's something in the zip from the release preventing to install the add-on.

I think that's probably #584 - the release version was created by me, and apparently that was done in such a way that it used backwards slashes instead of forwards slashes in the file paths. That was apparently not compatible with Linux, and I guess MacOS. The .bat file has since been changed (https://github.com/Candoran2/blender_nif_plugin/commit/9de0ff9cc2ef622bc6deb5f57e182c02405cab39) such that it will now create a zip file with forwards slashes.

I don't think the PR needs to necessarily be closed. Like you said, it gives a warning for an unknown property. If we know what a NiDitherProperty does, then the addon does not need to give that warning (even if the property does nothing). But it's up to you.

DigitalBox98 commented 10 months ago

Yes I confirm the zip for the 0.1.0 release is working fine on Windows but not on MacOS (and I guess also not on Linux).

For the import of the testing NIF with this 0.1.0 version, I have a warning message, so I guess everything is OK ?

image

For the usage of NiDitherProperty, I didn't see any difference in game when removing this property on the afanc.nif, so ignoring this property for the moment with a warning is the best solution I think :)