blendercam/scripts/addons/cam/ui_panels/area.py

87 wiersze
3.5 KiB
Python
Czysty Zwykły widok Historia

2022-05-10 14:30:57 +00:00
import bpy
from cam.ui_panels.buttons_panel import CAMButtonsPanel
class CAM_AREA_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM operation area panel"""
bl_label = "CAM operation area "
bl_idname = "WORLD_PT_CAM_OPERATION_AREA"
2023-06-13 18:15:22 +00:00
panel_interface_level = 0
2022-05-10 14:30:57 +00:00
2023-06-18 11:06:39 +00:00
prop_level = {
'draw_use_layers': 0,
'draw_maxz': 1,
'draw_minz': 1,
'draw_ambient': 1,
'draw_limit_curve': 1
2023-06-18 11:06:39 +00:00
}
2023-06-18 11:06:39 +00:00
def draw_use_layers(self):
if not self.has_correct_level(): return
2022-05-10 14:30:57 +00:00
row = self.layout.row(align=True)
row.prop(self.op, 'use_layers')
if self.op.use_layers:
row.prop(self.op, 'stepdown')
2022-05-10 14:30:57 +00:00
2023-06-18 11:06:39 +00:00
def draw_maxz(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'maxz')
2023-07-12 13:45:22 +00:00
if self.ôp.maxz > self.op.movement.free_height:
self.layout.prop(self.op.movement, 'free_height')
self.layout.label(text='POSSIBLE COLLISION: Depth start > Free movement')
2022-05-10 14:30:57 +00:00
2023-06-18 11:06:39 +00:00
def draw_minz(self):
if not self.has_correct_level(): return
2023-06-16 13:27:05 +00:00
if self.op.geometry_source in ['OBJECT', 'COLLECTION']:
if self.op.strategy == 'CURVE':
2022-05-10 14:30:57 +00:00
self.layout.label(text="cannot use depth from object using CURVES")
if not self.op.minz_from_ob:
if not self.op.minz_from_material:
self.layout.prop(self.op, 'minz')
self.layout.prop(self.op, 'minz_from_material')
if not self.op.minz_from_material:
self.layout.prop(self.op, 'minz_from_ob')
2022-05-10 14:30:57 +00:00
else:
self.layout.prop(self.op, 'source_image_scale_z')
self.layout.prop(self.op, 'source_image_size_x')
2023-06-16 13:27:05 +00:00
if self.op.source_image_name != '':
i = bpy.data.images[self.op.source_image_name]
2022-05-10 14:30:57 +00:00
if i is not None:
sy = int((self.op.source_image_size_x / i.size[0]) * i.size[1] * 1000000) / 1000
2022-05-10 14:30:57 +00:00
self.layout.label(text='image size on y axis: ' + strInUnits(sy, 8))
self.layout.separator()
self.layout.prop(self.op, 'source_image_offset')
2022-05-10 14:30:57 +00:00
col = self.layout.column(align=True)
col.prop(self.op, 'source_image_crop', text='Crop source image')
if self.op.source_image_crop:
col.prop(self.op, 'source_image_crop_start_x', text='start x')
col.prop(self.op, 'source_image_crop_start_y', text='start y')
col.prop(self.op, 'source_image_crop_end_x', text='end x')
col.prop(self.op, 'source_image_crop_end_y', text='end y')
2022-05-10 14:30:57 +00:00
2023-06-18 11:06:39 +00:00
def draw_ambient(self):
if not self.has_correct_level(): return
2023-06-18 11:06:39 +00:00
if self.op.strategy in ['BLOCK', 'SPIRAL', 'CIRCLES', 'PARALLEL', 'CROSS']:
self.layout.prop(self.op, 'ambient_behaviour')
if self.op.ambient_behaviour == 'AROUND':
self.layout.prop(self.op, 'ambient_radius')
self.layout.prop(self.op, "ambient_cutter_restrict")
2023-06-18 11:06:39 +00:00
def draw_limit_curve(self):
if not self.has_correct_level(): return
2023-06-18 11:06:39 +00:00
if self.op.strategy in ['BLOCK', 'SPIRAL', 'CIRCLES', 'PARALLEL', 'CROSS']:
self.layout.prop(self.op, 'use_limit_curve')
if self.op.use_limit_curve:
self.layout.prop_search(self.op, "limit_curve", bpy.data, "objects")
2022-05-10 14:30:57 +00:00
2023-06-18 11:06:39 +00:00
def draw(self, context):
self.context = context
2022-05-10 14:30:57 +00:00
2023-06-18 11:06:39 +00:00
self.draw_use_layers()
self.draw_maxz()
self.draw_minz()
self.draw_ambient()
self.draw_limit_curve()
2022-05-10 14:30:57 +00:00