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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-03-24 16:13:13 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-03-24 16:13:13 +0400
commit385c72f5f26ae9c86bf40c127c44216ceea0e6c1 (patch)
tree6c0432578abee5437adc94e96b5a91c593b866b4 /source/blender/blenkernel/intern/idcode.c
parent5841d1c8145ba50addeb17fa0231705d949d8b3d (diff)
parentb5ce1b1a23a3befbcc4cd3c67a5ec6a76d77aa5a (diff)
Merged changes in the trunk up to revision 55546.
Conflicts resolved: source/blenderplayer/bad_level_call_stubs/SConscript Partly reverted changes to intern/cycles/blender/addon/ui.py in revision 52899 to make it easier to merge trunk changes.
Diffstat (limited to 'source/blender/blenkernel/intern/idcode.c')
-rw-r--r--source/blender/blenkernel/intern/idcode.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index adc0503df29..c64c261b9b0 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -109,17 +109,36 @@ static IDType *idtype_from_code(int code)
return NULL;
}
+/**
+ * Return if the ID code is a valid ID code.
+ *
+ * \param code The code to check.
+ * \return Boolean, 0 when invalid.
+ */
bool BKE_idcode_is_valid(int code)
{
return idtype_from_code(code) ? true : false;
}
+/**
+ * Return non-zero when an ID type is linkable.
+ *
+ * \param code The code to check.
+ * \return Boolean, 0 when non linkable.
+ */
bool BKE_idcode_is_linkable(int code)
{
IDType *idt = idtype_from_code(code);
return idt ? ((idt->flags & IDTYPE_FLAGS_ISLINKABLE) != 0) : false;
}
+/**
+ * Convert an idcode into a name.
+ *
+ * \param code The code to convert.
+ * \return A static string representing the name of
+ * the code.
+ */
const char *BKE_idcode_to_name(int code)
{
IDType *idt = idtype_from_code(code);
@@ -127,6 +146,12 @@ const char *BKE_idcode_to_name(int code)
return idt ? idt->name : NULL;
}
+/**
+ * Convert a name into an idcode (ie. ID_SCE)
+ *
+ * \param name The name to convert.
+ * \return The code for the name, or 0 if invalid.
+ */
int BKE_idcode_from_name(const char *name)
{
IDType *idt = idtype_from_name(name);
@@ -134,6 +159,13 @@ int BKE_idcode_from_name(const char *name)
return idt ? idt->code : 0;
}
+/**
+ * Convert an idcode into a name (plural).
+ *
+ * \param code The code to convert.
+ * \return A static string representing the name of
+ * the code.
+ */
const char *BKE_idcode_to_name_plural(int code)
{
IDType *idt = idtype_from_code(code);
@@ -141,6 +173,12 @@ const char *BKE_idcode_to_name_plural(int code)
return idt ? idt->plural : NULL;
}
+/**
+ * Return an ID code and steps the index forward 1.
+ *
+ * \param index start as 0.
+ * \return the code, 0 when all codes have been returned.
+ */
int BKE_idcode_iter_step(int *index)
{
return (*index < nidtypes) ? idtypes[(*index)++].code : 0;