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:
-rw-r--r--source/blender/python/api2_2x/Material.c20
-rw-r--r--source/blender/python/api2_2x/doc/Material.py7
-rw-r--r--source/blender/src/buttons_logic.c8
3 files changed, 30 insertions, 5 deletions
diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c
index e32b87da240..82fb733c7ea 100644
--- a/source/blender/python/api2_2x/Material.c
+++ b/source/blender/python/api2_2x/Material.c
@@ -649,7 +649,7 @@ static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args );
static PyObject *Material_getColorband( BPy_Material * self, void * type);
int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
static PyObject *Material_copy( BPy_Material * self );
-
+static PyObject *Material_freeNodes( BPy_Material * self );
/*****************************************************************************/
/* Python BPy_Material methods table: */
@@ -887,6 +887,8 @@ static PyMethodDef BPy_Material_methods[] = {
"() - Return a copy of the material."},
{"copy", ( PyCFunction ) Material_copy, METH_NOARGS,
"() - Return a copy of the material."},
+ {"freeNodes", ( PyCFunction ) Material_freeNodes, METH_NOARGS,
+ "() - Free this materials nodes."},
{NULL, NULL, 0, NULL}
};
@@ -2588,6 +2590,22 @@ static PyObject *Material_copy( BPy_Material * self )
return ( PyObject * ) pymat;
}
+/* mat.freeNodes() */
+static PyObject *Material_freeNodes( BPy_Material * self )
+{
+ if (self->material->nodetree) {
+ if(self->material->nodetree) {
+ ntreeFreeTree(self->material->nodetree);
+ MEM_freeN(self->material->nodetree);
+ }
+ self->material->nodetree = NULL;
+ self->material->use_nodes = 0;
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+}
+
/* mat_a==mat_b or mat_a!=mat_b*/
static int Material_compare( BPy_Material * a, BPy_Material * b )
{
diff --git a/source/blender/python/api2_2x/doc/Material.py b/source/blender/python/api2_2x/doc/Material.py
index 05497cf551c..8d45449762c 100644
--- a/source/blender/python/api2_2x/doc/Material.py
+++ b/source/blender/python/api2_2x/doc/Material.py
@@ -1087,5 +1087,12 @@ class Material:
@return: a copy of this material
"""
+ def freeNodes ():
+ """
+ Removes the node tree from this material.
+ @rtype: bool
+ @return: true if nodes were freed from this material.
+ """
+
import id_generics
Material.__doc__ += id_generics.attributes
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index 934ff9e008a..4f704ef5ab0 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -3298,8 +3298,8 @@ void logic_buts(void)
if(cont->flag & CONT_SHOW) {
cont->otype= cont->type;
- uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 100, 19, &cont->type, 0, 0, 0, 0, "Controller type");
- but= uiDefBut(block, TEX, 1, "", (short)(xco+122), yco, (short)(width-166), 19, cont->name, 0, 31, 0, 0, "Controller name");
+ uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, 19, &cont->type, 0, 0, 0, 0, "Controller type");
+ but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-136), 19, cont->name, 0, 31, 0, 0, "Controller name");
uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
ycoo= yco;
@@ -3309,9 +3309,9 @@ void logic_buts(void)
else {
cpack(0x999999);
glRecti(xco+22, yco, xco+width-22,yco+19);
- but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 100, 19, cont, 0, 0, 0, 0, "Controller type");
+ but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, 19, cont, 0, 0, 0, 0, "Controller type");
uiButSetFunc(but, sca_move_controller, cont, NULL);
- but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+122), yco,(short)(width-166), 19, cont, 0, 0, 0, 0, "Controller name");
+ but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-136), 19, cont, 0, 0, 0, 0, "Controller name");
uiButSetFunc(but, sca_move_controller, cont, NULL);
ycoo= yco;
}