[Bf-blender-cvs] [8cafa0a] master: Code cleanup: give anomymous enum used for CustomData.type a name
Nicholas Bishop
noreply at git.blender.org
Mon Jan 26 16:41:54 CET 2015
Commit: 8cafa0afa67c2d027fbd241b3cf3959571a43160
Author: Nicholas Bishop
Date: Sat Jan 24 13:25:49 2015 +0100
Branches: master
https://developer.blender.org/rB8cafa0afa67c2d027fbd241b3cf3959571a43160
Code cleanup: give anomymous enum used for CustomData.type a name
Used this in GPU module to clarify what some "ints" really are.
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D1026
===================================================================
M source/blender/gpu/GPU_material.h
M source/blender/gpu/intern/gpu_codegen.c
M source/blender/gpu/intern/gpu_codegen.h
M source/blender/makesdna/DNA_customdata_types.h
===================================================================
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index 09a5653..cbbc428 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -32,6 +32,7 @@
#ifndef __GPU_MATERIAL_H__
#define __GPU_MATERIAL_H__
+#include "DNA_customdata_types.h" /* for CustomDataType */
#include "DNA_listBase.h"
#include "BLI_sys_types.h" /* for bool */
@@ -120,7 +121,7 @@ typedef struct GPUNodeStack {
short sockettype;
} GPUNodeStack;
-GPUNodeLink *GPU_attribute(int type, const char *name);
+GPUNodeLink *GPU_attribute(CustomDataType type, const char *name);
GPUNodeLink *GPU_uniform(float *num);
GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data);
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, bool is_data);
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 1f9efdc..984e1d6 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1142,7 +1142,7 @@ static void gpu_nodes_get_builtin_flag(ListBase *nodes, int *builtin)
/* varargs linking */
-GPUNodeLink *GPU_attribute(int type, const char *name)
+GPUNodeLink *GPU_attribute(const CustomDataType type, const char *name)
{
GPUNodeLink *link = GPU_node_link_create(0);
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index a069823..cf9f4cc 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -33,6 +33,7 @@
#ifndef __GPU_CODEGEN_H__
#define __GPU_CODEGEN_H__
+#include "DNA_customdata_types.h"
#include "DNA_listBase.h"
#include "GPU_material.h"
#include "GPU_glew.h"
@@ -89,7 +90,7 @@ struct GPUNode {
struct GPUNodeLink {
GPUNodeStack *socket;
- int attribtype;
+ CustomDataType attribtype;
const char *attribname;
int image;
@@ -153,7 +154,7 @@ typedef struct GPUInput {
float vec[16]; /* vector data */
GPUNodeLink *link;
int dynamictex; /* dynamic? */
- int attribtype; /* attribute type */
+ CustomDataType attribtype; /* attribute type */
char attribname[32]; /* attribute name */
int attribfirst; /* this is the first one that is bound */
GPUBuiltin builtin; /* builtin uniform */
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 70dc436..7fedad2 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -73,7 +73,7 @@ typedef struct CustomData {
} CustomData;
/* CustomData.type */
-enum {
+typedef enum CustomDataType {
CD_MVERT = 0,
CD_MSTICKY = 1, /* DEPRECATED */
CD_MDEFORMVERT = 2,
@@ -121,7 +121,7 @@ enum {
CD_TESSLOOPNORMAL = 40,
CD_NUMTYPES = 41
-};
+} CustomDataType;
/* Bits for CustomDataMask */
#define CD_MASK_MVERT (1 << CD_MVERT)
More information about the Bf-blender-cvs
mailing list