- 添加Blender插件核心文件:__init__.py、ui.py、property.py、preference.py - 添加插件工具模块:g.py、loop.py、generate_loop.py、const.py、op.py - 添加翻译工具:utils/trans.py - 添加PuLP线性规划库及其依赖文件,包括CBC求解器二进制文件 - 添加.gitignore和VSCode配置文件
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
from . import const, g
|
|
import bpy
|
|
from . import op
|
|
from .utils.trans import t
|
|
|
|
|
|
class EasyPatchMainPanel(bpy.types.Panel):
|
|
bl_label = "Easy Patch"
|
|
bl_idname = "VIEW3D_PT_OIMOYU_EASY_Patch_MAIN_PANEL"
|
|
bl_space_type = "VIEW_3D"
|
|
bl_region_type = "UI"
|
|
bl_context = "mesh_edit"
|
|
bl_options = {"DEFAULT_CLOSED"}
|
|
|
|
bl_category = "Edit"
|
|
bl_order = 1
|
|
|
|
def draw(self, context):
|
|
layout = self.layout
|
|
|
|
if g.is_running:
|
|
layout.row().operator(
|
|
op.EasyPatchModalOperator.bl_idname,
|
|
text=t("stop") + " Easy Patch",
|
|
icon="PAUSE",
|
|
)
|
|
else:
|
|
layout.prop(
|
|
context.scene.easy_patch_properties,
|
|
"snap_obj",
|
|
text="",
|
|
)
|
|
|
|
layout.row().operator(
|
|
op.EasyPatchModalOperator.bl_idname,
|
|
text=t("start") + " Easy Patch",
|
|
icon="PLAY",
|
|
)
|
|
|
|
layout.separator()
|
|
|
|
layout.row().operator(
|
|
op.EasyPatchSnapSelectedToSurfaceOperator.bl_idname,
|
|
text=t("snap_selected_to_surface"),
|
|
icon="MOD_SHRINKWRAP",
|
|
)
|
|
|
|
|
|
classes = (EasyPatchMainPanel,)
|