ReshotAI / gaussian-splatting-blender-addon

https://www.lingosub.com
333 stars 35 forks source link

Unable to export #9

Closed remino closed 8 months ago

remino commented 8 months ago

Using Blender 3.4 on macOS. I installed and enabled the plugin.

I can import a splat .ply file just fine and see it in the scene. But exporting it, even if I’ve made no changes, outputs this error instead:

Python: Traceback (most recent call last):
  File “[redacted]/gaussian-splatting-blender-addon-master/__init__.py", line 1075, in execute
    xyz[i] = position_attr.data[i].vector.to_tuple()
AttributeError: 'NoneType' object has no attribute ‘data'

I tried ignoring the NoneType objects:

         for i, _ in enumerate(mesh.vertices):
+            if position_attr is None:
+                continue
             xyz[i] = position_attr.data[i].vector.to_tuple()

That kinda goes around the problem, but that just outputs a big empty files with mostly empty bytes (0x00).

Any idea? How do you export splats?

remino commented 8 months ago

This fork seems to be taking care of that problem.

Although sometimes I still have some issues with opacity:

Python: Traceback (most recent call last):
  File “[redacted]/gaussian-splatting-blender-addon-master/__init__.py", line 1076, in execute
    opacities[i] = log_opacity_attr.data[i].value
IndexError: bpy_prop_collection[index]: index 0 out of range, size 0

This happens after I select any splat and delete it (“Delete Vertices”) in Edit mode.

remino commented 8 months ago

Okay, figured that out. I know some Python, still a rookie in Blender. So I dug in Scripting:

>>> # Selected object than ran this:
>>> len(bpy.context.view_layer.objects.active.data.vertices)
776787

>>> # Went into edit mode, deleted a few vertices, but then no change?
>>> len(bpy.context.view_layer.objects.active.data.vertices)
776787

>>> # Deselected the object, reselected it, then the change showed:
>>> len(bpy.context.view_layer.objects.active.data.vertices)
776629

So all I had to do was to delete the points, but then deselect the object then reselect it. Then I was able to export the object.

Think I’ll just close this issue now. Thanks!