1 Star 0 Fork 0

tangyin025/TexTools-Blender

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
op_uv_size_get.py 930 Bytes
一键复制 编辑 原始数据 按行查看 历史
franMarz 提交于 2023-12-25 05:01 . General revision, Stitch added
import bpy
from . import utilities_texel
class op(bpy.types.Operator):
bl_idname = "uv.textools_uv_size_get"
bl_label = "Get Size"
bl_description = "Get the selected Object texture size"
@classmethod
def poll(cls, context):
if not bpy.context.active_object:
return False
if bpy.context.active_object not in bpy.context.selected_objects:
return False
if bpy.context.active_object.type != 'MESH':
return False
return True
def execute(self, context):
get_size(self, context)
return {'FINISHED'}
def get_size(self, context):
image = utilities_texel.get_object_texture_image(bpy.context.active_object)
if not image:
self.report({'ERROR_INVALID_INPUT'}, "No Texture found on selected object")
return
bpy.context.scene.texToolsSettings.size[0] = image.size[0]
bpy.context.scene.texToolsSettings.size[1] = image.size[1]
bpy.utils.register_class(op)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tangyin025/TexTools-Blender.git
[email protected]:tangyin025/TexTools-Blender.git
tangyin025
TexTools-Blender
TexTools-Blender
master

搜索帮助