diff options
Diffstat (limited to 'source/blender')
56 files changed, 432 insertions, 208 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 851c6542de0..5161761cf09 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -217,7 +217,7 @@ void blf_font_buffer(FontBLF *font, const char *str) unsigned int i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; - /* buffer spesific vars*/ + /* buffer specific vars*/ const unsigned char b_col_char[4]= {font->b_col[0] * 255, font->b_col[1] * 255, font->b_col[2] * 255, diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 733ff3f357a..8a871b9ecf5 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -84,7 +84,7 @@ typedef struct SculptSession { int modifiers_active; /* object is deformed with some modifiers */ float (*orig_cos)[3]; /* coords of undeformed mesh */ float (*deform_cos)[3]; /* coords of deformed mesh but without stroke displacement */ - float (*deform_imats)[3][3]; /* crazyspace deformation matricies */ + float (*deform_imats)[3][3]; /* crazyspace deformation matrices */ /* Partial redraw */ int partial_redraw; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 96d603875e4..89579affa99 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1427,6 +1427,16 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p VECCOPY(vec, obmat[3]); obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f; + + /* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */ + if((part->draw & PART_DRAW_ROTATE_OB) == 0) { + float xvec[3], q[4]; + xvec[0] = -1.f; + xvec[1] = xvec[2] = 0; + vec_to_quat(q, xvec, ob->trackflag, ob->upflag); + quat_to_mat4(obmat, q); + obmat[3][3]= 1.0f; + } /* Normal particles and cached hair live in global space so we need to * remove the real emitter's transformation before 2nd order duplication. @@ -1445,7 +1455,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p copy_m4_m4(mat, tmat); if(part->draw & PART_DRAW_GLOBAL_OB) - VECADD(mat[3], mat[3], vec); + add_v3_v3v3(mat[3], mat[3], vec); dob= new_dupli_object(lb, ob, mat, ob->lay, counter, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, animated); copy_m4_m4(dob->omat, oldobmat); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 5c39fbfb9bb..e6c0e55d350 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1067,7 +1067,7 @@ static void trackto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta cob->matrix[2][2]=size[2]; /* targetmat[2] instead of ownermat[2] is passed to vectomat - * for backwards compatability it seems... (Aligorith) + * for backwards compatibility it seems... (Aligorith) */ sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]); vectomat(vec, ct->matrix[2], @@ -2104,7 +2104,7 @@ static void actcon_new_data (void *cdata) { bActionConstraint *data= (bActionConstraint *)cdata; - /* set type to 20 (Loc X), as 0 is Rot X for backwards compatability */ + /* set type to 20 (Loc X), as 0 is Rot X for backwards compatibility */ data->type = 20; } @@ -2161,7 +2161,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail); /* determine where in transform range target is */ - /* data->type is mapped as follows for backwards compatability: + /* data->type is mapped as follows for backwards compatibility: * 00,01,02 - rotation (it used to be like this) * 10,11,12 - scaling * 20,21,22 - location @@ -4351,7 +4351,7 @@ short proxylocked_constraints_owner (Object *ob, bPoseChannel *pchan) * constraints either had one or no targets. It used to be called during the main constraint solving * loop, but is now only used for the remaining cases for a few constraints. * - * None of the actual calculations of the matricies should be done here! Also, this function is + * None of the actual calculations of the matrices should be done here! Also, this function is * not to be used by any new constraints, particularly any that have multiple targets. */ void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime) diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 91f3c7a22ba..609f6cd38f1 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1034,12 +1034,14 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* first bone target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name)); /* second bone target (name was stored in same var as the first one) */ dtar= &dvar->targets[1]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) // xxx... for safety BLI_strncpy(dtar->pchan_name, idriver->name+DRIVER_NAME_OFFS, sizeof(dtar->pchan_name)); } @@ -1051,6 +1053,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* only requires a single target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name)); dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode); @@ -1065,6 +1068,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* only requires single target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode); } } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index c6f526415c8..e8b76c214dc 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4386,33 +4386,50 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0); else psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0); - - copy_m3_m4(nmat, ob->imat); - transpose_m3(nmat); - mul_m3_v3(nmat, nor); - normalize_v3(nor); - - /* make sure that we get a proper side vector */ - if(fabs(dot_v3v3(nor,vec))>0.999999) { - if(fabs(dot_v3v3(nor,xvec))>0.999999) { - nor[0] = 0.0f; - nor[1] = 1.0f; - nor[2] = 0.0f; + + if(psys->part->rotmode == PART_ROT_VEL) { + copy_m3_m4(nmat, ob->imat); + transpose_m3(nmat); + mul_m3_v3(nmat, nor); + normalize_v3(nor); + + /* make sure that we get a proper side vector */ + if(fabs(dot_v3v3(nor,vec))>0.999999) { + if(fabs(dot_v3v3(nor,xvec))>0.999999) { + nor[0] = 0.0f; + nor[1] = 1.0f; + nor[2] = 0.0f; + } + else { + nor[0] = 1.0f; + nor[1] = 0.0f; + nor[2] = 0.0f; + } } - else { - nor[0] = 1.0f; - nor[1] = 0.0f; - nor[2] = 0.0f; + cross_v3_v3v3(side, nor, vec); + normalize_v3(side); + + /* rotate side vector around vec */ + if(psys->part->phasefac != 0) { + float q_phase[4]; + float phasefac = psys->part->phasefac; + if(psys->part->randphasefac != 0.0f) + phasefac += psys->part->randphasefac * PSYS_FRAND((pa-psys->particles) + 20); + axis_angle_to_quat( q_phase, vec, phasefac*(float)M_PI); + + mul_qt_v3(q_phase, side); } - } - cross_v3_v3v3(side, nor, vec); - normalize_v3(side); - cross_v3_v3v3(nor, vec, side); - unit_m4(mat); - VECCOPY(mat[0], vec); - VECCOPY(mat[1], side); - VECCOPY(mat[2], nor); + cross_v3_v3v3(nor, vec, side); + + unit_m4(mat); + VECCOPY(mat[0], vec); + VECCOPY(mat[1], side); + VECCOPY(mat[2], nor); + } + else { + quat_to_mat4(mat, pa->state.rot); + } *scale= len; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 6a2cef41262..54af061dedb 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1607,8 +1607,8 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P } - /* -velocity */ - if(part->randfac != 0.0f){ + /* -velocity (boids need this even if there's no random velocity) */ + if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)){ r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f); r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f); r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index fb69db17b97..bc5bc87b1fa 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -910,7 +910,7 @@ static int ptcache_path(PTCacheID *pid, char *filename) else if (G.relbase_valid || lib) { char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */ - BLI_split_dirfile(blendfilename, NULL, file); + BLI_split_dirfile(blendfilename, NULL, file, 0, sizeof(file)); i = strlen(file); /* remove .blend */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 5a2c53f5b9b..00534400cf1 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3647,7 +3647,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo /* we only need 1 element to store the filename */ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); - BLI_split_dirfile(seq_load->path, strip->dir, se->name); + BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + strip->len, 0); @@ -3706,7 +3706,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo /* we only need 1 element for MOVIE strips */ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); - BLI_split_dirfile(seq_load->path, strip->dir, se->name); + BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); calc_sequence_disp(scene, seq); diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 81fc8a50db6..4f7f7b482b5 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -103,7 +103,7 @@ void BLI_setenv_if_new(const char *env, const char* val); void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file); void BLI_make_exist(char *dir); void BLI_make_existing_file(const char *name); -void BLI_split_dirfile(const char *string, char *dir, char *file); +void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen); void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file); char *BLI_path_basename(char *path); int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir); diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index c53ce9dced5..3ac8dba106a 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -147,6 +147,10 @@ void BLI_ascii_strtoupper(char *str, int len); char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); int BLI_utf8_invalid_byte(const char *str, int length); int BLI_utf8_invalid_strip(char *str, int length); + /* copied from glib */ +char *BLI_str_find_prev_char_utf8(const char *str, const char *p); +char *BLI_str_find_next_char_utf8(const char *p, const char *end); +char *BLI_str_prev_char_utf8(const char *p); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 485b8137a02..4e4f8b3cade 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -400,7 +400,7 @@ static void seq_setpath(struct BPathIterator *bpi, const char *path) if (SEQ_HAS_PATH(seq)) { if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) { - BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); + BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } else { /* simple case */ @@ -903,7 +903,7 @@ void findMissingFiles(Main *bmain, const char *str) //XXX waitcursor( 1 ); - BLI_split_dirfile(str, dirname, NULL); + BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0); BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 1c71f1e1f27..e3b7b8198b6 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -895,7 +895,7 @@ static int get_path_local(char *targetpath, const char *folder_name, const char } /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL); + BLI_split_dirfile(bprogname, bprogdir, NULL, sizeof(bprogdir), 0); /* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */ if(test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder)) @@ -967,7 +967,7 @@ static int get_path_system(char *targetpath, const char *folder_name, const char char bprogdir[FILE_MAX]; /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL); + BLI_split_dirfile(bprogname, bprogdir, NULL, sizeof(bprogdir), 0); if(folder_name) { if (subfolder_name) { @@ -1412,21 +1412,22 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext) * - dosnt use CWD, or deal with relative paths. * - Only fill's in *dir and *file when they are non NULL * */ -void BLI_split_dirfile(const char *string, char *dir, char *file) +void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen) { char *lslash_str = BLI_last_slash(string); - int lslash= lslash_str ? (int)(lslash_str - string) + 1 : 0; + size_t lslash= lslash_str ? (size_t)(lslash_str - string) + 1 : 0; if (dir) { if (lslash) { - BLI_strncpy( dir, string, lslash + 1); /* +1 to include the slash and the last char */ - } else { + BLI_strncpy( dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */ + } + else { dir[0] = '\0'; } } if (file) { - strcpy( file, string+lslash); + BLI_strncpy(file, string+lslash, filelen); } } @@ -1516,7 +1517,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const if (rel) rel[0]= 0; - BLI_split_dirfile(base_dir, blend_dir, NULL); + BLI_split_dirfile(base_dir, blend_dir, NULL, sizeof(blend_dir), 0); if (src_dir[0]=='\0') return 0; @@ -1527,7 +1528,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const BLI_path_abs(path, base_dir); /* get the directory part */ - BLI_split_dirfile(path, dir, base); + BLI_split_dirfile(path, dir, base, sizeof(dir), sizeof(base)); len= strlen(blend_dir); diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 961a41690f7..dc6cb0ef228 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -183,3 +183,83 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) return dst_r; } +/* copied from glib */ +/** + * g_utf8_find_prev_char: + * @str: pointer to the beginning of a UTF-8 encoded string + * @p: pointer to some position within @str + * + * Given a position @p with a UTF-8 encoded string @str, find the start + * of the previous UTF-8 character starting before @p. Returns %NULL if no + * UTF-8 characters are present in @str before @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. + * + * Return value: a pointer to the found character or %NULL. + **/ +char * BLI_str_find_prev_char_utf8(const char *str, const char *p) +{ + for (--p; p >= str; --p) { + if ((*p & 0xc0) != 0x80) { + return (char *)p; + } + } + return NULL; +} + +/** + * g_utf8_find_next_char: + * @p: a pointer to a position within a UTF-8 encoded string + * @end: a pointer to the byte following the end of the string, + * or %NULL to indicate that the string is nul-terminated. + * + * Finds the start of the next UTF-8 character in the string after @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. + * + * Return value: a pointer to the found character or %NULL + **/ +char *BLI_str_find_next_char_utf8(const char *p, const char *end) +{ + if (*p) { + if (end) { + for (++p; p < end && (*p & 0xc0) == 0x80; ++p) { + /* do nothing */ + } + } + else { + for (++p; (*p & 0xc0) == 0x80; ++p) { + /* do nothing */ + } + } + } + return (p == end) ? NULL : (char *)p; +} + +/** + * g_utf8_prev_char: + * @p: a pointer to a position within a UTF-8 encoded string + * + * Finds the previous UTF-8 character in the string before @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. If @p might be the first + * character of the string, you must use g_utf8_find_prev_char() instead. + * + * Return value: a pointer to the found character. + **/ +char *BLI_str_prev_char_utf8(const char *p) +{ + while (1) { + p--; + if ((*p & 0xc0) != 0x80) { + return (char *)p; + } + } +} +/* end glib copy */ diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 3b14abb0bee..9594197ef90 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -53,11 +53,10 @@ int BLI_getInstallationDir( char * str ) { char dir[FILE_MAXDIR]; - char file[FILE_MAXFILE]; int a; GetModuleFileName(NULL,str,FILE_MAXDIR+FILE_MAXFILE); - BLI_split_dirfile(str,dir,file); /* shouldn't be relative */ + BLI_split_dirfile(str, dir, NULL, sizeof(dir), 0); /* shouldn't be relative */ a = strlen(dir); if(dir[a-1] == '\\') dir[a-1]=0; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 47931477728..e7be98d955d 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -204,7 +204,7 @@ BLO_blendhandle_close( #define GROUP_MAX 32 -int BLO_has_bfile_extension(char *str); +int BLO_has_bfile_extension(const char *str); /* return ok when a blenderfile, in dir is the filename, * in group the type of libdata diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d52856a27cb..4441bf46c03 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1050,7 +1050,7 @@ void blo_freefiledata(FileData *fd) /* ************ DIV ****************** */ -int BLO_has_bfile_extension(char *str) +int BLO_has_bfile_extension(const char *str) { return (BLI_testextensie(str, ".ble") || BLI_testextensie(str, ".blend") || BLI_testextensie(str, ".blend.gz")); } @@ -12242,6 +12242,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) do_versions_nodetree_image_default_alpha_output(ntree); } + + { + /* support old particle dupliobject rotation settings */ + ParticleSettings *part; + + for (part=main->particle.first; part; part=part->id.next) { + if(ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { + part->draw |= PART_DRAW_ROTATE_OB; + + if(part->rotmode == 0) + part->rotmode = PART_ROT_VEL; + } + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 18e7c0f2fa7..181b2e3dd26 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2681,8 +2681,8 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL if(write_flags & G_FILE_RELATIVE_REMAP) { char dir1[FILE_MAXDIR+FILE_MAXFILE]; char dir2[FILE_MAXDIR+FILE_MAXFILE]; - BLI_split_dirfile(filepath, dir1, NULL); - BLI_split_dirfile(mainvar->name, dir2, NULL); + BLI_split_dirfile(filepath, dir1, NULL, sizeof(dir1), 0); + BLI_split_dirfile(mainvar->name, dir2, NULL, sizeof(dir2), 0); /* just incase there is some subtle difference */ BLI_cleanup_dir(mainvar->name, dir1); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index e98f551a097..056d74aabfb 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -884,7 +884,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) char dir[FILE_MAX]; char full_path[FILE_MAX]; - BLI_split_dirfile(filename, dir, NULL); + BLI_split_dirfile(filename, dir, NULL, sizeof(dir), 0); BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str()); Image *ima = BKE_add_image_file(full_path); if (!ima) { diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 747f3c783d7..53c43677c18 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -97,7 +97,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob) char src[FILE_MAX]; char dir[FILE_MAX]; - BLI_split_dirfile(this->export_settings->filepath, dir, NULL); + BLI_split_dirfile(this->export_settings->filepath, dir, NULL, sizeof(dir), 0); BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir); diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index c982a1d7f86..fe6aed77462 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -361,7 +361,8 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) _doSubChannels=2; \ else {\ filter_mode |= ANIMFILTER_TMP_PEEK; \ - } + } \ + (void) _doSubChannels; /* ... standard sub-channel filtering can go on here now ... */ #define END_ANIMFILTER_SUBCHANNELS \ filter_mode = _filter; \ diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 937d24eed04..b6398c6a2f5 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -259,7 +259,7 @@ void duplicate_gplayer_frames (bGPDlayer *gpl) /* Copy and Paste Tools */ /* - The copy/paste buffer currently stores a set of GP_Layers, with temporary * GP_Frames with the necessary strokes - * - Unless there is only one element in the buffer, names are also tested to check for compatability. + * - Unless there is only one element in the buffer, names are also tested to check for compatibility. * - All pasted frames are offset by the same amount. This is calculated as the difference in the times of * the current frame and the 'first keyframe' (i.e. the earliest one in all channels). * - The earliest frame is calculated per copy operation. diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 1eedd7ec782..df4113ca07a 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -106,7 +106,7 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile); void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile); -int ED_file_extension_icon(char *relname); +int ED_file_extension_icon(const char *relname); #endif /* ED_FILES_H */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a816c1612a1..b6c72c2e96f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -575,7 +575,7 @@ static void ui_draw_links(uiBlock *block) /* NOTE: if but->poin is allocated memory for every defbut, things fail... */ static int ui_but_equals_old(uiBut *but, uiBut *oldbut) { - /* various properties are being compared here, hopfully sufficient + /* various properties are being compared here, hopefully sufficient * to catch all cases, but it is simple to add more checks later */ if(but->retval != oldbut->retval) return 0; if(but->rnapoin.data != oldbut->rnapoin.data) return 0; @@ -640,7 +640,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut // but->flag= oldbut->flag; #else /* exception! redalert flag can't be update from old button. - * perhaps it should only copy spesific flags rather than all. */ + * perhaps it should only copy specific flags rather than all. */ // but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT); #endif // but->active= oldbut->active; @@ -748,7 +748,7 @@ static int ui_but_is_rna_undo(uiBut *but) if(but->rnapoin.id.data) { /* avoid undo push for buttons who's ID are screen or wm level * we could disable undo for buttons with no ID too but may have - * unforseen conciquences, so best check for ID's we _know_ are not + * unforeseen consequences, so best check for ID's we _know_ are not * handled by undo - campbell */ ID *id= but->rnapoin.id.data; if(ID_CHECK_UNDO(id) == FALSE) { @@ -865,7 +865,7 @@ void uiEndBlock(const bContext *C, uiBlock *block) /* inherit flags from 'old' buttons that was drawn here previous, based * on matching buttons, we need this to make button event handling non - * blocking, while still alowing buttons to be remade each redraw as it + * blocking, while still allowing buttons to be remade each redraw as it * is expected by blender code */ for(but=block->buttons.first; but; but=but->next) { if(ui_but_update_from_old_block(C, block, &but)) @@ -1211,7 +1211,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but) * an edit override pointer while dragging for example */ /* for buttons pointing to color for example */ -void ui_get_but_vectorf(uiBut *but, float *vec) +void ui_get_but_vectorf(uiBut *but, float vec[3]) { PropertyRNA *prop; int a, tot; @@ -1249,27 +1249,34 @@ void ui_get_but_vectorf(uiBut *but, float *vec) vec[0]= vec[1]= vec[2]= 0.0f; } } + + if (but->type == BUT_NORMAL) { + normalize_v3(vec); + } } /* for buttons pointing to color for example */ -void ui_set_but_vectorf(uiBut *but, float *vec) +void ui_set_but_vectorf(uiBut *but, const float vec[3]) { PropertyRNA *prop; - int a, tot; if(but->editvec) { - VECCOPY(but->editvec, vec); + copy_v3_v3(but->editvec, vec); } if(but->rnaprop) { prop= but->rnaprop; if(RNA_property_type(prop) == PROP_FLOAT) { + int tot; + int a; + tot= RNA_property_array_length(&but->rnapoin, prop); tot= MIN2(tot, 3); - for(a=0; a<tot; a++) + for (a=0; a<tot; a++) { RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]); + } } } else if(but->pointype == CHA) { @@ -1280,7 +1287,7 @@ void ui_set_but_vectorf(uiBut *but, float *vec) } else if(but->pointype == FLO) { float *fp= (float *)but->poin; - VECCOPY(fp, vec); + copy_v3_v3(fp, vec); } } diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index c35996701ee..6c661ba014e 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -179,6 +179,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) dtar = &dvar->targets[0]; dtar->id = (ID *)CTX_data_scene(C); // XXX: should we check that C is valid first? + dtar->idtype= ID_SCE; dtar->rna_path = BLI_sprintfN("frame_current"); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9af9b2f55ad..f4400d2d7db 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1252,6 +1252,86 @@ static short test_special_char(char ch) return 0; } +static int ui_textedit_step_next_utf8(const char *str, size_t maxlen, short *pos) +{ + const char *str_end= str + (maxlen + 1); + const char *str_pos= str + (*pos); + const char *str_next= BLI_str_find_next_char_utf8(str_pos, str_end); + if (str_next) { + (*pos) += (str_next - str_pos); + if((*pos) > maxlen) (*pos)= maxlen; + return TRUE; + } + + return FALSE; +} + +static int ui_textedit_step_prev_utf8(const char *str, size_t UNUSED(maxlen), short *pos) +{ + if((*pos) > 0) { + const char *str_pos= str + (*pos); + const char *str_prev= BLI_str_find_prev_char_utf8(str, str_pos); + if (str_prev) { + (*pos) -= (str_pos - str_prev); + return TRUE; + } + } + + return FALSE; +} + +static void ui_textedit_step_utf8(const char *str, size_t maxlen, + short *pos, const char direction, + const short do_jump, const short do_all) +{ + const short pos_prev= *pos; + + if(direction) { /* right*/ + if(do_jump) { + /* jump between special characters (/,\,_,-, etc.), + * look at function test_special_char() for complete + * list of special character, ctr -> */ + while((*pos) < maxlen) { + if (ui_textedit_step_next_utf8(str, maxlen, pos)) { + if(!do_all && test_special_char(str[(*pos)])) break; + } + else { + break; /* unlikely but just incase */ + } + } + } + else { + ui_textedit_step_next_utf8(str, maxlen, pos); + } + } + else { /* left */ + if(do_jump) { + /* left only: compensate for index/change in direction */ + ui_textedit_step_prev_utf8(str, maxlen, pos); + + /* jump between special characters (/,\,_,-, etc.), + * look at function test_special_char() for complete + * list of special character, ctr -> */ + while ((*pos) > 0) { + if (ui_textedit_step_prev_utf8(str, maxlen, pos)) { + if(!do_all && test_special_char(str[(*pos)])) break; + } + else { + break; + } + } + + /* left only: compensate for index/change in direction */ + if(((*pos) != 0) && ABS(pos_prev - (*pos)) > 1) { + ui_textedit_step_next_utf8(str, maxlen, pos); + } + } + else { + ui_textedit_step_prev_utf8(str, maxlen, pos); + } + } +} + static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data) { char *str= data->str; @@ -1294,13 +1374,17 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho /* mouse dragged outside the widget to the left */ if (x < startx && but->ofs > 0) { - int i= but->ofs; + short i= but->ofs; origstr[but->ofs] = 0; while (i > 0) { - i--; - if (BLF_width(fstyle->uifont_id, origstr+i) > (startx - x)*0.25f) break; // 0.25 == scale factor for less sensitivity + if (ui_textedit_step_prev_utf8(origstr, but->ofs, &i)) { + if (BLF_width(fstyle->uifont_id, origstr+i) > (startx - x)*0.25f) break; // 0.25 == scale factor for less sensitivity + } + else { + break; /* unlikely but possible */ + } } but->ofs = i; but->pos = but->ofs; @@ -1314,9 +1398,13 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho /* XXX does not take zoom level into account */ 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; - } + if (ui_textedit_step_prev_utf8(origstr, but->ofs, &but->pos)) { + origstr[but->pos+but->ofs] = 0; + } + else { + break; /* unlikely but possible */ + } + } but->pos += but->ofs; if(but->pos<0) but->pos= 0; } @@ -1391,48 +1479,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction 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(!jump_all && test_special_char(str[but->pos])) break; - } - } - else { - but->pos++; - if(but->pos > len) but->pos= len; - } - } - else { /* left */ - if(jump) { - - /* left only: compensate for index/change in direction */ - if(but->pos > 0) { - but->pos--; - } - - /* 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(!jump_all && test_special_char(str[but->pos])) break; - } - - /* 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--; - } - } - + ui_textedit_step_utf8(str, len, &but->pos, direction, jump, jump_all); if(select) { /* existing selection */ @@ -1498,21 +1545,10 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio changed= ui_textedit_delete_selection(but, data); } else if(but->pos>=0 && but->pos<len) { + short pos= but->pos; int step; - - if (jump) { - x = but->pos; - step= 0; - while(x < len) { - x++; - step++; - if(test_special_char(str[x])) break; - } - } - else { - step= 1; - } - + ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + step= pos - but->pos; for(x=but->pos; x<len; x++) str[x]= str[x+step]; str[len-step]='\0'; @@ -1525,20 +1561,11 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio changed= ui_textedit_delete_selection(but, data); } else if(but->pos>0) { + short pos= but->pos; int step; - if (jump) { - x = but->pos; - step= 0; - while(x > 0) { - x--; - step++; - if((step > 1) && test_special_char(str[x])) break; - } - } - else { - step= 1; - } + ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + step= but->pos - pos; for(x=but->pos; x<len; x++) str[x-step]= str[x]; @@ -1966,8 +1993,6 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) { - float softrange, softmin, softmax; - if(but->type == BUT_CURVE) { but->editcumap= (CurveMapping*)but->poin; } @@ -1977,10 +2002,12 @@ static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) } else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) { ui_get_but_vectorf(but, data->origvec); - VECCOPY(data->vec, data->origvec); + copy_v3_v3(data->vec, data->origvec); but->editvec= data->vec; } else { + float softrange, softmin, softmax; + data->startvalue= ui_get_but_val(but); data->origvalue= data->startvalue; data->value= data->origvalue; @@ -3004,6 +3031,9 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i /* button is presumed square */ /* if mouse moves outside of sphere, it does negative normal */ + /* note that both data->vec and data->origvec should be normalized + * else we'll get a hamrless but annoying jump when first clicking */ + fp= data->origvec; rad= (but->x2 - but->x1); radsq= rad*rad; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 6fb7677da6e..12e9d39e896 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -350,8 +350,8 @@ extern void ui_window_to_region(const ARegion *ar, int *x, int *y); extern double ui_get_but_val(uiBut *but); extern void ui_set_but_val(uiBut *but, double value); extern void ui_set_but_hsv(uiBut *but); -extern void ui_get_but_vectorf(uiBut *but, float *vec); -extern void ui_set_but_vectorf(uiBut *but, float *vec); +extern void ui_get_but_vectorf(uiBut *but, float vec[3]); +extern void ui_set_but_vectorf(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 622d50752fa..028ab05464b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -368,7 +368,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - /* special case, enum rna buttons only have enum item description, use general enum description too before the spesific one */ + /* special case, enum rna buttons only have enum item description, use general enum description too before the specific one */ if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) { const char *descr= RNA_property_description(but->rnaprop); if(descr && descr[0]) { diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 556876c4d8d..de7c6b1a65e 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -3970,7 +3970,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f copy_v2_v2(handles[a].mval, pos); copy_v2_v2(handles[a].prevmval, lastpos); - /* thread spesific */ + /* thread specific */ handles[a].thread_index = a; handles[a].projImages = (ProjPaintImage *)BLI_memarena_alloc(ps->arena_mt[a], ps->image_tot * sizeof(ProjPaintImage)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index ecab180822b..ca4ab3fd7ad 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1699,7 +1699,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } } - /* important to normalize after mirror, otherwise mirror gets wight + /* important to normalize after mirror, otherwise mirror gets weight * which has already been scaled down in relation to other weights, * then scales a second time [#26193]. Tricky multi-paint code doesn't * suffer from this problem - campbell */ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 611bf79603e..85edcce35ca 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -181,7 +181,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "", min_x, line1_y, line1_w-chan_offs, btn_h, - params->dir, 0.0, (float)FILE_MAX-1, 0, 0, + params->dir, 0.0, (float)FILE_MAX, 0, 0, UI_translate_do_tooltip(N_("File path"))); uiButSetCompleteFunc(but, autocomplete_directory, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); @@ -189,7 +189,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) if((params->flag & FILE_DIRSEL_ONLY) == 0) { but = uiDefBut(block, TEX, B_FS_FILENAME, "", min_x, line2_y, line2_w-chan_offs, btn_h, - params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, + params->file, 0.0, (float)FILE_MAXFILE, 0, 0, UI_translate_do_tooltip(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); uiButSetCompleteFunc(but, autocomplete_file, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0955d264ca8..559873bd601 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -666,7 +666,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) if((prop= RNA_struct_find_property(op->ptr, "filepath"))) { char filepath[FILE_MAX]; RNA_property_string_get(op->ptr, prop, filepath); - BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } else { if((prop= RNA_struct_find_property(op->ptr, "filename"))) { @@ -1143,7 +1143,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) if(BLI_exists(sfile->params->dir) && BLI_is_dir(sfile->params->dir) == 0) { char path[sizeof(sfile->params->dir)]; BLI_strncpy(path, sfile->params->dir, sizeof(path)); - BLI_split_dirfile(path, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } BLI_cleanup_dir(G.main->name, sfile->params->dir); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index c2e45c5ad8a..b478976d027 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -736,7 +736,7 @@ static int file_is_blend_backup(const char *str) } -static int file_extension_type(char *relname) +static int file_extension_type(const char *relname) { if(BLO_has_bfile_extension(relname)) { return BLENDERFILE; @@ -769,7 +769,7 @@ static int file_extension_type(char *relname) return 0; } -int ED_file_extension_icon(char *relname) +int ED_file_extension_icon(const char *relname) { int type= file_extension_type(relname); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 6cc42b2a751..f36145aaba0 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -113,7 +113,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) if (!sfile->params) { sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams"); /* set path to most recently opened .blend */ - BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); sfile->params->filter_glob[0] = '\0'; } @@ -142,7 +142,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) sfile->params->file[0]= '\0'; } else { - BLI_split_dirfile(name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } } else { @@ -613,7 +613,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) DIR *dir; struct dirent *de; - BLI_split_dirfile(str, dirname, NULL); + BLI_split_dirfile(str, dirname, NULL, sizeof(dirname), 0); dir = opendir(dirname); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index dc5e71f0406..37e6c0b73c9 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -340,7 +340,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) int sel, b; /* a single call to GL_LINES here around these calls should be sufficient to still - * get separate line segments, but which aren't wrapped with GL_LINE_STRIP everytime we + * get separate line segments, but which aren't wrapped with GL_LINE_STRIP every time we * want a single line */ glBegin(GL_LINES); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 1c4b0130897..7fa4e62359a 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -321,7 +321,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad char dir_only[FILE_MAX]; char file_only[FILE_MAX]; - BLI_split_dirfile(seq_load.path, dir_only, NULL); + BLI_split_dirfile(seq_load.path, dir_only, NULL, sizeof(dir_only), 0); RNA_BEGIN(op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", file_only); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index da785430d43..45543a9313e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2977,7 +2977,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "directory", directory); if (is_relative_path) { - /* TODO, shouldnt this already be relative from the filesel? + /* TODO, shouldn't this already be relative from the filesel? * (as the 'filepath' is) for now just make relative here, * but look into changing after 2.60 - campbell */ BLI_path_rel(directory, bmain->name); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 5c2013ee863..45908801147 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -362,7 +362,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop) PointerRNA itemptr; char dir[FILE_MAX], file[FILE_MAX]; - BLI_split_dirfile(drag->path, dir, file); + BLI_split_dirfile(drag->path, dir, file, sizeof(dir), sizeof(file)); RNA_string_set(drop->ptr, "directory", dir); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index b38071c29da..e5832e96c1c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -768,7 +768,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa else glDepthMask(0); for(vos= strings->first; vos; vos= vos->next) { -#if 0 // too slow, reading opengl info while drawing is very bad, better to see if we cn use the zbuffer while in pixel space - campbell +#if 0 // too slow, reading opengl info while drawing is very bad, better to see if we can use the zbuffer while in pixel space - campbell if(v3d->zbuf && (vos->flag & V3D_CACHE_TEXT_ZBUF)) { gluProject(vos->vec[0], vos->vec[1], vos->vec[2], mats.modelview, mats.projection, (GLint *)mats.viewport, &ux, &uy, &uz); glReadPixels(ar->winrct.xmin+vos->mval[0]+vos->xoffs, ar->winrct.ymin+vos->mval[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); @@ -6816,7 +6816,10 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec } else { Mesh *me= ob->data; - if(me->editflag & ME_EDIT_VERT_SEL) { + if( (me->editflag & ME_EDIT_VERT_SEL) && + /* currently vertex select only supports weight paint */ + (ob->mode & OB_MODE_WEIGHT_PAINT)) + { DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask); glColor3ub(0, 0, 0); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8f3b394abe8..f48e1b1c2d0 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1926,7 +1926,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu quat[3]= oldquat[3]; } else { - /* quaternions get limited with euler... (compatability mode) */ + /* quaternions get limited with euler... (compatibility mode) */ float eul[3], oldeul[3], nquat[4], noldquat[4]; float qlen; diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index 6d524a59b40..f33ee744caa 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -438,7 +438,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos); if(totleft) { - /* there are deformation modifier which doesn't support deformation matricies + /* there are deformation modifier which doesn't support deformation matrices calculation. Need additional crazyspace correction */ float (*deformedVerts)[3]= *deformcos; diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 492dd34caa6..db574160771 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -340,8 +340,8 @@ typedef struct bPose { void *ikdata; /* temporary IK data, depends on the IK solver. Not saved in file */ void *ikparam; /* IK solver parameters, structure depends on iksolver */ - bAnimVizSettings avs; /* settings for visualisation of bone animation */ - char proxy_act_bone[32]; /*proxy active bone name*/ + bAnimVizSettings avs; /* settings for visualization of bone animation */ + char proxy_act_bone[32]; /* proxy active bone name*/ } bPose; @@ -423,6 +423,8 @@ typedef enum eItasc_Solver { * This is also exploited for bone-groups. Bone-Groups are stored per bPose, and are used * primarily to color bones in the 3d-view. There are other benefits too, but those are mostly related * to Action-Groups. + * + * Note that these two uses each have their own RNA 'ActionGroup' and 'BoneGroup'. */ typedef struct bActionGroup { struct bActionGroup *next, *prev; @@ -651,7 +653,7 @@ typedef enum eAnimEdit_AutoSnap { * Constraint Channels in certain situations. * * Action-Channels can only belong to one group at a time, but they still live the Action's - * list of achans (to preserve backwards compatability, and also minimise the code + * list of achans (to preserve backwards compatibility, and also minimize the code * that would need to be recoded). Grouped achans are stored at the start of the list, according * to the position of the group in the list, and their position within the group. */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index e04bdd4ec45..00f6f2433af 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -228,7 +228,7 @@ typedef struct bMinMaxConstraint { int minmaxflag; float offset; int flag; - short sticky, stuck, pad1, pad2; /* for backward compatability */ + short sticky, stuck, pad1, pad2; /* for backward compatibility */ float cache[3]; char subtarget[32]; } bMinMaxConstraint; diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 8fe8b3bcf70..201ea8994ca 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -30,7 +30,7 @@ * \deprecated * The contents of this file are now officially depreceated. They were used for the 'old' animation system, * which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines, - * etc. are only still maintained to provide backwards compatability for old files. + * etc. are only still maintained to provide backwards compatibility for old files. */ #ifndef DNA_IPO_TYPES_H diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 9fec5207dbb..da2fce4da82 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -386,7 +386,8 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_DRAW_HEALTH 16 #define PART_ABS_PATH_TIME 32 #define PART_DRAW_COUNT_GR 64 -#define PART_DRAW_BB_LOCK 128 +#define PART_DRAW_BB_LOCK 128 /* used with billboards */ +#define PART_DRAW_ROTATE_OB 128 /* used with dupliobjects/groups */ #define PART_DRAW_PARENT 256 #define PART_DRAW_NUM 512 #define PART_DRAW_RAND_GR 1024 diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 813375a3549..061a21056d0 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1871,7 +1871,7 @@ static void def_cmp_id_mask(StructRNA *srna) prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom1"); - RNA_def_property_range(prop, 0, 10000); + RNA_def_property_range(prop, 0, 32767); RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index a6e0e9f3331..c36dca22731 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -53,7 +53,7 @@ static EnumPropertyItem effector_shape_items[] = { #ifdef RNA_RUNTIME -/* type spesific return values only used from functions */ +/* type specific return values only used from functions */ static EnumPropertyItem curve_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f0f782fede2..43d5f87f0d5 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -505,6 +505,17 @@ static int rna_PartSettings_is_fluid_get(PointerRNA *ptr) return part->type == PART_FLUID; } +void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= ptr->id.data; + ParticleSystem *part= (ParticleSystem*)ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(part->name, value, sizeof(part->name)); + + BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name), sizeof(part->name)); +} + static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr) { ParticleSystem *psys= (ParticleSystem*)ptr->data; @@ -1467,7 +1478,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) static EnumPropertyItem rot_mode_items[] = { {0, "NONE", 0, "None", ""}, {PART_ROT_NOR, "NOR", 0, "Normal", ""}, - {PART_ROT_VEL, "VEL", 0, "Velocity", ""}, + {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""}, {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""}, {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""}, {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""}, @@ -1722,7 +1733,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "rotmode"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, rot_mode_items); - RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation"); + RNA_def_property_ui_text(prop, "Rotation", "Particle rotation axis"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE); @@ -1787,7 +1798,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB); - RNA_def_property_ui_text(prop, "Use Global", "Use object's global coordinates for duplication"); + RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + + prop= RNA_def_property(srna, "use_rotation_dupli", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB); + RNA_def_property_ui_text(prop, "Rotation", "Use object's rotation for duplication (global x-axis is aligned particle rotation axis)"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); prop= RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE); @@ -2617,6 +2633,7 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Particle system name"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set"); RNA_def_struct_name_property(srna, prop); /* access to particle settings is redirected through functions */ diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b61495edc94..e3a3f93b5f3 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -139,6 +139,17 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value) } } +void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= ptr->id.data; + bActionGroup *agrp= ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name)); + + BLI_uniquename(&ob->pose->agroups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); +} + static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create) { bPoseChannel *pchan= ptr->data; @@ -657,6 +668,7 @@ static void rna_def_bone_group(BlenderRNA *brna) /* name */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set"); RNA_def_struct_name_property(srna, prop); // TODO: add some runtime-collections stuff to access grouped bones diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 2cbe51d30e8..143d082a45e 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -814,8 +814,8 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) { Scene *scene= (Scene*)ptr->id.data; SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; - BLI_strncpy_utf8(rl->name, value, sizeof(rl->name)); + BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name)); if(scene->nodetree) { bNode *node; diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 92739148b99..b90f10693ac 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -443,7 +443,6 @@ static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator * static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; if(seq->type == SEQ_SOUND && seq->sound) { /* for sound strips we need to update the sound as well. @@ -457,9 +456,7 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) sound_update_scene_sound(seq->scene_sound, seq->sound); } - BLI_split_dirfile(value, dir, name); - BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir)); - BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name)); + BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) @@ -481,11 +478,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) { StripProxy *proxy= (StripProxy*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; - - BLI_split_dirfile(value, dir, name); - BLI_strncpy(proxy->dir, dir, sizeof(proxy->dir)); - BLI_strncpy(proxy->file, name, sizeof(proxy->file)); + BLI_split_dirfile(value, proxy->dir, proxy->file, sizeof(proxy->dir), sizeof(proxy->file)); } static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) @@ -541,20 +534,13 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr) /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; - - BLI_split_dirfile(value, dir, name); - BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir)); - BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name)); + BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) { StripElem *elem= (StripElem*)(ptr->data); - char name[FILE_MAX]; - - BLI_split_dirfile(value, NULL, name); - BLI_strncpy(elem->name, name, sizeof(elem->name)); + BLI_split_dirfile(value, NULL, elem->name, 0, sizeof(elem->name)); }*/ static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 11157e67741..e2f0f4dab1f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2511,20 +2511,22 @@ static void rna_def_userdef_system(BlenderRNA *brna) /* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */ /* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */ static EnumPropertyItem language_items[] = { + {0, "", 0, "Nearly done", ""}, {0, "DEFAULT", 0, N_("Default (Default)"), ""}, {1, "ENGLISH", 0, N_("English (English)"), "en_US"}, + {8, "FRENCH", 0, N_("French (Français)"), "fr_FR"}, + {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, + {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, + {0, "", 0, "In progress", ""}, {2, "JAPANESE", 0, N_("Japanese (日本語)"), "ja_JP"}, {3, "DUTCH", 0, N_("Dutch (Nederlandse taal)"), "nl_NL"}, {4, "ITALIAN", 0, N_("Italian (Italiano)"), "it_IT"}, {5, "GERMAN", 0, N_("German (Deutsch)"), "de_DE"}, {6, "FINNISH", 0, N_("Finnish (Suomi)"), "fi_FI"}, {7, "SWEDISH", 0, N_("Swedish (Svenska)"), "sv_SE"}, - {8, "FRENCH", 0, N_("French (Française)"), "fr_FR"}, - {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, {10, "CATALAN", 0, N_("Catalan (Català)"), "ca_AD"}, {11, "CZECH", 0, N_("Czech (Český)"), "cs_CZ"}, {12, "BRAZILIAN_PORTUGUESE", 0, N_("Brazilian Portuguese (Português do Brasil)"), "pt_BR"}, - {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, {14, "TRADITIONAL_CHINESE", 0, N_("Traditional Chinese (繁體中文)"), "zh_TW"}, {15, "RUSSIAN", 0, N_("Russian (Русский)"), "ru_RU"}, {16, "CROATIAN", 0, N_("Croatian (Hrvatski)"), "hr_HR"}, @@ -2539,7 +2541,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"}, /*{25, "NEPALI", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/ /* using the utf8 flipped form of Persian (فارسی) */ - {26, "PERSIAN", 0, N_("Persian (ﺱﺭﺎﻓ)"), "fa_PE"}, + {26, "PERSIAN", 0, N_("Persian (ﯽﺳﺭﺎﻓ)"), "fa_PE"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL); diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index 53bbb27f9b0..154f7613223 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -180,7 +180,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* prepare group tree inputs */ for (sock=ntree->inputs.first; sock; sock=sock->next) { - ns = setup_stack(exec->stack, sock); + /* ns = */ setup_stack(exec->stack, sock); } /* prepare all internal nodes for execution */ for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) { @@ -198,7 +198,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* tag all outputs */ for (sock=node->outputs.first; sock; sock=sock->next) { - ns = setup_stack(exec->stack, sock); + /* ns = */ setup_stack(exec->stack, sock); } if(node->typeinfo->initexecfunc) diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index aabaf5b86de..51e48b84383 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -128,6 +128,21 @@ static bNodeSocketType node_socket_type_boolean = { /* buttonfunc */ NULL, }; +/****************** SHADER ******************/ + +static bNodeSocketType node_socket_type_shader = { + /* type */ SOCK_SHADER, + /* ui_name */ "Shader", + /* ui_description */ "Shader", + /* ui_icon */ 0, + /* ui_color */ {100,200,100,255}, + + /* value_structname */ NULL, + /* value_structsize */ 0, + + /* buttonfunc */ NULL, +}; + /****************** MESH ******************/ static bNodeSocketType node_socket_type_mesh = { @@ -153,6 +168,7 @@ void node_socket_type_init(bNodeSocketType *types[]) INIT_TYPE(rgba); INIT_TYPE(int); INIT_TYPE(boolean); + INIT_TYPE(shader); INIT_TYPE(mesh); #undef INIT_TYPE @@ -241,6 +257,17 @@ struct bNodeSocket *nodeAddOutputRGBA(struct bNodeTree *ntree, struct bNode *nod return sock; } +struct bNodeSocket *nodeAddInputShader(struct bNodeTree *ntree, struct bNode *node, const char *name) +{ + bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_SHADER); + return sock; +} +struct bNodeSocket *nodeAddOutputShader(struct bNodeTree *ntree, struct bNode *node, const char *name) +{ + bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_SHADER); + return sock; +} + struct bNodeSocket *nodeAddInputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name) { bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_MESH); @@ -271,6 +298,9 @@ struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct case SOCK_RGBA: sock = nodeAddInputRGBA(ntree, node, stemp->name, stemp->val1, stemp->val2, stemp->val3, stemp->val4); break; + case SOCK_SHADER: + sock = nodeAddInputShader(ntree, node, stemp->name); + break; case SOCK_MESH: sock = nodeAddInputMesh(ntree, node, stemp->name); break; @@ -299,6 +329,9 @@ struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struc case SOCK_RGBA: sock = nodeAddOutputRGBA(ntree, node, stemp->name); break; + case SOCK_SHADER: + sock = nodeAddOutputShader(ntree, node, stemp->name); + break; case SOCK_MESH: sock = nodeAddOutputMesh(ntree, node, stemp->name); break; diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 603bb0ed0ac..3b0c6a9ff25 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -58,7 +58,7 @@ typedef struct { PyObject_HEAD /* required python macro */ - /* collection iterator spesific parts */ + /* collection iterator specific parts */ char relpath[FILE_MAX]; char abspath[FILE_MAX]; /* absolute path */ BlendHandle *blo_handle; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index b1700aa53c6..7570b5642ef 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1089,7 +1089,7 @@ static PyObject *Matrix_decompose(MatrixObject *self) PyDoc_STRVAR(Matrix_lerp_doc, ".. function:: lerp(other, factor)\n" "\n" -" Returns the interpolation of two matricies.\n" +" Returns the interpolation of two matrices.\n" "\n" " :arg other: value to interpolate with.\n" " :type other: :class:`Matrix`\n" @@ -1669,7 +1669,7 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item) } else { PyErr_SetString(PyExc_IndexError, - "slice steps not supported with matricies"); + "slice steps not supported with matrices"); return NULL; } } @@ -1701,7 +1701,7 @@ static int Matrix_ass_subscript(MatrixObject* self, PyObject* item, PyObject* va return Matrix_ass_slice(self, start, stop, value); else { PyErr_SetString(PyExc_IndexError, - "slice steps not supported with matricies"); + "slice steps not supported with matrices"); return -1; } } |