diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-05 09:44:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-05 09:44:52 +0400 |
commit | 62f22185546e80b661424b45c88006f8b592d8b1 (patch) | |
tree | 518849699eb9f7299605f6bedc32bc71264816e1 /source/blender/makesrna/intern | |
parent | a71e2c498cbb3c1ec077e38e0fcb8ee1581e4d6b (diff) |
macro formatting & remve some unused code.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 41 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 44 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_color.c | 25 |
3 files changed, 57 insertions, 53 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index adedcbb18b3..891b62f7c79 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -70,25 +70,28 @@ static int replace_if_different(char *tmpfile, const char *dep_files[]) { // return 0; // use for testing had edited rna -#define REN_IF_DIFF \ - { \ - FILE *file_test= fopen(orgfile, "rb"); \ - if(file_test) { \ - fclose(file_test); \ - if(fp_org) fclose(fp_org); \ - if(fp_new) fclose(fp_new); \ - if(remove(orgfile) != 0) { \ - fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n", __FILE__, __LINE__, strerror(errno), orgfile); \ - return -1; \ - } \ - } \ - } \ - if(rename(tmpfile, orgfile) != 0) { \ - fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", __FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \ - return -1; \ - } \ - remove(tmpfile); \ - return 1; \ +#define REN_IF_DIFF \ + { \ + FILE *file_test= fopen(orgfile, "rb"); \ + if(file_test) { \ + fclose(file_test); \ + if(fp_org) fclose(fp_org); \ + if(fp_new) fclose(fp_new); \ + if(remove(orgfile) != 0) { \ + fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n", \ + __FILE__, __LINE__, strerror(errno), orgfile); \ + return -1; \ + } \ + } \ + } \ + if(rename(tmpfile, orgfile) != 0) { \ + fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n", \ + __FILE__, __LINE__, strerror(errno), tmpfile, orgfile); \ + return -1; \ + } \ + remove(tmpfile); \ + return 1; \ + /* end REN_IF_DIFF */ diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a33efda38d0..793d0112af7 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -2930,28 +2930,28 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper return 1; } -#define RAW_GET(dtype, var, raw, a) \ -{ \ - switch(raw.type) { \ - case PROP_RAW_CHAR: var = (dtype)((char*)raw.array)[a]; break; \ - case PROP_RAW_SHORT: var = (dtype)((short*)raw.array)[a]; break; \ - case PROP_RAW_INT: var = (dtype)((int*)raw.array)[a]; break; \ - case PROP_RAW_FLOAT: var = (dtype)((float*)raw.array)[a]; break; \ - case PROP_RAW_DOUBLE: var = (dtype)((double*)raw.array)[a]; break; \ - default: var = (dtype)0; \ - } \ -} - -#define RAW_SET(dtype, raw, a, var) \ -{ \ - switch(raw.type) { \ - case PROP_RAW_CHAR: ((char*)raw.array)[a] = (char)var; break; \ - case PROP_RAW_SHORT: ((short*)raw.array)[a] = (short)var; break; \ - case PROP_RAW_INT: ((int*)raw.array)[a] = (int)var; break; \ - case PROP_RAW_FLOAT: ((float*)raw.array)[a] = (float)var; break; \ - case PROP_RAW_DOUBLE: ((double*)raw.array)[a] = (double)var; break; \ - default: break; \ - } \ +#define RAW_GET(dtype, var, raw, a) \ +{ \ + switch(raw.type) { \ + case PROP_RAW_CHAR: var = (dtype)((char*)raw.array)[a]; break; \ + case PROP_RAW_SHORT: var = (dtype)((short*)raw.array)[a]; break; \ + case PROP_RAW_INT: var = (dtype)((int*)raw.array)[a]; break; \ + case PROP_RAW_FLOAT: var = (dtype)((float*)raw.array)[a]; break; \ + case PROP_RAW_DOUBLE: var = (dtype)((double*)raw.array)[a]; break; \ + default: var = (dtype)0; \ + } \ +} + +#define RAW_SET(dtype, raw, a, var) \ +{ \ + switch(raw.type) { \ + case PROP_RAW_CHAR: ((char*)raw.array)[a] = (char)var; break; \ + case PROP_RAW_SHORT: ((short*)raw.array)[a] = (short)var; break; \ + case PROP_RAW_INT: ((int*)raw.array)[a] = (int)var; break; \ + case PROP_RAW_FLOAT: ((float*)raw.array)[a] = (float)var; break; \ + case PROP_RAW_DOUBLE: ((double*)raw.array)[a] = (double)var; break; \ + default: break; \ + } \ } int RNA_raw_type_sizeof(RawPropertyType type) diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 59d23b7a878..60144e0cf7f 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -167,19 +167,20 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) /* helper macro for use here to try and get the path * - this calls the standard code for getting a path to a texture... */ -#define COLRAMP_GETPATH \ -{ \ -prop= RNA_struct_find_property(&ramp_ptr, "elements"); \ -if (prop) { \ -index= RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \ -if (index >= 0) { \ -char *texture_path= rna_ColorRamp_path(&ramp_ptr); \ -path= BLI_sprintfN("%s.elements[%d]", texture_path, index); \ -MEM_freeN(texture_path); \ -} \ -} \ + +#define COLRAMP_GETPATH \ +{ \ + prop= RNA_struct_find_property(&ramp_ptr, "elements"); \ + if (prop) { \ + index= RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \ + if (index >= 0) { \ + char *texture_path= rna_ColorRamp_path(&ramp_ptr); \ + path= BLI_sprintfN("%s.elements[%d]", texture_path, index); \ + MEM_freeN(texture_path); \ + } \ + } \ } - + /* determine the path from the ID-block to the ramp */ // FIXME: this is a very slow way to do it, but it will have to suffice... if (ptr->id.data) { |