CGCookie / addon_common

GNU General Public License v3.0
41 stars 7 forks source link

Blender 2.8 Mac OS X shader compilation errors #7

Open skarndev opened 5 years ago

skarndev commented 5 years ago

The lib is using OpenGL shaders version #120 while Blender 2.8 got moved to core profile. Is there any chance rendering can be updated to the core profile as well? Mac OS X has no support for compatibility profile.

vxlcoder commented 5 years ago

Thanks for the report, @skarnproject!

I will be updating these scripts right after the majority of the UI code is written.

A note: early on when I started dev on the addon_common (a long time ago now), I decided to wait on updating the shaders to see how quickly 2.80 was adopted, how much support it has on OSX, what OpenGL API was going to be available, etc. OSX OpenGL has always been a thorn in my side when it comes to writing shader code in Blender. I thought that I might have to support 2.79 along with 2.80. However, I'm leaning more toward dropping 2.79 support and focus on supporting supporting 2.80, which would simplify things a lot. Checking in with @patmo141 to see if he would use CC in Blender 2.79, or if he is planning to update his tools to 2.80.

skarndev commented 5 years ago

Thank you for the reply. Supporting both versions is a nightmare given how the API is different. I'd personally go for 2.8 only.

By the way, I have updated the shaders myself to give a test to your UI framework in 2.80, as I am going to use it in my addon for viewport widgets. There is an issue with FSM erroring out that main_main was not registered. It happens when I am running a provided test operator.

vxlcoder commented 5 years ago

If you would, do a Pull Request. Would be interested in your change.

As for the FSM issue, how is your project set up? Do you have a repo that I can look at?

skarndev commented 5 years ago

I need it tested before doing a PR since I don't know opengl, I just did it according to documentation. But since I could never run it, I did not test it.

Speaking of the repo, I don't have it publicly available yet. I just added addon_common folder to my project, that's it (the operator got registered automatically). Then I went into Blender and ran the test operator.

I am thinking it could maybe be related to automatic registration of operators? The system that Animation Nodes addon is also using for automatically registering bpy classes, you can see it there.

vxlcoder commented 5 years ago

ok. Are you using CookieCutter? if so, you'll need to "register" a function as the starting callback (main) for the finite state machine. I haven't tested using the addon+UI without using CookieCutter, so there might still be bugs there. Will take a look

skarndev commented 5 years ago

Yes, I am using CookieCutter. I just ran an operator provided in the test.py file of this repo. From what i can see, I can't spot any difference between the usage of CookieCutter in ExtraCut and Retopoflow compared to this.

The error is:

Loaded font "/Users/skarn/Library/Application Support/Blender/2.80/scripts/addons/io_scene_wmo/addon_common/common/fonts/DroidSans-Blender.ttf" as id 3 Traceback (most recent call last): File "/Users/skarn/Library/Application Support/Blender/2.80/scripts/addons/io_scene_wmo/addon_common/cookiecutter/cookiecutter.py", line 150, in modal self.fsm_update() File "/Users/skarn/Library/Application Support/Blender/2.80/scripts/addons/io_scene_wmo/addon_common/cookiecutter/cookiecutter_fsm.py", line 27, in fsm_update self.fsm.update() File "/Users/skarn/Library/Application Support/Blender/2.80/scripts/addons/io_scene_wmo/addon_common/common/fsm.py", line 88, in update self._state_next = self._call(self._state, fail_if_not_exist=True) File "/Users/skarn/Library/Application Support/Blender/2.80/scripts/addons/io_scene_wmo/addon_common/common/fsm.py", line 65, in _call assert not fail_if_not_exist, 'Could not find state "%s" with substate "%s" (%s)' % (state, substate, str(s)) AssertionError: Could not find state "main" with substate "main" (main__main)

vxlcoder commented 5 years ago

which branch are you using?

also, I haven't updated test.py in a long while. in fact, it uses functionality that has been removed from blender 2.80 (ex: bgl.glColor4f and bgl.glVertex2f) will update that as soon as I can.

a better template to start from is to look at retopoflow.py in the b280 branch of RetopoFlow (https://github.com/CGCookie/retopoflow/blob/b280/retopoflow/retopoflow.py).

skarndev commented 5 years ago

I am using the B280 branch. I see now that test.py contains some old style rendering code. I will try to setup a sample operator using CookieCutter using the Retopoflow one as an example, if that is the working one. I will see if I can update the rendering code to OpenGL core profile then.

patmo141 commented 5 years ago

I will be continuing use of CC in 2.79 for a while, however I can freeze the dependency at current revision so don't stress about pushing on to 2.8. I will be developing new tools in 2.8 so my vote is not to let 2.79 compatibility slow down 2.8 progress

patmo141 commented 4 years ago

@skarnproject were you able to set up a sample CookieCutter operator? I haven't taken the plunge yet but soon I will.

skarndev commented 4 years ago

@patmo141 I actually took a break from doing my Blender projects due to some reasons. Now I am getting back to this and will try asap. Is the Mac OS X compatibility issue supposed to be resolved now?

patmo141 commented 4 years ago

would you like to create a github repo and work together on creating a few simple cookie cutter examples?

skarndev commented 4 years ago

Sure, if you want to collaborate on that, please add me to the repo. I will be working on that stuff actively after January 1 st.

patmo141 commented 4 years ago

https://github.com/patmo141/cookie_cutter_examples/