Commit Graph

87 Commits

Author SHA1 Message Date
Campbell Barton
831a1fa91d Added MVert.hide property because hidden verts were hanging BPyMesh_Redux 2006-05-11 20:35:43 +00:00
Campbell Barton
0497ea57cb Added a polygon reduction function that can poly reduce any mesh and supports UV's as well as bone weights (Thanks to briggs).
Isnt intended to be ultra high quality, more for automatic realtime "Level of Detail" model generation.

BPyMesh.redux(ob, 0.5) # To reduce to about half the polys
2006-05-11 12:42:10 +00:00
Campbell Barton
a3783d32e0 Added some shortcuts to Mesh
MFace.area
 MFace.cent
 MEdge.length

Updated some scripts that used these.
2006-05-11 10:06:15 +00:00
Campbell Barton
8f84542c23 Modified mesh to allow writing to normals.
renamed meshPrettyNormals to meshCalcNormals, and it now writes to normals rather then returning a list of vecs.
updated vertexpaint_selfshadow_ao to be a bit more efficient and make use of the above changes.
2006-05-10 12:12:21 +00:00
Campbell Barton
41623cbdb9 made mesh's getFromObject pick the materials from object or obdata as set by the objects colbits.
its crufty that None of the exports currently export materials correctly, hopefully this will help.
2006-05-10 01:38:02 +00:00
Campbell Barton
8255bdce57 Added a self shadowing script accessed from the vertex paint menu, it does a fake ao thats more pradictable then radio baking and fairly fast.
Also assed a function to calculate high quality normals (normals are the same even for different topologys).
2006-05-07 14:09:46 +00:00
Campbell Barton
52d50b3cbc fix removal of groups for non selected verts.
removed debug prints
2006-04-24 11:34:16 +00:00
Campbell Barton
11586835da Added utility functions to BPyMesh.py
- dictWeightFlipGroups, return a vert weight with flipped group names.
- dictWeightMerge, takes a list of dictWeights and merges them

mesh_mirror_tool.py
Added vertex weight support for the mirror tool, its able to mirror arbitary meshes weights with optional name flipping and creation of name flipped groups.
This also uses the mode for l<>r, l>r, r>l so you can copy from left to right only for eg.
2006-04-24 11:26:04 +00:00
Campbell Barton
9c322c7e86 Moved ngon creating function from obj_import into BPyMesh so other importers can use it.
Exporter free's mesh vertex data each run (was causing memory errors when exporting fluidsim meshes... poke ken for Mesh.Unlink() since many meshes are still created)
Exporter had an indentation error also.
Added an NMesh wrapper around Mesh for importers to use, so as to work around slow 1 by 1 adding of data. used in upcoming flt_importer update.
Mesh cleanup now has the dangerous option to perform a cleanup on ALL mesh data. (needed it for a project)
2006-04-10 21:42:18 +00:00
Campbell Barton
61ad9e26c6 Did some changes to the getMeshFromObject wrapper.
Made obj_export use getMeshFromObject

obj_export now copies images from mtex as well as texface when copy images enabled.
obj_export tested to work with exporting fluidsim animations (somebody reported it was broken, must have been fixed at some point?)
2006-04-07 00:47:39 +00:00
Campbell Barton
086cb9d793 Added BPyMesh for mesh python mesh functions.
at the moment it only has meshWeight2Dict and dict2MeshWeight
  These allow you to deal with vertex weights as a list of dicts which makes scrips short and easy to understand.
   (kh_python, perhaps dict access to the python verts could replace this )

Used the above util functions to update mesh_cleanup.
Copied from the source

	'Material Clean', 'Remove unused materials.'
	'VGroups'
	'Group Clean', 'Remove vertex groups that have no verts using them.'
	'Weight Clean', 'Remove zero weighted verts from groups (limit is zero threshold).'
	'Weight Normalize', 'Make the sum total of vertex weights accross vgroups 1.0 for each vertex.'

Normalizing lets you see how much % of the vertex a bone owns just by looking at 1 of the bone weights.

Would be nice to have this functionality in Blender but theres not much room for new buttons in teh vgroup and material area :/
2006-04-05 18:54:38 +00:00
Campbell Barton
58c6550a7c Removed debug printing. 2006-03-31 02:35:16 +00:00
Campbell Barton
a05b2090a9 Fixed some bugs in BPyImage comprehensive loade. (used by 3ds and obj import)
OBJ Importer,
Added true FGon support for faces >4 verts. (Does a propper scanfill and optionaly converts it to an FGON.) - Checks for flipping, uses a face fan when scanfill fails.
Added the option to split by materials, into seperate mesh objects (Good for large databases)
Made smoothGroups optional.
2006-03-29 18:25:42 +00:00
Campbell Barton
528ea06531 Updated to use Blender.sys.exists() which now uses BLI_exist rather then stat. 2006-03-19 13:31:44 +00:00
Campbell Barton
f356eac8a4 Update box unpack with faster python use
Update image loader, optional arg for not autocreating the image. - aslo removed some stuff that shouldent have been left in.
  Workaround for a bug in Blender.sys.exists()... should fix soon.
2006-03-18 11:41:07 +00:00
Campbell Barton
afeba9462e Support win32 paths. 2006-03-14 20:27:27 +00:00
Campbell Barton
c8ff92d965 Added a function for importers to use, comprehensive image loader takes an imagepath and a file path- and imports the image, if it exists it uses the one alredy loaded or does a realy good job of finding the right image case insensitite if the normal path is not found. looks in all the logical places for the image- If teh image isnt found then a new dummy image is returned.
The nice thing about this is you can request an image and  you know youll get an image back- without doing your own error handeling.
2006-02-01 10:31:49 +00:00
Willian Padovani Germano
4b01aa7aa5 Scripts:
The orange -> HEAD merge reverted some scripts to older versions. This only
affected the ones that already existed before the orange branch.
Minor issue, easy to fix.

All in all, kudos to kaito, Hos and others for all the hard work in
bringing (coding, merging) all these changes to the main branch.
2006-01-29 19:17:53 +00:00
no-author
e8afec9f9a This commit was manufactured by cvs2svn to create branch 'orange'. 2006-01-26 22:47:31 +00:00
Tom Musgrove
067c6717c5 ==scripts==
updated svg import - it is better than the last version, and apparently works perfect on linux - but some issues on windows? work done by jms
2006-01-22 21:15:23 +00:00
Campbell Barton
d498ae5104 Fixed a bug in boxpack that archimap not to clear data between uses, and become progressivly slower.
Updated Archimap to set UV's aslists (dont need to convert to tuples anymore)
2006-01-12 03:34:37 +00:00
Willian Padovani Germano
ad579abf00 Scripts:
Final (?) updates for 2.40 :) :

- Bob Holcomb sent a better version of his 3ds importer
- Added doc info to bvh2arm: links to doc and mocap tute from author
Jean-Baptiste Perin
- Alessandro Pirovano improved the Lightwave importer.
- Mikael Lagre updated the collada scripts (fixed a bug with camera
lens value)
- Adam Saltsman improved the wings importer (ongoing work with
his pal Toastie).
- Anthony D'Agostino GPL'd his scripts (used Blender's BAL
license previously)

Thanks to all script authors for their work, interest and kindness.
Again, Tom (LetterRip) has played an important part in this, thanks and
welcome :).
2005-12-19 17:21:55 +00:00
Campbell Barton
c9de5c5b05 Seperated out archimaps generic 2d boxpacking function.
For anyone who is interested in boxpacking the logic isnt
that complex and lscm could benifit from using it.

Archimap will use this rather then having the boxpacker inline.
2005-12-18 21:35:31 +00:00
Willian Padovani Germano
a5aacefbfc Scripts: Jean-Michel updated his rvk1 to rvk2 script (thanks); small fix in BPyRegistry module to remove empty config keys instead of causing an error 2005-11-04 16:30:38 +00:00
Simon Clitherow
0d734795db A few leftover py2.3 -> py2.4 changes:
- updated python24.zip to include all required module dependancies.
- updated zlib.pyd to py24 zlib.pyd - now it opens the zip file (thanks ianwill!)
- removed whrandom module from basic_modules (deprecated in py24)
2005-10-30 19:19:38 +00:00
Willian Padovani Germano
5c31e9f2b5 Scripts updated:
- Discombobulator by Evan R and DirectX8 Exporter by Ben Omari.

BPython:
- Crashed Blender while testing discombobulator: obj.setMaterials() was not checking if the passed obj had valid obj->data. If the object had been created and not linked yet to a mesh, a crash would happen when trying to sync ob and me material lists. Now an error is returned. Also made obj.setMaterials accept an empty list, since obj.getMaterials can return that.

Thanks to the script authors for the updated versions and special thanks to Tom (LetterRip) for collecting info about updated and new scripts, sending me updates I had missed, etc.
2005-10-11 19:05:56 +00:00
Willian Padovani Germano
f6ff9ec608 Scripts updated:
- Jean-Michel Soler: 1) paths import -- ai module; 2) tex2uvbaker;
- Campbell Barton: obj exporter.

BPython:
- Campbell also provided a patch (+docs) to add shader data access to Blender.Material.

Again, thanks guys and sorry for the long delay.
2005-08-01 03:06:24 +00:00
Willian Padovani Germano
399f670ac7 Scripts updated:
- Jean-Michel Soler: paths import -- ai and svg modules;
- Jean-Baptiste PERIN: bvh to armatures (note: should not work until we re-wrap armatures in bpython);
- Campbell Barton: obj importer.

Thanks guys, excuse me the delay.

- tiny doc update.
2005-07-11 02:41:08 +00:00
Willian Padovani Germano
e5b527c629 Scripts:
- Jean-Michel Soler updated his paths importer (svg part) -- ongoing work related to this bug report by intrr:
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2674&group_id=9

- small doc update in paths import about some imported curves needing "enter edit mode, select all points, toggle cyclic (press 'c')" to show up correctly;

- old vrml 2 exporter's menu name and tooltip updated to clarify that it is the old version, soon to be removed (in favor of the already included vrml 97 update by Bart).  Also prints a msg about it to the console when used.

Thanks all.
2005-06-12 23:40:46 +00:00
Willian Padovani Germano
3d4438dcd7 Scripts:
- Campbell Barton updated his Wavefront obj importer;
- Jean-Michel Soler updated his paths import (eps part).

BPython bug fixes:

- oldie found by Ken Hughes: reference count of two pyobjects not being decremented in slider callback (Draw.c):
http://projects.blender.org/tracker/index.php?func=detail&aid=2727&group_id=9&atid=127

- Gergely Erdelyi found that setText() in Text3d module was not updating str length var, leading to mem corruption and provided a patch:
http://projects.blender.org/tracker/?func=detail&aid=2713&group_id=9&atid=127

- doc updates (suggested by Campbell)

Thanks guys.
2005-06-12 05:54:15 +00:00
Willian Padovani Germano
6cec51b259 BPython bug fixes:
- #2646 reported by Campbell: Python/Fileselector (moving from fileselector called by script to another space caused script to hang around open but not accessible)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2646&group_id=9

- #2676 reported by Wim Van Hoydonck: 2.37 python scripts gui: event 8 ignored (thanks Ton for discussing / pointing what to do, Ken Hughes for also working on a fix)
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2676&group_id=9

- gui-less scripts with calls to progress bar inside fileselector callbacks didn't return to the previous space on exit (staying on Scripts win), requiring an event to do so (mouse movement, for example).  Quick fix for now, will rework a little after 2.37a for a better alternative, not needing to move to the Scripts win at all.

- added syntax colors access to Window.Theme module.

Scripts:

- updates by Jean-Michel Soler: svg2obj (svg paths import), tex2uvbaker, fixfromarmature;
- updates by Campbell Barton: obj import / export, console;
- tiny: converted vrml97 export to unix line endings;
- updates in ac3d exporter, help browser, save theme.

Thanks all mentioned above.
2005-06-11 05:30:14 +00:00
Willian Padovani Germano
4b99e61cf2 No "release ahoy" yet, so it's probably still ok for these last minute updates (excuse me anyway):
Script bug fixes:
- Paths import: SVG update sent by author Jean-Michel Soler;
- Wavefront OBJ import / export updates sent by author Campbell Barton.
2005-05-30 02:26:40 +00:00
Willian Padovani Germano
7753547b70 No cvs freeze msg yet, so thought I could go with a last minute new script:
Scripts:
- license info for camera changer (thanks Tom for pointing), made it GPL since it's stricter and so can be "downgraded" w/o problems, but emailed the author to confirm and if necessary will fix before release.

- adding Discombobulator by Evan J. Rosky (in Mesh menu):
http://evan.nerdsofparadise.com/programs/discombobulator/index.html

This is a fun script to play with, giving quite interesting results.  It's good for that "high-tech" look in buildings, spaceships and walls.  Thanks Evan for contributing it.  GUI should have further updates in the future, like an added "horizontal" layout.  (Note: ignore mention in its online docs of a problem with edit mode, the script was fixed.)
2005-05-17 19:56:29 +00:00
Willian Padovani Germano
859959b49c BPython:
- fixing bug reported by Paolo Colombo: space handler slinks set for a 3d view were not set when the area got maximized;
- Blender.Object: added object.isSB() method to know if an object is a soft body (has ob->soft != NULL).  Used in fixfromarmature.py.

Scripts:
- updates: batch_name_edit (Campbell), fixfromarmature (JMS);
- additions:
   X3D exporter by Bart;
   Envelope Suite by Jonas Petersen;
   BVH 2 Armature by Jean-Baptiste Perin;
   Camera Changer by Regis Montoya (3R);
   Interactive Console by Campbell (ideasman).
- tiny updates in other scripts.
2005-05-17 07:17:52 +00:00
Willian Padovani Germano
589ce4a005 BPython:
- based on a request by Campbell (he also provided a patch for scene.Layer) access to layers was improved a little, keeping the old method (ob.Layers is a bitmask) and adding the nicer one (ob.layers is a list of ints).  Done for objects and scenes.  House-cleaning: .Layer was renamed to .Layers (actually just using strncmp instead of strcmp, so both work, same done for Window.ViewLayers).
- finally committing patch by Ken Hughes to let .clearScriptLinks() accept a parameter (list of strings) to clear only specified texts.
- doc updates and fixes (JMS reported a problem in nmesh.transform() example code).

Thanks all who contributed.
2005-04-21 19:44:52 +00:00
Willian Padovani Germano
d65fc84a68 Note: this commit includes new functionality to save and restore scripts configure options. This is ongoing work, scripts still have to be updated to use this feature and more tests are needed, though many have been performed. The new Scripts Config Editor script is the main part of this. If anyone wants to check it, only the AC3D importer and exporter have already been updated to use it: simply open them (you can then cancel with ESC) to have the data created, then try the config editor.
Scripts:
- Thanks Jean-Michel Soler (jms) for updated versions of dispaint, fixfromarmature and unweld (also renamed to remove version part).
- Thanks Bart for the upgraded VRML exporter (great doc webpage!).  It is available as VRML 97 and the original VRML 2 is for now still there, to help users testing the new version.  For the next release the old one should be removed, of course.
- New script: Scripts Config Editor (Scripts win -> Scripts -> System).  Scripts with config options (simple data that is to be set according to user needs or preferences) can use this facility instead of providing a gui and writing config files to disk themselves.
- Added new menu: System, available in the Scripts win.
- Updated sys_info.py, help_browse.py and the AC3D importer and exporter.
- Removed use of the Scrollbar and added arrow keys and mouse wheel support instead in Daniel Dunbar's old doc_browser.py. The scrollbar events handling doesn't exist, Ton suggested removing the scrollbar from the API months ago.  For now its ref doc is gone and no bundled script uses it, until we get time to implement it properly.
- Added module BPyRegistry.py with functions to handle reading / writing config files automatically to the scripts/bpydata/config dir.
- Removing dir release/bpydata and its contents (moved earlier to release/scripts/bpydata/)
- Bug #2379: made small changes to bevel_center's ui to fix a problem reported by Alexander Ewering (intrr):
http://projects.blender.org/tracker/?func=detail&atid=125&aid=2379&group_id=9

BPython:
- Thanks Campbell Barton for new functionality: Blender.Get() now can also return all the paths from the user prefs -> file paths win and there is a new function: Blender.sys.expandpath() to transform Blender paths (those starting with '//' and ending with '#') to absolute paths.
- Added function Blender.ShowHelp(), to open the Scripts Help Browser with a given help page -- just a time saver for scripts.
- Improved function Blender.Run() to also work with gui and file select scripts.
- Found a (new?) crash related to NMesh.PutRaw when creating a new object while in edit mode.  Leaving / entering edit mode fixes the problem, so a check for obj created, edit mode and leaving / re-entering it were added to the code for now (gdb didn't help much, no backtrace)
- doc updates, including splitting intro page in two, with bpython related stuff (registering / documenting / configuring scripts and command line mode (thanks Chris Want for "use system variables to pass parameters to scripts" idea).
- Registry: functions have been updated to support writing to / reading from disk, for the config editor -- only simple config data supported, for large amounts coders should write to a file themselves.  This is done with a new parameter: Registry.GetKey(keyname, True) will also search for the key on the config dir, if not already loaded; equiv. for Registry.SetKey(keyname, dict, True).  Data is only written to / read from disk when needed and only scripts already used (assuming they support this functionality) will have config data saved.
2005-04-16 05:25:42 +00:00
Willian Padovani Germano
62147bba30 Scripts (making some changes to the scripts dir):
- moved bpydata/ to scripts/bpydata/ and added a config/ subdir to it;
- created scripts/bpymodules for py modules (also got rid of those "mod_"'s appended to the files);
- updated scripts accordingly.

This will require you to "reinstall" (just copy the scripts/ dir over your older one) if you have a .blender/scripts/ dir somewhere.  Otherwise some scripts won't work.  You can use the updated "Help->System->System Information" script here to check all is fine.  An installer script yet to be written will help users with these issues, specially to make the user defined dir have the same structure expected from the default scripts dir, so the basic facilities (module search; saved config data; scripts: installer, help browser, config editor) are also available for a user's own collection of written and downloaded scripts.

BPython:
- slikdigit's crash was because he had no <home or blender exe location>/.blender/:
  proper check added and also now if all else fails the <cvsblender>/release/scripts/ dir is also searched for scripts.  All this registration dirs stuff is a little messy (installation!), so please report any troubles (I only tested on linux).
- slight change in error report in BPY_interface.c's BPY_menu_do_python; remembering to set globaldict pointer to NULL there, too.
- moved bpy_gethome() to EXPP_interface.[ch]
- "//" as user defined python dir is ignored while looking for scripts, considering it's only a default some users use, not really meant for a scripts dir.
2005-03-21 05:26:52 +00:00