Page MenuHome

Export Paper Model
ClosedPublic

Authored by Adam Dominec (emu) on Feb 3 2014, 11:04 AM.

Details

Summary

See: T38441 for details, this diff is for review only

Diff Detail

Event Timeline

initial review.

io_export_paper_model.py
66

no need for try here

70

whats blist ?

81

this could be a regular function

114

our API should be able to do this.

159

image names can be up to 64 characters now, does this size need updating?

174
214

prefer filepath.lower().endswith((".svg", ".png"))

994

Much more efficient to simply do present.clear()

1798

I think this is a bit confusing, why not import bmesh and call bmesh.new ?

Replies to the comments in code. (I'll also fix the remaining ones I don't reply to.)

io_export_paper_model.py
70

a type similar to list, implemented using a search tree. It can insert at any position in O(log n). https://pypi.python.org/pypi/blist/1.3.4

114

sure, as v1.to_3d().cross(v2.to_3d()).z
I did some profiling and this appears to be faster. It is one of the most often called functions in the script.

994

I don't think that would work. There may be other unrelated items in the list present. Each vertex may have many instances in the flat net.
This code really needs to make sure that source is not in present, and that target is.

1798

this way seemed to look more like Python to me, but I should better just conform with the API.
I'll change it to bmesh.new

I commited the changes to https://raw2.github.com/addam/Export-Paper-Model-from-Blender/master/io_export_paper_model.py
It still doesn't use tempfile, that will require a bit deeper changes.

io_export_paper_model.py
1798

Or perhaps I'll just remove this function for now. It's commented out from the UI.
I have this functionality in a branch, but it will take a few more weeks to finish.

Committed 2d cross product to mathutils.

io_export_paper_model.py
114
Adam Dominec (emu) commandeered this revision.Oct 24 2014, 10:54 PM

I made quite a lot of changes in the code and hopefully I understood a bit how Phabricator works, so I'm trying to update this.

The code should now be easier to read, although it still does not fully comply with PEP8.
I fixed a few issues both in the unfolding core and in the SVG output.
The script is compatible with Blender 2.70---2.72b.

Adam Dominec (emu) updated this revision to Diff 2755.EditedOct 24 2014, 11:07 PM

Updates based on campbellbarton's comments:

  • style changes (a lot of them)
  • UI: 3D toolbox: tabbed interface, split panel into two
  • API update: 2d cross product. Removed the cross_product function
  • added __slots__ to all classes that are more than singletons
  • use tempfile module for embedding images, instead of random names
  • linked images: use relative paths and convert to forward slashes in SVG

Other improvements and new features:

  • Outer line is a contiguous SVG path (suitable for cutting plotters)
  • new operator: Clear All Seams
  • Island.join/is_below: robustness against various kinds of disgusting geometry
  • explicit check: touching vs. crossing boundaries
  • changed boundary_sorted -> boundary (hopefully a speedup)
  • rename 'Make Unfoldable' -> 'Unfold' everywhere
  • improved main_faces selection

(...and many fixes of various importance)

Trying to make a complete diff (again), with two more commits:

  • code cleanup; leaving broken output of markers
  • fix: converting dimensions throughout the process

Removed the object_convert_to_armature.py script, should not be a part of D283.

Good; now this diff is again ready for code review.
(sorry for the mess, I'm still learning how to use Arcanist)

fix: non-2-manifold edges would cause a crash (merged from master)

Campbell Barton (campbellbarton) edited edge metadata.

This can go into contrib.

@Adam Dominec (emu). I have added you to addons project, so you can commit to this repository.

https://developer.blender.org/diffusion/BAC/

This revision is now accepted and ready to land.Feb 4 2015, 9:17 PM