Skip to content

Commit

Permalink
Send slotID's for backend_plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
nallath committed Jul 11, 2023
1 parent 4aebd75 commit 3037320
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cura/BackendPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def __init__(self) -> None:
self._plugin_command: Optional[List[str]] = None
self._process = None
self._is_running = False
self._supported_slots: List[int] = []

def getSupportedSlots(self) -> List[int]:
return self._supported_slots

def isRunning(self):
return self._is_running
Expand All @@ -25,6 +29,9 @@ def setPort(self, port: int) -> None:
def getPort(self) -> int:
return self.__port

def getAddress(self) -> str:
return self._plugin_address

def _validatePluginCommand(self) -> list[str]:
"""
Validate the plugin command and add the port parameter if it is missing.
Expand Down
13 changes: 13 additions & 0 deletions plugins/CuraEngineBackend/StartSliceJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,19 @@ def run(self) -> None:
for extruder_stack in global_stack.extruderList:
self._buildExtruderMessage(extruder_stack)

for plugin in CuraApplication.getInstance().getBackendPlugins():
for slot in plugin.getSupportedSlots():
# Right now we just send the message for every slot that we support. A single plugin can support
# multiple slots
# In the future the frontend will need to decide what slots that a plugin actually supports should
# also be used. For instance, if you have two plugins and each of them support a_generate and b_generate
# only one of each can actually be used (eg; plugin 1 does both, plugin 1 does a_generate and 2 does
# b_generate, etc).
plugin_message = self._slice_message.addRepeatedMessage("engine_plugins")
plugin_message.id = slot
plugin_message.address = plugin.getAddress()
plugin_message.port = plugin.getPort()

for group in filtered_object_groups:
group_message = self._slice_message.addRepeatedMessage("object_lists")
parent = group[0].getParent()
Expand Down

0 comments on commit 3037320

Please sign in to comment.