diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-10-24 08:18:28 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-10-24 08:18:28 +0400 |
commit | 0503a4f7a6fa2aba573ff4f8d4c6d7f387894952 (patch) | |
tree | 26fa3836cd19536e6445ef4aad8fcecece1614f3 /source | |
parent | 618d4d1a6e4a3df8399549fa80846cdeacb7299c (diff) | |
parent | 2bd9519e39f7c383005fd531f4c7dd92cce246ad (diff) |
svn merge ^/trunk/blender -r41100:41150
Diffstat (limited to 'source')
155 files changed, 1046 insertions, 693 deletions
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index e4e8805164a..214ae03b453 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -85,11 +85,6 @@ struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, str int BKE_font_getselection(struct Object *ob, int *start, int *end); -size_t chtoutf8(const unsigned long c, char o[4]); -void wcs2utf8s(char *dst, const wchar_t *src); -size_t wcsleninu8(wchar_t *src); -size_t utf8towchar(wchar_t *w, const char *c); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 1de3c295f4d..b75a8cb29ec 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -346,9 +346,8 @@ struct bNode *nodeGetActiveID(struct bNodeTree *ntree, short idtype); int nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id); void nodeClearActiveID(struct bNodeTree *ntree, short idtype); -void NodeTagChanged(struct bNodeTree *ntree, struct bNode *node); -int NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id); -void ntreeClearTags(struct bNodeTree *ntree); +void nodeUpdate(struct bNodeTree *ntree, struct bNode *node); +int nodeUpdateID(struct bNodeTree *ntree, struct ID *id); void nodeFreePreview(struct bNode *node); @@ -601,7 +600,7 @@ void ntreeCompositTagRender(struct Scene *sce); int ntreeCompositTagAnimated(struct bNodeTree *ntree); void ntreeCompositTagGenerators(struct bNodeTree *ntree); void ntreeCompositForceHidden(struct bNodeTree *ntree, struct Scene *scene); - +void ntreeCompositClearTags(struct bNodeTree *ntree); /* ************** TEXTURE NODES *************** */ diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index 556ff26e621..f1c7356e6b0 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -51,7 +51,7 @@ struct PackedFile *newPackedFileMemory(void *mem, int memlen); void packAll(struct Main *bmain, struct ReportList *reports); /* unpack */ -char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how); +char *unpackFile(struct ReportList *reports, const char *abs_name, const char *local_name, struct PackedFile *pf, int how); int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how); int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how); int unpackImage(struct ReportList *reports, struct Image *ima, int how); diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 4de6172251f..2998d7bda5c 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -42,8 +42,7 @@ if env['WITH_BF_QUICKTIME']: if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') + defs.append('WITH_SDL') if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index e5a5818e0e8..9552678628a 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -45,6 +45,7 @@ #include "DNA_scene_types.h" #include "BLI_edgehash.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_mesh.h" diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c index d7cff7cfe27..1baf34236ef 100644 --- a/source/blender/blenkernel/intern/BME_eulers.c +++ b/source/blender/blenkernel/intern/BME_eulers.c @@ -39,6 +39,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "bmesh_private.h" diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c index fd38fae13cf..e15a46b407e 100644 --- a/source/blender/blenkernel/intern/BME_mesh.c +++ b/source/blender/blenkernel/intern/BME_mesh.c @@ -38,7 +38,7 @@ */ - +#include "BLI_listbase.h" #include "MEM_guardedalloc.h" #include "BKE_bmesh.h" #include "bmesh_private.h" diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c index 2a16f8f18ff..e36f40c5a54 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -41,6 +41,7 @@ #include <limits.h> #include "MEM_guardedalloc.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_bmesh.h" /** diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 80a40c0a3a3..d3c5942b685 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -38,6 +38,7 @@ #include "BLI_winstuff.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "DNA_anim_types.h" @@ -1962,7 +1963,7 @@ static void dag_tag_renderlayers(Scene *sce, unsigned int lay) if(node->id==(ID *)sce) { SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); if(srl && (srl->lay & lay_changed)) - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); } } } diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 9c01b35b91a..068e70bbb50 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -64,142 +64,6 @@ static ListBase ttfdata= {NULL, NULL}; -/* UTF-8 <-> wchar transformations */ -size_t chtoutf8(const unsigned long c, char o[4]) -{ - // Variables and initialization -/* memset(o, 0, 4); */ - - // Create the utf-8 string - if (c < 0x80) { - o[0] = (char) c; - return 1; - } - else if (c < 0x800) { - o[0] = (0xC0 | (c>>6)); - o[1] = (0x80 | (c & 0x3f)); - return 2; - } - else if (c < 0x10000) { - o[0] = (0xe0 | (c >> 12)); - o[1] = (0x80 | (c >>6 & 0x3f)); - o[2] = (0x80 | (c & 0x3f)); - return 3; - } - else if (c < 0x200000) { - o[0] = (0xf0 | (c>>18)); - o[1] = (0x80 | (c >>12 & 0x3f)); - o[2] = (0x80 | (c >> 6 & 0x3f)); - o[3] = (0x80 | (c & 0x3f)); - return 4; - } - - /* should we assert here? */ - return 0; -} - -void wcs2utf8s(char *dst, const wchar_t *src) -{ - while(*src) { - dst += chtoutf8(*src++, dst); - } - - *dst= '\0'; -} - -size_t wcsleninu8(wchar_t *src) -{ - char ch_dummy[4]; - size_t len = 0; - - while(*src) { - len += chtoutf8(*src++, ch_dummy); - } - - return len; -} - -static size_t utf8slen(const char *strc) -{ - int len=0; - - while(*strc) { - if ((*strc & 0xe0) == 0xc0) { - if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00) - strc++; - } else if ((*strc & 0xf0) == 0xe0) { - if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00) - strc += 2; - } else if ((*strc & 0xf8) == 0xf0) { - if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00) - strc += 3; - } - - strc++; - len++; - } - - return len; -} - - -/* Converts Unicode to wchar - -According to RFC 3629 "UTF-8, a transformation format of ISO 10646" -(http://tools.ietf.org/html/rfc3629), the valid UTF-8 encoding are: - - Char. number range | UTF-8 octet sequence - (hexadecimal) | (binary) - --------------------+--------------------------------------------- - 0000 0000-0000 007F | 0xxxxxxx - 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - -If the encoding incidated by the first character is incorrect (because the -1 to 3 following characters do not match 10xxxxxx), the output is a '?' and -only a single input character is consumed. - -*/ - -size_t utf8towchar(wchar_t *w, const char *c) -{ - int len=0; - - if(w==NULL || c==NULL) return(0); - - while(*c) { - if ((*c & 0xe0) == 0xc0) { - if((c[1] & 0x80) && (c[1] & 0x40) == 0x00) { - *w=((c[0] &0x1f)<<6) | (c[1]&0x3f); - c++; - } else { - *w = '?'; - } - } else if ((*c & 0xf0) == 0xe0) { - if((c[1] & c[2] & 0x80) && ((c[1] | c[2]) & 0x40) == 0x00) { - *w=((c[0] & 0x0f)<<12) | ((c[1]&0x3f)<<6) | (c[2]&0x3f); - c += 2; - } else { - *w = '?'; - } - } else if ((*c & 0xf8) == 0xf0) { - if((c[1] & c[2] & c[3] & 0x80) && ((c[1] | c[2] | c[3]) & 0x40) == 0x00) { - *w=((c[0] & 0x07)<<18) | ((c[1]&0x1f)<<12) | ((c[2]&0x3f)<<6) | (c[3]&0x3f); - c += 3; - } else { - *w = '?'; - } - } else - *w=(c[0] & 0x7f); - - c++; - w++; - len++; - } - return len; -} - /* The vfont code */ void free_vfont(struct VFont *vf) { @@ -691,10 +555,10 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m if(vfont == NULL) return NULL; // Create unicode string - utf8len = utf8slen(cu->str); + utf8len = BLI_strlen_utf8(cu->str); mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem"); - utf8towchar(mem, cu->str); + BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1); // Count the wchar_t string length slen = wcslen(mem); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index cf8f96c143a..37982e7fec9 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -906,8 +906,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d if (scene->r.stamp & R_STAMP_MARKER) { char *name = scene_find_last_marker_name(scene, CFRA); - - if (name) strcpy(text, name); + + if (name) BLI_strncpy(text, name, sizeof(text)); else strcpy(text, "<none>"); BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text); @@ -980,7 +980,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d if (scene->r.stamp & R_STAMP_SEQSTRIP) { Sequence *seq= seq_foreground_frame_get(scene, scene->r.cfra); - if (seq) strcpy(text, seq->name+2); + if (seq) BLI_strncpy(text, seq->name+2, sizeof(text)); else strcpy(text, "<none>"); BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text); @@ -1514,7 +1514,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) Scene *scene; for(scene= G.main->scene.first; scene; scene= scene->id.next) { if(scene->nodetree) { - NodeTagIDChanged(scene->nodetree, &ima->id); + nodeUpdateID(scene->nodetree, &ima->id); } } } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 9de75a49998..edddcb4a6b2 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -52,6 +52,9 @@ #include "DNA_meshdata_types.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BKE_bmesh.h" #include "BKE_cloth.h" @@ -86,8 +89,8 @@ ModifierData *modifier_new(int type) ModifierTypeInfo *mti = modifierType_getInfo(type); ModifierData *md = MEM_callocN(mti->structSize, mti->structName); - // FIXME: we need to make the name always be unique somehow... - strcpy(md->name, mti->name); + /* note, this name must be made unique later */ + BLI_strncpy(md->name, mti->name, sizeof(md->name)); md->type = type; md->mode = eModifierMode_Realtime diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 97347d85deb..15513675c7a 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -42,6 +42,9 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "DNA_anim_types.h" diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index f0be3c99f13..cb1f52a6265 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -184,7 +184,7 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree, bNode *node, int in_out, const char else if (in_out==SOCK_OUT) BLI_addtail(&node->outputs, sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; return sock; } @@ -197,7 +197,7 @@ bNodeSocket *nodeInsertSocket(bNodeTree *ntree, bNode *node, int in_out, bNodeSo else if (in_out==SOCK_OUT) BLI_insertlinkbefore(&node->outputs, next_sock, sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; return sock; } @@ -221,7 +221,7 @@ void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock) MEM_freeN(sock->default_value); MEM_freeN(sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; } void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) @@ -246,7 +246,7 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) BLI_freelistN(&node->outputs); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; } /* finds a node based on its name */ @@ -374,7 +374,7 @@ void nodeMakeDynamicType(bNode *node) /*node->typeinfo= MEM_dupallocN(ntype);*/ bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType"); *newtype= *ntype; - strcpy(newtype->name, ntype->name); + BLI_strncpy(newtype->name, ntype->name, sizeof(newtype->name)); node->typeinfo= newtype; } } @@ -823,7 +823,7 @@ void nodeUnlinkNode(bNodeTree *ntree, bNode *node) if(link->fromnode==node) { lb= &node->outputs; if (link->tonode) - NodeTagChanged(ntree, link->tonode); + link->tonode->update |= NODE_UPDATE; } else if(link->tonode==node) lb= &node->inputs; @@ -1495,18 +1495,19 @@ void ntreeUpdateTree(bNodeTree *ntree) /* update individual nodes */ for (n=0; n < totnodes; ++n) { node = deplist[n]; - if (ntreetype->update_node) - ntreetype->update_node(ntree, node); - else if (node->typeinfo->updatefunc) - node->typeinfo->updatefunc(ntree, node); + + /* node tree update tags override individual node update flags */ + if ((node->update & NODE_UPDATE) || (ntree->update & NTREE_UPDATE)) { + if (ntreetype->update_node) + ntreetype->update_node(ntree, node); + else if (node->typeinfo->updatefunc) + node->typeinfo->updatefunc(ntree, node); + } + /* clear update flag */ + node->update = 0; } MEM_freeN(deplist); - - /* ensures only a single output node is enabled, texnode allows multiple though */ - if(ntree->type!=NTREE_TEXTURE) - ntreeSetOutput(ntree); - } /* general tree updates */ @@ -1518,6 +1519,9 @@ void ntreeUpdateTree(bNodeTree *ntree) if (ntreetype->update) ntreetype->update(ntree); else { + /* Trees can be associated with a specific node type (i.e. group nodes), + * in that case a tree update function may be defined by that node type. + */ bNodeType *ntype= node_get_type(ntree, ntree->nodetype); if (ntype && ntype->updatetreefunc) ntype->updatetreefunc(ntree); @@ -1530,24 +1534,24 @@ void ntreeUpdateTree(bNodeTree *ntree) ntree->update = 0; } -void NodeTagChanged(bNodeTree *ntree, bNode *node) +void nodeUpdate(bNodeTree *ntree, bNode *node) { - bNodeTreeType *ntreetype = ntreeGetType(ntree->type); + bNodeTreeType *ntreetype= ntreeGetType(ntree->type); - /* extra null pointer checks here because this is called when unlinking - unknown nodes on file load, so typeinfo pointers may not be set */ - if (ntreetype && ntreetype->update_node) + if (ntreetype->update_node) ntreetype->update_node(ntree, node); - else if (node->typeinfo && node->typeinfo->updatefunc) + else if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + /* clear update flag */ + node->update = 0; } -int NodeTagIDChanged(bNodeTree *ntree, ID *id) +int nodeUpdateID(bNodeTree *ntree, ID *id) { bNodeTreeType *ntreetype; bNode *node; int change = FALSE; - + if(ELEM(NULL, id, ntree)) return change; @@ -1558,6 +1562,8 @@ int NodeTagIDChanged(bNodeTree *ntree, ID *id) if(node->id==id) { change = TRUE; ntreetype->update_node(ntree, node); + /* clear update flag */ + node->update = 0; } } } @@ -1567,6 +1573,8 @@ int NodeTagIDChanged(bNodeTree *ntree, ID *id) change = TRUE; if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + /* clear update flag */ + node->update = 0; } } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 2c8975e9cb4..0041cd33c14 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -182,7 +182,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char // convert relative filenames to absolute filenames - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, basepath); // open the file @@ -240,7 +240,7 @@ void packAll(Main *bmain, ReportList *reports) } -/* +#if 0 // attempt to create a function that generates an unique filename // this will work when all funtions in fileops.c understand relative filenames... @@ -249,6 +249,7 @@ static char *find_new_name(char *name) { char tempname[FILE_MAXDIR + FILE_MAXFILE]; char *newname; + size_t len; if (fop_exists(name)) { for (number = 1; number <= 999; number++) { @@ -258,14 +259,12 @@ static char *find_new_name(char *name) } } } - - newname = mallocN(strlen(tempname) + 1, "find_new_name"); - strcpy(newname, tempname); - - return(newname); + len= strlen(tempname) + 1; + newname = MEM_mallocN(len, "find_new_name"); + memcpy(newname, tempname, len * sizeof(char)); + return newname; } - -*/ +#endif int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, int guimode) { @@ -277,12 +276,12 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i if (guimode) {} //XXX waitcursor(1); - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, G.main->name); if (BLI_exists(name)) { for (number = 1; number <= 999; number++) { - sprintf(tempname, "%s.%03d_", name, number); + BLI_snprintf(tempname, sizeof(tempname), "%s.%03d_", name, number); if (! BLI_exists(tempname)) { if (BLI_copy_fileops(name, tempname) == RET_OK) { remove_tmp = TRUE; @@ -342,7 +341,7 @@ int checkPackedFile(const char *filename, PackedFile *pf) char buf[4096]; char name[FILE_MAXDIR + FILE_MAXFILE]; - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, G.main->name); if (stat(name, &st)) { @@ -392,9 +391,10 @@ there was an error or when the user desides to cancel the operation. */ -char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFile *pf, int how) +char *unpackFile(ReportList *reports, const char *abs_name, const char *local_name, PackedFile *pf, int how) { - char *newname = NULL, *temp = NULL; + char *newname = NULL; + const char *temp = NULL; // char newabs[FILE_MAXDIR + FILE_MAXFILE]; // char newlocal[FILE_MAXDIR + FILE_MAXFILE]; @@ -437,12 +437,11 @@ char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFi } if (temp) { - newname = MEM_mallocN(strlen(temp) + 1, "unpack_file newname"); - strcpy(newname, temp); + newname= BLI_strdup(temp); } } - return (newname); + return newname; } @@ -453,17 +452,17 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how) int ret_value = RET_ERROR; if (vfont != NULL) { - strcpy(localname, vfont->name); + BLI_strncpy(localname, vfont->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//fonts/%s", fi); + BLI_snprintf(localname, sizeof(localname), "//fonts/%s", fi); newname = unpackFile(reports, vfont->name, localname, vfont->packedfile, how); if (newname != NULL) { ret_value = RET_OK; freePackedFile(vfont->packedfile); vfont->packedfile = NULL; - strcpy(vfont->name, newname); + BLI_strncpy(vfont->name, newname, sizeof(vfont->name)); MEM_freeN(newname); } } @@ -478,13 +477,13 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) int ret_value = RET_ERROR; if (sound != NULL) { - strcpy(localname, sound->name); + BLI_strncpy(localname, sound->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//sounds/%s", fi); + BLI_snprintf(localname, sizeof(localname), "//sounds/%s", fi); newname = unpackFile(reports, sound->name, localname, sound->packedfile, how); if (newname != NULL) { - strcpy(sound->name, newname); + BLI_strncpy(sound->name, newname, sizeof(sound->name)); MEM_freeN(newname); freePackedFile(sound->packedfile); @@ -506,16 +505,16 @@ int unpackImage(ReportList *reports, Image *ima, int how) int ret_value = RET_ERROR; if (ima != NULL) { - strcpy(localname, ima->name); + BLI_strncpy(localname, ima->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//textures/%s", fi); - + BLI_snprintf(localname, sizeof(localname), "//textures/%s", fi); + newname = unpackFile(reports, ima->name, localname, ima->packedfile, how); if (newname != NULL) { ret_value = RET_OK; freePackedFile(ima->packedfile); ima->packedfile = NULL; - strcpy(ima->name, newname); + BLI_strncpy(ima->name, newname, sizeof(ima->name)); MEM_freeN(newname); BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 54af061dedb..66850238284 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -69,7 +69,6 @@ #include "BLI_listbase.h" #include "BLI_threads.h" #include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */ -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_edgehash.h" diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index bc5bc87b1fa..8e5452e2704 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2891,24 +2891,24 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) char ext[MAX_PTCACHE_PATH]; /* save old name */ - strcpy(old_name, pid->cache->name); + BLI_strncpy(old_name, pid->cache->name, sizeof(old_name)); /* get "from" filename */ - strcpy(pid->cache->name, from); + BLI_strncpy(pid->cache->name, from, sizeof(pid->cache->name)); len = ptcache_filename(pid, old_filename, 0, 0, 0); /* no path */ ptcache_path(pid, path); dir = opendir(path); if(dir==NULL) { - strcpy(pid->cache->name, old_name); + BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name)); return; } BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); /* put new name into cache */ - strcpy(pid->cache->name, to); + BLI_strncpy(pid->cache->name, to, sizeof(pid->cache->name)); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2963,7 +2963,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) if(cache->index >= 0) BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); else - strcpy(ext, PTCACHE_EXT); + BLI_strncpy(ext, PTCACHE_EXT, sizeof(ext)); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index cdf2e39a4dd..e0e2876f79e 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -166,7 +166,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) int i= 0; /* strip numbers */ - strcpy(base_name, prop->name); + BLI_strncpy(base_name, prop->name, sizeof(base_name)); for(i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) { base_name[i]= '\0'; } @@ -178,7 +178,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) strcat(new_name, num); } while(get_property__internal(first, prop, new_name)); - strcpy(prop->name, new_name); + BLI_strncpy(prop->name, new_name, sizeof(prop->name)); } } } @@ -257,7 +257,7 @@ void set_property(bProperty *prop, char *str) *((float *)&prop->data)= (float)atof(str); break; case GPROP_STRING: - strcpy(prop->poin, str); + strcpy(prop->poin, str); /* TODO - check size? */ break; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 00534400cf1..a7c19130929 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -866,8 +866,8 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) SeqUniqueInfo sui; char *dot; sui.seq= seq; - strcpy(sui.name_src, seq->name+2); - strcpy(sui.name_dest, seq->name+2); + BLI_strncpy(sui.name_src, seq->name+2, sizeof(sui.name_src)); + BLI_strncpy(sui.name_dest, seq->name+2, sizeof(sui.name_dest)); sui.count= 1; sui.match= 1; /* assume the worst to start the loop */ @@ -887,7 +887,7 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui); } - strcpy(seq->name+2, sui.name_dest); + BLI_strncpy(seq->name+2, sui.name_dest, sizeof(seq->name)-2); } static const char *give_seqname_by_type(int type) @@ -1204,7 +1204,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, sorry folks, please rebuild your proxies... */ if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { - strcpy(dir, seq->strip->proxy->dir); + BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); } else if (seq->type == SEQ_IMAGE) { BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); } else { @@ -3360,9 +3360,9 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) SWAP(Sequence, *seq_a, *seq_b); /* swap back names so animation fcurves dont get swapped */ - strcpy(name, seq_a->name+2); - strcpy(seq_a->name+2, seq_b->name+2); - strcpy(seq_b->name+2, name); + BLI_strncpy(name, seq_a->name+2, sizeof(name)); + BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2); + BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2); /* swap back opacity, and overlay mode */ SWAP(int, seq_a->blend_mode, seq_b->blend_mode); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 002a4b7ec5a..889db8eb035 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -812,13 +812,12 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData } } +#ifdef WITH_SMOKE // forward decleration static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct); static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct); -#ifdef WITH_SMOKE - static int get_lamp(Scene *scene, float *light) { Base *base_tmp = NULL; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 65b4a21d0ee..8787ec07d9c 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -68,6 +68,7 @@ variables on the UI for now #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BLI_threads.h" diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 07df12d5468..02e381fe9b4 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -79,9 +79,9 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename) char str[FILE_MAX]; char *path; - int len; + size_t len; - strcpy(str, filename); + BLI_strncpy(str, filename, sizeof(str)); path = /*bmain ? bmain->name :*/ G.main->name; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index d344f79bb6c..7d720aed62c 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -992,7 +992,7 @@ void autotexname(Tex *tex) if(tex->type==TEX_IMAGE) { ima= tex->ima; if(ima) { - strcpy(di, ima->name); + BLI_strncpy(di, ima->name, sizeof(di)); BLI_splitdirstring(di, fi); strcpy(di, "I."); strcat(di, fi); diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index ba5d04f3021..cda7a51c47f 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -74,6 +74,8 @@ extern "C" { #include "BLI_string.h" +#include "BLI_string_utf8.h" + #include "BLI_path_util.h" #include "BLI_storage.h" diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index e4afc6ad79b..e4ef834822f 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -39,13 +39,6 @@ extern "C" { #endif -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "BLI_mempool.h" -#include "BLI_blenlib.h" - typedef unsigned int (*GHashHashFP) (const void *key); typedef int (*GHashCmpFP) (const void *a, const void *b); typedef void (*GHashKeyFreeFP) (void *key); diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 3ac8dba106a..958f240e3a8 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -25,9 +25,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * - * $Id$ -*/ + */ #ifndef BLI_STRING_H #define BLI_STRING_H @@ -142,16 +140,6 @@ void BLI_timestr(double _time, char *str); /* time var is global */ void BLI_ascii_strtolower(char *str, int len); void BLI_ascii_strtoupper(char *str, int len); - -/* string_utf8.c - may move these into their own header some day - campbell */ -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 } #endif diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h new file mode 100644 index 00000000000..b7a9c204bfe --- /dev/null +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -0,0 +1,55 @@ +/* + * $Id: + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BLI_STRING_UTF8_H +#define BLI_STRING_UTF8_H + +/** \file BLI_string_utf8.h + * \ingroup bli + */ + +#ifdef __cplusplus +extern "C" { +#endif + +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); + + /* wchar_t functions, copied from blenders own font.c originally */ +size_t BLI_wstrlen_utf8(const wchar_t *src); +size_t BLI_strlen_utf8(const char *strc); +size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy); +size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst, const char *src, const size_t maxcpy); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index d6975ac38a1..f427be6baf5 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -222,7 +222,7 @@ # else # define _dummy_abort() (void)0 # endif -# ifdef __GNUC__ /* just want to check if __func__ is available */ +# if defined(__GNUC__) || defined(_MSC_VER) /* just want to check if __func__ is available */ # define BLI_assert(a) \ do { \ if (!(a)) { \ diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index e8de8f52655..3620abf41ad 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -134,6 +134,7 @@ set(SRC BLI_storage.h BLI_storage_types.h BLI_string.h + BLI_string_utf8.h BLI_threads.h BLI_utildefines.h BLI_uvproject.h diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index cf3605a80ff..00903aa42cd 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -35,12 +35,13 @@ #include <ctype.h> /* for tolower */ +#include <string.h> #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include "BLI_listbase.h" #include "BLI_string.h" -#include "BLI_utildefines.h" #include "BLI_args.h" #include "BLI_ghash.h" diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index dd685c606d2..3a423135d5e 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -32,11 +32,20 @@ * \ingroup bli */ +#include <string.h> +#include <stdlib.h> + #include "MEM_guardedalloc.h" + + +// #include "BLI_blenlib.h" + +#include "BLI_mempool.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" + #include "BLO_sys_types.h" // for intptr_t support /***/ diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 9ccd7fbe121..e848ad8d0d3 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -227,7 +227,7 @@ int BLI_move(const char *file, const char *to) { // it has to be 'mv filename filename' and not // 'mv filename destdir' - strcpy(str, to); + BLI_strncpy(str, to, sizeof(str)); // points 'to' to a directory ? if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(file) != NULL) { @@ -252,7 +252,7 @@ int BLI_copy_fileops(const char *file, const char *to) { // it has to be 'cp filename filename' and not // 'cp filename destdir' - strcpy(str, to); + BLI_strncpy(str, to, sizeof(str)); // points 'to' to a directory ? if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(file) != NULL) { @@ -286,7 +286,7 @@ void BLI_recurdir_fileops(const char *dirname) { // blah1/blah2/ (with slash) after creating // blah1/blah2 (without slash) - strcpy(tmp, dirname); + BLI_strncpy(tmp, dirname, sizeof(tmp)); lslash= BLI_last_slash(tmp); if (lslash == tmp + strlen(tmp) - 1) { @@ -371,7 +371,7 @@ void BLI_recurdir_fileops(const char *dirname) { if (BLI_exists(dirname)) return; - strcpy(tmp, dirname); + BLI_strncpy(tmp, dirname, sizeof(tmp)); lslash= BLI_last_slash(tmp); if (lslash) { diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 0fe028eb3c0..7e5d03423e5 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -364,7 +364,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) // get the name fontname = FT_Get_Postscript_Name(face); - strcpy(vfd->name, (fontname == NULL) ? "" : fontname); + BLI_strncpy(vfd->name, (fontname == NULL) ? "" : fontname, sizeof(vfd->name)); // Extract the first 256 character from TTF lcode= charcode= FT_Get_First_Char(face, &glyph_index); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e336b914ffa..7638e95b4ec 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -304,15 +304,15 @@ void BLI_adddirstrings(void) for(num=0, file= files; num<actnum; num++, file++){ #ifdef WIN32 mode = 0; - strcpy(file->mode1, types[0]); - strcpy(file->mode2, types[0]); - strcpy(file->mode3, types[0]); + BLI_strncpy(file->mode1, types[0], sizeof(file->mode1)); + BLI_strncpy(file->mode2, types[0], sizeof(file->mode2)); + BLI_strncpy(file->mode3, types[0], sizeof(file->mode3)); #else mode = file->s.st_mode; - strcpy(file->mode1, types[(mode & 0700) >> 6]); - strcpy(file->mode2, types[(mode & 0070) >> 3]); - strcpy(file->mode3, types[(mode & 0007)]); + BLI_strncpy(file->mode1, types[(mode & 0700) >> 6], sizeof(file->mode1)); + BLI_strncpy(file->mode2, types[(mode & 0070) >> 3], sizeof(file->mode2)); + BLI_strncpy(file->mode3, types[(mode & 0007)], sizeof(file->mode3)); if (((mode & S_ISGID) == S_ISGID) && (file->mode2[2]=='-'))file->mode2[2]='l'; diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index dc6cb0ef228..f331d13e580 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -31,6 +31,8 @@ */ #include <string.h> +#include <wchar.h> +#include <wctype.h> #include "BLI_string.h" @@ -183,6 +185,159 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) return dst_r; } + +/* --------------------------------------------------------------------------*/ +/* wchar_t / utf8 functions */ + +/* UTF-8 <-> wchar transformations */ +static size_t chtoutf8(const unsigned long c, char o[4]) +{ + // Variables and initialization +/* memset(o, 0, 4); */ + + // Create the utf-8 string + if (c < 0x80) { + o[0] = (char) c; + return 1; + } + else if (c < 0x800) { + o[0] = (0xC0 | (c>>6)); + o[1] = (0x80 | (c & 0x3f)); + return 2; + } + else if (c < 0x10000) { + o[0] = (0xe0 | (c >> 12)); + o[1] = (0x80 | (c >>6 & 0x3f)); + o[2] = (0x80 | (c & 0x3f)); + return 3; + } + else if (c < 0x200000) { + o[0] = (0xf0 | (c>>18)); + o[1] = (0x80 | (c >>12 & 0x3f)); + o[2] = (0x80 | (c >> 6 & 0x3f)); + o[3] = (0x80 | (c & 0x3f)); + return 4; + } + + /* should we assert here? */ + return 0; +} + +size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy) +{ + size_t len = 0; + while(*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isnt known :| */ + len += chtoutf8(*src++, dst+len); + } + + dst[len]= '\0'; + + return len; +} + +/* wchar len in utf8 */ +size_t BLI_wstrlen_utf8(const wchar_t *src) +{ + char ch_dummy[4]; + size_t len = 0; + + while(*src) { + len += chtoutf8(*src++, ch_dummy); + } + + return len; +} + +// utf8slen +size_t BLI_strlen_utf8(const char *strc) +{ + int len=0; + + while(*strc) { + if ((*strc & 0xe0) == 0xc0) { + if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00) + strc++; + } else if ((*strc & 0xf0) == 0xe0) { + if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00) + strc += 2; + } else if ((*strc & 0xf8) == 0xf0) { + if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00) + strc += 3; + } + + strc++; + len++; + } + + return len; +} + + +/* Converts Unicode to wchar + +According to RFC 3629 "UTF-8, a transformation format of ISO 10646" +(http://tools.ietf.org/html/rfc3629), the valid UTF-8 encoding are: + + Char. number range | UTF-8 octet sequence + (hexadecimal) | (binary) + --------------------+--------------------------------------------- + 0000 0000-0000 007F | 0xxxxxxx + 0000 0080-0000 07FF | 110xxxxx 10xxxxxx + 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx + 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + +If the encoding incidated by the first character is incorrect (because the +1 to 3 following characters do not match 10xxxxxx), the output is a '?' and +only a single input character is consumed. + +*/ + +size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxcpy) +{ + int len=0; + + if(dst_w==NULL || src_c==NULL) return(0); + + while(*src_c && len < maxcpy) { + if ((*src_c & 0xe0) == 0xc0) { + if((src_c[1] & 0x80) && (src_c[1] & 0x40) == 0x00) { + *dst_w=((src_c[0] &0x1f)<<6) | (src_c[1]&0x3f); + src_c++; + } else { + *dst_w = '?'; + } + } else if ((*src_c & 0xf0) == 0xe0) { + if((src_c[1] & src_c[2] & 0x80) && ((src_c[1] | src_c[2]) & 0x40) == 0x00) { + *dst_w=((src_c[0] & 0x0f)<<12) | ((src_c[1]&0x3f)<<6) | (src_c[2]&0x3f); + src_c += 2; + } else { + *dst_w = '?'; + } + } else if ((*src_c & 0xf8) == 0xf0) { + if((src_c[1] & src_c[2] & src_c[3] & 0x80) && ((src_c[1] | src_c[2] | src_c[3]) & 0x40) == 0x00) { + *dst_w=((src_c[0] & 0x07)<<18) | ((src_c[1]&0x1f)<<12) | ((src_c[2]&0x3f)<<6) | (src_c[3]&0x3f); + src_c += 3; + } else { + *dst_w = '?'; + } + } else { + *dst_w=(src_c[0] & 0x7f); + } + + src_c++; + dst_w++; + len++; + } + return len; +} + +/* end wchar_t / utf8 functions */ +/* --------------------------------------------------------------------------*/ + + + + + /* copied from glib */ /** * g_utf8_find_prev_char: diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index e7be98d955d..2799b2165f0 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -252,7 +252,7 @@ void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendH void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); -BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports); +BlendFileData* blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenloader/BLO_runtime.h b/source/blender/blenloader/BLO_runtime.h index 920b14e92fa..0a3ceeefa78 100644 --- a/source/blender/blenloader/BLO_runtime.h +++ b/source/blender/blenloader/BLO_runtime.h @@ -42,8 +42,8 @@ extern "C" { struct BlendFileData; struct ReportList; -int BLO_is_a_runtime(char *file); -struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports); +int BLO_is_a_runtime(const char *file); +struct BlendFileData *BLO_read_runtime(const char *file, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 0e93e5fa8c0..ded5a95df5a 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -44,6 +44,8 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "BLI_linklist.h" @@ -288,7 +290,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil fd = blo_openblendermemfile(memfile, reports); if (fd) { fd->reports= reports; - strcpy(fd->relabase, filename); + BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase)); /* clear ob->proxy_from pointers in old main */ blo_clear_proxy_pointers_from_lib(oldmain); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 1eccf3c182c..20ddca60cfe 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9341,7 +9341,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) simasel->prv_h = 96; simasel->prv_w = 96; simasel->flag = 7; /* ??? elubie */ - strcpy (simasel->dir, U.textudir); /* TON */ + BLI_strncpy (simasel->dir, U.textudir, sizeof(simasel->dir)); /* TON */ simasel->file[0]= '\0'; simasel->returnfunc = NULL; @@ -9564,7 +9564,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct->tar = data->tar; - strcpy(ct->subtarget, data->subtarget); + BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget)); ct->space = con->tarspace; BLI_addtail(&data->targets, ct); @@ -9594,7 +9594,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct->tar = data->tar; - strcpy(ct->subtarget, data->subtarget); + BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget)); ct->space = con->tarspace; BLI_addtail(&data->targets, ct); @@ -10281,8 +10281,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { if(scene->ed && scene->ed->seqbasep) { - for(seq = scene->ed->seqbasep->first; seq; seq = seq->next) - { + SEQ_BEGIN(scene->ed, seq) { if(seq->type == SEQ_HD_SOUND) { char str[FILE_MAX]; @@ -10302,6 +10301,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) seq->strip->dir); } } + SEQ_END } } @@ -12074,8 +12074,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) aa->flag = ia->flag; aa->sta = ia->sta; aa->end = ia->end; - strcpy(aa->name, ia->name); - strcpy(aa->frameProp, ia->frameProp); + BLI_strncpy(aa->name, ia->name, sizeof(aa->name)); + BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp)); if (ob->adt) aa->act = ob->adt->action; @@ -13717,8 +13717,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) printf(" enter a new path:\n"); if(scanf("%s", newlib_path) > 0) { - strcpy(mainptr->curlib->name, newlib_path); - strcpy(mainptr->curlib->filepath, newlib_path); + BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name)); + BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath)); cleanup_path(G.main->name, mainptr->curlib->filepath); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); @@ -13834,7 +13834,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) /* reading runtime */ -BlendFileData *blo_read_blendafterruntime(int file, char *name, int actualsize, ReportList *reports) +BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actualsize, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd = filedata_new(); diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c index f5308b5ea5c..7a241e007f2 100644 --- a/source/blender/blenloader/intern/runtime.c +++ b/source/blender/blenloader/intern/runtime.c @@ -68,7 +68,7 @@ static int handle_read_msb_int(int handle) return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0); } -int BLO_is_a_runtime(char *path) +int BLO_is_a_runtime(const char *path) { int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0); int datastart; @@ -97,7 +97,7 @@ cleanup: return res; } -BlendFileData *BLO_read_runtime(char *path, ReportList *reports) +BlendFileData *BLO_read_runtime(const char *path, ReportList *reports) { BlendFileData *bfd= NULL; size_t actualsize; diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index f3a6e2371bb..dec93c0ff63 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -691,7 +691,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); else - strcpy(rna_path, tm_str); + BLI_strncpy(rna_path, tm_str, sizeof(rna_path)); newcu[i] = create_fcurve(axis, rna_path); newcu[i]->totvert = frames.size(); } @@ -1246,7 +1246,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node, if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); else - strcpy(rna_path, tm_str); + BLI_strncpy(rna_path, tm_str, sizeof(rna_path)); newcu[i] = create_fcurve(axis, rna_path); #ifdef ARMATURE_TEST diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index d687b0689ff..25d4874379d 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -824,7 +824,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } else if (strcmp(ct->subtarget, pchan->name)==0) { ct->tar = tarArm; - strcpy(ct->subtarget, curbone->name); + BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget)); } } } @@ -871,7 +871,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } else if (strcmp(ct->subtarget, pchan->name)==0) { ct->tar = tarArm; - strcpy(ct->subtarget, curbone->name); + BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget)); } } } @@ -2503,7 +2503,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj */ if (oldtarget->temp) { newtarget = (EditBone *) oldtarget->temp; - strcpy(ct->subtarget, newtarget->name); + BLI_strncpy(ct->subtarget, newtarget->name, sizeof(ct->subtarget)); } } } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index bf2e17c4e87..e7c7ebf3ece 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -997,11 +997,8 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) } /* get marker name */ - if (pld->marker) - strcpy(markern, pld->marker->name); - else - strcpy(markern, "No Matches"); - + BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern)); + sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern); ED_area_headerprint(pld->sa, pld->headerstr); } @@ -1186,7 +1183,7 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm /* backup stuff that needs to occur before every operation * - make a copy of searchstr, so that we know if cache needs to be rebuilt */ - strcpy(pld->searchold, pld->searchstr); + BLI_strncpy(pld->searchold, pld->searchstr, sizeof(pld->searchold)); /* if we're currently showing the original pose, only certain events are handled */ if (pld->flag & PL_PREVIEW_SHOWORIGINAL) { diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 61935aa72ca..a978f327993 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1197,7 +1197,7 @@ void POSE_OT_paste (wmOperatorType *ot) /* identifiers */ ot->name= "Paste Pose"; ot->idname= "POSE_OT_paste"; - ot->description= "Pastes the stored pose on to the current pose"; + ot->description= "Paste the stored pose on to the current pose"; /* api callbacks */ ot->exec= pose_paste_exec; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index ffb544d5570..05b59f2a2d5 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -221,13 +221,13 @@ static void update_string(Curve *cu) MEM_freeN(cu->str); // Calculate the actual string length in UTF-8 variable characters - len = wcsleninu8(ef->textbuf); + len = BLI_wstrlen_utf8(ef->textbuf); // Alloc memory for UTF-8 variable char length string cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); // Copy the wchar to UTF-8 - wcs2utf8s(cu->str, ef->textbuf); + BLI_strncpy_wchar_as_utf8(cu->str, ef->textbuf, len + 1); } static int insert_into_textbuf(Object *obedit, uintptr_t c) @@ -373,7 +373,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename) if(cu->len+filelen<MAXTEXT) { int tmplen; wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary"); - tmplen = utf8towchar(mem, strp); + tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1); wcscat(ef->textbuf, mem); MEM_freeN(mem); cu->len += tmplen; @@ -1046,7 +1046,7 @@ void FONT_OT_change_spacing(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increasing character spacing with", -20, 20); + RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increase character spacing with", -20, 20); } /************************* change character **********************/ @@ -1241,10 +1241,10 @@ static int insert_text_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0); - len= strlen(inserted_utf8); + len= BLI_strlen_utf8(inserted_utf8); inserted_text= MEM_callocN(sizeof(wchar_t)*(len+1), "FONT_insert_text"); - utf8towchar(inserted_text, inserted_utf8); + BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len+1); for(a=0; a<len; a++) insert_into_textbuf(obedit, inserted_text[a]); @@ -1289,10 +1289,22 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) else if(event==BACKSPACEKEY) ascii= 0; - if(val && ascii) { + if(val && (ascii || evt->utf8_buf[0])) { /* handle case like TAB (== 9) */ - if((ascii > 31 && ascii < 254 && ascii != 127) || (ascii==13) || (ascii==10) || (ascii==8)) { - if(accentcode) { + if( (ascii > 31 && ascii < 254 && ascii != 127) || + (ascii==13) || + (ascii==10) || + (ascii==8) || + (evt->utf8_buf[0])) + { + + if (evt->utf8_buf[0]) { + BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1); + ascii= inserted_text[0]; + insert_into_textbuf(obedit, ascii); + accentcode= 0; + } + else if(accentcode) { if(cu->pos>0) { inserted_text[0]= findaccent(ef->textbuf[cu->pos-1], ascii); ef->textbuf[cu->pos-1]= inserted_text[0]; @@ -1348,7 +1360,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) /* store as utf8 in RNA string */ char inserted_utf8[8] = {0}; - wcs2utf8s(inserted_utf8, inserted_text); + BLI_strncpy_wchar_as_utf8(inserted_utf8, inserted_text, sizeof(inserted_utf8)); RNA_string_set(op->ptr, "text", inserted_utf8); } @@ -1478,7 +1490,7 @@ void make_editText(Object *obedit) } // Convert the original text to wchar_t - utf8towchar(ef->textbuf, cu->str); + BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT+4); /* length is bogus */ wcscpy(ef->oldstr, ef->textbuf); cu->len= wcslen(ef->textbuf); diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index b6398c6a2f5..56210864593 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -311,7 +311,7 @@ void copy_gpdata () gpln= MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer"); gpln->frames.first= gpln->frames.last= NULL; - strcpy(gpln->info, gpls->info); + BLI_strncpy(gpln->info, gpls->info, sizeof(gpln->info)); BLI_addtail(&gpcopybuf, gpln); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b6c72c2e96f..16edd0a1a9e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1747,7 +1747,9 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) } else if(but->type == TEX) { /* string */ - BLI_strncpy(but->poin, str, but->hardmax); + if(ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax); + else BLI_strncpy(but->poin, str, but->hardmax); + return 1; } else if(but->type == SEARCH_MENU) { @@ -2559,6 +2561,24 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, if(block->curlayout) ui_layout_add_but(block->curlayout, but); +#ifdef WITH_PYTHON_UI_INFO + { + extern void PyC_FileAndNum_Safe(const char **filename, int *lineno); + + const char *fn; + int lineno= -1; + PyC_FileAndNum_Safe(&fn, &lineno); + if (lineno != -1) { + BLI_strncpy(but->py_dbg_fn, fn, sizeof(but->py_dbg_fn)); + but->py_dbg_ln= lineno; + } + else { + but->py_dbg_fn[0]= '\0'; + but->py_dbg_ln= -1; + } + } +#endif /* WITH_PYTHON_UI_INFO */ + return but; } diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 6c661ba014e..aeb8ad99dd2 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -38,6 +38,7 @@ #include "BLI_listbase.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -115,7 +116,7 @@ int ui_but_anim_expression_set(uiBut *but, const char *str) driver= fcu->driver; if(driver && driver->type == DRIVER_TYPE_PYTHON) { - BLI_strncpy(driver->expression, str, sizeof(driver->expression)); + BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); driver->flag |= DRIVER_FLAG_RECOMPILE; WM_event_add_notifier(but->block->evil_C, NC_ANIMATION|ND_KEYFRAME, NULL); return 1; @@ -164,7 +165,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) /* set the expression */ // TODO: need some way of identifying variables used - BLI_strncpy(driver->expression, str, sizeof(driver->expression)); + BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); /* FIXME: for now, assume that * - for expressions, users are likely to be using "frame" -> current frame" as a variable diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index a40900fb39b..aefe773fdad 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -600,13 +600,13 @@ static void ui_draw_but_CHARTAB(uiBut *but) wstr[0] = cs; if(strcmp(G.selfont->name, FO_BUILTIN_NAME)) { - wcs2utf8s((char *)ustr, (wchar_t *)wstr); + BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } else { if(G.ui_international == TRUE) { - wcs2utf8s((char *)ustr, (wchar_t *)wstr); + BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } else { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f4400d2d7db..c02bbafce15 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -107,6 +107,12 @@ typedef enum uiHandleButtonState { BUTTON_STATE_EXIT } uiHandleButtonState; +typedef enum uiButtonJumpType { + BUTTON_EDIT_JUMP_NONE, + BUTTON_EDIT_JUMP_DELIM, + BUTTON_EDIT_JUMP_ALL +} uiButtonJumpType; + typedef struct uiHandleButtonData { wmWindowManager *wm; wmWindow *window; @@ -260,7 +266,7 @@ static int ui_is_a_warp_but(uiBut *but) } /* file selectors are exempt from utf-8 checks */ -static int ui_is_utf8_but(uiBut *but) +int ui_is_but_utf8(uiBut *but) { if (but->rnaprop) { const int subtype= RNA_property_subtype(but->rnaprop); @@ -1163,7 +1169,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } else { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); - BLI_strncpy(active_data->str, buf, active_data->maxlen); + + if(ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen); + else BLI_strncpy(active_data->str, buf, active_data->maxlen); + if(but->type == SEARCH_MENU) { /* else uiSearchboxData.active member is not updated [#26856] */ ui_searchbox_update(C, data->searchbox, but, 1); @@ -1282,18 +1291,18 @@ static int ui_textedit_step_prev_utf8(const char *str, size_t UNUSED(maxlen), sh 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) + uiButtonJumpType jump) { const short pos_prev= *pos; if(direction) { /* right*/ - if(do_jump) { + if(jump != BUTTON_EDIT_JUMP_NONE) { /* 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; + if((jump != BUTTON_EDIT_JUMP_ALL) && test_special_char(str[(*pos)])) break; } else { break; /* unlikely but just incase */ @@ -1305,7 +1314,7 @@ static void ui_textedit_step_utf8(const char *str, size_t maxlen, } } else { /* left */ - if(do_jump) { + if(jump != BUTTON_EDIT_JUMP_NONE) { /* left only: compensate for index/change in direction */ ui_textedit_step_prev_utf8(str, maxlen, pos); @@ -1314,7 +1323,7 @@ static void ui_textedit_step_utf8(const char *str, size_t maxlen, * 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; + if((jump != BUTTON_EDIT_JUMP_ALL) && test_special_char(str[(*pos)])) break; } else { break; @@ -1428,27 +1437,28 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, ui_check_but(but); } -static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) +/* note: utf8 & ascii funcs should be merged */ +static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const char utf8_buf[6]) { char *str; - int len, x, changed= 0; + int len, changed= 0; str= data->str; len= strlen(str); if(len-(but->selend - but->selsta)+1 <= data->maxlen) { + int step= BLI_strnlen(utf8_buf, sizeof(utf8_buf)); + /* type over the current selection */ - if ((but->selend - but->selsta) > 0) + if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); + len= strlen(str); + } - len= strlen(str); - if(len+1 < data->maxlen) { - for(x= data->maxlen; x>but->pos; x--) - str[x]= str[x-1]; - str[but->pos]= ascii; - str[len+1]= '\0'; - - but->pos++; + if(len + step < data->maxlen) { + memmove(&str[but->pos + step], &str[but->pos], (len + 1) - but->pos); + memcpy(&str[but->pos], utf8_buf, step * sizeof(char)); + but->pos += step; changed= 1; } } @@ -1456,7 +1466,13 @@ 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, int jump_all) +static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) +{ + char utf8_buf[6]= {ascii, '\0'}; + return ui_textedit_type_utf8(but, data, utf8_buf); +} + +static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, uiButtonJumpType jump) { const char *str= data->str; const int len= strlen(str); @@ -1465,7 +1481,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction /* special case, quit selection and set cursor */ if (has_sel && !select) { - if (jump_all) { + if (jump == BUTTON_EDIT_JUMP_ALL) { but->selsta = but->selend= but->pos = direction ? len : 0; } else { @@ -1479,7 +1495,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction data->selextend = 0; } else { - ui_textedit_step_utf8(str, len, &but->pos, direction, jump, jump_all); + ui_textedit_step_utf8(str, len, &but->pos, direction, jump); if(select) { /* existing selection */ @@ -1528,35 +1544,33 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction } } -static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, const int all, const int jump) +static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, uiButtonJumpType jump) { char *str= data->str; const int len= strlen(str); - int x, changed= 0; + int changed= 0; - if(all) { + if(jump == BUTTON_EDIT_JUMP_ALL) { if(len) changed=1; - str[0]= 0; + str[0]= '\0'; but->pos= 0; } else if(direction) { /* delete */ if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); } - else if(but->pos>=0 && but->pos<len) { + else if (but->pos>=0 && but->pos<len) { short pos= but->pos; int step; - ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + ui_textedit_step_utf8(str, len, &pos, direction, jump); step= pos - but->pos; - for(x=but->pos; x<len; x++) - str[x]= str[x+step]; - str[len-step]='\0'; + memmove(&str[but->pos], &str[but->pos + step], (len + 1) - but->pos); changed= 1; } } else { /* backspace */ - if(len!=0) { + if (len != 0) { if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); } @@ -1564,13 +1578,9 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio short pos= but->pos; int step; - ui_textedit_step_utf8(str, len, &pos, direction, jump, all); + ui_textedit_step_utf8(str, len, &pos, direction, jump); step= but->pos - pos; - - for(x=but->pos; x<len; x++) - str[x-step]= str[x]; - str[len-step]='\0'; - + memmove(&str[but->pos - step], &str[but->pos], (len + 1) - but->pos); but->pos -= step; changed= 1; } @@ -1680,19 +1690,9 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) ui_get_but_string(but, data->str, data->maxlen); if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { - /* XXX: we dont have utf editing yet so for numbers its best to strip out utf chars - * this is so the deg' synbol isnt included in number editing fields: bug 22274 */ - int i; - for(i=0; data->str[i]; i++) { - if(!isascii(data->str[i])) { - /* no stripping actually: just convert to alt name */ - ui_convert_to_unit_alt_name(but, data->str, data->maxlen); - break; - } - } + ui_convert_to_unit_alt_name(but, data->str, data->maxlen); } - - + data->origstr= BLI_strdup(data->str); data->selextend= 0; data->selstartx= 0; @@ -1717,7 +1717,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if(but) { - if(ui_is_utf8_but(but)) { + if(ui_is_but_utf8(but)) { int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); /* not a file?, strip non utf-8 chars */ if(strip) { @@ -1869,11 +1869,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, FALSE); + ui_textedit_move(but, data, 1, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case LEFTARROWKEY: - ui_textedit_move(but, data, 0, event->shift, event->ctrl, FALSE); + ui_textedit_move(but, data, 0, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case DOWNARROWKEY: @@ -1883,7 +1883,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case ENDKEY: - ui_textedit_move(but, data, 1, event->shift, TRUE, TRUE); + ui_textedit_move(but, data, 1, event->shift, BUTTON_EDIT_JUMP_ALL); retval= WM_UI_HANDLER_BREAK; break; case UPARROWKEY: @@ -1893,7 +1893,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case HOMEKEY: - ui_textedit_move(but, data, 0, event->shift, TRUE, TRUE); + ui_textedit_move(but, data, 0, event->shift, BUTTON_EDIT_JUMP_ALL); retval= WM_UI_HANDLER_BREAK; break; case PADENTER: @@ -1902,12 +1902,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval= WM_UI_HANDLER_BREAK; break; case DELKEY: - changed= ui_textedit_delete(but, data, 1, 0, event->ctrl); + changed= ui_textedit_delete(but, data, 1, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case BACKSPACEKEY: - changed= ui_textedit_delete(but, data, 0, event->shift, event->ctrl); + changed= ui_textedit_delete(but, data, 0, event->shift ? BUTTON_EDIT_JUMP_ALL : (event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE)); retval= WM_UI_HANDLER_BREAK; break; @@ -1930,7 +1930,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle break; } - if(event->ascii && (retval == WM_UI_HANDLER_CONTINUE)) { + if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) { char ascii = event->ascii; /* exception that's useful for number buttons, some keyboard @@ -1939,7 +1939,16 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->type == PADPERIOD && ascii == ',') ascii = '.'; - changed= ui_textedit_type_ascii(but, data, ascii); + if(event->utf8_buf[0]) { + /* keep this printf until utf8 is well tested */ + printf("%s: utf8 char '%s'\n", __func__, event->utf8_buf); + // strcpy(event->utf8_buf, "12345"); + changed= ui_textedit_type_utf8(but, data, event->utf8_buf); + } + else { + changed= ui_textedit_type_ascii(but, data, ascii); + } + retval= WM_UI_HANDLER_BREAK; } @@ -4438,6 +4447,17 @@ static int ui_but_menu(bContext *C, uiBut *but) } } +#ifdef WITH_PYTHON_UI_INFO + if (but->py_dbg_ln != -1) { + PointerRNA ptr_props; + + WM_operator_properties_create(&ptr_props, "WM_OT_text_edit"); + RNA_string_set(&ptr_props, "filepath", but->py_dbg_fn); + RNA_int_set(&ptr_props, "line", but->py_dbg_ln); + uiItemFullO(layout, "WM_OT_text_edit", "Edit Source", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0); + } +#endif /* WITH_PYTHON_UI_INFO */ + uiPupMenuEnd(C, pup); return 1; diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 12e9d39e896..b7a2227f98a 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -252,6 +252,11 @@ struct uiBut { /* pointer back */ uiBlock *block; + +#ifdef WITH_PYTHON_UI_INFO + char py_dbg_fn[240]; + int py_dbg_ln; +#endif }; struct uiBlock { @@ -368,6 +373,7 @@ extern void ui_check_but(uiBut *but); extern int ui_is_but_float(uiBut *but); extern int ui_is_but_unit(uiBut *but); extern int ui_is_but_rna_valid(uiBut *but); +extern int ui_is_but_utf8(uiBut *but); extern void ui_bounds_block(uiBlock *block); extern void ui_block_translate(uiBlock *block, int x, int y); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4dcdeab2169..e264146a6e3 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -38,8 +38,8 @@ #include "DNA_scene_types.h" #include "DNA_userdef_types.h" -#include "BLI_string.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "BKE_animsys.h" @@ -759,18 +759,28 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif if (mti->flags & eModifierTypeFlag_SupportsEditmode) uiItemR(row, &ptr, "show_in_editmode", 0, "", ICON_NONE); } - if ((ob->type==OB_MESH) && modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) - { - /* -- convert to rna ? */ - but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("Apply modifier to editing cage during Editmode"))); - if (index < cageIndex) - uiButSetFlag(but, UI_BUT_DISABLED); - uiButSetFunc(but, modifiers_setOnCage, ob, md); - } - /* tesselation point for curve-typed objects */ - if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { + if (ob->type==OB_MESH) { + if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) + { + /* -- convert to rna ? */ + but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, + UI_translate_do_tooltip(N_("Apply modifier to editing cage during Editmode"))); + if (index < cageIndex) + uiButSetFlag(but, UI_BUT_DISABLED); + uiButSetFunc(but, modifiers_setOnCage, ob, md); + } + else { + uiBlockEndAlign(block); + + /* place holder button */ + uiBlockSetEmboss(block, UI_EMBOSSN); + but= uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, NULL); + uiButSetFlag(but, UI_BUT_DISABLED); + uiBlockSetEmboss(block, UI_EMBOSS); + } + } /* tesselation point for curve-typed objects */ + else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { /* some modifiers could work with pre-tesselated curves only */ if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { /* add disabled pre-tesselated button, so users could have diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 9b9237f70cf..fd511948bac 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1151,7 +1151,7 @@ void init_userdef_do_versions(void) vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL); if (bmain->versionfile <= 191) { - strcpy(U.plugtexdir, U.textudir); + BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir)); strcpy(U.sounddir, "/"); } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 6c553289052..ec7c6cc6108 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -245,7 +245,7 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, const c for (ct=targets.first, i=0; ct; ct= ct->next, i++) { if (i == index) { ct->tar= target; - strcpy(ct->subtarget, subtarget); + BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget)); break; } } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 7eaa1e1de38..0b512661102 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -588,7 +588,7 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot) /* identifiers */ ot->name= "Toggle Pose Mode"; ot->idname= "OBJECT_OT_posemode_toggle"; - ot->description= "Enables or disables posing/selecting bones"; + ot->description= "Enable or disable posing/selecting bones"; /* api callbacks */ ot->exec= posemode_exec; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 1be95ad1654..d802510fa49 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -842,7 +842,7 @@ void OBJECT_OT_hook_select(wmOperatorType *ot) /* identifiers */ ot->name= "Select Hook"; - ot->description= "Selects effected vertices on mesh"; + ot->description= "Select affected vertices on mesh"; ot->idname= "OBJECT_OT_hook_select"; /* callbacks */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 16b7686f269..b75b7baaaa3 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -332,11 +332,9 @@ static int make_proxy_exec (bContext *C, wmOperator *op) /* Add new object for the proxy */ newob= add_object(scene, OB_EMPTY); - if (gob) - strcpy(name, gob->id.name+2); - else - strcpy(name, ob->id.name+2); - strcat(name, "_proxy"); + + BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name); + rename_id(&newob->id, name); /* set layers OK */ @@ -603,7 +601,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) /* handle types */ if (pchan) - strcpy(ob->parsubstr, pchan->name); + BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr)); else ob->parsubstr[0]= 0; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 72a5a944809..9ca43599cd6 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -671,7 +671,7 @@ static void vgroup_duplicate(Object *ob) } cdg = defgroup_duplicate(dg); - strcpy(cdg->name, name); + BLI_strncpy(cdg->name, name, sizeof(cdg->name)); defgroup_unique_name(cdg, ob); BLI_addtail(&ob->defbase, cdg); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 0b350e3afd0..d80f3fef125 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -398,13 +398,13 @@ static void render_endjob(void *rjv) ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1); /* XXX above function sets all tags in nodes */ - ntreeClearTags(rj->scene->nodetree); + ntreeCompositClearTags(rj->scene->nodetree); /* potentially set by caller */ rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE; if(rj->srl) { - NodeTagIDChanged(rj->scene->nodetree, &rj->scene->id); + nodeUpdateID(rj->scene->nodetree, &rj->scene->id); WM_main_add_notifier(NC_NODE|NA_EDITED, rj->scene); } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 70709a22d3d..697cddfcee0 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -261,7 +261,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sce->r.alphamode= R_ADDSKY; sce->r.cfra= scene->r.cfra; - strcpy(sce->r.engine, scene->r.engine); + BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); if(id_type==ID_MA) { Material *mat= NULL, *origmat= (Material *)id; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f8df5409af1..9205483a203 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -647,7 +647,7 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot) ot->flag= OPTYPE_BLOCKING; - RNA_def_int(ot->srna, "modifier", 0, 0, 2, "modifier", "modifier state", 0, 2); + RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2); } /* ************** swap area operator *********************************** */ diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 3010adafe20..27c311aa04f 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -157,7 +157,7 @@ static int screenshot_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); - strcpy(G.ima, path); + BLI_strncpy(G.ima, path, sizeof(G.ima)); BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 252109eb6de..c88c118e874 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -401,7 +401,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile"); - strcpy(tile->idname, ima->id.name); + BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname)); tile->x= x_tile; tile->y= y_tile; @@ -409,7 +409,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char); tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect"); - strcpy(tile->ibufname, ibuf->name); + BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname)); tile->gen_type= ima->gen_type; tile->source= ima->source; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 9a974c638a3..0299c89619d 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -39,6 +39,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BLI_threads.h" @@ -262,7 +264,7 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node) } unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode"); - strcpy(unode->idname, ob->id.name); + BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname)); unode->node= node; BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index aa2ea124fe0..bd9a38ab27e 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -44,7 +44,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BLI_dynstr.h" -#include "BLI_string.h" #ifdef WIN32 #include <windows.h> /* need to include windows.h so _WIN32_IE is defined */ diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 71d9dd3adcb..beeb5e3532f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -704,8 +704,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char sprintf(str, "(%d) Frames:", iuser->framenr); else strcpy(str, "Frames:"); uiBlockBeginAlign(block); - uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Sets the number of images of a movie to use"); - uiDefButI(block, NUM, imagechanged, "StartFr:", 160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Sets the global starting frame of the movie"); + uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use"); + uiDefButI(block, NUM, imagechanged, "StartFr:", 160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie"); } #endif } diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index d0a80cddf56..52930626964 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -160,7 +160,7 @@ void INFO_OT_select_pick(wmOperatorType *ot) /* ot->flag= OPTYPE_REGISTER; */ /* properties */ - RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "The index of the report", 0, INT_MAX); + RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the report", 0, INT_MAX); } diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index b7f9af09348..b1c0dd02e4b 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -478,7 +478,7 @@ static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e static void LOGIC_OT_actuator_remove(wmOperatorType *ot) { ot->name= "Remove Actuator"; - ot->description= "Remove a actuator from the active object"; + ot->description= "Remove an actuator from the active object"; ot->idname= "LOGIC_OT_actuator_remove"; ot->invoke= actuator_remove_invoke; @@ -533,7 +533,7 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot) /* identifiers */ ot->name= "Add Actuator"; - ot->description = "Add a actuator to the active object"; + ot->description = "Add an actuator to the active object"; ot->idname= "LOGIC_OT_actuator_add"; /* api callbacks */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index e713ed5a678..baa47d4147e 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -102,12 +102,12 @@ void ED_node_changed_update(ID *id, bNode *node) WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id); } else if(treetype==NTREE_COMPOSIT) { - NodeTagChanged(edittree, node); + nodeUpdate(edittree, node); /* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */ node= node_tree_get_editgroup(nodetree); if(node) - NodeTagIDChanged(nodetree, node->id); + nodeUpdateID(nodetree, node->id); WM_main_add_notifier(NC_SCENE|ND_NODES, id); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index baa755ef841..85942901c00 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -496,17 +496,17 @@ void snode_set_context(SpaceNode *snode, Scene *scene) node_tree_from_ID(snode->id, &snode->nodetree, &snode->edittree, NULL); } -static void snode_tag_changed(SpaceNode *snode, bNode *node) +static void snode_update(SpaceNode *snode, bNode *node) { bNode *gnode; if (node) - NodeTagChanged(snode->edittree, node); + nodeUpdate(snode->edittree, node); /* if inside group, tag entire group */ gnode= node_tree_get_editgroup(snode->nodetree); if(gnode) - NodeTagIDChanged(snode->nodetree, gnode->id); + nodeUpdateID(snode->nodetree, gnode->id); } static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) @@ -1775,7 +1775,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode) link->fromsock= sock; } ntreeUpdateTree(snode->edittree); - snode_tag_changed(snode, node); + snode_update(snode, node); } } } @@ -2127,7 +2127,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace) continue; } - snode_tag_changed(snode, node_to); + snode_update(snode, node_to); ++numlinks; break; } @@ -2175,7 +2175,7 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate if(node->id) id_us_plus(node->id); - snode_tag_changed(snode, node); + snode_update(snode, node); } if(snode->nodetree->type==NTREE_TEXTURE) { @@ -2412,7 +2412,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event) case MIDDLEMOUSE: if(link->tosock && link->fromsock) { /* send changed events for original tonode and new */ - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); /* we might need to remove a link */ if(in_out==SOCK_OUT) @@ -2495,7 +2495,7 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag) if(link) { /* send changed event to original tonode */ if(link->tonode) - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); nldrag->node= link->fromnode; nldrag->sock= link->fromsock; @@ -2663,7 +2663,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) next= link->next; if(cut_links_intersect(link, mcoords, i)) { - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); nodeRemLink(snode->edittree, link); } } @@ -2794,7 +2794,7 @@ void ED_node_link_insert(ScrArea *sa) nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs, sockto->type), node, sockto); ntreeUpdateTree(snode->edittree); /* needed for pointers */ - snode_tag_changed(snode, select); + snode_update(snode, select); ED_node_changed_update(snode->id, select); } } @@ -3198,7 +3198,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) /* Be able to mute in-/output nodes as well. - DingTo if(node->inputs.first && node->outputs.first) { */ node->flag ^= NODE_MUTED; - snode_tag_changed(snode, node); + snode_update(snode, node); } } diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 9c4581a43da..1047e906a10 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -244,10 +244,10 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) if(type==NTREE_COMPOSIT) { Scene *scene= wmn->window->screen->scene; - /* note that NodeTagIDChanged is already called by BKE_image_signal() on all + /* note that nodeUpdateID is already called by BKE_image_signal() on all * scenes so really this is just to know if the images is used in the compo else * painting on images could become very slow when the compositor is open. */ - if(NodeTagIDChanged(scene->nodetree, wmn->reference)) + if(nodeUpdateID(scene->nodetree, wmn->reference)) ED_area_tag_refresh(sa); } } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7fa4e62359a..7e4d02036ef 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -235,7 +235,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - strcpy(seq->name+2, sce_seq->id.name+2); + BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2); seqbase_unique_name_recursive(&ed->seqbase, seq); seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 45543a9313e..33d2a27f789 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -929,11 +929,11 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) if(last_seq==NULL) return; - BLI_strncpy(from, last_seq->strip->dir, FILE_MAX); + BLI_strncpy(from, last_seq->strip->dir, sizeof(from)); // XXX if (0==sbutton(from, 0, sizeof(from)-1, "From: ")) // return; - strcpy(to, from); + BLI_strncpy(to, from, sizeof(to)); // XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: ")) // return; diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 47f051e1ec4..51f4f1e579c 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -136,7 +136,12 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->data) { case ND_DISPLAY: + ED_area_tag_redraw(sa); + break; case ND_CURSOR: + if(st->text && st->text == wmn->reference) + text_scroll_to_cursor(st, sa); + ED_area_tag_redraw(sa); break; } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 8d40550961f..242bccd2376 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2583,6 +2583,9 @@ static int set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); SetSelection *ssel; + if(event->mval[0]>=st->txtbar.xmin) + return OPERATOR_PASS_THROUGH; + op->customdata= MEM_callocN(sizeof(SetSelection), "SetCursor"); ssel= op->customdata; ssel->selecting= RNA_boolean_get(op->ptr, "select"); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 83a695ba72a..eed86467eaa 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1839,7 +1839,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* wire draw over solid only in posemode */ - if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || (arm->drawtype==ARM_LINE)) { + if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* draw line check first. we do selection indices */ if ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) { if (arm->flag & ARM_POSEMODE) @@ -2512,7 +2512,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in if(v3d->flag2 & V3D_RENDER_OVERRIDE) return 1; - if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) { + if(dt>OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* we use color for solid lighting */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index f66bffadcfa..50cc825fb68 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3083,7 +3083,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC TransData2D *td2d = *td2dv; int i; - if (fcu == NULL) + if (ELEM(NULL, fcu, fcu->bezt)) return td; for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index a2a1802973b..ba59ca0bc46 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -515,7 +515,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* identifiers */ ot->name= "Minimize Stretch"; ot->idname= "UV_OT_minimize_stretch"; - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING; ot->description="Reduce UV stretching by relaxing angles"; /* api callbacks */ diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index c1ef8c4792b..34c39b1083a 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1175,7 +1175,7 @@ static struct ImBuf * anim_getnew(struct anim * anim) { case ANIM_SEQUENCE: ibuf = IMB_loadiffname(anim->name, anim->ib_flags); if (ibuf) { - strcpy(anim->first, anim->name); + BLI_strncpy(anim->first, anim->name, sizeof(anim->first)); anim->duration = 1; } break; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 635813d856e..e4abd8b329d 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -29,10 +29,11 @@ #include "AVI_avi.h" #include "imbuf.h" #include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math_base.h" -#include "BLI_string.h" + #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" #include "BKE_global.h" diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 4cfd0b56b70..f03cc200a56 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -154,7 +154,9 @@ typedef struct bNode { float locx, locy; /* root offset for drawing */ float width, height; /* node custom width and height */ float miniwidth; /* node width if hidden */ - int pad; + + int update; /* update flags */ + char label[32]; /* custom user-defined label */ short custom1, custom2; /* to be abused for buttons */ float custom3, custom4; @@ -192,6 +194,13 @@ typedef struct bNode { /* automatic flag for nodes included in transforms */ #define NODE_TRANSFORM (1<<13) +/* node->update */ +/* XXX NODE_UPDATE is a generic update flag. More fine-grained updates + * might be used in the future, but currently all work the same way. + */ +#define NODE_UPDATE 0xFFFF /* generic update flag (includes all others) */ +#define NODE_UPDATE_ID 1 /* associated id data block has changed */ + typedef struct bNodeLink { struct bNodeLink *next, *prev; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 1627d4d2acb..13be1253184 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -434,7 +434,8 @@ typedef struct SpaceLogic { struct bGPdata *gpd; /* grease-pencil data */ } SpaceLogic; - +/* note, this entire struct isnt used anymore!, + * may remove some day - campbell */ typedef struct SpaceImaSel { SpaceLink *next, *prev; ListBase regionbase; /* storage of regions for inactive spaces */ diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 44c37f93b5e..f2d1578388d 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -132,7 +132,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * } } -static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports, const char name[]) +static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[]) { TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= 1; @@ -550,7 +550,6 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "new", "rna_Action_pose_markers_new"); RNA_def_function_ui_description(func, "Add a pose marker to the action"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)"); RNA_def_property_flag(parm, PROP_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index d828139a6d5..2859a7bb89b 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -450,7 +450,7 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, Property return item; } -static void rna_Actuator_Armature_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Actuator_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { bActuator *act= (bActuator *)ptr->data; bArmatureActuator *aa = act->data; diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index ebf8990adf3..21e99d312d6 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -80,6 +80,8 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value) /* wrapper for poll callback */ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) { + extern FunctionRNA rna_KeyingSetInfo_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -87,7 +89,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) int ok; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ @@ -108,12 +110,14 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) /* wrapper for iterator callback */ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks) { + extern FunctionRNA rna_KeyingSetInfo_iterator_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "iterator"); + func= &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ @@ -129,12 +133,14 @@ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks /* wrapper for generator callback */ static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, PointerRNA *data) { + extern FunctionRNA rna_KeyingSetInfo_generate_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "generate"); + func= &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 357f613f65f..e21f6aeb26f 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -76,7 +76,7 @@ EnumPropertyItem boidruleset_type_items[] ={ #include "BKE_depsgraph.h" #include "BKE_particle.h" -static void rna_Boids_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 52067d40dd3..8bdbdcefc61 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -292,7 +292,7 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) } } -static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Curve *cu= (Curve*)ptr->id.data; @@ -483,7 +483,7 @@ void rna_Curve_body_set(PointerRNA *ptr, const char *value) cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */ - //wcs2utf8s(cu->str, value); // value is not wchar_t + //BLI_strncpy_wchar_as_utf8(cu->str, value, len+1); // value is not wchar_t BLI_strncpy(cu->str, value, len+1); } @@ -722,7 +722,7 @@ static void rna_def_bpoint(BlenderRNA *brna) prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vec[3]"); - RNA_def_property_ui_text(prop, "Weight", "Nurbs weight"); + RNA_def_property_ui_text(prop, "Weight", "NURBS weight"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* Number values */ @@ -1446,7 +1446,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) srna= RNA_def_struct(brna, "Spline", NULL); RNA_def_struct_sdna(srna, "Nurb"); - RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either Nurbs, Bezier or Polyline or a character with text objects"); + RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects"); prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); @@ -1496,13 +1496,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderu"); RNA_def_property_range(prop, 2, 6); - RNA_def_property_ui_text(prop, "Order U", "Nurbs order in the U direction (For splines and surfaces), Higher values let points influence a greater area"); + RNA_def_property_ui_text(prop, "Order U", "NURBS order in the U direction (for splines and surfaces, higher values let points influence a greater area)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderv"); RNA_def_property_range(prop, 2, 6); - RNA_def_property_ui_text(prop, "Order V", "Nurbs order in the V direction (For surfaces only), Higher values let points influence a greater area"); + RNA_def_property_ui_text(prop, "Order V", "NURBS order in the V direction (for surfaces only, higher values let points influence a greater area)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index ab469c19e15..06571a454be 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -39,7 +39,6 @@ #include "DNA_genfile.h" #include "DNA_sdna_types.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 43812ad4a01..08a71e0cd4f 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1368,13 +1368,14 @@ static void rna_def_fkeyframe(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "ipo"); RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items); RNA_def_property_ui_text(prop, "Interpolation", - "Interpolation method to use for segment of the curve from this Keyframe until the next Keyframe"); + "Interpolation method to use for segment of the F-Curve from " + "this Keyframe until the next Keyframe"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "hide"); RNA_def_property_enum_items(prop, beztriple_keyframe_type_items); - RNA_def_property_ui_text(prop, "Type", "The type of keyframe (for visual purposes only"); + RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); /* Vector values */ diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index ba90aca47a3..c114c44ad77 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -173,6 +173,7 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value) { #ifdef DISABLE_ELBEEM + (void)ptr; value[0]= '\0'; #else Object *ob= (Object*)ptr->id.data; @@ -182,7 +183,7 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v #endif } -static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) +static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *UNUSED(ptr)) { #ifdef DISABLE_ELBEEM return 0; diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index eac4932ac43..66bcc5951cd 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -369,25 +369,25 @@ static void rna_def_imageuser(BlenderRNA *brna) prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frames"); RNA_def_property_range(prop, 0, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); + RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); + RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); + RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fie_ima"); RNA_def_property_range(prop, 1, 200); - RNA_def_property_ui_text(prop, "Fields per Frame", "The number of fields per rendered frame (2 fields is 1 image)"); + RNA_def_property_ui_text(prop, "Fields per Frame", "Number of fields per rendered frame (2 fields is 1 image)"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 2a81c4f0a2c..f30fea659ae 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -179,10 +179,11 @@ static void rna_Lattice_points_w_set(PointerRNA *ptr, int value) static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value) { Lattice *lt= ptr->data; - strcpy(lt->vgroup, value); + BLI_strncpy(lt->vgroup, value, sizeof(lt->vgroup)); - if(lt->editlatt) - strcpy(lt->editlatt->latt->vgroup, value); + if(lt->editlatt) { + BLI_strncpy(lt->editlatt->latt->vgroup, value, sizeof(lt->editlatt->latt->vgroup)); + } } /* annoying, but is a consequence of RNA structures... */ diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index f29c74caac1..e076053b6e6 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1435,19 +1435,19 @@ static void rna_def_mtexpoly(BlenderRNA *brna) prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_get", "rna_MeshTextureFaceLayer_active_set"); - RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing"); + RNA_def_property_ui_text(prop, "Active", "Set the layer as active for display and editing"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", "rna_MeshTextureFaceLayer_active_render_set"); - RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering"); + RNA_def_property_ui_text(prop, "Active Render", "Set the layer as active for rendering"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get", "rna_MeshTextureFaceLayer_clone_set"); - RNA_def_property_ui_text(prop, "Active Clone", "Sets the layer as active for cloning"); + RNA_def_property_ui_text(prop, "Active Clone", "Set the layer as active for cloning"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); @@ -1924,7 +1924,8 @@ static void rna_def_mesh(BlenderRNA *brna) /* UV textures */ prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, "rna_Mesh_uv_textures_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, + "rna_Mesh_uv_textures_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_ui_text(prop, "UV Textures", ""); rna_def_uv_textures(brna, prop); @@ -1953,26 +1954,30 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL, "rna_Mesh_vertex_colors_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL, + "rna_Mesh_vertex_colors_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshColorLayer"); RNA_def_property_ui_text(prop, "Vertex Colors", ""); rna_def_vertex_colors(brna, prop); prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL, "rna_Mesh_float_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL, + "rna_Mesh_float_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer"); RNA_def_property_ui_text(prop, "Float Property Layers", ""); prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL, "rna_Mesh_int_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL, + "rna_Mesh_int_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshIntPropertyLayer"); RNA_def_property_ui_text(prop, "Int Property Layers", ""); prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL, "rna_Mesh_string_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL, + "rna_Mesh_string_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshStringPropertyLayer"); RNA_def_property_ui_text(prop, "String Property Layers", ""); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 896f1eed127..ac51e0d304d 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -55,6 +55,11 @@ #include "WM_types.h" EnumPropertyItem modifier_type_items[] ={ + {0, "", 0, "Modify", ""}, + {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, + {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""}, + {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""}, + {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""}, {0, "", 0, "Generate", ""}, {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""}, {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""}, @@ -68,11 +73,6 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""}, {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""}, - {0, "", 0, "Modify", ""}, - {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, - {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""}, - {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""}, - {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""}, {0, "", 0, "Deform", ""}, {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""}, {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""}, diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 061a21056d0..0677b848fee 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -568,7 +568,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), Repor } else { ntreeUpdateTree(ntree); /* update group node socket links*/ - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); if (group) @@ -651,7 +651,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b ret= nodeAddLink(ntree, fromnode, in, tonode, out); if(ret) { - NodeTagChanged(ntree, tonode); + nodeUpdate(ntree, tonode); ntreeUpdateTree(ntree); @@ -1403,19 +1403,19 @@ static void def_cmp_image(StructRNA *srna) prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frames"); RNA_def_property_range(prop, 0, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f24c43a1f74..8b8ee735484 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1398,7 +1398,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Controller"); RNA_def_property_ui_text(prop, "Controllers", - "Game engine controllers to process events, connecting sensor to actuators"); + "Game engine controllers to process events, connecting sensors to actuators"); prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Actuator"); @@ -1427,7 +1427,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "body_type"); RNA_def_property_enum_items(prop, body_type_items); RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); - RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation"); + RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE); @@ -1489,20 +1489,20 @@ static void rna_def_object_game_settings(BlenderRNA *brna) /* lock rotation */ prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis"); + RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis"); prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis"); + RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis"); prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); /* is this used anywhere ? */ prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); @@ -1527,7 +1527,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction"); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Friction Coefficients", - "Relative friction coefficient in the in the X, Y and Z directions, " + "Relative friction coefficients in the in the X, Y and Z directions, " "when anisotropic friction is enabled"); prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); @@ -1538,7 +1538,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "boundtype"); RNA_def_property_enum_items(prop, collision_bounds_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf"); - RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type"); + RNA_def_property_ui_text(prop, "Collision Bounds", "Select the collision type"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index c36dca22731..597f8730e72 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -193,7 +193,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P pid2 = pid; else if(cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name)==0) { /*TODO: report "name exists" to user */ - strcpy(cache->name, cache->prev_name); + BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name)); new_name = 0; } } @@ -203,13 +203,13 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P char old_name[80]; char new_name[80]; - strcpy(old_name, cache->prev_name); - strcpy(new_name, cache->name); + BLI_strncpy(old_name, cache->prev_name, sizeof(old_name)); + BLI_strncpy(new_name, cache->name, sizeof(new_name)); BKE_ptcache_disk_cache_rename(pid2, old_name, new_name); } - strcpy(cache->prev_name, cache->name); + BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name)); } } @@ -679,7 +679,8 @@ static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point } -static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) +static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Object *ob= NULL; @@ -725,7 +726,8 @@ static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range"); + RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", + "rna_Cache_active_point_cache_index_range"); RNA_def_property_ui_text(prop, "Active Point Cache Index", ""); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change"); } @@ -827,7 +829,8 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); prop= RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list"); rna_def_ptcache_point_caches(brna, prop); @@ -914,7 +917,8 @@ static void rna_def_collision(BlenderRNA *brna) prop= RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2); - RNA_def_property_ui_text(prop, "Absorption", "How much of effector force gets lost during collision with this object (in percent)"); + RNA_def_property_ui_text(prop, "Absorption", + "How much of effector force gets lost during collision with this object (in percent)"); RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); } @@ -1128,7 +1132,9 @@ static void rna_def_field(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "tex_mode"); RNA_def_property_enum_items(prop, texture_items); - RNA_def_property_ui_text(prop, "Texture Mode", "How the texture effect is calculated (RGB & Curl need a RGB texture else Gradient will be used instead)"); + RNA_def_property_ui_text(prop, "Texture Mode", + "How the texture effect is calculated (RGB & Curl need a RGB texture, " + "else Gradient will be used instead)"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE); @@ -1423,7 +1429,10 @@ static void rna_def_game_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "weld_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "welding"); RNA_def_property_range(prop, 0.0f, 0.01f); - RNA_def_property_ui_text(prop, "Welding", "Welding threshold: distance between nearby vertices to be considered equal => set to 0.0 to disable welding test and speed up scene loading (ok if the mesh has no duplicates)"); + RNA_def_property_ui_text(prop, "Welding", + "Welding threshold: distance between nearby vertices to be considered equal " + "=> set to 0.0 to disable welding test and speed up scene loading " + "(ok if the mesh has no duplicates)"); /* Integers */ @@ -1435,7 +1444,7 @@ static void rna_def_game_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "cluster_iterations", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "numclusteriterations"); RNA_def_property_range(prop, 1, 128); - RNA_def_property_ui_text(prop, "Cluster Iterations", "Specify the number of cluster iterations"); + RNA_def_property_ui_text(prop, "Cluster Iterations", "Number of cluster iterations"); /* Booleans */ @@ -1519,7 +1528,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vertgroup"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */ - RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set"); + RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", + "rna_SoftBodySettings_goal_vgroup_set"); RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values"); prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE); @@ -1641,7 +1651,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rklimit"); RNA_def_property_range(prop, 0.001f, 10.0f); - RNA_def_property_ui_text(prop, "Error Limit", "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); + RNA_def_property_ui_text(prop, "Error Limit", + "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE); @@ -1665,7 +1676,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fuzzyness"); RNA_def_property_range(prop, 1, 100); - RNA_def_property_ui_text(prop, "Fuzzy", "Fuzziness while on collision, high values make collision handling faster but less stable"); + RNA_def_property_ui_text(prop, "Fuzzy", + "Fuzziness while on collision, high values make collision handling faster but less stable"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index e3a3f93b5f3..d224bd0d4e5 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -48,13 +48,14 @@ // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable EnumPropertyItem posebone_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock (default)"}, - {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"}, + {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", + "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -717,7 +718,8 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro /* Collection active property */ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); - RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", "rna_PoseChannel_active_constraint_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", + "rna_PoseChannel_active_constraint_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint"); @@ -820,7 +822,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) */ prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE); RNA_def_property_array(prop, 4); - RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", "rna_PoseChannel_rotation_axis_angle_set", NULL); + RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", + "rna_PoseChannel_rotation_axis_angle_set", NULL); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable"); RNA_def_property_float_array_default(prop, default_axisAngle); RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation"); @@ -853,7 +856,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, matrix_dimsize); RNA_def_property_ui_text(prop, "Basis Matrix", - "Provides an alternative access to loc/scale/rotation relative to the parent and own rest bone"); + "Alternative access to location/scale/rotation relative to the parent and own rest bone"); RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1039,7 +1042,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "agrp_index"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set", "rna_PoseChannel_bone_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set", + "rna_PoseChannel_bone_group_index_range"); RNA_def_property_ui_text(prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group)"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1072,7 +1076,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) // XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this! prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW); - RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface"); + RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", + "Lock editing of 'angle' component of four-component rotations in the interface"); RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1080,7 +1085,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) // XXX this needs a better name prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D); - RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)"); + RNA_def_property_ui_text(prop, "Lock Rotations (4D)", + "Lock editing of four component rotations by components (instead of as Eulers)"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1098,13 +1104,17 @@ static void rna_def_pose_channel(BlenderRNA *brna) static void rna_def_pose_itasc(BlenderRNA *brna) { static const EnumPropertyItem prop_itasc_mode_items[]= { - {0, "ANIMATION", 0, "Animation", "Stateless solver computing pose starting from current action and non-IK constraints"}, - {ITASC_SIMULATION, "SIMULATION", 0, "Simulation", "Statefull solver running in real-time context and ignoring actions and non-IK constraints"}, + {0, "ANIMATION", 0, "Animation", + "Stateless solver computing pose starting from current action and non-IK constraints"}, + {ITASC_SIMULATION, "SIMULATION", 0, "Simulation", + "Statefull solver running in real-time context and ignoring actions and non-IK constraints"}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem prop_itasc_reiteration_items[]= { {0, "NEVER", 0, "Never", "The solver does not reiterate, not even on first frame (starts from rest pose)"}, - {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial", "The solver reiterates (converges) on the first frame but not on subsequent frame"}, - {ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always", "The solver reiterates (converges) on all frames"}, + {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial", + "The solver reiterates (converges) on the first frame but not on subsequent frame"}, + {ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always", + "The solver reiterates (converges) on all frames"}, {0, NULL, 0, NULL, NULL}}; StructRNA *srna; @@ -1141,12 +1151,15 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_itasc_reiteration_items); - RNA_def_property_ui_text(prop, "Reiteration", "Defines if the solver is allowed to reiterate (converges until precision is met) on none, first or all frames"); + RNA_def_property_ui_text(prop, "Reiteration", + "Defines if the solver is allowed to reiterate (converges until " + "precision is met) on none, first or all frames"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP); - RNA_def_property_ui_text(prop, "Auto step", "Automatically determine the optimal number of steps for best performance/accuracy trade off"); + RNA_def_property_ui_text(prop, "Auto step", + "Automatically determine the optimal number of steps for best performance/accuracy trade off"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE); @@ -1164,7 +1177,8 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "feedback"); RNA_def_property_range(prop, 0.0f,100.0f); - RNA_def_property_ui_text(prop, "Feedback", "Feedback coefficient for error correction. Average response time=1/feedback. Default=20"); + RNA_def_property_ui_text(prop, "Feedback", + "Feedback coefficient for error correction. Average response time=1/feedback. Default=20"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE); @@ -1182,13 +1196,17 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dampmax"); RNA_def_property_range(prop, 0.0f,1.0f); - RNA_def_property_ui_text(prop, "Damp", "Maximum damping coefficient when singular value is nearly 0. Higher values=more stability, less reactivity. Default=0.5"); + RNA_def_property_ui_text(prop, "Damp", + "Maximum damping coefficient when singular value is nearly 0 " + "(higher values=more stability, less reactivity - default=0.5)"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dampeps"); RNA_def_property_range(prop, 0.0f,1.0f); - RNA_def_property_ui_text(prop, "Epsilon", "Singular value under which damping is progressively applied. Higher values=more stability, less reactivity. Default=0.1"); + RNA_def_property_ui_text(prop, "Epsilon", + "Singular value under which damping is progressively applied " + "(higher values=more stability, less reactivity - default=0.1)"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); } @@ -1232,7 +1250,8 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_group"); - RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", + "rna_Pose_active_bone_group_index_range"); RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); } @@ -1265,7 +1284,8 @@ static void rna_def_pose(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "iksolver"); RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL); RNA_def_property_enum_items(prop, prop_iksolver_items); - RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC"); + RNA_def_property_ui_text(prop, "IK Solver", + "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_ik_solver_update"); prop= RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index f5fab9d2f33..a2e68668856 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -88,12 +88,14 @@ void RE_engines_exit(void) static void engine_render(RenderEngine *engine, struct Scene *scene) { + extern FunctionRNA rna_RenderEngine_render_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - func= RNA_struct_find_function(&ptr, "render"); + func= &rna_RenderEngine_render_func; /* RNA_struct_find_function(&ptr, "render"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "scene", &scene); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 376b0c529d0..31c872f43f8 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -167,7 +167,7 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data) return 0; } -static int rna_property_builtin(CollectionPropertyIterator *iter, void *data) +static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *data) { PropertyRNA *prop= (PropertyRNA*)data; @@ -176,7 +176,7 @@ static int rna_property_builtin(CollectionPropertyIterator *iter, void *data) return (prop->flag & PROP_BUILTIN); } -static int rna_function_builtin(CollectionPropertyIterator *iter, void *data) +static int rna_function_builtin(CollectionPropertyIterator *UNUSED(iter), void *data) { FunctionRNA *func= (FunctionRNA*)data; @@ -775,7 +775,7 @@ static int rna_EnumProperty_default_get(PointerRNA *ptr) return ((EnumPropertyRNA*)prop)->defaultvalue; } -static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data) +static int rna_enum_check_separator(CollectionPropertyIterator *UNUSED(iter), void *data) { EnumPropertyItem *item= (EnumPropertyItem*)data; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 143d082a45e..6f5fd812b72 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1056,7 +1056,7 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons * is not for general use and only for the few cases where changing scene * settings and NOT for general purpose updates, possibly this should be * given its own notifier. */ -static void rna_Scene_update_active_object_data(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { Object *ob= OBACT; if(ob) { @@ -1757,13 +1757,13 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop= RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionminsize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size. Smaller regions will be deleted"); + RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionmergesize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size. Smaller regions will be merged"); + RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE); @@ -1979,7 +1979,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); RNA_def_property_ui_text(prop, "Occlusion Resolution", - "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); + "Size of the occlusion buffer in pixel, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); @@ -1987,7 +1987,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 250); RNA_def_property_ui_text(prop, "Frames Per Second", - "The nominal number of game frames per second " + "Nominal number of game frames per second " "(physics fixed timestep = 1/fps, independently of actual frame rate)"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -1996,7 +1996,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Max Logic Steps", - "Sets the maximum number of logic frame per game frame if graphics slows down the game, " + "Maximum number of logic frame per game frame if graphics slows down the game, " "higher value allows better synchronization with physics"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2005,7 +2005,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Max Physics Steps", - "Sets the maximum number of physics step per game frame if graphics slows down the game, " + "Maximum number of physics step per game frame if graphics slows down the game, " "higher value allows physics to keep up with realtime"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2014,7 +2014,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Physics Sub Steps", - "Sets the number of simulation substep per physic timestep, " + "Number of simulation substep per physic timestep, " "higher value give better physics precision"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2068,7 +2068,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD); - RNA_def_property_ui_text(prop, "Record Animation", "Record animation to fcurves"); + RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves"); prop= RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set"); @@ -2077,8 +2077,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES); RNA_def_property_ui_text(prop, "Restrict Animation Updates", - "Restrict the number of animation updates to the animation FPS. This is " - "better for performance, but can cause issues with smooth playback"); + "Restrict the number of animation updates to the animation FPS (this is " + "better for performance, but can cause issues with smooth playback)"); /* materials */ prop= RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 28b96f3b08b..d169ee5079b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -127,7 +127,8 @@ static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) pset->brushtype = value; } -static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free)) +static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Scene *scene= CTX_data_scene(C); Object *ob= (scene->basact)? scene->basact->object: NULL; @@ -275,7 +276,8 @@ static void rna_def_sculpt(BlenderRNA *brna) prop= RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER); - RNA_def_property_ui_text(prop, "Symmetry Feathering", "Reduce the strength of the brush where it overlaps symmetrical daubs"); + RNA_def_property_ui_text(prop, "Symmetry Feathering", + "Reduce the strength of the brush where it overlaps symmetrical daubs"); prop= RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP); @@ -283,7 +285,9 @@ static void rna_def_sculpt(BlenderRNA *brna) prop= RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM); - RNA_def_property_ui_text(prop, "Use Deform Only", "Use only deformation modifiers (temporary disable all constructive modifiers except multi-resolution)"); + RNA_def_property_ui_text(prop, "Use Deform Only", + "Use only deformation modifiers (temporary disable all " + "constructive modifiers except multi-resolution)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Sculpt_update"); } @@ -345,7 +349,8 @@ static void rna_def_image_paint(BlenderRNA *brna) prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); - RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); + RNA_def_property_ui_text(prop, "Clone Layer", + "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); /* integers */ @@ -357,7 +362,8 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_property_range(prop, 0, 90); RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle"); - prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size", "Size to capture the image for re-projecting", 0, 0); + prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size", + "Size to capture the image for re-projecting", 0, 0); RNA_def_property_range(prop, 512, 16384); } @@ -518,7 +524,8 @@ static void rna_def_particle_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME); - RNA_def_property_ui_text(prop, "Puff Volume", "Apply puff to unselected end-points, (helps maintain hair volume when puffing root)"); + RNA_def_property_ui_text(prop, "Puff Volume", + "Apply puff to unselected end-points (helps maintain hair volume when puffing root)"); prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "invert"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index b90f10693ac..9d72eeacf3e 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1190,7 +1190,7 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Overlay Offset", ""); RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); - RNA_def_property_ui_text(prop, "Active Strip", "Sequencers active strip"); + RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip"); } static void rna_def_filter_video(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 217d68860f2..44bdeba3e2e 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -177,14 +177,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "alpha"); RNA_def_property_range(prop, -5.0, 5.0); RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text(prop, "Density", "How much density effects smoke motion, higher value results in faster rising smoke"); + RNA_def_property_ui_text(prop, "Density", "How much density affects smoke motion (higher value results in faster rising smoke)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "beta"); RNA_def_property_range(prop, -5.0, 5.0); RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text(prop, "Heat", "How much heat effects smoke motion, higher value results in faster rising smoke"); + RNA_def_property_ui_text(prop, "Heat", "How much heat affects smoke motion (higher value results in faster rising smoke)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE); @@ -245,7 +245,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); RNA_def_property_enum_items(prop, smoke_domain_colli_items); - RNA_def_property_ui_text(prop, "Border Collisions", "Selects which domain border will be treated as collision object"); + RNA_def_property_ui_text(prop, "Border Collisions", "Select which domain border will be treated as collision object"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); @@ -313,7 +313,7 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); - RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits it's velocity from the emitter particle"); + RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits its velocity from the emitter particle"); prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 8afcd61b9c8..cbe06e6cab5 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -860,7 +860,7 @@ static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value) return (ntree->nodetype==0 && ntree->type == snode->treetype); } -static void rna_SpaceNodeEditor_node_tree_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_SpaceNodeEditor_node_tree_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { SpaceNode *snode= (SpaceNode*)ptr->data; diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b5e8acb76e5..1babf5e61a1 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -133,7 +133,7 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr) } } -static void rna_Texture_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Texture_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Tex *tex= ptr->id.data; @@ -162,7 +162,7 @@ static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, Pointe /* Used for Texture Properties, used (also) for/in Nodes */ -static void rna_Texture_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Tex *tex= ptr->id.data; @@ -177,7 +177,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) tex_set_type(tex, value); } -void rna_TextureSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) +void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id= ptr->id.data; @@ -388,12 +388,12 @@ static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value) pd->psys= BLI_findindex(&ob->particlesystem, value.data) + 1; } -static char *rna_PointDensity_path(PointerRNA *ptr) +static char *rna_PointDensity_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("point_density"); } -static char *rna_VoxelData_path(PointerRNA *ptr) +static char *rna_VoxelData_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("voxel_data"); } @@ -698,7 +698,7 @@ static EnumPropertyItem prop_noise_basis_items[] = { {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle", "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"}, {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise", - "Noise algorithm - Cell Noise: Square cell tessallation"}, + "Noise algorithm - Cell Noise: Square cell tessellation"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_noise_type[] = { @@ -1525,13 +1525,13 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) prop= RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space"); RNA_def_property_enum_items(prop, particle_cache_items); - RNA_def_property_ui_text(prop, "Particle Cache", "Co-ordinate system to cache particles in"); + RNA_def_property_ui_text(prop, "Particle Cache", "Coordinate system to cache particles in"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "vertex_cache_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ob_cache_space"); RNA_def_property_enum_items(prop, vertice_cache_items); - RNA_def_property_ui_text(prop, "Vertices Cache", "Co-ordinate system to cache vertices in"); + RNA_def_property_ui_text(prop, "Vertices Cache", "Coordinate system to cache vertices in"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); @@ -1657,9 +1657,9 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem voxeldata_extension[] = { - {TEX_EXTEND, "EXTEND", 0, "Extend", "Extends by repeating edge pixels of the image"}, - {TEX_CLIP, "CLIP", 0, "Clip", "Clips to image size and sets exterior pixels as transparent"}, - {TEX_REPEAT, "REPEAT", 0, "Repeat", "Causes the image to repeat horizontally and vertically"}, + {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, + {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"}, + {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem smoked_type_items[] = { diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 2c2bc4704bf..2a62a39ef33 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -95,6 +95,8 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re static int panel_poll(const bContext *C, PanelType *pt) { + extern FunctionRNA rna_Panel_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -102,7 +104,7 @@ static int panel_poll(const bContext *C, PanelType *pt) int visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -118,12 +120,14 @@ static int panel_poll(const bContext *C, PanelType *pt) static void panel_draw(const bContext *C, Panel *pnl) { + extern FunctionRNA rna_Panel_draw_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); - func= RNA_struct_find_function(&ptr, "draw"); + func= &rna_Panel_draw_func;/* RNA_struct_find_function(&ptr, "draw"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -134,12 +138,14 @@ static void panel_draw(const bContext *C, Panel *pnl) static void panel_draw_header(const bContext *C, Panel *pnl) { + extern FunctionRNA rna_Panel_draw_header_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); - func= RNA_struct_find_function(&ptr, "draw_header"); + func= &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -249,12 +255,14 @@ static StructRNA* rna_Panel_refine(PointerRNA *ptr) static void header_draw(const bContext *C, Header *hdr) { + extern FunctionRNA rna_Header_draw_func; + PointerRNA htr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr); - func= RNA_struct_find_function(&htr, "draw"); + func= &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */ RNA_parameter_list_create(&list, &htr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -347,6 +355,8 @@ static StructRNA* rna_Header_refine(PointerRNA *htr) static int menu_poll(const bContext *C, MenuType *pt) { + extern FunctionRNA rna_Menu_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -354,7 +364,7 @@ static int menu_poll(const bContext *C, MenuType *pt) int visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -370,12 +380,14 @@ static int menu_poll(const bContext *C, MenuType *pt) static void menu_draw(const bContext *C, Menu *hdr) { + extern FunctionRNA rna_Menu_draw_func; + PointerRNA mtr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &mtr); - func= RNA_struct_find_function(&mtr, "draw"); + func= &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */ RNA_parameter_list_create(&list, &mtr, func); RNA_parameter_set_lookup(&list, "context", &C); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index e2f0f4dab1f..0c3ff108c03 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -72,7 +72,7 @@ static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe WM_main_add_notifier(NC_WINDOW, NULL); } -static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_userdef_dpi_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { U.widget_unit = (U.dpi * 20 + 36)/72; WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */ @@ -813,25 +813,25 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurb prop= RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_uline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb U-lines", ""); + RNA_def_property_ui_text(prop, "NURBS U-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_vline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb V-lines", ""); + RNA_def_property_ui_text(prop, "NURBS V-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb active U-lines", ""); + RNA_def_property_ui_text(prop, "NURBS active U-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb active V-lines", ""); + RNA_def_property_ui_text(prop, "NURBS active V-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -1984,19 +1984,19 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "vec"); RNA_def_property_array(prop, 3); RNA_def_property_float_array_default(prop, default_dir); - RNA_def_property_ui_text(prop, "Direction", "The direction that the OpenGL light is shining"); + RNA_def_property_ui_text(prop, "Direction", "Direction that the OpenGL light is shining"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "col"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Diffuse Color", "The diffuse color of the OpenGL light"); + RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the OpenGL light"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); prop= RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "spec"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Specular Color", "The color of the lights specular highlight"); + RNA_def_property_ui_text(prop, "Specular Color", "Color of the light's specular highlight"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); } diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index e9df79acd4a..676fe1e092d 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -762,6 +762,8 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) static int operator_poll(bContext *C, wmOperatorType *ot) { + extern FunctionRNA rna_Operator_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -769,7 +771,7 @@ static int operator_poll(bContext *C, wmOperatorType *ot) int visible; RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -785,6 +787,8 @@ static int operator_poll(bContext *C, wmOperatorType *ot) static int operator_execute(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_execute_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -792,7 +796,7 @@ static int operator_execute(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "execute"); + func= &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -809,6 +813,8 @@ static int operator_execute(bContext *C, wmOperator *op) /* same as execute() but no return value */ static int operator_check(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_check_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -816,7 +822,7 @@ static int operator_check(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "check"); + func= &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -832,6 +838,8 @@ static int operator_check(bContext *C, wmOperator *op) static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) { + extern FunctionRNA rna_Operator_invoke_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -839,7 +847,7 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "invoke"); + func= &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -857,6 +865,8 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) /* same as invoke */ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) { + extern FunctionRNA rna_Operator_modal_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -864,7 +874,7 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "modal"); + func= &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -881,12 +891,14 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) static void operator_draw(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_draw_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "draw"); + func= &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -898,6 +910,8 @@ static void operator_draw(bContext *C, wmOperator *op) /* same as exec(), but call cancel */ static int operator_cancel(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_cancel_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -905,7 +919,7 @@ static int operator_cancel(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "cancel"); + func= &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -1689,7 +1703,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "id"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "id", "ID of the item"); + RNA_def_property_ui_text(prop, "ID", "ID of the item"); RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 11ec327c306..62975763874 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -409,7 +409,7 @@ static void rna_def_world_mist(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "mistdist"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 10000, 10, 2); - RNA_def_property_ui_text(prop, "Depth", "The distance over which the mist effect fades in"); + RNA_def_property_ui_text(prop, "Depth", "Distance over which the mist effect fades in"); RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE); @@ -433,7 +433,7 @@ static void rna_def_world_stars(BlenderRNA *brna) srna= RNA_def_struct(brna, "WorldStarsSettings", NULL); RNA_def_struct_sdna(srna, "World"); RNA_def_struct_nested(brna, srna, "World"); - RNA_def_struct_ui_text(srna, "World Stars", "Stars setting for a World data-block"); + RNA_def_struct_ui_text(srna, "World Stars", "Stars settings for a World data-block"); prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS); diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py index 5df6e9a86ff..ca610eeb024 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py @@ -8,7 +8,7 @@ Typical line in the input file (elements in [] are optional). [comment *] ToolSettings.snap_align_rotation -> use_snap_align_rotation: boolean [Align rotation with the snapping target] Geterate output format from blender run this: - ./blender.bin --background --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt + ./blender.bin --background -noaudio --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt """ diff --git a/source/blender/makesrna/rna_cleanup/rna_update.sh b/source/blender/makesrna/rna_cleanup/rna_update.sh index a4d686cc482..e3119191cb2 100755 --- a/source/blender/makesrna/rna_cleanup/rna_update.sh +++ b/source/blender/makesrna/rna_cleanup/rna_update.sh @@ -1,5 +1,5 @@ cd ../../../../ -./blender.bin --background --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt +./blender.bin --background -noaudio --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt cd ./source/blender/makesrna/rna_cleanup/ ./rna_cleaner.py out.txt ./rna_cleaner.py rna_properties.txt diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 42ecf34d6dc..3e201cb26f7 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -37,6 +37,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_bmesh.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index c097e9bdf24..2c5d31268b7 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -43,6 +43,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index b93d1e38abd..8e21a6cd372 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -38,6 +38,8 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "DNA_armature_types.h" diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index fdef0530daa..e245339c9e4 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -42,6 +42,7 @@ #include "BLI_edgehash.h" #include "BLI_array.h" #include "BLI_smallhash.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" @@ -179,7 +180,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->crease_outer = smd->crease_outer; tsmd->crease_rim = smd->crease_rim; tsmd->flag = smd->flag; - strcpy(tsmd->defgrp_name, smd->defgrp_name); + BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 5c58070be9d..6f4939ecbdd 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -183,6 +183,11 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree) } } +static void update(bNodeTree *ntree) +{ + ntreeSetOutput(ntree); +} + bNodeTreeType ntreeType_Composite = { /* type */ NTREE_COMPOSIT, /* idname */ "NTCompositing Nodetree", @@ -195,7 +200,7 @@ bNodeTreeType ntreeType_Composite = { /* localize */ localize, /* local_sync */ local_sync, /* local_merge */ local_merge, - /* update */ NULL, + /* update */ update, /* update_node */ update_node }; @@ -716,9 +721,9 @@ void ntreeCompositTagRender(Scene *curscene) for(node= sce->nodetree->nodes.first; node; node= node->next) { if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE) - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); } } } @@ -745,7 +750,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) for (index=0; index<len; index++) { if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); return 1; } } @@ -763,7 +768,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) for (index=0; index<len; index++) { if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); return 1; } } @@ -789,18 +794,18 @@ int ntreeCompositTagAnimated(bNodeTree *ntree) if(node->type==CMP_NODE_IMAGE) { Image *ima= (Image *)node->id; if(ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); tagged= 1; } } else if(node->type==CMP_NODE_TIME) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); tagged= 1; } /* here was tag render layer, but this is called after a render, so re-composites fail */ else if(node->type==NODE_GROUP) { if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); } } } @@ -818,12 +823,12 @@ void ntreeCompositTagGenerators(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { if( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE)) - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); } } /* XXX after render animation system gets a refresh, this call allows composite to end clean */ -void ntreeClearTags(bNodeTree *ntree) +void ntreeCompositClearTags(bNodeTree *ntree) { bNode *node; @@ -832,6 +837,6 @@ void ntreeClearTags(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { node->need_exec= 0; if(node->type==NODE_GROUP) - ntreeClearTags((bNodeTree *)node->id); + ntreeCompositClearTags((bNodeTree *)node->id); } } diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 56f80840112..6214f39dc0a 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -239,9 +239,11 @@ bNode *node_group_make_from_selected(bNodeTree *ntree) } } + /* update of the group tree */ ngroup->update |= NTREE_UPDATE; ntreeUpdateTree(ngroup); - ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS; + /* update of the tree containing the group instance node */ + ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); return gnode; @@ -559,7 +561,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) /* free the group tree (takes care of user count) */ free_libblock(&G.main->nodetree, wgroup); - ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS; + ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); return 1; @@ -716,7 +718,7 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o if(sock) { sock->groupsock = gsock; - strcpy(sock->name, gsock->name); + BLI_strncpy(sock->name, gsock->name, sizeof(sock->name)); sock->type= gsock->type; /* XXX hack: group socket input/output roles are inverted internally, @@ -901,7 +903,7 @@ static void loop_sync(bNodeTree *ntree, int sync_in_out) if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage)) break; /* make sure the name is the same (only for identification by user, no deeper meaning) */ - strcpy(mirror->name, sock->name); + BLI_strncpy(mirror->name, sock->name, sizeof(mirror->name)); /* fix the socket order if necessary */ if (mirror != sync) { BLI_remlink(sync_lb, mirror); diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 51e48b84383..74f15af88a2 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -405,15 +405,15 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_out, ListBase *socklist, bNodeSocketTemplate *stemp_first) { - bNodeSocket *sock; + bNodeSocket *sock, *nextsock; bNodeSocketTemplate *stemp; /* no inputs anymore? */ if(stemp_first==NULL) { - while(socklist->first) { - sock = (bNodeSocket*)socklist->first; + for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) { + nextsock = sock->next; if (!(sock->flag & SOCK_DYNAMIC)) - nodeRemoveSocket(ntree, node, socklist->first); + nodeRemoveSocket(ntree, node, sock); } } else { @@ -424,10 +424,10 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou stemp++; } /* leftovers are removed */ - while(socklist->first) { - sock = (bNodeSocket*)socklist->first; + for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) { + nextsock = sock->next; if (!(sock->flag & SOCK_DYNAMIC)) - nodeRemoveSocket(ntree, node, socklist->first); + nodeRemoveSocket(ntree, node, sock); } /* and we put back the verified sockets */ diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 28f0f983454..9f3e7ce3c73 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -85,6 +85,11 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree) } } +static void update(bNodeTree *ntree) +{ + ntreeSetOutput(ntree); +} + bNodeTreeType ntreeType_Shader = { /* type */ NTREE_SHADER, /* id_name */ "NTShader Nodetree", @@ -97,7 +102,7 @@ bNodeTreeType ntreeType_Shader = { /* localize */ NULL, /* local_sync */ local_sync, /* local_merge */ NULL, - /* update */ NULL, + /* update */ update, /* update_node */ NULL }; diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 603aa7ceb77..2b016177820 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -108,7 +108,7 @@ int ntreeTexTagAnimated(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { if(node->type==TEX_NODE_CURVE_TIME) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); return 1; } else if(node->type==NODE_GROUP) { diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 1bccc8a24c4..575495e186e 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -30,7 +30,7 @@ #include "py_capi_utils.h" -#include "BKE_font.h" /* only for utf8towchar, should replace with py funcs but too late in release now */ +#include "BLI_string_utf8.h" /* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */ #ifdef _WIN32 /* BLI_setenv */ #include "BLI_path_util.h" @@ -184,6 +184,15 @@ void PyC_FileAndNum(const char **filename, int *lineno) } } +void PyC_FileAndNum_Safe(const char **filename, int *lineno) +{ + if(!PYC_INTERPRETER_ACTIVE) { + return; + } + + PyC_FileAndNum(filename, lineno); +} + /* Would be nice if python had this built in */ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...) { @@ -469,7 +478,7 @@ void PyC_SetHomePath(const char *py_path_bundle) /* cant use this, on linux gives bug: #23018, TODO: try LANG="en_US.UTF-8" /usr/bin/blender, suggested 22008 */ /* mbstowcs(py_path_bundle_wchar, py_path_bundle, FILE_MAXDIR); */ - utf8towchar(py_path_bundle_wchar, py_path_bundle); + BLI_strncpy_wchar_from_utf8(py_path_bundle_wchar, py_path_bundle, sizeof(py_path_bundle_wchar) / sizeof(wchar_t)); Py_SetPythonHome(py_path_bundle_wchar); // printf("found python (wchar_t) '%ls'\n", py_path_bundle_wchar); diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 03a8637710e..f38ce209be2 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -36,6 +36,7 @@ PyObject * PyC_ExceptionBuffer(void); PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...); PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...); void PyC_FileAndNum(const char **filename, int *lineno); +void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix); /* follow http://www.python.org/dev/peps/pep-0383/ */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index aaa813137c6..ddbd557375c 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -52,12 +52,12 @@ #include "BLI_path_util.h" #include "BLI_math_base.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_text.h" -#include "BKE_font.h" /* only for utf8towchar */ #include "BKE_main.h" #include "BKE_global.h" /* only for script checking */ @@ -194,7 +194,7 @@ void BPY_python_start(int argc, const char **argv) /* not essential but nice to set our name */ static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ - utf8towchar(bprogname_wchar, bprogname); + BLI_strncpy_wchar_from_utf8(bprogname_wchar, bprogname, sizeof(bprogname_wchar) / sizeof(wchar_t)); Py_SetProgramName(bprogname_wchar); /* must run before python initializes */ diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index b5fd7851458..7e8b9b7b6df 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -44,6 +44,7 @@ #include "../generic/bpy_internal_import.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "RNA_access.h" #include "RNA_enum_types.h" diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 7835ae6dcd3..3db73816025 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2261,7 +2261,7 @@ static void ntree_render_scenes(Render *re) restore_scene= (scene != re->scene); node->id->flag &= ~LIB_DOIT; - NodeTagChanged(re->scene->nodetree, node); + nodeUpdate(re->scene->nodetree, node); } } } @@ -2468,7 +2468,7 @@ static void do_render_composite_fields_blur_3d(Render *re) ntreeCompositTagAnimated(ntree); } - if(ntree && re->r.scemode & R_DOCOMP) { + if(ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) { /* checks if there are render-result nodes that need scene */ if((re->r.scemode & R_SINGLE_LAYER)==0) ntree_render_scenes(re); diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 7a39342ac8d..a73bf93841d 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -481,12 +481,12 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data) layer= &data->layers[i]; if (layer->type == CD_MTFACE) { - strcpy(obr->mtface[mtfn++], layer->name); + BLI_strncpy(obr->mtface[mtfn++], layer->name, sizeof(layer->name)); obr->actmtface= CLAMPIS(layer->active_rnd, 0, numtf); obr->bakemtface= layer->active; } else if (layer->type == CD_MCOL) { - strcpy(obr->mcol[mcn++], layer->name); + BLI_strncpy(obr->mcol[mcn++], layer->name, sizeof(layer->name)); obr->actmcol= CLAMPIS(layer->active_rnd, 0, numcol); } } diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index fec59e97194..f28fb08ac6e 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -341,8 +341,8 @@ typedef struct wmEvent { short val; /* press, release, scrollvalue */ int x, y; /* mouse pointer position, screen coord */ int mval[2]; /* region mouse position, name convention pre 2.5 :) */ - short unicode; /* future, ghost? */ - char ascii; /* from ghost */ + char utf8_buf[6]; /* from, ghost if utf8 is enabled for the platform */ + char ascii; /* from ghost, fallback if utf8 isnt set */ char pad; /* previous state */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 33e98007fed..6fd84b4c315 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1146,7 +1146,7 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi) /* the matching rules */ if(kmitype==KM_TEXTINPUT) - if(ISTEXTINPUT(winevent->type) && winevent->ascii) return 1; + if(ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1; if(kmitype!=KM_ANY) if(winevent->type!=kmitype) return 0; @@ -2578,6 +2578,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U GHOST_TEventKeyData *kd= customdata; event.type= convert_key(kd->key); event.ascii= kd->ascii; + strcpy(event.utf8_buf, kd->utf8_buf); event.val= (type==GHOST_kEventKeyDown)?KM_PRESS:KM_RELEASE; /* exclude arrow keys, esc, etc from text input */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b0183d05ac2..1face062e7e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -56,7 +56,6 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" /*for WM_operator_pystring */ #include "BLI_math.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" @@ -105,6 +104,11 @@ static GHash *global_ops_hash= NULL; +#ifdef WITH_PYTHON_UI_INFO +# include "DNA_text_types.h" +# include "BKE_text.h" +#endif + /* ************ operator API, exported ********** */ @@ -3505,6 +3509,79 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot) MEM_freeN(ot); } +#ifdef WITH_PYTHON_UI_INFO + +static ScrArea *biggest_text_view(bContext *C) +{ + bScreen *sc= CTX_wm_screen(C); + ScrArea *sa, *big= NULL; + int size, maxsize= 0; + + for(sa= sc->areabase.first; sa; sa= sa->next) { + if(sa->spacetype==SPACE_TEXT) { + size= sa->winx * sa->winy; + if(size > maxsize) { + maxsize= size; + big= sa; + } + } + } + return big; +} + +static int wm_text_edit_exec(bContext *C, wmOperator *op) +{ + Main *bmain= CTX_data_main(C); + Text *text; + + char filepath[240]; + int line= RNA_int_get(op->ptr, "line"); + RNA_string_get(op->ptr, "filepath", filepath); + + for (text=bmain->text.first; text; text=text->id.next) { + if (text->name && BLI_path_cmp(text->name, filepath) == 0) { + break; + } + } + + if (text == NULL) { + text= add_text(filepath, bmain->name); + } + + if (text == NULL) { + BKE_reportf(op->reports, RPT_WARNING, "file: '%s' can't be opened", filepath); + return OPERATOR_CANCELLED; + } + else { + /* naughty!, find text area to set, not good behavior + * but since this is a dev tool lets allow it - campbell */ + ScrArea *sa= biggest_text_view(C); + if(sa) { + SpaceText *st= sa->spacedata.first; + st->text= text; + } + + txt_move_toline(text, line - 1, FALSE); + WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); + } + + return OPERATOR_FINISHED; +} + +static void WM_OT_text_edit(wmOperatorType *ot) +{ + ot->name= "Edit Text File"; + ot->idname= "WM_OT_text_edit"; + + ot->exec= wm_text_edit_exec; + + RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "Path", ""); + RNA_def_int(ot->srna, "line", 0, INT_MIN, INT_MAX, "Line", "", 0, INT_MAX); +} + +#endif /* WITH_PYTHON_UI_INFO */ + + /* ******************************************************* */ /* called on initialize WM_exit() */ void wm_operatortype_free(void) @@ -3548,6 +3625,10 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_collada_import); #endif +#ifdef WITH_PYTHON_UI_INFO + WM_operatortype_append(WM_OT_text_edit); +#endif + } /* circleselect-like modal operators */ diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 56e9494a43e..e8cc6e1877d 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -88,8 +88,8 @@ if(WITH_GAMEENGINE) add_definitions(-DWITH_GAMEENGINE) endif() -if(NOT WITH_SDL) - add_definitions(-DDISABLE_SDL) +if(WITH_SDL) + add_definitions(-DWITH_SDL) endif() if(WITH_BINRELOC) diff --git a/source/creator/creator.c b/source/creator/creator.c index d9de5a7cdc4..b357f7b48f2 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -309,7 +309,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data) #else printf (" $TMP or $TMPDIR Store temporary files here.\n"); #endif -#ifndef DISABLE_SDL +#ifdef WITH_SDL printf (" $SDL_AUDIODRIVER LibSDL audio driver - alsa, esd, dma.\n"); #endif printf (" $PYTHONHOME Path to the python directory, eg. /usr/lib/python.\n\n"); @@ -1248,7 +1248,7 @@ int main(int argc, const char **argv) /* this is properly initialized with user defs, but this is default */ BLI_where_is_temp(btempdir, FILE_MAX, 1); /* call after loading the startup.blend so we can read U.tempdir */ -#ifndef DISABLE_SDL +#ifdef WITH_SDL BLI_setenv("SDL_VIDEODRIVER", "dummy"); #endif } diff --git a/source/darwin/blender.app/Contents/Info.plist b/source/darwin/blender.app/Contents/Info.plist index 9aeb617a051..37920dc8181 100644 --- a/source/darwin/blender.app/Contents/Info.plist +++ b/source/darwin/blender.app/Contents/Info.plist @@ -46,7 +46,7 @@ <key>LSEnvironment</key> <dict> <key>OMP_NUM_THREADS</key> - <string></string> + <string>4</string> </dict> </dict> </plist> diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist index 44d6783599c..eb80955e5a6 100644 --- a/source/darwin/set_simulation_threads.app/Contents/Info.plist +++ b/source/darwin/set_simulation_threads.app/Contents/Info.plist @@ -34,9 +34,9 @@ <key>name</key> <string>ScriptWindowState</string> <key>positionOfDivider</key> - <real>470</real> + <real>493</real> <key>savedFrame</key> - <string>199 169 1197 810 0 0 1920 1178 </string> + <string>698 332 1163 846 0 0 1920 1178 </string> <key>selectedTabView</key> <string>result</string> </dict> diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt Binary files differindex d905e27cb6d..fa562578a80 100644 --- a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc Binary files differindex 54735c5cb04..540621d0b9e 100644 --- a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc diff --git a/source/darwin/set_simulation_threads_applescript.scpt b/source/darwin/set_simulation_threads_applescript.scpt Binary files differdeleted file mode 100644 index 82ea5357de5..00000000000 --- a/source/darwin/set_simulation_threads_applescript.scpt +++ /dev/null diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index ce542671425..af4df5035bb 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -360,7 +360,14 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO)); ketsjiengine->SetCameraOverrideProjectionMatrix(MT_CmMatrix4x4(rv3d->winmat)); ketsjiengine->SetCameraOverrideViewMatrix(MT_CmMatrix4x4(rv3d->viewmat)); - ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); + if(rv3d->persp == RV3D_ORTHO) + { + ketsjiengine->SetCameraOverrideClipping(-v3d->far, v3d->far); + } + else + { + ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far); + } ketsjiengine->SetCameraOverrideLens(v3d->lens); } diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index bd417165337..9a57de60517 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -131,8 +131,8 @@ if(WITH_SDL) list(APPEND INC_SYS ${SDL_INCLUDE_DIR} ) -else() - add_definitions(-DDISABLE_SDL) + + add_definitions(-DWITH_SDL) endif() blender_add_lib(ge_logic "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index 48ba09e67d2..0547d97285d 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -29,8 +29,8 @@ * \ingroup gamelogic */ -#ifndef DISABLE_SDL -#include <SDL.h> +#ifdef WITH_SDL +# include <SDL.h> #endif #include <stdio.h> @@ -57,7 +57,7 @@ SCA_Joystick::SCA_Joystick(short int index) for(int i=0; i<JOYHAT_MAX; i++) m_hat_array[i]= 0; -#ifndef DISABLE_SDL +#ifdef WITH_SDL m_private = new PrivateData(); #endif } @@ -66,7 +66,7 @@ SCA_Joystick::SCA_Joystick(short int index) SCA_Joystick::~SCA_Joystick() { -#ifndef DISABLE_SDL +#ifdef WITH_SDL delete m_private; #endif } @@ -77,9 +77,9 @@ int SCA_Joystick::m_refCount = 0; SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) { -#ifdef DISABLE_SDL +#ifndef WITH_SDL return NULL; -#else +#else /* WITH_SDL */ if (joyindex < 0 || joyindex >= JOYINDEX_MAX) { echo("Error-invalid joystick index: " << joyindex); return NULL; @@ -107,14 +107,14 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) m_refCount++; } return m_instance[joyindex]; -#endif +#endif /* WITH_SDL */ } void SCA_Joystick::ReleaseInstance() { if (--m_refCount == 0) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL int i; for (i=0; i<JOYINDEX_MAX; i++) { if (m_instance[i]) { @@ -125,7 +125,7 @@ void SCA_Joystick::ReleaseInstance() } SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO); -#endif +#endif /* WITH_SDL */ } } @@ -163,7 +163,7 @@ bool SCA_Joystick::aAxisIsPositive(int axis_single) bool SCA_Joystick::aAnyButtonPressIsPositive(void) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL /* this is needed for the "all events" option * so we know if there are no buttons pressed */ for (int i=0; i<m_buttonmax; i++) @@ -175,7 +175,7 @@ bool SCA_Joystick::aAnyButtonPressIsPositive(void) bool SCA_Joystick::aButtonPressIsPositive(int button) { -#ifdef DISABLE_SDL +#ifndef WITH_SDL return false; #else bool result; @@ -187,7 +187,7 @@ bool SCA_Joystick::aButtonPressIsPositive(int button) bool SCA_Joystick::aButtonReleaseIsPositive(int button) { -#ifdef DISABLE_SDL +#ifndef WITH_SDL return false; #else bool result; @@ -221,11 +221,11 @@ int SCA_Joystick::GetNumberOfHats() bool SCA_Joystick::CreateJoystickDevice(void) { -#ifdef DISABLE_SDL +#ifndef WITH_SDL m_isinit = true; m_axismax = m_buttonmax = m_hatmax = 0; return false; -#else +#else /* WITH_SDL */ if(m_isinit == false){ if (m_joyindex>=m_joynum) { // don't print a message, because this is done anyway @@ -257,13 +257,13 @@ bool SCA_Joystick::CreateJoystickDevice(void) } return true; -#endif +#endif /* WITH_SDL */ } void SCA_Joystick::DestroyJoystickDevice(void) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL if (m_isinit){ if(SDL_JoystickOpened(m_joyindex)){ echo("Closing-joystick " << m_joyindex); @@ -271,12 +271,12 @@ void SCA_Joystick::DestroyJoystickDevice(void) } m_isinit = false; } -#endif +#endif /* WITH_SDL */ } int SCA_Joystick::Connected(void) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL if (m_isinit && SDL_JoystickOpened(m_joyindex)) return 1; #endif @@ -285,7 +285,7 @@ int SCA_Joystick::Connected(void) int SCA_Joystick::pGetAxis(int axisnum, int udlr) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL return m_axis_array[(axisnum*2)+udlr]; #endif return 0; @@ -293,7 +293,7 @@ int SCA_Joystick::pGetAxis(int axisnum, int udlr) int SCA_Joystick::pAxisTest(int axisnum) { -#ifndef DISABLE_SDL +#ifdef WITH_SDL short i1= m_axis_array[(axisnum*2)]; short i2= m_axis_array[(axisnum*2)+1]; @@ -304,7 +304,7 @@ int SCA_Joystick::pAxisTest(int axisnum) if (i2 < 0) i2 = -i2; if (i1 <i2) return i2; else return i1; -#else +#else /* WITH_SDL */ return 0; -#endif +#endif /* WITH_SDL */ } diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h index f371955ffc6..4e3e3ef656d 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h @@ -33,8 +33,8 @@ #define _SCA_JOYSTICK_H_ #include "SCA_JoystickDefines.h" -#ifndef DISABLE_SDL -#include "SDL.h" +#ifdef WITH_SDL +# include "SDL.h" #endif /** @@ -52,7 +52,7 @@ class SCA_Joystick static int m_refCount; class PrivateData; -#ifndef DISABLE_SDL +#ifdef WITH_SDL PrivateData *m_private; #endif int m_joyindex; @@ -89,7 +89,7 @@ class SCA_Joystick bool m_istrig_button; bool m_istrig_hat; -#ifndef DISABLE_SDL +#ifdef WITH_SDL /** * event callbacks */ @@ -102,7 +102,7 @@ class SCA_Joystick void OnBallMotion(SDL_Event *sdl_event){} #endif -#endif +#endif /* WITH_SDL */ /** * Open the joystick */ @@ -193,7 +193,7 @@ public: */ int Connected(void); }; -#ifndef DISABLE_SDL +#ifdef WITH_SDL void Joystick_HandleEvents( void ); #endif diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp index b6e313aa6c2..e1ab364ae67 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp @@ -29,15 +29,15 @@ * \ingroup gamelogic */ -#ifndef DISABLE_SDL -#include <SDL.h> +#ifdef WITH_SDL +# include <SDL.h> #endif #include "SCA_Joystick.h" #include "SCA_JoystickPrivate.h" -#ifndef DISABLE_SDL +#ifdef WITH_SDL void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event) { if(sdl_event->jaxis.axis >= JOYAXIS_MAX) @@ -125,4 +125,4 @@ void SCA_Joystick::HandleEvents(void) } } } -#endif +#endif /* WITH_SDL */ diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h index 02dd8145bb7..472a7353190 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickPrivate.h @@ -33,7 +33,7 @@ #define __SCA_JOYSTICKPRIVATE_H__ #include "SCA_Joystick.h" -#ifndef DISABLE_SDL +#ifdef WITH_SDL class SCA_Joystick::PrivateData { public: @@ -47,6 +47,6 @@ public: { } }; -#endif +#endif /* WITH_SDL */ #endif diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp index b61e4f4edca..2942384055b 100644 --- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp @@ -65,7 +65,7 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime) } else { ; -#ifndef DISABLE_SDL +#ifdef WITH_SDL SCA_Joystick::HandleEvents(); /* Handle all SDL Joystick events */ #endif SG_DList::iterator<SCA_JoystickSensor> it(m_sensors); diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript index d6323882267..62bdbc29544 100644 --- a/source/gameengine/GameLogic/SConscript +++ b/source/gameengine/GameLogic/SConscript @@ -10,9 +10,8 @@ incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph' defs = [] if env['WITH_BF_SDL']: + defs.append('WITH_SDL') incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') if env['WITH_BF_PYTHON']: incs += ' ' + env['BF_PYTHON_INC'] diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index f5bd3a91c26..ea17b9adcfd 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -309,7 +309,7 @@ static void get_filename(int argc, char **argv, char *filename) #endif // !_APPLE } -static BlendFileData *load_game_data(char *progname, char *filename = NULL, char *relativename = NULL) +static BlendFileData *load_game_data(const char *progname, char *filename = NULL, char *relativename = NULL) { ReportList reports; BlendFileData *bfd = NULL; @@ -321,7 +321,7 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char bfd= BLO_read_runtime(progname, &reports); if (bfd) { bfd->type= BLENFILETYPE_RUNTIME; - strcpy(bfd->main->name, progname); + BLI_strncpy(bfd->main->name, progname, sizeof(bfd->main->name)); } } else { bfd= BLO_read_from_file(progname, &reports); @@ -766,7 +766,7 @@ int main(int argc, char** argv) char basedpath[240]; // base the actuator filename relative to the last file - strcpy(basedpath, exitstring.Ptr()); + BLI_strncpy(basedpath, exitstring.Ptr(), sizeof(basedpath)); BLI_path_abs(basedpath, pathname); bfd = load_game_data(basedpath); diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp index 08794042e37..9e8f53ad219 100644 --- a/source/gameengine/Ketsji/BL_Action.cpp +++ b/source/gameengine/Ketsji/BL_Action.cpp @@ -361,9 +361,6 @@ void BL_Action::Update(float curtime) break; } - - if (!m_done) - InitIPO(); } if (m_obj->GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) @@ -446,8 +443,6 @@ void BL_Action::Update(float curtime) obj->SetActiveAction(NULL, 0, curtime); } - - InitIPO(); m_obj->UpdateIPO(m_localtime, m_ipo_flags & ACT_IPOFLAG_CHILD); } } diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 9d8b1781869..329ac890cd2 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -225,8 +225,7 @@ if(WITH_SDL) list(APPEND INC_SYS ${SDL_INCLUDE_DIR} ) -else() - add_definitions(-DDISABLE_SDL) + add_definitions(-DWITH_SDL) endif() if(WITH_CODEC_FFMPEG) diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 8e6126bb173..afc3bf2b53d 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1400,8 +1400,14 @@ void KX_KetsjiEngine::PostProcessScene(KX_Scene* scene) KX_Camera* activecam = NULL; RAS_CameraData camdata = RAS_CameraData(); - if (override_camera) camdata.m_lens = m_overrideCamLens; - + if (override_camera) + { + camdata.m_lens = m_overrideCamLens; + camdata.m_clipstart = m_overrideCamNear; + camdata.m_clipend = m_overrideCamFar; + + camdata.m_perspective= !m_overrideCamUseOrtho; + } activecam = new KX_Camera(scene,KX_Scene::m_callbacks,camdata); activecam->SetName("__default__cam__"); diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 34f5c26415d..e1978263a12 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -240,29 +240,23 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) /* build the from and to point in normalized device coordinates - * Looks like normailized device coordinates are [-1,1] in x [-1,1] in y - * [0,-1] in z + * Normalized device coordinates are [-1,1] in x, y, z * * The actual z coordinates used don't have to be exact just infront and * behind of the near and far clip planes. */ frompoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, 1.0 - (2 * (m_y_inv - y_lb) / height), - /*cam->GetCameraData()->m_perspective ? 0.0:cdata->m_clipstart,*/ /* real clipstart is scaled in ortho for some reason, zero is ok */ - 0.0, /* nearclip, see above comments */ + -1.0, 1.0 ); topoint.setValue( (2 * (m_x-x_lb) / width) - 1.0, 1.0 - (2 * (m_y_inv-y_lb) / height), - cam->GetCameraData()->m_perspective ? 1.0:cam->GetCameraData()->m_clipend, /* farclip, see above comments */ + 1.0, 1.0 ); - - /* camera to world */ - MT_Transform wcs_camcs_tranform = cam->GetWorldToCamera(); - MT_Transform cams_wcs_transform; - cams_wcs_transform.invert(wcs_camcs_tranform); - MT_Matrix4x4 camcs_wcs_matrix = MT_Matrix4x4(cams_wcs_transform); + /* camera to world */ + MT_Matrix4x4 camcs_wcs_matrix = MT_Matrix4x4(cam->GetCameraToWorld()); /* badly defined, the first time round.... I wonder why... I might * want to guard against floating point errors here.*/ @@ -272,6 +266,8 @@ bool KX_MouseFocusSensor::ParentObjectHasFocusCamera(KX_Camera *cam) /* shoot-points: clip to cam to wcs . win to clip was already done.*/ frompoint = clip_camcs_matrix * frompoint; topoint = clip_camcs_matrix * topoint; + /* clipstart = - (frompoint[2] / frompoint[3]) + * clipend = - (topoint[2] / topoint[3]) */ frompoint = camcs_wcs_matrix * frompoint; topoint = camcs_wcs_matrix * topoint; diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 40917a67c2f..e86831b9323 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1816,7 +1816,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur /* Yet another gotcha in the py api * Cant run PySys_SetArgv more then once because this adds the * binary dir to the sys.path each time. - * Id have thaught python being totally restarted would make this ok but + * Id have thought python being totally restarted would make this ok but * somehow it remembers the sys.path - Campbell */ static bool first_time = true; diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript index 9b453ed76d5..064f09df9f3 100644 --- a/source/gameengine/Ketsji/SConscript +++ b/source/gameengine/Ketsji/SConscript @@ -27,8 +27,7 @@ incs += ' ' + env['BF_OPENGL_INC'] if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') + defs.append('WITH_SDL') if env['WITH_BF_PYTHON']: incs += ' ' + env['BF_PYTHON_INC'] diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp index edacd1dd0f1..6ca402691cb 100644 --- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp +++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp @@ -99,7 +99,7 @@ ComputeDefaultOrtho( frustum.x1 = -frustum.x2; frustum.y2 = sizeY; frustum.y1 = -frustum.y2; - frustum.camnear = -camfar; + frustum.camnear = camnear; frustum.camfar = camfar; } diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt index c5a6831a4cb..64cc79de879 100644 --- a/source/tests/CMakeLists.txt +++ b/source/tests/CMakeLists.txt @@ -43,7 +43,7 @@ else() endif() # for testing with valgrind prefix: valgrind --track-origins=yes --error-limit=no -set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} --background --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts) +set(TEST_BLENDER_EXE ${TEST_BLENDER_EXE} --background -noaudio --factory-startup --env-system-scripts ${CMAKE_SOURCE_DIR}/release/scripts) # ------------------------------------------------------------------------------ diff --git a/source/tests/rna_info_dump.py b/source/tests/rna_info_dump.py index 62c1248d733..293c02dfb84 100644 --- a/source/tests/rna_info_dump.py +++ b/source/tests/rna_info_dump.py @@ -19,7 +19,7 @@ # <pep8 compliant> # Used for generating API diff's between releases -# ./blender.bin --background --python release/test/rna_info_dump.py +# ./blender.bin --background -noaudio --python release/test/rna_info_dump.py import bpy |