I’m mainly a .Net developer and I’ve been able to draft a live link plugin for blender but I’m not familiar enough with Python and the Blender API to get it working but I’ve commented the steps that need to be taken.
All the live link plugin needs to do is:
Listen to the local port for a json formatted file path.
Import the .obj (always is just a .obj, no textures)
convert faces to quads and get seams from UV islands.
[Edit: 2 & 3 are implemented but need to be tested. #1 now is a asyncio server that I have no idea how to start when blender is launched or the addon is enabled. It appears not to run.]
If anyone wants to help you can contribute to the plugin on github:
I have sat down and figured out what I needed to fix but now I’m at the point where I need to have my code start and run in the background when blender starts or from when the addon is loaded or whatever. How can I do that?
And also if I try and remove the register and unregister functions I get errors when enabling the addon. If I leave them blank python expects an indented line. so idk how to get rid of the unnecessary class extension.
however for having code run in the background, you use a handler. I see you went down that route already having it commented out. What didn’t work there?
And you need the register and unregister functions for blender to enable the addon. So if you remove them you’d obviously get errors.
I took a look at it and it kinda looks like it is using some kind of built in threading on a timer, but there is a ton of code there and I’m to new to python to really understand what is going on. Maybe the tasks_queue.py is doing what I want but is way overkill for what I need. idk
Well the thing with timers is if I have them check the local port for data every X seconds then what if the user presses the “send to blender” button when blender is not checking. I’m not continuously streaming data and the user isn’t importing from blender like in BlenderKit but sending a file path to blender.
I could have the timer start the server after X seconds after startup then disable the timer I guess. Is there really no way to just call a function that is in a class from the register function after registering the class?