alextsui05 / blender-off-addon

Import-export OFF meshes in Blender.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blender 2.80 version

cogitas3d opened this issue · comments

Dear @alextsui05,

First of all thank you very much for this addon, it help a lot of lifes, humans and other animals (http://ciceromoraes.com.br/doc/pt_br/Moraes/ProteseV.html).

I develop some addon that use your tool and we use it to do prosthesis and surgical planning.

Some days ago I started to rewrite OrtogOnBlender (our addon) to 2.80 and I "convert" your addon to 2.80 version.

I'm not a professional programmer, but I wold like to share the result:

http://www.ciceromoraes.com.br/downloads/import_off.py

Thank you again and a big hug!

@cogitas3d @alextsui05
same bug in 2.8 release

Traceback (most recent call last):
  File "/usr/share/blender/scripts/addons/blender-off-addon/__init__.py", line 160, in execute
    return save(self, context, **keywords)
  File "/usr/share/blender/scripts/addons/blender-off-addon/__init__.py", line 271, in save
    mesh = obj.to_mesh(context.depsgraph, APPLY_MODIFIERS)
AttributeError: 'Context' object has no attribute 'depsgraph'

location: <unknown location>:-1

https://developer.blender.org/T64792

Do you know where we need change script?
I will be grateful for the help

@cogitas3d @alextsui05
same bug in 2.8 release

Traceback (most recent call last):
  File "/usr/share/blender/scripts/addons/blender-off-addon/__init__.py", line 160, in execute
    return save(self, context, **keywords)
  File "/usr/share/blender/scripts/addons/blender-off-addon/__init__.py", line 271, in save
    mesh = obj.to_mesh(context.depsgraph, APPLY_MODIFIERS)
AttributeError: 'Context' object has no attribute 'depsgraph'

location: <unknown location>:-1

https://developer.blender.org/T64792

Do you know where we need change script?
I will be grateful for the help

I think I fixed the export error: https://gist.github.com/ahbnr/bb3f52abf0d882252b6a8e1dd88c1c07

Line

mesh = obj.to_mesh(bpy.context.depsgraph, True)

had to be replaced with

depsgraph = bpy.context.evaluated_depsgraph_get()
blender_mesh_owner = obj.evaluated_get(depsgraph)
mesh = blender_mesh_owner.to_mesh()

@cogitas3d: If the change works for you and @brothermechanic, maybe you can create a pull request with your version and this little change.

I just fixed this. Here is pull request
#17

Sorry everyone for the lateness of noticing this issue. I only noticed this when I received a direct email in my inbox requesting Blender 2.8x support...

I have merged @xuser86 's PR + minor fixes and updated the version and readme. The addon has been tested and works on Blender 2.82.7, the packaged version in Ubuntu 20.04 LTS. You all may have forked the project and incorporated your own fixes at this point, but for what it's worth, the master branch of this addon is now functional on 2.8x 🙏

Also I don't know if anyone will need the old addon, but it is available on blender/2.7 branch.