MaxScript 设置 OBJ Import Options

如果不使用脚本,我们导入obj模型的界面是这个样子的:

调节的参数,只有我们点击了import之后,这些参数才会保存。比如,我导入obj文件时,不想导入材质,那么把Import materials 去掉勾选就可以了。问题是:这个保存只保留在自己电脑,如果被人拿到你的max文件,导入obj模型时,这个操作就会消失,会根据对方默认的设置进行导入。

       此时,我们有两种方法,一是在对方电脑上先导入一个模型,把import materials √去掉。这样对方电脑也和我们一样。另外一种方法是直接调节参数保存的文件,该设置的文件保存路径:C:\Users\admin\AppData\Local\Autodesk\3dsMax\2017 - 64bit\ENU\en-US\plugcfg\gw_objimp.ini 。该文档界面如下:

将ImportMaterials=0(不导入材质)、1(导入材质)

感觉上面说的这些都是废话,会用max的人进本都知道????

问题:如果不用人手工来修改呢?我的max文件在别人电脑导入obj就是不要材质呢?

解决:写脚本,自动执行修改。

参考:https://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__files_GUID_639CF6E0_1B9F_4B05_9CE8_D6418162E0CE_htm


--Open the INI file for editing in the MAXScript Editor
edit (objimp.getIniName())
 
--Alternatively, use INI file access to read and write:
theINI =objimp.getIniName()
getIniSetting theINI--get INI file categories
-->#("General", "Objects", "Geometry", "Units/Scale", "Material")
 
--get the keys of the General category:
getIniSetting theINI "Geometry"
-->#("FlipZyAxis", "CenterPivots", "Shapes", "TextureCoords", "SmoothingGroups", "NormalsType", "SmoothAngle", "FlipNormals")
 
--get thevalueof theGeometry>Shapeskey:
getIniSetting theINI "Geometry""Shapes"
-->"0"
 
--TurnShapes on:
setIniSetting theINI "Geometry""Shapes" "1"
-->true
setIniSetting theINI "Geometry""FlipZyAxis" "0"

做了一下反转测试(setIniSetting theINI "Geometry""FlipZyAxis" "0"),亲测可用。

搞定!!!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值