[Bf-blender-cvs] [7c7f3776dd0] blender2.8: Use collection and instance terminology in Python API
Sergey Sharybin
noreply at git.blender.org
Wed Nov 28 18:23:06 CET 2018
Commit: 7c7f3776dd0e2f0125a4065e4b4d070a8666ef7c
Author: Sergey Sharybin
Date: Wed Nov 28 17:49:52 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB7c7f3776dd0e2f0125a4065e4b4d070a8666ef7c
Use collection and instance terminology in Python API
This follows naming convention agreed on in T56648.
===================================================================
M intern/cycles/blender/blender_object.cpp
M intern/cycles/blender/blender_shader.cpp
M release/scripts/freestyle/modules/parameter_editor.py
M release/scripts/modules/bl_previews_utils/bl_previews_render.py
M release/scripts/modules/bpy_extras/io_utils.py
M release/scripts/modules/bpy_types.py
M release/scripts/startup/bl_operators/object.py
M release/scripts/startup/bl_operators/rigidbody.py
M release/scripts/startup/bl_ui/properties_freestyle.py
M release/scripts/startup/bl_ui/properties_object.py
M release/scripts/startup/bl_ui/properties_particle.py
M release/scripts/startup/bl_ui/properties_physics_cloth.py
M release/scripts/startup/bl_ui/properties_physics_common.py
M release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
M release/scripts/startup/bl_ui/properties_physics_rigidbody.py
M release/scripts/startup/bl_ui/properties_physics_smoke.py
M release/scripts/startup/bl_ui/properties_physics_softbody.py
M release/scripts/startup/bl_ui/properties_scene.py
M release/scripts/templates_py/operator_modal_view3d_raycast.py
M source/blender/editors/space_node/drawnode.c
M source/blender/makesrna/intern/rna_cloth.c
M source/blender/makesrna/intern/rna_collection.c
M source/blender/makesrna/intern/rna_dynamicpaint.c
M source/blender/makesrna/intern/rna_nodetree.c
M source/blender/makesrna/intern/rna_object.c
M source/blender/makesrna/intern/rna_object_force.c
M source/blender/makesrna/intern/rna_particle.c
M source/blender/makesrna/intern/rna_rigidbody.c
M source/blender/makesrna/intern/rna_scene.c
M source/blender/makesrna/intern/rna_smoke.c
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index a57edf9b940..bcab5276060 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -506,15 +506,15 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
}
static bool object_render_hide_original(BL::Object::type_enum ob_type,
- BL::Object::dupli_type_enum dupli_type)
+ BL::Object::instance_type_enum dupli_type)
{
/* metaball exception, they duplicate self */
if(ob_type == BL::Object::type_META)
return false;
- return (dupli_type == BL::Object::dupli_type_VERTS ||
- dupli_type == BL::Object::dupli_type_FACES ||
- dupli_type == BL::Object::dupli_type_FRAMES);
+ return (dupli_type == BL::Object::instance_type_VERTS ||
+ dupli_type == BL::Object::instance_type_FACES ||
+ dupli_type == BL::Object::instance_type_FRAMES);
}
static bool object_render_hide(BL::Object& b_ob,
@@ -541,15 +541,15 @@ static bool object_render_hide(BL::Object& b_ob,
}
/* Both mode_PREVIEW and mode_VIEWPORT are treated the same here.*/
- const bool show_duplicator = depsgraph_mode == BL::Depsgraph::mode_RENDER
- ? b_ob.show_duplicator_for_render()
- : b_ob.show_duplicator_for_viewport();
+ const bool show_instancer = depsgraph_mode == BL::Depsgraph::mode_RENDER
+ ? b_ob.show_instancer_for_render()
+ : b_ob.show_instancer_for_viewport();
if(has_particles) {
- show_emitter = show_duplicator;
+ show_emitter = show_instancer;
hide_emitter = !show_emitter;
- } else if(b_ob.is_duplicator()) {
- if(top_level || show_duplicator) {
+ } else if(b_ob.is_instancer()) {
+ if(top_level || show_instancer) {
hide_as_dupli_parent = true;
}
}
@@ -558,7 +558,7 @@ static bool object_render_hide(BL::Object& b_ob,
BL::Object parent = b_ob.parent();
while(parent) {
if(object_render_hide_original(b_ob.type(),
- parent.dupli_type()))
+ parent.instance_type()))
{
if(parent_hide) {
hide_as_dupli_child_original = true;
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 604c134a2f7..b04a0394141 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -812,7 +812,7 @@ static ShaderNode *add_node(Scene *scene,
else if(b_node.is_a(&RNA_ShaderNodeTexCoord)) {
BL::ShaderNodeTexCoord b_tex_coord_node(b_node);
TextureCoordinateNode *tex_coord = new TextureCoordinateNode();
- tex_coord->from_dupli = b_tex_coord_node.from_dupli();
+ tex_coord->from_dupli = b_tex_coord_node.from_instancer();
if(b_tex_coord_node.object()) {
tex_coord->use_transform = true;
tex_coord->ob_tfm = get_transform(b_tex_coord_node.object().matrix_world());
@@ -865,7 +865,7 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeUVMap b_uvmap_node(b_node);
UVMapNode *uvm = new UVMapNode();
uvm->attribute = b_uvmap_node.uv_map();
- uvm->from_dupli = b_uvmap_node.from_dupli();
+ uvm->from_dupli = b_uvmap_node.from_instancer();
node = uvm;
}
else if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) {
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/sta
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list