Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set image margin #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion io_export_paper_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ def save(self, properties):
rd.bake_type = 'TEXTURE' if properties.output_type == 'TEXTURE' else 'FULL'
rd.use_bake_selected_to_active = (properties.output_type == 'SELECTED_TO_ACTIVE')

rd.bake_margin, rd.bake_distance, rd.bake_bias, rd.use_bake_to_vertex_color, rd.use_bake_clear = 0, 0, 0.001, False, False
rd.bake_margin, rd.bake_distance, rd.bake_bias, rd.use_bake_to_vertex_color, rd.use_bake_clear =\
properties.image_margin, 0, 0.001, False, False
if image_packing == 'PAGE_LINK':
self.mesh.save_image(tex, printable_size * ppm, filepath)
elif image_packing == 'ISLAND_LINK':
Expand Down Expand Up @@ -2059,6 +2060,9 @@ class ExportPaperModel(bpy.types.Operator):
description="Shows the box 'Colors and Style' expanded in user interface",
default=False, options={'SKIP_SAVE'})
style = bpy.props.PointerProperty(type=PaperModelStyle)
image_margin = bpy.props.IntProperty(name="Image margin",
description="Extend the image beyond the edge of the islands to avoid gaps",
default=0, soft_min=0)

unfolder = None
largest_island_ratio = 0
Expand Down Expand Up @@ -2157,6 +2161,8 @@ def draw(self, context):
row = col.row()
row.active = self.file_format == 'SVG'
row.prop(self.properties, "image_packing", text="Images")
row = col.row()
row.prop(self.properties, "image_margin", text="Image margin (px)")

box = layout.box()
row = box.row(align=True)
Expand Down