From 408a2c62b974c10c7d19ad419dfca479dec59f65 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 00:41:48 +0000 Subject: fix for armatures in wire draw mode not displaying in solid mode. note, this isn't a showstopper bugfix. --- source/blender/editors/space_view3d/drawarmature.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- cgit v1.2.3 From 0d7bd0f9b63db4c7891137d18ae6a40e652e190f Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 19 Oct 2011 17:08:35 +0000 Subject: Adds an update flag to the bNode struct (similar to bNodeTree->update). This prevents access to non-existent typeinfo during type initialization, when node types have been removed and such nodes are deleted from older files. All blenkernel functions now only set the node->update flag instead of directly calling the update function. All operators, etc. calling blenkernel functions to modify nodes should make a ntreeUpdate call afterward (they already did that anyway). Editor/RNA/renderer/etc. high-level functions still can do immediate updates by using nodeUpdate and nodeUpdateID (replacing NodeTagChanged/NodeTagIDChanged respectively). These old functions were previously used only for setting compositor node needexec flags and clearing cached data, but have become generic update functions that require type-specific functionality (i.e. a valid typeinfo struct). --- source/blender/blenkernel/BKE_node.h | 7 ++- source/blender/blenkernel/intern/depsgraph.c | 2 +- source/blender/blenkernel/intern/image.c | 2 +- source/blender/blenkernel/intern/node.c | 52 +++++++++++++--------- source/blender/editors/render/render_internal.c | 4 +- source/blender/editors/space_node/node_draw.c | 4 +- source/blender/editors/space_node/node_edit.c | 22 ++++----- source/blender/editors/space_node/space_node.c | 4 +- source/blender/makesdna/DNA_node_types.h | 11 ++++- source/blender/makesrna/intern/rna_nodetree.c | 4 +- .../blender/nodes/composite/node_composite_tree.c | 27 ++++++----- source/blender/nodes/intern/node_common.c | 6 ++- source/blender/nodes/shader/node_shader_tree.c | 7 ++- source/blender/nodes/texture/node_texture_tree.c | 2 +- source/blender/render/intern/source/pipeline.c | 2 +- 15 files changed, 92 insertions(+), 64 deletions(-) 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/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 80a40c0a3a3..8d0c20ecc52 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1962,7 +1962,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/image.c b/source/blender/blenkernel/intern/image.c index cf8f96c143a..1de581034a4 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -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/node.c b/source/blender/blenkernel/intern/node.c index f0be3c99f13..a46b358798a 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 */ @@ -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/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/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/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/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 061a21056d0..7d20378d55e 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); 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; indextype==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..4dbf4b96b74 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; 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/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 7835ae6dcd3..19dc0538dba 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); } } } -- cgit v1.2.3 From c97aa671f4f5082d61f5e8f08281323e514708d0 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Wed, 19 Oct 2011 18:21:08 +0000 Subject: == Sequencer == do_versions fix: hd audio tracks within metastrips were not properly upgraded from 2.49 files, resulting in broken unusable tracks, which were rendered as black strips as a bonus. --- source/blender/blenloader/intern/readfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index dfaf96a6066..a6474fb5044 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10215,8 +10215,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]; @@ -10236,6 +10235,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) seq->strip->dir); } } + SEQ_END } } -- cgit v1.2.3 From 4d2a28c2a9408463b182e67c47accb31b8ea7df9 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Wed, 19 Oct 2011 18:46:16 +0000 Subject: Revert own commit 41026. It now had issues when hiding menus with the - icon, space selector disappeared. I am sorry for that, but I consider this a show stopper eventually. :( This commit introduces the issue with narrowed verts/edge/face select in solid/edit mode again. --- release/scripts/startup/bl_ui/space_view3d.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index e4beee66871..c6a26cd9bbf 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -56,9 +56,9 @@ class VIEW3D_HT_header(Header): # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode... - layout.template_header_3D() + row = layout.row() #XXX Narrowed down vert/edge/face selector in edit mode/solid drawmode. -DingTo + row.template_header_3D() - row = layout.row() if obj: # Particle edit if obj.mode == 'PARTICLE_EDIT': -- cgit v1.2.3 From c661a4b1ab80162d0fac4fd0e2066b806e2acdce Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 19 Oct 2011 19:12:41 +0000 Subject: OSX: set at least initial OMP_NUM_THREADS value to avoid warnings in log, remove applescript for now --- source/darwin/blender.app/Contents/Info.plist | 2 +- .../set_simulation_threads.app/Contents/Info.plist | 44 --------------------- .../Contents/MacOS/applet | Bin 34480 -> 0 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 - .../Contents/Resources/Scripts/main.scpt | Bin 4696 -> 0 bytes .../Contents/Resources/applet.icns | Bin 40291 -> 0 bytes .../Contents/Resources/applet.rsrc | Bin 362 -> 0 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 -- .../darwin/set_simulation_threads_applescript.scpt | Bin 5144 -> 0 bytes 9 files changed, 1 insertion(+), 50 deletions(-) delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist delete mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet delete mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc delete mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf delete mode 100644 source/darwin/set_simulation_threads_applescript.scpt 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 @@ LSEnvironment OMP_NUM_THREADS - + 4 diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist deleted file mode 100644 index 44d6783599c..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleAllowMixedLocalizations - - CFBundleDevelopmentRegion - English - CFBundleExecutable - applet - CFBundleIconFile - applet - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - set_simulation_threads - CFBundlePackageType - APPL - CFBundleSignature - aplt - LSMinimumSystemVersionByArchitecture - - x86_64 - 10.6 - - LSRequiresCarbon - - WindowState - - dividerCollapsed - - eventLogLevel - -1 - name - ScriptWindowState - positionOfDivider - 470 - savedFrame - 199 169 1197 810 0 0 1920 1178 - selectedTabView - result - - - diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet deleted file mode 100755 index 0079f4b19d4..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo deleted file mode 100644 index 3253614c402..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -APPLaplt \ No newline at end of file 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 deleted file mode 100644 index d905e27cb6d..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns deleted file mode 100644 index fcc1f09273d..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc deleted file mode 100644 index 54735c5cb04..00000000000 Binary files a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc and /dev/null differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf deleted file mode 100644 index 0d0a60c08b5..00000000000 --- a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf +++ /dev/null @@ -1,4 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 -{\fonttbl} -{\colortbl;\red255\green255\blue255;} -} \ No newline at end of file diff --git a/source/darwin/set_simulation_threads_applescript.scpt b/source/darwin/set_simulation_threads_applescript.scpt deleted file mode 100644 index 82ea5357de5..00000000000 Binary files a/source/darwin/set_simulation_threads_applescript.scpt and /dev/null differ -- cgit v1.2.3 From f6f9288f353eed07cb298a7be3585f0bf3f620dd Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Wed, 19 Oct 2011 19:15:35 +0000 Subject: replace former applescript with an editable one --- .../set_simulation_threads.app/Contents/Info.plist | 44 +++++++++++++++++++++ .../Contents/MacOS/applet | Bin 0 -> 34480 bytes .../set_simulation_threads.app/Contents/PkgInfo | 1 + .../Contents/Resources/Scripts/main.scpt | Bin 0 -> 7664 bytes .../Contents/Resources/applet.icns | Bin 0 -> 40291 bytes .../Contents/Resources/applet.rsrc | Bin 0 -> 362 bytes .../Contents/Resources/description.rtfd/TXT.rtf | 4 ++ 7 files changed, 49 insertions(+) create mode 100644 source/darwin/set_simulation_threads.app/Contents/Info.plist create mode 100755 source/darwin/set_simulation_threads.app/Contents/MacOS/applet create mode 100644 source/darwin/set_simulation_threads.app/Contents/PkgInfo create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc create mode 100644 source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf diff --git a/source/darwin/set_simulation_threads.app/Contents/Info.plist b/source/darwin/set_simulation_threads.app/Contents/Info.plist new file mode 100644 index 00000000000..eb80955e5a6 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleAllowMixedLocalizations + + CFBundleDevelopmentRegion + English + CFBundleExecutable + applet + CFBundleIconFile + applet + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + set_simulation_threads + CFBundlePackageType + APPL + CFBundleSignature + aplt + LSMinimumSystemVersionByArchitecture + + x86_64 + 10.6 + + LSRequiresCarbon + + WindowState + + dividerCollapsed + + eventLogLevel + -1 + name + ScriptWindowState + positionOfDivider + 493 + savedFrame + 698 332 1163 846 0 0 1920 1178 + selectedTabView + result + + + diff --git a/source/darwin/set_simulation_threads.app/Contents/MacOS/applet b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet new file mode 100755 index 00000000000..0079f4b19d4 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/MacOS/applet differ diff --git a/source/darwin/set_simulation_threads.app/Contents/PkgInfo b/source/darwin/set_simulation_threads.app/Contents/PkgInfo new file mode 100644 index 00000000000..3253614c402 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/PkgInfo @@ -0,0 +1 @@ +APPLaplt \ No newline at end of file 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 new file mode 100644 index 00000000000..fa562578a80 Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/Scripts/main.scpt differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns new file mode 100644 index 00000000000..fcc1f09273d Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.icns differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc new file mode 100644 index 00000000000..540621d0b9e Binary files /dev/null and b/source/darwin/set_simulation_threads.app/Contents/Resources/applet.rsrc differ diff --git a/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf new file mode 100644 index 00000000000..0d0a60c08b5 --- /dev/null +++ b/source/darwin/set_simulation_threads.app/Contents/Resources/description.rtfd/TXT.rtf @@ -0,0 +1,4 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf230 +{\fonttbl} +{\colortbl;\red255\green255\blue255;} +} \ No newline at end of file -- cgit v1.2.3 From 617d3cb85237c5178b09fefedcd75313653b52ce Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 21:55:27 +0000 Subject: pass -noaudio when running blender for various utilities - doc-gen and tests. --- GNUmakefile | 6 +++--- doc/blender_file_format/BlendFileDnaExporter_25.py | 6 +++--- doc/blender_file_format/README | 6 +++--- doc/python_api/sphinx_doc_gen.py | 4 ++-- doc/python_api/sphinx_doc_gen.sh | 2 +- source/blender/makesrna/rna_cleanup/rna_cleaner.py | 2 +- source/blender/makesrna/rna_cleanup/rna_update.sh | 2 +- source/tests/CMakeLists.txt | 2 +- source/tests/rna_info_dump.py | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index af953143b82..c68c8684687 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -174,7 +174,7 @@ package_archive: # Other Targets # translations: - $(BUILD_DIR)/bin/blender --background --factory-startup --python po/update_msg.py + $(BUILD_DIR)/bin/blender --background -noaudio --factory-startup --python po/update_msg.py python3 po/update_pot.py python3 po/update_po.py python3 po/update_mo.py @@ -238,12 +238,12 @@ check_sparse: # Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation. doc_py: - $(BUILD_DIR)/bin/blender --background --factory-startup --python doc/python_api/sphinx_doc_gen.py + $(BUILD_DIR)/bin/blender --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py cd doc/python_api ; sphinx-build -n -b html sphinx-in sphinx-out @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'" doc_dna: - $(BUILD_DIR)/bin/blender --background --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py + $(BUILD_DIR)/bin/blender --background -noaudio --factory-startup --python doc/blender_file_format/BlendFileDnaExporter_25.py @echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'" doc_man: diff --git a/doc/blender_file_format/BlendFileDnaExporter_25.py b/doc/blender_file_format/BlendFileDnaExporter_25.py index 988c992fd78..bc5b2e73c7e 100755 --- a/doc/blender_file_format/BlendFileDnaExporter_25.py +++ b/doc/blender_file_format/BlendFileDnaExporter_25.py @@ -379,15 +379,15 @@ class DNACatalogHTML: def usage(): - print("\nUsage: \n\tblender2.5 -b -P BlendFileDnaExporter_25.py [-- [options]]") + print("\nUsage: \n\tblender2.5 --background -noaudio --python BlendFileDnaExporter_25.py [-- [options]]") print("Options:") print("\t--dna-keep-blend: doesn't delete the produced blend file DNA export to html") print("\t--dna-debug: sets the logging level to DEBUG (lots of additional info)") print("\t--dna-versioned saves version informations in the html and blend filenames") print("\t--dna-overwrite-css overwrite dna.css, useful when modifying css in the script") print("Examples:") - print("\tdefault: % blender2.5 -b -P BlendFileDnaExporter_25.py") - print("\twith options: % blender2.5 -b -P BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n") + print("\tdefault: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py") + print("\twith options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug\n") ###################################################### diff --git a/doc/blender_file_format/README b/doc/blender_file_format/README index 55dc3b83e49..f28d4b3f6b6 100644 --- a/doc/blender_file_format/README +++ b/doc/blender_file_format/README @@ -16,14 +16,14 @@ Below you have the help message with a list of options you can use. Usage: - blender2.5 -b -P BlendFileDnaExporter_25.py [-- [options]] + blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py [-- [options]] Options: --dna-keep-blend: doesn't delete the produced blend file DNA export to html --dna-debug: sets the logging level to DEBUG (lots of additional info) --dna-versioned saves version informations in the html and blend filenames --dna-overwrite-css overwrite dna.css, useful when modifying css in the script Examples: - default: % blender2.5 -b -P BlendFileDnaExporter_25.py - with options: % blender2.5 -b -P BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug + default: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py + with options: % blender2.5 --background -noaudio --python BlendFileDnaExporter_25.py -- --dna-keep-blend --dna-debug diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 2ccf67e2db4..017c2acc363 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -27,7 +27,7 @@ For HTML generation ------------------- - Run this script from blenders root path once you have compiled blender - ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py + ./blender.bin --background -noaudio --python doc/python_api/sphinx_doc_gen.py This will generate python files in doc/python_api/sphinx-in/ providing ./blender.bin is or links to the blender executable @@ -94,7 +94,7 @@ else: # for quick rebuilds """ rm -rf /b/doc/python_api/sphinx-* && \ -./blender.bin --background --factory-startup --python doc/python_api/sphinx_doc_gen.py && \ +./blender.bin --background -noaudio --factory-startup --python doc/python_api/sphinx_doc_gen.py && \ sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out """ diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 307476d9a92..fad9bfbbf90 100755 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -48,7 +48,7 @@ SPHINXBASE=doc/python_api if $DO_EXE_BLENDER ; then # dont delete existing docs, now partial updates are used for quick builds. - $BLENDER --background --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py + $BLENDER --background -noaudio --factory-startup --python $SPHINXBASE/sphinx_doc_gen.py fi 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/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 @@ # # 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 -- cgit v1.2.3 From 0e66576f02afebdb4016249a9d7013ee5c1f0c36 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 22:40:03 +0000 Subject: replace RNA function string lookups with direct assignments, currently the lookup returns the same pointer every time. some of these functions - panel/operator poll for eg, are called many times per redraw so while not a bottleneck its unnecessary. --- source/blender/makesrna/intern/rna_animation.c | 12 ++++++++--- source/blender/makesrna/intern/rna_render.c | 4 +++- source/blender/makesrna/intern/rna_ui.c | 24 ++++++++++++++++------ source/blender/makesrna/intern/rna_wm.c | 28 +++++++++++++++++++------- 4 files changed, 51 insertions(+), 17 deletions(-) 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_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_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_wm.c b/source/blender/makesrna/intern/rna_wm.c index e9df79acd4a..f8383b1d451 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); -- cgit v1.2.3 From 364fcde86d3cdcb09d075a0445fc2e1eb64170d5 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Wed, 19 Oct 2011 23:04:48 +0000 Subject: #fix: Saving OpenEXR images as floats ignores color profile. This was not noticable in renderer because it works in linear color space. Painting on the image editor, saving and reloading was problematic though. --- .../blender/imbuf/intern/openexr/openexr_api.cpp | 56 ++++++++++++++++------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index e064d7f760d..aa7defb2f39 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -342,27 +342,55 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag FrameBuffer frameBuffer; OutputFile *file = new OutputFile(name, header); - int xstride = sizeof(float) * channels; - int ystride = - xstride*width; - float *rect[4] = {NULL, NULL, NULL, NULL}; - - /* last scanline, stride negative */ - rect[0]= ibuf->rect_float + channels*(height-1)*width; - rect[1]= rect[0]+1; - rect[2]= rect[0]+2; - rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isnt written? */ - - frameBuffer.insert ("R", Slice (FLOAT, (char *)rect[0], xstride, ystride)); - frameBuffer.insert ("G", Slice (FLOAT, (char *)rect[1], xstride, ystride)); - frameBuffer.insert ("B", Slice (FLOAT, (char *)rect[2], xstride, ystride)); + int xstride = sizeof(float) * 4; + int ystride = xstride*width; + float *init_to = new float [4 * width*height * sizeof(float)]; + float *from, *to = init_to; + + frameBuffer.insert ("R", Slice (FLOAT, (char *)init_to, xstride, ystride)); + frameBuffer.insert ("G", Slice (FLOAT, (char *)(init_to + 1), xstride, ystride)); + frameBuffer.insert ("B", Slice (FLOAT, (char *)(init_to + 2), xstride, ystride)); if (ibuf->depth==32 && channels >= 4) - frameBuffer.insert ("A", Slice (FLOAT, (char *)rect[3], xstride, ystride)); + frameBuffer.insert ("A", Slice (FLOAT, (char *)(init_to + 3), xstride, ystride)); if (write_zbuf) frameBuffer.insert ("Z", Slice (FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width), sizeof(float), sizeof(float) * -width)); + + if(ibuf->profile == IB_PROFILE_LINEAR_RGB) { + for (int i = ibuf->y-1; i >= 0; i--) + { + from= ibuf->rect_float + channels*i*width; + + for (int j = ibuf->x; j > 0; j--) + { + to[0] = from[0]; + to[1] = from[1]; + to[2] = from[2]; + to[3] = (channels >= 4)? from[3]: 1.0f; + to+= 4; from += 4; + } + } + } + else { + for (int i = ibuf->y-1; i >= 0; i--) + { + from= ibuf->rect_float + channels*i*width; + + for (int j = ibuf->x; j > 0; j--) + { + to[0] = srgb_to_linearrgb(from[0]); + to[1] = srgb_to_linearrgb(from[1]); + to[2] = srgb_to_linearrgb(from[2]); + to[3] = (channels >= 4)? from[3]: 1.0f; + to+= 4; from += 4; + } + } + } + file->setFrameBuffer (frameBuffer); file->writePixels (height); delete file; + delete [] init_to; } catch (const std::exception &exc) { -- cgit v1.2.3 From 5cf593a778e3dca51a5ebd6b4c23ce6c7b0a7ac6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2011 23:10:54 +0000 Subject: strcpy() --> BLI_strncpy(), where source strings are not fixed and target size is known. --- source/blender/blenkernel/BKE_packedFile.h | 2 +- source/blender/blenkernel/intern/image.c | 6 +-- source/blender/blenkernel/intern/modifier.c | 4 +- source/blender/blenkernel/intern/node.c | 2 +- source/blender/blenkernel/intern/packedFile.c | 53 +++++++++++----------- source/blender/blenkernel/intern/pointcache.c | 10 ++-- source/blender/blenkernel/intern/property.c | 6 +-- source/blender/blenkernel/intern/sequencer.c | 14 +++--- source/blender/blenkernel/intern/sound.c | 4 +- source/blender/blenkernel/intern/texture.c | 2 +- source/blender/blenlib/intern/fileops.c | 8 ++-- source/blender/blenlib/intern/freetypefont.c | 2 +- source/blender/blenlib/intern/storage.c | 12 ++--- source/blender/blenloader/BLO_readfile.h | 2 +- source/blender/blenloader/BLO_runtime.h | 4 +- source/blender/blenloader/intern/readblenentry.c | 2 +- source/blender/blenloader/intern/readfile.c | 16 +++---- source/blender/blenloader/intern/runtime.c | 4 +- source/blender/collada/AnimationImporter.cpp | 4 +- source/blender/editors/armature/editarmature.c | 6 +-- source/blender/editors/armature/poselib.c | 9 ++-- .../blender/editors/gpencil/editaction_gpencil.c | 2 +- source/blender/editors/interface/resources.c | 2 +- source/blender/editors/object/object_constraint.c | 2 +- source/blender/editors/object/object_relations.c | 10 ++-- source/blender/editors/object/object_vgroup.c | 2 +- source/blender/editors/render/render_preview.c | 2 +- source/blender/editors/screen/screendump.c | 2 +- source/blender/editors/sculpt_paint/paint_image.c | 4 +- source/blender/editors/sculpt_paint/sculpt_undo.c | 2 +- .../editors/space_sequencer/sequencer_add.c | 2 +- .../editors/space_sequencer/sequencer_edit.c | 4 +- source/blender/imbuf/intern/anim_movie.c | 2 +- source/blender/makesrna/intern/rna_lattice.c | 7 +-- source/blender/makesrna/intern/rna_object_force.c | 8 ++-- source/blender/modifiers/intern/MOD_solidify.c | 3 +- source/blender/nodes/intern/node_common.c | 4 +- .../blender/render/intern/source/renderdatabase.c | 4 +- source/gameengine/GamePlayer/ghost/GPG_ghost.cpp | 6 +-- 39 files changed, 118 insertions(+), 122 deletions(-) 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/intern/image.c b/source/blender/blenkernel/intern/image.c index 1de581034a4..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, ""); 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, ""); BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 9de75a49998..2cee9676e5e 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -86,8 +86,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/node.c b/source/blender/blenkernel/intern/node.c index a46b358798a..cb1f52a6265 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -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; } } 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/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/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/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; nummode1, 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/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..220784c9ff7 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -288,7 +288,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 a6474fb5044..667550bcaa0 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9275,7 +9275,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; @@ -9498,7 +9498,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); @@ -9528,7 +9528,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); @@ -12008,8 +12008,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; @@ -13651,8 +13651,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); @@ -13768,7 +13768,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& 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 20368bbf57b..11fd932eed6 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/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/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_relations.c b/source/blender/editors/object/object_relations.c index 389c0941cc2..49a71018719 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -334,11 +334,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 */ @@ -605,7 +603,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 7b4db347315..c1b21865504 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -669,7 +669,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_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/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 c5af8971907..b6b22c391b8 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 13b6fef3004..a32487e7117 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -262,7 +262,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_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/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/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_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index c36dca22731..8db1faee04d 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)); } } diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 757da28e4b5..f2e3a0d016a 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" @@ -183,7 +184,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/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 4dbf4b96b74..6214f39dc0a 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -718,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, @@ -903,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/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/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); -- cgit v1.2.3 From 4512f10db981bdd9083bd6763fc993f2a162ac53 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 00:19:21 +0000 Subject: misc edits - rename define DISABLE_SDL --> WITH_SDL (which was already used in some places) - blenders interation preset was using orbit rather then turntable 3d view preference (different from factory defaults). - tagged some unused rna args. --- build_files/scons/tools/Blender.py | 4 +- release/scripts/presets/interaction/blender.py | 2 +- source/blender/blenkernel/SConscript | 3 +- source/blender/blenlib/BLI_utildefines.h | 2 +- source/blender/makesdna/DNA_space_types.h | 3 +- source/blender/makesrna/intern/rna_action.c | 3 +- source/blender/makesrna/intern/rna_actuator.c | 2 +- source/blender/makesrna/intern/rna_boid.c | 2 +- source/blender/makesrna/intern/rna_curve.c | 2 +- source/blender/makesrna/intern/rna_fluidsim.c | 3 +- source/blender/makesrna/intern/rna_rna.c | 6 +-- source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/makesrna/intern/rna_space.c | 2 +- source/blender/makesrna/intern/rna_texture.c | 10 ++--- source/blender/makesrna/intern/rna_userdef.c | 2 +- source/creator/CMakeLists.txt | 4 +- source/creator/creator.c | 4 +- source/gameengine/GameLogic/CMakeLists.txt | 4 +- .../gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 44 +++++++++++----------- .../gameengine/GameLogic/Joystick/SCA_Joystick.h | 12 +++--- .../GameLogic/Joystick/SCA_JoystickEvents.cpp | 8 ++-- .../GameLogic/Joystick/SCA_JoystickPrivate.h | 4 +- .../gameengine/GameLogic/SCA_JoystickManager.cpp | 2 +- source/gameengine/GameLogic/SConscript | 3 +- source/gameengine/Ketsji/CMakeLists.txt | 3 +- source/gameengine/Ketsji/SConscript | 3 +- 26 files changed, 68 insertions(+), 71 deletions(-) diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index 147316c204a..c802eee4fb6 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -316,8 +316,8 @@ def creator(env): if env['WITH_BF_TIFF']: defs.append('WITH_TIFF') - if not env['WITH_BF_SDL']: - defs.append('DISABLE_SDL') + if env['WITH_BF_SDL']: + defs.append('WITH_SDL') if env['WITH_BF_PYTHON']: incs.append('#/source/blender/python') diff --git a/release/scripts/presets/interaction/blender.py b/release/scripts/presets/interaction/blender.py index 3b6ce13d7e0..c5454e479a3 100644 --- a/release/scripts/presets/interaction/blender.py +++ b/release/scripts/presets/interaction/blender.py @@ -9,5 +9,5 @@ bpy.context.user_preferences.edit.use_insertkey_xyz_to_rgb = False bpy.context.user_preferences.inputs.select_mouse = 'RIGHT' bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY' bpy.context.user_preferences.inputs.view_zoom_axis = 'VERTICAL' -bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL' +bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE' bpy.context.user_preferences.inputs.invert_mouse_zoom = False diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 7d7ab56ec3f..512eec4021f 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -41,8 +41,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/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 456ee72c4e0..b2b3e7381c6 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -221,7 +221,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/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_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 edae977f3f6..49f39a207d2 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 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; 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_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 ccc8151ac7f..09824616936 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1054,7 +1054,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) { 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..03f0a4ba363 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"); } diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index e2f0f4dab1f..9202647981b 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 */ diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index e7a1ff14f03..b4e9d4d262e 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 3ce469de4e8..f6b99a9f73c 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -305,7 +305,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"); @@ -1213,7 +1213,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/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 +#ifdef WITH_SDL +# include #endif #include @@ -57,7 +57,7 @@ SCA_Joystick::SCA_Joystick(short int index) for(int i=0; i= 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=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 +#ifdef WITH_SDL +# include #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 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/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/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'] -- cgit v1.2.3 From 445279524a6c10fc09cd365a63fa9b69e364be83 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 00:48:00 +0000 Subject: debug build option WITH_PYTHON_UI_INFO, so you can right click and edit the python source for UI layout directly. --- CMakeLists.txt | 8 +++ source/blender/editors/interface/interface.c | 18 +++++ .../blender/editors/interface/interface_handlers.c | 11 +++ .../blender/editors/interface/interface_intern.h | 5 ++ source/blender/editors/space_text/space_text.c | 5 ++ source/blender/python/generic/py_capi_utils.c | 9 +++ source/blender/python/generic/py_capi_utils.h | 1 + source/blender/windowmanager/intern/wm_operators.c | 82 ++++++++++++++++++++++ 8 files changed, 139 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cfda3a01e6..6e3247a7d2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,6 +213,10 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC) option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF) mark_as_advanced(WITH_ASSERT_ABORT) +option(WITH_PYTHON_UI_INFO "Allow navigating to UI source from the context menu" OFF) +mark_as_advanced(WITH_PYTHON_UI_INFO) + + if(APPLE) if(NOT CMAKE_OSX_ARCHITECTURES) set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING @@ -1326,6 +1330,10 @@ if(WITH_ASSERT_ABORT) add_definitions(-DWITH_ASSERT_ABORT) endif() +if(WITH_PYTHON_UI_INFO) + add_definitions(-DWITH_PYTHON_UI_INFO) +endif() + # message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}") # message(STATUS "Using CXXFLAGS: ${CMAKE_CXX_FLAGS}") diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b6c72c2e96f..ac1fab365f0 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -2559,6 +2559,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_handlers.c b/source/blender/editors/interface/interface_handlers.c index f4400d2d7db..4df9d7f12e2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4438,6 +4438,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..c5843397c12 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 { 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/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 1bccc8a24c4..e658532db24 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -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, ...) { 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/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index b0183d05ac2..4924457da1a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -105,6 +105,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 +3510,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 +3626,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 */ -- cgit v1.2.3 From 8e58fceab1452fc914e0fe88aaf7ecc80ea9bdb6 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Thu, 20 Oct 2011 05:18:02 +0000 Subject: Bugfix [#28976] crash when moving keys in dopesheet editor --- source/blender/editors/transform/transform_conversions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index c4295b15858..879dc425091 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2947,7 +2947,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++) { -- cgit v1.2.3 From 9bbec84e7e14f11f86baeaea6a9a2bce6b7499de Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 05:30:26 +0000 Subject: initial support for unicode keyboard input for ghost & blenders WM. - currently X11 only, depends on Xinput (but should not break other os's). - ghost stores utf8 buffer, copies to wmEvent's - UI text input is currently the only area that uses this - not console or text editor. - no rna access yet. --- intern/ghost/GHOST_Types.h | 1 + intern/ghost/intern/GHOST_EventKey.h | 5 +- intern/ghost/intern/GHOST_SystemCarbon.cpp | 2 +- intern/ghost/intern/GHOST_SystemCocoa.mm | 6 ++- intern/ghost/intern/GHOST_SystemSDL.cpp | 2 +- intern/ghost/intern/GHOST_SystemWin32.cpp | 3 +- intern/ghost/intern/GHOST_SystemX11.cpp | 55 +++++++++++++++++++++- intern/ghost/intern/GHOST_SystemX11.h | 17 +++++++ intern/ghost/intern/GHOST_WindowX11.cpp | 14 ++++++ intern/ghost/intern/GHOST_WindowX11.h | 8 ++++ .../blender/editors/interface/interface_handlers.c | 40 +++++++++++++++- source/blender/windowmanager/WM_types.h | 4 +- .../blender/windowmanager/intern/wm_event_system.c | 1 + source/gameengine/Ketsji/KX_PythonInit.cpp | 2 +- 14 files changed, 148 insertions(+), 12 deletions(-) diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index dd399a7aa95..78fc3f69c7a 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -468,6 +468,7 @@ typedef struct { GHOST_TKey key; /** The ascii code for the key event ('\0' if none). */ char ascii; + char utf8_buf[6]; } GHOST_TEventKeyData; typedef struct { diff --git a/intern/ghost/intern/GHOST_EventKey.h b/intern/ghost/intern/GHOST_EventKey.h index 3581cd86b20..a8fca1e8f2d 100644 --- a/intern/ghost/intern/GHOST_EventKey.h +++ b/intern/ghost/intern/GHOST_EventKey.h @@ -55,6 +55,7 @@ public: { m_keyEventData.key = key; m_keyEventData.ascii = '\0'; + m_keyEventData.utf8_buf[0]= '\0'; m_data = &m_keyEventData; } @@ -65,11 +66,13 @@ public: * @param key The key code of the key. * @param ascii The ascii code for the key event. */ - GHOST_EventKey(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TKey key, char ascii) + GHOST_EventKey(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TKey key, char ascii, const char utf8_buf[6]) : GHOST_Event(msec, type, window) { m_keyEventData.key = key; m_keyEventData.ascii = ascii; + if (utf8_buf) memcpy(m_keyEventData.utf8_buf, utf8_buf, sizeof(m_keyEventData.utf8_buf)); + else m_keyEventData.utf8_buf[0]= '\0'; m_data = &m_keyEventData; } diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 02ff5c0f559..762966c9b9e 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -931,7 +931,7 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event) } else { type = GHOST_kEventKeyUp; } - pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii) ); + pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii, NULL) ); // } break; diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 303c2b24497..e8ec13f20df 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1656,6 +1656,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) } switch ([event type]) { + char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ + case NSKeyDown: case NSKeyUp: charsIgnoringModifiers = [event charactersIgnoringModifiers]; @@ -1684,10 +1686,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) break; //Cmd-Q is directly handled by Cocoa if ([event type] == NSKeyDown) { - pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii) ); + pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); //printf("\nKey down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); } else { - pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii) ); + pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii, utf8_buf) ); //printf("\nKey up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); } break; diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp index f2cc45731fa..11bd562f767 100644 --- a/intern/ghost/intern/GHOST_SystemSDL.cpp +++ b/intern/ghost/intern/GHOST_SystemSDL.cpp @@ -441,7 +441,7 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event) } } - g_event= new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym); + g_event= new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym, NULL); } break; } diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 38f3985b139..24b6474732e 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -725,7 +725,8 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP (LPSTR) &ascii, 1, NULL,NULL); - event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii); + /* TODO, last arg is utf8, need to pass utf8 arg */ + event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii, NULL); #ifdef GHOST_DEBUG std::cout << ascii << std::endl; diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 27a61cf57fc..209ffe501f4 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -89,6 +89,11 @@ GHOST_SystemX11( abort(); //was return before, but this would just mean it will crash later } + /* Open a connection to the X input manager */ +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + m_xim = XOpenIM(m_display, NULL, (char *)GHOST_X11_RES_NAME, (char *)GHOST_X11_RES_CLASS); +#endif + m_delete_window_atom = XInternAtom(m_display, "WM_DELETE_WINDOW", True); @@ -141,6 +146,10 @@ GHOST_SystemX11( GHOST_SystemX11:: ~GHOST_SystemX11() { +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XCloseIM(m_xim); +#endif + XCloseDisplay(m_display); } @@ -500,9 +509,9 @@ GHOST_SystemX11::processEvent(XEvent *xe) case KeyRelease: { XKeyEvent *xke = &(xe->xkey); - KeySym key_sym = XLookupKeysym(xke,0); char ascii; + char utf8_buf[6]; /* 6 is enough for a utf8 char */ GHOST_TKey gkey = convertXKey(key_sym); GHOST_TEventType type = (xke->type == KeyPress) ? @@ -512,13 +521,55 @@ GHOST_SystemX11::processEvent(XEvent *xe) ascii = '\0'; } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + /* getting unicode on key-up events gives XLookupNone status */ + if (xke->type == KeyPress) { + Status status; + int len; + + /* use utf8 because its not locale depentant, from xorg docs */ + if (!(len= Xutf8LookupString(window->getX11_XIC(), xke, utf8_buf, sizeof(utf8_buf), &key_sym, &status))) { + utf8_buf[0]= '\0'; + } + + if ((status == XLookupChars || status == XLookupBoth)) { + if ((unsigned char)utf8_buf[0] >= 32) { /* not an ascii control character */ + /* do nothing for now, this is valid utf8 */ + } + else { + utf8_buf[0]= '\0'; + } + } + else if (status == XLookupKeySym) { + /* this key doesn't have a text representation, it is a command + key of some sort */; + } + else { + printf("Bad keycode lookup. Keysym 0x%x Status: %s\n", + (unsigned int) key_sym, + (status == XBufferOverflow ? "BufferOverflow" : + status == XLookupNone ? "XLookupNone" : + status == XLookupKeySym ? "XLookupKeySym" : + "Unknown status")); + + printf("'%.*s' %p %p\n", len, utf8_buf, window->getX11_XIC(), m_xim); + } + } + else { + utf8_buf[0]= '\0'; + } +#else + utf8_buf[0]= '\0'; +#endif + g_event = new GHOST_EventKey( getMilliSeconds(), type, window, gkey, - ascii + ascii, + utf8_buf ); break; diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index b43d955d156..af45d68450f 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -40,6 +40,12 @@ #include "GHOST_System.h" #include "../GHOST_Types.h" +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) +# define GHOST_X11_RES_NAME "Blender" /* res_name */ +# define GHOST_X11_RES_CLASS "Blender" /* res_class */ +#endif + + class GHOST_WindowX11; /** @@ -203,6 +209,14 @@ public: return m_display; } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIM + getX11_XIM( + ) { + return m_xim; + } +#endif + /* Helped function for get data from the clipboard. */ void getClipboard_xcout(XEvent evt, Atom sel, Atom target, unsigned char **txt, unsigned long *len, @@ -258,6 +272,9 @@ public: private : Display * m_display; +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIM m_xim; +#endif /// The vector of windows that need to be updated. std::vector m_dirty_windows; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 160980b6331..d26224d956a 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -392,6 +392,13 @@ GHOST_WindowX11( } } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + m_xic = XCreateIC(m_system->getX11_XIM(), XNClientWindow, m_window, XNFocusWindow, m_window, + XNInputStyle, XIMPreeditNothing | XIMStatusNothing, + XNResourceName, GHOST_X11_RES_NAME, XNResourceClass, + GHOST_X11_RES_CLASS, NULL); +#endif + // Set the window icon XWMHints *xwmhints = XAllocWMHints(); XImage *x_image, *mask_image; @@ -1304,6 +1311,13 @@ GHOST_WindowX11:: XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime); } +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + if (m_xic) { + XDestroyIC(m_xic); + } +#endif + + XDestroyWindow(m_display, m_window); XFree(m_visual); } diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index 2cb269ea919..ee662945eaa 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -221,6 +221,10 @@ public: { return NULL; } #endif // WITH_X11_XINPUT +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIC getX11_XIC() { return m_xic; } +#endif + /* * Need this in case that we want start the window * in FullScree or Maximized state. @@ -363,6 +367,10 @@ private : XTablet m_xtablet; #endif +#if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) + XIC m_xic; +#endif + void icccmSetState(int state); int icccmGetState() const; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 4df9d7f12e2..85103b42244 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1428,6 +1428,36 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, ui_check_but(but); } +/* 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; + size_t step= BLI_strnlen(utf8_buf, sizeof(utf8_buf)); + + str= data->str; + len= strlen(str); + + if(len-(but->selend - but->selsta)+1 <= data->maxlen) { + /* type over the current selection */ + if ((but->selend - but->selsta) > 0) + changed= ui_textedit_delete_selection(but, data); + + len= strlen(str); + if(len+step < data->maxlen) { + for(x= data->maxlen; x>but->pos; x--) + str[x]= str[x-step]; + memcpy(&str[but->pos], utf8_buf, step * sizeof(char)); + str[len+step]= '\0'; + + but->pos += step; + changed= 1; + } + } + + return changed; +} + static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) { char *str; @@ -1939,7 +1969,15 @@ 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); + changed= ui_textedit_type_utf8(but, data, event->utf8_buf); + } + else { + changed= ui_textedit_type_ascii(but, data, ascii); + } + retval= WM_UI_HANDLER_BREAK; } 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..7dcb4cf091f 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -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/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; -- cgit v1.2.3 From e0604e5941f958f332911b0948cddfc1f21f0014 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 20 Oct 2011 06:29:14 +0000 Subject: OSX fix for recent utf8 commit --- intern/ghost/intern/GHOST_SystemCocoa.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index e8ec13f20df..58a856375bb 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1655,8 +1655,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) return GHOST_kFailure; } + char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ switch ([event type]) { - char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ case NSKeyDown: case NSKeyUp: -- cgit v1.2.3 From 415f35d1dc916edcb9b050f25ae406c6eee2b63d Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 20 Oct 2011 06:38:45 +0000 Subject: =?UTF-8?q?bge=20bugfix:=20patch=20#28893=20"Fix=20for=20#28753=20?= =?UTF-8?q?and=20some=20other=20changes=20for=20BGE=20projection=20code"?= =?UTF-8?q?=20by=20Juha=20M=C3=A4ki-Kanto=20(kanttori)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp | 9 ++++++++- source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 10 ++++++++-- source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 18 +++++++----------- source/gameengine/Rasterizer/RAS_FramingManager.cpp | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) 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/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/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; } -- cgit v1.2.3 From 3a51a446c1b14a5e4ac68007eef2d8a8bfdc49de Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Thu, 20 Oct 2011 07:03:08 +0000 Subject: Fix for 7.1 audio export being misscalculated... --- intern/audaspace/intern/AUD_ChannelMapperReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp index 27d10ce6dc8..7764164a9b0 100644 --- a/intern/audaspace/intern/AUD_ChannelMapperReader.cpp +++ b/intern/audaspace/intern/AUD_ChannelMapperReader.cpp @@ -352,7 +352,7 @@ const float AUD_ChannelMapperReader::SURROUND71_ANGLES[] = 0.0f * M_PI / 180.0f, 0.0f * M_PI / 180.0f, -110.0f * M_PI / 180.0f, - 110.0f * M_PI / 180.0f + 110.0f * M_PI / 180.0f, -150.0f * M_PI / 180.0f, 150.0f * M_PI / 180.0f }; -- cgit v1.2.3 From 7aca04ad0a5d71f555008671ba740a6396bb0db0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 07:12:14 +0000 Subject: minor changes to test editing - use BLI_strncpy_utf8 for utf8 buttons when pasting. - reuse code for ui_textedit_type_ascii / ui_textedit_type_utf8. - use memmove rather then for() loops in string editing. - merge jump/all arguments in interface_handlers.c into one enum arg. --- source/blender/editors/interface/interface.c | 4 +- source/blender/editors/interface/interface_anim.c | 4 +- .../blender/editors/interface/interface_handlers.c | 129 ++++++++------------- .../blender/editors/interface/interface_intern.h | 1 + 4 files changed, 56 insertions(+), 82 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index ac1fab365f0..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) { diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 6c661ba014e..545d60bfcb9 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -115,7 +115,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 +164,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_handlers.c b/source/blender/editors/interface/interface_handlers.c index 85103b42244..1f30f8a5109 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; @@ -1432,24 +1441,23 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const char utf8_buf[6]) { char *str; - int len, x, changed= 0; - size_t step= BLI_strnlen(utf8_buf, sizeof(utf8_buf)); + 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+step < data->maxlen) { - for(x= data->maxlen; x>but->pos; x--) - str[x]= str[x-step]; + 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)); - str[len+step]= '\0'; - but->pos += step; changed= 1; } @@ -1460,33 +1468,11 @@ static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const cha static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) { - char *str; - int len, x, changed= 0; - - str= data->str; - len= strlen(str); - - if(len-(but->selend - but->selsta)+1 <= data->maxlen) { - /* type over the current selection */ - if ((but->selend - but->selsta) > 0) - changed= ui_textedit_delete_selection(but, data); - - 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++; - changed= 1; - } - } - - return changed; + 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, int jump, int jump_all) +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); @@ -1495,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 { @@ -1509,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 */ @@ -1558,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->pospos>=0 && but->pospos; 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; xpos], &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); } @@ -1594,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; xpos - step], &str[but->pos], (len + 1) - but->pos); but->pos -= step; changed= 1; } @@ -1710,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; @@ -1747,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) { @@ -1899,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: @@ -1913,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: @@ -1923,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: @@ -1932,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; @@ -1969,9 +1939,10 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->type == PADPERIOD && ascii == ',') ascii = '.'; - if(event->utf8_buf[0]) { + if(event->utf8_buf[0] || 1) { /* 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 { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index c5843397c12..b7a2227f98a 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -373,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); -- cgit v1.2.3 From f1fe89acf1f42df4becfc5dd53d2d3ea8635a72c Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Thu, 20 Oct 2011 07:20:17 +0000 Subject: Fix for bug #28979 "Action actuator breaks animation" reported by Goran Milovanovic. Apparently IPO options can be set too frequently... --- source/gameengine/Ketsji/BL_Action.cpp | 5 ----- 1 file changed, 5 deletions(-) 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); } } -- cgit v1.2.3 From daf51fe6cd1b47d3727e932bb465b8e2a8723d41 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 20 Oct 2011 07:56:04 +0000 Subject: A big set of UI messages fixes and tweaks! No functional changes. --- release/scripts/startup/bl_operators/anim.py | 2 +- release/scripts/startup/bl_operators/object.py | 2 +- release/scripts/startup/bl_operators/presets.py | 2 +- .../bl_operators/screen_play_rendered_anim.py | 2 +- .../startup/bl_operators/vertexpaint_dirt.py | 2 +- source/blender/editors/armature/poseobject.c | 2 +- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/object/object_hook.c | 2 +- source/blender/editors/screen/screen_ops.c | 2 +- source/blender/editors/space_image/image_buttons.c | 4 +- source/blender/editors/space_info/info_report.c | 2 +- source/blender/editors/space_logic/logic_ops.c | 4 +- source/blender/makesrna/intern/rna_curve.c | 8 +-- source/blender/makesrna/intern/rna_fcurve.c | 5 +- source/blender/makesrna/intern/rna_image.c | 8 +-- source/blender/makesrna/intern/rna_mesh.c | 21 ++++--- source/blender/makesrna/intern/rna_nodetree.c | 6 +- source/blender/makesrna/intern/rna_object.c | 16 ++--- source/blender/makesrna/intern/rna_object_force.c | 32 ++++++---- source/blender/makesrna/intern/rna_pose.c | 68 ++++++++++++++-------- source/blender/makesrna/intern/rna_scene.c | 20 +++---- source/blender/makesrna/intern/rna_sculpt_paint.c | 19 ++++-- source/blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/makesrna/intern/rna_smoke.c | 8 +-- source/blender/makesrna/intern/rna_texture.c | 12 ++-- source/blender/makesrna/intern/rna_userdef.c | 14 ++--- source/blender/makesrna/intern/rna_wm.c | 2 +- source/blender/makesrna/intern/rna_world.c | 4 +- 29 files changed, 160 insertions(+), 115 deletions(-) diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index 3051914cf00..e1d33198142 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -228,7 +228,7 @@ class BakeAction(Operator): class ClearUselessActions(Operator): """Mark actions with no F-Curves for deletion after save+reload of """ \ - """file preserving "action libraries""" + """file preserving \"action libraries\"""" bl_idname = "anim.clear_useless_actions" bl_label = "Clear Useless Actions" bl_options = {'REGISTER', 'UNDO'} diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 51c530db672..738cc7b24e0 100644 --- a/release/scripts/startup/bl_operators/object.py +++ b/release/scripts/startup/bl_operators/object.py @@ -122,7 +122,7 @@ class SelectCamera(Operator): class SelectHierarchy(Operator): - '''Select object relative to the active objects position''' \ + '''Select object relative to the active object's position''' \ '''in the hierarchy''' bl_idname = "object.select_hierarchy" bl_label = "Select Hierarchy" diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 2fd0c4a9e12..2e42105fbf0 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -142,7 +142,7 @@ class AddPresetBase(): class ExecutePreset(Operator): - ''' Executes a preset ''' + '''Execute a preset''' bl_idname = "script.execute_preset" bl_label = "Execute a Python Preset" diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index 3479a3f9e53..5ee7cf86142 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -66,7 +66,7 @@ def guess_player_path(preset): class PlayRenderedAnim(Operator): - '''Plays back rendered frames/movies using an external player''' + '''Play back rendered frames/movies using an external player''' bl_idname = "render.play_rendered_anim" bl_label = "Play Rendered Animation" bl_options = {'REGISTER'} diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py index ce4942ae238..5fb5c7f39cf 100644 --- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py +++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py @@ -159,7 +159,7 @@ class VertexPaintDirt(Operator): ) blur_iterations = IntProperty( name="Blur Iterations", - description="Number times to blur the colors. (higher blurs more)", + description="Number times to blur the colors (higher blurs more)", min=0, max=40, default=1, ) 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 1f2ef79e091..60b1cc8f5cd 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -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 **********************/ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 76cbfdc88e7..0ad11d1a997 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -585,7 +585,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 ce01bef34f6..9f1ad8e4c3c 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -837,7 +837,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/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a2be1e8fa6f..bae6fa9d6b0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -649,7 +649,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/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/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 49f39a207d2..c03a10f2170 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -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_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_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_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d35b7ad38fb..c4f33f9cf10 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1383,20 +1383,20 @@ static void rna_def_mtface(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); @@ -1835,7 +1835,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, "fdata.layers", "fdata.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); @@ -1865,26 +1866,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, "fdata.layers", "fdata.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, "fdata.layers", "fdata.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, "fdata.layers", "fdata.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, "fdata.layers", "fdata.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_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 7d20378d55e..0677b848fee 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -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 bbbec3bcf9a..e329df8470d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1397,7 +1397,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"); @@ -1426,7 +1426,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); @@ -1488,20 +1488,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); @@ -1526,7 +1526,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); @@ -1537,7 +1537,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 8db1faee04d..597f8730e72 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -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_scene.c b/source/blender/makesrna/intern/rna_scene.c index 09824616936..70ff5682717 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1755,13 +1755,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); @@ -1977,7 +1977,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); @@ -1985,7 +1985,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); @@ -1994,7 +1994,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); @@ -2003,7 +2003,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); @@ -2012,7 +2012,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); @@ -2066,7 +2066,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"); @@ -2075,8 +2075,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_texture.c b/source/blender/makesrna/intern/rna_texture.c index 03f0a4ba363..1babf5e61a1 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -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_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 9202647981b..0c3ff108c03 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -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 f8383b1d451..676fe1e092d 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1703,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); -- cgit v1.2.3 From 9969ebffa60d37762bf20b67b3cf1fd6430ff9fa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 20 Oct 2011 08:03:29 +0000 Subject: Fix #28942: Minimize stretch in UV editing has no continues grab --- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index ae4718d8f56..7f6394e822b 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -464,7 +464,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 */ -- cgit v1.2.3 From 1555d4b1a8ff43414b6ab5e87097d53f86c86a00 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 08:12:39 +0000 Subject: fix [#28902] Rendering and visibility icons in modifier panel move between clicks --- .../editors/interface/interface_templates.c | 32 ++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4dcdeab2169..77a25307651 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -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 -- cgit v1.2.3 From f037642843bf7f7b8fe219d73480c896d7746372 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 20 Oct 2011 08:19:51 +0000 Subject: Fix #28937: Text Editor Selection (Scroll Bar) Do not start selection if mouse cursor.x >= scrollbar.x --- source/blender/editors/space_text/text_ops.c | 3 +++ 1 file changed, 3 insertions(+) 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"); -- cgit v1.2.3 From e02dfe4a79b3632b3143d5d45e0dee1463ff7aa6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 20 Oct 2011 08:32:26 +0000 Subject: Fix #28938: Black frames when composite output node even with disabled nodes --- source/blender/render/intern/source/pipeline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 19dc0538dba..3db73816025 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -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); -- cgit v1.2.3 From 8d6a554d7502029f04aca33efcdd004744b9bd84 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 09:47:05 +0000 Subject: - add BLI_string_utf8.h for unicode functions. - move font.c unicode functions into string_utf8.c and rename to fit with other BLI_string funcs. --- source/blender/blenkernel/BKE_font.h | 5 - source/blender/blenkernel/intern/font.c | 140 +------------------ source/blender/blenkernel/intern/particle_system.c | 1 - source/blender/blenkernel/intern/smoke.c | 3 +- source/blender/blenlib/BLI_blenlib.h | 2 + source/blender/blenlib/BLI_string.h | 14 +- source/blender/blenlib/BLI_string_utf8.h | 55 ++++++++ source/blender/blenlib/CMakeLists.txt | 1 + source/blender/blenlib/intern/BLI_args.c | 1 - source/blender/blenlib/intern/string_utf8.c | 155 +++++++++++++++++++++ source/blender/editors/curve/editfont.c | 14 +- source/blender/editors/interface/interface_anim.c | 1 + source/blender/editors/interface/interface_draw.c | 4 +- .../editors/interface/interface_templates.c | 1 - source/blender/editors/space_file/fsmenu.c | 1 - source/blender/imbuf/intern/indexer.c | 3 +- source/blender/makesrna/intern/rna_curve.c | 2 +- source/blender/makesrna/intern/rna_define.c | 1 - source/blender/python/generic/py_capi_utils.c | 4 +- source/blender/python/intern/bpy_interface.c | 4 +- source/blender/windowmanager/intern/wm_operators.c | 1 - 21 files changed, 234 insertions(+), 179 deletions(-) create mode 100644 source/blender/blenlib/BLI_string_utf8.h 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/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/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 7b2d621aff2..64a90e15b60 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -70,7 +70,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 "BKE_main.h" diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 85140841f15..49c8831f06c 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/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_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..15884c4d2d9 --- /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.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/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index aa822731474..ea9f72c19c3 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -128,6 +128,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..82891b1e121 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -39,7 +39,6 @@ #include "MEM_guardedalloc.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/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 +#include +#include #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/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 60b1cc8f5cd..03e226e3a75 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+filelentextbuf, mem); MEM_freeN(mem); cu->len += tmplen; @@ -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; aptr, "text", inserted_utf8); } @@ -1478,7 +1478,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/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 545d60bfcb9..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" 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_templates.c b/source/blender/editors/interface/interface_templates.c index 77a25307651..0375345afcc 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -38,7 +38,6 @@ #include "DNA_scene_types.h" #include "DNA_userdef_types.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" 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 /* need to include windows.h so _WIN32_IE is defined */ 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/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index c03a10f2170..8bdbdcefc61 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -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); } 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/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index e658532db24..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" @@ -478,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/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/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 4924457da1a..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" -- cgit v1.2.3 From fe30dcbfb6281857435759b5c36ff390d7c067cb Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 20 Oct 2011 09:53:02 +0000 Subject: Minor: fix [#28899] Frequently used modelling modifiers moved further out of reach by new Vertex Weight modifiers. --- source/blender/makesrna/intern/rna_modifier.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index fbf54a76cd9..c33fa0bc7f8 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", ""}, -- cgit v1.2.3 From 36017e2af9a3015876b4f573f00630cdae39c1ac Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Thu, 20 Oct 2011 10:35:54 +0000 Subject: OSX: dalai's patch for utf8 support, todo: uppercase chars not working yet --- intern/ghost/intern/GHOST_SystemCocoa.mm | 33 ++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 58a856375bb..1dfb8e36422 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1654,8 +1654,17 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) //printf("\nW failure for event 0x%x",[event type]); return GHOST_kFailure; } + + /* unicode input - not entirely supported yet + * but we are getting the right byte, Blender is not drawing it though + * also some languages may need special treatment: + - Japanese: romanji is used as input, and every 2 letters OSX converts the text + to Hiragana/Katakana. + - Korean: one add one letter at a time, and then the OSX join them in the equivalent + combined letter. + */ + char utf8_buf[6]= {'\0'}; - char utf8_buf[6]= {'\0'}; /* TODO, unicode input */ switch ([event type]) { case NSKeyDown: @@ -1669,7 +1678,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) keyCode = convertKey([event keyCode],0, [event type] == NSKeyDown?kUCKeyActionDown:kUCKeyActionUp); - + /* ascii */ characters = [event characters]; if ([characters length]>0) { //Check for dead keys //Convert characters to iso latin 1 encoding @@ -1681,16 +1690,32 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr) } else ascii= 0; + + /* unicode */ + if ([characters length]>0) { + convertedCharacters = [characters dataUsingEncoding:NSUTF8StringEncoding]; + if ([convertedCharacters length]>0) { + utf8_buf[0] = ((char*)[convertedCharacters bytes])[0]; + utf8_buf[1] = ((char*)[convertedCharacters bytes])[1]; + utf8_buf[2] = ((char*)[convertedCharacters bytes])[2]; + utf8_buf[3] = ((char*)[convertedCharacters bytes])[3]; + utf8_buf[4] = ((char*)[convertedCharacters bytes])[4]; + utf8_buf[5] = ((char*)[convertedCharacters bytes])[5]; + } + else { + utf8_buf[0] = '\0'; + } + } if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask)) break; //Cmd-Q is directly handled by Cocoa if ([event type] == NSKeyDown) { pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); - //printf("\nKey down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); + //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } else { pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, ascii, utf8_buf) ); - //printf("\nKey up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii); + //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf); } break; -- cgit v1.2.3 From 70ba7d02dbb44a20ac6d405d75e81806fc7ce4b5 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Thu, 20 Oct 2011 10:36:02 +0000 Subject: Fix for #28980, could enter infinite loop during node socket verification if dynamic sockets are present. Note: in this particular bug report the sockets have some faulty flag settings (none of them should be flagged as SOCK_DYNAMIC), needs more info. --- source/blender/nodes/intern/node_socket.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 */ -- cgit v1.2.3 From 3d501ca70fb3811ced1fdad5e4a170d173531a94 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 10:47:38 +0000 Subject: unicode text input for 3d text. --- source/blender/blenlib/BLI_string_utf8.h | 2 +- source/blender/editors/curve/editfont.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 15884c4d2d9..b7a9c204bfe 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -25,7 +25,7 @@ #ifndef BLI_STRING_UTF8_H #define BLI_STRING_UTF8_H -/** \file BLI_string.h +/** \file BLI_string_utf8.h * \ingroup bli */ diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 03e226e3a75..dff5be059c3 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1291,8 +1291,20 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) if(val && ascii) { /* 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]; -- cgit v1.2.3 From 2f92b5bc3fa11609e07ba7bc0859275ee3ccf12b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 11:18:57 +0000 Subject: fixes for unicode input, should work for operator textinput now. --- source/blender/editors/curve/editfont.c | 2 +- source/blender/editors/interface/interface_handlers.c | 4 ++-- source/blender/windowmanager/intern/wm_event_system.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index dff5be059c3..c80f5c85c25 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -1289,7 +1289,7 @@ 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) || diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 1f30f8a5109..c02bbafce15 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -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,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->type == PADPERIOD && ascii == ',') ascii = '.'; - if(event->utf8_buf[0] || 1) { + 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"); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 7dcb4cf091f..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; -- cgit v1.2.3 From a828845f27557242d59eb881ca2d5a43c8915636 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 20 Oct 2011 12:15:39 +0000 Subject: reverting 41124, maybe better solution is to enforce linear space in generated float images --- .../blender/imbuf/intern/openexr/openexr_api.cpp | 56 ++++++---------------- 1 file changed, 14 insertions(+), 42 deletions(-) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index aa7defb2f39..e064d7f760d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -342,55 +342,27 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag FrameBuffer frameBuffer; OutputFile *file = new OutputFile(name, header); - int xstride = sizeof(float) * 4; - int ystride = xstride*width; - float *init_to = new float [4 * width*height * sizeof(float)]; - float *from, *to = init_to; - - frameBuffer.insert ("R", Slice (FLOAT, (char *)init_to, xstride, ystride)); - frameBuffer.insert ("G", Slice (FLOAT, (char *)(init_to + 1), xstride, ystride)); - frameBuffer.insert ("B", Slice (FLOAT, (char *)(init_to + 2), xstride, ystride)); + int xstride = sizeof(float) * channels; + int ystride = - xstride*width; + float *rect[4] = {NULL, NULL, NULL, NULL}; + + /* last scanline, stride negative */ + rect[0]= ibuf->rect_float + channels*(height-1)*width; + rect[1]= rect[0]+1; + rect[2]= rect[0]+2; + rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isnt written? */ + + frameBuffer.insert ("R", Slice (FLOAT, (char *)rect[0], xstride, ystride)); + frameBuffer.insert ("G", Slice (FLOAT, (char *)rect[1], xstride, ystride)); + frameBuffer.insert ("B", Slice (FLOAT, (char *)rect[2], xstride, ystride)); if (ibuf->depth==32 && channels >= 4) - frameBuffer.insert ("A", Slice (FLOAT, (char *)(init_to + 3), xstride, ystride)); + frameBuffer.insert ("A", Slice (FLOAT, (char *)rect[3], xstride, ystride)); if (write_zbuf) frameBuffer.insert ("Z", Slice (FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width), sizeof(float), sizeof(float) * -width)); - - if(ibuf->profile == IB_PROFILE_LINEAR_RGB) { - for (int i = ibuf->y-1; i >= 0; i--) - { - from= ibuf->rect_float + channels*i*width; - - for (int j = ibuf->x; j > 0; j--) - { - to[0] = from[0]; - to[1] = from[1]; - to[2] = from[2]; - to[3] = (channels >= 4)? from[3]: 1.0f; - to+= 4; from += 4; - } - } - } - else { - for (int i = ibuf->y-1; i >= 0; i--) - { - from= ibuf->rect_float + channels*i*width; - - for (int j = ibuf->x; j > 0; j--) - { - to[0] = srgb_to_linearrgb(from[0]); - to[1] = srgb_to_linearrgb(from[1]); - to[2] = srgb_to_linearrgb(from[2]); - to[3] = (channels >= 4)? from[3]: 1.0f; - to+= 4; from += 4; - } - } - } - file->setFrameBuffer (frameBuffer); file->writePixels (height); delete file; - delete [] init_to; } catch (const std::exception &exc) { -- cgit v1.2.3 From 2bd9519e39f7c383005fd531f4c7dd92cce246ad Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 20 Oct 2011 13:50:24 +0000 Subject: BLI_ghash.h was including BLI_blenlib.h, remove from ghash header and include in each file --- source/blender/blenkernel/intern/BME_conversions.c | 1 + source/blender/blenkernel/intern/BME_eulers.c | 1 + source/blender/blenkernel/intern/BME_mesh.c | 2 +- source/blender/blenkernel/intern/BME_structure.c | 1 + source/blender/blenkernel/intern/depsgraph.c | 1 + source/blender/blenkernel/intern/modifier.c | 3 +++ source/blender/blenkernel/intern/nla.c | 3 +++ source/blender/blenkernel/intern/softbody.c | 1 + source/blender/blenlib/BLI_ghash.h | 7 ------- source/blender/blenlib/intern/BLI_args.c | 4 +++- source/blender/blenlib/intern/BLI_ghash.c | 9 +++++++++ source/blender/blenloader/intern/readblenentry.c | 2 ++ source/blender/editors/interface/interface_templates.c | 1 + source/blender/editors/sculpt_paint/sculpt_undo.c | 2 ++ source/blender/modifiers/intern/MOD_bevel.c | 1 + source/blender/modifiers/intern/MOD_boolean_util.c | 1 + source/blender/modifiers/intern/MOD_mask.c | 2 ++ source/blender/python/intern/bpy_operator.c | 1 + 18 files changed, 34 insertions(+), 9 deletions(-) diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index 9a3c9462934..8b5cfe1b882 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -44,6 +44,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 593f50a65e7..bbd439dcb93 100644 --- a/source/blender/blenkernel/intern/BME_eulers.c +++ b/source/blender/blenkernel/intern/BME_eulers.c @@ -38,6 +38,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 62a9601da13..e34f2ee1e50 100644 --- a/source/blender/blenkernel/intern/BME_mesh.c +++ b/source/blender/blenkernel/intern/BME_mesh.c @@ -37,7 +37,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 bd5241adb6b..c385ad4fcda 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -40,6 +40,7 @@ #include #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 8d0c20ecc52..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" diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 2cee9676e5e..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" 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/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/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 -#include -#include - -#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/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index 82891b1e121..00903aa42cd 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -35,11 +35,13 @@ #include /* for tolower */ +#include #include "MEM_guardedalloc.h" -#include "BLI_listbase.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.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 03e3b7ab560..e34abaf15f9 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -32,11 +32,20 @@ * \ingroup bli */ +#include +#include + #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/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 220784c9ff7..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" diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0375345afcc..e264146a6e3 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -39,6 +39,7 @@ #include "DNA_userdef_types.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "BKE_animsys.h" diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index a32487e7117..7656e51d241 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" diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 197e6a24342..3397dad2460 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 9d83e351b2b..01245ca4e01 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 b7cdac9e246..ad1e0806327 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/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" -- cgit v1.2.3 From 7131b00a431770da69a0dbc32c8616d560360de0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 20 Oct 2011 14:54:22 +0000 Subject: Fix missing updates when changing smoke flow settings. --- source/blender/makesrna/intern/rna_smoke.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 44bdeba3e2e..c40548ade6b 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -289,12 +289,14 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.001, 1); RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4); RNA_def_property_ui_text(prop, "Density", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "temp"); RNA_def_property_range(prop, -10, 10); RNA_def_property_ui_range(prop, -10, 10, 1, 1); RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "psys"); @@ -306,20 +308,24 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW); RNA_def_property_ui_text(prop, "Outflow", "Delete smoke from simulation"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE); RNA_def_property_ui_text(prop, "Absolute Density", "Only allow given density value in emitter area"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); 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 its velocity from the emitter particle"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); RNA_def_property_range(prop, -2.0, 2.0); RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5); RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); } static void rna_def_smoke_coll_settings(BlenderRNA *brna) -- cgit v1.2.3 From 4ea8cb25295d0e61a1fcf1cd16028a3586ed5921 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 20 Oct 2011 14:55:02 +0000 Subject: Fix missing node editor update when assigning/removing materials on objects. --- source/blender/editors/space_node/space_node.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 1047e906a10..1d9723f598b 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -214,6 +214,12 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_refresh(sa); } break; + case NC_OBJECT: + if(type==NTREE_SHADER) { + if(wmn->data==ND_OB_SHADING) + ED_area_tag_refresh(sa); + } + break; case NC_TEXT: /* pynodes */ if(wmn->data==ND_SHADING) -- cgit v1.2.3