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

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

最近的项目是用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

 

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/791137.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-05
下一篇2022-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存