forked from bartvdbraak/blender
export_fbx.py - support scene start/end frames, fpx, mist settings, better default camera writing.
BPyObject.py - function for getting an objects armature, look at both parent and modifier. editmesh_add.c and BPyAddMesh.py - check for multires filesel.c, Append/Link had a bug where files linked in, didnt have the LIB_APPEND_TAG unset, and appending these into a new blend file would link instead. BKE_library.h, library.c - utility functions for flagging listbases flag_all_listbases_ids and and flag_listbase_ids
This commit is contained in:
parent
94b7743dd3
commit
c7b1e5c11d
@ -1,6 +1,7 @@
|
||||
import Blender
|
||||
from Blender.Window import EditMode, GetCursorPos, GetViewQuat
|
||||
import bpy
|
||||
import BPyMessages
|
||||
|
||||
def add_mesh_simple(name, verts, edges, faces):
|
||||
'''
|
||||
@ -26,12 +27,16 @@ def add_mesh_simple(name, verts, edges, faces):
|
||||
|
||||
# We are in mesh editmode
|
||||
if EditMode():
|
||||
me = ob_act.getData(mesh=1)
|
||||
|
||||
if me.multires:
|
||||
BPyMessages.Error_NoMeshMultiresEdit()
|
||||
return
|
||||
|
||||
# Add to existing mesh
|
||||
# must exit editmode to modify mesh
|
||||
EditMode(0)
|
||||
|
||||
me = ob_act.getData(mesh=1)
|
||||
me.sel = False
|
||||
|
||||
vert_offset = len(me.verts)
|
||||
|
@ -1,5 +1,23 @@
|
||||
import Blender
|
||||
|
||||
def getObjectArmature(ob):
|
||||
'''
|
||||
This returns the first armature the mesh uses.
|
||||
remember there can be more then 1 armature but most people dont do that.
|
||||
'''
|
||||
arm = ob.parent
|
||||
if arm and arm.type == 'Armature' and ob.parentType == Blender.Object.ParentTypes.ARMATURE:
|
||||
arm
|
||||
|
||||
for m in ob.modifiers:
|
||||
if m.type== Blender.Modifier.Types.ARMATURE:
|
||||
arm = m[Blender.Modifier.Settings.OBJECT]
|
||||
if arm:
|
||||
return arm
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def getDerivedObjects(ob, PARTICLES= True):
|
||||
'''
|
||||
Takes an objects and returnes a list of (ob, maxrix4x4) pairs
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -70,5 +70,8 @@ void IDnames_to_pupstring(char **str, char *title, char *extraops, struct ListBa
|
||||
void IMAnames_to_pupstring(char **str, char *title, char *extraops, struct ListBase *lb, struct ID *link, short *nr);
|
||||
void IPOnames_to_pupstring(char **str, char *title, char *extraops, struct ListBase *lb, struct ID* link, short *nr, int blocktype);
|
||||
|
||||
void flag_listbase_ids(ListBase *lb, short flag, short value);
|
||||
void flag_all_listbases_ids(short flag, short value);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -198,6 +198,28 @@ ListBase *wich_libbase(Main *mainlib, short type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Flag all ids in listbase */
|
||||
void flag_listbase_ids(ListBase *lb, short flag, short value)
|
||||
{
|
||||
ID *id;
|
||||
if (value) {
|
||||
for(id= lb->first; id; id= id->next) id->flag |= flag;
|
||||
} else {
|
||||
flag = ~flag;
|
||||
for(id= lb->first; id; id= id->next) id->flag &= flag;
|
||||
}
|
||||
}
|
||||
|
||||
/* Flag all ids in listbase */
|
||||
void flag_all_listbases_ids(short flag, short value)
|
||||
{
|
||||
ListBase *lbarray[MAX_LIBARRAY];
|
||||
int a;
|
||||
a= set_listbasepointers(G.main, lbarray);
|
||||
while(a--) flag_listbase_ids(lbarray[a], flag, value);
|
||||
}
|
||||
|
||||
|
||||
/* note: MAX_LIBARRAY define should match this code */
|
||||
int set_listbasepointers(Main *main, ListBase **lb)
|
||||
{
|
||||
|
@ -604,15 +604,7 @@ PyObject *LibraryData_importLibData( BPy_LibraryData *self, char *name,
|
||||
*/
|
||||
|
||||
if( mode != FILE_LINK ) {
|
||||
ID *id;
|
||||
ListBase *lbarray[MAX_LIBARRAY];
|
||||
int a;
|
||||
|
||||
/* tag everything, all untagged data can be made local */
|
||||
a= set_listbasepointers(G.main, lbarray);
|
||||
while( a--)
|
||||
for( id= lbarray[a]->first; id; id= id->next )
|
||||
id->flag |= LIB_APPEND_TAG;
|
||||
flag_all_listbases_ids(LIB_APPEND_TAG, 1);
|
||||
|
||||
/* see what new block will be called */
|
||||
strncpy( newName, name, strlen(name)+1 );
|
||||
@ -629,8 +621,12 @@ PyObject *LibraryData_importLibData( BPy_LibraryData *self, char *name,
|
||||
*/
|
||||
for( lib = G.main->library.first; lib; lib = lib->id.next )
|
||||
if( strcmp( longFilename, lib->name ) == 0 ) {
|
||||
if( mode != FILE_LINK )
|
||||
if( mode != FILE_LINK ) {
|
||||
all_local( lib, 1 );
|
||||
/* important we unset, otherwise these object wont
|
||||
* link into other scenes from this blend file */
|
||||
flag_all_listbases_ids(LIB_APPEND_TAG, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1183,6 +1183,8 @@ void add_primitiveMesh(int type)
|
||||
if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
|
||||
if(G.vd==0) return;
|
||||
|
||||
if (G.obedit && G.obedit->type==OB_MESH && multires_test()) return;
|
||||
|
||||
/* if editmode exists for other type, it exits */
|
||||
check_editmode(OB_MESH);
|
||||
|
||||
|
@ -2395,17 +2395,9 @@ static void do_library_append(SpaceFile *sfile)
|
||||
Object *ob;
|
||||
int idcode = groupname_to_code(group);
|
||||
|
||||
if((sfile->flag & FILE_LINK)==0) {
|
||||
if((sfile->flag & FILE_LINK)==0)
|
||||
/* tag everything, all untagged data can be made local */
|
||||
ID *id;
|
||||
ListBase *lbarray[MAX_LIBARRAY];
|
||||
int a;
|
||||
|
||||
a= set_listbasepointers(G.main, lbarray);
|
||||
while(a--) {
|
||||
for(id= lbarray[a]->first; id; id= id->next) id->flag |= LIB_APPEND_TAG;
|
||||
}
|
||||
}
|
||||
flag_all_listbases_ids(LIB_APPEND_TAG, 1);
|
||||
|
||||
BLO_library_append(sfile, dir, idcode);
|
||||
|
||||
@ -2428,6 +2420,10 @@ static void do_library_append(SpaceFile *sfile)
|
||||
/* make local */
|
||||
if(lib && (sfile->flag & FILE_LINK)==0) {
|
||||
all_local(lib, 1);
|
||||
/* important we unset, otherwise these object wont
|
||||
* link into other scenes from this blend file */
|
||||
flag_all_listbases_ids(LIB_APPEND_TAG, 1);
|
||||
|
||||
}
|
||||
|
||||
DAG_scene_sort(G.scene);
|
||||
|
Loading…
Reference in New Issue
Block a user