diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-04 18:37:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-04 18:37:22 +0300 |
commit | 589b2b4ca8af8a3b260c0dd33ddfdb0cc8ee8376 (patch) | |
tree | b4dd33f0e15d4e0e5d47e6f667ebe9d81f1b456f /release/scripts | |
parent | 61a8f370f547e9b39ada252b285b09a3aa92b42d (diff) |
object.group_users, object.scene_users
utility functions to find the groups and scenes this object is used in.
button to set the group location from the cursor (UI is horrible but not any nice place to add?)
smarp project would fail if there were linked meshes in the scene, made ID.tag ignore the library, so you can tag linked data since its only for tools to use.
normalize the vertex normal before setting and use inline vector functions.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/bpy_types.py | 13 | ||||
-rw-r--r-- | release/scripts/ui/properties_object.py | 7 |
2 files changed, 20 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index d890882b77c..2a757f83208 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -46,6 +46,19 @@ class Object(bpy_types.ID): import bpy return [child for child in bpy.data.objects if child.parent == self] + @property + def group_users(self): + """The groups this object is in""" + import bpy + name = self.name + return [group for group in bpy.data.groups if name in group.objects] + + @property + def scene_users(self): + """The scenes this object is in""" + import bpy + name = self.name + return [scene for scene in bpy.data.scenes if name in scene.objects] class _GenericBone: """ diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 716c0340e2d..f24dda2ce8b 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -154,6 +154,8 @@ class OBJECT_PT_groups(ObjectButtonsPanel): else: layout.operator_menu_enum("object.group_add", "group") + index = 0 + value = str(tuple(context.scene.cursor_location)) for group in bpy.data.groups: if ob.name in group.objects: col = layout.column(align=True) @@ -172,6 +174,11 @@ class OBJECT_PT_groups(ObjectButtonsPanel): if wide_ui: col = split.column() col.prop(group, "dupli_offset", text="") + + prop = col.operator("wm.context_set_value", text="From Cursor") + prop.path = "object.group_users[%d].dupli_offset" % index + prop.value = value + index += 1 class OBJECT_PT_display(ObjectButtonsPanel): |