代码拉取完成,页面将自动刷新
import bpy
from . import utilities_ui
from . import utilities_uv
class op(bpy.types.Operator):
bl_idname = "uv.textools_uv_channel_add"
bl_label = "Add UV Channel"
bl_description = "Add a new UV channel to all the selected Objects"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
if not bpy.context.active_object:
return False
if bpy.context.active_object.type != 'MESH':
return False
return True
def execute(self, context):
premode = bpy.context.active_object.mode
utilities_uv.multi_object_loop(adduvs, self, context)
bpy.ops.object.mode_set(mode=premode)
return {'FINISHED'}
def adduvs(self, context):
if len( bpy.context.object.data.uv_layers ) == 0:
bpy.context.active_object.data.uv_layers.new(name="UVMap")
else:
# Add new UV channel based on last
#bpy.ops.mesh.uv_texture_add()
name = "UVMap" + str(len(bpy.context.active_object.data.uv_layers)+1)
bpy.context.active_object.data.uv_layers.new(name=name)
# Get current index
index = len(bpy.context.object.data.uv_layers)-1
bpy.context.object.data.uv_layers.active_index = index
bpy.context.scene.texToolsSettings.uv_channel = str(index)
bpy.context.active_object.data.uv_layers[0].active_render = True
bpy.utils.register_class(op)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。