diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-06 06:04:43 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-10-06 06:04:43 +0400 |
commit | f84e8e76406a30bd15e6e55e41714e62826315aa (patch) | |
tree | e4a077ee05de21155421b35854162ad5f29c53b3 /source/blender/freestyle/intern/python | |
parent | cb4f6629279ba9792cc46114fe603bebff11c6a3 (diff) |
Fine control of feature edge selection with mesh face and edge marks.
New "face marks" and "edge marks" have been introduced in mesh data
blocks. In the edit mode of a mesh object, face marks can be put
to selected faces by choosing Mesh >> Faces >> Mark Freestyle Face
from the menu of a 3D View window or Ctrl-F >> Mark Freestyle Face
from the context menu. Similarly, edge marks can be put to selected
edges by Mesh >> Edges >> Mark Freestyle Edge or Ctrl-E >> Mark
Freestyle Edge. These marks should work fine with the Subdivision
surface modifier.
Moreover, two new conditions for feature edge selection have been
added to the Parameter Editor mode as described below:
1. The Selection by Edge Types option has now the new Edge Mark type,
which can be used to (de)select feature edges having edge marks.
This option can be used to add to (or remove from) the view map
arbitrary edges of mesh objects.
2. Selection by Face Marks option has been newly introduced, in which
face marks are used for feature edge selection in two ways. One
option is called "One Face" which is to (de)select feature edges if
one of faces on the left and right of each feature edge has a face
mark. The other option is "Both Faces" to (de)select feature edges
if both faces on the left and right have a face mark.
Diffstat (limited to 'source/blender/freestyle/intern/python')
3 files changed, 109 insertions, 1 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp index 35be367b348..149baa9a7f3 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.cpp +++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp @@ -78,7 +78,8 @@ static char Nature___doc__[] = "* Nature.RIDGE: True for ridges.\n" "* Nature.VALLEY: True for valleys.\n" "* Nature.SUGGESTIVE_CONTOUR: True for suggestive contours.\n" -"* Nature.MATERIAL_BOUNDARY: True for edges at material boundaries.\n"; +"* Nature.MATERIAL_BOUNDARY: True for edges at material boundaries.\n" +"* Nature.EDGE_MARK: True for edges having user-defined edge marks.\n"; /*-----------------------BPy_Nature type definition ------------------------------*/ @@ -181,6 +182,10 @@ static PyLongObject _Nature_MATERIAL_BOUNDARY = { PyVarObject_HEAD_INIT(&Nature_Type, 1) { Nature::MATERIAL_BOUNDARY } }; +static PyLongObject _Nature_EDGE_MARK = { + PyVarObject_HEAD_INIT(&Nature_Type, 1) + { Nature::EDGE_MARK } +}; #define BPy_Nature_POINT ((PyObject *)&_Nature_POINT) #define BPy_Nature_S_VERTEX ((PyObject *)&_Nature_S_VERTEX) @@ -196,6 +201,7 @@ static PyLongObject _Nature_MATERIAL_BOUNDARY = { #define BPy_Nature_VALLEY ((PyObject *)&_Nature_VALLEY) #define BPy_Nature_SUGGESTIVE_CONTOUR ((PyObject *)&_Nature_SUGGESTIVE_CONTOUR) #define BPy_Nature_MATERIAL_BOUNDARY ((PyObject *)&_Nature_MATERIAL_BOUNDARY) +#define BPy_Nature_EDGE_MARK ((PyObject *)&_Nature_EDGE_MARK) //-------------------MODULE INITIALIZATION-------------------------------- int Nature_Init( PyObject *module ) @@ -225,6 +231,7 @@ int Nature_Init( PyObject *module ) PyDict_SetItemString( Nature_Type.tp_dict, "VALLEY", BPy_Nature_VALLEY ); PyDict_SetItemString( Nature_Type.tp_dict, "SUGGESTIVE_CONTOUR", BPy_Nature_SUGGESTIVE_CONTOUR ); PyDict_SetItemString( Nature_Type.tp_dict, "MATERIAL_BOUNDARY", BPy_Nature_MATERIAL_BOUNDARY ); + PyDict_SetItemString( Nature_Type.tp_dict, "EDGE_MARK", BPy_Nature_EDGE_MARK ); return 0; } diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index ec49167b0c1..39d644b7714 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -154,6 +154,32 @@ static PyObject * FEdgeSharp_bMaterial( BPy_FEdgeSharp *self ) { return BPy_FrsMaterial_from_FrsMaterial(m); } +static char FEdgeSharp_aFaceMark___doc__[] = +".. method:: aFaceMark()\n" +"\n" +" Returns the face mark of the face lying on the right of the FEdge.\n" +" If this FEdge is a border, it has no face on the right, and thus\n" +" false is returned.\n" +"\n" +" :return: The face mark of the face lying on the right of the FEdge.\n" +" :rtype: bool\n"; + +static PyObject * FEdgeSharp_aFaceMark( BPy_FEdgeSharp *self ) { + return PyBool_from_bool( self->fes->aFaceMark() ); +} + +static char FEdgeSharp_bFaceMark___doc__[] = +".. method:: bFaceMark()\n" +"\n" +" Returns the face mark of the face lying on the left of the FEdge.\n" +"\n" +" :return: The face mark of the face lying on the left of the FEdge.\n" +" :rtype: bool\n"; + +static PyObject * FEdgeSharp_bFaceMark( BPy_FEdgeSharp *self ) { + return PyBool_from_bool( self->fes->bFaceMark() ); +} + static char FEdgeSharp_setNormalA___doc__[] = ".. method:: setNormalA(iNormal)\n" "\n" @@ -240,6 +266,44 @@ static PyObject * FEdgeSharp_setbMaterialIndex( BPy_FEdgeSharp *self, PyObject * Py_RETURN_NONE; } +static char FEdgeSharp_setaFaceMark___doc__[] = +".. method:: setaFaceMark(i)\n" +"\n" +" Sets the face mark of the face lying on the right of the FEdge.\n" +"\n" +" :arg i: A face mark.\n" +" :type i: bool\n"; + +static PyObject * FEdgeSharp_setaFaceMark( BPy_FEdgeSharp *self, PyObject *args ) { + PyObject *obj; + + if(!( PyArg_ParseTuple(args, "O", &obj) )) + return NULL; + + self->fes->setaFaceMark( bool_from_PyBool(obj) ); + + Py_RETURN_NONE; +} + +static char FEdgeSharp_setbFaceMark___doc__[] = +".. method:: setbFaceMark(i)\n" +"\n" +" Sets the face mark of the face lying on the left of the FEdge.\n" +"\n" +" :arg i: A face mark.\n" +" :type i: bool\n"; + +static PyObject * FEdgeSharp_setbFaceMark( BPy_FEdgeSharp *self, PyObject *args ) { + PyObject *obj; + + if(!( PyArg_ParseTuple(args, "O", &obj) )) + return NULL; + + self->fes->setbFaceMark( bool_from_PyBool(obj) ); + + Py_RETURN_NONE; +} + /*----------------------FEdgeSharp instance definitions ----------------------------*/ static PyMethodDef BPy_FEdgeSharp_methods[] = { {"normalA", ( PyCFunction ) FEdgeSharp_normalA, METH_NOARGS, FEdgeSharp_normalA___doc__}, @@ -248,10 +312,14 @@ static PyMethodDef BPy_FEdgeSharp_methods[] = { {"bMaterialIndex", ( PyCFunction ) FEdgeSharp_bMaterialIndex, METH_NOARGS, FEdgeSharp_bMaterialIndex___doc__}, {"aMaterial", ( PyCFunction ) FEdgeSharp_aMaterial, METH_NOARGS, FEdgeSharp_aMaterial___doc__}, {"bMaterial", ( PyCFunction ) FEdgeSharp_bMaterial, METH_NOARGS, FEdgeSharp_bMaterial___doc__}, + {"aFaceMark", ( PyCFunction ) FEdgeSharp_aFaceMark, METH_NOARGS, FEdgeSharp_aFaceMark___doc__}, + {"bFaceMark", ( PyCFunction ) FEdgeSharp_bFaceMark, METH_NOARGS, FEdgeSharp_bFaceMark___doc__}, {"setNormalA", ( PyCFunction ) FEdgeSharp_setNormalA, METH_VARARGS, FEdgeSharp_setNormalA___doc__}, {"setNormalB", ( PyCFunction ) FEdgeSharp_setNormalB, METH_VARARGS, FEdgeSharp_setNormalB___doc__}, {"setaMaterialIndex", ( PyCFunction ) FEdgeSharp_setaMaterialIndex, METH_VARARGS, FEdgeSharp_setaMaterialIndex___doc__}, {"setbMaterialIndex", ( PyCFunction ) FEdgeSharp_setbMaterialIndex, METH_VARARGS, FEdgeSharp_setbMaterialIndex___doc__}, + {"setaFaceMark", ( PyCFunction ) FEdgeSharp_setaFaceMark, METH_NOARGS, FEdgeSharp_setaFaceMark___doc__}, + {"setbFaceMark", ( PyCFunction ) FEdgeSharp_setbFaceMark, METH_NOARGS, FEdgeSharp_setbFaceMark___doc__}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index df945b1e6a8..3ddb4d060de 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -104,6 +104,18 @@ static PyObject * FEdgeSmooth_material( BPy_FEdgeSmooth *self ) { return BPy_FrsMaterial_from_FrsMaterial(m); } +static char FEdgeSmooth_faceMark___doc__[] = +".. method:: faceMark()\n" +"\n" +" Returns the face mark of the face it is running across.\n" +"\n" +" :return: The face mark of the face it is running across.\n" +" :rtype: bool\n"; + +static PyObject * FEdgeSmooth_faceMark( BPy_FEdgeSmooth *self ) { + return PyBool_from_bool( self->fes->faceMark() ); +} + static char FEdgeSmooth_setNormal___doc__[] = ".. method:: setNormal(iNormal)\n" "\n" @@ -147,13 +159,34 @@ static PyObject * FEdgeSmooth_setMaterialIndex( BPy_FEdgeSmooth *self, PyObject Py_RETURN_NONE; } +static char FEdgeSmooth_setFaceMark___doc__[] = +".. method:: setFaceMark(i)\n" +"\n" +" Sets the face mark of the face it is running across.\n" +"\n" +" :arg i: A face mark.\n" +" :type i: bool\n"; + +static PyObject * FEdgeSmooth_setFaceMark( BPy_FEdgeSmooth *self, PyObject *args ) { + PyObject *obj; + + if(!( PyArg_ParseTuple(args, "O", &obj) )) + return NULL; + + self->fes->setFaceMark( bool_from_PyBool(obj) ); + + Py_RETURN_NONE; +} + /*----------------------FEdgeSmooth instance definitions ----------------------------*/ static PyMethodDef BPy_FEdgeSmooth_methods[] = { {"normal", ( PyCFunction ) FEdgeSmooth_normal, METH_NOARGS, FEdgeSmooth_normal___doc__}, {"materialIndex", ( PyCFunction ) FEdgeSmooth_materialIndex, METH_NOARGS, FEdgeSmooth_materialIndex___doc__}, {"material", ( PyCFunction ) FEdgeSmooth_material, METH_NOARGS, FEdgeSmooth_material___doc__}, + {"faceMark", ( PyCFunction ) FEdgeSmooth_faceMark, METH_NOARGS, FEdgeSmooth_faceMark___doc__}, {"setNormal", ( PyCFunction ) FEdgeSmooth_setNormal, METH_VARARGS, FEdgeSmooth_setNormal___doc__}, {"setMaterialIndex", ( PyCFunction ) FEdgeSmooth_setMaterialIndex, METH_VARARGS, FEdgeSmooth_setMaterialIndex___doc__}, + {"setFaceMark", ( PyCFunction ) FEdgeSmooth_setFaceMark, METH_VARARGS, FEdgeSmooth_setFaceMark___doc__}, {NULL, NULL, 0, NULL} }; |