Files
cable-normalizer/__init__.py

102 lines
3.4 KiB
Python

bl_info = {
"name": "Kabeck Cable Normalizer",
"author": "Antigravity",
"version": (3, 0),
"blender": (3, 3, 0),
"location": "View3D > Sidebar > Kabeck",
"description": "Normalizes cable thickness, labels, length and generates uniform label textures",
"warning": "",
"doc_url": "",
"category": "3D View",
}
if "bpy" in locals():
import importlib
importlib.reload(utils)
importlib.reload(texture_gen)
importlib.reload(migration)
importlib.reload(operators)
else:
import bpy
from . import utils
from . import texture_gen
from . import migration
from . import operators
classes = (
operators.KABECK_OT_get_diameter,
operators.KABECK_OT_normalize_cable,
operators.KABECK_OT_batch_process,
operators.KABECK_PT_normalizer_panel,
migration.KABECK_OT_convert_to_cable,
migration.KABECK_OT_migrate_cables,
)
def register():
bpy.types.Scene.normalizer_target_diameter = bpy.props.FloatProperty(
name="Target Diameter",
description="Fallback target outer diameter in mm (used when Cable node has no value)",
default=13.8,
min=0.1,
)
bpy.types.Scene.normalizer_target_length = bpy.props.FloatProperty(
name="Target Length",
description="Fallback target length in mm",
default=1000.0,
min=1.0,
)
bpy.types.Scene.normalizer_target_label_rotation = bpy.props.FloatVectorProperty(
name="Target Label Rotation",
description="Uniform rotation applied to all labels during batch",
subtype='EULER',
default=(0.0, 0.0, 0.0),
)
bpy.types.Scene.normalizer_target_label_scale = bpy.props.FloatProperty(
name="Target Label Size",
description="Visual size of the label (Scale * obj.scale product)",
default=1.0,
min=0.01,
)
bpy.types.Scene.normalizer_font_path = bpy.props.StringProperty(
name="Font Path",
description="Path to a .ttf or .otf font file for label textures",
default="/Volumes/Alpha SSD/Fonts/Windows Dots.ttf",
subtype='FILE_PATH',
)
bpy.types.Scene.normalizer_label_prefix = bpy.props.StringProperty(
name="Label Prefix",
description="Text prepended to all cable labels (e.g. 'Kabeck')",
default="Kabeck",
)
bpy.types.Scene.normalizer_prefix_gap = bpy.props.IntProperty(
name="Prefix Gap (px)",
description="Gap in pixels between prefix and label on the texture",
default=50,
min=0, max=2000,
)
bpy.types.Scene.normalizer_target_label_translation = bpy.props.FloatVectorProperty(
name="Label Translation",
description="XYZ Transform translation applied to all labels",
subtype='TRANSLATION',
default=(0.0, 0.0, 0.0),
)
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
del bpy.types.Scene.normalizer_target_diameter
del bpy.types.Scene.normalizer_target_length
del bpy.types.Scene.normalizer_target_label_rotation
del bpy.types.Scene.normalizer_target_label_scale
del bpy.types.Scene.normalizer_font_path
del bpy.types.Scene.normalizer_label_prefix
del bpy.types.Scene.normalizer_prefix_gap
del bpy.types.Scene.normalizer_target_label_translation
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()