关于UE4通过python获取静态网格体插槽的问题

之前做项目可以很轻松的获取skeletal mesh的材质插槽,但是静态mesh没有同样的功能。
于是在google 搜到了一个答案,在此记录一下:
Ok, so the function get_material_slot_names() is a method of the StaticMeshComponent class. So you are able to retrieve the materials from base StaticMesh class by first creating a StaticMeshComponent, setting your asset as the static mesh property, then calling get_material_slot_names()

I wrote a simple function to do this:

def get_material_slot_names(static_mesh):
sm_component = unreal.StaticMeshComponent()
sm_component.set_static_mesh(static_mesh)
return unreal.StaticMeshComponent.get_material_slot_names(sm_component)
It seems a bit hacky to have to create a static mesh component just to access the material slots of the mesh itself, but this seems to work well enough for my purposes.

链接: https://answers.unrealengine.com/questions/972932/get-material-slot-names-for-static-mesh-in-python.html.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值