Merging r40848 through r40876 from trunk into soc-2011-tomato

This commit is contained in:
Sergey Sharybin
2011-10-09 20:26:56 +00:00
39 changed files with 264 additions and 251 deletions

View File

@@ -123,8 +123,10 @@ def dump_messages_rna(messages):
continue
msgsrc = "bpy.types.%s.%s" % (bl_rna.identifier, prop.identifier)
messages.setdefault(prop.name, []).append(msgsrc)
messages.setdefault(prop.description, []).append(msgsrc)
if prop.name and prop.name != prop.identifier:
messages.setdefault(prop.name, []).append(msgsrc)
if prop.description:
messages.setdefault(prop.description, []).append(msgsrc)
if isinstance(prop, bpy.types.EnumProperty):
for item in prop.enum_items:
@@ -132,8 +134,11 @@ def dump_messages_rna(messages):
prop.identifier,
item.identifier,
)
messages.setdefault(item.name, []).append(msgsrc)
messages.setdefault(item.description, []).append(msgsrc)
# Here identifier and name can be the same!
if item.name: # and item.name != item.identifier:
messages.setdefault(item.name, []).append(msgsrc)
if item.description:
messages.setdefault(item.description, []).append(msgsrc)
def walkRNA(bl_rna):

View File

@@ -140,7 +140,7 @@ def align_objects(align_x,
for obj, bb_world in objs:
if bb_quality:
if bb_quality and obj.type == 'MESH':
GBB = GlobalBB_HQ(obj)
else:
GBB = GlobalBB_LQ(bb_world)
@@ -204,7 +204,7 @@ def align_objects(align_x,
matrix_world = obj.matrix_world.copy()
bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
if bb_quality:
if bb_quality and obj.type == 'MESH':
GBB = GlobalBB_HQ(obj)
else:
GBB = GlobalBB_LQ(bb_world)

View File

@@ -353,14 +353,26 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
# custom properties
def doCustomProps(ksi, ks, bone):
prop_type_compat = {bpy.types.BooleanProperty,
bpy.types.IntProperty,
bpy.types.FloatProperty}
# go over all custom properties for bone
for prop, val in bone.items():
for prop in bone.keys():
# ignore special "_RNA_UI" used for UI editing
if prop == "_RNA_UI":
continue
# for now, just add all of 'em
ksi.addProp(ks, bone, '["%s"]' % (prop))
prop_rna = type(bone).bl_rna.properties.get(prop, None)
if prop_rna is None:
prop_path = '["%s"]' % prop
if bone.path_resolve(prop_path, False).rna_type in prop_type_compat:
ksi.addProp(ks, bone, prop_path)
elif prop_rna.is_animatable:
ksi.addProp(ks, bone, prop)
###############################

View File

@@ -46,6 +46,7 @@ struct Curve;
struct objfnt;
struct TmpFont;
struct CharInfo;
struct Main;
struct chartrans {
float xof, yof;
@@ -77,10 +78,10 @@ void BKE_font_register_builtin(void *mem, int size);
void free_vfont(struct VFont *sc);
void free_ttfont(void);
struct VFont *get_builtin_font(void);
struct VFont *load_vfont(const char *name);
struct VFont *load_vfont(struct Main *bmain, const char *name);
struct TmpFont *vfont_find_tmpfont(struct VFont *vfont);
struct chartrans *BKE_text_to_curve(struct Scene *scene, struct Object *ob, int mode);
struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode);
int BKE_font_getselection(struct Object *ob, int *start, int *end);

View File

@@ -45,7 +45,7 @@ struct ReportList;
struct VFont;
/* pack */
struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename);
struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename, const char *relabase);
struct PackedFile *newPackedFileMemory(void *mem, int memlen);
void packAll(struct Main *bmain, struct ReportList *reports);

View File

@@ -1514,7 +1514,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
/* in par the family name is stored, use this to find the other objects */
chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI);
chartransdata= BKE_text_to_curve(G.main, scene, par, FO_DUPLI);
if(chartransdata==NULL) return;
cu= par->data;

View File

@@ -2383,10 +2383,8 @@ int CustomData_verify_versions(struct CustomData *data, int index)
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
{
char *path = (id->lib)? id->lib->filepath: G.main->name;
BLI_strncpy(filename, external->filename, FILE_MAX);
BLI_path_abs(filename, path);
BLI_path_abs(filename, ID_BLEND_PATH(G.main, id));
}
void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem)

View File

@@ -1207,7 +1207,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if(cu->path) free_path(cu->path);
cu->path= NULL;
if(ob->type==OB_FONT) BKE_text_to_curve(scene, ob, 0);
if(ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0);
if(!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);

View File

@@ -284,7 +284,7 @@ struct TmpFont *vfont_find_tmpfont(VFont *vfont)
return tmpfnt;
}
static VFontData *vfont_get_data(VFont *vfont)
static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
{
struct TmpFont *tmpfnt = NULL;
PackedFile *tpf;
@@ -319,11 +319,11 @@ static VFontData *vfont_get_data(VFont *vfont)
BLI_addtail(&ttfdata, tmpfnt);
}
} else {
pf= newPackedFile(NULL, vfont->name);
pf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
if(!tmpfnt)
{
tpf= newPackedFile(NULL, vfont->name);
tpf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
// Add temporary packed file to globals
tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
@@ -351,7 +351,7 @@ static VFontData *vfont_get_data(VFont *vfont)
return vfont->data;
}
VFont *load_vfont(const char *name)
VFont *load_vfont(Main *bmain, const char *name)
{
char filename[FILE_MAXFILE];
VFont *vfont= NULL;
@@ -371,8 +371,8 @@ VFont *load_vfont(const char *name)
BLI_strncpy(dir, name, sizeof(dir));
BLI_splitdirstring(dir, filename);
pf= newPackedFile(NULL, name);
tpf= newPackedFile(NULL, name);
pf= newPackedFile(NULL, name, bmain->name);
tpf= newPackedFile(NULL, name, bmain->name);
is_builtin= 0;
}
@@ -382,7 +382,7 @@ VFont *load_vfont(const char *name)
vfd= BLI_vfontdata_from_freetypefont(pf);
if (vfd) {
vfont = alloc_libblock(&G.main->vfont, ID_VF, filename);
vfont = alloc_libblock(&bmain->vfont, ID_VF, filename);
vfont->data = vfd;
/* if there's a font name, use it for the ID name */
@@ -439,7 +439,7 @@ VFont *get_builtin_font(void)
if (strcmp(vf->name, FO_BUILTIN_NAME)==0)
return vf;
return load_vfont(FO_BUILTIN_NAME);
return load_vfont(G.main, FO_BUILTIN_NAME);
}
static VChar *find_vfont_char(VFontData *vfd, intptr_t character)
@@ -500,7 +500,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
}
static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx)
static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo *info, float ofsx, float ofsy, float rot, int charidx)
{
BezTriple *bezt1, *bezt2;
Nurb *nu1 = NULL, *nu2 = NULL;
@@ -509,7 +509,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float
VChar *che = NULL;
int i;
vfd= vfont_get_data(which_vfont(cu, info));
vfd= vfont_get_data(bmain, which_vfont(cu, info));
if (!vfd) return;
/*
@@ -662,7 +662,7 @@ static float char_width(Curve *cu, VChar *che, CharInfo *info)
}
}
struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int mode)
{
VFont *vfont, *oldvfont;
VFontData *vfd= NULL;
@@ -714,7 +714,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
if (cu->tb==NULL)
cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "TextBox compat");
vfd= vfont_get_data(vfont);
vfd= vfont_get_data(bmain, vfont);
/* The VFont Data can not be found */
if(!vfd) {
@@ -792,7 +792,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
}
if (vfont != oldvfont) {
vfd= vfont_get_data(vfont);
vfd= vfont_get_data(bmain, vfont);
oldvfont = vfont;
}
@@ -1157,7 +1157,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode)
}
// We do not want to see any character for \n or \r
if(cha != '\n' && cha != '\r')
buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i);
buildchar(bmain, cu, cha, info, ct->xof, ct->yof, ct->rot, i);
if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) {
float ulwidth, uloverlap= 0.0f;

View File

@@ -182,7 +182,7 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd)
gpl->thickness = 3;
/* auto-name */
sprintf(gpl->info, "GP_Layer");
strcpy(gpl->info, "GP_Layer");
BLI_uniquename(&gpd->layers, gpl, "GP_Layer", '.', offsetof(bGPDlayer, info[0]), sizeof(gpl->info));
/* make this one the active one */

View File

@@ -1480,7 +1480,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
/* try to repack file */
if(ima->packedfile) {
PackedFile *pf;
pf = newPackedFile(NULL, ima->name);
pf = newPackedFile(NULL, ima->name, ID_BLEND_PATH(G.main, &ima->id));
if (pf) {
freePackedFile(ima->packedfile);
ima->packedfile = pf;
@@ -1653,10 +1653,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
BLI_stringdec(name, head, tail, &numlen);
BLI_stringenc(name, head, tail, numlen, frame);
if(ima->id.lib)
BLI_path_abs(name, ima->id.lib->filepath);
else
BLI_path_abs(name, G.main->name);
BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id));
flag= IB_rect|IB_multilayer;
if(ima->flag & IMA_DO_PREMUL)
@@ -1768,11 +1765,8 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
char str[FILE_MAX];
BLI_strncpy(str, ima->name, FILE_MAX);
if(ima->id.lib)
BLI_path_abs(str, ima->id.lib->filepath);
else
BLI_path_abs(str, G.main->name);
BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
/* FIXME: make several stream accessible in image editor, too*/
ima->anim = openanim(str, IB_rect, 0);
@@ -1834,10 +1828,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
/* get the right string */
BLI_strncpy(str, ima->name, sizeof(str));
if(ima->id.lib)
BLI_path_abs(str, ima->id.lib->filepath);
else
BLI_path_abs(str, G.main->name);
BLI_path_abs(str, ID_BLEND_PATH(G.main, &ima->id));
/* read ibuf */
ibuf = IMB_loadiffname(str, flag);
@@ -1860,7 +1851,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
/* make packed file for autopack */
if ((ima->packedfile == NULL) && (G.fileflags & G_AUTOPACK))
ima->packedfile = newPackedFile(NULL, str);
ima->packedfile = newPackedFile(NULL, str, ID_BLEND_PATH(G.main, &ima->id));
}
}
else

View File

@@ -952,9 +952,9 @@ static void get_flags_for_id(ID *id, char *buf)
isnode= ((Tex *)id)->use_nodes;
if (id->us<0)
sprintf(buf, "-1W ");
strcpy(buf, "-1W ");
else if (!id->lib && !isfake && id->us && !isnode)
sprintf(buf, " ");
strcpy(buf, " ");
else if(isnode)
sprintf(buf, "%c%cN%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' ');
else

View File

@@ -1284,16 +1284,16 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
if (strip->name[0]==0) {
switch (strip->type) {
case NLASTRIP_TYPE_CLIP: /* act-clip */
sprintf(strip->name, "%s", (strip->act)?(strip->act->id.name+2):("<No Action>"));
BLI_strncpy(strip->name, (strip->act)?(strip->act->id.name+2):("<No Action>"), sizeof(strip->name));
break;
case NLASTRIP_TYPE_TRANSITION: /* transition */
sprintf(strip->name, "Transition");
BLI_strncpy(strip->name, "Transition", sizeof(strip->name));
break;
case NLASTRIP_TYPE_META: /* meta */
sprintf(strip->name, "Meta");
BLI_strncpy(strip->name, "Meta", sizeof(strip->name));
break;
default:
sprintf(strip->name, "NLA Strip");
BLI_strncpy(strip->name, "NLA Strip", sizeof(strip->name));
break;
}
}

View File

@@ -168,7 +168,7 @@ PackedFile *newPackedFileMemory(void *mem, int memlen)
return pf;
}
PackedFile *newPackedFile(ReportList *reports, const char *filename)
PackedFile *newPackedFile(ReportList *reports, const char *filename, const char *basepath)
{
PackedFile *pf = NULL;
int file, filelen;
@@ -185,7 +185,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename)
// convert relative filenames to absolute filenames
strcpy(name, filename);
BLI_path_abs(name, G.main->name);
BLI_path_abs(name, basepath);
// open the file
// and create a PackedFile structure
@@ -224,7 +224,7 @@ void packAll(Main *bmain, ReportList *reports)
for(ima=bmain->image.first; ima; ima=ima->id.next) {
if(ima->packedfile == NULL && ima->id.lib==NULL) {
if(ima->source==IMA_SRC_FILE) {
ima->packedfile = newPackedFile(reports, ima->name);
ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
}
else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported.", ima->id.name+2);
@@ -234,11 +234,11 @@ void packAll(Main *bmain, ReportList *reports)
for(vf=bmain->vfont.first; vf; vf=vf->id.next)
if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0)
vf->packedfile = newPackedFile(reports, vf->name);
vf->packedfile = newPackedFile(reports, vf->name, bmain->name);
for(sound=bmain->sound.first; sound; sound=sound->id.next)
if(sound->packedfile == NULL && sound->id.lib==NULL)
sound->packedfile = newPackedFile(reports, sound->name);
sound->packedfile = newPackedFile(reports, sound->name, bmain->name);
}

View File

@@ -340,20 +340,13 @@ void sound_load(struct Main *bmain, struct bSound* sound)
#endif
{
char fullpath[FILE_MAX];
char *path;
/* load sound */
PackedFile* pf = sound->packedfile;
/* dont modify soundact->sound->name, only change a copy */
BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
if(sound->id.lib)
path = sound->id.lib->filepath;
else
path = bmain->name;
BLI_path_abs(fullpath, path);
BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
/* but we need a packed file then */
if (pf)

View File

@@ -109,7 +109,7 @@ void RegisterBlendExtension(void) {
lresult = RegCreateKeyEx(root, "blendfile", 0,
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, &dwd);
if (lresult == ERROR_SUCCESS) {
sprintf(buffer,"%s","Blender File");
strcpy(buffer,"Blender File");
lresult = RegSetValueEx(hkey, NULL, 0, REG_SZ, (BYTE*)buffer, strlen(buffer) + 1);
RegCloseKey(hkey);
}

View File

@@ -71,12 +71,12 @@ void ANIM_timecode_string_from_frame (char *str, Scene *scene, int power, short
if (timecodes) {
int hours=0, minutes=0, seconds=0, frames=0;
float raw_seconds= cfra;
char neg[2]= "";
char neg[2]= {'\0'};
/* get cframes */
if (cfra < 0) {
/* correction for negative cfraues */
sprintf(neg, "-");
neg[0]= '-';
cfra = -cfra;
}
if (cfra >= 3600) {

View File

@@ -63,9 +63,9 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
return icon;
else if ELEM3(NULL, id, fcu, fcu->rna_path) {
if (fcu == NULL)
sprintf(name, "<invalid>");
strcpy(name, "<invalid>");
else if (fcu->rna_path == NULL)
sprintf(name, "<no path>");
strcpy(name, "<no path>");
else /* id == NULL */
BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index);
}

View File

@@ -259,6 +259,7 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int recalc, int mode)
{
struct Main *bmain= CTX_data_main(C);
Curve *cu= obedit->data;
EditFont *ef= cu->editfont;
cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0];
@@ -269,7 +270,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
if(mode == FO_EDIT)
update_string(cu);
BKE_text_to_curve(scene, obedit, mode);
BKE_text_to_curve(bmain, scene, obedit, mode);
if(recalc)
DAG_id_tag_update(obedit->data, 0);
@@ -928,9 +929,10 @@ static int move_cursor(bContext *C, int type, int select)
if(select == 0) {
if(cu->selstart) {
struct Main *bmain= CTX_data_main(C);
cu->selstart = cu->selend = 0;
update_string(cu);
BKE_text_to_curve(scene, obedit, FO_SELCHANGE);
BKE_text_to_curve(bmain, scene, obedit, FO_SELCHANGE);
}
}
@@ -1644,13 +1646,14 @@ static int open_cancel(bContext *UNUSED(C), wmOperator *op)
static int open_exec(bContext *C, wmOperator *op)
{
struct Main *bmain= CTX_data_main(C);
VFont *font;
PropertyPointerRNA *pprop;
PointerRNA idptr;
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
font= load_vfont(filepath);
font= load_vfont(bmain, filepath);
if(!font) {
if(op->customdata) MEM_freeN(op->customdata);

View File

@@ -1318,12 +1318,12 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
}
/* mouse inside the widget */
else if (x >= startx) {
float aspect= (but->block->aspect);
const float aspect_sqrt= sqrtf(but->block->aspect);
but->pos= strlen(origstr)-but->ofs;
/* XXX does not take zoom level into account */
while (startx + aspect*BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) {
while (startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) {
if (but->pos <= 0) break;
but->pos--;
origstr[but->pos+but->ofs] = 0;
@@ -1379,133 +1379,115 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc
return changed;
}
static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump)
static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump, int jump_all)
{
char *str;
int len;
const char *str= data->str;
const int len= strlen(str);
const int pos_prev= but->pos;
const int has_sel= (but->selend - but->selsta) > 0;
str= data->str;
len= strlen(str);
if(direction) { /* right*/
/* if there's a selection */
if ((but->selend - but->selsta) > 0) {
/* extend the selection based on the first direction taken */
if(select) {
if (!data->selextend) {
data->selextend = EXTEND_RIGHT;
}
if (data->selextend == EXTEND_RIGHT) {
but->selend++;
if (but->selend > len) but->selend = len;
} else if (data->selextend == EXTEND_LEFT) {
but->selsta++;
/* if the selection start has gone past the end,
* flip them so they're in sync again */
if (but->selsta == but->selend) {
but->pos = but->selsta;
data->selextend = EXTEND_RIGHT;
}
}
} else {
/* special case, quit selection and set cursor */
if (has_sel && !select) {
if (jump_all) {
but->selsta = but->selend= but->pos = direction ? len : 0;
}
else {
if (direction) {
but->selsta = but->pos = but->selend;
data->selextend = 0;
}
} else {
if(select) {
/* make a selection, starting from the cursor position */
int tlen;
but->selsta = but->pos;
but->pos++;
if(but->pos > (tlen= strlen(str))) but->pos= tlen;
but->selend = but->pos;
} else if(jump) {
/* jump betweenn special characters (/,\,_,-, etc.),
else {
but->pos = but->selend = but->selsta;
}
}
data->selextend = 0;
}
else {
if(direction) { /* right*/
if(jump) {
/* jump between special characters (/,\,_,-, etc.),
* look at function test_special_char() for complete
* list of special character, ctr -> */
while(but->pos < len) {
but->pos++;
if(test_special_char(str[but->pos])) break;
if(!jump_all && test_special_char(str[but->pos])) break;
}
} else {
int tlen;
}
else {
but->pos++;
if(but->pos > (tlen= strlen(str))) but->pos= tlen;
if(but->pos > len) but->pos= len;
}
}
}
else { /* left */
/* if there's a selection */
if ((but->selend - but->selsta) > 0) {
/* extend the selection based on the first direction taken */
if(select) {
if (!data->selextend) {
data->selextend = EXTEND_LEFT;
else { /* left */
if(jump) {
/* left only: compensate for index/change in direction */
if(but->pos > 0) {
but->pos--;
}
if (data->selextend == EXTEND_LEFT) {
but->selsta--;
if (but->selsta < 0) but->selsta = 0;
} else if (data->selextend == EXTEND_RIGHT) {
but->selend--;
/* if the selection start has gone past the end,
* flip them so they're in sync again */
if (but->selsta == but->selend) {
but->pos = but->selsta;
data->selextend = EXTEND_LEFT;
}
}
} else {
but->pos = but->selend = but->selsta;
data->selextend = 0;
}
} else {
if(select) {
/* make a selection, starting from the cursor position */
but->selend = but->pos;
but->pos--;
if(but->pos<0) but->pos= 0;
but->selsta = but->pos;
} else if(jump) {
/* jump betweenn special characters (/,\,_,-, etc.),
/* jump between special characters (/,\,_,-, etc.),
* look at function test_special_char() for complete
* list of special character, ctr -> */
while(but->pos > 0){
but->pos--;
if(test_special_char(str[but->pos])) break;
if(!jump_all && test_special_char(str[but->pos])) break;
}
} else {
/* left only: compensate for index/change in direction */
if((but->pos != 0) && ABS(pos_prev - but->pos) > 1) {
but->pos++;
}
}
else {
if(but->pos>0) but->pos--;
}
}
}
}
static void ui_textedit_move_end(uiBut *but, uiHandleButtonData *data, int direction, int select)
{
char *str;
str= data->str;
if(direction) { /* right */
if(select) {
but->selsta = but->pos;
but->selend = strlen(str);
data->selextend = EXTEND_RIGHT;
} else {
but->selsta = but->selend = but->pos= strlen(str);
}
}
else { /* left */
if(select) {
but->selend = but->pos;
but->selsta = 0;
data->selextend = EXTEND_LEFT;
} else {
but->selsta = but->selend = but->pos= 0;
/* existing selection */
if (has_sel) {
if(data->selextend == 0) {
data->selextend= EXTEND_RIGHT;
}
if (direction) {
if (data->selextend == EXTEND_RIGHT) {
but->selend= but->pos;
}
else {
but->selsta= but->pos;
}
}
else {
if (data->selextend == EXTEND_LEFT) {
but->selsta= but->pos;
}
else {
but->selend= but->pos;
}
}
if (but->selend < but->selsta) {
SWAP(short, but->selsta, but->selend);
data->selextend= (data->selextend == EXTEND_RIGHT) ? EXTEND_LEFT : EXTEND_RIGHT;
}
} /* new selection */
else {
if (direction) {
data->selextend= EXTEND_RIGHT;
but->selend= but->pos;
but->selsta= pos_prev;
}
else {
data->selextend= EXTEND_LEFT;
but->selend= pos_prev;
but->selsta= but->pos;
}
}
}
}
}
@@ -1842,11 +1824,11 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
break;
case RIGHTARROWKEY:
ui_textedit_move(but, data, 1, event->shift, event->ctrl);
ui_textedit_move(but, data, 1, event->shift, event->ctrl, FALSE);
retval= WM_UI_HANDLER_BREAK;
break;
case LEFTARROWKEY:
ui_textedit_move(but, data, 0, event->shift, event->ctrl);
ui_textedit_move(but, data, 0, event->shift, event->ctrl, FALSE);
retval= WM_UI_HANDLER_BREAK;
break;
case DOWNARROWKEY:
@@ -1856,7 +1838,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* pass on purposedly */
case ENDKEY:
ui_textedit_move_end(but, data, 1, event->shift);
ui_textedit_move(but, data, 1, event->shift, TRUE, TRUE);
retval= WM_UI_HANDLER_BREAK;
break;
case UPARROWKEY:
@@ -1866,7 +1848,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
}
/* pass on purposedly */
case HOMEKEY:
ui_textedit_move_end(but, data, 0, event->shift);
ui_textedit_move(but, data, 0, event->shift, TRUE, TRUE);
retval= WM_UI_HANDLER_BREAK;
break;
case PADENTER:

View File

@@ -1221,7 +1221,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
cu1->vfontbi= cu->vfontbi;
id_us_plus((ID *)cu1->vfontbi);
BKE_text_to_curve(scene, base->object, 0); /* needed? */
BKE_text_to_curve(bmain, scene, base->object, 0); /* needed? */
BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family));

View File

@@ -519,6 +519,7 @@ static int sound_poll(bContext *C)
static int pack_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Editing* ed = CTX_data_scene(C)->ed;
bSound* sound;
@@ -530,7 +531,7 @@ static int pack_exec(bContext *C, wmOperator *op)
if(!sound || sound->packedfile)
return OPERATOR_CANCELLED;
sound->packedfile= newPackedFile(op->reports, sound->name);
sound->packedfile= newPackedFile(op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
sound_load(CTX_data_main(C), sound);
return OPERATOR_FINISHED;

View File

@@ -1567,6 +1567,7 @@ static int pack_test(bContext *C, wmOperator *op)
static int pack_exec(bContext *C, wmOperator *op)
{
struct Main *bmain= CTX_data_main(C);
Image *ima= CTX_data_edit_image(C);
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
int as_png= RNA_boolean_get(op->ptr, "as_png");
@@ -1582,7 +1583,7 @@ static int pack_exec(bContext *C, wmOperator *op)
if(as_png)
BKE_image_memorypack(ima);
else
ima->packedfile= newPackedFile(op->reports, ima->name);
ima->packedfile= newPackedFile(op->reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);

View File

@@ -1989,7 +1989,7 @@ void VIEW3D_OT_select_border(wmOperatorType *ot)
/* much like facesel_face_pick()*/
/* returns 0 if not found, otherwise 1 */
static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, short rect)
static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, int size)
{
ViewContext vc;
view3d_set_viewcontext(C, &vc);
@@ -1997,12 +1997,12 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un
if (!me || me->totvert==0)
return 0;
if (rect) {
if (size > 0) {
/* sample rect to increase changes of selecting, so that when clicking
on an face in the backbuf, we can still select a vert */
int dist;
*index = view3d_sample_backbuf_rect(&vc, mval, 3, 1, me->totvert+1, &dist,0,NULL, NULL);
*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert+1, &dist,0,NULL, NULL);
}
else {
/* sample only on the exact position */
@@ -2024,7 +2024,8 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
Mesh* me= obact->data; /* already checked for NULL */
unsigned int index = 0;
MVert *mv;
if(vertsel_vert_pick(C, me, mval, &index, 1)) {
if(vertsel_vert_pick(C, me, mval, &index, 50)) {
mv = me->mvert+index;
if(extend) {
mv->flag ^= SELECT;

View File

@@ -171,7 +171,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
pup= uiPupMenuBegin(C, "Unpack file", ICON_NONE);
layout= uiPupMenuLayout(pup);
sprintf(line, "Remove Pack");
strcpy(line, "Remove Pack");
props_ptr= uiItemFullO(layout, opname, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&props_ptr, "method", PF_REMOVE);
RNA_string_set(&props_ptr, "id", id_name);

View File

@@ -207,6 +207,8 @@ typedef struct PreviewImage {
#define ID_CHECK_UNDO(id) ((GS((id)->name) != ID_SCR) && (GS((id)->name) != ID_WM))
#define ID_BLEND_PATH(_bmain, _id) ((_id)->lib ? (_id)->lib->filepath : (_bmain)->name)
#ifdef GS
#undef GS
#endif

View File

@@ -141,12 +141,12 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
psys->part= part;
psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
psys->flag |= PSYS_ENABLED;
sprintf(psys->name, "FluidParticles");
BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
BLI_addtail(&ob->particlesystem,psys);
/* add modifier */
psmd= (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem);
sprintf(psmd->modifier.name, "FluidParticleSystem" );
BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name));
psmd->psys= psys;
BLI_addtail(&ob->modifiers, psmd);
modifier_unique_name(&ob->modifiers, (ModifierData *)psmd);

View File

@@ -142,7 +142,7 @@ static void rna_Image_pack(Image *image, ReportList *reports, int as_png)
BKE_image_memorypack(image);
}
else {
image->packedfile= newPackedFile(reports, image->name);
image->packedfile= newPackedFile(reports, image->name, ID_BLEND_PATH(G.main, &image->id));
}
}
}

View File

@@ -346,12 +346,12 @@ void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall
mb->id.name+2, ID_REAL_USERS(mb));
}
VFont *rna_Main_fonts_load(Main *UNUSED(bmain), ReportList *reports, const char *filepath)
VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath)
{
VFont *font;
errno= 0;
font= load_vfont(filepath);
font= load_vfont(bmain, filepath);
if(!font)
BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,

View File

@@ -275,7 +275,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
part->end = 250.0f;
part->ren_as = PART_DRAW_NOT;
part->draw_as = PART_DRAW_DOT;
sprintf(psys->name, "SmokeParticles");
BLI_strncpy(psys->name, "SmokeParticles", sizeof(psys->name));
psys->recalc |= (PSYS_RECALC_RESET|PSYS_RECALC_PHYS);
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
}

View File

@@ -506,6 +506,13 @@ static int rna_Property_readonly_get(PointerRNA *ptr)
return prop->flag & PROP_EDITABLE ? 0:1;
}
static int rna_Property_animatable_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
return (prop->flag & PROP_ANIMATABLE) != 0;
}
static int rna_Property_use_output_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -1066,6 +1073,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
prop= RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", NULL);
RNA_def_property_ui_text(prop, "Animatable", "Property is animatable through RNA");
prop= RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);

View File

@@ -93,7 +93,7 @@ void bpy_import_main_set(struct Main *maggie)
/* returns a dummy filename for a textblock so we can tell what file a text block comes from */
void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
{
BLI_snprintf(fn, fn_len, "%s%c%s", text->id.lib ? text->id.lib->filepath : bpy_import_main->name, SEP, text->id.name+2);
BLI_snprintf(fn, fn_len, "%s%c%s", ID_BLEND_PATH(bpy_import_main, &text->id), SEP, text->id.name+2);
}
PyObject *bpy_text_import(Text *text)

View File

@@ -84,6 +84,11 @@
static PyObject* pyrna_struct_Subtype(PointerRNA *ptr);
static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self);
#define BPY_DOC_ID_PROP_TYPE_NOTE \
" .. note:: Only :class:`bpy.types.ID`, :class:`bpy.types.Bone` and \n" \
" :class:`bpy.types.PoseBone` classes support custom properties.\n"
int pyrna_struct_validity_check(BPy_StructRNA *pysrna)
{
if(pysrna->ptr.type)
@@ -2746,8 +2751,7 @@ PyDoc_STRVAR(pyrna_struct_keys_doc,
" :return: custom property keys.\n"
" :rtype: list of strings\n"
"\n"
" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone` classes\n"
" support custom properties.\n"
BPY_DOC_ID_PROP_TYPE_NOTE
);
static PyObject *pyrna_struct_keys(BPy_PropertyRNA *self)
{
@@ -2775,8 +2779,7 @@ PyDoc_STRVAR(pyrna_struct_items_doc,
" :return: custom property key, value pairs.\n"
" :rtype: list of key, value tuples\n"
"\n"
" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
" classes support custom properties.\n"
BPY_DOC_ID_PROP_TYPE_NOTE
);
static PyObject *pyrna_struct_items(BPy_PropertyRNA *self)
{
@@ -2804,8 +2807,7 @@ PyDoc_STRVAR(pyrna_struct_values_doc,
" :return: custom property values.\n"
" :rtype: list\n"
"\n"
" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
" classes support custom properties.\n"
BPY_DOC_ID_PROP_TYPE_NOTE
);
static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
{
@@ -3655,18 +3657,28 @@ static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
Py_RETURN_NONE;
}
static PyObject *pyrna_struct_get_rna_type(BPy_PropertyRNA *self)
{
PointerRNA tptr;
RNA_pointer_create(NULL, &RNA_Property, self->prop, &tptr);
return pyrna_struct_Subtype(&tptr);
}
/*****************************************************************************/
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef pyrna_prop_getseters[]= {
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL},
{(char *)"rna_type", (getter)pyrna_struct_get_rna_type, (setter)NULL, (char *)"The property type for introspection", NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef pyrna_struct_getseters[]= {
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
{(char *)"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, (char *)"The :class:`bpy.types.ID` object this datablock is from or None, (not available for all data types)", NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -3773,8 +3785,7 @@ PyDoc_STRVAR(pyrna_struct_get_doc,
" *key* is not found.\n"
" :type default: Undefined\n"
"\n"
" .. note:: Only :class:`ID`, :class:`Bone` and :class:`PoseBone`\n"
" classes support custom properties.\n"
BPY_DOC_ID_PROP_TYPE_NOTE
);
static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
{

View File

@@ -273,7 +273,7 @@ char pyrna_struct_driver_add_doc[] =
" :arg index: array index of the property drive. Defaults to -1 for all indices or a single channel if the property is not an array.\n"
" :type index: int\n"
" :return: The driver(s) added.\n"
" :rtype: :class:`FCurve` or list if index is -1 with an array property.\n"
" :rtype: :class:`bpy.types.FCurve` or list if index is -1 with an array property.\n"
;
PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
{

View File

@@ -587,12 +587,12 @@ elseif(WIN32)
FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
DESTINATION ${TARGETDIR}
)
else()
install(
FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
DESTINATION ${TARGETDIR}
)
endif()
install( # x86 builds can run on x64 Windows, so this is required at all times
FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
DESTINATION ${TARGETDIR}
)
elseif(APPLE)
set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)

View File

@@ -110,9 +110,9 @@ KX_GameObject::KX_GameObject(
m_pGraphicController(NULL),
m_xray(false),
m_pHitObject(NULL),
m_pObstacleSimulation(NULL),
m_actionManager(NULL),
m_isDeformable(false),
m_pObstacleSimulation(NULL)
m_isDeformable(false)
#ifdef WITH_PYTHON
, m_attr_dict(NULL)
#endif

View File

@@ -633,7 +633,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM
const float ivmax = 1.0f / vmax;
float adir[2], adist;
float adir[2] /*, adist */;
vcpy(adir, activeObst->pvel);
if (vlen(adir) > 0.01f)
vnorm(adir);
@@ -641,7 +641,7 @@ static void processSamples(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavM
vset(adir,0,0);
float activeObstPos[2];
vset(activeObstPos, activeObst->m_pos.x(), activeObst->m_pos.y());
adist = vdot(adir, activeObstPos);
/* adist = vdot(adir, activeObstPos); */
float minPenalty = FLT_MAX;

View File

@@ -46,38 +46,38 @@
/* ------------------------------------------------------------------------- */
KX_SteeringActuator::KX_SteeringActuator(SCA_IObject *gameobj,
int mode,
KX_GameObject *target,
KX_GameObject *navmesh,
float distance,
float velocity,
float acceleration,
float turnspeed,
bool isSelfTerminated,
int pathUpdatePeriod,
KX_ObstacleSimulation* simulation,
short facingmode,
bool normalup,
bool enableVisualization) :
SCA_IActuator(gameobj, KX_ACT_STEERING),
m_mode(mode),
m_target(target),
m_distance(distance),
m_velocity(velocity),
m_acceleration(acceleration),
m_turnspeed(turnspeed),
m_isSelfTerminated(isSelfTerminated),
m_pathUpdatePeriod(pathUpdatePeriod),
m_updateTime(0),
m_isActive(false),
m_simulation(simulation),
m_enableVisualization(enableVisualization),
m_facingMode(facingmode),
m_normalUp(normalup),
m_obstacle(NULL),
m_pathLen(0),
m_wayPointIdx(-1),
m_steerVec(MT_Vector3(0, 0, 0))
int mode,
KX_GameObject *target,
KX_GameObject *navmesh,
float distance,
float velocity,
float acceleration,
float turnspeed,
bool isSelfTerminated,
int pathUpdatePeriod,
KX_ObstacleSimulation* simulation,
short facingmode,
bool normalup,
bool enableVisualization)
: SCA_IActuator(gameobj, KX_ACT_STEERING),
m_target(target),
m_mode(mode),
m_distance(distance),
m_velocity(velocity),
m_acceleration(acceleration),
m_turnspeed(turnspeed),
m_simulation(simulation),
m_updateTime(0),
m_obstacle(NULL),
m_isActive(false),
m_isSelfTerminated(isSelfTerminated),
m_enableVisualization(enableVisualization),
m_facingMode(facingmode),
m_normalUp(normalup),
m_pathLen(0),
m_pathUpdatePeriod(pathUpdatePeriod),
m_wayPointIdx(-1),
m_steerVec(MT_Vector3(0, 0, 0))
{
m_navmesh = static_cast<KX_NavMeshObject*>(navmesh);
if (m_navmesh)

View File

@@ -56,12 +56,12 @@ class KX_SteeringActuator : public SCA_IActuator
int m_mode;
float m_distance;
float m_velocity;
float m_acceleration;
float m_acceleration;
float m_turnspeed;
KX_ObstacleSimulation* m_simulation;
KX_Obstacle* m_obstacle;
double m_updateTime;
KX_Obstacle* m_obstacle;
bool m_isActive;
bool m_isSelfTerminated;
bool m_enableVisualization;