Merged 15771:15912 from trunk

This commit is contained in:
2008-08-01 23:39:52 +00:00
139 changed files with 3133 additions and 1475 deletions

View File

@@ -1469,6 +1469,8 @@ PyObject *Armature_Init(void)
PyConstant_NewInt("BONE_SELECTED", BONE_SELECTED));
PyModule_AddObject(module, "TIP_SELECTED",
PyConstant_NewInt("TIP_SELECTED", BONE_TIPSEL));
PyModule_AddObject(module, "LOCKED_EDIT",
PyConstant_NewInt("LOCKED_EDIT", BONE_EDITMODE_LOCKED));
PyModule_AddObject(module, "OCTAHEDRON",
PyConstant_NewInt("OCTAHEDRON", ARM_OCTA));

View File

@@ -368,6 +368,10 @@ static PyObject *EditBone_getOptions(BPy_EditBone *self, void *closure)
if (PyList_Append(list,
EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1)
goto RuntimeError;
if(self->editbone->flag & BONE_EDITMODE_LOCKED)
if (PyList_Append(list,
EXPP_GetModuleConstant("Blender.Armature", "LOCKED_EDIT")) == -1)
goto RuntimeError;
}else{
if(self->flag & BONE_CONNECTED)
if (PyList_Append(list,
@@ -401,6 +405,10 @@ static PyObject *EditBone_getOptions(BPy_EditBone *self, void *closure)
if (PyList_Append(list,
EXPP_GetModuleConstant("Blender.Armature", "TIP_SELECTED")) == -1)
goto RuntimeError;
if(self->flag & BONE_EDITMODE_LOCKED)
if (PyList_Append(list,
EXPP_GetModuleConstant("Blender.Armature", "LOCKED_EDIT")) == -1)
goto RuntimeError;
}
return list;
@@ -422,7 +430,7 @@ static int EditBone_CheckValidConstant(PyObject *constant)
return 0;
if (!STREQ3(PyString_AsString(name), "CONNECTED", "HINGE", "NO_DEFORM") &&
!STREQ3(PyString_AsString(name), "ROOT_SELECTED", "BONE_SELECTED", "TIP_SELECTED") &&
!STREQ2(PyString_AsString(name), "MULTIPLY", "HIDDEN_EDIT"))
!STREQ3(PyString_AsString(name), "MULTIPLY", "HIDDEN_EDIT", "LOCKED_EDIT"))
return 0;
else
return 1;

View File

@@ -89,6 +89,8 @@ Example::
@type BONE_SELECTED: Constant
@var TIP_SELECTED: Tip of the Bone is selected
@type TIP_SELECTED: Constant
@var LOCKED_EDIT: Prevents the bone from being transformed in editmode
@type LOCKED_EDIT: Constant
@var OCTAHEDRON: Bones drawn as octahedrons
@type OCTAHEDRON: Constant
@var STICK: Bones drawn as a line
@@ -286,6 +288,7 @@ class Bone:
- Armature.ROOT_SELECTED: Selection of root ball of bone
- Armature.BONE_SELECTED: Selection of bone
- Armature.TIP_SELECTED: Selection of tip ball of bone
- Armature.LOCKED_EDIT: Prevents the bone from being transformed in editmode
@type options: List of Constants
@ivar subdivision: The number of bone subdivisions.
@type subdivision: Int

View File

@@ -56,6 +56,7 @@ struct View3D; /* keep me up here */
#include "gen_utils.h"
#include "gen_library.h"
#include "../BPY_extern.h" /* for BPY_do_all_scripts() */
#include "Scene.h"
#include "Group.h"
@@ -469,19 +470,20 @@ PyObject *M_Render_EnableDispWin( PyObject * self )
PyObject *RenderData_Render( BPy_RenderData * self )
{
Scene *oldsce;
/* unlock to prevent a deadlock when there are pynodes: */
PyThreadState *tstate = NULL;
if (!G.background) {
oldsce = G.scene;
set_scene( self->scene );
tstate = PyEval_SaveThread();
BIF_do_render( 0 );
set_scene( oldsce );
}
else { /* background mode (blender -b file.blend -P script) */
int slink_flag = 0;
Render *re= RE_NewRender(G.scene->id.name);
int end_frame = G.scene->r.efra;
if (G.scene != self->scene)
@@ -490,11 +492,25 @@ PyObject *RenderData_Render( BPy_RenderData * self )
G.scene->r.efra = G.scene->r.sfra;
if (G.f & G_DOSCRIPTLINKS) {
BPY_do_all_scripts(SCRIPT_RENDER);
G.f &= ~G_DOSCRIPTLINKS; /* avoid FRAMECHANGED events*/
slink_flag = 1;
}
tstate = PyEval_SaveThread();
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
if (slink_flag) {
G.f |= G_DOSCRIPTLINKS;
BPY_do_all_scripts(SCRIPT_POSTRENDER);
}
G.scene->r.efra = end_frame;
}
PyEval_RestoreThread(tstate);
Py_RETURN_NONE;
}
@@ -565,12 +581,13 @@ PyObject *RenderData_SaveRenderedImage ( BPy_RenderData * self, PyObject *args )
PyObject *RenderData_RenderAnim( BPy_RenderData * self )
{
Scene *oldsce;
/* this prevents a deadlock when there are pynodes: */
PyThreadState *tstate = PyEval_SaveThread();
/* unlock to prevent a deadlock when there are pynodes: */
PyThreadState *tstate = NULL;
if (!G.background) {
oldsce = G.scene;
set_scene( self->scene );
tstate = PyEval_SaveThread();
BIF_do_render( 1 );
set_scene( oldsce );
}
@@ -584,8 +601,17 @@ PyObject *RenderData_RenderAnim( BPy_RenderData * self )
if (G.scene->r.sfra > G.scene->r.efra)
return EXPP_ReturnPyObjError (PyExc_RuntimeError,
"start frame must be less or equal to end frame");
if (G.f & G_DOSCRIPTLINKS)
BPY_do_all_scripts(SCRIPT_RENDER);
tstate = PyEval_SaveThread();
RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
if (G.f & G_DOSCRIPTLINKS)
BPY_do_all_scripts(SCRIPT_POSTRENDER);
}
PyEval_RestoreThread(tstate);
Py_RETURN_NONE;
}