powroupi / blender_mmd_tools

mmd_tools is a blender addon for importing Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.83k stars 277 forks source link

Fixed error if no 3D view is found #208

Closed Darkblader24 closed 5 years ago

Darkblader24 commented 5 years ago

Sometimes it can happens that there is no 3D view (or it is not the first space) when calling the shading buttons via code. This fixes this.

powroupi commented 5 years ago

Thank you for the changes. :smile:

But I think we should use context.area whenever context.area is a 3D view area, and consider a case of no 3d View. :thinking:

Darkblader24 commented 5 years ago

You are right, I missed that. I just tested around with it more and found out that there are more things to iron out than just this error. Take a look at the case when there are more than two 3D views: https://i.imgur.com/6g7Wy4Y.gif The second one is pretty much not working properly at all and the first one also effects the second one. I think it should either effect both at the same time or only one of them.

Feel free to do whatever you want with this PR and fix it in your own style since this issue extends the scope of this PR.

powroupi commented 5 years ago

Okay, I've updated the code (29feeb7) which should fix the error of calling the shading buttons via code/console. It will effect all 3D views when context.area is not a 3D view area. :)

Darkblader24 commented 5 years ago

Thanks, works like a charm 💯