在UE4中用Houdini Engine设置Houdini Inputs、Houdini Parameters、bake的脚本(部分python代码)

最近的项目是用python脚本把HDA模型导入UE4并在Houdini Inputs中设置几何输入以及模型:

def configure_inputs(self, in_wrapper):
        print('configure_inputs')
        in_wrapper.on_post_instantiation_delegate.remove_callable(self.configure_inputs)

        geo_input = in_wrapper.create_empty_input(unreal.HoudiniPublicAPIGeoInput)
        geo_input.set_input_objects((self.asset, ))
        geo_input.set_object_transform_offset(
            self.asset,
            unreal.Transform(
                (0, 0, 0),
                (0, 0, 0),
                (0, 0, 0),
            )
        )
        in_wrapper.set_input_at_index(0, geo_input)
        geo_input = None

然后还要设置hda的参数:

def on_post_instantiation(self, in_wrapper):
        print('on_post_instantiation')
      in_wrapper.on_post_instantiation_delegate.remove_callable(self.on_post_instantiation)
        # 设置normal_blend_factor和Blendmode的默认值:        
        in_wrapper.set_float_parameter_value('normal_blend_factor', 0.7)
        in_wrapper.set_int_parameter_value('Blendmode', 2)

最后bake出来(默认bake路径是/Game/HoudiniEngine/Bake):

def on_post_bake(self, in_wrapper, success):
        print('on_post_bake')
        in_wrapper.on_post_bake_delegate.remove_callable(self.on_post_bake)
        print('bake complete ... {}'.format('success' if success else 'failed'))

        in_wrapper.delete_instantiated_asset()
        global _g_wrapper
        _g_wrapper = None

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值