Nodes: support Value node in simulation node tree

This commit is contained in:
Jacques Lucke 2020-07-11 16:39:17 +02:00
parent 16d4373158
commit 8fae58ce0b
2 changed files with 10 additions and 1 deletions

View File

@ -484,6 +484,7 @@ simulation_node_categories = [
NodeItem("SimulationNodeTime"),
NodeItem("SimulationNodeParticleAttribute"),
NodeItem("FunctionNodeGroupInstanceID"),
NodeItem("ShaderNodeValue"),
]),
SimulationNodeCategory("SIM_EMITTERS", "Emitters", items=[
NodeItem("SimulationNodeParticleMeshEmitter"),

View File

@ -39,13 +39,21 @@ static int gpu_shader_value(GPUMaterial *mat,
return GPU_stack_link(mat, node, "set_value", in, out, link);
}
static void sh_node_value_expand_in_mf_network(blender::bke::NodeMFNetworkBuilder &builder)
{
const bNodeSocket *bsocket = builder.dnode().output(0).bsocket();
const bNodeSocketValueFloat *value = (const bNodeSocketValueFloat *)bsocket->default_value;
builder.construct_and_set_matching_fn<blender::fn::CustomMF_Constant<float>>(value->value);
}
void register_node_type_sh_value(void)
{
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0);
sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0);
node_type_socket_templates(&ntype, NULL, sh_node_value_out);
node_type_gpu(&ntype, gpu_shader_value);
ntype.expand_in_mf_network = sh_node_value_expand_in_mf_network;
nodeRegisterType(&ntype);
}