blender/release/scripts
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
..
bpydata fixed flt_import problem adding materials to the mesh, made untextured faces not go pink. 2006-07-28 08:59:44 +00:00
bpymodules dxfLibrary.py - modif in POLYLINE class 2009-05-06 02:19:16 +00:00
3ds_export.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
3ds_import.py python geometry function Geometry.BezierInterp(vec_knot_1, vec_handle_1, vec_handle_2, vec_knot_2, resolution) 2009-05-04 13:01:18 +00:00
ac3d_export.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
ac3d_import.py == Scripts == 2009-01-11 16:13:00 +00:00
add_mesh_empty.py * adds EmptyMesh to the menu 2007-06-28 08:33:04 +00:00
add_mesh_torus.py BGE Python owned proxies had a problem being decref'd twice, this would crash on freeing KX_Vertex/Poly Proxy types when python was compiled with debug options enabled. 2009-05-07 22:06:27 +00:00
animation_bake_constraints.py use higher precession pi 2008-12-31 02:13:38 +00:00
animation_trajectory.py animation_trajectory - was printing deprecation warnings. cleaned up some of its code too. 2007-02-07 07:43:10 +00:00
armature_symmetry.py PyAPI. 2007-04-18 14:40:01 +00:00
Axiscopy.py mesh_skin updated to use ed.key, other minor cleanups. 2006-12-25 23:14:48 +00:00
bevel_center.py Emacs has some rules about where and how to look for settings. 2009-04-07 17:17:47 +00:00
blenderLipSynchro.py added encoding "# coding: utf-8" to the headers of scripts that python would not run with execfile('....'), python would also riase the error, though there is no practicle use 2008-05-11 12:41:12 +00:00
bvh_import.py own error, bvh import would always miss the last frame. 2008-10-08 17:07:32 +00:00
c3d_import.py c3d_import needed encoding defined for python 2.5+ to run. 2008-10-12 10:39:45 +00:00
camera_changer.py updated this script (one of the most out of date) 2007-01-28 03:36:33 +00:00
config.py == Python == 2008-10-09 22:28:44 +00:00
console.py [#18611] console.py linewrap 2009-04-25 17:41:17 +00:00
DirectX8Exporter.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
DirectX8Importer.py misc changes from stable 2007-08-01 18:04:44 +00:00
discombobulator.py dont use tface hide or select anymore, since maintaining 2 sets of hide/select data for each face is annoying. 2007-04-29 13:39:46 +00:00
envelope_symmetry.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
export_dxf.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
export_fbx.py [#18702] FBX exported hemi light crashes maya 2009-05-06 21:47:24 +00:00
export_lightwave_motion.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
export_m3g.py uniform end-of-line format and set svn:eol-style property to "native" for all scripts 2008-11-05 11:42:34 +00:00
export_map.py quake map exporter, supports lamps, cubes as brushes, complex meshes face per brush, nurbs surfaces as a patch 2007-03-01 02:25:20 +00:00
export_mdd.py The mdd exporter was skipping the first frame, fix from bill nieuwendorp (slow67) 2008-04-20 16:18:43 +00:00
export_obj.py [#18694] Added support for Wavefront OBJ groups for both the import and export scripts 2009-05-13 00:20:14 +00:00
export-iv-0.1.py Added GPL Headers to some of my scipts that were missing it. also changed the header of a few others. 2007-02-14 01:03:32 +00:00
faceselect_same_weights.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
flt_defaultp.py -> FLT palette alpha bug 2008-03-18 22:55:40 +00:00
flt_dofedit.py Merge from trunk 16122-16307 2008-08-30 14:32:16 +00:00
flt_export.py Merge from trunk: 15912:16031 2008-08-09 10:12:59 +00:00
flt_filewalker.py -> Updated FLT scripts 2007-11-22 01:43:24 +00:00
flt_import.py soc-2008-mxcurioni: merged changes to revision 14967 2008-05-25 18:28:52 +00:00
flt_lodedit.py Merge from trunk 16122-16307 2008-08-30 14:32:16 +00:00
flt_palettemanager.py Merge from trunk: 15912:16031 2008-08-09 10:12:59 +00:00
flt_properties.py Merge from trunk 16122-16307 2008-08-30 14:32:16 +00:00
flt_toolbar.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
help_bpy_api.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_browser.py == Scripts == 2009-01-21 15:45:31 +00:00
help_getting_started.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_manual.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_release_notes.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_tutorials.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_web_blender.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_web_devcomm.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_web_eshop.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
help_web_usercomm.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
hotkeys.py Added joystick epydocs, only changed incorrect docstrings in SCA_JoystickSensor.cpp 2008-10-18 13:23:30 +00:00
IDPropBrowser.py This commit fixes up a bunch of svn properties to hopefully make things a little nicer for everyone. 2007-08-28 10:07:08 +00:00
image_2d_cutout.py 2D Cutout Image Importer 2009-05-11 05:35:32 +00:00
image_auto_layout.py [#18479] 'Consolidate into one image' does not calculate/use 'pixel margin' 2009-04-01 07:13:55 +00:00
image_billboard.py image render to billboard was rotating UV's incorrectly, also make use of texface alpha rather then making many materials with textures. 2008-03-12 10:00:52 +00:00
image_edit.py attempt to make executing an external command work with python 2.4 & 2.5, it seems that only py 2.6 wanted list args for subprocess.Popen 2008-11-11 08:21:09 +00:00
import_dxf.py update for DXF-Importer v1.12, DXF-Exporter v1.29 - 2009.04.11 by migius 2009-04-15 01:37:50 +00:00
import_lightwave_motion.py uniform end-of-line format and set svn:eol-style property to "native" for all scripts 2008-11-05 11:42:34 +00:00
import_mdd.py Missed a few lines in import_mdd.py 2008-01-14 05:58:38 +00:00
import_obj.py [#18694] Added support for Wavefront OBJ groups for both the import and export scripts 2009-05-13 00:20:14 +00:00
import_web3d.py [#18329] VRML import on indexedfaceset munges some colors (off by one) 2009-04-13 06:50:02 +00:00
lightwave_export.py [#18695] Replace python errors with useful messages when no full python installation is found 2009-05-05 21:51:54 +00:00
lightwave_import.py py 2.3 compat for lightwave_import and wizard_curve2tree 2008-10-21 00:21:02 +00:00
md2_export.py [#11172] md2 export bug(s) 2009-04-23 11:59:13 +00:00
md2_import.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
mesh_boneweight_copy.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
mesh_cleanup.py cleanup mesh materials option was setting incorrect material indicies 2008-09-03 03:24:01 +00:00
mesh_edges2curves.py * bpy curve api wouldn't give correct errors for bad arguments when appending nurbs. 2008-12-24 15:46:26 +00:00
mesh_mirror_tool.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
mesh_poly_reduce_grid.py Script written for apricot, poly reduces based on known topologies, keeping edge loops unlike edge collapsing poly reduction. 2009-04-02 11:30:27 +00:00
mesh_poly_reduce.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
mesh_skin.py wizard_curve2tree.py - always use active object (local view was messing up the context) 2007-11-21 11:53:30 +00:00
mesh_solidify.py PyAPI. 2007-04-18 14:40:01 +00:00
mesh_unfolder.py ==Unfolder python script update== 2007-10-24 09:02:58 +00:00
mesh_wire.py mesh_wire.py - gave an error with no faces, 2007-11-22 16:30:14 +00:00
ms3d_import_ascii.py [#8540] Import scripts for MilkShape3D file formats 2008-09-23 00:49:44 +00:00
ms3d_import.py Merged 15170:15635 from trunk (no conflicts or even merges) 2008-07-18 23:35:34 +00:00
obdatacopier.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
object_active_to_other.py new script to copy the active object to all other selected objects transformation. 2009-05-11 00:56:48 +00:00
object_apply_def.py render layer saving script assumed scriptsdir existed. 2008-05-09 17:13:03 +00:00
object_batch_name_edit.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
object_cookie_cutter.py Fix some spelling errors. 2009-05-04 16:03:54 +00:00
object_drop.py added an option for python Draw.UIBlock(func, mouse_exit) so moving the mouse outside the popup wont close it. 2008-10-22 08:21:43 +00:00
object_find.py object_find, didnt get images from an objects material textures 2008-09-06 17:04:54 +00:00
object_random_loc_sz_rot.py This commit fixes up a bunch of svn properties to hopefully make things a little nicer for everyone. 2007-08-28 10:07:08 +00:00
object_sel2dupgroup.py uvcalc_lightmap, UVCalc menu, usefull for using the most texture area when baking lightmaps 2007-02-19 10:54:33 +00:00
object_timeofs_follow_act.py outliner messed up shift+clicking on linked objects - would display their library path rather then selecting them. displaying library path could be useful but should add elsewhere. 2008-01-22 00:56:35 +00:00
off_export.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
off_import.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
paths_import.py soc-2008-mxcurioni: merged changes to revision 14798, compilation works for rendering/ directry. Still needs to figure out how to compile on non-Unix machines. 2008-05-11 20:28:47 +00:00
ply_export.py fix for [#17871] PLY file import: blender seems to loose vertex color information 2008-10-20 13:36:18 +00:00
ply_import.py [#18388] PLY Import fails if line ending is not \n 2009-03-10 06:58:42 +00:00
raw_export.py Merged changes from trunk to soc-2008-mxcurioni, to revision 14603 2008-04-28 19:21:51 +00:00
raw_import.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
renameobjectbyblock.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
render_save_layers.py === Blender Python API === 2008-10-19 21:39:50 +00:00
rvk1_torvk2.py Merged 15771:15912 from trunk 2008-08-01 23:39:52 +00:00
save_theme.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
scripttemplate_background_job.py minor corrections 2009-01-16 10:51:30 +00:00
scripttemplate_camera_object.py Clean up for the imminent migration from SVN to GIT. 2009-03-31 22:34:34 +00:00
scripttemplate_gamelogic_basic.py update script templates for new BGE api attributes 2009-05-11 00:19:55 +00:00
scripttemplate_gamelogic.py update script templates for new BGE api attributes 2009-05-11 00:19:55 +00:00
scripttemplate_ipo_gen.py fix header text 2008-09-28 13:51:30 +00:00
scripttemplate_mesh_edit.py was missing editmode exit in script template 2007-06-10 17:28:21 +00:00
scripttemplate_metaball_create.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
scripttemplate_object_edit.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
scripttemplate_pyconstraint.py Bugfix #8710: 2008-03-23 02:28:24 +00:00
scripttemplate_text_plugin.py Script template added for text plug-ins 2008-07-21 10:07:03 +00:00
slp_import.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
sysinfo.py Merge of first part of changes from the apricot branch, especially 2008-09-04 20:51:28 +00:00
textplugin_functiondocs.py Improvements to the base BPyTextPlugin module: 2008-08-15 23:14:22 +00:00
textplugin_imports.py Speed improvements for reading text lines and the option to specify a range for Text.asLines([start[, end]]) Also some tweaks for the plug-in scripts and updates to pydocs. 2008-08-12 15:17:08 +00:00
textplugin_membersuggest.py Improvements to the base BPyTextPlugin module: 2008-08-15 23:14:22 +00:00
textplugin_outliner.py Speed improvements for reading text lines and the option to specify a range for Text.asLines([start[, end]]) Also some tweaks for the plug-in scripts and updates to pydocs. 2008-08-12 15:17:08 +00:00
textplugin_suggest.py Improvements to the base BPyTextPlugin module: 2008-08-15 23:14:22 +00:00
textplugin_templates.py Fix for text plug-in scripts on 64-bit platforms. 2008-08-26 17:09:17 +00:00
unweld.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
uv_export.py Made the remaining UV py scripts work with editmesh now. 2007-09-24 09:40:09 +00:00
uv_seams_from_islands.py Merged from trunk 2008-06-09 14:04:19 +00:00
uvcalc_follow_active_coords.py [#18082] make uvcalc_follow_active_coords.py bypass the gui and accept arguments when called from another script 2009-01-12 04:07:06 +00:00
uvcalc_lightmap.py more python 2.3 compat, should be the last of it. 2008-10-21 09:08:46 +00:00
uvcalc_quad_clickproj.py [#18082] make uvcalc_follow_active_coords.py bypass the gui and accept arguments when called from another script 2009-01-12 04:07:06 +00:00
uvcalc_smart_project.py [#18478] Unwrap (smart projections) should accept values grater than 0.25 for island margin (it works just fine when changed in original script) 2009-04-01 02:02:26 +00:00
uvcopy.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
vertexpaint_from_material.py script was adding UV's rather then vertex Colors (this was correct before uv & vcol layers existed) 2008-12-30 08:25:36 +00:00
vertexpaint_gradient.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
vertexpaint_selfshadow_ao.py fixes for bugs submitted by BGE users, fixes by myself and Mitchell Stokes 2009-05-03 09:21:58 +00:00
vrml97_export.py vrml exporting with images was broken. 2008-10-14 23:43:08 +00:00
weightpaint_average.py simple weight invert script for the weightpaint menu, removed a print from weightpaint_average.py 2007-11-19 10:17:55 +00:00
weightpaint_clean.py Merge from trunk: 15912:16031 2008-08-09 10:12:59 +00:00
weightpaint_copy.py dont use tface hide or select anymore, since maintaining 2 sets of hide/select data for each face is annoying. 2007-04-29 13:39:46 +00:00
weightpaint_envelope_assign.py toolbox.c - for the label in VarStruct use the tooltip for the text to get around the 15 char limit that only allowed you to fill about half of the available area on the clever numbuts panel, 2007-01-04 11:43:13 +00:00
weightpaint_gradient.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
weightpaint_grow_shrink.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
weightpaint_invert.py typo in Text3d, weightpaint_invert wasnt working properly 2007-11-19 10:49:12 +00:00
weightpaint_normalize.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
widgetwizard.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00
wizard_bolt_factory.py bolt wizard from Aaron Keith (Spudmn), edits from Brendon and myself. 2009-05-11 05:10:09 +00:00
wizard_curve2tree.py more python 2.3 compat, should be the last of it. 2008-10-21 09:08:46 +00:00
wizard_landscape_ant.py Another Noise Tool svn commit is complaining about mixed line endings so after 16 attempts I wont include the full message 2009-05-11 12:38:24 +00:00
x3d_export.py * added support for exporting dupli objects 2008-05-07 15:38:40 +00:00
xsi_export.py added ipo script template from blenderartists forTe, made scripts refresh on load factory settings and replaced elysiun with blenderartist.org in headers 2008-04-23 14:04:05 +00:00