Blender V2.61 - r43446
Classes | Defines | Functions | Variables

idcode.c File Reference

#include <stdlib.h>
#include <string.h>
#include "DNA_ID.h"
#include "BKE_idcode.h"

Go to the source code of this file.

Classes

struct  IDType

Defines

#define IDTYPE_FLAGS_ISLINKABLE   (1<<0)

Functions

static IDTypeidtype_from_name (const char *str)
static IDTypeidtype_from_code (int code)
int BKE_idcode_is_valid (int code)
int BKE_idcode_is_linkable (int code)
const char * BKE_idcode_to_name (int code)
int BKE_idcode_from_name (const char *name)
const char * BKE_idcode_to_name_plural (int code)
int BKE_idcode_iter_step (int *index)

Variables

static IDType idtypes []
static int nidtypes = sizeof(idtypes)/sizeof(idtypes[0])

Detailed Description

Definition in file idcode.c.


Define Documentation

#define IDTYPE_FLAGS_ISLINKABLE   (1<<0)

Definition at line 46 of file idcode.c.

Referenced by BKE_idcode_is_linkable().


Function Documentation

int BKE_idcode_from_name ( const char *  name)

Convert a name into an idcode (ie. ID_SCE)

Parameters:
nameThe name to convert.
Returns:
The code for the name, or 0 if invalid.

Definition at line 124 of file idcode.c.

References IDType::code, and idtype_from_name().

Referenced by groupname_to_code(), KX_BlenderSceneConverter::LinkBlendFile(), and wm_link_append_exec().

int BKE_idcode_is_linkable ( int  code)

Return non-zero when an ID type is linkable.

Parameters:
codeThe code to check.
Returns:
Boolean, 0 when non linkable.

Definition at line 111 of file idcode.c.

References IDType::flags, IDTYPE_FLAGS_ISLINKABLE, and idtype_from_code().

Referenced by BLO_blendhandle_get_linkable_groups(), bpy_lib_enter(), and bpy_lib_exit().

int BKE_idcode_is_valid ( int  code)

Return if the ID code is a valid ID code.

Parameters:
codeThe code to check.
Returns:
Boolean, 0 when invalid.

Definition at line 106 of file idcode.c.

References idtype_from_code().

Referenced by BLO_blendhandle_get_linkable_groups().

int BKE_idcode_iter_step ( int *  index)

Return an ID code and steps the index forward 1.

Parameters:
index,startas 0.
Returns:
the code, 0 when all codes have been returned.

Definition at line 138 of file idcode.c.

References IDType::code, and nidtypes.

Referenced by bpy_lib_enter(), and bpy_lib_exit().

const char* BKE_idcode_to_name ( int  code)

Convert an idcode into a name.

Parameters:
codeThe code to convert.
Returns:
A static string representing the name of the code.

Definition at line 117 of file idcode.c.

References idtype_from_code(), IDType::name, and NULL.

Referenced by BLO_blendhandle_get_linkable_groups(), read_libraries(), and rna_id_write_error().

const char* BKE_idcode_to_name_plural ( int  code)

Convert an idcode into a name (plural).

Parameters:
codeThe code to convert.
Returns:
A static string representing the name of the code.

Definition at line 131 of file idcode.c.

References idtype_from_code(), NULL, and IDType::plural.

Referenced by bpy_lib_enter(), bpy_lib_exit(), id_drop_copy(), pyrna_prop_repr(), and pyrna_struct_repr().

static IDType* idtype_from_code ( int  code) [static]

Definition at line 95 of file idcode.c.

References i, nidtypes, and NULL.

Referenced by BKE_idcode_is_linkable(), BKE_idcode_is_valid(), BKE_idcode_to_name(), and BKE_idcode_to_name_plural().

static IDType* idtype_from_name ( const char *  str) [static]

Definition at line 85 of file idcode.c.

References i, nidtypes, and NULL.

Referenced by BKE_idcode_from_name().


Variable Documentation

IDType idtypes[] [static]

Definition at line 50 of file idcode.c.

int nidtypes = sizeof(idtypes)/sizeof(idtypes[0]) [static]

Definition at line 83 of file idcode.c.

Referenced by BKE_idcode_iter_step(), idtype_from_code(), and idtype_from_name().