[Bf-blender-cvs] [51f9968] master: C++ RNA: Pass structures by reference
Sergey Sharybin
noreply at git.blender.org
Sat Nov 28 17:21:46 CET 2015
Commit: 51f996836c1bd6484905b224c46f497c7faf66a2
Author: Sergey Sharybin
Date: Sat Nov 28 21:20:30 2015 +0500
Branches: master
https://developer.blender.org/rB51f996836c1bd6484905b224c46f497c7faf66a2
C++ RNA: Pass structures by reference
C++ structures might be rather big and passing them by value is not really
optimal. There should be no functional changes apart from better memory
access pattern when synchronizing huge scenes to Cycles.
===================================================================
M source/blender/makesrna/intern/makesrna.c
===================================================================
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 887124f..ce977da 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1900,9 +1900,13 @@ static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *UNUSED(srn
if (!(flag & PROP_DYNAMIC) && dp->prop->arraydimension)
fprintf(f, "%s %s[%u]", rna_parameter_type_cpp_name(dp->prop),
rna_safe_id(dp->prop->identifier), dp->prop->totarraylength);
- else
- fprintf(f, "%s %s%s", rna_parameter_type_cpp_name(dp->prop),
- ptrstr, rna_safe_id(dp->prop->identifier));
+ else {
+ fprintf(f, "%s%s%s%s",
+ rna_parameter_type_cpp_name(dp->prop),
+ (dp->prop->type == PROP_POINTER && ptrstr[0] == '\0') ? "& " : " ",
+ ptrstr,
+ rna_safe_id(dp->prop->identifier));
+ }
}
fprintf(f, ")");
More information about the Bf-blender-cvs
mailing list