3
""" Registration info for Blender menus: <- these words are ignored
7
Tip: 'Copy data from active object to other selected ones.'
10
__author__ = "Jean-Michel Soler (jms)"
11
__url__ = ("blender", "elysiun",
12
"Script's homepage, http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_lampdatacopier.htm",
13
"Communicate problems and errors, http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender")
17
Use "Data Copier" to copy attributes from the active object to other selected ones of
20
This script is still in an early version but is already useful for copying
21
attributes for some types of objects like lamps and cameras.
25
Select the objects that will be updated, select the object whose data will
26
be copied (they must all be of the same type, of course), then run this script.
27
Toggle the buttons representing the attributes to be copied and press "Copy".
30
# ----------------------------------------------------------
31
# Object DATA copier 0.1.1
32
# (c) 2004 jean-michel soler
33
# -----------------------------------------------------------
34
#----------------------------------------------
35
# Page officielle/official page du blender python Object DATA copier:
36
# http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_lampdatacopier.htm
37
# Communiquer les problemes et erreurs sur:
38
# To Communicate problems and errors on:
39
# http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender
40
#---------------------------------------------
41
# Blender Artistic License
42
# http://download.blender.org/documentation/html/x21254.html
43
#---------------------------------------------
47
from Blender.Draw import *
48
from Blender.BGL import *
51
O = Object.GetSelected()
55
MAJ='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
56
O = Object.GetSelected()
57
param= [ p for p in dir(O[0].getData()) if (p.find('set')!=0 and p.find('get')!=0 and (MAJ.find(p[0])==-1 or (p in ['R','G','B']))) ]
65
exec "doc=str(%s.Modes)+' ; value : %s'"%( O[0].getType(), str(O[0].getData().mode) )
67
exec """doc= '%s'+' value = '+ str(O[0].getData().%s)"""%(p,p)
70
exec "doc=str(%s.Types)+' ; value : %s'"%( O[0].getType(), str(O[0].getData().type) )
72
exec """doc= '%s'+' value = '+ str(O[0].getData().%s)"""%(p,p)
74
exec """doc= '%s'+' value = '+ str(O[0].getData().%s)"""%(p,p)
75
if doc.find('built-in')!=-1:
76
exec """doc= 'This is a function ! Doc = '+ str(O[0].getData().%s.__doc__)"""%(p)
79
PARAM[p]=[Create(0),evt,doc]
88
for O in Blender.Object.GetSelected():
89
if O.getType()!='Mesh' and O.getType()!='Empty' :
90
if OBJECT==None and TYPE==None:
94
elif O.getType()==TYPE:
95
for p in PARAM.keys():
96
if PARAM[p][0].val==1:
98
exec "O.getData().%s=OBJECT.%s"%(p,p)
100
errormsg = "Type Error|It's not possible to copy %s to %s types." % (p,TYPE)
101
Blender.Draw.PupMenu(errormsg)
124
glColor3f(0.7, 0.7, 0.7)
125
glClear(GL_COLOR_BUFFER_BIT)
126
glColor3f(0.1, 0.1, 0.15)
128
size=Buffer(GL_FLOAT, 4)
129
glGetFloatv(GL_SCISSOR_BOX, size)
131
for s in [0,1,2,3]: size[s]=int(size[s])
134
Button ("Exit",1,20,4,80,ligne)
135
Button ("Copy",2,102,4,80,ligne)
136
Button ("renew",3,184,4,80,ligne)
138
glRasterPos2f(20, ligne*2-8)
139
Text(O[0].getType()+" DATA copier")
153
PARAM[p][0]=Toggle(p,
159
PARAM[p][0].val,str(PARAM[p][2]))
162
Register(DRAW,EVENT,BUTTON)