From 7c7f3776dd0e2f0125a4065e4b4d070a8666ef7c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 28 Nov 2018 17:49:52 +0100 Subject: Use collection and instance terminology in Python API This follows naming convention agreed on in T56648. --- .../scripts/freestyle/modules/parameter_editor.py | 12 +++---- .../bl_previews_utils/bl_previews_render.py | 10 +++--- release/scripts/modules/bpy_extras/io_utils.py | 4 +-- release/scripts/modules/bpy_types.py | 2 +- release/scripts/startup/bl_operators/object.py | 10 +++--- release/scripts/startup/bl_operators/rigidbody.py | 2 +- .../scripts/startup/bl_ui/properties_freestyle.py | 10 +++--- release/scripts/startup/bl_ui/properties_object.py | 42 +++++++++++----------- .../scripts/startup/bl_ui/properties_particle.py | 42 +++++++++++----------- .../startup/bl_ui/properties_physics_cloth.py | 2 +- .../startup/bl_ui/properties_physics_common.py | 2 +- .../bl_ui/properties_physics_dynamicpaint.py | 2 +- .../startup/bl_ui/properties_physics_rigidbody.py | 2 +- .../startup/bl_ui/properties_physics_smoke.py | 6 ++-- .../startup/bl_ui/properties_physics_softbody.py | 2 +- release/scripts/startup/bl_ui/properties_scene.py | 2 +- .../templates_py/operator_modal_view3d_raycast.py | 2 +- 17 files changed, 77 insertions(+), 77 deletions(-) (limited to 'release/scripts') diff --git a/release/scripts/freestyle/modules/parameter_editor.py b/release/scripts/freestyle/modules/parameter_editor.py index f2001a1ae50..3e695f4d389 100644 --- a/release/scripts/freestyle/modules/parameter_editor.py +++ b/release/scripts/freestyle/modules/parameter_editor.py @@ -1188,8 +1188,8 @@ def get_dashed_pattern(linestyle): def get_grouped_objects(group): for ob in group.objects: - if ob.dupli_type == 'GROUP' and ob.dupli_group is not None: - for dupli in get_grouped_objects(ob.dupli_group): + if ob.instance_type == 'COLLECTION' and ob.instance_collection is not None: + for dupli in get_grouped_objects(ob.instance_collection): yield dupli else: yield ob @@ -1275,10 +1275,10 @@ def process(layer_name, lineset_name): upred = NotUP1D(upred) selection_criteria.append(upred) # prepare selection criteria by group of objects - if lineset.select_by_group: - if lineset.group is not None: - names = {getQualifiedObjectName(ob): True for ob in get_grouped_objects(lineset.group)} - upred = ObjectNamesUP1D(names, lineset.group_negation == 'EXCLUSIVE') + if lineset.select_by_collection: + if lineset.collection is not None: + names = {getQualifiedObjectName(ob): True for ob in get_grouped_objects(lineset.collection)} + upred = ObjectNamesUP1D(names, lineset.collection_negation == 'EXCLUSIVE') selection_criteria.append(upred) # prepare selection criteria by image border if lineset.select_by_image_border: diff --git a/release/scripts/modules/bl_previews_utils/bl_previews_render.py b/release/scripts/modules/bl_previews_utils/bl_previews_render.py index 16b0b107927..f425278e8cb 100644 --- a/release/scripts/modules/bl_previews_utils/bl_previews_render.py +++ b/release/scripts/modules/bl_previews_utils/bl_previews_render.py @@ -229,13 +229,13 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): def object_bbox_merge(bbox, ob, ob_space, offset_matrix): # Take collections instances into account (including linked one in this case). - if ob.type == 'EMPTY' and ob.dupli_type == 'COLLECTION': - grp_objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in ob.dupli_group.all_objects) + if ob.type == 'EMPTY' and ob.instance_type == 'COLLECTION': + grp_objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in ob.instance_collection.all_objects) if (len(grp_objects) == 0): ob_bbox = ob.bound_box else: coords = objects_bbox_calc(ob_space, grp_objects, - Matrix.Translation(ob.dupli_group.dupli_offset).inverted()) + Matrix.Translation(ob.instance_collection.instance_offset).inverted()) ob_bbox = ((coords[0], coords[1], coords[2]), (coords[21], coords[22], coords[23])) elif ob.bound_box: ob_bbox = ob.bound_box @@ -390,11 +390,11 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern): bpy.context.screen.scene = scene bpy.ops.object.collection_instance_add(collection=grp.name) - grp_ob = next((ob for ob in scene.objects if ob.dupli_group and ob.dupli_group.name == grp.name)) + grp_ob = next((ob for ob in scene.objects if ob.instance_collection and ob.dupli_coilection.name == grp.name)) grp_obname = grp_ob.name scene.update() - offset_matrix = Matrix.Translation(grp.dupli_offset).inverted() + offset_matrix = Matrix.Translation(grp.instance_offset).inverted() preview_render_do(render_context, 'collections', grp.name, objects, offset_matrix) diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index e74631256e3..4b28a9edf70 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -341,10 +341,10 @@ def axis_conversion_ensure(operator, forward_attr, up_attr): # return a tuple (free, object list), free is True if memory should be freed # later with free_derived_objects() def create_derived_objects(scene, ob): - if ob.parent and ob.parent.dupli_type in {'VERTS', 'FACES'}: + if ob.parent and ob.parent.instance_type in {'VERTS', 'FACES'}: return False, None - if ob.dupli_type != 'NONE': + if ob.instance_type != 'NONE': ob.dupli_list_create(scene) return True, [(dob.object, dob.matrix) for dob in ob.dupli_list] else: diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index dda1ab7b4ed..7779e1ba38a 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -104,7 +104,7 @@ class Collection(bpy_types.ID): """The collection instance objects this collection is used in""" import bpy return tuple(obj for obj in bpy.data.objects - if self == obj.dupli_group) + if self == obj.instance_collection) class Object(bpy_types.ID): diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index b59c6da7368..ad1488339df 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -640,10 +640,10 @@ class MakeDupliFace(Operator): for obj in objects: scene.objects.unlink(obj) - ob_new.dupli_type = 'FACES' + ob_new.instance_type = 'FACES' ob_inst.parent = ob_new - ob_new.use_dupli_faces_scale = True - ob_new.dupli_faces_scale = 1.0 / SCALE_FAC + ob_new.use_instance_faces_scale = True + ob_new.instance_faces_scale = 1.0 / SCALE_FAC ob_inst.select_set(True) ob_new.select_set(True) @@ -852,7 +852,7 @@ class TransformsToDeltasAnim(Operator): class DupliOffsetFromCursor(Operator): """Set offset used for collection instances based on cursor position""" - bl_idname = "object.dupli_offset_from_cursor" + bl_idname = "object.instance_offset_from_cursor" bl_label = "Set Offset From Cursor" bl_options = {'INTERNAL', 'UNDO'} @@ -864,7 +864,7 @@ class DupliOffsetFromCursor(Operator): scene = context.scene collection = context.collection - collection.dupli_offset = scene.cursor_location + collection.instance_offset = scene.cursor_location return {'FINISHED'} diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index cca01a6f2fa..235db39e9b1 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -47,7 +47,7 @@ class CopyRigidbodySettings(Operator): "deactivate_angular_velocity", "linear_damping", "angular_damping", - "collision_groups", + "collision_collections", "mesh_source", "use_deform", "enabled", diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py index f5f15c7ca58..c67ea2d4b8b 100644 --- a/release/scripts/startup/bl_ui/properties_freestyle.py +++ b/release/scripts/startup/bl_ui/properties_freestyle.py @@ -208,7 +208,7 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel row.prop(lineset, "select_by_visibility", text="Visibility", toggle=True) row.prop(lineset, "select_by_edge_types", text="Edge Types", toggle=True) row.prop(lineset, "select_by_face_marks", text="Face Marks", toggle=True) - row.prop(lineset, "select_by_group", text="Group", toggle=True) + row.prop(lineset, "select_by_collection", text="Collection", toggle=True) row.prop(lineset, "select_by_image_border", text="Image Border", toggle=True) if lineset.select_by_visibility: @@ -247,11 +247,11 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel row.prop(lineset, "face_mark_negation", expand=True) row.prop(lineset, "face_mark_condition", expand=True) - if lineset.select_by_group: - col.label(text="Group:") + if lineset.select_by_collection: + col.label(text="Collection:") row = col.row() - row.prop(lineset, "group", text="") - row.prop(lineset, "group_negation", expand=True) + row.prop(lineset, "collection", text="") + row.prop(lineset, "collection_negation", expand=True) class VIEWLAYER_PT_freestyle_linestyle(ViewLayerFreestyleEditorButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index a1bd50c32c5..aafeb0a103d 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -176,7 +176,7 @@ class COLLECTION_MT_specials(Menu): layout.operator("object.collection_unlink", icon='X') layout.operator("object.collection_objects_select") - layout.operator("object.dupli_offset_from_cursor") + layout.operator("object.instance_offset_from_cursor") class OBJECT_PT_collections(ObjectButtonsPanel, Panel): @@ -212,7 +212,7 @@ class OBJECT_PT_collections(ObjectButtonsPanel, Panel): row.menu("COLLECTION_MT_specials", icon='DOWNARROW_HLT', text="") row = col.box().row() - row.prop(collection, "dupli_offset", text="") + row.prop(collection, "instance_offset", text="") class OBJECT_PT_display(ObjectButtonsPanel, Panel): @@ -230,7 +230,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): is_geometry = (obj_type in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT'}) is_wire = (obj_type in {'CAMERA', 'EMPTY'}) is_empty_image = (obj_type == 'EMPTY' and obj.empty_display_type == 'IMAGE') - is_dupli = (obj.dupli_type != 'NONE') + is_dupli = (obj.instance_type != 'NONE') col = flow.column() col.prop(obj, "show_name", text="Name") @@ -288,42 +288,42 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): ob = context.object row = layout.row() - row.prop(ob, "dupli_type", expand=True) + row.prop(ob, "instance_type", expand=True) layout.use_property_split = True flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) - if ob.dupli_type == 'FRAMES': + if ob.instance_type == 'FRAMES': col = flow.column(align=True) - col.prop(ob, "dupli_frames_start", text="Start") - col.prop(ob, "dupli_frames_end", text="End") + col.prop(ob, "instance_frames_start", text="Start") + col.prop(ob, "instance_frames_end", text="End") col = flow.column(align=True) - col.prop(ob, "dupli_frames_on", text="On") - col.prop(ob, "dupli_frames_off", text="Off") + col.prop(ob, "instance_frames_on", text="On") + col.prop(ob, "instance_frames_off", text="Off") col = flow.column(align=True) - col.prop(ob, "use_dupli_frames_speed", text="Speed") + col.prop(ob, "use_instance_frames_speed", text="Speed") - elif ob.dupli_type == 'VERTS': - layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation") + elif ob.instance_type == 'VERTS': + layout.prop(ob, "use_instance_vertices_rotation", text="Rotation") - elif ob.dupli_type == 'FACES': + elif ob.instance_type == 'FACES': col = flow.column() - col.prop(ob, "use_dupli_faces_scale", text="Scale") + col.prop(ob, "use_instance_faces_scale", text="Scale") sub = col.column() - sub.active = ob.use_dupli_faces_scale - sub.prop(ob, "dupli_faces_scale", text="Inherit Scale") + sub.active = ob.use_instance_faces_scale + sub.prop(ob, "instance_faces_scale", text="Inherit Scale") - elif ob.dupli_type == 'COLLECTION': + elif ob.instance_type == 'COLLECTION': col = flow.column() - col.prop(ob, "dupli_group", text="Collection") + col.prop(ob, "instance_collection", text="Collection") - if ob.dupli_type != 'NONE' or len(ob.particle_systems): + if ob.instance_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") + col.prop(ob, "show_instancer_for_viewport") + col.prop(ob, "show_instancer_for_render") from .properties_animviz import ( diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py index f727f1110a4..c7b97836267 100644 --- a/release/scripts/startup/bl_ui/properties_particle.py +++ b/release/scripts/startup/bl_ui/properties_particle.py @@ -879,7 +879,7 @@ class PARTICLE_PT_physics_boids_movement(ParticleButtonsPanel, Panel): layout.separator() - layout.prop(part, "collision_group") + layout.prop(part, "collision_collection") class PARTICLE_PT_physics_boids_battle(ParticleButtonsPanel, Panel): @@ -1018,7 +1018,7 @@ class PARTICLE_PT_physics_deflection(ParticleButtonsPanel, Panel): col.prop(part, "use_size_deflect") col.prop(part, "use_die_on_collision") - col.prop(part, "collision_group") + col.prop(part, "collision_collection") class PARTICLE_PT_physics_forces(ParticleButtonsPanel, Panel): @@ -1229,7 +1229,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel): if context.object: layout.separator() - layout.prop(context.object, "show_duplicator_for_render", text="Show Emitter") + layout.prop(context.object, "show_instancer_for_render", text="Show Emitter") class PARTICLE_PT_render_extra(ParticleButtonsPanel, Panel): @@ -1366,11 +1366,11 @@ class PARTICLE_PT_render_object(ParticleButtonsPanel, Panel): col = layout.column() - col.prop(part, "dupli_object", text="Instance Object") + col.prop(part, "instance_object", text="Instance Object") sub = col.column() - sub.prop(part, "use_global_dupli", text="Global Coordinates") - sub.prop(part, "use_rotation_dupli", text="Object Rotation") - sub.prop(part, "use_scale_dupli", text="Object Scale") + sub.prop(part, "use_global_instance", text="Global Coordinates") + sub.prop(part, "use_rotation_instance", text="Object Rotation") + sub.prop(part, "use_scale_instance", text="Object Scale") class PARTICLE_PT_render_collection(ParticleButtonsPanel, Panel): @@ -1392,15 +1392,15 @@ class PARTICLE_PT_render_collection(ParticleButtonsPanel, Panel): col = layout.column() - col.prop(part, "dupli_group") + col.prop(part, "instance_collection") - col.prop(part, "use_whole_group") + col.prop(part, "use_whole_collection") sub = col.column() - sub.active = (part.use_whole_group is False) - sub.prop(part, "use_group_pick_random") - sub.prop(part, "use_global_dupli", text="Global Coordinates") - sub.prop(part, "use_rotation_dupli", text="Object Rotation") - sub.prop(part, "use_scale_dupli", text="Object Scale") + sub.active = (part.use_whole_collection is False) + sub.prop(part, "use_collection_pick_random") + sub.prop(part, "use_global_instance", text="Global Coordinates") + sub.prop(part, "use_rotation_instance", text="Object Rotation") + sub.prop(part, "use_scale_instance", text="Object Scale") class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel): @@ -1418,9 +1418,9 @@ class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel): layout = self.layout part = particle_get_settings(context) - layout.active = not part.use_whole_group + layout.active = not part.use_whole_collection - layout.prop(part, "use_group_count", text="") + layout.prop(part, "use_collection_count", text="") def draw(self, context): layout = self.layout @@ -1430,11 +1430,11 @@ class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel): col = layout.column() - layout.active = part.use_group_count and not part.use_whole_group + layout.active = part.use_collection_count and not part.use_whole_collection row = layout.row() - row.template_list("UI_UL_list", "particle_dupli_weights", part, "dupli_weights", - part, "active_dupliweight_index") + row.template_list("UI_UL_list", "particle_instance_weights", part, "instance_weights", + part, "active_instanceweight_index") col = row.column() sub = col.row() @@ -1446,7 +1446,7 @@ class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel): subsub.separator() subsub.operator("particle.dupliob_refresh", icon='FILE_REFRESH', text="") - weight = part.active_dupliweight + weight = part.active_instanceweight if weight: row = layout.row() row.prop(weight, "count") @@ -1635,7 +1635,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel): if context.object: layout.separator() - layout.prop(context.object, "show_duplicator_for_viewport", text="Show Emitter") + layout.prop(context.object, "show_instancer_for_viewport", text="Show Emitter") class PARTICLE_PT_children(ParticleButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py index 8ccf3f63465..71731644caf 100644 --- a/release/scripts/startup/bl_ui/properties_physics_cloth.py +++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py @@ -273,7 +273,7 @@ class PHYSICS_PT_cloth_object_collision(PhysicButtonsPanel, Panel): col.prop(cloth, "impulse_clamp") col = flow.column() - col.prop(cloth, "group") + col.prop(cloth, "collection") class PHYSICS_PT_cloth_self_collision(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py index 49cd1a41499..9e537e85911 100644 --- a/release/scripts/startup/bl_ui/properties_physics_common.py +++ b/release/scripts/startup/bl_ui/properties_physics_common.py @@ -242,7 +242,7 @@ def effector_weights_ui(self, context, weights, weight_type): # NOTE: TODO temporarly used until the animate properties are properly skipped. layout.use_property_decorate = False # No animation (remove this later on). - layout.prop(weights, "group") + layout.prop(weights, "collection") flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True) diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index de76047b458..1d3866bb142 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -260,7 +260,7 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, Panel): col.separator() col = flow.column() - col.prop(surface, "brush_group") + col.prop(surface, "brush_collection") if surface_type not in {'DISPLACE', 'WAVE'}: col = flow.column() # flow the layout otherwise. diff --git a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py index 13d07d64028..1c0598fb6dc 100644 --- a/release/scripts/startup/bl_ui/properties_physics_rigidbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_rigidbody.py @@ -191,7 +191,7 @@ class PHYSICS_PT_rigid_body_collisions_collections(PHYSICS_PT_rigidbody_panel, P ob = context.object rbo = ob.rigid_body - layout.prop(rbo, "collision_groups", text="") + layout.prop(rbo, "collision_collections", text="") class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py index 9c502bbd9d6..4fd79f26b0b 100644 --- a/release/scripts/startup/bl_ui/properties_physics_smoke.py +++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py @@ -487,11 +487,11 @@ class PHYSICS_PT_smoke_collections(PhysicButtonsPanel, Panel): domain = context.smoke.domain_settings col = layout.column() - col.prop(domain, "fluid_group", text="Flow") + col.prop(domain, "fluid_collection", text="Flow") # col = layout.column() - # col.prop(domain, "effector_group", text="Effector") - col.prop(domain, "collision_group", text="Collision") + # col.prop(domain, "effector_collection", text="Effector") + col.prop(domain, "collision_collection", text="Collision") class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py index 4b3867f8970..12fb2973b4f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_softbody.py +++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py @@ -56,7 +56,7 @@ class PHYSICS_PT_softbody(PhysicButtonsPanel, Panel): md = context.soft_body softbody = md.settings - layout.prop(softbody, "collision_group") + layout.prop(softbody, "collision_collection") class PHYSICS_PT_softbody_object(PhysicButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 6f1060323b2..32524ec092c 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -400,7 +400,7 @@ class SCENE_PT_rigid_body_world_settings(SceneButtonsPanel, Panel): col.active = rbw.enabled col = col.column() - col.prop(rbw, "group") + col.prop(rbw, "collection") col.prop(rbw, "constraints") col = col.column() diff --git a/release/scripts/templates_py/operator_modal_view3d_raycast.py b/release/scripts/templates_py/operator_modal_view3d_raycast.py index 4b9700dd3fe..e5467228dfa 100644 --- a/release/scripts/templates_py/operator_modal_view3d_raycast.py +++ b/release/scripts/templates_py/operator_modal_view3d_raycast.py @@ -23,7 +23,7 @@ def main(context, event): if obj.type == 'MESH': yield (obj, obj.matrix_world.copy()) - if obj.dupli_type != 'NONE': + if obj.instance_type != 'NONE': obj.dupli_list_create(scene) for dob in obj.dupli_list: obj_dupli = dob.object -- cgit v1.2.3