Commit Graph

29 Commits

Author SHA1 Message Date
Campbell Barton
c23b23db4e Attribute PolyDimensions GmbH for funding OBJ spline import/export. 2009-06-18 16:01:47 +00:00
Campbell Barton
2371c35afc OBJ Import
* Wasn't setting the curve 3D option
* The nurbs object name could be None which caused an error, check its set.

OBJ Export
* Off by 1 error on closed nurbs was incorrect, broke other importers but worked with blender.
* Nurbs verts were not adding to the total vert count, scrambling meshes added after (somehow my first test case had all the curve objects last)
2009-06-13 03:54:27 +00:00
Campbell Barton
96c5f36eff OBJ import support for nurbs curves
Imports nurbs with orderU and endpointU (inferred from weights).

No support for vert-weights, surfaces, 2D curves or non-bspline's yet.

fix for exporting closed nurbs, was overlapping too much of the curve.
2009-06-12 04:16:12 +00:00
Campbell Barton
8347a9f21b Option to export curves as OBJ native curves (rather then a bunch of edges)
- nurbs and polyline (not bezier)
- closed / open curves
- OrderU works as expected
- Endpoint U works too.
2009-06-10 19:14:05 +00:00
Campbell Barton
c19baf85cc [#18694] Added support for Wavefront OBJ groups for both the import and export scripts
from Paolo Ciccone (pciccone) 

Im not that keen on this functionality since vertex groups in blender are for weight painting and OBJ's groups are more like sub-objects, The conversion between these is a poor approximation (one vertex group per face).
But this is still useful for using blender with poser so accepting these 2 patches.

Made some changes from the patch
*Export*
- vgroup off by default, since this is mainly useful for corner cases
- findVertexGroupName() - changed how exporting selects a vertex group for a face, use the highest combind weight for each group instead of  the number of checking how many times the verts are in a group because they could have a zero weight.
- findVertexGroupName() - would fail if a faces verts were not in any groups, now return a (null) group
- Allow modifiers to export with vgroups

*Import*
- disable by default
- ignore (null) groups
- fixed a problem where the patch broke SPLIT_GROUPS
- move the group definition out of global namespace, breaks importing as a module.

--- Patch submission info
The import/export scripts included with Blender 2.48 don't save/preserve groups defined in OBJ file. This presents a
couple of issues: users loading an obj file with groups are not able to use a rather important set of data. When the
file is then saved the groups are lost bringing up both the issue of data loss and loss of functionality as groups are
used for rigging and morph target creation for Poser/DAZ Studio and all compatible applications. Of course other
animation/modeling packages that use OBJ files might be affected.

The solution that I present here simply patches the excellent python scripts written by Campbell Barton and Jiri Hnidek.
The new code implements the preservation of groups by creating Blender vertex groups during import and by re-writing
those groups in the OBJ file during export. Of course group ownership is idetermined at the face/polygon level and not
at the vertex level.

This rather simple solution makes Blender instantly one of the better tools to create Poser Morph targets (Full Body
Morphs) and conforming figures and clothing.  Of course it's also adding a more complete support for the whole OBJ spec.

The patches are fitting well inside the established logic, have a minimal impact and are totally transparent to the
user. See the attached video (about 7 minutes long) for more details.

I noticed that the original scripts are formatted with tabs. I think it would be a good idea to follow the standard
Python recommendation and convert the scripts to use spaces. I didn't want to do it on my side as it would generate
a patch that replaces the whole file, not something that I wanted to do with my first submission :) But it would help
if people with access to SVN could do it.

Here is a short video that demonstrates the updates:
http://www.paolociccone.com/blender_obj_scripts.html

Cheers!
----
2009-05-13 00:20:14 +00:00
Campbell Barton
0409977aa8 [#18241] Very minor bugfix and typo correction for wavefront obj exporter and importer python scripts
from Michael Judd.

Also removed .keys() for a loop in impor_obj.py since its the default dictionary iterator.
2009-01-30 02:01:16 +00:00
Campbell Barton
688cc11302 added an option for python Draw.UIBlock(func, mouse_exit) so moving the mouse outside the popup wont close it.
Stops FBX Export and OBJ I/O from flickering a lot.
2008-10-22 08:21:43 +00:00
Campbell Barton
ff2fcdf34e py 2.3 compat for lightwave_import and wizard_curve2tree 2008-10-21 00:21:02 +00:00
Campbell Barton
18072f5583 modified OBJ import and export UI's to be less confusing with nicer layout. removed an unneeded workaround in fbx export. 2008-10-19 15:53:22 +00:00
Matt Ebb
f0e0e6b1c9 * Some tweaks to the OBJ importer/exporter after chatting with Campbell
- renamed the 'morph target' option to 'keep vertex order'
- enabled 'keep vertex order' by default

This should improve usability for importing and exporting shape keys, point caches, mdds ,etc.
2008-09-17 04:07:58 +00:00
Campbell Barton
62bd1b85e6 left in prints 2008-02-27 23:11:04 +00:00
Campbell Barton
345866b61e Fix for [#8382] UV unwrap & export puts seams on all edges.
Maya uses OBJ's UV's to generate seams, some people complained that models imported from blender didnt work well in maya.
It was faster to write every faces UV (without doing a remove doubles), but sharing UV coords makes smaller files and might also be more efficient in other applications.
2008-02-27 23:10:25 +00:00
Campbell Barton
8bcfafa3d9 changed default nan_definitions.mk to use python 2.5 for linux (ai64 default was py 2.2 which probably wont even compile anymore)
pose.c - left a print here
export obj would ask about file overwriting twice.
2007-10-21 17:38:17 +00:00
Campbell Barton
567e634253 obj export had the overwrite confirmation commented out from testing, UIBlock needed to clear the events so tooltips show. 2007-08-21 19:37:03 +00:00
Campbell Barton
b0921f3d79 exporting normals wit the "High Quality Normals" option disabled, exported localspace normals.
not too bad since HQNormals were enabled by default.
2007-06-06 04:34:59 +00:00
Campbell Barton
f368b60baf OBJ smooting groups exported enabled for by default for the first smooth group (should have been disabled)
gen_library.c - Own error, hashing did not decref the tuple it created.
Draw.c - callback also missed a decref
2007-06-04 08:15:27 +00:00
Chris Want
c80b2ef9b1 'Copy Images' option for the .obj exporter would fail.
Changing Material ==> Blender.Material fixed it.
2007-05-16 22:30:20 +00:00
Campbell Barton
60b3268c32 adding a python function for cleaning strings (for filenames and export names) BPySys.py - used fotr obj and fbx export.
view.c - missed one smoothview/camera.
Brigg's hide object patch didnt change the object selection flag, other minor changes also.
2007-04-19 20:58:09 +00:00
Campbell Barton
9cf602b949 3ds_export - enabled textures as an option since it works with some appliactions (only way to get textured models from blender to google sketchup)
3ds_import - added option to disable recursive image searching (could be slow somtimes)
export_obj - when making group/object names only use both object and mesh name when they differ.
weightpaint_clean, weightpaint_grow_shrink - minor updates.
Render.py - own error in epydocs.
2007-01-31 01:18:51 +00:00
Campbell Barton
7239784b17 added option "morph target" since many people complain that verts are re-ordered with some options enabled. 2007-01-26 07:01:30 +00:00
Campbell Barton
0decfd140b fixed an obscure bug in obj import (possibly in Mesh.c) that made adding edges as faces mess up.
export obj now dosnt remove double UV's, its too slow.

updated version numbers to 243 and other minor changes.
2007-01-26 06:02:21 +00:00
Campbell Barton
2a829b87e2 use better Python 2.4 syntax sorting (in a try so py 2.3 still works)
use new scene/object creation for making temp objects.
2007-01-25 04:18:09 +00:00
Campbell Barton
604defd8f2 somehow pasted some text by mistake that raised an error. 2006-12-25 10:53:00 +00:00
Campbell Barton
859b7f207e modified scripts from using older/depricated Python API commands, deprecated scn.getChildren() in the docs. 2006-12-25 09:17:23 +00:00
Campbell Barton
711a1f8686 made editmode select grouped work with mixed selections - can show select grouped items for vert/edges/faces all at once.
bad comment in Axiscopy and spelling fix in export_obj
2006-12-16 10:39:08 +00:00
Campbell Barton
827cce172c update to Axiscopy, more error checking. basic functionality the same.
- Dont allow it to apply the matrix twice to a linked-dupe. (Same as Apply Loc/Size/Rot)
- Make sure that the source object is active, not just the first selected object.
- Use Mesh instead of NMesh.
- use mesh.transform(mat) rather then vert by vert vec*mat

Other scripts had pupBlock changes for better layout.
2006-12-15 22:14:33 +00:00
Campbell Barton
6959e689be added many checks to uvcopy so it dosnt raise errors.
Minor changes to radiosity_export, updated to work with the new API (vertexColors MTFace)
obdatacopier - was getting the selection but not using it. made it ignore some read only properties.
BPyMesh - minor change: use face iterator rather then making a tuple()
2006-12-12 07:28:20 +00:00
Campbell Barton
323cc790fa added a BPyObject.py with 1 function- getDerivedObjects, gets all dupliObjects and can optionaly get a mesh generated from the objects particles.
export obj can now export duplis and particles as well as faster face exporting and other small cleanups/speedups.
2006-10-01 14:02:51 +00:00
Campbell Barton
7fce181d11 BPyMessages - added "Save over" message for scripts to use, so as not to overwrite files.
import_obj - comments, docstring additions, cleanup.

OBJ export: -renamed export_obj
 faster edge exporting (use edges LOOSE flag rather then finding zero face user edges)
 check for file before overwriting
 use object iterators
2006-09-25 05:12:37 +00:00