Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
wants to merge 1 commit into from

Conversation

DigitalBox98
Copy link

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

@DigitalBox98 DigitalBox98 changed the title NiDitherProperty : accept property to allow import of additional DAOC gifs NiDitherProperty : accept property to allow import of additional DAOC nifs Aug 31, 2023
@Candoran2
Copy link
Member

Could you attach the nif in question?

@Candoran2 Candoran2 changed the base branch from master to develop August 31, 2023 19:55
@Candoran2
Copy link
Member

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.

@Candoran2 Candoran2 self-requested a review August 31, 2023 19:57
@DigitalBox98
Copy link
Author

The file is attached for testing purpose

Afanc.nif.zip

@Candoran2
Copy link
Member

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
Copy link
Author

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
Copy link
Member

Candoran2 commented Sep 1, 2023

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: #566 (comment)

@DigitalBox98
Copy link
Author

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
Copy link
Member

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
Copy link
Author

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
Copy link
Author

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
Copy link
Member

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 (Candoran2@9de0ff9) 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
Copy link
Author

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 :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants