Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-07 08:36:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-07 08:36:37 +0400
commitbb8fe0bf4afeaa5ae91329b8d8147b94cc54034a (patch)
tree8ce068ee16a8f61a6beeb08c0929f0fa9a8bde3b /source/blender
parent96d73bfdcfd74bfccd58bf02ae25b64577fce904 (diff)
minor edits
- remove unneeded type check from convert grease pencil operator. - correct some error prints & use __func__. - make copy_libblock take an ID* argument rather than void*.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c2
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenkernel/intern/camera.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/lamp.c4
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/library.c12
-rw-r--r--source/blender/blenkernel/intern/material.c4
-rw-r--r--source/blender/blenkernel/intern/mball.c2
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c2
-rw-r--r--source/blender/blenkernel/intern/speaker.c2
-rw-r--r--source/blender/blenkernel/intern/text.c2
-rw-r--r--source/blender/blenkernel/intern/texture.c4
-rw-r--r--source/blender/blenkernel/intern/world.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c19
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c19
23 files changed, 46 insertions, 52 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 9130cac6cd6..308d7ff22c2 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -46,7 +46,7 @@ struct PointerRNA;
struct PropertyRNA;
void *alloc_libblock(struct ListBase *lb, short type, const char *name);
-void *copy_libblock(void *rt);
+void *copy_libblock(struct ID *id);
void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action);
void BKE_id_lib_local_paths(struct Main *bmain, struct ID *id);
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 944f7c6a0b6..5fb03b7bbd0 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -185,7 +185,7 @@ bAction *copy_action (bAction *src)
if (src == NULL)
return NULL;
- dst= copy_libblock(src);
+ dst= copy_libblock(&src->id);
/* duplicate the lists of groups and markers */
BLI_duplicatelist(&dst->groups, &src->groups);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index f19ed859064..50f305e4400 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -204,7 +204,7 @@ bArmature *copy_armature(bArmature *arm)
Bone *oldBone, *newBone;
Bone *newActBone= NULL;
- newArm= copy_libblock (arm);
+ newArm= copy_libblock(&arm->id);
BLI_duplicatelist(&newArm->bonebase, &arm->bonebase);
/* Duplicate the childrens' lists*/
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index e78b89441c9..09021e71025 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -144,7 +144,7 @@ Brush *copy_brush(Brush *brush)
{
Brush *brushn;
- brushn= copy_libblock(brush);
+ brushn= copy_libblock(&brush->id);
if (brush->mtex.tex)
id_us_plus((ID*)brush->mtex.tex);
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index eeec82c3beb..145eb9363e9 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -68,7 +68,7 @@ Camera *copy_camera(Camera *cam)
{
Camera *camn;
- camn= copy_libblock(cam);
+ camn= copy_libblock(&cam->id);
return camn;
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index adc08f5cd9f..160f5703a01 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -192,7 +192,7 @@ Curve *copy_curve(Curve *cu)
Curve *cun;
int a;
- cun= copy_libblock(cu);
+ cun= copy_libblock(&cu->id);
cun->nurb.first= cun->nurb.last= NULL;
duplicateNurblist( &(cun->nurb), &(cu->nurb));
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index c389800b0d1..eb7d07a6f7d 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -154,7 +154,7 @@ Key *copy_key(Key *key)
if(key==NULL) return NULL;
- keyn= copy_libblock(key);
+ keyn= copy_libblock(&key->id);
BLI_duplicatelist(&keyn->block, &key->block);
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 974aa660e9f..4edd032dc04 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -106,7 +106,7 @@ Lamp *copy_lamp(Lamp *la)
Lamp *lan;
int a;
- lan= copy_libblock(la);
+ lan= copy_libblock(&la->id);
for(a=0; a<MAX_MTEX; a++) {
if(lan->mtex[a]) {
@@ -132,7 +132,7 @@ Lamp *localize_lamp(Lamp *la)
Lamp *lan;
int a;
- lan= copy_libblock(la);
+ lan= copy_libblock(&la->id);
BLI_remlink(&G.main->lamp, lan);
for(a=0; a<MAX_MTEX; a++) {
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index cef23ac3824..7c9e2be4493 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -204,7 +204,7 @@ Lattice *copy_lattice(Lattice *lt)
{
Lattice *ltn;
- ltn= copy_libblock(lt);
+ ltn= copy_libblock(&lt->id);
ltn->def= MEM_dupallocN(lt->def);
ltn->key= copy_key(ltn->key);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 0b01c3d6dd1..878b87759b7 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -717,14 +717,11 @@ void copy_libblock_data(ID *id, const ID *id_from, const short do_action)
}
/* used everywhere in blenkernel */
-void *copy_libblock(void *rt)
+void *copy_libblock(ID *id)
{
- ID *idn, *id;
+ ID *idn;
ListBase *lb;
- char *cp, *cpn;
size_t idn_len;
-
- id= rt;
lb= which_libbase(G.main, GS(id->name));
idn= alloc_libblock(lb, GS(id->name), id->name+2);
@@ -733,8 +730,9 @@ void *copy_libblock(void *rt)
idn_len= MEM_allocN_len(idn);
if((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
- cp= (char *)id;
- cpn= (char *)idn;
+ const char *cp= (const char *)id;
+ char *cpn= (char *)idn;
+
memcpy(cpn+sizeof(ID), cp+sizeof(ID), idn_len - sizeof(ID));
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 7be3514e0f2..48c6d6b2a19 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -215,7 +215,7 @@ Material *copy_material(Material *ma)
Material *man;
int a;
- man= copy_libblock(ma);
+ man= copy_libblock(&ma->id);
id_lib_extern((ID *)man->group);
@@ -247,7 +247,7 @@ Material *localize_material(Material *ma)
Material *man;
int a;
- man= copy_libblock(ma);
+ man= copy_libblock(&ma->id);
BLI_remlink(&G.main->mat, man);
/* no increment for texture ID users, in previewrender.c it prevents decrement */
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 327306b32ee..5c82acde99b 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -120,7 +120,7 @@ MetaBall *copy_mball(MetaBall *mb)
MetaBall *mbn;
int a;
- mbn= copy_libblock(mb);
+ mbn= copy_libblock(&mb->id);
BLI_duplicatelist(&mbn->elems, &mb->elems);
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 4a8bc34cdf7..ec9d4873057 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -206,7 +206,7 @@ Mesh *copy_mesh(Mesh *me)
MTFace *tface;
int a, i;
- men= copy_libblock(me);
+ men= copy_libblock(&me->id);
men->mat= MEM_dupallocN(me->mat);
for(a=0; a<men->totcol; a++) {
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 8f609291351..a9b2ffe7529 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -629,7 +629,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
for(newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next)
if(newtree==ntree) break;
if(newtree) {
- newtree= copy_libblock(ntree);
+ newtree= copy_libblock(&ntree->id);
} else {
newtree= MEM_dupallocN(ntree);
copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index ae4e6ea81b8..1d654839969 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1084,7 +1084,7 @@ Object *copy_object(Object *ob)
ModifierData *md;
int a;
- obn= copy_libblock(ob);
+ obn= copy_libblock(&ob->id);
if(ob->totcol) {
obn->mat= MEM_dupallocN(ob->mat);
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 56e4c91ba5e..1064a5af160 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3569,7 +3569,7 @@ ParticleSettings *psys_copy_settings(ParticleSettings *part)
ParticleSettings *partn;
int a;
- partn= copy_libblock(part);
+ partn= copy_libblock(&part->id);
partn->pd= MEM_dupallocN(part->pd);
partn->pd2= MEM_dupallocN(part->pd2);
partn->effector_weights= MEM_dupallocN(part->effector_weights);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 66d29b02263..14dfe015894 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -126,7 +126,7 @@ Scene *copy_scene(Scene *sce, int type)
scen->r.layers= lb;
}
else {
- scen= copy_libblock(sce);
+ scen= copy_libblock(&sce->id);
BLI_duplicatelist(&(scen->base), &(sce->base));
clear_id_newpoins();
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index 018c7a197ff..a14233e9179 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -69,7 +69,7 @@ Speaker *copy_speaker(Speaker *spk)
{
Speaker *spkn;
- spkn= copy_libblock(spk);
+ spkn= copy_libblock(&spk->id);
if(spkn->sound)
spkn->sound->id.us++;
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 955127a8000..e8be0bb2608 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -431,7 +431,7 @@ Text *copy_text(Text *ta)
Text *tan;
TextLine *line, *tmp;
- tan= copy_libblock(ta);
+ tan= copy_libblock(&ta->id);
/* file name can be NULL */
if(ta->name) {
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 3aa289d0ef8..377eeef117e 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -751,7 +751,7 @@ Tex *copy_texture(Tex *tex)
{
Tex *texn;
- texn= copy_libblock(tex);
+ texn= copy_libblock(&tex->id);
if(texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
else texn->ima= NULL;
@@ -781,7 +781,7 @@ Tex *localize_texture(Tex *tex)
{
Tex *texn;
- texn= copy_libblock(tex);
+ texn= copy_libblock(&tex->id);
BLI_remlink(&G.main->tex, texn);
/* image texture: free_texture also doesn't decrease */
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index c7d2763774d..1d6972b9d61 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -118,7 +118,7 @@ World *copy_world(World *wrld)
World *wrldn;
int a;
- wrldn= copy_libblock(wrld);
+ wrldn= copy_libblock(&wrld->id);
for(a=0; a<MAX_MTEX; a++) {
if(wrld->mtex[a]) {
@@ -142,7 +142,7 @@ World *localize_world(World *wrld)
World *wrldn;
int a;
- wrldn= copy_libblock(wrld);
+ wrldn= copy_libblock(&wrld->id);
BLI_remlink(&G.main->world, wrldn);
for(a=0; a<MAX_MTEX; a++) {
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index d481be94bcc..7b79384fbb4 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -555,8 +555,8 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
* - must clear transforms set on object, as those skew our results
*/
ob= add_object(scene, OB_CURVE);
- ob->loc[0]= ob->loc[1]= ob->loc[2]= 0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0;
+ zero_v3(ob->loc);
+ zero_v3(ob->rot);
cu= ob->data;
cu->flag |= CU_3D;
@@ -573,6 +573,9 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
case GP_STROKECONVERT_CURVE:
gp_stroke_to_bezier(C, gpl, gps, cu, subrect_ptr);
break;
+ default:
+ BLI_assert(!"invalid mode");
+ break;
}
}
}
@@ -602,17 +605,7 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* handle conversion modes */
- switch (mode) {
- case GP_STROKECONVERT_PATH:
- case GP_STROKECONVERT_CURVE:
- gp_layer_to_curve(C, gpd, gpl, mode);
- break;
-
- default: /* unsupoorted */
- BKE_report(op->reports, RPT_ERROR, "Unknown conversion option");
- return OPERATOR_CANCELLED;
- }
+ gp_layer_to_curve(C, gpd, gpl, mode);
/* notifiers */
WM_event_add_notifier(C, NC_OBJECT|NA_ADDED, NULL);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 933066513e2..19e9a6bd483 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -270,7 +270,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
int retval= OPERATOR_FINISHED;
if(opm==NULL)
- printf("macro error, calling NULL modal()\n");
+ printf("%s: macro error, calling NULL modal()\n", __func__);
else {
retval = opm->type->modal(C, opm, event);
OPERATOR_RETVAL_CHECK(retval);
@@ -341,7 +341,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
wmOperatorType *ot;
if(WM_operatortype_find(idname, TRUE)) {
- printf("Macro error: operator %s exists\n", idname);
+ printf("%s: macro error: operator %s exists\n", __func__, idname);
return NULL;
}
@@ -658,10 +658,11 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
uiLayout *layout;
if(prop==NULL) {
- printf("WM_menu_invoke: %s has no enum property set\n", op->type->idname);
+ printf("%s: %s has no enum property set\n", __func__, op->type->idname);
}
else if (RNA_property_type(prop) != PROP_ENUM) {
- printf("WM_menu_invoke: %s \"%s\" is not an enum property\n", op->type->idname, RNA_property_identifier(prop));
+ printf("%s: %s \"%s\" is not an enum property\n",
+ __func__, op->type->idname, RNA_property_identifier(prop));
}
else if (RNA_property_is_set(op->ptr, RNA_property_identifier(prop))) {
const int retval= op->type->exec(C, op);
@@ -686,10 +687,12 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons
PropertyRNA *prop= ot->prop;
if(prop==NULL) {
- printf("WM_enum_search_invoke: %s has no enum property set\n", ot->idname);
+ printf("%s: %s has no enum property set\n",
+ __func__, ot->idname);
}
else if (RNA_property_type(prop) != PROP_ENUM) {
- printf("WM_enum_search_invoke: %s \"%s\" is not an enum property\n", ot->idname, RNA_property_identifier(prop));
+ printf("%s: %s \"%s\" is not an enum property\n",
+ __func__, ot->idname, RNA_property_identifier(prop));
}
else {
PointerRNA ptr;
@@ -725,7 +728,7 @@ static void operator_enum_call_cb(struct bContext *C, void *arg1, void *arg2)
WM_operator_properties_free(&props_ptr);
}
else {
- printf("operator_enum_call_cb: op->prop for '%s' is NULL\n", ot->idname);
+ printf("%s: op->prop for '%s' is NULL\n", __func__, ot->idname);
}
}
}
@@ -2619,7 +2622,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
memcpy(gesture->customdata, old_lasso, 2*sizeof(short)*gesture->size);
gesture->size = gesture->size + WM_LASSO_MIN_POINTS;
MEM_freeN(old_lasso);
- printf("realloc\n");
+ // printf("realloc\n");
}
{