diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_object.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_object.py | 281 |
1 files changed, 138 insertions, 143 deletions
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 50cef9124ab..17034689528 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -40,7 +40,7 @@ class OBJECT_PT_context_object(ObjectButtonsPanel, Panel): layout.template_ID(space, "pin_id") else: row = layout.row() - row.template_ID(context.scene.objects, "active", filter='AVAILABLE') + row.template_ID(context.view_layer.objects, "active", filter='AVAILABLE') class OBJECT_PT_transform(ObjectButtonsPanel, Panel): @@ -48,150 +48,140 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel): def draw(self, context): layout = self.layout + layout.use_property_split = True + + flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) ob = context.object - row = layout.row() + col = flow.column() + row = col.row(align=True) + row.prop(ob, "location") + row.use_property_decorate = False + row.prop(ob, "lock_location", text="", emboss=False) - row.column().prop(ob, "location") if ob.rotation_mode == 'QUATERNION': - row.column().prop(ob, "rotation_quaternion", text="Rotation") + col = flow.column() + row = col.row(align=True) + row.prop(ob, "rotation_quaternion", text="Rotation") + sub = row.column(align=True) + sub.use_property_decorate = False + sub.prop(ob, "lock_rotation_w", text="", emboss=False) + sub.prop(ob, "lock_rotation", text="", emboss=False) elif ob.rotation_mode == 'AXIS_ANGLE': # row.column().label(text="Rotation") #row.column().prop(pchan, "rotation_angle", text="Angle") #row.column().prop(pchan, "rotation_axis", text="Axis") - row.column().prop(ob, "rotation_axis_angle", text="Rotation") + col = flow.column() + row = col.row(align=True) + row.prop(ob, "rotation_axis_angle", text="Rotation") + + sub = row.column(align=True) + sub.use_property_decorate = False + sub.prop(ob, "lock_rotation_w", text="", emboss=False) + sub.prop(ob, "lock_rotation", text="", emboss=False) else: - row.column().prop(ob, "rotation_euler", text="Rotation") + col = flow.column() + row = col.row(align=True) + row.prop(ob, "rotation_euler", text="Rotation") + row.use_property_decorate = False + row.prop(ob, "lock_rotation", text="", emboss=False) + + col = flow.column() + row = col.row(align=True) + row.prop(ob, "scale") + row.use_property_decorate = False + row.prop(ob, "lock_scale", text="", emboss=False) - row.column().prop(ob, "scale") - - layout.prop(ob, "rotation_mode") + row = layout.row(align=True) + row.prop(ob, "rotation_mode") + row.label(text="", icon='BLANK1') class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel): bl_label = "Delta Transform" + bl_parent_id = "OBJECT_PT_transform" bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout + layout.use_property_split = True + flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=True, align=False) ob = context.object - row = layout.row() + col = flow.column() + col.prop(ob, "delta_location") - row.column().prop(ob, "delta_location") + col = flow.column() if ob.rotation_mode == 'QUATERNION': - row.column().prop(ob, "delta_rotation_quaternion", text="Rotation") + col.prop(ob, "delta_rotation_quaternion", text="Rotation") elif ob.rotation_mode == 'AXIS_ANGLE': # row.column().label(text="Rotation") #row.column().prop(pchan, "delta_rotation_angle", text="Angle") #row.column().prop(pchan, "delta_rotation_axis", text="Axis") #row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation") - row.column().label(text="Not for Axis-Angle") + col.label(text="Not for Axis-Angle") else: - row.column().prop(ob, "delta_rotation_euler", text="Delta Rotation") - - row.column().prop(ob, "delta_scale") - - -class OBJECT_PT_transform_locks(ObjectButtonsPanel, Panel): - bl_label = "Transform Locks" - bl_options = {'DEFAULT_CLOSED'} - - def draw(self, context): - layout = self.layout - - ob = context.object + col.prop(ob, "delta_rotation_euler", text="Delta Rotation") - split = layout.split(percentage=0.1) - - col = split.column(align=True) - col.label(text="") - col.label(text="X:") - col.label(text="Y:") - col.label(text="Z:") - - split.column().prop(ob, "lock_location", text="Location") - split.column().prop(ob, "lock_rotation", text="Rotation") - split.column().prop(ob, "lock_scale", text="Scale") - - if ob.rotation_mode in {'QUATERNION', 'AXIS_ANGLE'}: - row = layout.row() - row.prop(ob, "lock_rotations_4d", text="Lock Rotation") - - sub = row.row() - sub.active = ob.lock_rotations_4d - sub.prop(ob, "lock_rotation_w", text="W") + col = flow.column() + col.prop(ob, "delta_scale") class OBJECT_PT_relations(ObjectButtonsPanel, Panel): bl_label = "Relations" + bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout + layout.use_property_split = True + flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) ob = context.object - split = layout.split() - - col = split.column() - col.prop(ob, "layers") - col.separator() - col.prop(ob, "pass_index") - - col = split.column() - col.label(text="Parent:") - col.prop(ob, "parent", text="") - - sub = col.column() - sub.prop(ob, "parent_type", text="") + col = flow.column() + col.prop(ob, "parent") + sub = col.row(align=True) + sub.prop(ob, "parent_type") parent = ob.parent if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE': - sub.prop_search(ob, "parent_bone", parent.data, "bones", text="") + sub.prop_search(ob, "parent_bone", parent.data, "bones") sub.active = (parent is not None) + col = flow.column() + col.active = (ob.parent is not None) + col.prop(ob, "use_slow_parent") + sub = col.row(align=True) + sub.active = (ob.use_slow_parent) + sub.prop(ob, "slow_parent_offset", text="Offset") -class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel): - bl_label = "Relations Extras" - bl_options = {'DEFAULT_CLOSED'} - - def draw(self, context): - layout = self.layout - - ob = context.object - - split = layout.split() + col = flow.column() + col.separator() - if context.scene.render.engine != 'BLENDER_GAME': - col = split.column() - col.label(text="Tracking Axes:") - col.prop(ob, "track_axis", text="Axis") - col.prop(ob, "up_axis", text="Up Axis") + col.prop(ob, "track_axis", text="Tracking Axis") + col.prop(ob, "up_axis", text="Up Axis") - col = split.column() - col.prop(ob, "use_slow_parent") - row = col.row() - row.active = ((ob.parent is not None) and (ob.use_slow_parent)) - row.prop(ob, "slow_parent_offset", text="Offset") + col = flow.column() + col.separator() - layout.prop(ob, "use_extra_recalc_object") - layout.prop(ob, "use_extra_recalc_data") + col.prop(ob, "pass_index") -class GROUP_MT_specials(Menu): - bl_label = "Group Specials" +class COLLECTION_MT_specials(Menu): + bl_label = "Collection Specials" def draw(self, context): layout = self.layout - layout.operator("object.group_unlink", icon='X') - layout.operator("object.grouped_select") + layout.operator("object.collection_unlink", icon='X') + layout.operator("object.collection_objects_select") layout.operator("object.dupli_offset_from_cursor") -class OBJECT_PT_groups(ObjectButtonsPanel, Panel): - bl_label = "Groups" +class OBJECT_PT_collections(ObjectButtonsPanel, Panel): + bl_label = "Collections" + bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout @@ -199,42 +189,40 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel): obj = context.object row = layout.row(align=True) - if bpy.data.groups: - row.operator("object.group_link", text="Add to Group") + if bpy.data.collections: + row.operator("object.collection_link", text="Add to Collection") else: - row.operator("object.group_add", text="Add to Group") - row.operator("object.group_add", text="", icon='ZOOMIN') + row.operator("object.collection_add", text="Add to Collection") + row.operator("object.collection_add", text="", icon='ZOOMIN') obj_name = obj.name - for group in bpy.data.groups: + for collection in bpy.data.collections: # XXX this is slow and stupid!, we need 2 checks, one thats fast # and another that we can be sure its not a name collision # from linked library data - group_objects = group.objects - if obj_name in group.objects and obj in group_objects[:]: + collection_objects = collection.objects + if obj_name in collection.objects and obj in collection_objects[:]: col = layout.column(align=True) - col.context_pointer_set("group", group) + col.context_pointer_set("collection", collection) row = col.box().row() - row.prop(group, "name", text="") - row.operator("object.group_remove", text="", icon='X', emboss=False) - row.menu("GROUP_MT_specials", icon='DOWNARROW_HLT', text="") + row.prop(collection, "name", text="") + row.operator("object.collection_remove", text="", icon='X', emboss=False) + row.menu("COLLECTION_MT_specials", icon='DOWNARROW_HLT', text="") - split = col.box().split() - - col = split.column() - col.prop(group, "layers", text="Dupli Visibility") - - col = split.column() - col.prop(group, "dupli_offset", text="") + row = col.box().row() + row.prop(collection, "dupli_offset", text="") class OBJECT_PT_display(ObjectButtonsPanel, Panel): - bl_label = "Display" + bl_label = "Viewport Display" + bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout + layout.use_property_split = True + flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) obj = context.object obj_type = obj.type @@ -243,84 +231,93 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): is_empty_image = (obj_type == 'EMPTY' and obj.empty_draw_type == 'IMAGE') is_dupli = (obj.dupli_type != 'NONE') - split = layout.split() - - col = split.column() + col = flow.column(align=True) col.prop(obj, "show_name", text="Name") col.prop(obj, "show_axis", text="Axis") + # Makes no sense for cameras, armatures, etc.! # but these settings do apply to dupli instances + col = flow.column(align=True) if is_geometry or is_dupli: - col.prop(obj, "show_wire", text="Wire") + col.prop(obj, "show_wire", text="Wireframe") if obj_type == 'MESH' or is_dupli: col.prop(obj, "show_all_edges") - col = split.column() - row = col.row() - row.prop(obj, "show_bounds", text="Bounds") - sub = row.row() + col = flow.column() + col.prop(obj, "show_bounds", text="Bounds") + sub = col.column() sub.active = obj.show_bounds - sub.prop(obj, "draw_bounds_type", text="") + sub.prop(obj, "draw_bounds_type") + col = flow.column() if is_geometry: col.prop(obj, "show_texture_space", text="Texture Space") - col.prop(obj, "show_x_ray", text="X-Ray") - if obj_type == 'MESH' or is_empty_image: - col.prop(obj, "show_transparent", text="Transparency") + col.prop(obj.display, "show_shadows", text="Shadow") - split = layout.split() + col.prop(obj, "show_x_ray", text="X-Ray") + # if obj_type == 'MESH' or is_empty_image: + # col.prop(obj, "show_transparent", text="Transparency") - col = split.column() + col = flow.column() if is_wire: # wire objects only use the max. draw type for duplis col.active = is_dupli - col.label(text="Maximum Dupli Draw Type:") - else: - col.label(text="Maximum Draw Type:") - col.prop(obj, "draw_type", text="") + col.prop( + obj, "draw_type", + text="Maximum Draw Type" if is_wire else "Maximum Draw Type", + ) - col = split.column() if is_geometry or is_empty_image: # Only useful with object having faces/materials... - col.label(text="Object Color:") - col.prop(obj, "color", text="") + col.prop(obj, "color") class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): bl_label = "Duplication" + bl_options = {'DEFAULT_CLOSED'} def draw(self, context): layout = self.layout ob = context.object - layout.row().prop(ob, "dupli_type", expand=True) + row = layout.row() + row.prop(ob, "dupli_type", expand=True) + + layout.use_property_split = True + flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) if ob.dupli_type == 'FRAMES': - split = layout.split() - col = split.column(align=True) + col = flow.column(align=True) col.prop(ob, "dupli_frames_start", text="Start") col.prop(ob, "dupli_frames_end", text="End") - col = split.column(align=True) + col = flow.column(align=True) col.prop(ob, "dupli_frames_on", text="On") col.prop(ob, "dupli_frames_off", text="Off") - layout.prop(ob, "use_dupli_frames_speed", text="Speed") + col = flow.column(align=True) + col.prop(ob, "use_dupli_frames_speed", text="Speed") elif ob.dupli_type == 'VERTS': layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation") elif ob.dupli_type == 'FACES': - row = layout.row() - row.prop(ob, "use_dupli_faces_scale", text="Scale") - sub = row.row() + col = flow.column() + col.prop(ob, "use_dupli_faces_scale", text="Scale") + sub = col.column() sub.active = ob.use_dupli_faces_scale sub.prop(ob, "dupli_faces_scale", text="Inherit Scale") - elif ob.dupli_type == 'GROUP': - layout.prop(ob, "dupli_group", text="Group") + elif ob.dupli_type == 'COLLECTION': + col = flow.column() + col.prop(ob, "dupli_group", text="Collection") + + if ob.dupli_type != 'NONE' or len(ob.particle_systems): + col = flow.column(align=True) + col.prop(ob, "show_duplicator_for_viewport") + col.prop(ob, "show_duplicator_for_render") from .properties_animviz import ( @@ -362,7 +359,7 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , Panel): # inherit fr class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel): - COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} + COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'} _context_path = "object" _property_type = bpy.types.Object @@ -371,13 +368,11 @@ classes = ( OBJECT_PT_context_object, OBJECT_PT_transform, OBJECT_PT_delta_transform, - OBJECT_PT_transform_locks, OBJECT_PT_relations, - OBJECT_PT_relations_extras, - GROUP_MT_specials, - OBJECT_PT_groups, - OBJECT_PT_display, + COLLECTION_MT_specials, + OBJECT_PT_collections, OBJECT_PT_duplication, + OBJECT_PT_display, OBJECT_PT_motion_paths, OBJECT_PT_custom_props, ) |