简体   繁体   English

如何从 Blender python 触发脚本节点更新?

[英]How to trigger script node update from Blender python?

I have a Blender model, that uses a script to generate a shader.我有一个 Blender 模型,它使用脚本生成着色器。 This script takes as input the output of a Value Node, and uses this value to generate a pattern.此脚本将值节点的输出作为输入,并使用此值生成模式。

I would like to use a python Blender script to: - change the "Value" being fed into the script - perform the "script node update" as if I was pressing the button in the script node - render and save.我想使用 python Blender 脚本来: - 更改输入脚本的“值” - 执行“脚本节点更新”,就像我按下脚本节点中的按钮一样 - 渲染并保存。

I'd be looping through a set of 20 "values" so want to do this in one click.我会循环遍历一组 20 个“值”,所以想一键完成。

在此处输入图片说明

I found the simplest way to do what I wanted was to actually update the default value for the input parameters to the script node.我发现做我想做的最简单的方法是实际更新脚本节点的输入参数的默认值。 This actually triggers the script to update at the same time.这实际上会同时触发脚本进行更新。

nodeScript.inputs[2].default_value = 100 nodeScript.inputs[2].default_value = 100

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM