diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-11-13 00:16:53 +0300 |
commit | bdfe7d89e2f1292644577972c716931b4ce3c6c3 (patch) | |
tree | d00eb50b749cb001e2b08272c91791e66740b05d /release/scripts/scripttemplate_metaball_create.py | |
parent | 78a1c27c4a6abe0ed31ca93ad21910f3df04da56 (diff) | |
parent | 7e4db234cee71ead34ee81a12e27da4bd548eb4b (diff) |
Merge of trunk into blender 2.5:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r12987:17416
Issues:
* GHOST/X11 had conflicting changes. Some code was added in 2.5, which was
later added in trunk also, but reverted partially, specifically revision
16683. I have left out this reversion in the 2.5 branch since I think it is
needed there.
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16683
* Scons had various conflicting changes, I decided to go with trunk version
for everything except priorities and some library renaming.
* In creator.c, there were various fixes and fixes for fixes related to the -w
-W and -p options. In 2.5 -w and -W is not coded yet, and -p is done
differently. Since this is changed so much, and I don't think those fixes
would be needed in 2.5, I've left them out.
* Also in creator.c: there was code for a python bugfix where the screen was not
initialized when running with -P. The code that initializes the screen there
I had to disable, that can't work in 2.5 anymore but left it commented as a
reminder.
Further I had to disable some new function calls. using src/ and python/, as
was done already in this branch, disabled function calls:
* bpath.c: error reporting
* BME_conversions.c: editmesh conversion functions.
* SHD_dynamic: disabled almost completely, there is no python/.
* KX_PythonInit.cpp and Ketsji/ build files: Mathutils is not there, disabled.
* text.c: clipboard copy call.
* object.c: OB_SUPPORT_MATERIAL.
* DerivedMesh.c and subsurf_ccg, stipple_quarttone.
Still to be done:
* Go over files and functions that were moved to a different location but could
still use changes that were done in trunk.
Diffstat (limited to 'release/scripts/scripttemplate_metaball_create.py')
-rw-r--r-- | release/scripts/scripttemplate_metaball_create.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/release/scripts/scripttemplate_metaball_create.py b/release/scripts/scripttemplate_metaball_create.py new file mode 100644 index 00000000000..28db9de3af6 --- /dev/null +++ b/release/scripts/scripttemplate_metaball_create.py @@ -0,0 +1,76 @@ +#!BPY +""" +Name: 'Metaball Generation' +Blender: 245 +Group: 'ScriptTemplate' +Tooltip: 'Script template to make metaballs from a mesh' +""" + +from Blender import Window +import bpy + +script_data = \ +'''#!BPY +""" +Name: 'My Metaball Script' +Blender: 245 +Group: 'Misc' +Tooltip: 'Put some useful info here' +""" + +# Add a license here if you wish to re-disribute, we recommend the GPL + +from Blender import Metaball, Mesh, Window +import bpy + +def makeMetaSculpture(sce): + #Create a base mesh for our sculpture to use + monkey = Mesh.Primitives.Monkey() + + #Create a new meta datablock to use and give it a name + metaObj = Metaball.New() + metaObj.name = "MetaSuzanne" + + #Increase the resolution so it looks better + metaObj.wiresize = 0.2 + metaObj.rendersize = 0.1 + + #The radius for our new meta objects to take + metaRadius = 2.0 + + for f in monkey.faces: + + #Create a new metaball as part of the Meta Object Data + newBall = metaObj.elements.add() + + #Make the new ball have the same coordinates as a vertex on our Mesh + newBall.co = f.cent + + #Assign the same radius to all balls + newBall.radius = f.area * metaRadius + + #Create the new object and put our meta data there + sce.objects.new(metaObj, "MetaSuzanne") + + +def main(): + scene = bpy.data.scenes.active #Get the active scene + + Window.WaitCursor(1) + + #Call the sculpture making function + makeMetaSculpture(scene) + + Window.WaitCursor(0) + + #Redraw the Screen When Finished + Window.RedrawAll(1) + +if __name__ == '__main__': + main() +''' + +new_text = bpy.data.texts.new('metaball_template.py') +new_text.write(script_data) +bpy.data.texts.active = new_text +Window.RedrawAll() |