BPY api addition material.freeNodes() - use to cleanup apricot files, since there is no way to remove a node tree via the UI, unused materials and duplicate images were hanging around.
buttons_logic - gave the name a but more room then the controller type, better for documentation screenshots.
This commit is contained in:
parent
9d7c56a7f2
commit
2af7083d75
@ -649,7 +649,7 @@ static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args );
|
|||||||
static PyObject *Material_getColorband( BPy_Material * self, void * type);
|
static PyObject *Material_getColorband( BPy_Material * self, void * type);
|
||||||
int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
|
int Material_setColorband( BPy_Material * self, PyObject * value, void * type);
|
||||||
static PyObject *Material_copy( BPy_Material * self );
|
static PyObject *Material_copy( BPy_Material * self );
|
||||||
|
static PyObject *Material_freeNodes( BPy_Material * self );
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Python BPy_Material methods table: */
|
/* Python BPy_Material methods table: */
|
||||||
@ -887,6 +887,8 @@ static PyMethodDef BPy_Material_methods[] = {
|
|||||||
"() - Return a copy of the material."},
|
"() - Return a copy of the material."},
|
||||||
{"copy", ( PyCFunction ) Material_copy, METH_NOARGS,
|
{"copy", ( PyCFunction ) Material_copy, METH_NOARGS,
|
||||||
"() - Return a copy of the material."},
|
"() - Return a copy of the material."},
|
||||||
|
{"freeNodes", ( PyCFunction ) Material_freeNodes, METH_NOARGS,
|
||||||
|
"() - Free this materials nodes."},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2588,6 +2590,22 @@ static PyObject *Material_copy( BPy_Material * self )
|
|||||||
return ( PyObject * ) pymat;
|
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*/
|
/* mat_a==mat_b or mat_a!=mat_b*/
|
||||||
static int Material_compare( BPy_Material * a, BPy_Material * b )
|
static int Material_compare( BPy_Material * a, BPy_Material * b )
|
||||||
{
|
{
|
||||||
|
@ -1087,5 +1087,12 @@ class Material:
|
|||||||
@return: a copy of this 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
|
import id_generics
|
||||||
Material.__doc__ += id_generics.attributes
|
Material.__doc__ += id_generics.attributes
|
||||||
|
@ -3298,8 +3298,8 @@ void logic_buts(void)
|
|||||||
|
|
||||||
if(cont->flag & CONT_SHOW) {
|
if(cont->flag & CONT_SHOW) {
|
||||||
cont->otype= cont->type;
|
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");
|
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+122), yco, (short)(width-166), 19, cont->name, 0, 31, 0, 0, "Controller name");
|
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);
|
uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
|
||||||
|
|
||||||
ycoo= yco;
|
ycoo= yco;
|
||||||
@ -3309,9 +3309,9 @@ void logic_buts(void)
|
|||||||
else {
|
else {
|
||||||
cpack(0x999999);
|
cpack(0x999999);
|
||||||
glRecti(xco+22, yco, xco+width-22,yco+19);
|
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);
|
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);
|
uiButSetFunc(but, sca_move_controller, cont, NULL);
|
||||||
ycoo= yco;
|
ycoo= yco;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user