svn merge -r15932:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender
This commit is contained in:
@@ -185,15 +185,16 @@ if env['WITH_BF_OPENMP'] == 1:
|
||||
env['CPPFLAGS'].append('/openmp')
|
||||
env['CXXFLAGS'].append('/openmp')
|
||||
else:
|
||||
if env['CC'] == 'icc':
|
||||
if env['CC'][-3:] == 'icc': # to be able to handle CC=/opt/bla/icc case
|
||||
env.Append(LINKFLAGS=['-openmp', '-static-intel'])
|
||||
env['CCFLAGS'].append('-openmp')
|
||||
env['CPPFLAGS'].append('-openmp')
|
||||
env['CXXFLAGS'].append('-openmp')
|
||||
else:
|
||||
env['CCFLAGS'].append('-fopenmp')
|
||||
env['CPPFLAGS'].append('-fopenmp')
|
||||
env['CXXFLAGS'].append('-fopenmp')
|
||||
env.Append(CCFLAGS=['-fopenmp'])
|
||||
env.Append(CPPFLAGS=['-fopenmp'])
|
||||
env.Append(CXXFLAGS=['-fopenmp'])
|
||||
# env.Append(LINKFLAGS=['-fprofile-generate'])
|
||||
|
||||
#check for additional debug libnames
|
||||
|
||||
|
@@ -278,6 +278,9 @@ ECHO Done
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Merge.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Merge2.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Mesh.cpp">
|
||||
</File>
|
||||
@@ -330,9 +333,15 @@ ECHO Done
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Merge.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Merge2.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Mesh.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Misc.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\intern\BOP_Segment.h">
|
||||
</File>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@ It removes very low weighted verts from the current group with a weight option.
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@@ -51,13 +51,14 @@ def weightClean(me, PREF_THRESH, PREF_KEEP_SINGLE, PREF_OTHER_GROUPS):
|
||||
for wd in vWeightDict:
|
||||
l = len(wd)
|
||||
if not PREF_KEEP_SINGLE or l > 1:
|
||||
# cant use iteritems because the dict is having items removed
|
||||
for group in wd.keys():
|
||||
w= wd[group]
|
||||
if w <= PREF_THRESH:
|
||||
# small weight, remove.
|
||||
del wd[group]
|
||||
rem_count +=1
|
||||
l-=1
|
||||
l-=1
|
||||
|
||||
if PREF_KEEP_SINGLE and l == 1:
|
||||
break
|
||||
@@ -117,4 +118,4 @@ def main():
|
||||
Draw.PupMenu('Removed %i verts from groups' % rem_count)
|
||||
|
||||
if __name__=='__main__':
|
||||
main()
|
||||
main()
|
||||
|
@@ -117,10 +117,14 @@ float BPY_pydriver_eval(struct IpoDriver *driver)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
int EXPP_dict_set_item_str(struct PyObject *dict, char *key, struct PyObject *value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
void Node_SetStack(struct BPy_Node *self, struct bNodeStack **stack, int type){}
|
||||
void InitNode(struct BPy_Node *self, struct bNode *node){}
|
||||
void Node_SetShi(struct BPy_Node *self, struct ShadeInput *shi){}
|
||||
|
@@ -265,14 +265,34 @@ static void layerSwap_tface(void *data, int *corner_indices)
|
||||
{
|
||||
MTFace *tf = data;
|
||||
float uv[4][2];
|
||||
const static short pin_flags[4] =
|
||||
{ TF_PIN1, TF_PIN2, TF_PIN3, TF_PIN4 };
|
||||
const static char sel_flags[4] =
|
||||
{ TF_SEL1, TF_SEL2, TF_SEL3, TF_SEL4 };
|
||||
short unwrap = tf->unwrap & ~(TF_PIN1 | TF_PIN2 | TF_PIN3 | TF_PIN4);
|
||||
char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
|
||||
int j;
|
||||
|
||||
for(j = 0; j < 4; ++j) {
|
||||
uv[j][0] = tf->uv[corner_indices[j]][0];
|
||||
uv[j][1] = tf->uv[corner_indices[j]][1];
|
||||
int source_index = corner_indices[j];
|
||||
|
||||
uv[j][0] = tf->uv[source_index][0];
|
||||
uv[j][1] = tf->uv[source_index][1];
|
||||
|
||||
// swap pinning flags around
|
||||
if(tf->unwrap & pin_flags[source_index]) {
|
||||
unwrap |= pin_flags[j];
|
||||
}
|
||||
|
||||
// swap selection flags around
|
||||
if(tf->flag & sel_flags[source_index]) {
|
||||
flag |= sel_flags[j];
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(tf->uv, uv, sizeof(tf->uv));
|
||||
tf->unwrap = unwrap;
|
||||
tf->flag = flag;
|
||||
}
|
||||
|
||||
static void layerDefault_tface(void *data, int count)
|
||||
|
@@ -1130,8 +1130,18 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
||||
mface[numFaces].v1 = vert_map[mface[numFaces].v1];
|
||||
mface[numFaces].v2 = vert_map[mface[numFaces].v2];
|
||||
mface[numFaces].v3 = vert_map[mface[numFaces].v3];
|
||||
if(mface[numFaces].v4)
|
||||
if(mface[numFaces].v4) {
|
||||
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
|
||||
|
||||
test_index_face(&mface[numFaces], &result->faceData,
|
||||
numFaces, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
test_index_face(&mface[numFaces], &result->faceData,
|
||||
numFaces, 3);
|
||||
}
|
||||
|
||||
origindex[numFaces] = ORIGINDEX_NONE;
|
||||
|
||||
numFaces++;
|
||||
@@ -1221,8 +1231,17 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
|
||||
mface[numFaces].v1 = vert_map[mface[numFaces].v1];
|
||||
mface[numFaces].v2 = vert_map[mface[numFaces].v2];
|
||||
mface[numFaces].v3 = vert_map[mface[numFaces].v3];
|
||||
if(mface[numFaces].v4)
|
||||
if(mface[numFaces].v4) {
|
||||
mface[numFaces].v4 = vert_map[mface[numFaces].v4];
|
||||
|
||||
test_index_face(&mface[numFaces], &result->faceData,
|
||||
numFaces, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
test_index_face(&mface[numFaces], &result->faceData,
|
||||
numFaces, 3);
|
||||
}
|
||||
origindex[numFaces] = ORIGINDEX_NONE;
|
||||
|
||||
numFaces++;
|
||||
|
@@ -3744,6 +3744,9 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
|
||||
|
||||
/* TODO: pa_clump vgroup */
|
||||
do_clump(state,key1,t,part->clumpfac,part->clumppow,1.0);
|
||||
|
||||
if(psys->lattice)
|
||||
calc_latt_deform(state->co,1.0f);
|
||||
}
|
||||
else{
|
||||
if (pa) { /* TODO PARTICLE - should this ever be NULL? - Campbell */
|
||||
|
@@ -612,6 +612,7 @@ static int startffmpeg(struct anim * anim) {
|
||||
av_free(anim->pFrameRGB);
|
||||
av_free(anim->pFrameDeinterlaced);
|
||||
av_free(anim->pFrame);
|
||||
anim->pCodecCtx = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -639,7 +640,19 @@ static int startffmpeg(struct anim * anim) {
|
||||
PIX_FMT_BGR32,
|
||||
SWS_FAST_BILINEAR | SWS_PRINT_INFO,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
|
||||
if (!anim->img_convert_ctx) {
|
||||
fprintf (stderr,
|
||||
"Can't transform color space??? Bailing out...\n");
|
||||
avcodec_close(anim->pCodecCtx);
|
||||
av_close_input_file(anim->pFormatCtx);
|
||||
av_free(anim->pFrameRGB);
|
||||
av_free(anim->pFrameDeinterlaced);
|
||||
av_free(anim->pFrame);
|
||||
anim->pCodecCtx = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@@ -108,7 +108,8 @@ void mouse_armature(void);
|
||||
void remake_editArmature(void);
|
||||
void selectconnected_armature(void);
|
||||
void selectconnected_posearmature(void);
|
||||
void select_bone_parent(void);
|
||||
void armature_select_hierarchy(short direction, short add_to_sel);
|
||||
|
||||
void setflag_armature(short mode);
|
||||
void unique_editbone_name (struct ListBase *ebones, char *name);
|
||||
|
||||
@@ -143,6 +144,10 @@ void set_locks_armature_bones(short lock);
|
||||
|
||||
#define BONESEL_NOSEL 0x80000000 /* Indicates a negative number */
|
||||
|
||||
/* used in bone_select_hierachy() */
|
||||
#define BONE_SELECT_PARENT 0
|
||||
#define BONE_SELECT_CHILD 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -65,6 +65,8 @@ void pose_assign_to_posegroup(short active);
|
||||
void pose_remove_from_posegroups(void);
|
||||
void pgroup_operation_with_menu(void);
|
||||
|
||||
void pose_select_hierarchy(short direction, short add_to_sel);
|
||||
|
||||
void pose_select_grouped(short nr);
|
||||
void pose_select_grouped_menu(void);
|
||||
|
||||
|
@@ -160,11 +160,10 @@ ScriptError g_script_error;
|
||||
* Function prototypes
|
||||
***************************************************************************/
|
||||
PyObject *RunPython( Text * text, PyObject * globaldict );
|
||||
char *GetName( Text * text );
|
||||
PyObject *CreateGlobalDictionary( void );
|
||||
void ReleaseGlobalDictionary( PyObject * dict );
|
||||
void DoAllScriptsFromList( ListBase * list, short event );
|
||||
PyObject *importText( char *name );
|
||||
static PyObject *importText( char *name );
|
||||
void init_ourImport( void );
|
||||
void init_ourReload( void );
|
||||
PyObject *blender_import( PyObject * self, PyObject * args );
|
||||
@@ -651,7 +650,7 @@ int BPY_txt_do_python_Text( struct Text *text )
|
||||
}
|
||||
|
||||
/* Create a new script structure and initialize it: */
|
||||
script = alloc_libblock( &G.main->script, ID_SCRIPT, GetName( text ) );
|
||||
script = alloc_libblock( &G.main->script, ID_SCRIPT, text->id.name+2 );
|
||||
|
||||
if( !script ) {
|
||||
printf( "couldn't allocate memory for Script struct!" );
|
||||
@@ -662,8 +661,7 @@ int BPY_txt_do_python_Text( struct Text *text )
|
||||
* an error after it will call BPY_Err_Handle below, but the text struct
|
||||
* will have been deallocated already, so we need to copy its name here.
|
||||
*/
|
||||
BLI_strncpy( textname, GetName( text ),
|
||||
strlen( GetName( text ) ) + 1 );
|
||||
BLI_strncpy( textname, text->id.name+2, 21 );
|
||||
|
||||
script->id.us = 1;
|
||||
script->flags = SCRIPT_RUNNING;
|
||||
@@ -1062,12 +1060,10 @@ int BPY_menu_do_python( short menutype, int event )
|
||||
*****************************************************************************/
|
||||
void BPY_free_compiled_text( struct Text *text )
|
||||
{
|
||||
if( !text->compiled )
|
||||
return;
|
||||
Py_DECREF( ( PyObject * ) text->compiled );
|
||||
text->compiled = NULL;
|
||||
|
||||
return;
|
||||
if( text->compiled ) {
|
||||
Py_DECREF( ( PyObject * ) text->compiled );
|
||||
text->compiled = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -2683,8 +2679,7 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
|
||||
buf = txt_to_buf( text );
|
||||
|
||||
text->compiled =
|
||||
Py_CompileString( buf, GetName( text ),
|
||||
Py_file_input );
|
||||
Py_CompileString( buf, text->id.name+2, Py_file_input );
|
||||
|
||||
MEM_freeN( buf );
|
||||
|
||||
@@ -2698,15 +2693,6 @@ PyObject *RunPython( Text * text, PyObject * globaldict )
|
||||
return PyEval_EvalCode( text->compiled, globaldict, globaldict );
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Description: This function returns the value of the name field of the
|
||||
* given Text struct.
|
||||
*****************************************************************************/
|
||||
char *GetName( Text * text )
|
||||
{
|
||||
return ( text->id.name + 2 );
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Description: This function creates a new Python dictionary object.
|
||||
*****************************************************************************/
|
||||
@@ -2751,49 +2737,38 @@ void DoAllScriptsFromList( ListBase * list, short event )
|
||||
return;
|
||||
}
|
||||
|
||||
PyObject *importText( char *name )
|
||||
static PyObject *importText( char *name )
|
||||
{
|
||||
Text *text;
|
||||
char *txtname;
|
||||
char txtname[22]; /* 21+NULL */
|
||||
char *buf = NULL;
|
||||
int namelen = strlen( name );
|
||||
|
||||
txtname = malloc( namelen + 3 + 1 );
|
||||
if( !txtname )
|
||||
return NULL;
|
||||
|
||||
|
||||
if (namelen>21-3) return NULL; /* we know this cant be importable, the name is too long for blender! */
|
||||
|
||||
memcpy( txtname, name, namelen );
|
||||
memcpy( &txtname[namelen], ".py", 4 );
|
||||
|
||||
text = ( Text * ) & ( G.main->text.first );
|
||||
|
||||
while( text ) {
|
||||
if( !strcmp( txtname, GetName( text ) ) )
|
||||
for(text = G.main->text.first; text; text = text->id.next) {
|
||||
if( !strcmp( txtname, text->id.name+2 ) )
|
||||
break;
|
||||
text = text->id.next;
|
||||
}
|
||||
|
||||
if( !text ) {
|
||||
free( txtname );
|
||||
if( !text )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( !text->compiled ) {
|
||||
buf = txt_to_buf( text );
|
||||
text->compiled =
|
||||
Py_CompileString( buf, GetName( text ),
|
||||
Py_file_input );
|
||||
text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
|
||||
MEM_freeN( buf );
|
||||
|
||||
if( PyErr_Occurred( ) ) {
|
||||
PyErr_Print( );
|
||||
BPY_free_compiled_text( text );
|
||||
free( txtname );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free( txtname );
|
||||
return PyImport_ExecCodeModule( name, text->compiled );
|
||||
}
|
||||
|
||||
@@ -2864,7 +2839,7 @@ static PyObject *reimportText( PyObject *module )
|
||||
/* look up the text object */
|
||||
text = ( Text * ) & ( G.main->text.first );
|
||||
while( text ) {
|
||||
if( !strcmp( txtname, GetName( text ) ) )
|
||||
if( !strcmp( txtname, text->id.name+2 ) )
|
||||
break;
|
||||
text = text->id.next;
|
||||
}
|
||||
@@ -2881,8 +2856,7 @@ static PyObject *reimportText( PyObject *module )
|
||||
|
||||
/* compile the buffer */
|
||||
buf = txt_to_buf( text );
|
||||
text->compiled = Py_CompileString( buf, GetName( text ),
|
||||
Py_file_input );
|
||||
text->compiled = Py_CompileString( buf, text->id.name+2, Py_file_input );
|
||||
MEM_freeN( buf );
|
||||
|
||||
/* if compile failed.... return this error */
|
||||
|
@@ -1088,7 +1088,7 @@ void M_Blender_Init(void)
|
||||
PyDict_SetItemString(dict, "Material", Material_Init());
|
||||
PyDict_SetItemString(dict, "Mesh", Mesh_Init());
|
||||
PyDict_SetItemString(dict, "Metaball", Metaball_Init());
|
||||
PyDict_SetItemString(dict, "Mathutils", Mathutils_Init());
|
||||
PyDict_SetItemString(dict, "Mathutils", Mathutils_Init("Blender.Mathutils"));
|
||||
PyDict_SetItemString(dict, "Geometry", Geometry_Init());
|
||||
PyDict_SetItemString(dict, "Modifier", Modifier_Init());
|
||||
PyDict_SetItemString(dict, "NMesh", NMesh_Init());
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "Constraint.h" /*This must come first*/
|
||||
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_effect_types.h"
|
||||
#include "DNA_vec_types.h"
|
||||
@@ -43,6 +44,7 @@
|
||||
#include "BKE_constraint.h"
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BIF_editconstraint.h"
|
||||
#include "BIF_poseobject.h"
|
||||
#include "BSE_editipo.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "butspace.h"
|
||||
@@ -2286,19 +2288,32 @@ static PyObject *ConstraintSeq_moveDown( BPy_ConstraintSeq *self, BPy_Constraint
|
||||
|
||||
static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint *value )
|
||||
{
|
||||
bConstraint *con = locate_constr( self, value );
|
||||
bConstraint *con = locate_constr(self, value);
|
||||
bPoseChannel *active= NULL;
|
||||
|
||||
/* if we can't locate the constraint, return (exception already set) */
|
||||
if( !con )
|
||||
if (!con)
|
||||
return (PyObject *)NULL;
|
||||
|
||||
/* do the actual removal */
|
||||
if( self->pchan )
|
||||
BLI_remlink( &self->pchan->constraints, con );
|
||||
else
|
||||
BLI_remlink( &self->obj->constraints, con);
|
||||
/* check if we need to set temporary 'active' flag for pchan */
|
||||
if (self->pchan) {
|
||||
active= get_active_posechannel(self->obj);
|
||||
|
||||
if (active != self->pchan) {
|
||||
if (active) active->bone->flag &= ~BONE_ACTIVE;
|
||||
self->pchan->bone->flag |= BONE_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
/* del_constr_func() frees constraint + its data */
|
||||
del_constr_func( self->obj, con );
|
||||
|
||||
/* reset active pchan (if applicable) */
|
||||
if (self->pchan && self->pchan!=active) {
|
||||
if (active) active->bone->flag |= BONE_ACTIVE;
|
||||
self->pchan->bone->flag &= ~BONE_ACTIVE;
|
||||
}
|
||||
|
||||
/* erase the link to the constraint */
|
||||
value->con = NULL;
|
||||
|
||||
|
@@ -131,11 +131,11 @@
|
||||
#define EXPP_MAT_RAYMIRRGLOSS_MIN 0.0
|
||||
#define EXPP_MAT_RAYMIRRGLOSS_MAX 1.0
|
||||
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MIN 0
|
||||
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX 255
|
||||
#define EXPP_MAT_RAYMIRRGLOSSSAMPLES_MAX 1024
|
||||
#define EXPP_MAT_RAYTRANSPGLOSS_MIN 0.0
|
||||
#define EXPP_MAT_RAYTRANSPGLOSS_MAX 1.0
|
||||
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MIN 0
|
||||
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 255
|
||||
#define EXPP_MAT_RAYTRANSPGLOSSSAMPLES_MAX 1024
|
||||
#define EXPP_MAT_FILTER_MIN 0.0
|
||||
#define EXPP_MAT_FILTER_MAX 1.0
|
||||
#define EXPP_MAT_TRANSLUCENCY_MIN 0.0
|
||||
@@ -738,8 +738,10 @@ static PyMethodDef BPy_Material_methods[] = {
|
||||
"() - Return fresnel power for refractions factor"},
|
||||
{"getRayTransGloss", ( PyCFunction ) Material_getGlossTrans, METH_NOARGS,
|
||||
"() - Return amount refraction glossiness"},
|
||||
{"getRayTransGlossSamples", ( PyCFunction ) Material_getGlossTransSamples, METH_NOARGS,
|
||||
"() - Return number of sampels for transparent glossiness"},
|
||||
{"getRayMirrGlossSamples", ( PyCFunction ) Material_getGlossMirrSamples, METH_NOARGS,
|
||||
"() - Return amount mirror glossiness"},
|
||||
"() - Return number of sampels for mirror glossiness"},
|
||||
{"getFilter", ( PyCFunction ) Material_getFilter, METH_NOARGS,
|
||||
"() - Return the amount of filtering when transparent raytrace is enabled"},
|
||||
{"getTranslucency", ( PyCFunction ) Material_getTranslucency, METH_NOARGS,
|
||||
@@ -847,8 +849,10 @@ static PyMethodDef BPy_Material_methods[] = {
|
||||
"(f) - Set blend fac for mirror fresnel - [1.0, 5.0]"},
|
||||
{"setRayTransGloss", ( PyCFunction ) Material_setGlossTrans, METH_VARARGS,
|
||||
"(f) - Set amount refraction glossiness - [0.0, 1.0]"},
|
||||
{"setRayTransGlossSamples", ( PyCFunction ) Material_setGlossTransSamples, METH_VARARGS,
|
||||
"(i) - Set number transparent gloss samples - [1, 1024]"},
|
||||
{"setRayMirrGlossSamples", ( PyCFunction ) Material_setGlossMirrSamples, METH_VARARGS,
|
||||
"(f) - Set amount mirror glossiness - [0.0, 1.0]"},
|
||||
"(i) - Set number mirror gloss samples - [1, 1024]"},
|
||||
{"setFilter", ( PyCFunction ) Matr_oldsetFilter, METH_VARARGS,
|
||||
"(f) - Set the amount of filtering when transparent raytrace is enabled"},
|
||||
{"setTranslucency", ( PyCFunction ) Matr_oldsetTranslucency, METH_VARARGS,
|
||||
|
@@ -106,8 +106,9 @@ struct PyMethodDef M_Mathutils_methods[] = {
|
||||
{"Point", (PyCFunction) M_Mathutils_Point, METH_VARARGS, M_Mathutils_Point_doc},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
//----------------------------MODULE INIT-------------------------
|
||||
PyObject *Mathutils_Init(void)
|
||||
/*----------------------------MODULE INIT-------------------------*/
|
||||
/* from can be Blender.Mathutils or GameLogic.Mathutils for the BGE */
|
||||
PyObject *Mathutils_Init(char *from)
|
||||
{
|
||||
PyObject *submodule;
|
||||
|
||||
@@ -125,8 +126,7 @@ PyObject *Mathutils_Init(void)
|
||||
if( PyType_Ready( &quaternion_Type ) < 0 )
|
||||
return NULL;
|
||||
|
||||
submodule = Py_InitModule3("Blender.Mathutils",
|
||||
M_Mathutils_methods, M_Mathutils_doc);
|
||||
submodule = Py_InitModule3(from, M_Mathutils_methods, M_Mathutils_doc);
|
||||
return (submodule);
|
||||
}
|
||||
//-----------------------------METHODS----------------------------
|
||||
|
@@ -38,7 +38,7 @@
|
||||
#include "euler.h"
|
||||
#include "point.h"
|
||||
|
||||
PyObject *Mathutils_Init( void );
|
||||
PyObject *Mathutils_Init( char * from );
|
||||
PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat);
|
||||
PyObject *column_vector_multiplication(MatrixObject * mat, VectorObject* vec);
|
||||
PyObject *row_point_multiplication(PointObject* pt, MatrixObject * mat);
|
||||
|
@@ -1865,9 +1865,17 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
|
||||
num= cpa->num;
|
||||
|
||||
/* get orco */
|
||||
psys_particle_on_emitter(ob, psmd,
|
||||
(part->childtype == PART_CHILD_FACES)? PART_FROM_FACE: PART_FROM_PARTICLE,
|
||||
cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,nor,0,0,orco,0);
|
||||
if(part->childtype == PART_CHILD_FACES) {
|
||||
psys_particle_on_emitter(ob, psmd,
|
||||
PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
|
||||
cpa->fuv,cpa->foffset,co,nor,0,0,orco,0);
|
||||
}
|
||||
else {
|
||||
ParticleData *par = psys->particles + cpa->parent;
|
||||
psys_particle_on_emitter(ob, psmd, part->from,
|
||||
par->num,DMCACHE_ISCHILD,par->fuv,
|
||||
par->foffset,co,nor,0,0,orco,0);
|
||||
}
|
||||
|
||||
if(uvco){
|
||||
if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES){
|
||||
|
@@ -173,6 +173,7 @@ static void constraint_active_func(void *ob_v, void *con_v)
|
||||
}
|
||||
|
||||
lb= get_active_constraints(ob);
|
||||
if (lb == NULL) return;
|
||||
|
||||
for(con= lb->first; con; con= con->next) {
|
||||
if(con==con_v) con->flag |= CONSTRAINT_ACTIVE;
|
||||
@@ -307,7 +308,7 @@ void del_constr_func (void *ob_v, void *con_v)
|
||||
}
|
||||
/* remove constraint itself */
|
||||
lb= get_active_constraints(ob_v);
|
||||
free_constraint_data (con);
|
||||
free_constraint_data(con);
|
||||
BLI_freelinkN(lb, con);
|
||||
|
||||
constraint_active_func(ob_v, NULL);
|
||||
|
@@ -763,7 +763,16 @@ static void seq_panel_input()
|
||||
}
|
||||
|
||||
if (last_seq->type == SEQ_IMAGE) {
|
||||
StripElem * se = give_stripelem(last_seq, CFRA);
|
||||
int cfra = CFRA;
|
||||
StripElem * se;
|
||||
|
||||
if(last_seq->startdisp >cfra) {
|
||||
cfra = last_seq->startdisp;
|
||||
} else if (last_seq->enddisp <= cfra) {
|
||||
cfra = last_seq->enddisp - 1;
|
||||
}
|
||||
|
||||
se = give_stripelem(last_seq, cfra);
|
||||
|
||||
if (se) {
|
||||
uiDefBut(block, TEX,
|
||||
|
@@ -2507,7 +2507,7 @@ int draw_armature(Base *base, int dt, int flag)
|
||||
int retval= 0;
|
||||
|
||||
if(G.f & G_SIMULATION)
|
||||
return;
|
||||
return 1;
|
||||
|
||||
if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) {
|
||||
/* we use color for solid lighting */
|
||||
|
@@ -98,7 +98,7 @@
|
||||
int no_rightbox=0, no_leftbox= 0;
|
||||
static void draw_seq_handle(Sequence *seq, SpaceSeq *sseq, float pixelx, short direction);
|
||||
static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq);
|
||||
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2);
|
||||
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col);
|
||||
static void draw_shadedstrip(Sequence *seq, char *col, float x1, float y1, float x2, float y2);
|
||||
static void draw_seq_strip(struct Sequence *seq, struct ScrArea *sa, struct SpaceSeq *sseq, int outline_tint, float pixelx);
|
||||
|
||||
@@ -604,7 +604,7 @@ static void draw_seq_extensions(Sequence *seq, SpaceSeq *sseq)
|
||||
}
|
||||
|
||||
/* draw info text on a sequence strip */
|
||||
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
|
||||
static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2, char *background_col)
|
||||
{
|
||||
float v1[2], v2[2];
|
||||
int len, size;
|
||||
@@ -670,8 +670,13 @@ static void draw_seq_text(Sequence *seq, float x1, float x2, float y1, float y2)
|
||||
mval[1]= 1;
|
||||
areamouseco_to_ipoco(G.v2d, mval, &x1, &x2);
|
||||
|
||||
if(seq->flag & SELECT) cpack(0xFFFFFF);
|
||||
else cpack(0);
|
||||
if(seq->flag & SELECT){
|
||||
cpack(0xFFFFFF);
|
||||
}else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
|
||||
cpack(0x505050); /* use lighter text colour for dark background */
|
||||
}else{
|
||||
cpack(0);
|
||||
}
|
||||
glRasterPos3f(x1, y1+SEQ_STRIP_OFSBOTTOM, 0.0);
|
||||
BMF_DrawString(G.font, strp);
|
||||
}
|
||||
@@ -740,7 +745,7 @@ so wave file sample drawing precission is zoom adjusted
|
||||
static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outline_tint, float pixelx)
|
||||
{
|
||||
float x1, x2, y1, y2;
|
||||
char col[3], is_single_image;
|
||||
char col[3], background_col[3], is_single_image;
|
||||
|
||||
/* we need to know if this is a single image/color or not for drawing */
|
||||
is_single_image = (char)check_single_seq(seq);
|
||||
@@ -755,13 +760,14 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
|
||||
|
||||
|
||||
/* get the correct color per strip type*/
|
||||
get_seq_color3ubv(seq, col);
|
||||
//get_seq_color3ubv(seq, col);
|
||||
get_seq_color3ubv(seq, background_col);
|
||||
|
||||
/* draw the main strip body */
|
||||
if (is_single_image) /* single image */
|
||||
draw_shadedstrip(seq, col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
|
||||
draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
|
||||
else /* normal operation */
|
||||
draw_shadedstrip(seq, col, x1, y1, x2, y2);
|
||||
draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
|
||||
|
||||
/* draw additional info and controls */
|
||||
if (seq->type == SEQ_RAM_SOUND)
|
||||
@@ -814,7 +820,7 @@ static void draw_seq_strip(Sequence *seq, ScrArea *sa, SpaceSeq *sseq, int outli
|
||||
|
||||
/* nice text here would require changing the view matrix for texture text */
|
||||
if( (x2-x1) / pixelx > 32) {
|
||||
draw_seq_text(seq, x1, x2, y1, y2);
|
||||
draw_seq_text(seq, x1, x2, y1, y2, background_col);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1033,87 +1033,6 @@ static void *get_nearest_bone (short findunsel)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* used by posemode and editmode */
|
||||
void select_bone_parent (void)
|
||||
{
|
||||
Object *ob;
|
||||
bArmature *arm;
|
||||
|
||||
/* get data */
|
||||
if (G.obedit)
|
||||
ob= G.obedit;
|
||||
else if (OBACT)
|
||||
ob= OBACT;
|
||||
else
|
||||
return;
|
||||
arm= (bArmature *)ob->data;
|
||||
|
||||
/* determine which mode armature is in */
|
||||
if ((!G.obedit) && (ob->flag & OB_POSEMODE)) {
|
||||
/* deal with pose channels */
|
||||
/* channels are sorted on dependency, so the loop below won't result in a flood-select */
|
||||
bPoseChannel *pchan=NULL;
|
||||
|
||||
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
||||
/* check if bone in original selection */
|
||||
if (pchan->bone->flag & BONE_SELECTED) {
|
||||
bPoseChannel *chanpar= pchan->parent;
|
||||
|
||||
/* check if any parent */
|
||||
if ((chanpar) && ((chanpar->bone->flag & BONE_SELECTED)==0)) {
|
||||
chanpar->bone->flag |= BONE_SELECTED;
|
||||
select_actionchannel_by_name (ob->action, pchan->name, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (G.obedit) {
|
||||
/* deal with editbones */
|
||||
EditBone *curbone, *parbone, *parpar;
|
||||
|
||||
/* prevent floods */
|
||||
for (curbone= G.edbo.first; curbone; curbone= curbone->next)
|
||||
curbone->temp= NULL;
|
||||
|
||||
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
|
||||
/* check if bone selected */
|
||||
if ((curbone->flag & BONE_SELECTED) && curbone->temp==NULL) {
|
||||
parbone= curbone->parent;
|
||||
|
||||
/* check if any parent */
|
||||
if ((parbone) && ((parbone->flag & BONE_SELECTED)==0)) {
|
||||
/* select the parent bone */
|
||||
parbone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
|
||||
|
||||
/* check if parent has parent */
|
||||
parpar= parbone->parent;
|
||||
|
||||
if ((parpar) && (parbone->flag & BONE_CONNECTED)) {
|
||||
parpar->flag |= BONE_TIPSEL;
|
||||
}
|
||||
/* tag this bone to not flood selection */
|
||||
parbone->temp= parbone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* to be sure... */
|
||||
for (curbone= G.edbo.first; curbone; curbone= curbone->next)
|
||||
curbone->temp= NULL;
|
||||
|
||||
}
|
||||
|
||||
/* undo + redraw pushes */
|
||||
countall(); // flushes selection!
|
||||
|
||||
allqueue (REDRAWVIEW3D, 0);
|
||||
allqueue (REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWBUTSOBJECT, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
|
||||
BIF_undo_push("Select Parent");
|
||||
}
|
||||
|
||||
/* helper for setflag_sel_bone() */
|
||||
static void bone_setflag (int *bone, int flag, short mode)
|
||||
{
|
||||
@@ -1139,6 +1058,89 @@ static void bone_setflag (int *bone, int flag, short mode)
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the first available child of an editbone */
|
||||
static EditBone *editbone_get_child(EditBone *pabone, short use_visibility)
|
||||
{
|
||||
Object *ob;
|
||||
bArmature *arm;
|
||||
EditBone *curbone, *chbone=NULL;
|
||||
|
||||
if (!G.obedit) return NULL;
|
||||
else ob= G.obedit;
|
||||
arm= (bArmature *)ob->data;
|
||||
|
||||
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
|
||||
if (curbone->parent == pabone) {
|
||||
if (use_visibility) {
|
||||
if ((arm->layer & curbone->layer) && !(pabone->flag & BONE_HIDDEN_A))
|
||||
chbone = curbone;
|
||||
}
|
||||
else
|
||||
chbone = curbone;
|
||||
}
|
||||
}
|
||||
|
||||
return chbone;
|
||||
}
|
||||
|
||||
void armature_select_hierarchy(short direction, short add_to_sel)
|
||||
{
|
||||
Object *ob;
|
||||
bArmature *arm;
|
||||
EditBone *curbone, *pabone, *chbone;
|
||||
|
||||
if (!G.obedit) return;
|
||||
else ob= G.obedit;
|
||||
arm= (bArmature *)ob->data;
|
||||
|
||||
for (curbone= G.edbo.first; curbone; curbone= curbone->next) {
|
||||
if (arm->layer & curbone->layer) {
|
||||
if (curbone->flag & (BONE_ACTIVE)) {
|
||||
if (direction == BONE_SELECT_PARENT) {
|
||||
if (curbone->parent == NULL) continue;
|
||||
else pabone = curbone->parent;
|
||||
|
||||
if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_A)) {
|
||||
pabone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
|
||||
if (pabone->parent) pabone->parent->flag |= BONE_TIPSEL;
|
||||
|
||||
if (!add_to_sel) curbone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
|
||||
curbone->flag &= ~BONE_ACTIVE;
|
||||
break;
|
||||
}
|
||||
|
||||
} else { // BONE_SELECT_CHILD
|
||||
chbone = editbone_get_child(curbone, 1);
|
||||
if (chbone == NULL) continue;
|
||||
|
||||
if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_A)) {
|
||||
chbone->flag |= (BONE_ACTIVE|BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
|
||||
|
||||
if (!add_to_sel) {
|
||||
curbone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL);
|
||||
if (curbone->parent) curbone->parent->flag &= ~BONE_TIPSEL;
|
||||
}
|
||||
curbone->flag &= ~BONE_ACTIVE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
countall(); // flushes selection!
|
||||
|
||||
allqueue (REDRAWVIEW3D, 0);
|
||||
allqueue (REDRAWBUTSEDIT, 0);
|
||||
allqueue (REDRAWBUTSOBJECT, 0);
|
||||
allqueue (REDRAWOOPS, 0);
|
||||
|
||||
if (direction==BONE_SELECT_PARENT)
|
||||
BIF_undo_push("Select edit bone parent");
|
||||
if (direction==BONE_SELECT_CHILD)
|
||||
BIF_undo_push("Select edit bone child");
|
||||
}
|
||||
|
||||
/* used by posemode and editmode */
|
||||
void setflag_armature (short mode)
|
||||
{
|
||||
|
@@ -644,6 +644,7 @@ static int seq_is_parent(Sequence *par, Sequence *seq)
|
||||
|
||||
static int seq_is_predecessor(Sequence *pred, Sequence *seq)
|
||||
{
|
||||
if (!pred) return 0;
|
||||
if(pred == seq) return 0;
|
||||
else if(seq_is_parent(pred, seq)) return 1;
|
||||
else if(pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
|
||||
|
@@ -543,6 +543,7 @@ static void check_packAll()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
static void copy_game_dll(char *dll_filename, char *source_dir, char *dest_dir)
|
||||
{
|
||||
char source_filename[FILE_MAX];
|
||||
@@ -576,6 +577,7 @@ static void copy_all_game_dlls(char *str)
|
||||
copy_game_dll(game_dll_list[i], source_dir, dest_dir );
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
static int write_runtime(char *str, char *exename)
|
||||
{
|
||||
|
@@ -1325,12 +1325,21 @@ static void do_view3d_select_armaturemenu(void *arg, int event)
|
||||
case 2: /* Select/Deselect all */
|
||||
deselectall_armature(1, 1);
|
||||
break;
|
||||
case 3: /* Select Parent(s) */
|
||||
select_bone_parent();
|
||||
break;
|
||||
case 4: /* Swap Select All */
|
||||
case 3: /* Swap Select All */
|
||||
deselectall_armature(3, 1);
|
||||
break;
|
||||
case 4: /* Select parent */
|
||||
armature_select_hierarchy(BONE_SELECT_PARENT, 0);
|
||||
break;
|
||||
case 5: /* Select child */
|
||||
armature_select_hierarchy(BONE_SELECT_CHILD, 0);
|
||||
break;
|
||||
case 6: /* Extend Select parent */
|
||||
armature_select_hierarchy(BONE_SELECT_PARENT, 1);
|
||||
break;
|
||||
case 7: /* Extend Select child */
|
||||
armature_select_hierarchy(BONE_SELECT_CHILD, 1);
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
@@ -1348,11 +1357,18 @@ static uiBlock *view3d_select_armaturemenu(void *arg_unused)
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
|
||||
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
}
|
||||
@@ -1379,12 +1395,21 @@ static void do_view3d_select_pose_armaturemenu(void *arg, int event)
|
||||
case 3: /* Select Target(s) of Constraint(s) */
|
||||
pose_select_constraint_target();
|
||||
break;
|
||||
case 4: /* Select Bone's Parent */
|
||||
select_bone_parent();
|
||||
break;
|
||||
case 5: /* Swap Select All */
|
||||
deselectall_posearmature(OBACT, 3, 1);
|
||||
break;
|
||||
case 6: /* Select parent */
|
||||
pose_select_hierarchy(BONE_SELECT_PARENT, 0);
|
||||
break;
|
||||
case 7: /* Select child */
|
||||
pose_select_hierarchy(BONE_SELECT_CHILD, 0);
|
||||
break;
|
||||
case 8: /* Extend Select parent */
|
||||
pose_select_hierarchy(BONE_SELECT_PARENT, 1);
|
||||
break;
|
||||
case 9: /* Extend Select child */
|
||||
pose_select_hierarchy(BONE_SELECT_CHILD, 1);
|
||||
break;
|
||||
}
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
@@ -1404,8 +1429,17 @@ static uiBlock *view3d_select_pose_armaturemenu(void *arg_unused)
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Constraint Target|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
|
||||
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent|[", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Child|]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Parent|Shift [", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extend Select Child|Shift ]", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
|
||||
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiBlockSetDirection(block, UI_DOWN);
|
||||
}
|
||||
|
@@ -479,6 +479,67 @@ void pose_select_constraint_target(void)
|
||||
|
||||
}
|
||||
|
||||
void pose_select_hierarchy(short direction, short add_to_sel)
|
||||
{
|
||||
Object *ob= OBACT;
|
||||
bArmature *arm= ob->data;
|
||||
bPoseChannel *pchan;
|
||||
Bone *curbone, *pabone, *chbone;
|
||||
|
||||
/* paranoia checks */
|
||||
if (!ob && !ob->pose) return;
|
||||
if (ob==G.obedit || (ob->flag & OB_POSEMODE)==0) return;
|
||||
|
||||
for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
||||
curbone= pchan->bone;
|
||||
|
||||
if (arm->layer & curbone->layer) {
|
||||
if (curbone->flag & (BONE_ACTIVE)) {
|
||||
if (direction == BONE_SELECT_PARENT) {
|
||||
|
||||
if (pchan->parent == NULL) continue;
|
||||
else pabone= pchan->parent->bone;
|
||||
|
||||
if ((arm->layer & pabone->layer) && !(pabone->flag & BONE_HIDDEN_P)) {
|
||||
|
||||
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
|
||||
curbone->flag &= ~BONE_ACTIVE;
|
||||
pabone->flag |= (BONE_ACTIVE|BONE_SELECTED);
|
||||
|
||||
select_actionchannel_by_name (ob->action, pchan->name, 0);
|
||||
select_actionchannel_by_name (ob->action, pchan->parent->name, 1);
|
||||
break;
|
||||
}
|
||||
} else { // BONE_SELECT_CHILD
|
||||
|
||||
if (pchan->child == NULL) continue;
|
||||
else chbone = pchan->child->bone;
|
||||
|
||||
if ((arm->layer & chbone->layer) && !(chbone->flag & BONE_HIDDEN_P)) {
|
||||
|
||||
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
|
||||
curbone->flag &= ~BONE_ACTIVE;
|
||||
chbone->flag |= (BONE_ACTIVE|BONE_SELECTED);
|
||||
|
||||
select_actionchannel_by_name (ob->action, pchan->name, 0);
|
||||
select_actionchannel_by_name (ob->action, pchan->child->name, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allqueue (REDRAWVIEW3D, 0);
|
||||
allqueue (REDRAWBUTSOBJECT, 0);
|
||||
allqueue (REDRAWOOPS, 0);
|
||||
|
||||
if (direction==BONE_SELECT_PARENT)
|
||||
BIF_undo_push("Select pose bone parent");
|
||||
if (direction==BONE_SELECT_CHILD)
|
||||
BIF_undo_push("Select pose bone child");
|
||||
}
|
||||
|
||||
/* context: active channel */
|
||||
void pose_special_editmenu(void)
|
||||
{
|
||||
|
@@ -2438,7 +2438,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
else if(G.qual==LR_ALTKEY && G.obedit->type==OB_ARMATURE)
|
||||
clear_bone_parent();
|
||||
else if((G.qual==0) && (G.obedit->type==OB_ARMATURE))
|
||||
select_bone_parent();
|
||||
armature_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
|
||||
else if((G.qual==(LR_CTRLKEY|LR_ALTKEY)) && (G.obedit->type==OB_ARMATURE))
|
||||
separate_armature();
|
||||
else if((G.qual==0) && G.obedit->type==OB_MESH)
|
||||
@@ -2468,7 +2468,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
start_RBSimulation();
|
||||
}
|
||||
else if((G.qual==0) && (OBACT) && (OBACT->type==OB_ARMATURE) && (OBACT->flag & OB_POSEMODE))
|
||||
select_bone_parent();
|
||||
pose_select_hierarchy(BONE_SELECT_PARENT, 1); // 1 = add to selection
|
||||
else if((G.qual==0)) {
|
||||
start_game();
|
||||
}
|
||||
@@ -2770,6 +2770,19 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
scrarea_queue_winredraw(curarea);
|
||||
break;
|
||||
|
||||
case LEFTBRACKETKEY:
|
||||
if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
|
||||
armature_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
|
||||
else if ((ob) && (ob->flag & OB_POSEMODE))
|
||||
pose_select_hierarchy(BONE_SELECT_PARENT, (G.qual == LR_SHIFTKEY));
|
||||
break;
|
||||
case RIGHTBRACKETKEY:
|
||||
if ((G.obedit) && (G.obedit->type == OB_ARMATURE))
|
||||
armature_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
|
||||
if ((ob) && (ob->flag & OB_POSEMODE))
|
||||
pose_select_hierarchy(BONE_SELECT_CHILD, (G.qual == LR_SHIFTKEY));
|
||||
break;
|
||||
|
||||
case PADSLASHKEY:
|
||||
if(G.qual==0) {
|
||||
if(G.vd->localview) {
|
||||
|
@@ -914,6 +914,7 @@ PyMethodDef KX_GameObject::Methods[] = {
|
||||
KX_PYMETHODTABLE(KX_GameObject, rayCastTo),
|
||||
KX_PYMETHODTABLE(KX_GameObject, rayCast),
|
||||
KX_PYMETHODTABLE(KX_GameObject, getDistanceTo),
|
||||
KX_PYMETHODTABLE(KX_GameObject, getVectTo),
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
|
||||
@@ -1367,14 +1368,15 @@ PyObject* KX_GameObject::PyGetMesh(PyObject* self,
|
||||
{
|
||||
int mesh = 0;
|
||||
|
||||
if (PyArg_ParseTuple(args, "|i", &mesh))
|
||||
if (!PyArg_ParseTuple(args, "|i", &mesh))
|
||||
return NULL; // python sets a simple error
|
||||
|
||||
if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0)
|
||||
{
|
||||
if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0)
|
||||
{
|
||||
KX_MeshProxy* meshproxy = new KX_MeshProxy(m_meshes[mesh]);
|
||||
return meshproxy;
|
||||
}
|
||||
KX_MeshProxy* meshproxy = new KX_MeshProxy(m_meshes[mesh]);
|
||||
return meshproxy;
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -1555,6 +1557,54 @@ KX_PYMETHODDEF_DOC(KX_GameObject, getDistanceTo,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
KX_PYMETHODDEF_DOC(KX_GameObject, getVectTo,
|
||||
"getVectTo(other): get vector and the distance to another point/KX_GameObject\n"
|
||||
"Returns a 3-tuple with (distance,worldVector,localVector)\n")
|
||||
{
|
||||
MT_Point3 toPoint, fromPoint;
|
||||
MT_Vector3 toDir, locToDir;
|
||||
MT_Scalar distance;
|
||||
|
||||
PyObject *returnValue;
|
||||
PyObject *pyother;
|
||||
|
||||
if (!PyVecArgTo(args, toPoint))
|
||||
{
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "O!", &KX_GameObject::Type, &pyother))
|
||||
{
|
||||
KX_GameObject *other = static_cast<KX_GameObject*>(pyother);
|
||||
toPoint = other->NodeGetWorldPosition();
|
||||
}else
|
||||
{
|
||||
PyErr_SetString(PyExc_TypeError, "Expected a 3D Vector or GameObject type");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
fromPoint = NodeGetWorldPosition();
|
||||
toDir = toPoint-fromPoint;
|
||||
distance = toDir.length();
|
||||
|
||||
if (MT_fuzzyZero(distance))
|
||||
{
|
||||
//cout << "getVectTo() Error: Null vector!\n";
|
||||
locToDir = toDir = MT_Vector3(0.0,0.0,0.0);
|
||||
distance = 0.0;
|
||||
} else {
|
||||
toDir.normalize();
|
||||
locToDir = toDir * NodeGetWorldOrientation();
|
||||
}
|
||||
|
||||
returnValue = PyTuple_New(3);
|
||||
if (returnValue) { // very unlikely to fail, python sets a memory error here.
|
||||
PyTuple_SET_ITEM(returnValue, 0, PyFloat_FromDouble(distance));
|
||||
PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(toDir));
|
||||
PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(locToDir));
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
bool KX_GameObject::RayHit(KX_ClientObjectInfo* client, MT_Point3& hit_point, MT_Vector3& hit_normal, void * const data)
|
||||
{
|
||||
|
||||
@@ -1588,8 +1638,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
|
||||
char *propName = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args,"O|fs", &pyarg, &dist, &propName)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
return NULL; // python sets simple error
|
||||
}
|
||||
|
||||
if (!PyVecTo(pyarg, toPoint))
|
||||
@@ -1654,8 +1703,7 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
|
||||
KX_GameObject *other;
|
||||
|
||||
if (!PyArg_ParseTuple(args,"O|Ofs", &pyto, &pyfrom, &dist, &propName)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Invalid arguments");
|
||||
return NULL;
|
||||
return NULL; // Python sets a simple error
|
||||
}
|
||||
|
||||
if (!PyVecTo(pyto, toPoint))
|
||||
@@ -1714,13 +1762,11 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
|
||||
if (m_pHitObject)
|
||||
{
|
||||
PyObject* returnValue = PyTuple_New(3);
|
||||
if (!returnValue) {
|
||||
PyErr_SetString(PyExc_TypeError, "PyTuple_New() failed");
|
||||
return NULL;
|
||||
if (returnValue) { // unlikely this would ever fail, if it does python sets an error
|
||||
PyTuple_SET_ITEM(returnValue, 0, m_pHitObject->AddRef());
|
||||
PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(resultPoint));
|
||||
PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(resultNormal));
|
||||
}
|
||||
PyTuple_SET_ITEM(returnValue, 0, m_pHitObject->AddRef());
|
||||
PyTuple_SET_ITEM(returnValue, 1, PyObjectFrom(resultPoint));
|
||||
PyTuple_SET_ITEM(returnValue, 2, PyObjectFrom(resultNormal));
|
||||
return returnValue;
|
||||
}
|
||||
return Py_BuildValue("OOO", Py_None, Py_None, Py_None);
|
||||
|
@@ -756,6 +756,7 @@ public:
|
||||
KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
|
||||
KX_PYMETHOD_DOC(KX_GameObject,rayCast);
|
||||
KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo);
|
||||
KX_PYMETHOD_DOC(KX_GameObject,getVectTo);
|
||||
|
||||
private :
|
||||
|
||||
|
@@ -62,6 +62,10 @@
|
||||
|
||||
#include "KX_PyMath.h"
|
||||
|
||||
extern "C" {
|
||||
#include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
|
||||
}
|
||||
|
||||
#include "PHY_IPhysicsEnvironment.h"
|
||||
// FIXME: Enable for access to blender python modules. This is disabled because
|
||||
// python has dependencies on a lot of other modules and is a pain to link.
|
||||
@@ -815,7 +819,10 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
|
||||
|
||||
ErrorObject = PyString_FromString("GameLogic.error");
|
||||
PyDict_SetItemString(d, "error", ErrorObject);
|
||||
|
||||
|
||||
// Add Blender.Mathutils module, duplicate code :/
|
||||
PyDict_SetItemString(d, "Mathutils", Mathutils_Init("GameLogic.Mathutils"));
|
||||
|
||||
// XXXX Add constants here
|
||||
/* To use logic bricks, we need some sort of constants. Here, we associate */
|
||||
/* constants and sumbolic names. Add them to dictionary d. */
|
||||
|
@@ -5,7 +5,21 @@ Import ('env')
|
||||
|
||||
sources = env.Glob('*.cpp')
|
||||
|
||||
incs = '. #source/kernel/gen_system #intern/string #intern/guardedalloc'
|
||||
# Mathutils C files.
|
||||
sources.extend([\
|
||||
'#source/blender/python/api2_2x/Mathutils.c',\
|
||||
'#source/blender/python/api2_2x/constant.c',\
|
||||
'#source/blender/python/api2_2x/euler.c',\
|
||||
'#source/blender/python/api2_2x/gen_utils.c',\
|
||||
'#source/blender/python/api2_2x/matrix.c',\
|
||||
'#source/blender/python/api2_2x/point.c',\
|
||||
'#source/blender/python/api2_2x/quat.c',\
|
||||
'#source/blender/python/api2_2x/vector.c',\
|
||||
])
|
||||
|
||||
incs = '. #source/blender/python/api2_2x' # Only for Mathutils! - no other deps
|
||||
|
||||
incs += ' #source/kernel/gen_system #intern/string #intern/guardedalloc'
|
||||
incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer #intern/bmfont'
|
||||
incs += ' #intern/SoundSystem #intern/SoundSystem/include #intern/SoundSystem/openal'
|
||||
incs += ' #intern/SoundSystem/dummy #intern/SoundSystem/intern #source/gameengine/Converter'
|
||||
|
@@ -253,6 +253,16 @@ class KX_GameObject:
|
||||
@type other: L{KX_GameObject} or list [x, y, z]
|
||||
@rtype: float
|
||||
"""
|
||||
def getVectTo(other):
|
||||
"""
|
||||
Returns the vector and the distance to another object or point.
|
||||
The vector is normalized unless the distance is 0, in which a NULL vector is returned.
|
||||
|
||||
@param other: a point or another L{KX_GameObject} to get the vector and distance to.
|
||||
@type other: L{KX_GameObject} or list [x, y, z]
|
||||
@rtype: 3-tuple (float, 3-tuple (x,y,z), 3-tuple (x,y,z))
|
||||
@return: (distance, globalVector(3), localVector(3))
|
||||
"""
|
||||
def rayCastTo(other,dist,prop):
|
||||
"""
|
||||
Look towards another point/object and find first object hit within dist that matches prop.
|
||||
|
Reference in New Issue
Block a user