[Bf-blender-cvs] [d29052a5142] functions: make object an input in mesh collision event
Jacques Lucke
noreply at git.blender.org
Tue Jul 30 13:27:49 CEST 2019
Commit: d29052a51420c8bd56e6384d0951db29a894ed02
Author: Jacques Lucke
Date: Tue Jul 30 10:59:51 2019 +0200
Branches: functions
https://developer.blender.org/rBd29052a51420c8bd56e6384d0951db29a894ed02
make object an input in mesh collision event
===================================================================
M release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py
M source/blender/simulations/bparticles/inserters.cpp
===================================================================
diff --git a/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py b/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py
index f79bc3fce33..d815638952e 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/mesh_collision_event.py
@@ -7,14 +7,7 @@ class MeshCollisionEventNode(bpy.types.Node, BParticlesNode):
bl_idname = "bp_MeshCollisionEventNode"
bl_label = "Mesh Collision Event"
- object: PointerProperty(
- name="Object",
- type=bpy.types.Object,
- )
-
def declaration(self, builder: NodeBuilder):
builder.event_input("event", "Event")
+ builder.fixed_input("object", "Object", "Object")
builder.control_flow_output("on_event", "On event")
-
- def draw(self, layout):
- layout.prop(self, "object", text="")
diff --git a/source/blender/simulations/bparticles/inserters.cpp b/source/blender/simulations/bparticles/inserters.cpp
index 8f8ffda95ee..39a1cfd509d 100644
--- a/source/blender/simulations/bparticles/inserters.cpp
+++ b/source/blender/simulations/bparticles/inserters.cpp
@@ -173,12 +173,18 @@ static std::unique_ptr<Force> BUILD_FORCE_turbulence(
}
static std::unique_ptr<Event> BUILD_EVENT_mesh_collision(
- BuildContext &ctx,
- VirtualNode *vnode,
- std::unique_ptr<ParticleFunction> UNUSED(compute_inputs_fn))
+ BuildContext &ctx, VirtualNode *vnode, std::unique_ptr<ParticleFunction> compute_inputs_fn)
{
- PointerRNA rna = vnode->rna();
- Object *object = (Object *)RNA_pointer_get(&rna, "object").id.data;
+ if (compute_inputs_fn->parameter_depends_on_particle("Object", 0)) {
+ return {};
+ }
+
+ SharedFunction &fn = compute_inputs_fn->function_no_deps();
+ TupleCallBody &body = fn->body<TupleCallBody>();
+ FN_TUPLE_CALL_ALLOC_TUPLES(body, fn_in, fn_out);
+ body.call__setup_execution_context(fn_in, fn_out);
+
+ Object *object = body.get_output<Object *>(fn_out, 0, "Object");
if (object == nullptr || object->type != OB_MESH) {
return {};
}
More information about the Bf-blender-cvs
mailing list