rna: added lib.parent access and made filename editable.

This commit is contained in:
Campbell Barton
2010-04-22 08:25:05 +00:00
parent a2b6abeee1
commit c8c22d2cf6
4 changed files with 10 additions and 12 deletions
+1 -7
View File
@@ -178,13 +178,7 @@ ModifierData *modifiers_findByType(Object *ob, ModifierType type)
ModifierData *modifiers_findByName(Object *ob, const char *name)
{
ModifierData *md = ob->modifiers.first;
for (; md; md=md->next)
if (strcmp(md->name, name)==0)
break;
return md;
return BLI_findstring(&(ob->modifiers), name, offsetof(ModifierData, name));
}
void modifiers_clearErrors(Object *ob)
@@ -93,7 +93,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, char *name)
defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
BLI_strncpy(defgroup->name, name, 32);
BLI_strncpy(defgroup->name, name, sizeof(defgroup->name));
BLI_addtail(&ob->defbase, defgroup);
defgroup_unique_name(defgroup, ob);
+3 -3
View File
@@ -116,10 +116,10 @@ typedef struct Library {
ID id;
ID *idblock;
struct FileData *filedata;
char name[240]; /* revealed in the UI, can store relative path */
char filename[240]; /* expanded name, not relative, used while reading */
char name[240]; /* path name used for reading, can be relative and edited in the outliner */
char filename[240]; /* temp. absolute filepath, only used while reading */
int tot, pad; /* tot, idblock and filedata are only fo read and write */
struct Library *parent; /* for outliner, showing dependency */
struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */
} Library;
#define PREVIEW_MIPMAPS 2
+5 -1
View File
@@ -401,8 +401,12 @@ static void rna_def_library(BlenderRNA *brna)
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Filename", "Path to the library .blend file");
/* TODO - lib->filename isnt updated, however the outliner also skips this, probably only needed on read. */
prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ID");
RNA_def_property_ui_text(prop, "Parent", "");
}
void RNA_def_ID(BlenderRNA *brna)
{