forked from bartvdbraak/blender
use 2d vectors for mask point access.
This commit is contained in:
parent
2029b0205a
commit
603842fad4
@ -155,56 +155,38 @@ static StructRNA *rna_Curve_refine(PointerRNA *ptr)
|
|||||||
|
|
||||||
static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
|
static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
|
||||||
{
|
{
|
||||||
BezTriple *bt = (BezTriple *)ptr->data;
|
BezTriple *bezt = (BezTriple *)ptr->data;
|
||||||
|
copy_v3_v3(values, bezt->vec[0]);
|
||||||
values[0] = bt->vec[0][0];
|
|
||||||
values[1] = bt->vec[0][1];
|
|
||||||
values[2] = bt->vec[0][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
|
static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
|
||||||
{
|
{
|
||||||
BezTriple *bt = (BezTriple *)ptr->data;
|
BezTriple *bezt = (BezTriple *)ptr->data;
|
||||||
|
copy_v3_v3(bezt->vec[0], values);
|
||||||
bt->vec[0][0] = values[0];
|
|
||||||
bt->vec[0][1] = values[1];
|
|
||||||
bt->vec[0][2] = values[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
|
static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
|
||||||
{
|
{
|
||||||
BezTriple *bt = (BezTriple *)ptr->data;
|
BezTriple *bezt = (BezTriple *)ptr->data;
|
||||||
|
copy_v3_v3(values, bezt->vec[2]);
|
||||||
values[0] = bt->vec[2][0];
|
|
||||||
values[1] = bt->vec[2][1];
|
|
||||||
values[2] = bt->vec[2][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
|
static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
|
||||||
{
|
{
|
||||||
BezTriple *bt = (BezTriple *)ptr->data;
|
BezTriple *bezt = (BezTriple *)ptr->data;
|
||||||
|
copy_v3_v3(bezt->vec[2], values);
|
||||||
bt->vec[2][0] = values[0];
|
|
||||||
bt->vec[2][1] = values[1];
|
|
||||||
bt->vec[2][2] = values[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
|
static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
|
||||||
{
|
{
|
||||||
BezTriple *bt = (BezTriple *)ptr->data;
|
BezTriple *bezt = (BezTriple *)ptr->data;
|
||||||
|
copy_v3_v3(values, bezt->vec[1]);
|
||||||
values[0] = bt->vec[1][0];
|
|
||||||
values[1] = bt->vec[1][1];
|
|
||||||
values[2] = bt->vec[1][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
|
static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
|
||||||
{
|
{
|
||||||
BezTriple *bt = (BezTriple *)ptr->data;
|
BezTriple *bezt = (BezTriple *)ptr->data;
|
||||||
|
copy_v3_v3(bezt->vec[1], values);
|
||||||
bt->vec[1][0] = values[0];
|
|
||||||
bt->vec[1][1] = values[1];
|
|
||||||
bt->vec[1][2] = values[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
|
||||||
|
@ -250,60 +250,42 @@ static void rna_MaskSplinePoint_handle1_get(PointerRNA *ptr, float *values)
|
|||||||
{
|
{
|
||||||
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
||||||
BezTriple *bezt = &point->bezt;
|
BezTriple *bezt = &point->bezt;
|
||||||
|
copy_v2_v2(values, bezt->vec[0]);
|
||||||
values[0] = bezt->vec[0][0];
|
|
||||||
values[1] = bezt->vec[0][1];
|
|
||||||
values[2] = bezt->vec[0][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskSplinePoint_handle1_set(PointerRNA *ptr, const float *values)
|
static void rna_MaskSplinePoint_handle1_set(PointerRNA *ptr, const float *values)
|
||||||
{
|
{
|
||||||
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
||||||
BezTriple *bezt = &point->bezt;
|
BezTriple *bezt = &point->bezt;
|
||||||
|
copy_v2_v2(bezt->vec[0], values);
|
||||||
bezt->vec[0][0] = values[0];
|
|
||||||
bezt->vec[0][1] = values[1];
|
|
||||||
bezt->vec[0][2] = values[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskSplinePoint_handle2_get(PointerRNA *ptr, float *values)
|
static void rna_MaskSplinePoint_handle2_get(PointerRNA *ptr, float *values)
|
||||||
{
|
{
|
||||||
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
||||||
BezTriple *bezt = &point->bezt;
|
BezTriple *bezt = &point->bezt;
|
||||||
|
copy_v2_v2(values, bezt->vec[2]);
|
||||||
values[0] = bezt->vec[2][0];
|
|
||||||
values[1] = bezt->vec[2][1];
|
|
||||||
values[2] = bezt->vec[2][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskSplinePoint_handle2_set(PointerRNA *ptr, const float *values)
|
static void rna_MaskSplinePoint_handle2_set(PointerRNA *ptr, const float *values)
|
||||||
{
|
{
|
||||||
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
||||||
BezTriple *bezt = &point->bezt;
|
BezTriple *bezt = &point->bezt;
|
||||||
|
copy_v2_v2(bezt->vec[2], values);
|
||||||
bezt->vec[2][0] = values[0];
|
|
||||||
bezt->vec[2][1] = values[1];
|
|
||||||
bezt->vec[2][2] = values[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskSplinePoint_ctrlpoint_get(PointerRNA *ptr, float *values)
|
static void rna_MaskSplinePoint_ctrlpoint_get(PointerRNA *ptr, float *values)
|
||||||
{
|
{
|
||||||
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
||||||
BezTriple *bezt = &point->bezt;
|
BezTriple *bezt = &point->bezt;
|
||||||
|
copy_v2_v2(values, bezt->vec[1]);
|
||||||
values[0] = bezt->vec[1][0];
|
|
||||||
values[1] = bezt->vec[1][1];
|
|
||||||
values[2] = bezt->vec[1][2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_MaskSplinePoint_ctrlpoint_set(PointerRNA *ptr, const float *values)
|
static void rna_MaskSplinePoint_ctrlpoint_set(PointerRNA *ptr, const float *values)
|
||||||
{
|
{
|
||||||
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
MaskSplinePoint *point = (MaskSplinePoint*) ptr->data;
|
||||||
BezTriple *bezt = &point->bezt;
|
BezTriple *bezt = &point->bezt;
|
||||||
|
copy_v2_v2(bezt->vec[1], values);
|
||||||
bezt->vec[1][0] = values[0];
|
|
||||||
bezt->vec[1][1] = values[1];
|
|
||||||
bezt->vec[1][2] = values[2];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_MaskSplinePoint_handle_type_get(PointerRNA *ptr)
|
static int rna_MaskSplinePoint_handle_type_get(PointerRNA *ptr)
|
||||||
@ -479,19 +461,19 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna)
|
|||||||
|
|
||||||
/* Vector values */
|
/* Vector values */
|
||||||
prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
|
prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
|
||||||
RNA_def_property_array(prop, 3);
|
RNA_def_property_array(prop, 2);
|
||||||
RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", NULL);
|
RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", NULL);
|
||||||
RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
|
RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
|
||||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
|
prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
|
||||||
RNA_def_property_array(prop, 3);
|
RNA_def_property_array(prop, 2);
|
||||||
RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", NULL);
|
RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", NULL);
|
||||||
RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
|
RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
|
||||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
|
prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
|
||||||
RNA_def_property_array(prop, 3);
|
RNA_def_property_array(prop, 2);
|
||||||
RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", NULL);
|
RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", NULL);
|
||||||
RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
|
RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
|
||||||
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
RNA_def_property_update(prop, 0, "rna_Mask_update_data");
|
||||||
|
Loading…
Reference in New Issue
Block a user