~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/doc/Group.py

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
Example::
12
12
 
13
 
  # Make Dupli's Real, as a python script.
14
 
 
15
 
  from Blender import *
16
 
 
17
 
  scn= Scene.GetCurrent()
18
 
  for ob in scn.objects:
19
 
    print 'Object Group Settings'
20
 
    print ob.name, ob.type
21
 
    print 'enableDupVerts:', ob.enableDupVerts
22
 
    print 'enableDupFrames:', ob.enableDupFrames
23
 
    print 'enableDupGroup:', ob.enableDupGroup
24
 
    print 'DupGroup:', ob.DupGroup
25
 
    dupe_obs= ob.DupObjects
26
 
    print 'num dup obs:', len(dupe_obs)
27
 
 
28
 
    for dup_ob, dup_matrix in dupe_obs:
29
 
      print '\tDupOb', dup_ob.name
30
 
      scn.objects.new(dup_ob.data)
31
 
      new_ob.setMatrix(dup_matrix)
32
 
      new_ob.sel= 1 # select all real instances.
33
 
 
34
 
    ob.sel=0 # Desel the original object
35
 
 
36
 
  Window.RedrawAll()
37
 
 
38
 
Example::
39
 
 
40
 
  # Make a new group with the selected objects, and add an instance of this group.
41
 
 
42
 
  from Blender import *
43
 
  
44
 
  scn= Scene.GetCurrent()
45
 
  
46
 
  # New Group
47
 
  grp= Group.New('mygroup')
48
 
  grp.objects= scn.objects
49
 
  
50
 
  # Instance the group at an empty using dupligroups
51
 
  ob= scn.objects.new(None)
52
 
  ob.enableDupGroup= True
53
 
  ob.DupGroup= grp
54
 
  Window.RedrawAll()
55
 
  
56
 
  
57
 
Example::
58
 
 
59
 
  # Remove all non mesh objects from a group.
60
 
 
61
 
  from Blender import *
62
 
  
63
 
  scn= Scene.GetCurrent()
64
 
  
65
 
  # New Group
66
 
  grp= Group.Get('mygroup')
67
 
  for ob in list(grp.objects): # Convert to a list before looping because we are removing items
68
 
    if ob.type != 'Mesh':
69
 
      grp.objects.unlink(ob)
 
13
        # Make Dupli's Real, as a python script.
 
14
 
 
15
        from Blender import *
 
16
 
 
17
        scn= Scene.GetCurrent()
 
18
        for ob in scn.objects:
 
19
                print 'Object Group Settings'
 
20
                print ob.name, ob.type
 
21
                print 'enableDupVerts:', ob.enableDupVerts
 
22
                print 'enableDupFrames:', ob.enableDupFrames
 
23
                print 'enableDupGroup:', ob.enableDupGroup
 
24
                print 'DupGroup:', ob.DupGroup
 
25
                dupe_obs= ob.DupObjects
 
26
                print 'num dup obs:', len(dupe_obs)
 
27
 
 
28
                for dup_ob, dup_matrix in dupe_obs:
 
29
                        print '\tDupOb', dup_ob.name
 
30
                        scn.objects.new(dup_ob.data)
 
31
                        new_ob.setMatrix(dup_matrix)
 
32
                        new_ob.sel= 1 # select all real instances.
 
33
 
 
34
                ob.sel=0 # Desel the original object
 
35
 
 
36
        Window.RedrawAll()
 
37
 
 
38
Example::
 
39
 
 
40
        # Make a new group with the selected objects, and add an instance of this group.
 
41
 
 
42
        from Blender import *
 
43
        
 
44
        scn= Scene.GetCurrent()
 
45
        
 
46
        # New Group
 
47
        grp= Group.New('mygroup')
 
48
        grp.objects= scn.objects
 
49
        
 
50
        # Instance the group at an empty using dupligroups
 
51
        ob= scn.objects.new(None)
 
52
        ob.enableDupGroup= True
 
53
        ob.DupGroup= grp
 
54
        Window.RedrawAll()
 
55
        
 
56
        
 
57
Example::
 
58
 
 
59
        # Remove all non mesh objects from a group.
 
60
 
 
61
        from Blender import *
 
62
        
 
63
        scn= Scene.GetCurrent()
 
64
        
 
65
        # New Group
 
66
        grp= Group.Get('mygroup')
 
67
        for ob in list(grp.objects): # Convert to a list before looping because we are removing items
 
68
                if ob.type != 'Mesh':
 
69
                        grp.objects.unlink(ob)
70
70
"""
71
71
 
72
72
def New (name = None):
73
 
  """
74
 
  Make a new empty group, name optional, default is "Group"
75
 
  @type name: string
76
 
  @param name: The name of the new group.
77
 
  @rtype:  Blender Group
78
 
  @return: A Empty Blender Group object
79
 
  """
 
73
        """
 
74
        Make a new empty group, name optional, default is "Group"
 
75
        @type name: string
 
76
        @param name: The name of the new group.
 
77
        @rtype:  Blender Group
 
78
        @return: A Empty Blender Group object
 
79
        """
80
80
 
81
81
def Get (name = None):
82
 
  """
83
 
  Get the Group object(s) from Blender.
84
 
  @type name: string
85
 
  @param name: The name of the Group object.
86
 
  @rtype: Blender Group or a list of Blender Groups
87
 
  @return: It depends on the I{name} parameter:
88
 
      - (name): The Group object called I{name}, Exception if it is not found.
89
 
      - (): A list with all Group objects in the current blend file.
90
 
  """
 
82
        """
 
83
        Get the Group object(s) from Blender.
 
84
        @type name: string
 
85
        @param name: The name of the Group object.
 
86
        @rtype: Blender Group or a list of Blender Groups
 
87
        @return: It depends on the I{name} parameter:
 
88
                        - (name): The Group object called I{name}, Exception if it is not found.
 
89
                        - (): A list with all Group objects in the current blend file.
 
90
        """
91
91
 
92
92
def Unlink (group):
93
 
  """
94
 
  Unlink (delete) this group from Blender.
95
 
  @Note: No objects will be removed, just the group that references them.
96
 
  @type group: group
97
 
  @param group: A group to remove from this blend file, does not remove objects that this group uses.
98
 
  """
 
93
        """
 
94
        Unlink (delete) this group from Blender.
 
95
        @Note: No objects will be removed, just the group that references them.
 
96
        @type group: group
 
97
        @param group: A group to remove from this blend file, does not remove objects that this group uses.
 
98
        """
99
99
 
100
100
 
101
101
class Group:
102
 
  """
103
 
  The Group object
104
 
  ================
105
 
    This object gives access to Groups in Blender.
106
 
  @ivar name: The name of this Group object.
107
 
  @type name: string
108
 
  @ivar users: Number of users this group has (read only)
109
 
  @type users: int
110
 
  @ivar fakeUser: The fake user status.
111
 
    Enabling this will keep it in the blend even if there are no users.
112
 
  @type fakeUser: bool
113
 
  @ivar layers: Layer bitmask for this group.
114
 
  @type layers: int
115
 
  @ivar objects: Objects that this group uses.
116
 
    This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group).
117
 
    The groups objects can be set by assigning a list or iterator of objects to the groups objects.
118
 
    objects.link() and objects.unlink() also work with the the objects iterator just like with lists.
119
 
 
120
 
    B{Note}: append() and remove() have been deprecated and replaced by link() and unlink(),
121
 
    after Blender 2.43 append() and remove() will not be available.
122
 
  @type objects: custom object sequence
123
 
  """
124
 
 
125
 
  def __copy__ ():
126
 
    """
127
 
    Make a copy of this group
128
 
    @rtype: Group
129
 
    @return:  a copy of this group
130
 
    """
 
 
b'\\ No newline at end of file'
 
102
        """
 
103
        The Group object
 
104
        ================
 
105
                This object gives access to Groups in Blender.
 
106
        @ivar layers: Layer bitmask for this group.
 
107
        @type layers: int
 
108
        @ivar objects: Objects that this group uses.
 
109
                This is a sequence with-list like access so use list(grp.objects) if you need to use a list (where grp is a group).
 
110
                The groups objects can be set by assigning a list or iterator of objects to the groups objects.
 
111
                objects.link() and objects.unlink() also work with the the objects iterator just like with lists.
 
112
 
 
113
                B{Note}: append() and remove() have been deprecated and replaced by link() and unlink(),
 
114
                after Blender 2.43 append() and remove() will not be available.
 
115
        @type objects: custom object sequence
 
116
        """
 
117
 
 
118
        def __copy__ ():
 
119
                """
 
120
                Make a copy of this group
 
121
                @rtype: Group
 
122
                @return:  a copy of this group
 
123
                """
 
124
 
 
125
import id_generics
 
126
Group.__doc__ += id_generics.attributes 
 
127