[Bf-blender-cvs] [c7bf98a1866] functions: push initial function caller information on execution stack

Jacques Lucke noreply at git.blender.org
Thu Mar 28 12:49:13 CET 2019


Commit: c7bf98a1866354f7654eff505a2b9051b6b96492
Author: Jacques Lucke
Date:   Thu Mar 28 09:50:12 2019 +0100
Branches: functions
https://developer.blender.org/rBc7bf98a1866354f7654eff505a2b9051b6b96492

push initial function caller information on execution stack

===================================================================

M	source/blender/blenkernel/intern/fcurve.c
M	source/blender/functions/FN-C.h
M	source/blender/functions/c_wrapper.cpp
M	source/blender/modifiers/intern/MOD_displace.c
M	source/blender/modifiers/intern/MOD_functiondeform.c
M	source/blender/modifiers/intern/MOD_functionpoints.c

===================================================================

diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 3cc2e3e5247..502a58e881e 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1627,7 +1627,7 @@ static float dvar_eval_function(ChannelDriver *UNUSED(driver), DriverVar *dvar)
 	FnTuple fn_out = FN_tuple_for_output(body);
 	FN_tuple_set_int32(fn_in, 0, (int64_t)dvar);
 
-	FN_tuple_call_invoke(body, fn_in, fn_out);
+	FN_tuple_call_invoke(body, fn_in, fn_out, __func__);
 	float result = FN_tuple_get_float(fn_out, 0);
 
 	FN_tuple_free(fn_in);
diff --git a/source/blender/functions/FN-C.h b/source/blender/functions/FN-C.h
index 92df8b8673c..7e54a5c0ab9 100644
--- a/source/blender/functions/FN-C.h
+++ b/source/blender/functions/FN-C.h
@@ -64,7 +64,8 @@ typedef struct OpaqueFnTuple *FnTuple;
 typedef struct OpaqueFnTupleCallBody *FnTupleCallBody;
 
 FnTupleCallBody FN_tuple_call_get(FnFunction fn);
-void FN_tuple_call_invoke(FnTupleCallBody body, FnTuple fn_in, FnTuple fn_out);
+void FN_tuple_call_invoke(
+	FnTupleCallBody body, FnTuple fn_in, FnTuple fn_out, const char *caller_info);
 FnTuple FN_tuple_for_input(FnTupleCallBody body);
 FnTuple FN_tuple_for_output(FnTupleCallBody body);
 
diff --git a/source/blender/functions/c_wrapper.cpp b/source/blender/functions/c_wrapper.cpp
index a051babe9b8..713b6d120cc 100644
--- a/source/blender/functions/c_wrapper.cpp
+++ b/source/blender/functions/c_wrapper.cpp
@@ -139,16 +139,24 @@ LIST_WRAPPER(fvec3, float *, FnFVec3List);
 WRAPPERS(Tuple *, FnTuple);
 WRAPPERS(TupleCallBody *, FnTupleCallBody);
 
-void FN_tuple_call_invoke(FnTupleCallBody body, FnTuple fn_in, FnTuple fn_out)
+void FN_tuple_call_invoke(
+	FnTupleCallBody body,
+	FnTuple fn_in,
+	FnTuple fn_out,
+	const char *caller_info)
 {
 	Tuple &fn_in_ = *unwrap(fn_in);
 	Tuple &fn_out_ = *unwrap(fn_out);
 	TupleCallBody *body_ = unwrap(body);
-
 	BLI_assert(fn_in_.all_initialized());
+
+	/* setup stack */
 	ExecutionStack stack;
+	TextStackFrame caller_frame(caller_info);
+	stack.push(&caller_frame);
 	TextStackFrame function_frame(body_->owner()->name().c_str());
 	stack.push(&function_frame);
+
 	ExecutionContext ctx(stack);
 	body_->call(fn_in_, fn_out_, ctx);
 	BLI_assert(fn_out_.all_initialized());
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 971508c6a91..0bc216004d2 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -230,7 +230,7 @@ static void displaceModifier_do_task(
 		FN_tuple_set_fvec3(fn_in, 0, vertexCos[iter]);
 		FN_tuple_set_int32(fn_in, 1, iter);
 
-		FN_tuple_call_invoke(body, fn_in, fn_out);
+		FN_tuple_call_invoke(body, fn_in, fn_out, __func__);
 
 		weight = FN_tuple_get_float(fn_out, 0);
 
diff --git a/source/blender/modifiers/intern/MOD_functiondeform.c b/source/blender/modifiers/intern/MOD_functiondeform.c
index 550e3602b2e..c8c913fdeca 100644
--- a/source/blender/modifiers/intern/MOD_functiondeform.c
+++ b/source/blender/modifiers/intern/MOD_functiondeform.c
@@ -91,7 +91,7 @@ static void do_deformation(
 		FN_tuple_set_int32(fn_in, 1, seed + i);
 		FN_tuple_set_float(fn_in, 2, fdmd->control1);
 
-		FN_tuple_call_invoke(body, fn_in, fn_out);
+		FN_tuple_call_invoke(body, fn_in, fn_out, __func__);
 
 		FN_tuple_get_fvec3(fn_out, 0, vertexCos[i]);
 	}
diff --git a/source/blender/modifiers/intern/MOD_functionpoints.c b/source/blender/modifiers/intern/MOD_functionpoints.c
index d923f3a04c5..50d73aad25a 100644
--- a/source/blender/modifiers/intern/MOD_functionpoints.c
+++ b/source/blender/modifiers/intern/MOD_functionpoints.c
@@ -79,7 +79,7 @@ static Mesh *build_point_mesh(FunctionPointsModifierData *fpmd)
 
 	FN_tuple_set_float(fn_in, 0, fpmd->control1);
 	FN_tuple_set_int32(fn_in, 1, fpmd->control2);
-	FN_tuple_call_invoke(body, fn_in, fn_out);
+	FN_tuple_call_invoke(body, fn_in, fn_out, __func__);
 	FnFVec3List list = FN_tuple_relocate_out_fvec3_list(fn_out, 0);
 
 	FN_TUPLE_CALL_DESTRUCT_STACK(body, fn_in, fn_out);



More information about the Bf-blender-cvs mailing list