~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

Viewing changes to release/scripts/object_active_to_other.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!BPY
 
2
"""
 
3
Name: 'Copy Active to Selected'
 
4
Blender: 249
 
5
Group: 'Object'
 
6
Tooltip: 'For every selected object, copy the active to their loc/size/rot'
 
7
"""
 
8
 
 
9
# ***** BEGIN GPL LICENSE BLOCK *****
 
10
#
 
11
# Script copyright (C) Campbell Barton
 
12
#
 
13
# This program is free software; you can redistribute it and/or
 
14
# modify it under the terms of the GNU General Public License
 
15
# as published by the Free Software Foundation; either version 2
 
16
# of the License, or (at your option) any later version.
 
17
#
 
18
# This program is distributed in the hope that it will be useful,
 
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
# GNU General Public License for more details.
 
22
#
 
23
# You should have received a copy of the GNU General Public License
 
24
# along with this program; if not, write to the Free Software Foundation,
 
25
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
26
#
 
27
# ***** END GPL LICENCE BLOCK *****
 
28
# --------------------------------------------------------------------------
 
29
 
 
30
 
 
31
from Blender import Window, sys, Draw
 
32
import bpy
 
33
 
 
34
def my_object_util(sce):
 
35
        ob_act = sce.objects.active
 
36
        
 
37
        if not ob_act:
 
38
                Draw.PupMenu('Error%t|No active object selected')
 
39
                return
 
40
        
 
41
        mats = [ob.matrixWorld for ob in sce.objects.context if ob != ob_act]
 
42
        
 
43
        for m in mats:
 
44
                ob_copy = ob_act.copy()
 
45
                sce.objects.link(ob_copy)
 
46
                ob_copy.setMatrix(m)
 
47
                ob_copy.Layers = ob.Layers
 
48
                
 
49
 
 
50
def main():
 
51
        sce = bpy.data.scenes.active
 
52
        
 
53
        Window.WaitCursor(1)
 
54
        my_object_util(sce)
 
55
        Window.WaitCursor(0)
 
56
 
 
57
if __name__ == '__main__':
 
58
        main()