diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-05 21:00:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-05 21:00:11 +0400 |
commit | 6292fb4cbd43c087c06886be7517a0dc07da9b43 (patch) | |
tree | bb4974c8fc57411bf872eb9ac04fdfd7f6734240 | |
parent | 9b37bf21f46d897ad9b74eb97fb4f0a7ed59bd9d (diff) |
code cleanup: BKE_libblock_find_name() now takes an ID constant rather then a string.
-rw-r--r-- | source/blender/blenkernel/BKE_library.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_data.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 2 |
11 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index e8dff6633bc..2804eb407db 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -82,7 +82,7 @@ void name_uiprefix_id(char *name, struct ID *id); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only); -struct ID *BKE_libblock_find_name(const char *type, const char *name); +struct ID *BKE_libblock_find_name(const short type, const char *name); void clear_id_newpoins(void); void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8d643349b8c..20444045c1c 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -943,9 +943,9 @@ void free_main(Main *mainvar) /* ***************** ID ************************ */ -ID *BKE_libblock_find_name(const char *type, const char *name) /* type: "OB" or "MA" etc */ +ID *BKE_libblock_find_name(const short type, const char *name) /* type: "OB" or "MA" etc */ { - ListBase *lb= which_libbase(G.main, GS(type)); + ListBase *lb= which_libbase(G.main, type); return BLI_findstring(lb, name, offsetof(ID, name) + 2); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 2673200690b..37d7cc06fe7 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -615,7 +615,7 @@ void BKE_scene_set_background(Main *bmain, Scene *scene) /* called from creator.c */ Scene *BKE_scene_set_name(Main *bmain, const char *name) { - Scene *sce= (Scene *)BKE_libblock_find_name("SC", name); + Scene *sce = (Scene *)BKE_libblock_find_name(ID_SCE, name); if (sce) { BKE_scene_set_background(bmain, sce); printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 49e472fada4..668f34c60d3 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -560,7 +560,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) } else { RNA_string_get(op->ptr, "name", name); - ima = (Image *)BKE_libblock_find_name("IM", name); + ima = (Image *)BKE_libblock_find_name(ID_IM, name); } if (!ima) { diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 40bca557169..ef861164c92 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1954,7 +1954,7 @@ static int add_named_exec(bContext *C, wmOperator *op) /* find object, create fake base */ RNA_string_get(op->ptr, "name", name); - ob = (Object *)BKE_libblock_find_name("OB", name); + ob = (Object *)BKE_libblock_find_name(ID_OB, name); if (ob == NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 8cb7c1fdcb5..d31e0b69473 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1911,7 +1911,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even char name[MAX_ID_NAME - 2]; RNA_string_get(op->ptr, "name", name); - ma = (Material *)BKE_libblock_find_name("MA", name); + ma = (Material *)BKE_libblock_find_name(ID_MA, name); if (base == NULL || ma == NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 3e06db4bc6f..86823be09a4 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -884,7 +884,7 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op) flip_side_name(tmpname, primbase->object->id.name + 2, TRUE); if (strcmp(tmpname, primbase->object->id.name + 2) != 0) { /* names differ */ - Object *ob = (Object *)BKE_libblock_find_name("OB", tmpname); + Object *ob = (Object *)BKE_libblock_find_name(ID_OB, tmpname); if (ob) { Base *secbase = BKE_scene_base_find(scene, ob); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index a49a9f02c60..09c7ecd6b48 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2945,7 +2945,7 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name)); - br = (Brush *)BKE_libblock_find_name("BR", "Smooth"); + br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth"); if (br) { paint_brush_set(p, br); brush = br; @@ -3508,7 +3508,7 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str /* Alt-Smooth */ if (ss->cache->alt_smooth) { Paint *p = &sd->paint; - brush = (Brush *)BKE_libblock_find_name("BR", ss->cache->saved_active_brush_name); + brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name); if (brush) { paint_brush_set(p, brush); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index be9b495619c..f30098d151d 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3418,7 +3418,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) else if (RNA_struct_property_is_set(op->ptr, "name")) { char name[MAX_ID_NAME-2]; RNA_string_get(op->ptr, "name", name); - ima= (Image *)BKE_libblock_find_name("IM", name); + ima= (Image *)BKE_libblock_find_name(ID_IM, name); if (!ima) { BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found", name); diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 47eecbc0d77..43f186f4b31 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1402,9 +1402,9 @@ static int parent_drop_exec(bContext *C, wmOperator *op) partype= RNA_enum_get(op->ptr, "type"); RNA_string_get(op->ptr, "parent", parname); - par= (Object *)BKE_libblock_find_name("OB", parname); + par= (Object *)BKE_libblock_find_name(ID_OB, parname); RNA_string_get(op->ptr, "child", childname); - ob= (Object *)BKE_libblock_find_name("OB", childname); + ob= (Object *)BKE_libblock_find_name(ID_OB, childname); ED_object_parent_set(op->reports, bmain, scene, ob, par, partype); @@ -1473,9 +1473,9 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_string_set(op->ptr, "parent", te_found->name); /* Identify parent and child */ RNA_string_get(op->ptr, "child", childname); - ob= (Object *)BKE_libblock_find_name("OB", childname); + ob= (Object *)BKE_libblock_find_name(ID_OB, childname); RNA_string_get(op->ptr, "parent", parname); - par= (Object *)BKE_libblock_find_name("OB", parname); + par= (Object *)BKE_libblock_find_name(ID_OB, parname); if (ELEM(NULL, ob, par)) { if (par == NULL) printf("par==NULL\n"); @@ -1659,7 +1659,7 @@ static int parent_clear_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even char obname[MAX_ID_NAME]; RNA_string_get(op->ptr, "dragged_obj", obname); - ob= (Object *)BKE_libblock_find_name("OB", obname); + ob= (Object *)BKE_libblock_find_name(ID_OB, obname); /* check dragged object (child) is active */ if (ob != CTX_data_active_object(C)) diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 11afc5825a7..3e8ac58df8e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3184,7 +3184,7 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNU } else if (RNA_struct_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", name); - ima = (Image *)BKE_libblock_find_name("IM", name); + ima = (Image *)BKE_libblock_find_name(ID_IM, name); } bgpic = background_image_add(C); |