Cleanup: Remove using-directive from freestyle headers

The header files in freestyle utilize the using-directive at the global
file scope. This is a bad practice as it pollutes the global name space
causing possible ambiguous reference compilation errors. In particular,
the DNA files that are included by freestyle will cause those ambiguous
reference errors when the developers adds a DNA member with a type name
that also exist in the Freestyle name space, such as Curve and possibly
others.

This patch does the minimal work needed to resolve that by moving the
using-directives from the headers into the corresponding translation
units.

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D10351
This commit is contained in:
2021-02-08 17:28:15 +02:00
parent 048135e2c8
commit 21a2b975b8
216 changed files with 442 additions and 186 deletions

View File

@@ -27,6 +27,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject AdjacencyIterator_Type;
/*---------------------------Python BPy_AdjacencyIterator structure definition----------*/
typedef struct {
BPy_Iterator py_it;
AdjacencyIterator *a_it;
Freestyle::AdjacencyIterator *a_it;
bool at_start;
} BPy_AdjacencyIterator;

View File

@@ -29,6 +29,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject ChainPredicateIterator_Type;
/*---------------------------Python BPy_ChainPredicateIterator structure definition----------*/
typedef struct {
BPy_ChainingIterator py_c_it;
ChainPredicateIterator *cp_it;
Freestyle::ChainPredicateIterator *cp_it;
PyObject *upred;
PyObject *bpred;
} BPy_ChainPredicateIterator;

View File

@@ -27,6 +27,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject ChainSilhouetteIterator_Type;
/*---------------------------Python BPy_ChainSilhouetteIterator structure definition----------*/
typedef struct {
BPy_ChainingIterator py_c_it;
ChainSilhouetteIterator *cs_it;
Freestyle::ChainSilhouetteIterator *cs_it;
} BPy_ChainSilhouetteIterator;
///////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -29,6 +29,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject ChainingIterator_Type;
/*---------------------------Python BPy_ChainingIterator structure definition----------*/
typedef struct {
BPy_ViewEdgeIterator py_ve_it;
ChainingIterator *c_it;
Freestyle::ChainingIterator *c_it;
} BPy_ChainingIterator;
///////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -27,6 +27,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject CurvePointIterator_Type;
/*---------------------------Python BPy_CurvePointIterator structure definition----------*/
typedef struct {
BPy_Iterator py_it;
CurveInternal::CurvePointIterator *cp_it;
Freestyle::CurveInternal::CurvePointIterator *cp_it;
} BPy_CurvePointIterator;
///////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -27,6 +27,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject Interface0DIterator_Type;
/*---------------------------Python BPy_Interface0DIterator structure definition----------*/
typedef struct {
BPy_Iterator py_it;
Interface0DIterator *if0D_it;
Freestyle::Interface0DIterator *if0D_it;
bool reversed;
bool at_start;
} BPy_Interface0DIterator;

View File

@@ -28,6 +28,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject SVertexIterator_Type;
/*---------------------------Python BPy_SVertexIterator structure definition----------*/
typedef struct {
BPy_Iterator py_it;
ViewEdgeInternal::SVertexIterator *sv_it;
Freestyle::ViewEdgeInternal::SVertexIterator *sv_it;
} BPy_SVertexIterator;
///////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -28,6 +28,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject StrokeVertexIterator_Type;
/*---------------------------Python BPy_StrokeVertexIterator structure definition----------*/
typedef struct {
BPy_Iterator py_it;
StrokeInternal::StrokeVertexIterator *sv_it;
Freestyle::StrokeInternal::StrokeVertexIterator *sv_it;
bool reversed;
/* attribute to make next() work correctly */
bool at_start;

View File

@@ -27,6 +27,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject ViewEdgeIterator_Type;
/*---------------------------Python BPy_ViewEdgeIterator structure definition----------*/
typedef struct {
BPy_Iterator py_it;
ViewEdgeInternal::ViewEdgeIterator *ve_it;
Freestyle::ViewEdgeInternal::ViewEdgeIterator *ve_it;
} BPy_ViewEdgeIterator;
///////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -26,6 +26,8 @@
extern "C" {
#endif
using namespace Freestyle;
///////////////////////////////////////////////////////////////////////////////////////////
//------------------------INSTANCE METHODS ----------------------------------

View File

@@ -38,7 +38,7 @@ extern PyTypeObject orientedViewEdgeIterator_Type;
/*---------------------------Python BPy_orientedViewEdgeIterator structure definition----------*/
typedef struct {
BPy_Iterator py_it;
ViewVertexInternal::orientedViewEdgeIterator *ove_it;
Freestyle::ViewVertexInternal::orientedViewEdgeIterator *ove_it;
bool reversed;
bool at_start;
} BPy_orientedViewEdgeIterator;