Code review - Issue 5091046: RNA write access for CurveMaphttps://codereview.appspot.com/2011-09-22T07:07:13+00:00rietveld
Message from unknown
2011-09-21T11:50:34+00:00lukas.toenneurn:md5:a864706919d5ff5e2034d5cb7838d356
Message from lukas.toenne@googlemail.com
2011-09-21T11:50:35+00:00lukas.toenneurn:md5:81c691dba942282b58f87d2c07d4dbcf
Message from lukas.toenne@googlemail.com
2011-09-21T11:57:32+00:00lukas.toenneurn:md5:089df3b84b7c929694830cd3e9ae427c
Further explanation:
Updating points in a CurveMap requires update calls on the CurveMapping struct. Since this is unknown to the CurveMap itself, this has been disabled in the RNA (CurveMap points are readonly, except for selection flag, which does not require the update).
To work around this i added some RNA functions to CurveMapping, wrapping the C functions used for this purpose. They take the curve map index as a required parameter. The remove and set_handle functions work on all selected points (as in C code), so in order to update specific points without messing up selection one would have to save the selection state and restore later.
Not as elegant as direct CurveMapPoint functions, but a suitable workaround imho.
Message from ideasman42@gmail.com
2011-09-22T07:07:13+00:00ideasman42urn:md5:f2583029ce8a89dcd840852650837eb9
Generally functionality is ok, but would like to have this match Curve and FCurve style access, comments inline.
http://codereview.appspot.com/5091046/diff/1/source/blender/makesrna/intern/rna_color.c
File source/blender/makesrna/intern/rna_color.c (right):
http://codereview.appspot.com/5091046/diff/1/source/blender/makesrna/intern/rna_color.c#newcode161
source/blender/makesrna/intern/rna_color.c:161: static void rna_CurveMapping_set_point_handles(CurveMapping *cumap, int cuma_index, int handle_type)
Why add this when we have CurveMapPoint.handle_type ???
http://codereview.appspot.com/5091046/diff/1/source/blender/makesrna/intern/rna_color.c#newcode425
source/blender/makesrna/intern/rna_color.c:425: prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
add/remove points function should be added here.
I'd like this to follow Bezier curve / FCurve api style where possible.
http://codereview.appspot.com/5091046/diff/1/source/blender/makesrna/intern/rna_color.c#newcode486
source/blender/makesrna/intern/rna_color.c:486: func= RNA_def_function(srna, "reset", "rna_CurveMapping_reset");
Rather then passing an index this should be a member of CurveMap.