Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-05-10 20:12:00 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-05-10 20:25:39 +0300
commit4240b67e4cb7f757be7f6ee7e0cc8fda60fbe711 (patch)
tree29e8dc3dedc982d994ac2f9fbac4b92e6eae6117 /source/blender/blenkernel
parente5ec386803f50c8fb75bd5ba842baa0c964ac3e1 (diff)
Expand the collection settings API to support float arrays
We still need to update the RNA interface to access those. But since there is no RNA_def_property_float_array_funcs I'm not sure how many changes this will require.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_layer.h4
-rw-r--r--source/blender/blenkernel/intern/layer.c24
2 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index b6a8cb04ec8..be4b40b90ff 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -129,14 +129,18 @@ void BKE_scene_layer_engine_settings_validate_layer(struct SceneLayer *sl);
void BKE_scene_layer_engine_settings_create(struct IDProperty *root);
void BKE_collection_engine_property_add_float(struct IDProperty *props, const char *name, float value);
+void BKE_collection_engine_property_add_float_array(
+ struct IDProperty *props, const char *name, const float *values, const int array_length);
void BKE_collection_engine_property_add_int(struct IDProperty *props, const char *name, int value);
void BKE_collection_engine_property_add_bool(struct IDProperty *props, const char *name, bool value);
int BKE_collection_engine_property_value_get_int(struct IDProperty *props, const char *name);
float BKE_collection_engine_property_value_get_float(struct IDProperty *props, const char *name);
+const float *BKE_collection_engine_property_value_get_float_array(struct IDProperty *props, const char *name);
bool BKE_collection_engine_property_value_get_bool(struct IDProperty *props, const char *name);
void BKE_collection_engine_property_value_set_int(struct IDProperty *props, const char *name, int value);
void BKE_collection_engine_property_value_set_float(struct IDProperty *props, const char *name, float value);
+void BKE_collection_engine_property_value_set_float_array(struct IDProperty *props, const char *name, const float *values);
void BKE_collection_engine_property_value_set_bool(struct IDProperty *props, const char *name, bool value);
/* evaluation */
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index baecd64504c..5942e575fd2 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1333,6 +1333,18 @@ void BKE_collection_engine_property_add_float(IDProperty *props, const char *nam
IDP_AddToGroup(props, IDP_New(IDP_FLOAT, &val, name));
}
+void BKE_collection_engine_property_add_float_array(
+ IDProperty *props, const char *name, const float *values, const int array_length)
+{
+ IDPropertyTemplate val = {0};
+ val.array.len = array_length;
+ val.array.type = IDP_FLOAT;
+
+ IDProperty *idprop= IDP_New(IDP_ARRAY, &val, name);
+ memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
+ IDP_AddToGroup(props, idprop);
+}
+
void BKE_collection_engine_property_add_int(IDProperty *props, const char *name, int value)
{
IDPropertyTemplate val = {0};
@@ -1359,6 +1371,12 @@ float BKE_collection_engine_property_value_get_float(IDProperty *props, const ch
return idprop ? IDP_Float(idprop) : 0.0f;
}
+const float *BKE_collection_engine_property_value_get_float_array(IDProperty *props, const char *name)
+{
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ return idprop ? IDP_Array(idprop) : NULL;
+}
+
bool BKE_collection_engine_property_value_get_bool(IDProperty *props, const char *name)
{
IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
@@ -1377,6 +1395,12 @@ void BKE_collection_engine_property_value_set_float(IDProperty *props, const cha
IDP_Float(idprop) = value;
}
+void BKE_collection_engine_property_value_set_float_array(IDProperty *props, const char *name, const float *values)
+{
+ IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);
+ memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
+}
+
void BKE_collection_engine_property_value_set_bool(IDProperty *props, const char *name, bool value)
{
IDProperty *idprop = IDP_GetPropertyFromGroup(props, name);