2023-06-13 18:15:22 +00:00
|
|
|
import bpy
|
2024-04-02 15:07:14 +00:00
|
|
|
from bpy.types import Panel
|
|
|
|
|
Import Fix, funcs moved, refs updated, ocl rename
Changed all imports from absolute to relative:
- instead of importing the module 'cam' now imports come from '.' the relative parent folder
- importing the module into itself resulted in a circular import error, relative imports avoid this
Moved Functions, refs updated:
- some functions (and 2 variables) only existed on the base level of the module, in the init file, and could not otherwise be accessed, they were moved into the utils file with other similar functions
- these were primarily called as update functions for Properties scattered across the addon, these have all been updated to reflect the new location and import convention
opencamlib_version rename:
- in 2 files there was a local variable named 'opencamlib_version' that was defined by a function called 'opencamlib_version' that returned the opencamlib_version
- this seemed to confuse Blender into thinking that it was being called before it was defined, and simply changing the variable name to 'ocl_version' while keeping the function name as 'opencamlib_version' fixed the issue
2024-03-22 21:52:18 +00:00
|
|
|
from .buttons_panel import CAMButtonsPanel
|
2023-06-13 18:15:22 +00:00
|
|
|
|
|
|
|
|
2024-04-02 15:07:14 +00:00
|
|
|
class CAM_GCODE_Panel(CAMButtonsPanel, Panel):
|
2024-04-11 19:06:21 +00:00
|
|
|
"""CAM Operation G-code Options Panel"""
|
|
|
|
bl_label = "CAM G-code Options"
|
2023-06-13 18:15:22 +00:00
|
|
|
bl_idname = "WORLD_PT_CAM_GCODE"
|
2023-06-14 09:33:08 +00:00
|
|
|
panel_interface_level = 1
|
2023-06-13 18:15:22 +00:00
|
|
|
|
2023-06-21 16:45:50 +00:00
|
|
|
prop_level = {
|
2023-07-04 17:16:13 +00:00
|
|
|
'draw_output_header': 1,
|
|
|
|
'draw_output_trailer': 1,
|
|
|
|
'draw_enable_dust': 1,
|
|
|
|
'draw_enable_hold': 1,
|
|
|
|
'draw_enable_mist': 1
|
2023-06-21 16:45:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def draw_output_header(self):
|
2024-03-21 12:29:30 +00:00
|
|
|
if not self.has_correct_level():
|
|
|
|
return
|
2023-06-21 16:45:50 +00:00
|
|
|
self.layout.prop(self.op, 'output_header')
|
|
|
|
if self.op.output_header:
|
|
|
|
self.layout.prop(self.op, 'gcode_header')
|
|
|
|
|
|
|
|
def draw_output_trailer(self):
|
2024-03-21 12:29:30 +00:00
|
|
|
if not self.has_correct_level():
|
|
|
|
return
|
2023-06-21 16:45:50 +00:00
|
|
|
self.layout.prop(self.op, 'output_trailer')
|
|
|
|
if self.op.output_trailer:
|
|
|
|
self.layout.prop(self.op, 'gcode_trailer')
|
|
|
|
|
|
|
|
def draw_enable_dust(self):
|
2024-03-21 12:29:30 +00:00
|
|
|
if not self.has_correct_level():
|
|
|
|
return
|
2023-06-21 16:45:50 +00:00
|
|
|
self.layout.prop(self.op, 'enable_dust')
|
|
|
|
if self.op.enable_dust:
|
|
|
|
self.layout.prop(self.op, 'gcode_start_dust_cmd')
|
|
|
|
self.layout.prop(self.op, 'gcode_stop_dust_cmd')
|
|
|
|
|
|
|
|
def draw_enable_hold(self):
|
2024-03-21 12:29:30 +00:00
|
|
|
if not self.has_correct_level():
|
|
|
|
return
|
2023-06-21 16:45:50 +00:00
|
|
|
self.layout.prop(self.op, 'enable_hold')
|
|
|
|
if self.op.enable_hold:
|
|
|
|
self.layout.prop(self.op, 'gcode_start_hold_cmd')
|
|
|
|
self.layout.prop(self.op, 'gcode_stop_hold_cmd')
|
|
|
|
|
|
|
|
def draw_enable_mist(self):
|
2024-03-21 12:29:30 +00:00
|
|
|
if not self.has_correct_level():
|
|
|
|
return
|
2023-06-21 16:45:50 +00:00
|
|
|
self.layout.prop(self.op, 'enable_mist')
|
|
|
|
if self.op.enable_mist:
|
|
|
|
self.layout.prop(self.op, 'gcode_start_mist_cmd')
|
|
|
|
self.layout.prop(self.op, 'gcode_stop_mist_cmd')
|
2023-06-13 18:15:22 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
2023-06-21 16:45:50 +00:00
|
|
|
self.context = context
|
2023-06-13 18:15:22 +00:00
|
|
|
|
2023-06-21 16:45:50 +00:00
|
|
|
self.draw_output_header()
|
|
|
|
self.draw_output_trailer()
|
|
|
|
self.draw_enable_dust()
|
|
|
|
self.draw_enable_hold()
|
|
|
|
self.draw_enable_mist()
|