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:
authorBastien Montagne <bastien@blender.org>2020-06-16 18:14:50 +0300
committerBastien Montagne <bastien@blender.org>2020-06-16 18:40:30 +0300
commit94fba47513239a2ea20722d7d68b19e7e69e6b26 (patch)
tree9a64a84d583e628eeba29f4fb76df9411711cb3e /source/blender
parent9e307117f8399eb84f1c4932a1f577ecdd0c8a2d (diff)
Cleanup: use explicit enum type for duplicate option of `BKE_object_duplicate`
Using enum type itself in implementations, and uint in headers (as using enums types in headers is a pain when enum are not defined and used in a single same header file...).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/intern/collection.c2
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c2
-rw-r--r--source/blender/editors/include/ED_object.h2
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c11
-rw-r--r--source/blender/editors/object/object_add.c8
-rw-r--r--source/blender/io/collada/BCMath.cpp2
9 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 3710ec810ce..4096c4f2ec1 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -138,7 +138,7 @@ bool BKE_object_obdata_is_libdata(const struct Object *ob);
struct Object *BKE_object_duplicate(struct Main *bmain,
const struct Object *ob,
- const int dupflag);
+ const uint dupflag);
void BKE_object_obdata_size_init(struct Object *ob, const float scale);
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 1d084c8ab02..9abcce7c38f 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -391,7 +391,7 @@ static Collection *collection_duplicate_recursive(Main *bmain,
}
if (ob_new == NULL) {
- ob_new = BKE_object_duplicate(bmain, ob_old, object_dupflag);
+ ob_new = BKE_object_duplicate(bmain, ob_old, (eDupli_ID_Flags)object_dupflag);
ID_NEW_SET(ob_old, ob_new);
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 127c5243c7e..fd7ddc9eb6d 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1758,7 +1758,7 @@ Object *BKE_object_copy(Main *bmain, const Object *ob)
* \note Caller MUST free \a newid pointers itself (#BKE_main_id_clear_newpoins()) and call updates
* of DEG too (#DAG_relations_tag_update()).
*/
-Object *BKE_object_duplicate(Main *bmain, const Object *ob, const int dupflag)
+Object *BKE_object_duplicate(Main *bmain, const Object *ob, const uint dupflag)
{
Material ***matarar;
ID *id;
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4e1c07af001..82f5d99aa47 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1432,7 +1432,7 @@ static int separate_exec(bContext *C, wmOperator *op)
/* 2. Duplicate the object and data. */
/* Take into account user preferences for duplicating actions. */
- short dupflag = (U.dupflag & USER_DUP_ACT);
+ const eDupli_ID_Flags dupflag = (U.dupflag & USER_DUP_ACT);
newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, dupflag);
DEG_relations_tag_update(bmain);
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 76776b5c23c..18ffffb3782 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -4277,7 +4277,7 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
/* Create a new object. */
/* Take into account user preferences for duplicating actions. */
- short dupflag = (U.dupflag & USER_DUP_ACT);
+ const eDupli_ID_Flags dupflag = (U.dupflag & USER_DUP_ACT);
base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_prev, dupflag);
ob_dst = base_new->object;
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 5c33513f0a4..ebd7321a46d 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -185,7 +185,7 @@ struct Base *ED_object_add_duplicate(struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer,
struct Base *base,
- int dupflag);
+ const uint dupflag);
void ED_object_parent(struct Object *ob,
struct Object *parent,
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index a0a3d24e49a..2cffb3ecdec 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -4161,7 +4161,7 @@ static Base *mesh_separate_tagged(
CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
/* Take into account user preferences for duplicating actions. */
- short dupflag = USER_DUP_MESH | (U.dupflag & USER_DUP_ACT);
+ const eDupli_ID_Flags dupflag = USER_DUP_MESH | (U.dupflag & USER_DUP_ACT);
base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_old, dupflag);
/* normally would call directly after but in this case delay recalc */
@@ -4233,7 +4233,7 @@ static Base *mesh_separate_arrays(Main *bmain,
CustomData_bmesh_init_pool(&bm_new->pdata, faces_len, BM_FACE);
/* Take into account user preferences for duplicating actions. */
- short dupflag = USER_DUP_MESH | (U.dupflag & USER_DUP_ACT);
+ const eDupli_ID_Flags dupflag = USER_DUP_MESH | (U.dupflag & USER_DUP_ACT);
base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_old, dupflag);
/* normally would call directly after but in this case delay recalc */
@@ -7240,8 +7240,11 @@ void MESH_OT_wireframe(wmOperatorType *ot)
/* use 1 rather then 10 for max else dragging the button moves too far */
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
RNA_def_float_distance(ot->srna, "offset", 0.01f, 0.0f, 1e4f, "Offset", "", 0.0f, 10.0f);
- RNA_def_boolean(
- ot->srna, "use_crease", false, "Crease", "Crease hub edges for an improved subdivision surface");
+ RNA_def_boolean(ot->srna,
+ "use_crease",
+ false,
+ "Crease",
+ "Crease hub edges for an improved subdivision surface");
prop = RNA_def_float(
ot->srna, "crease_weight", 0.01f, 0.0f, 1e3f, "Crease weight", "", 0.0f, 1.0f);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 2);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 7dfca69d7f0..5af586942dc 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2798,7 +2798,7 @@ void OBJECT_OT_convert(wmOperatorType *ot)
/* leaves selection of base/object unaltered */
/* Does set ID->newid pointers. */
static Base *object_add_duplicate_internal(
- Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob, int dupflag)
+ Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob, const eDupli_ID_Flags dupflag)
{
Base *base, *basen = NULL;
Object *obn;
@@ -2846,7 +2846,7 @@ static Base *object_add_duplicate_internal(
* note: caller must do DAG_relations_tag_update(bmain);
* this is not done automatic since we may duplicate many objects in a batch */
Base *ED_object_add_duplicate(
- Main *bmain, Scene *scene, ViewLayer *view_layer, Base *base, int dupflag)
+ Main *bmain, Scene *scene, ViewLayer *view_layer, Base *base, const eDupli_ID_Flags dupflag)
{
Base *basen;
Object *ob;
@@ -2879,7 +2879,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
const bool linked = RNA_boolean_get(op->ptr, "linked");
- int dupflag = (linked) ? 0 : U.dupflag;
+ const eDupli_ID_Flags dupflag = (linked) ? 0 : (eDupli_ID_Flags)U.dupflag;
CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
Base *basen = object_add_duplicate_internal(bmain, scene, view_layer, base->object, dupflag);
@@ -2963,7 +2963,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
Base *basen;
Object *ob;
const bool linked = RNA_boolean_get(op->ptr, "linked");
- int dupflag = (linked) ? 0 : U.dupflag;
+ const eDupli_ID_Flags dupflag = (linked) ? 0 : (eDupli_ID_Flags)U.dupflag;
char name[MAX_ID_NAME - 2];
/* find object, create fake base */
diff --git a/source/blender/io/collada/BCMath.cpp b/source/blender/io/collada/BCMath.cpp
index ec9977c1469..e8765fa2bcd 100644
--- a/source/blender/io/collada/BCMath.cpp
+++ b/source/blender/io/collada/BCMath.cpp
@@ -17,6 +17,8 @@
* All rights reserved.
*/
+#include "BLI_utildefines.h"
+
#include "BCMath.h"
#include "BlenderContext.h"