[Bf-extensions-cvs] [d6090097] master: addons: objects.link/unlink syntax update
NBurn
noreply at git.blender.org
Tue Jan 29 16:55:14 CET 2019
Commit: d609009748a604c1df2d8babfa4098260666d01a
Author: NBurn
Date: Tue Jan 29 10:54:49 2019 -0500
Branches: master
https://developer.blender.org/rBAd609009748a604c1df2d8babfa4098260666d01a
addons: objects.link/unlink syntax update
Changed objects.link and objects.unlink from scene to collection
===================================================================
M add_advanced_objects_menu/add_light_template.py
M add_advanced_objects_menu/arrange_on_curve.py
M add_advanced_objects_menu/copy2.py
M add_advanced_objects_menu/cubester.py
M add_advanced_objects_menu/make_struts.py
M add_advanced_objects_menu/oscurart_chain_maker.py
M add_advanced_objects_menu/random_box_structure.py
M add_advanced_objects_menu/trilighting.py
M add_advanced_objects_panels/delaunay_voronoi.py
M add_advanced_objects_panels/object_laplace_lightning.py
M add_advanced_objects_panels/oscurart_constellation.py
M add_mesh_extra_objects/Wallfactory.py
M add_mesh_extra_objects/add_mesh_beam_builder.py
M add_mesh_extra_objects/add_mesh_triangles.py
M add_mesh_extra_objects/mesh_discombobulator.py
M animation_add_corrective_shape_key.py
M btrace/bTrace.py
M io_export_unreal_psk_psa.py
M io_import_scene_lwo.py
M io_import_scene_unreal_psa_psk.py
M io_mesh_pdb/import_pdb.py
M io_scene_ms3d/ms3d_export.py
M io_scene_ms3d/ms3d_import.py
M io_scene_x3d/import_x3d.py
M light_field_tools/light_field_tools.py
M mesh_bsurfaces.py
M mesh_carver.py
M mesh_tissue/tessellate_numpy.py
M mocap/retarget.py
M object_cloud_gen.py
M object_fracture/fracture_ops.py
M object_fracture_cell/__init__.py
M object_fracture_cell/fracture_cell_setup.py
M object_print3d_utils/export.py
M render_povray/primitives.py
M uv_texture_atlas.py
===================================================================
diff --git a/add_advanced_objects_menu/add_light_template.py b/add_advanced_objects_menu/add_light_template.py
index 2ca87c3b..3d6d880e 100644
--- a/add_advanced_objects_menu/add_light_template.py
+++ b/add_advanced_objects_menu/add_light_template.py
@@ -19,7 +19,7 @@ def add_lights(self, context):
constraint.track_axis = 'TRACK_NEGATIVE_Z'
constraint.up_axis = 'UP_X'
constraint.owner_space = 'LOCAL'
- bpy.context.scene.objects.link(ob)
+ bpy.context.collection.objects.link(ob)
ob.rotation_euler[2] = -0.785398
if self.bFillLight:
@@ -34,7 +34,7 @@ def add_lights(self, context):
constraint.track_axis = 'TRACK_NEGATIVE_Z'
constraint.up_axis = 'UP_X'
constraint.owner_space = 'LOCAL'
- bpy.context.scene.objects.link(ob)
+ bpy.context.collection.objects.link(ob)
ob.rotation_euler[2] = 0.785398
ob.data.energy = 0.3
@@ -50,7 +50,7 @@ def add_lights(self, context):
constraint.track_axis = 'TRACK_NEGATIVE_Z'
constraint.up_axis = 'UP_X'
constraint.owner_space = 'LOCAL'
- bpy.context.scene.objects.link(ob)
+ bpy.context.collection.objects.link(ob)
ob.rotation_euler[2] = 3.14159
ob.data.energy = 0.2
diff --git a/add_advanced_objects_menu/arrange_on_curve.py b/add_advanced_objects_menu/arrange_on_curve.py
index 2e1ff4bd..38fbb92a 100644
--- a/add_advanced_objects_menu/arrange_on_curve.py
+++ b/add_advanced_objects_menu/arrange_on_curve.py
@@ -266,7 +266,7 @@ class DupliCurve(Operator):
j += 1
dx -= dist # Calculating the remaining length of the section
obj = object.copy()
- context.scene.objects.link(obj)
+ context.collection.objects.link(obj)
obj.matrix_world = quat * yawMatrix * pitchMatrix * rollMatrix
# Placing in the correct position
obj.matrix_world.translation = point - v_norm * dx
@@ -296,7 +296,7 @@ class DupliCurve(Operator):
j += 1
dx -= dist # Calculating the remaining length of the section
obj = object.copy()
- context.scene.objects.link(obj)
+ context.collection.objects.link(obj)
obj.matrix_world = quat * yawMatrix * pitchMatrix * rollMatrix
# Placing in the correct position
obj.matrix_world.translation = point - v_norm * dx
@@ -332,7 +332,7 @@ class DupliCurve(Operator):
object = G_Objeto[j % len(G_Objeto)]
j += 1
obj = object.copy()
- context.scene.objects.link(obj)
+ context.collection.objects.link(obj)
obj.matrix_world = quat * yawMatrix * pitchMatrix * rollMatrix
# Placing in the correct position
obj.matrix_world.translation = point - v_norm * dx
diff --git a/add_advanced_objects_menu/copy2.py b/add_advanced_objects_menu/copy2.py
index 0492a089..5b1bceb1 100644
--- a/add_advanced_objects_menu/copy2.py
+++ b/add_advanced_objects_menu/copy2.py
@@ -139,7 +139,7 @@ class Copy2(Operator):
return {"CANCELLED"}
try:
copy_to_from(
- context.scene,
+ context.collection,
copy_to_object,
copy_from_object,
self.copytype,
@@ -162,18 +162,18 @@ class Copy2(Operator):
return {"FINISHED"}
-def copy_to_from(scene, to_obj, from_obj, copymode, axes, edgescale, scale):
+def copy_to_from(collection, to_obj, from_obj, copymode, axes, edgescale, scale):
if copymode == 'V':
- vertex_copy(scene, to_obj, from_obj, axes)
+ vertex_copy(collection, to_obj, from_obj, axes)
if copymode == 'E':
# don't pass edgescalling to object types that cannot be scaled
if from_obj.type in ["CAMERA", "LIGHT", "EMPTY", "ARMATURE", "SPEAKER", "META"]:
edgescale = False
- edge_copy(scene, to_obj, from_obj, axes, edgescale, scale)
+ edge_copy(collection, to_obj, from_obj, axes, edgescale, scale)
if copymode == 'F':
- face_copy(scene, to_obj, from_obj, axes)
+ face_copy(collection, to_obj, from_obj, axes)
axes_dict = {'XY': (1, 2, 0),
@@ -184,13 +184,13 @@ axes_dict = {'XY': (1, 2, 0),
'ZY': (1, 0, 2)}
-def copyto(scene, source_obj, pos, xdir, zdir, axes, scale=None):
+def copyto(collection, source_obj, pos, xdir, zdir, axes, scale=None):
"""
copy the source_obj to pos, so its primary axis points in zdir and its
secondary axis points in xdir
"""
copy_obj = source_obj.copy()
- scene.objects.link(copy_obj)
+ collection.objects.link(copy_obj)
xdir = xdir.normalized()
zdir = zdir.normalized()
@@ -219,7 +219,7 @@ def copyto(scene, source_obj, pos, xdir, zdir, axes, scale=None):
return copy_obj
-def vertex_copy(scene, obj, source_obj, axes):
+def vertex_copy(collection, obj, source_obj, axes):
# vertex select mode
sel_verts = []
copy_list = []
@@ -249,7 +249,7 @@ def vertex_copy(scene, obj, source_obj, axes):
xdir = edir - edir.dot(zdir) * zdir
xdir = -xdir.normalized()
- copy = copyto(scene, source_obj, pos, xdir, zdir, axes)
+ copy = copyto(collection, source_obj, pos, xdir, zdir, axes)
copy_list.append(copy)
# select all copied objects
@@ -258,7 +258,7 @@ def vertex_copy(scene, obj, source_obj, axes):
obj.select_set(False)
-def edge_copy(scene, obj, source_obj, axes, es, scale):
+def edge_copy(collection, obj, source_obj, axes, es, scale):
# edge select mode
sel_edges = []
copy_list = []
@@ -292,7 +292,7 @@ def edge_copy(scene, obj, source_obj, axes, es, scale):
i = list('XYZ').index(axes[1])
escale[i] = scale * xlen / source_obj.dimensions[i]
- copy = copyto(scene, source_obj, pos, xdir, zdir, axes, scale=escale)
+ copy = copyto(collection, source_obj, pos, xdir, zdir, axes, scale=escale)
copy_list.append(copy)
# select all copied objects
@@ -301,7 +301,7 @@ def edge_copy(scene, obj, source_obj, axes, es, scale):
obj.select_set(False)
-def face_copy(scene, obj, source_obj, axes):
+def face_copy(collection, obj, source_obj, axes):
# face select mode
sel_faces = []
copy_list = []
@@ -318,7 +318,7 @@ def face_copy(scene, obj, source_obj, axes):
fn = (f.center + f.normal) * obj.matrix_world.transposed() - fco
fn = fn.normalized()
- copy = copyto(scene, source_obj, fco, vco - fco, fn, axes)
+ copy = copyto(collection, source_obj, fco, vco - fco, fn, axes)
copy_list.append(copy)
# select all copied objects
diff --git a/add_advanced_objects_menu/cubester.py b/add_advanced_objects_menu/cubester.py
index 20ebb2aa..8925171a 100644
--- a/add_advanced_objects_menu/cubester.py
+++ b/add_advanced_objects_menu/cubester.py
@@ -199,7 +199,7 @@ def create_mesh_from_audio(self, context, verts, faces):
mesh = bpy.data.meshes.new("cubed")
mesh.from_pydata(verts, [], faces)
ob = bpy.data.objects.new("cubed", mesh)
- bpy.context.scene.objects.link(ob)
+ bpy.context.collection.objects.link(ob)
bpy.context.view_layer.objects.active = ob
ob.select_set(True)
@@ -414,7 +414,7 @@ def create_mesh_from_image(self, scene, verts, faces):
mesh = bpy.data.meshes.new("cubed")
mesh.from_pydata(verts, [], faces)
ob = bpy.data.objects.new("cubed", mesh)
- context.scene.objects.link(ob)
+ context.collection.objects.link(ob)
context.view_layer.objects.active = ob
ob.select_set(True)
diff --git a/add_advanced_objects_menu/make_struts.py b/add_advanced_objects_menu/make_struts.py
index 57cede0a..547fb2f5 100644
--- a/add_advanced_objects_menu/make_struts.py
+++ b/add_advanced_objects_menu/make_struts.py
@@ -491,7 +491,7 @@ def create_struts(self, context, ind, od, segments, solid, loops, manifold):
mesh = bpy.data.meshes.new("Struts")
mesh.from_pydata(verts, [], faces)
obj = bpy.data.objects.new("Struts", mesh)
- bpy.context.scene.objects.link(obj)
+ bpy.context.collection.objects.link(obj)
obj.select_set(True)
obj.location = truss_obj.location
bpy.context.view_layer.objects.active = obj
diff --git a/add_advanced_objects_menu/oscurart_chain_maker.py b/add_advanced_objects_menu/oscurart_chain_maker.py
index b6fca005..a553ae48 100644
--- a/add_advanced_objects_menu/oscurart_chain_maker.py
+++ b/add_advanced_objects_menu/oscurart_chain_maker.py
@@ -90,7 +90,7 @@ def makeChain(self, context, mult, curverig):
(23, 22, 19, 18), (21, 17, 14, 20), (15, 23, 18, 12)]
)
mesh.validate()
- bpy.context.scene.objects.link(object)
+ bpy.context.collection.objects.link(object)
# scale to the bone
bpy.data.objects["HardLink" + str(hueso.name)].scale = (hueso.length * mult,
hueso.length * mult,
@@ -142,7 +142,7 @@ def makeChain(self, context, mult, curverig):
(22, 21, 20, 19), (23, 22, 19, 18), (21, 17, 14, 20), (15, 23, 18, 12)]
)
mesh.validate()
- bpy.context.scene.objects.link(object)
+ bpy.context.collection.objects.link(object)
# scale to the bone
bpy.data.objects["NewLink" + str(hueso.name)].scale = (hueso.length * mult,
hueso.length * mult,
@@ -171,7 +171,7 @@ def makeChain(self, context, mult, curverig):
# create data and link the object to the scene
crv = bpy.data.curves.new("CurvaCable", "CURVE")
obCable = bpy.data.objects.new("Cable", crv)
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list