Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-11-18 22:57:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-11-18 22:57:55 +0300
commitb8710e1468a3ce523c35260e47332393e2b967a3 (patch)
treead1d4de3888bb98a9ecfef3864d806f2edf23ff6 /release/scripts/modules
parent40990d52d143b1698580986405134429b5a4899f (diff)
Fix UV layer bug in object_utils.object_data_add()
Adding a torus in edit-mode, with 'Generate UVs' for example would either create another UV layer with the default name or switch to the default UV layer name if it exists. Now use the existing UV layer if present.
Diffstat (limited to 'release/scripts/modules')
-rw-r--r--release/scripts/modules/bpy_extras/object_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 88cd7398fe0..c48f03c133d 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -189,6 +189,14 @@ def object_data_add(context, obdata, operator=None, use_active_layer=True, name=
scene.update() # apply location
# scene.objects.active = obj_new
+ # Match up UV layers, this is needed so adding an object with UV's
+ # doesn't create new layers when there happens to be a naming mis-match.
+ uv_new = obdata.uv_layers.active
+ if uv_new is not None:
+ uv_act = obj_act.data.uv_layers.active
+ if uv_act is not None:
+ uv_new.name = uv_act.name
+
bpy.ops.object.join() # join into the active.
if obdata:
bpy.data.meshes.remove(obdata)