Maya FBX导出导入

2024-03-26 09:44
文章标签 fbx 导出 导入 maya

本文主要是介绍Maya FBX导出导入,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

问题描述:

Maya 导出导入 FBX,设置 FBX 的 导入和导出设置

解决方案:

获取FBX设置

def getFBXSettings():""" get current user settings for FBX export and store them """mel.eval('FBXPushSettings;')def setFBXSettings():""" set user-defined FBX settings back after export """mel.eval('FBXPopSettings;')

导出 FBX


def exportFBX(export_file_path, selected=True, **kwargs):""""""smoothing_groups = kwargs.get('smoothing_groups', 'true')hard_edges = kwargs.get('hard_edges', 'false')tangents = kwargs.get('tangents', 'false')smooth_mesh = kwargs.get('smooth_mesh', 'true')instances = kwargs.get('instances', 'false')referenced_assets_content = kwargs.get('referenced_assets_content','false')animation_only = kwargs.get('animation_only', 'false')bake_complex_animation = kwargs.get('bake_complex_animation', 'false')bake_complex_step = kwargs.get('bake_complex_step', '1')use_scene_name = kwargs.get('use_scene_name', 'false')quaternion = kwargs.get('quaternion', 'euler')shapes = kwargs.get('shapes', 'false')skins = kwargs.get('skins', 'false')skeleton = kwargs.get('skeleton', 'false')constraints = kwargs.get('constraints', 'false')cameras = kwargs.get('cameras', 'false')lights = kwargs.get('lights', 'false')embed_media = kwargs.get('embed_media', 'false')connections = kwargs.get('connections', 'false')up_axis = kwargs.get('up_axis', 'y')in_ascii = kwargs.get('in_ascii', 'false')# store current user FBX settingsgetFBXSettings()# export selected as FBX# Geometrymel.eval("FBXExportSmoothingGroups -v {}".format(smoothing_groups))mel.eval("FBXExportHardEdges -v {}".format(hard_edges))mel.eval("FBXExportTangents -v {}".format(tangents))mel.eval("FBXExportSmoothMesh -v {}".format(smooth_mesh))mel.eval("FBXExportInstances -v {}".format(instances))mel.eval("FBXExportReferencedAssetsContent -v {}".format(referenced_assets_content))mel.eval("FBXExportAnimationOnly -v {}".format(animation_only))mel.eval("FBXExportBakeComplexAnimation -v {}".format(bake_complex_animation))mel.eval("FBXExportBakeComplexStep -v {}".format(bake_complex_step))mel.eval("FBXExportUseSceneName -v {}".format(use_scene_name))mel.eval("FBXExportQuaternion -v {}".format(quaternion))mel.eval("FBXExportShapes -v {}".format(shapes))mel.eval("FBXExportSkins -v {}".format(skins))mel.eval('FBXExportSkeletonDefinitions -v {}'.format(skeleton))# Constraintsmel.eval("FBXExportConstraints -v {}".format(constraints))# Camerasmel.eval("FBXExportCameras -v {}".format(cameras))# Lightsmel.eval("FBXExportLights -v {}".format(lights))# Embed Mediamel.eval("FBXExportEmbeddedTextures -v {}".format(embed_media))# Connectionsmel.eval("FBXExportInputConnections -v {}".format(connections))# Axis Conversionmel.eval("FBXExportUpAxis {}".format(up_axis))# Version# mel.eval("FBXExportFileVersion -v FBX201600")mel.eval("FBXExportInAscii -v {}".format(in_ascii))try:# cmds.file(r'{}'.format(export_file_path), exportSelected=selected,#           type="FBX export",#           force=True, prompt=False)if selected:cmds.FBXExport('-file', export_file_path, '-s')else:cmds.FBXExport('-file', export_file_path)except Exception as e:print(e)print(export_file_path)# restore current user FBX settingssetFBXSettings()

导入FBX


def import_fbx(fbx_file, **kwargs):log = kwargs.get('log', 'false')axis_conversion = kwargs.get('axis_conversion', 'true')cache_file = kwargs.get('cache_file', 'true')import_camera = kwargs.get('import_camera', 'false')import_constraints = kwargs.get('import_constraints', 'false')convert_joint = kwargs.get('convert_joint', 'true')convert_unit = kwargs.get('convert_unit', 'cm')fit_timeline = kwargs.get('fit_timeline', 'true')force_axis = kwargs.get('force_axis', 'y')hard_edge = kwargs.get('hard_edge', 'false')import_light = kwargs.get('import_light', 'false')merge_pivots = kwargs.get('merge_pivots', 'true')merge_ani_layer = kwargs.get('merge_ani_layer', 'true')import_mode = kwargs.get('import_mode', 'merge')import_driven_key = kwargs.get('import_driven_key', 'false')quaternion = kwargs.get('quaternion', 'resample')resample_rate = kwargs.get('resample_rate', 'File')# scale_factor_enable = kwargs.get('scale_factor_enable', 'false')scale_factor = kwargs.get('scale_factor_enable', 1.0)frame_rate = kwargs.get('frame_rate', 'true')lock_attr = kwargs.get('lock_attr', 'false')set_take = kwargs.get('set_take', 0)import_shape = kwargs.get('import_shape', 'true')skeleton_type = kwargs.get('skeleton_type', 'humanik')import_skin = kwargs.get('import_skin', 'true')lock_normal = kwargs.get('lock_normal', 'false')up_axis = kwargs.get('up_axis', 'y')# store current user FBX settingsgetFBXSettings()# optionsmel.eval("FBXImportGenerateLog -v {}".format(log))mel.eval("FBXImportAxisConversionEnable -v {}".format(axis_conversion))mel.eval("FBXImportCacheFile -v {}".format(cache_file))mel.eval("FBXImportCameras -v {}".format(import_camera))mel.eval("FBXImportConstraints -v {}".format(import_constraints))mel.eval("FBXImportConvertDeformingNullsToJoint -v {}".format(convert_joint))mel.eval("FBXImportConvertUnitString {}".format(convert_unit))mel.eval("FBXImportFillTimeline -v {}".format(fit_timeline))mel.eval("FBXImportForcedFileAxis -v {}".format(force_axis))mel.eval("FBXImportHardEdges -v {}".format(hard_edge))mel.eval("FBXImportLights -v {}".format(import_light))mel.eval("FBXImportMergeBackNullPivots -v {}".format(merge_pivots))mel.eval("FBXImportMergeAnimationLayers -v {}".format(merge_ani_layer))mel.eval("FBXImportMode -v {}".format(import_mode))mel.eval("FBXImportProtectDrivenKeys -v {}".format(import_driven_key))mel.eval("FBXImportQuaternion -v {}".format(quaternion))mel.eval("FBXImportResamplingRateSource -v {}".format(resample_rate))# mel.eval("FBXImportScaleFactorEnable {}".format(scale_factor_enable))mel.eval("FBXImportScaleFactor {}".format(scale_factor))mel.eval("FBXImportSetMayaFrameRate -v {}".format(frame_rate))mel.eval("FBXImportSetLockedAttribute -v {}".format(lock_attr))mel.eval("FBXImportSetTake -ti {}".format(set_take))mel.eval("FBXImportShapes -v {}".format(import_shape))# mel.eval("FBXImportSkeletonType -v {}".format(skeleton_type))mel.eval("FBXImportSkins -v {}".format(import_skin))mel.eval("FBXImportUnlockNormals -v {}".format(lock_normal))mel.eval("FBXImportUpAxis {}".format(up_axis))try:cmds.FBXImport('-file', fbx_file)except Exception as e:traceback.print_exc()print(fbx_file)# restore current user FBX settingssetFBXSettings()

这篇关于Maya FBX导出导入的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/848074

相关文章

python: 多模块(.py)中全局变量的导入

文章目录 global关键字可变类型和不可变类型数据的内存地址单模块(单个py文件)的全局变量示例总结 多模块(多个py文件)的全局变量from x import x导入全局变量示例 import x导入全局变量示例 总结 global关键字 global 的作用范围是模块(.py)级别: 当你在一个模块(文件)中使用 global 声明变量时,这个变量只在该模块的全局命名空

MySQL使用mysqldump导出数据

mysql mysqldump只导出表结构或只导出数据的实现方法 备份数据库: #mysqldump 数据库名 >数据库备份名 #mysqldump -A -u用户名 -p密码 数据库名>数据库备份名 #mysqldump -d -A --add-drop-table -uroot -p >xxx.sql 1.导出结构不导出数据 mysqldump --opt -d 数据库名 -u

一步一步将PlantUML类图导出为自定义格式的XMI文件

一步一步将PlantUML类图导出为自定义格式的XMI文件 说明: 首次发表日期:2024-09-08PlantUML官网: https://plantuml.com/zh/PlantUML命令行文档: https://plantuml.com/zh/command-line#6a26f548831e6a8cPlantUML XMI文档: https://plantuml.com/zh/xmi

如何导入sun.misc.BASE64Encoder和sum.misc.BASE64Decoder

右击项目名--->Build Path--->Configure Build Path...--->java Build Path--->Access rules:1 rule defined,added to all librar...   --->Edit --->Add...

mysql中导入txt文件数据的操作指令

1 表tt的格式:    CREATE TABLE `tt` (   `ind` int NOT NULL auto_increment,   `name` char(100) default NULL,   PRIMARY KEY  (`ind`)  )   2 文件d.txt的内容示例:  1,a  2,b  3,c

SpringBoot中利用EasyExcel+aop实现一个通用Excel导出功能

一、结果展示 主要功能:可以根据前端传递的参数,导出指定列、指定行 1.1 案例一 前端页面 传递参数 {"excelName": "导出用户信息1725738666946","sheetName": "导出用户信息","fieldList": [{"fieldName": "userId","fieldDesc": "用户id"},{"fieldName": "age","fieldDe

分享MSSQL、MySql、Oracle的大数据批量导入方法及编程手法细节

1:MSSQL SQL语法篇: BULK INSERT      [ database_name . [ schema_name ] . | schema_name . ] [ table_name | view_name ]         FROM 'data_file'        [ WITH       (      [ [ , ] BATCHSIZE = batch_siz

插件maven-search:Maven导入依赖时,使用插件maven-search拷贝需要的依赖的GAV

然后粘贴: <dependency>    <groupId>mysql</groupId>    <artifactId>mysql-connector-java</artifactId>    <version>8.0.26</version> </dependency>

Pr 入门系列之二:导入与管理素材(下)

◆  ◆  ◆ 管理素材 导入素材后,项目面板中每一个媒体都只是原始素材的“链接”。 所以,视频编辑过程中一般情况下都不会破坏原始素材。 1、在不同视图模式下组织素材 项目面板提供了三大视图 View供选用:列表视图、图标视图以及自由格式视图。 A. 锁定 B. 列表视图 C. 图标视图 D. 自由格式视图 E. 缩放滑块 F. 排序图标 G. 自动匹配序列 H. 查找 I. 新建素材箱 J.

win10不用anaconda安装tensorflow-cpu并导入pycharm

记录一下防止忘了 一、前提:已经安装了python3.6.4,想用tensorflow的包 二、在pycharm中File-Settings-Project Interpreter点“+”号导入很慢,所以直接在cmd中使用 pip install -i https://mirrors.aliyun.com/pypi/simple tensorflow-cpu下载好,默认下载的tensorflow