Code Monkey home page Code Monkey logo

pyffi's Introduction

niftools.github.io

Installing Locally

Prerequisites

You need to install Ruby. After you install Ruby you can simply install Bundler: gem install bundler

Then to get the necessary gems for the site you run bundle install from the project root.

You will most likely get an SSL error while trying to build so you need to grab http://curl.haxx.se/ca/cacert.pem then install it anywhere (e.g. Ruby folder) and add it to your PATH.

OPTIONAL If you want to edit or create posts more easily (instead of by hand), you can uncomment - jekyll-admin in _config.yml to use the admin interface at localhost:4000/admin. This change does not need to be committed as jekyll-admin is local only. I would recommend leaving it otherwise commented as it appears to disable file watching while editing the site design.

OPTIONAL If you are ever designing new pages and need to change \bower_components in order to add package dependencies you will need to install Node.js/npm. You must then install Bower with npm install -g bower. From there you can add Bower packages to the project root's bower.json and then run bower install or you can run bower install <package>.

Building and Running

To build the site locally you run jekyll build. To serve the site locally you can run jekyll serve. This will serve from localhost:4000 and will watch for any changed files so that changes will show up as you make them.

To view what the site would look like with the posts in _drafts published you can run jekyll serve --drafts.

Front-Matter

Jekyll will parse any file with front matter at the very beginning of the file. Empty front matter looks like so:

   ---
   ---

You can also include the following variables:

Variable Description Format
layout: Which template to choose in _layouts. default, page, post
title: Text which shows in the webpage title and also the jumbotron <string>
date: Used to sort a post in chronological order. Also used in feed.xml. YYYY-MM-DD HH:MM:SS +/-TTTT
category: What category your post belongs in. <string>
categories: What categories your post belongs in. [<string>, ...]
tags: A list of tags relevant to the post. [<string>, ...]
excerpt: Text which shows in the page meta description. If used in a post it will act as the synopsis on the front page. <string>
subtitle: Text which shows under the title in the jumbotron. <string>
menu: Which navbar item is to have the class selected <string>
toc: Whether this page should have an auto-generated table of contents. true | false
geopattern: A custom string input for the jumbotron SVG background. Otherwise it uses title: <string>
navbar: Used to override the navbar style for this page. navbar-inverse navbar-inversed
css: Custom CSS to include on this page. Must install to /assets/css/ but only list the filename. [<string>, ...]
js: Custom JS to include on this page. Must install to /assets/js/ but only list the filename. [<string>, ...]

A common example of front matter for a post would be

---
layout: post
title:  "Example Post"
date:   2017-05-10 13:25:35 +0200
categories: nifskope releases
---

Publishing

To avoid publishing manually, you may use jekyll-admin if you have uncommented it in _config.yml and restarted jekyll. The admin interface will be available at localhost:4000/admin. You can include custom front matter variables in the field below the post text.

Posts

Placing any Markdown or HTML file in _posts with valid front matter will publish the file to the site. Where it goes will depend on the front matter such as the layout and what categories are listed. A post layout with categories: nifskope releases will get published to /nifskope/releases/.

Relevant Documentation

Categories

Most posts should likely consist of two categories: the project or main product name and a subcategory such as releases e.g. categories: nifskope releases or categories: blender releases. If posting about general developmental news or about multiple projects, use something like category: updates.

Pages

A page layout titled mypage.md will get published to /mypage if it is in the project root.

Relevant Documentation

pyffi's People

Contributors

alphax avatar amorilia avatar carver13 avatar dexesttp avatar ghostwalker71 avatar hendrix-zt2 avatar mikeshutlar avatar neomonkeus avatar nickdickinsonwilde avatar pradishb avatar psi29a avatar qbx2 avatar tagnumelite avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyffi's Issues

Python 3.7 Support

@niftools/pyffi-reviewers

Issue Overview

Iterators choke on next() methods because StopIteration is no longer silent.
https://www.python.org/dev/peps/pep-0479/

Possible solution:
a) wrap next() calls into try/except clauses
b) rewrite iterators to use for loops to avoid next()

Travis passes because option b) was applied to the one instance of this issue that was covered by tests, but there are more. Check all next() calls!

Version Information

Pyffi Version Info

current develop

Platform information

[Provide a brief overview of what OS your running on]

Context

[Provide more detailed information to the issue itself]

Steps to Reproduce

[Ordered list of the steps required for recreating the issue, including settings]
#.

Expected Result

[Describe what you expected to have resulted from this process]

Actual Result

[Describe what you currently experience from this process, and thereby explain the bug]

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

[Set the logging level to 'Debug' and attach the output of the console. ]

Similar Known Issues

[Reference any known issues - https://github.com/niftools/pyffi/issues]

Additional Information

[Anything else you feel is relevant]

Export Embedded Texture fails : save_as_dds : NiPixelData

Embedded textures are stored in the pixeldata attribute of the abstract type ATextureRenderData . There are two concrete implementations NiPersistentSrcTextureRendererData. and NiPixelData

The ATextureRenderData attribute pixelformat determines the type of .dds.

For NifFormat.PixelFormat.PX_FMT_DXT5_ALT, the code only supports the subclass - NiPersistentSrcTextureRendererData.

Fiesta online stores the texture data as an NiPixelData for PX_FMT_DXT5_ALT type. The code fails when it attempts to call an NiPersistentSrcTextureRendererData specific attribute pixel_data_matrix

Remove Sourceforge support references

When executing spell which fail, the user is presented with output to the now defunct sf.net project.
The codebase should be updated to point to its current home.

Optimiser : Chair meshes get skipped

I recently did a complete mesh optimization (vanilla + SI), and found out that all chair meshes were skipped.
My conclusion:
Any file that contains "hair" in the filename will get skipped. That's why the script skips all "chair" meshes. Simple temporary renaming of the mesh does the trick, but one has to be aware of this limit when working with large number of meshes.

.. same goes for "hood", "helmet" and "emperor".
Helmet - skips _gnd meshes and static helmet meshes. Also, there are helmets that are not used with egms, so those should be safe too.
hood - _gnd meshes, and any path containing "hood" (like dark brotherhood)
emperor - Makes script skip whole "clothes\upperclass\emperor" subfolder.
There are probably more problematic filters.

The optimizer aims to be conservative and avoids anything that might cause trouble. You can edit the list of keywords that cause nifs to be skipped: it's in the file
C:\Program Files (x86)\PyFFI\utilities\toaster\oblivion_optimize.ini
Does this help?

Well, I've already did that and it got the job done.
So, is there any detailed listing of which vanilla meshes are not to be optimized?
It's obvious that meshes with egm/tri files must be skipped, but there are helmets that don't use egm/tri files (ones that obscure the face, so no face-fitting is done). Those are safe to optimize, to the best of my knowledge.

The ini file is supposed to be that list :-)
If you disable everything, it will automatically skip all meshes which have a tri or egm file attached to them. The problems occur when you have installed a mod with a nif that refers to an egm file in a bsa file - the script cannot detect this. Hence the failsafe heuristics (which are obviously overly conservative!). If you run the optimizer on a fully extracted folder (all bsa files etc.) then it should be quite safe.
Does that explain?

I think there should be 2 lists.
One that lists all the known (as in vanilla) mehses that have BSA-d EGM/TRI counterparts.. but with full paths, and not keywords, and a second list with all the keywords..
Just a thought.

I see - but IMO two lists would just make things confusing. What I think is needed is a way to specify keywords that also match parts of paths. Turning this into a feature request...

Skyrim Nifs and update_skin_partition spell: missing functionality vs Nifskope spell 'Make All Skin Partitions'

After my BoneWeight Copy tool adds a new NifFormat.BSDismemberSkinInstance block and assigns it as a skininstance, etc I use the following call to build the skin partitions:

niBlock.update_skin_partition(maxbonesperpartition=max_part_bones, maxbonespervertex=max_vert_bones, trianglepartmap=partition_map)

This resulting nif, on export, fails to properly render in the construction kit or in-game. However, running the Nifskope spell ''Make All Skin Partitions' fixes the mesh and allows it to be properly rendered in game.

I have yet to identify all of the changes made by the Nifskope spell, but one set of changes modifies the following properties

_BSDismemberSkinInstance.partitions.pf_editor_visible = 1
_BSDismemberSkinInstance.partitions.reserved_bits_1 = 0
_BSDismemberSkinInstance.partitions.pf_start_net_boneset = 1

Now, nifskope always sets these properties to this value, which might actually be a Nifskope bug.

Nifskope makes some additional modifications to the nif that I have not yet identified that allow newly rigged Skyrim meshes to be usable in game.

Set node name for ControllerLink with StringPalette

@niftools/pyffi-reviewers

Issue Overview

All controller links should set on the parent controller's palette. Don't create a palette for each controller link.

see niftools/blender_niftools_addon#463 for a fix on the blender plugin side

Version Information

Pyffi Version Info

current master / dev

Platform information

[Provide a brief overview of what OS your running on]

Context

[Provide more detailed information to the issue itself]

Steps to Reproduce

[Ordered list of the steps required for recreating the issue, including settings]
#.

Expected Result

ControllerLink.set_node_name()
should set:
self.target_name (for older games that do not use the palette)
self.node_name
self.node_name_offset
and write to a shared palette

Actual Result

the linked pyffi for the plugin does not set self.target_name
a new palette is created for each controlled block

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

[Set the logging level to 'Debug' and attach the output of the console. ]

Similar Known Issues

[Reference any known issues - https://github.com/niftools/pyffi/issues]

Additional Information

[Anything else you feel is relevant]

Not able to import from pyffi.formats.nif import NifFormat in Python 3.8

@niftools/pyffi-reviewers

Issue Overview

[Provide high level overview of the issue and why it is relevant to this repository]

Version Information

Pyffi Version Info

pyffi-2.2.3

Platform information

Ubuntu Linux

Steps to Reproduce

  1. $ pip3 install pyffi
  2. $ python
  3. >>> from pyffi.formats.nif import NifFormat

Expected Result

NifFormat available in current scope

Actual Result

Traceback:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
    from pyffi.formats.nif import NifFormat
  File "/home/tbunyk/.local/lib/python3.8/site-packages/pyffi/formats/nif/__init__.py", line 361, in <module>
    import pyffi.formats.bsa
  File "/home/tbunyk/.local/lib/python3.8/site-packages/pyffi/formats/bsa/__init__.py", line 125, in <module>
    class BsaFormat(pyffi.object_models.xml.FileFormat):
  File "/home/tbunyk/.local/lib/python3.8/site-packages/pyffi/object_models/xml/__init__.py", line 104, in __init__
    start = time.clock()
AttributeError: module 'time' has no attribute 'clock'

Possible Fix

The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead. stackoverflow

Add support for BTD (Bethesda Terrain Data) files

@niftools/pyffi-reviewers

Issue Overview

BTD files store landscape mesh and texture information for Fallout 76 (\Fallout76\Data\Terrain\Appalachia.btd), instead of being stored in BSA or BA2 files

The file format itself may be unknown as of right now, as I've not found references anywhere about its structure. It may be similar to other bethesda archive formats.

I tried to reverse engineer the file and could find this information about the header at least:

Header

char[4] - magic (BTDB)
uint32 - version/content flag (6)
32 bytes - unknown
uint32 - number of materials stored in the file
uint32[number of materials] - an array of uint32s which contain either pointers or sizes, not sure

The rest of the data appears to be compressed in some format, i've not been able to reverse engineer which format from the fallout 76 exe yet.

I believe the file itself contains data relating to these files:

Data\Meshes\Terrain\Scratch%s.TMP.%u.%i,%i.HEM
Data\Meshes\Terrain%s%s.%u.%i.%i.BTR
Data\Textures\Terrain%s%s.%u.%i.%i.DDS
Data\Textures\Terrain%s%s.%u.%i.%i_msn.DDS

unpack requires a buffer of 2 bytes

@niftools/pyffi-reviewers

Issue Overview

It looks like the same problem with #38. The breakage occurs using the same code as here, so it shouldn't be anything I'm doing. I'm using Apel's Morrowind sign texture as a test file.

Version Information

Pyffi Version Info

2.2.3

Platform information

Manjaro Linux, most recent stable, kernel 4.19 stable

Context

import argparse, re, os
from pyffi.formats.nif import NifFormat
for stream, data in NifFormat.walkData('/tmp/Apel Tavern Sign Retexture V1-42576-1-0'):
    try:
        # the replace call makes the doctest also pass on windows
        print("reading %s" % stream.name.replace("\\", "/"))
        data.read(stream)
    except Exception:
        print(
            "Warning: read failed due corrupt file,"
            " corrupt format description, or bug.")

Steps to Reproduce

Run the above pointing to the correct location.
#.

Expected Result

A nonfailing run.

Actual Result

reading /tmp/Apel Tavern Sign Retexture V1-42576-1-0/meshes/x/furn_sign_inn_01.nif
Reading <struct 'NiTriShapeData'> failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/pyffi/formats/nif/__init__.py", line 1383, in read
    block.read(stream, self)
  File "/usr/lib/python3.7/site-packages/pyffi/object_models/xml/struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "/usr/lib/python3.7/site-packages/pyffi/object_models/xml/array.py", line 304, in read
    elem.read(stream, data)
  File "/usr/lib/python3.7/site-packages/pyffi/object_models/xml/struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "/usr/lib/python3.7/site-packages/pyffi/object_models/xml/array.py", line 304, in read
    elem.read(stream, data)
  File "/usr/lib/python3.7/site-packages/pyffi/object_models/common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a buffer of 2 bytes
Warning: read failed due corrupt file, corrupt format description, or bug.

Possible Fix

It looks like a regression because of the way Morrowind textures work versus some of the later games. There was a point at which this worked (roughly a couple of years ago), so maybe dropping into the original code on this error occurring would cause a fix.

Similar Known Issues

#38

modify_texturepath error

@niftools/pyffi-reviewers

Issue Overview

Spell "modify_texturepath" fails with error that requires a bytes-like object not string.

Version Information

Pyffi Version Info

PyFFI 2.2.3

Platform information

W10 x64 Latest revision
Python 3.8.2

Context

Just trying to mass-change a bunch of texture paths.

Steps to Reproduce

*I ran the following line from the cmd:
python.exe scripts\niftoaster.py -a "new\texturepath" modify_texturepath "path\to\nifs"

  • it asked if I wanted to proceed, and then error'd out

Expected Result

new paths

Actual Result

error

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

[Set the logging level to 'Debug' and attach the output of the console. ]

pyffi.toaster:1076:ERROR:FAILED ON C:\Users\MaLonn\Downloads\Autumn_Trees_V1_1\LEAF_FREQUENCY_VARIATIONS\4_ULTRA_HIGH_FREQUENCY\VaPER - FallingLeavesQuakingAspenYoungLight.nif - with the follow exception
pyffi.toaster:1076:ERROR:EXPT MSG : a bytes-like object is required, not 'str'
pyffi.toaster:1076:ERROR:If you were running a spell that came with PyFFI
pyffi.toaster:1076:ERROR:Please report this issue - https://github.com/niftools/pyffi/issues

Similar Known Issues

[Reference any known issues - https://github.com/niftools/pyffi/issues]

Additional Information

[Anything else you feel is relevant]

niftoaster error - type object 'NifFormat' has no attribute 'BSTriShape'

@niftools/pyffi-reviewers

Issue Overview

Update check_centerradius for BS

Version Information

Pyffi Version Info

[version number]
Run the following command if it is installed.
python -c "import pyffi; print(pyffi.version)"

Platform information

I have latest PyFFI clone from git, compiled from source on Windows 10 with 32-bit Python 3.6.

Context

I have a bunch of NIFs that need their Bounding Spheres corrected. I was looking for some software that could do it. SSE NIF Optimizer supposedly has that feature but I tried it and the Bounding Spheres were unchanged. I found PyFFI and niftoaster and niftoaster has the spell check_centerradius which I believe will update the Bounding Sphere if all the vertices aren't inside it.

Steps to Reproduce

Run the check_centerradius on the provided file

Expected Result

The nif to be updated with the new bounding sphere where the vertices are read from the new block structure

Actual Result

[Describe what you currently experience from this process, and thereby explain the bug]

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

https://github.com/niftools/pyffi/files/1857827/bookset08.zip

Console Output

I get the following error:

pyffi.toaster:INFO:toasting with 8 threads in chunks of 256 files pyffi.toaster:45952:INFO:=== C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\meshes\Nix_Manor\run\bookset08.nif === pyffi.toaster:45952:ERROR:FAILED ON C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\meshes\Nix_Manor\run\bookset08.nif - with the follow exception pyffi.toaster:45952:ERROR:EXPT MSG : type object 'NifFormat' has no attribute 'BSTriShape' pyffi.toaster:45952:ERROR:If you were running a spell that came with PyFFI pyffi.toaster:45952:ERROR:Please report this issue - https://github.com/niftools/pyffi/issues

I'm running SSE btw.

Similar Known Issues

requires updating to nif.xml that support BSTriShape
dependency #21

Additional Information

[Anything else you feel is relevant]

Pyffi : Regression HavokMaterial Object type support broken

@niftools/pyffi-reviewer

Issue Overview

Test failures due to changes in implementation of HavokMaterial layer information

Version Information

Pyffi Version Info

2.2.3

Platform information

win32

Context

DocString tests are failing when executed

  • niftoaster.txt
  • bhkpackednitristripsshape.txt
  • opt_collisiongeometry.txt
  • opt_collision_to_box_shape.txt

Steps to Reproduce

#. Update test_doctest.py to include the above doctest paths
#. py.test -v /tests/test_doctests.py

Expected Result

Test should pass without failure

Actual Result

Test is failing as its attempting to assign an object type HavokMaterial as a formatted integer string

expected HavokMaterial but got int

Possible Fix

Update required due to nif.xml changes to HavokMaterial, spells needs to be updated to extract layer information.

Screenshot

N\A

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

File "\pyffi\tests\formats\nif\niftoaster.txt", line 1347, in niftoaster.txt
Failed example:
    niftoaster.NifToaster().cli() # doctest: +ELLIPSIS
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest niftoaster.txt[79]>", line 1, in <module>
        niftoaster.NifToaster().cli() # doctest: +ELLIPSIS
      File "\pyffi\pyffi\spells\__init__.py", line 1265, in cli
        self.toast(self.top)
      File "\pyffi\pyffi\spells\__init__.py", line 1381, in toast
        self._toast(stream)
      File "\pyffi\pyffi\spells\__init__.py", line 1464, in _toast
        spell.recurse()
      File "\pyffi\pyffi\spells\__init__.py", line 291, in recurse
        self.recurse(child)
      File "\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File "\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File "\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File "\pyffi\pyffi\spells\__init__.py", line 300, in recurse
        if self.branchentry(branch):
      File "\pyffi\pyffi\spells\nif\fix.py", line 539, in branchentry
        branch.update_mopp()
      File "\pyffi\pyffi\formats\nif\__init__.py", line 2452, in update_mopp
        self.update_mopp_welding()
      File "\pyffi\pyffi\formats\nif\__init__.py", line 2486, in update_mopp_welding
        material_per_triangle)
      File "\pyffi\pyffi\utils\mopp.py", line 168, in getMopperOriginScaleCodeWelding
        infile.write("%i\n" % matindex)
    TypeError: %i format: a number is required, not HavokMaterial
FAIL: .\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt
Doctest: bhkpackednitristripsshape.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python34\Lib\doctest.py", line 2187, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for bhkpackednitristripsshape.txt
  File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 0

----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 19, in bhkpackednitristripsshape.txt
Failed example:
    shape.add_shape(triangles=triangles1, normals=normals1, vertices=vertices1,
                   layer=1, material=2)
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest bhkpackednitristripsshape.txt[10]>", line 2, in <module>
        layer=1, material=2)
      File ".\pyffi\pyffi\formats\nif\__init__.py", line 2975, in add_shape
        self.sub_shapes[num_shapes].material = material
      File ".\pyffi\pyffi\object_models\xml\struct_.py", line 592, in set_attribute
        value.__class__.__name__))
    TypeError: expected HavokMaterial but got int
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 21, in bhkpackednitristripsshape.txt
Failed example:
    shape.add_shape(triangles=triangles2, normals=normals2, vertices=vertices2,
                   layer=3, material=4)
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest bhkpackednitristripsshape.txt[11]>", line 2, in <module>
        layer=3, material=4)
      File ".\pyffi\pyffi\formats\nif\__init__.py", line 2975, in add_shape
        self.sub_shapes[num_shapes].material = material
      File ".\pyffi\pyffi\object_models\xml\struct_.py", line 592, in set_attribute
        value.__class__.__name__))
    TypeError: expected HavokMaterial but got int
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 29, in bhkpackednitristripsshape.txt
Failed example:
    shape.sub_shapes[0].material
Expected:
    2
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000042CDC18>
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 35, in bhkpackednitristripsshape.txt
Failed example:
    shape.sub_shapes[1].material
Expected:
    4
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000042AEDD8>
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 40, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.sub_shapes[0].layer
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest bhkpackednitristripsshape.txt[20]>", line 1, in <module>
        shape.data.sub_shapes[0].layer
    AttributeError: 'OblivionSubShape' object has no attribute 'layer'
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 42, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.sub_shapes[0].num_vertices
Expected:
    3
Got:
    0
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 44, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.sub_shapes[0].material
Expected:
    2
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000042CDA20>
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 46, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.sub_shapes[1].layer
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest bhkpackednitristripsshape.txt[23]>", line 1, in <module>
        shape.data.sub_shapes[1].layer
    AttributeError: 'OblivionSubShape' object has no attribute 'layer'
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 48, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.sub_shapes[1].num_vertices
Expected:
    4
Got:
    0
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 50, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.sub_shapes[1].material
Expected:
    4
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000042AEA58>
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 52, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.num_triangles
Expected:
    3
Got:
    0
----------------------------------------------------------------------
File ".\pyffi\tests\formats\nif\bhkpackednitristripsshape.txt", line 54, in bhkpackednitristripsshape.txt
Failed example:
    shape.data.num_vertices
Expected:
    7
Got:
    0


----------------------------------------------------------------------
Ran 1 test in 0.012s

File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 35, in opt_collisiongeometry.txt
Failed example:
    spell.recurse() # doctest: +REPORT_NDIFF
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[13]>", line 1, in <module>
        spell.recurse() # doctest: +REPORT_NDIFF
      File ".\pyffi\pyffi\spells\__init__.py", line 291, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 300, in recurse
        if self.branchentry(branch):
      File ".\pyffi\pyffi\spells\nif\optimize.py", line 1067, in branchentry
        self.optimize_mopp(branch)
      File ".\pyffi\pyffi\spells\nif\optimize.py", line 1046, in optimize_mopp
        mopp.update_mopp_welding()
      File ".\pyffi\pyffi\formats\nif\__init__.py", line 2486, in update_mopp_welding
        material_per_triangle)
      File ".\pyffi\pyffi\utils\mopp.py", line 168, in getMopperOriginScaleCodeWelding
        infile.write("%i\n" % matindex)
    TypeError: %i format: a number is required, not HavokMaterial
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 66, in opt_collisiongeometry.txt
Failed example:
    print(str(data.roots[0].collision_object.body.shape.shape.data.triangles[-1])) # doctest: +ELLIPSIS
Expected:
    <class 'pyffi.formats.nif.hkTriangle'> instance at ...
    * triangle :
        <class 'pyffi.formats.nif.Triangle'> instance at ...
        * v_1 : 12
        * v_2 : 16
        * v_3 : 4
    * welding_info : 18924
    * normal : [ -0.904  0.197 -0.380 ]
    <BLANKLINE>
Got:
    <class 'pyffi.formats.nif.hkTriangle'> instance at 0x042DE5C0
    * triangle :
        <class 'pyffi.formats.nif.Triangle'> instance at 0x042DE8D0
        * v_1 : 12
        * v_2 : 16
        * v_3 : 4
    * welding_info : 18866
    * normal : [ -0.904  0.197 -0.380 ]
    <BLANKLINE>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 92, in opt_collisiongeometry.txt
Failed example:
    spell.recurse() # doctest: +REPORT_NDIFF
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[25]>", line 1, in <module>
        spell.recurse() # doctest: +REPORT_NDIFF
      File ".\pyffi\pyffi\spells\__init__.py", line 291, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 300, in recurse
        if self.branchentry(branch):
      File ".\pyffi\pyffi\spells\nif\optimize.py", line 1078, in branchentry
        if branch.layer == NifFormat.OblivionLayer.OL_CLUTTER:
    AttributeError: 'bhkRigidBodyT' object has no attribute 'layer'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 129, in opt_collisiongeometry.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.sub_shapes[0].num_vertices
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[26]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.sub_shapes[0].num_vertices
    AttributeError: 'bhkNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 131, in opt_collisiongeometry.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.data.num_vertices
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[27]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.data.num_vertices
    AttributeError: 'bhkNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 133, in opt_collisiongeometry.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.data.num_triangles
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[28]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.data.num_triangles
    AttributeError: 'bhkNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 156, in opt_collisiongeometry.txt
Failed example:
    spell.recurse() # doctest: +REPORT_NDIFF
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[40]>", line 1, in <module>
        spell.recurse() # doctest: +REPORT_NDIFF
      File ".\pyffi\pyffi\spells\__init__.py", line 291, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 300, in recurse
        if self.branchentry(branch):
      File ".\pyffi\pyffi\spells\nif\optimize.py", line 1099, in branchentry
        for sub_shape in branch.shape.get_sub_shapes()):
      File ".\pyffi\pyffi\spells\nif\optimize.py", line 1099, in <genexpr>
        for sub_shape in branch.shape.get_sub_shapes()):
    AttributeError: 'OblivionSubShape' object has no attribute 'layer'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 192, in opt_collisiongeometry.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.sub_shapes[0].num_vertices
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[41]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.sub_shapes[0].num_vertices
    AttributeError: 'bhkPackedNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 194, in opt_collisiongeometry.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.data.num_vertices
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[42]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.data.num_vertices
    AttributeError: 'bhkPackedNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 196, in opt_collisiongeometry.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.data.num_triangles
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[43]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.data.num_triangles
    AttributeError: 'bhkPackedNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collisiongeometry.txt", line 216, in opt_collisiongeometry.txt
Failed example:
    spell.recurse() # doctest: +REPORT_NDIFF
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collisiongeometry.txt[52]>", line 1, in <module>
        spell.recurse() # doctest: +REPORT_NDIFF
      File ".\pyffi\pyffi\spells\__init__.py", line 291, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 305, in recurse
        self.recurse(child)
      File ".\pyffi\pyffi\spells\__init__.py", line 300, in recurse
        if self.branchentry(branch):
      File ".\pyffi\pyffi\spells\nif\optimize.py", line 1067, in branchentry
        self.optimize_mopp(branch)
      File ".\pyffi\pyffi\spells\nif\optimize.py", line 1046, in optimize_mopp
        mopp.update_mopp_welding()
      File ".\pyffi\pyffi\formats\nif\__init__.py", line 2486, in update_mopp_welding
        material_per_triangle)
      File ".\pyffi\pyffi\utils\mopp.py", line 168, in getMopperOriginScaleCodeWelding
        infile.write("%i\n" % matindex)
    TypeError: %i format: a number is required, not HavokMaterial

======================================================================
FAIL: .\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt
Doctest: opt_collision_to_box_shape.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python34\Lib\doctest.py", line 2187, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for opt_collision_to_box_shape.txt
  File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 0

----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 20, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.sub_shapes[0].material
Expected:
    0
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000052DEE48>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 44, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.material
Expected:
    0
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000052DEE48>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 62, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x000000000557EF98>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 74, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x000000000557EF98>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 76, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x000000000557EF98>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 96, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.sub_shapes[0].material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000042769E8>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 108, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000042769E8>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 110, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000042769E8>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 125, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.sub_shapes[0].num_vertices
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collision_to_box_shape.txt[44]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.sub_shapes[0].num_vertices
    AttributeError: 'bhkPackedNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 127, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.data.num_vertices
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collision_to_box_shape.txt[45]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.data.num_vertices
    AttributeError: 'bhkPackedNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 129, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.sub_shapes[0].material
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest opt_collision_to_box_shape.txt[46]>", line 1, in <module>
        data.roots[0].collision_object.body.shape.shape.sub_shapes[0].material
    AttributeError: 'bhkPackedNiTriStripsShape' object has no attribute 'shape'
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 133, in opt_collision_to_box_shape.txt
Failed example:
    spell.recurse()
Expected:
    pyffi.toaster:INFO:--- opt_collisionbox ---
    pyffi.toaster:INFO:  ~~~ NiNode [TestBhkMoppBvTreeShape] ~~~
    pyffi.toaster:INFO:    ~~~ bhkCollisionObject [] ~~~
    pyffi.toaster:INFO:      ~~~ bhkRigidBodyT [] ~~~
    pyffi.toaster:INFO:        ~~~ bhkMoppBvTreeShape [] ~~~
    pyffi.toaster:INFO:          optimized box collision
    pyffi.toaster:INFO:    ~~~ NiTriShape [Stuff] ~~~
Got:
    pyffi.toaster:INFO:--- opt_collisionbox ---
    pyffi.toaster:INFO:  ~~~ NiNode [TestBhkPackedNiTriStripsShape] ~~~
    pyffi.toaster:INFO:    ~~~ bhkCollisionObject [] ~~~
    pyffi.toaster:INFO:      ~~~ bhkRigidBodyT [] ~~~
    pyffi.toaster:INFO:        optimized box collision
    pyffi.toaster:INFO:    ~~~ NiTriShape [Stuff] ~~~
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 142, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000052B0198>
----------------------------------------------------------------------
File ".\pyffi\tests\spells\nif\opt_collision_to_box_shape.txt", line 144, in opt_collision_to_box_shape.txt
Failed example:
    data.roots[0].collision_object.body.shape.shape.material
Expected:
    9
Got:
    <pyffi.formats.nif.HavokMaterial object at 0x00000000052B0198>

Similar Known Issues

N\A

Additional Information

Enable 'formats/nif/niftoaster.txt', in test_doctests.py to allow running of the niftoaster docstring tests.

How to generate BSTriShape node with pyffi 2.2.4dev4?

Hi, I am trying to write me a converter script which takes an fbx file as an input and outputs a nif file for Skyrim SE.
I am using pyffi 2.2.4.dev4 with Python 3.9 and while generating a NiTriShape Block is not a problem i can't figure out how to generate a BSTriShapeBlock.
How is this done in pyffi?

Endian type check

Adding endian type check to num uv sets as seen in nif xml pull req - Particle system + 20.3.0.9 support - commit - Extended support for 20.3.0.9 causes pyffi to return a missing attribute error during import within blender.

Cannot import Tri module due to deprecated function call

@niftools/pyffi-reviewers

Issue Overview

I work for a lab that needs to be able to automate how they process .tri files. This is the only python library that can handle specific formats. I cannot import the Tri sub module because there is a reference to time.clock(). The clock function has been deprecated.

Version Information

Pyffi Version Info

2.2.3
Run the following command if it is installed.
python -c "import pyffi; print(pyffi.version)"

Platform information

macOS Ventura

Context

I cannot import the Tri sub module because there is a reference to time.clock(). The clock function has been deprecated.

Steps to Reproduce

Attempt to import pyffi.formats.tri

Expected Result

AttributeError: module 'time' has no attribute 'clock'

Actual Result

AttributeError: module 'time' has no attribute 'clock'

Possible Fix

Update reference to newer function

Screenshot

N/A

Logs and Files

N/A

Console Output

N/A

Similar Known Issues

N/A

Additional Information

N/A

Pyffi parse error NiTriShapeData

@niftools/pyffi-reviewer

Issue Overview

Failure to parse NiTriShapeData in test_opt_dupgeomdata.nif

Version Information

Pyffi Version Info

2.2.3

Platform information

win32

Context

Execution of the

Steps to Reproduce

#. Update test_doctest.py to include niftoaster.txt
#. py.test -v /tests/test_doctests.py

Expected Result

Pyffi should be able to read the file without parsing error and pass the test

Actual Result

Pyffi is unable to read the file and throws an error

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

N\A

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

'''
File "\pyffi\tests\formats\nif\niftoaster.txt", line 233, in niftoaster.txt
Failed example:
niftoaster.NifToaster().cli() # doctest: +REPORT_UDIFF
Differences (unified diff with -expected +actual):
@@ -117,7 +117,21 @@
pyffi.toaster:INFO: comparing file sizes
pyffi.toaster:INFO:=== tests/formats/nif/test_opt_dupgeomdata.nif ===
-pyffi.toaster:INFO: --- check_readwrite ---
-pyffi.toaster:INFO: writing to temporary file
-pyffi.toaster:INFO: comparing file sizes
+pyffi.nif.data:ERROR:Reading <class 'pyffi.formats.nif.NiTriShapeData'> failed
+Traceback (most recent call last):
+ File "\pyffi\pyffi\formats\nif_init_.py", line 1383, in read
+ block.read(stream, self)
+ File "\pyffi\pyffi\object_models\xml\struct_.py", line 354, in read
+ attr_value.read(stream, data)
+ File "\pyffi\pyffi\object_models\xml\array.py", line 300, in read
+ elem.read(stream, data)
+ File "\pyffi\pyffi\object_models\xml\struct_.py", line 354, in read
+ attr_value.read(stream, data)
+ File "\pyffi\pyffi\object_models\common.py", line 167, in read
+ stream.read(self._size))[0]
+struct.error: unpack requires a bytes object of length 2
+pyffi.toaster:ERROR:TEST FAILED ON tests/formats/nif/test_opt_dupgeomdata.nif
+pyffi.toaster:ERROR:If you were running a spell that came with PyFFI, then
+pyffi.toaster:ERROR:please report this as a bug (include the file) on
+pyffi.toaster:ERROR:https://github.com/niftools/pyffi/issues
'''

Similar Known Issues

N\A

Additional Information

This could be a nif.xml issue

Pyffi : Regression Kfm reader broken

@niftools/pyffi-reviewers

Issue Overview

The kfm toaster is unable to read kfm files

Version Information

Pyffi Version Info

2.2.3

Platform information

win32

Context

DocString tests are failing when executed related to kfm support

  • kfmtoaster.txt

Steps to Reproduce

#. Update test_doctest.py to include the above doctest paths
#. py.test -v /tests/test_doctests.py

Expected Result

Test should pass without failure

Actual Result

Tests should be able to read the file, but it appears that some functionality is not implemented.
It could also be that there is some inheritance issue.

Possible Fix

It might not be using the concrete implementation, but the base Toaster Object.

Screenshot

N\A

Logs and Files

N\A

Console Output

File ".\pyffi\tests\formats\kfm\kfmtoaster.txt", line 35, in kfmtoaster.txt
Failed example:
    kfmtoaster.KfmToaster().cli() # doctest: +ELLIPSIS
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest kfmtoaster.txt[17]>", line 1, in <module>
        kfmtoaster.KfmToaster().cli() # doctest: +ELLIPSIS
      File ".\pyffi\pyffi\spells\__init__.py", line 1265, in cli
        self.toast(self.top)
      File ".\pyffi\pyffi\spells\__init__.py", line 1381, in toast
        self._toast(stream)
      File ".\pyffi\pyffi\spells\__init__.py", line 1453, in _toast
        data.inspect(stream)
      File ".\pyffi\pyffi\object_models\__init__.py", line 195, in inspect
        raise NotImplementedError
    NotImplementedError
----------------------------------------------------------------------
File ".\pyffi\tests\formats\kfm\kfmtoaster.txt", line 42, in kfmtoaster.txt
Failed example:
    kfmtoaster.KfmToaster().cli() # doctest: +ELLIPSIS
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest kfmtoaster.txt[19]>", line 1, in <module>
        kfmtoaster.KfmToaster().cli() # doctest: +ELLIPSIS
      File ".\pyffi\pyffi\spells\__init__.py", line 1265, in cli
        self.toast(self.top)
      File ".\pyffi\pyffi\spells\__init__.py", line 1381, in toast
        self._toast(stream)
      File ".\pyffi\pyffi\spells\__init__.py", line 1453, in _toast
        data.inspect(stream)
      File ".\pyffi\pyffi\object_models\__init__.py", line 195, in inspect
        raise NotImplementedError
    NotImplementedError
----------------------------------------------------------------------
File ".\pyffi\tests\formats\kfm\kfmtoaster.txt", line 52, in kfmtoaster.txt
Failed example:
    kfmtoaster.KfmToaster().cli() # doctest: +ELLIPSIS +REPORT_UDIFF
Exception raised:
    Traceback (most recent call last):
      File "C:\Python34\Lib\doctest.py", line 1318, in __run
        compileflags, 1), test.globs)
      File "<doctest kfmtoaster.txt[21]>", line 1, in <module>
        kfmtoaster.KfmToaster().cli() # doctest: +ELLIPSIS +REPORT_UDIFF
      File ".\pyffi\pyffi\spells\__init__.py", line 1265, in cli
        self.toast(self.top)
      File ".\pyffi\pyffi\spells\__init__.py", line 1381, in toast
        self._toast(stream)
      File ".\pyffi\pyffi\spells\__init__.py", line 1453, in _toast
        data.inspect(stream)
      File ".\pyffi\pyffi\object_models\__init__.py", line 195, in inspect
        raise NotImplementedError
    NotImplementedError

Similar Known Issues

N\A

Additional Information

N\A

Error parsing NIF files from Spellbinder Demo

@niftools/pyffi-reviewers

Issue Overview

Opening any .NIF file in blender from https://archive.org/details/SpellbinderTheNexusConflictDemo fails.

Version Information

Pyffi Version Info

2.2.4.dev3

Platform information

Linux 5.10.9-arch1-1 #1 SMP PREEMPT Tue, 19 Jan 2021 22:06:06 +0000 x86_64 GNU/Linux

Steps to Reproduce

  1. Download the exe
  2. Install it
  3. Try to import Fem1.NIF (or any other file) into blender using the 0.0.3 NIF addon.

Logs and Files

niftools:INFO:Importing /home/.wine/drive_c/mythic/spellbinder/figures/Fem1.NIF
niftools:INFO:NIF file version: 2030000
niftools:INFO:Reading file
pyffi.nif.data:DEBUG:Reading header at 0x00000000
pyffi.nif.data:DEBUG:Version 0x02030000
pyffi.nif.data.struct:DEBUG:Array:copyright
pyffi.nif.data.array:DEBUG:Reading array of size 3
pyffi.nif.data:DEBUG:Reading NiMaterialProperty block at 0x0000009A
pyffi.nif.data.struct:DEBUG:* NiMaterialProperty.name = b'' : type <class 'pyffi.formats.nif.NifFormat.string'> at 0x0000009A offset 154 -
pyffi.nif.data.struct:DEBUG:* NiMaterialProperty.has_old_extra_data = False : type <class 'pyffi.formats.nif.NifFormat.bool'> at 0x0000009E offset 158 -
pyffi.nif.data.struct:DEBUG:* NiMaterialProperty.unknown_byte = 0 : type <class 'pyffi.object_models.common.UByte'> at 0x000000A2 offset 162 -
pyffi.nif.data.struct:DEBUG:Color3:ambient_color
pyffi.nif.data.struct:DEBUG:* Color3.r = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000A3 offset 163 -
pyffi.nif.data.struct:DEBUG:* Color3.g = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000A7 offset 167 -
pyffi.nif.data.struct:DEBUG:* Color3.b = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000AB offset 171 -
pyffi.nif.data.struct:DEBUG:Color3:diffuse_color
pyffi.nif.data.struct:DEBUG:* Color3.r = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000AF offset 175 -
pyffi.nif.data.struct:DEBUG:* Color3.g = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000B3 offset 179 -
pyffi.nif.data.struct:DEBUG:* Color3.b = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000B7 offset 183 -
pyffi.nif.data.struct:DEBUG:Color3:specular_color
pyffi.nif.data.struct:DEBUG:* Color3.r = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000BB offset 187 -
pyffi.nif.data.struct:DEBUG:* Color3.g = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000BF offset 191 -
pyffi.nif.data.struct:DEBUG:* Color3.b = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000C3 offset 195 -
pyffi.nif.data.struct:DEBUG:Color3:emissive_color
pyffi.nif.data.struct:DEBUG:* Color3.r = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000C7 offset 199 -
pyffi.nif.data.struct:DEBUG:* Color3.g = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000CB offset 203 -
pyffi.nif.data.struct:DEBUG:* Color3.b = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000CF offset 207 -
pyffi.nif.data.struct:DEBUG:* NiMaterialProperty.glossiness = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000D3 offset 211 -
pyffi.nif.data.struct:DEBUG:* NiMaterialProperty.alpha = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000D7 offset 215 -
pyffi.nif.data:DEBUG:Reading NiClod block at 0x000000E9
pyffi.nif.data.struct:DEBUG:* NiClod.name = b'' : type <class 'pyffi.formats.nif.NifFormat.string'> at 0x000000E9 offset 233 -
pyffi.nif.data.struct:DEBUG:* NiClod.has_old_extra_data = False : type <class 'pyffi.formats.nif.NifFormat.bool'> at 0x000000FA offset 250 -
pyffi.nif.data.struct:DEBUG:* NiClod.unknown_byte = 0 : type <class 'pyffi.object_models.common.UByte'> at 0x000000FE offset 254 -
pyffi.nif.data.struct:DEBUG:Vector3:translation
pyffi.nif.data.struct:DEBUG:* Vector3.x = 0 : type <class 'pyffi.object_models.common.Float'> at 0x000000FF offset 255 -
pyffi.nif.data.struct:DEBUG:* Vector3.y = 0 : type <class 'pyffi.object_models.common.Float'> at 0x00000103 offset 259 -
pyffi.nif.data.struct:DEBUG:* Vector3.z = 0 : type <class 'pyffi.object_models.common.Float'> at 0x00000107 offset 263 -
pyffi.nif.data.struct:DEBUG:Matrix33:rotation
pyffi.nif.data.struct:DEBUG:* Matrix33.m_11 = 1.0 : type <class 'pyffi.object_models.common.Float'> at 0x0000010B offset 267 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_21 = 0.0 : type <class 'pyffi.object_models.common.Float'> at 0x0000010F offset 271 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_31 = 0.0 : type <class 'pyffi.object_models.common.Float'> at 0x00000113 offset 275 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_12 = 0.0 : type <class 'pyffi.object_models.common.Float'> at 0x00000117 offset 279 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_22 = 1.0 : type <class 'pyffi.object_models.common.Float'> at 0x0000011B offset 283 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_32 = 0.0 : type <class 'pyffi.object_models.common.Float'> at 0x0000011F offset 287 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_13 = 0.0 : type <class 'pyffi.object_models.common.Float'> at 0x00000123 offset 291 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_23 = 0.0 : type <class 'pyffi.object_models.common.Float'> at 0x00000127 offset 295 -
pyffi.nif.data.struct:DEBUG:* Matrix33.m_33 = 1.0 : type <class 'pyffi.object_models.common.Float'> at 0x0000012B offset 299 -
pyffi.nif.data.struct:DEBUG:* NiClod.scale = 1.0 : type <class 'pyffi.object_models.common.Float'> at 0x0000012F offset 303 -
pyffi.nif.data.struct:DEBUG:Vector3:velocity
pyffi.nif.data.struct:DEBUG:* Vector3.x = 0 : type <class 'pyffi.object_models.common.Float'> at 0x00000133 offset 307 -
pyffi.nif.data.struct:DEBUG:* Vector3.y = 0 : type <class 'pyffi.object_models.common.Float'> at 0x00000137 offset 311 -
pyffi.nif.data.struct:DEBUG:* Vector3.z = 0 : type <class 'pyffi.object_models.common.Float'> at 0x0000013B offset 315 -
pyffi.nif.data.struct:DEBUG:* NiClod.num_properties = 0 : type <class 'pyffi.object_models.common.UInt'> at 0x0000013F offset 319 -
pyffi.nif.data.struct:DEBUG:Array:properties
pyffi.nif.data.array:DEBUG:Reading array of size 1
pyffi.nif.data.struct:DEBUG:Array:unknown_1
pyffi.nif.data.array:DEBUG:Reading array of size 4
pyffi.nif.data.struct:DEBUG:* NiClod.unknown_2 = 0 : type <class 'pyffi.object_models.common.UByte'> at 0x00000157 offset 343 -
pyffi.nif.data.struct:DEBUG:* NiClod.data = None : type <class 'pyffi.formats.nif.NifFormat.Ref'> at 0x00000158 offset 344 -
Python: Traceback (most recent call last):
File "/home/.config/blender/2.91/scripts/addons/io_scene_niftools/operators/nif_import_op.py", line 121, in execute
    return NifImport(self, context).execute()
File "/home/.config/blender/2.91/scripts/addons/io_scene_niftools/nif_import.py", line 74, in execute
    self.load_files()  # needs to be first to provide version info.
File "/home/.config/blender/2.91/scripts/addons/io_scene_niftools/nif_import.py", line 144, in load_files
    NifData.init(NifFile.load_nif(NifOp.props.filepath))
File "/home/.config/blender/2.91/scripts/addons/io_scene_niftools/file_io/nif.py", line 64, in load_nif
    data.read(nif_stream)
File "/home/.config/blender/2.91/scripts/addons/io_scene_niftools/dependencies/pyffi/formats/nif/__init__.py", line 1318, in read
    top_level_str.read(stream, data=self)
File "/home/.config/blender/2.91/scripts/addons/io_scene_niftools/dependencies/pyffi/object_models/common.py", line 667, in read
    raise ValueError('string too long (0x%08X at 0x%08X)'
ValueError: string too long (0xB6C4523E at 0x00000160)
location: <unknown location>:-1

BSEffectShader texture_clamp_mode incorrectly mapped

@niftools/pyffi-reviewers

Issue Overview

[Provide high level overview of the issue and why it is relevant to this repository]

Version Information

Pyffi Version Info

[version number]
Run the following command if it is installed.
python -c "import pyffi; print(pyffi.version)"

Platform information

[Provide a brief overview of what OS your running on]

Context

[Provide more detailed information to the issue itself]
The texture_clamp_mode on a imported/exported BSEffectShader is not just the "Texture Clamp Mode" block detail in NifSkope, but also the "Lighting Influence", "Env Map Min LOD" and "Unknown Byte", where each consecutive field 256 higher. Presumably this is an issue with pyffi, but it can be worked around for now.

Steps to Reproduce

[Ordered list of the steps required for recreating the issue, including settings]
#.

Expected Result

[Describe what you expected to have resulted from this process]

Actual Result

[Describe what you currently experience from this process, and thereby explain the bug]

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

[Set the logging level to 'Debug' and attach the output of the console. ]

Similar Known Issues

[Reference any known issues - https://github.com/niftools/pyffi/issues]

Additional Information

[Anything else you feel is relevant]

Unable to walk NIF, string too long

@niftools/pyffi-reviewer

Issue Overview

 Error with ../../../Private/UIX/UIX FILES/Data Files/Meshes/TOE/RedMoonGa01.NIF: ('string too long (0xB43A827B at 0x0000BFE8)',)
 Error with ../../../Private/UIX/UIX FILES/Data Files/Meshes/TOEspy/BlueMoonGa01.NIF: ('string too long (0xB43A827B at 0x0000BFE9)',)
 Error with ../../../Private/UIX/UIX FILES/Data Files/Meshes/TOEspy/Card_Explosion.NIF: ('string too long (0xBF800000 at 0x0000B3DD)',)
 Error with ../../../Private/UIX/UIX FILES/Data Files/Meshes/TOEspy/XCard_Explosion.nif: ('string too long (0xBF800000 at 0x0000B2EE)',)

There are at least 4 files that can't be walked due to a string being too long. I'm not sure if this is a problem the NIF or with pyffi. The only thing in common is that they were created by the Bethesda plugin in 3DSMax.

Version Information

Pyffi Version Info

2.2.2

Platform information

Ubuntu (16.10) Linux

Context

I was running nifwalk over all NIFs I planned on releasing to make sure I had all the resources.

Steps to Reproduce

from pyffi.formats.nif import NifFormat
NifFormat.walkData(nif_path)

raise ValueError

Expected Result

an NIF object that I can iterate over

Actual Result

Error message.

Release 2.2.3 (and older than 2.2.2) not on pypi

I know that when we make releases on github (tag), it will not retrieve files from submodules. That makes installation with pip3 impossible as it doesn't include the nif.xml submodule.

Can someone upload 2.2.3 to PyPi? Also, can someone also upload older packages?

If we need help here, I can help as I also manage PyPi packages:
https://pypi.org/user/psi29a/

We should offer older packages as well, for example 2.1.x isn't on PyPi which is problematic for those still using Python 2.6 or Python 2.7 (see Blender 2.49b).

Investigate adding .bf to pyffi.

The .bf format is a optimised animation format based on the .kf format.

It contains a number of new block types, no header and data type variations. We need to see if this can be supported via the current nif format as is done with the .kf format or do we need to create a new Format entirely.

struct.error when reading nif.xml

@niftools/blender-nif-plugin-reviewer -

Before creating a new issue, ensure that

  • Read the user documentation.
  • Check that the issue hasn't already been reported.
  • Read through the list of Helpful resources links on the right-hand side.
  • Talk with the developers to ensure its a valid issue

The issue will get closed off immediately as invalid if

  • Looking for support where the forums, chat or documentation is more appropriate.
  • Goes off topic, loses focus or turns into a discussion.
  • Removing parts of the template the issue.

Fill out the template below to the best of your ability, including .blend files, nifs, logs; help us to help you.

Issue Overview

Plugin doesn't work with the portable (zip) version of Blender 2.79b.

Version Information

Blender Nif Plugin Version Info

2.6.0a0.dev4-2019-11-24

Blender Version Info

2.79b portable (zip)

Platform information

Windows 10 Professional 64bit

Context

Unfortunately, Blender 2.79b cannot be installed alongside 2.8x and is automatically uninstalled when installing the new version. Therefore I tried using the portable (zip) version of 2.79b instead, which does not need to be installed and works with 2.8x installed at the same time.

However, the nif plugin no longer works in this version, as I get this error when trying to import a model:

struct.error: unpack requires a bytes object of length 2
ERROR:pyffi.nif.data:Reading <struct 'NiTriShapeData'> failed

The console shows a lot more messages related to the various .py files and in the end it says:

location: <unknown location>:-1

Exporting does not produce an error, but the model is not exported correctly and cannot be opened in Nifskope.

I tried uninstalling 2.8x and installing 2.79b again, but the installer says a newer version is already installed and exits.

Steps to Reproduce

Happens whenever I import or export a model.

Expected Result

See above.

Actual Result

See above

Possible Fix

Screenshot

Logs and Files

Info Bar Output

bpy.data.window_managers["WinMan"].addon_search = "nif"
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.delete(use_global=False)
bpy.context.space_data.recent_folders_active = 0
bpy.context.space_data.recent_folders_active = 1
bpy.context.space_data.recent_folders_active = 1
Executing - Niftools : Blender Nif Plugin v2.6.0 (running on Blender 2.79 (sub 0), PyFFI 2.2.4.dev2)
Importing D:\Spiele\Bethesda Softworks\Morrowind_EV_GOG\Data Files\Meshes\o\contain_barrel10.nif
NIF file version: 67108866
Reading file
Finished
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\operators\nif_import_op.py", line 156, in execute
    return nif_import.NifImport(self, context).execute()
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\nif_import.py", line 110, in execute
    self.data = NifFile.load_nif(NifOp.props.filepath)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\io\nif.py", line 64, in load_nif
    nif_data.read(nif_stream)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2

location: <unknown location>:-1

Console Output

pyffi.nif.data:ERROR:Reading <struct 'NiTriShapeData'> failed
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2
ERROR:pyffi.nif.data:Reading <struct 'NiTriShapeData'> failed
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\operators\nif_import_op.py", line 156, in execute
    return nif_import.NifImport(self, context).execute()
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\nif_import.py", line 110, in execute
    self.data = NifFile.load_nif(NifOp.props.filepath)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\io\nif.py", line 64, in load_nif
    nif_data.read(nif_stream)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2

location: <unknown location>:-1

location: <unknown location>:-1

Blend File

Happens for every model

Nif File

Happens for every model

Similar Known Issues

Additional Information

Add a model exporter for NIF files

@niftools/pyffi-reviewer

Issue Overview

It would be nice if niftoaster could export NIF files to a more standard model format, such as OBJ or FBX.

This would serve both as a good example of using pyffi for NIF processing, as well as testing and using NIF files. (In particular, I am having unrelated issues with some OBJs exported from Blender, and this would help test that.)

Version Information

Pyffi Version Info

Any

Platform information

Any

Context

Steps to Reproduce

Expected Result

Actual Result

Possible Fix

Screenshot

Logs and Files

Console Output

Similar Known Issues

Additional Information

Format support in qskope - .tiff & .dds

(I am assuming this is the only active fork of pyffi as someone else mentioned it)

anyway, adding new formats to qskope is currently not really supported, or I can't figure it out. Even if i manually add a new pyffi format to openFile() in __init__.py, it still doesn't correctly show the 'structure' of the file, as i'm not sure how you define that (like you see if you load a tiff file, or dds file in qskope)

get_translation() and set_translation() of Matrix44 not working correctly

@niftools/pyffi-reviewers

Issue Overview

Because the Matrix44 class is imported/exported transposed to how it is displayed in NifSkope, the get_translation() and set_translation() functions of that class do not work as expected.

Version Information

Pyffi Version Info

2.2.4.dev3, can confirm it is also happening with 2.2.4.dev4

Platform information

Windows 10 64-bit, using pyffi through the Blender Nif plugin.

Context

The transform of a bhkConvexTransformShape is transposed to how it is displayed in NifSkope. This is even right after the pyffi import (i.e. at the end of the load_nif function) or right before pyffi export (i.e. just before the data.write(stream)). This means that the get_translation() and set_translation() functions, which set and get from the bottom row (correct with how it is displayed in NifSkope), do not operate on the translation, but on the useless fourth column once back in NifSkope.

Steps to Reproduce

  • Load a model with a bhkConvexTransformShape that has a non-zero translation using Pyffi
  • (optional) Display the bhkConvexTransformShape's transform
  • Modify the translation using set_translation() and get_translation() (e.g. multiply the translation by 2)
  • (optional) Display the bhkConvexTransformShape's transform
  • Save it back as a nif

Expected Result

The expected result is that get_translation() and set_translation() do the intended modification.

Actual Result

There is no modification on the exported translation, instead the fourth column is affected.

Possible Fix

Either change get_translation() and set_translation() to reflect the fact that the Matrix44 is transposed upon import/export, or do not transpose the Matrix44.

Screenshot

image
image
image
image

Logs and Files

File I tested with:
https://cdn.discordapp.com/attachments/702566403605266435/706515307014914138/irondagger.nif

Console Output

Relevant output found in screenshots above.

Similar Known Issues

None that I could find.

Additional Information

Error reading file 'NoneType' object has no attribute 'replace_global_node'

@niftools/pyffi-reviewers

Issue Overview

So I'm trying to delete some blocks from a file. Deleting NiTextureEffect blocks works fine, but when I try to apply the same technique NiSourceTexture blocks, I get the above error.

Version Information

Pyffi Version Info

Run the following command if it is installed.
python -c "import pyffi; print(pyffi.version)"
2.2.2 (For Morrowind nif compatibility)

Platform information

[Provide a brief overview of what OS your running on]
Manjaro, latest stable

Context

[Provide more detailed information to the issue itself]

reading openmw-mesh-converter/Apel Tavern Sign Retexture V1-42576-1-0/meshes/x/furn_sign_inn_01.nif
removing NiNode node
removing NiNode node
Traceback (most recent call last):
  File "fix_nif_qt.py", line 53, in main
    data.replace_global_node(block, None)
  File "/usr/lib/python3.7/site-packages/pyffi/formats/nif/__init__.py", line 1240, in replace_global_node
    root.replace_global_node(oldbranch, newbranch,
AttributeError: 'NoneType' object has no attribute 'replace_global_node'
None
Error reading file 'NoneType' object has no attribute 'replace_global_node'

Steps to Reproduce

[Ordered list of the steps required for recreating the issue, including settings]

            for block in data.blocks:
                if (is_nitextureeffect_block(block)
                    or is_nisourcetexture_block(block)):
                    print('removing %s node' % type(block).__name__)
                    data.replace_global_node(block, None)
                    file_changed = True

#.

Expected Result

[Describe what you expected to have resulted from this process]
What I would expect is for both kinds of blocks to be deleted.

Actual Result

[Describe what you currently experience from this process, and thereby explain the bug]
The block cannot be deleted and an exception is thrown.

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

[Set the logging level to 'Debug' and attach the output of the console. ]

Similar Known Issues

[Reference any known issues - https://github.com/niftools/pyffi/issues]

Additional Information

[Anything else you feel is relevant]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.