added the option to Blender.Library to 'link' data for malefico
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_space_types.h" /* for line linked */
|
||||
#include "BKE_library.h" /* for all_local */
|
||||
#include "BKE_font.h" /* for text_to_curve */
|
||||
#include "BKE_utildefines.h"
|
||||
@@ -309,27 +310,29 @@ PyObject *M_Library_Load( PyObject * self, PyObject * args )
|
||||
char *base = NULL;
|
||||
int update = 1;
|
||||
int blocktype = 0;
|
||||
int linked = 0;
|
||||
|
||||
if( !bpy_openlib ) {
|
||||
return EXPP_ReturnPyObjError( PyExc_IOError,
|
||||
"no library file: you need to open one, first." );
|
||||
}
|
||||
|
||||
if( !PyArg_ParseTuple( args, "ss|i", &name, &base, &update ) ) {
|
||||
if( !PyArg_ParseTuple( args, "ss|ii", &name, &base, &update, &linked ) ) {
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"expected two strings as arguments." );
|
||||
}
|
||||
|
||||
blocktype = ( int ) BLO_idcode_from_name( base );
|
||||
|
||||
if( !blocktype ) {
|
||||
if( !blocktype )
|
||||
return EXPP_ReturnPyObjError( PyExc_NameError,
|
||||
"no such Blender datablock type" );
|
||||
}
|
||||
|
||||
BLO_script_library_append( bpy_openlib, bpy_openlibname, name,
|
||||
blocktype );
|
||||
|
||||
|
||||
if (linked)
|
||||
BLO_script_library_append( bpy_openlib, bpy_openlibname, name, blocktype, FILE_LINK);
|
||||
else
|
||||
BLO_script_library_append( bpy_openlib, bpy_openlibname, name, blocktype, 0);
|
||||
|
||||
if( update ) {
|
||||
M_Library_Update( self );
|
||||
Py_DECREF( Py_None ); /* incref'ed by above function */
|
||||
|
||||
@@ -80,17 +80,19 @@ def Datablocks (group):
|
||||
@param group: datablock group, see L{LinkableGroups}.
|
||||
"""
|
||||
|
||||
def Load (datablock, group, update = 1):
|
||||
def Load (datablock, group, update = 1, linked = 0):
|
||||
"""
|
||||
Load the given datablock object from the current library file
|
||||
@type datablock: string
|
||||
@type group: string
|
||||
@type update: bool
|
||||
@type linked: bool
|
||||
@param datablock: an available object name, as returned by L{Datablocks}.
|
||||
@param group: an available group name, as returned by L{LinkableGroups}.
|
||||
@param update: defines if Blender should be updated after loading this
|
||||
object. This means linking all objects and remaking all display lists,
|
||||
so it is potentially very slow.
|
||||
@param linked: Will keep objects linked to their source blend file, the update option or later updating will unlink the data from the original blend and make it local.
|
||||
|
||||
@warn: If you plan to load more than one object in sequence, it is
|
||||
B{definitely recommended} to set 'update' to 0 in all calls to this
|
||||
|
||||
Reference in New Issue
Block a user