Commit: 69b96e27ee9d0282b295081462e9ac0a2f75a30e
Author: Clément Foucault
Date:   Wed Feb 15 18:17:50 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB69b96e27ee9d0282b295081462e9ac0a2f75a30e

Collections Settings: Added Bool type.

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

M       source/blender/blenkernel/BKE_layer.h
M       source/blender/blenkernel/intern/layer.c
M       source/blender/blenloader/intern/writefile.c
M       source/blender/makesdna/DNA_layer_types.h
M       source/blender/makesrna/intern/rna_scene.c

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

diff --git a/source/blender/blenkernel/BKE_layer.h 
b/source/blender/blenkernel/BKE_layer.h
index db817bb332..6e12b82e55 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -114,11 +114,14 @@ void 
BKE_layer_collection_engine_settings_list_free(struct ListBase *lb);
 
 void BKE_collection_engine_property_add_float(struct CollectionEngineSettings 
*ces, const char *name, float value);
 void BKE_collection_engine_property_add_int(struct CollectionEngineSettings 
*ces, const char *name, int value);
+void BKE_collection_engine_property_add_bool(struct CollectionEngineSettings 
*ces, const char *name, bool value);
 struct CollectionEngineProperty *BKE_collection_engine_property_get(struct 
CollectionEngineSettings *ces, const char *name);
 int BKE_collection_engine_property_value_get_int(struct 
CollectionEngineSettings *ces, const char *name);
 float BKE_collection_engine_property_value_get_float(struct 
CollectionEngineSettings *ces, const char *name);
+bool BKE_collection_engine_property_value_get_bool(struct 
CollectionEngineSettings *ces, const char *name);
 void BKE_collection_engine_property_value_set_int(struct 
CollectionEngineSettings *ces, const char *name, int value);
 void BKE_collection_engine_property_value_set_float(struct 
CollectionEngineSettings *ces, const char *name, float value);
+void BKE_collection_engine_property_value_set_bool(struct 
CollectionEngineSettings *ces, const char *name, bool value);
 bool BKE_collection_engine_property_use_get(struct CollectionEngineSettings 
*ces, const char *name);
 void BKE_collection_engine_property_use_set(struct CollectionEngineSettings 
*ces, const char *name, bool value);
 
diff --git a/source/blender/blenkernel/intern/layer.c 
b/source/blender/blenkernel/intern/layer.c
index 70fb7a21ef..3e69fa61d9 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -892,6 +892,16 @@ void 
BKE_collection_engine_property_add_int(CollectionEngineSettings *ces, const
        BLI_addtail(&ces->properties, prop);
 }
 
+void BKE_collection_engine_property_add_bool(CollectionEngineSettings *ces, 
const char *name, bool value)
+{
+       CollectionEnginePropertyBool *prop;
+       prop = MEM_callocN(sizeof(CollectionEnginePropertyBool), "collection 
engine settings bool");
+       prop->data.type = COLLECTION_PROP_TYPE_BOOL;
+       BLI_strncpy_utf8(prop->data.name, name, sizeof(prop->data.name));
+       prop->value = value;
+       BLI_addtail(&ces->properties, prop);
+}
+
 CollectionEngineProperty 
*BKE_collection_engine_property_get(CollectionEngineSettings *ces, const char 
*name)
 {
        return BLI_findstring(&ces->properties, name, 
offsetof(CollectionEngineProperty, name));
@@ -911,6 +921,13 @@ float 
BKE_collection_engine_property_value_get_float(CollectionEngineSettings *c
        return prop->value;
 }
 
+bool BKE_collection_engine_property_value_get_bool(CollectionEngineSettings 
*ces, const char *name)
+{
+       CollectionEnginePropertyBool *prop;
+       prop = (CollectionEnginePropertyBool *)BLI_findstring(&ces->properties, 
name, offsetof(CollectionEngineProperty, name));
+       return prop->value;
+}
+
 void BKE_collection_engine_property_value_set_int(CollectionEngineSettings 
*ces, const char *name, int value)
 {
        CollectionEnginePropertyInt *prop;
@@ -927,6 +944,14 @@ void 
BKE_collection_engine_property_value_set_float(CollectionEngineSettings *ce
        prop->data.flag |= COLLECTION_PROP_USE;
 }
 
+void BKE_collection_engine_property_value_set_bool(CollectionEngineSettings 
*ces, const char *name, bool value)
+{
+       CollectionEnginePropertyBool *prop;
+       prop = (CollectionEnginePropertyBool *)BLI_findstring(&ces->properties, 
name, offsetof(CollectionEngineProperty, name));
+       prop->value = value;
+       prop->data.flag |= COLLECTION_PROP_USE;
+}
+
 bool BKE_collection_engine_property_use_get(CollectionEngineSettings *ces, 
const char *name)
 {
        CollectionEngineProperty *prop;
@@ -995,6 +1020,9 @@ static void collection_engine_property_set 
(CollectionEngineProperty *prop_dst,
                    case COLLECTION_PROP_TYPE_INT:
                            ((CollectionEnginePropertyInt *)prop_dst)->value = 
((CollectionEnginePropertyInt *)prop_src)->value;
                            break;
+                   case COLLECTION_PROP_TYPE_BOOL:
+                           ((CollectionEnginePropertyBool *)prop_dst)->value = 
((CollectionEnginePropertyBool *)prop_src)->value;
+                           break;
                    default:
                            BLI_assert(false);
                            break;
diff --git a/source/blender/blenloader/intern/writefile.c 
b/source/blender/blenloader/intern/writefile.c
index ef46026f05..57846f6c03 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2582,6 +2582,9 @@ static void write_collection_engine_settings(WriteData 
*wd, ListBase *lb)
                            case COLLECTION_PROP_TYPE_INT:
                                    writestruct(wd, DATA, 
CollectionEnginePropertyInt, 1, prop);
                                    break;
+                           case COLLECTION_PROP_TYPE_BOOL:
+                                   writestruct(wd, DATA, 
CollectionEnginePropertyBool, 1, prop);
+                                   break;
                            default:
                                    ; /* error: don't know how to write this 
file */
                        }
diff --git a/source/blender/makesdna/DNA_layer_types.h 
b/source/blender/makesdna/DNA_layer_types.h
index 5d8bff3ef1..de2bd51f64 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -127,6 +127,12 @@ typedef struct CollectionEnginePropertyInt {
   int pad;
 } CollectionEnginePropertyInt;
 
+typedef struct CollectionEnginePropertyBool {
+  struct CollectionEngineProperty data;
+  int value;
+  int pad;
+} CollectionEnginePropertyBool;
+
 typedef struct CollectionEnginePropertyFloat {
   struct CollectionEngineProperty data;
   float value;
@@ -150,6 +156,7 @@ enum {
 typedef enum CollectionEnginePropertyType {
        COLLECTION_PROP_TYPE_FLOAT = 0,
        COLLECTION_PROP_TYPE_INT = 1,
+       COLLECTION_PROP_TYPE_BOOL = 2,
 } CollectionEnginePropertyType;
 
 /* CollectionEngineSettings->type */
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index eaa11b04ef..c985e6fd42 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2426,6 +2426,9 @@ static void 
rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr,
 #define RNA_LAYER_ENGINE_CLAY_GET_SET_INT(_NAME_) \
        RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_)
 
+#define RNA_LAYER_ENGINE_CLAY_GET_SET_BOOL(_NAME_) \
+       RNA_LAYER_ENGINE_GET_SET(int, Clay, COLLECTION_MODE_NONE, _NAME_)
+
 /* mode engines */
 
 #define RNA_LAYER_MODE_OBJECT_GET_SET_FLOAT(_NAME_) \
@@ -2434,12 +2437,18 @@ static void 
rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr,
 #define RNA_LAYER_MODE_OBJECT_GET_SET_INT(_NAME_) \
        RNA_LAYER_ENGINE_GET_SET(int, ObjectMode, COLLECTION_MODE_OBJECT, 
_NAME_)
 
+#define RNA_LAYER_MODE_OBJECT_GET_SET_BOOL(_NAME_) \
+       RNA_LAYER_ENGINE_GET_SET(bool, ObjectMode, COLLECTION_MODE_OBJECT, 
_NAME_)
+
 #define RNA_LAYER_MODE_EDIT_GET_SET_FLOAT(_NAME_) \
        RNA_LAYER_ENGINE_GET_SET(float, EditMode, COLLECTION_MODE_EDIT, _NAME_)
 
 #define RNA_LAYER_MODE_EDIT_GET_SET_INT(_NAME_) \
        RNA_LAYER_ENGINE_GET_SET(int, EditMode, COLLECTION_MODE_EDIT, _NAME_)
 
+#define RNA_LAYER_MODE_EDIT_GET_SET_BOOL(_NAME_) \
+       RNA_LAYER_ENGINE_GET_SET(bool, EditMode, COLLECTION_MODE_EDIT, _NAME_)
+
 /* clay engine */
 
 RNA_LAYER_ENGINE_CLAY_GET_SET_INT(type)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to