diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-05-21 19:26:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-05-21 19:26:50 +0400 |
commit | ae5c665abe85c826c534d9d5cedd0048326c7073 (patch) | |
tree | 5df23c72f9389005a851c8682ef38982cb8210b7 /release | |
parent | e176e471f13d8754f2436a701150b546f507e7dd (diff) |
updated rvk1_torvk2 from JMS and added GPL headers
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/bpymodules/ai2obj.py | 47 | ||||
-rw-r--r-- | release/scripts/bpymodules/gimp2obj.py | 41 | ||||
-rw-r--r-- | release/scripts/paths_import.py | 46 | ||||
-rw-r--r-- | release/scripts/rvk1_torvk2.py | 347 |
4 files changed, 302 insertions, 179 deletions
diff --git a/release/scripts/bpymodules/ai2obj.py b/release/scripts/bpymodules/ai2obj.py index 31072ffb2be..dcf56853184 100644 --- a/release/scripts/bpymodules/ai2obj.py +++ b/release/scripts/bpymodules/ai2obj.py @@ -1,14 +1,50 @@ """ +paths_ai2obj.py +# --------------------------------------------------------------- +Copyright (c) jm soler juillet/novembre 2004-april 2007, +# --------------------------------------------------------------- + released under GNU Licence + for the Blender 2.45 Python Scripts Bundle. +Ce programme est libre, vous pouvez le redistribuer et/ou +le modifier selon les termes de la Licence Publique Générale GNU +publiée par la Free Software Foundation (version 2 ou bien toute +autre version ultérieure choisie par vous). + +Ce programme est distribué car potentiellement utile, mais SANS +AUCUNE GARANTIE, ni explicite ni implicite, y compris les garanties +de commercialisation ou d'adaptation dans un but spécifique. +Reportez-vous à la Licence Publique Générale GNU pour plus de détails. + +Vous devez avoir reçu une copie de la Licence Publique Générale GNU +en même temps que ce programme ; si ce n'est pas le cas, écrivez à la +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +MA 02111-1307, États-Unis. + + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# --------------------------------------------------------------- #---------------------------------------------- -# (c) jm soler juillet 2004-juin 2005, -# released under Blender Artistic Licence -# for the Blender 2.34 Python Scripts Bundle. -#---------------------------------------------- +# # Page officielle : # http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_import_ai_en.htm # Communiquer les problemes et erreurs sur: # http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender -# +#---------------------------------------------- +#---------------------------------------------- +#Chagelog +#---------------------------------------------- # 0.1.1 : 2004/08/03, bug in boudingbox reading when Value are negative # 0.1.2 : 2005/06/12, gmove tranformation properties # 0.1.3 : 2005/06/25, added a __name__ test to use the script alone @@ -21,7 +57,6 @@ # 0.1.8 : 2006/07/03, two more closepath improvements # 0.1.9 : 2007/05/06, modif on the method that gets the last object on the list data - """ SHARP_IMPORT=0 SCALE=1 diff --git a/release/scripts/bpymodules/gimp2obj.py b/release/scripts/bpymodules/gimp2obj.py index 8e258467db1..8b31c5d7294 100644 --- a/release/scripts/bpymodules/gimp2obj.py +++ b/release/scripts/bpymodules/gimp2obj.py @@ -1,7 +1,42 @@ """ #---------------------------------------------- -# (c) jm soler juillet 2004, released under Blender Artistic Licence -# for the Blender 2.34 Python Scripts Bundle. +# (c) jm soler juillet 2004, +#---------------------------------------------- + released under GNU Licence + for the Blender 2.45 Python Scripts Bundle. +Ce programme est libre, vous pouvez le redistribuer et/ou +le modifier selon les termes de la Licence Publique Générale GNU +publiée par la Free Software Foundation (version 2 ou bien toute +autre version ultérieure choisie par vous). + +Ce programme est distribué car potentiellement utile, mais SANS +AUCUNE GARANTIE, ni explicite ni implicite, y compris les garanties +de commercialisation ou d'adaptation dans un but spécifique. +Reportez-vous à la Licence Publique Générale GNU pour plus de détails. + +Vous devez avoir reçu une copie de la Licence Publique Générale GNU +en même temps que ce programme ; si ce n'est pas le cas, écrivez à la +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +MA 02111-1307, États-Unis. + + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +""" + +# --------------------------------------------------------------- # last update : 07/05/2007 #---------------------------------------------- # Page officielle : @@ -9,7 +44,7 @@ # Communiquer les problemes et erreurs sur: # http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender #--------------------------------------------- -""" + SHARP_IMPORT=0 SCALE=1 diff --git a/release/scripts/paths_import.py b/release/scripts/paths_import.py index 08f12294ee6..f36454978ba 100644 --- a/release/scripts/paths_import.py +++ b/release/scripts/paths_import.py @@ -36,30 +36,60 @@ Notes:<br> """ #---------------------------------------------- -# (c) jm soler juillet 2004, released under Blender Artistic Licence -# for the Blender 2.34 Python Scripts Bundle. +# (c) jm soler juillet 2004, released under GPL +# for the Blender 2.45 Python Scripts Bundle. #---------------------------------------------- +""" +Ce programme est libre, vous pouvez le redistribuer et/ou +le modifier selon les termes de la Licence Publique Générale GNU +publiée par la Free Software Foundation (version 2 ou bien toute +autre version ultérieure choisie par vous). + +Ce programme est distribué car potentiellement utile, mais SANS +AUCUNE GARANTIE, ni explicite ni implicite, y compris les garanties +de commercialisation ou d'adaptation dans un but spécifique. +Reportez-vous à la Licence Publique Générale GNU pour plus de détails. + +Vous devez avoir reçu une copie de la Licence Publique Générale GNU +en même temps que ce programme ; si ce n'est pas le cas, écrivez à la +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +MA 02111-1307, États-Unis. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" import Blender argv=__script__['arg'] if argv=='SVG': - from svg2obj import * + from paths_svg2obj import * fonctionSELECT = functionSELECT # can they all be called function? elif argv=='AI': - from ai2obj import * + from paths_ai2obj import * elif argv=='EPS': - from eps2obj import * + from paths_eps2obj import * elif argv=='Gimp_1_0': - from gimp2obj import * + from paths_gimp2obj import * elif argv=='Gimp_2_0': - from svg2obj import * + from paths_svg2obj import * fonctionSELECT = functionSELECT # can they all be called function? text = 'Import %s' % argv -Blender.Window.FileSelector (fonctionSELECT, text) +Blender.Window.FileSelector (fonctionSELECT, text)
\ No newline at end of file diff --git a/release/scripts/rvk1_torvk2.py b/release/scripts/rvk1_torvk2.py index 0df35b887c2..754d2d0af2d 100644 --- a/release/scripts/rvk1_torvk2.py +++ b/release/scripts/rvk1_torvk2.py @@ -1,8 +1,8 @@ #!BPY """ Registration info for Blender menus: <- these words are ignored -Name: 'Rvk1 to Rvk2' -Blender: 234 +Name: 'Deformed mesh to Rvk' +Blender: 243 Group: 'Mesh' Tip: 'Copy deform data (not surf. subdiv) of active obj to rvk of the 2nd selected obj' """ @@ -11,10 +11,10 @@ __author__ = "Jean-Michel Soler (jms)" __url__ = ("blender", "elysiun", "Script's homepage, http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_rvk1versrvk2.htm", "Communicate problems and errors, http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender") -__version__ = "2007/02" +__version__ = "2007/04/27" __bpydoc__ = """\ -"RVK1 to RVK2" copies deform data (except EDGESPLIT,DECIMATE,SUBSURF,BOOLEAN, +"DEFORM to RVK2" copies deform data (except EDGESPLIT,DECIMATE,SUBSURF,BOOLEAN, BUILD,MIRROR,ARRAY) of the active object to the RVK (relative vertex key) of the other selected object. @@ -39,11 +39,39 @@ the rvk it will also ask whether it should replace or add a new vertex group. """ #---------------------------------------------- -# jm soler (c) 04/02/2007 : 'Rvk1toRvk2' release under blender artistic licence +# jm soler (c) 2004-2007 : 'Deformed mesh to Rvk' released under GPL licence #---------------------------------------------- -# Blender Artistic License -# http://download.blender.org/documentation/html/x21254.html -#---------------------------------------------------- +""" +Ce programme est libre, vous pouvez le redistribuer et/ou +le modifier selon les termes de la Licence Publique Générale GNU +publiée par la Free Software Foundation (version 2 ou bien toute +autre version ultérieure choisie par vous). + +Ce programme est distribué car potentiellement utile, mais SANS +AUCUNE GARANTIE, ni explicite ni implicite, y compris les garanties +de commercialisation ou d'adaptation dans un but spécifique. +Reportez-vous à la Licence Publique Générale GNU pour plus de détails. + +Vous devez avoir reçu une copie de la Licence Publique Générale GNU +en même temps que ce programme ; si ce n'est pas le cas, écrivez à la +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +MA 02111-1307, États-Unis. + + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" # Copy the rvk (1, or armature, lattice, or # any mesh deformation except surface # sbdivision) of the active object to rvk (2) of @@ -67,178 +95,173 @@ the rvk it will also ask whether it should replace or add a new vertex group. import Blender from Blender import NMesh,Draw,Object,Modifier +DEBUG=0 + def Value(t): exec "t=Modifier.Types.%s"%t return t -def rvk2rvk(): +def deform2rvk(): POSSMOD_list=['EDGESPLIT', - 'DECIMATE', - 'SUBSURF', - 'BOOLEAN', - 'BUILD', - 'MIRROR', - 'ARRAY'] - + 'DECIMATE', + 'SUBSURF', + 'BOOLEAN', + 'BUILD', + 'MIRROR', + 'ARRAY'] + AUTHMOD_list=['LATTICE', 'CURVE', 'WAVE', 'ARMATURE'] - + MODIFIERS=0 + BMOD=[['Possible Modifiers'], - ['Allowed Modifiers']] + ['Allowed Modifiers']] # ================================================================= # at leat 2 objects =============================================== # ================================================================= if len(Object.GetSelected())>1 : - RVK1=Object.GetSelected()[0] - RVK2=Object.GetSelected()[1] - # ============================================================= - # must be 2 meshes ============================================ - # ============================================================= - if RVK1.getType()=='Mesh' and RVK2.getType()=='Mesh': - FRAME=Blender.Get('curframe') + RVK1=Object.GetSelected()[0] + RVK2=Object.GetSelected()[1] + # ============================================================= + # must be 2 meshes ============================================ + # ============================================================= + if RVK1.getType()=='Mesh' and RVK2.getType()=='Mesh': + FRAME=Blender.Get('curframe') + DATA2=RVK2.getData() + if DEBUG: print DATA2.getKey() + # ============================================================ + # at least the second must have a shape key ================== + # ============================================================ + if DATA2.getKey(): + # ====================================================== + # in case of modifiers use ============================= + # ====================================================== + if RVK1.modifiers: + MODIFIERS=1 + POSSMOD=[Value(t) for t in POSSMOD_list] + AUTHMOD=[Value(t) for t in AUTHMOD_list] + if DEBUG: print 'POSSMOD:',POSSMOD,'\nAUTHMOD:', AUTHMOD + MODRVK1=RVK1.modifiers + block = [] + # =================================================== + # === Bloc Menu Modifiers ===1 doc ================= + # =================================================== + m=0 + for mod in MODRVK1: + if DEBUG: print mod.type + if mod.type in POSSMOD: + BMOD[0].append([Draw.Create(0),mod.type, + m, + POSSMOD_list[POSSMOD.index(mod.type)], + mod[Modifier.Settings.RENDER]==1, + mod[Modifier.Settings.EDITMODE]==1 + ]) + elif mod.type in AUTHMOD: + BMOD[1].append([Draw.Create(1), + mod.type, + m, + AUTHMOD_list[AUTHMOD.index(mod.type)], + mod[Modifier.Settings.RENDER]==1, + mod[Modifier.Settings.EDITMODE]==1 + ]) + m+=1 + # =================================================== + # === Bloc Menu Modifiers ===2 display ============= + # =================================================== + block.append(BMOD[1][0]) + for B in BMOD[1][1:]: + block.append((B[3],B[0],"")) + block.append(BMOD[0][0]) + block.append("not alredy implemented") + block.append("in this script.") + for B in BMOD[0][1:]: + block.append((B[3],B[0],"")) + retval = Blender.Draw.PupBlock("MESH 2 RVK", block) + # =================================================== + # === unset Modifiers ============================= + # =================================================== + for B in BMOD[0][1:]: + if DEBUG: print B[2] + MODRVK1[B[2]][Modifier.Settings.RENDER]=0 + for B in BMOD[1]: + if not B[1]: + MODRVK1[B[2]][Modifier.Settings.RENDER]=0 + # =================================================== + # === update Modifiers ============================= + # =================================================== + RVK1.makeDisplayList() + # ======================================================= + # === get deformed mesh ================================ + # ======================================================= + RVK1NAME=Object.GetSelected()[0].getName() + meshrvk1=NMesh.GetRawFromObject(RVK1NAME) + if DEBUG: print len(meshrvk1.verts) + # ======================================================= + # === get normal mesh for vertex group ================= + # ======================================================= + DATA1=RVK1.getData() + # ======================================================= + # === get destination mesh ============================ + # ======================================================= DATA2=RVK2.getData() - print DATA2.getKey() - # ============================================================ - # at least the second must have a shape key ================== - # ============================================================ - if DATA2.getKey(): - # ====================================================== - # in case of modifiers use ============================= - # ====================================================== - if RVK1.modifiers: - MODIFIERS=1 - POSSMOD=[Value(t) for t in POSSMOD_list] - AUTHMOD=[Value(t) for t in AUTHMOD_list] - print 'POSSMOD:',POSSMOD,'\nAUTHMOD:', AUTHMOD - MODRVK1=RVK1.modifiers - block = [] - - # =================================================== - # === Bloc Menu Modifiers ===1 doc ================= - # =================================================== - m=0 - for mod in MODRVK1: - print mod.type - if mod.type in POSSMOD: - BMOD[0].append([Draw.Create(0),mod.type, - m, - POSSMOD_list[POSSMOD.index(mod.type)], - mod[Modifier.Settings.RENDER]==1, - mod[Modifier.Settings.EDITMODE]==1 - ]) - elif mod.type in AUTHMOD: - BMOD[1].append([Draw.Create(1), - mod.type, - m, - AUTHMOD_list[AUTHMOD.index(mod.type)], - mod[Modifier.Settings.RENDER]==1, - mod[Modifier.Settings.EDITMODE]==1 - ]) - m+=1 - - # =================================================== - # === Bloc Menu Modifiers ===2 display ============= - # =================================================== - block.append(BMOD[1][0]) - for B in BMOD[1][1:]: - block.append((B[3],B[0],"")) - - block.append(BMOD[0][0]) - block.append("not alredy implemented") - block.append("in this script.") - for B in BMOD[0][1:]: - block.append((B[3],B[0],"")) - retval = Blender.Draw.PupBlock("MESH 2 RVK", block) - - # =================================================== - # === unset Modifiers ============================= - # =================================================== - for B in BMOD[0][1:]: - print B[2] - MODRVK1[B[2]][Modifier.Settings.RENDER]=0 - for B in BMOD[1]: - if not B[1]: - MODRVK1[B[2]][Modifier.Settings.RENDER]=0 - - # =================================================== - # === update Modifiers ============================= - # =================================================== - RVK1.makeDisplayList() - - # ======================================================= - # === get deformed mesh ================================ - # ======================================================= - RVK1NAME=Object.GetSelected()[0].getName() - meshrvk1=NMesh.GetRawFromObject(RVK1NAME) - print len(meshrvk1.verts) - - # ======================================================= - # === get normal mesh for vertex group ================= - # ======================================================= - DATA1=RVK1.getData() - - # ======================================================= - # === get destination mesh ============================ - # ======================================================= - DATA2=RVK2.getData() - print len(meshrvk1.verts) - print len(DATA2.verts) - # ======================================================== - # ===== is there the same number of vertices ============= - # ======================================================== - if len(meshrvk1.verts)==len(DATA2.verts): - name = "Do you want to replace or add vertex groups ? %t| YES %x1| NO ? %x2 " - result = Draw.PupMenu(name) - if result==1: - # ===================================================== - # ===== Do we save vertex groups ? =================== - # ===================================================== - GROUPNAME2=DATA2.getVertGroupNames() - if len(GROUPNAME2)!=0: - for GROUP2 in GROUPNAME2: - DATA2.removeVertGroup(GROUP2) - GROUPNAME1=DATA1.getVertGroupNames() - if len(GROUPNAME1)!=0: - for GROUP1 in GROUPNAME1: - DATA2.addVertGroup(GROUP1) - DATA2.assignVertsToGroup(GROUP1,DATA1.getVertsFromGroup(GROUP1),1.0,'replace') - # ======================================================== - # ===== now copy the vertices coords ===================== - # ======================================================== - for v in meshrvk1.verts: - i= meshrvk1.verts.index(v) - v1=DATA2.verts[i] - for n in [0,1,2]: - v1.co[n]=v.co[n] - DATA2.update() - DATA2.insertKey(FRAME,'relative') - DATA2.update() - RVK2.makeDisplayList() - if MODIFIERS: - # =================================================== - # === unset Modifiers ============================= - # =================================================== - for B in BMOD[0][1:]: - MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2] - for B in BMOD[1]: - if not B[1]: - MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2] - else: - name = "Meshes Objects must the same number of vertices %t| Ok. %x1" - result = Draw.PupMenu(name) - return + if DEBUG: print len(meshrvk1.verts) + if DEBUG: print len(DATA2.verts) + # ======================================================== + # ===== is there the same number of vertices ============= + # ======================================================== + if len(meshrvk1.verts)==len(DATA2.verts): + name = "Do you want to replace or add vertex groups ? %t| YES %x1| NO ? %x2 " + result = Draw.PupMenu(name) + if result==1: + # ===================================================== + # ===== Do we save vertex groups ? =================== + # ===================================================== + GROUPNAME2=DATA2.getVertGroupNames() + if len(GROUPNAME2)!=0: + for GROUP2 in GROUPNAME2: + DATA2.removeVertGroup(GROUP2) + GROUPNAME1=DATA1.getVertGroupNames() + if len(GROUPNAME1)!=0: + for GROUP1 in GROUPNAME1: + DATA2.addVertGroup(GROUP1) + DATA2.assignVertsToGroup(GROUP1,DATA1.getVertsFromGroup(GROUP1),1.0,'replace') + # ======================================================== + # ===== now copy the vertices coords ===================== + # ======================================================== + for v in meshrvk1.verts: + i= meshrvk1.verts.index(v) + v1=DATA2.verts[i] + for n in [0,1,2]: + v1.co[n]=v.co[n] + DATA2.update() + DATA2.insertKey(FRAME,'relative') + DATA2.update() + RVK2.makeDisplayList() + if MODIFIERS: + # =================================================== + # === unset Modifiers ============================= + # =================================================== + for B in BMOD[0][1:]: + MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2] + for B in BMOD[1]: + if not B[1]: + MODRVK1[B[2]][Modifier.Settings.RENDER]|=B[-2] else: - name = "Second Object must have at least a shape key %t| Ok. %x1" - result = Draw.PupMenu(name) - return - else: - name = "Object must be Meshes %t| Ok. %x1" + name = "Meshes Objects must the same number of vertices %t| Ok. %x1" + result = Draw.PupMenu(name) + return + else: + name = "Second Object must have at least a shape key %t| Ok. %x1" result = Draw.PupMenu(name) - return + return + else: + name = "Object must be Meshes %t| Ok. %x1" + result = Draw.PupMenu(name) + return else : name = "At least 2 Meshes as to be selected %t| Ok. %x1" result = Draw.PupMenu(name) @@ -246,5 +269,5 @@ def rvk2rvk(): Blender.Redraw() EDITMODE=Blender.Window.EditMode() Blender.Window.EditMode(0) -rvk2rvk() +deform2rvk() Blender.Window.EditMode(EDITMODE)
\ No newline at end of file |