forked from bartvdbraak/blender
use const for readonly strings and set some functions to static
This commit is contained in:
parent
626f737186
commit
699030ceb6
@ -1585,30 +1585,3 @@ setWindowCustomCursorShape(
|
|||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
void glutCustomCursor(char *data1, char *data2, int size)
|
|
||||||
{
|
|
||||||
Pixmap source, mask;
|
|
||||||
Cursor cursor;
|
|
||||||
XColor fg, bg;
|
|
||||||
|
|
||||||
if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
|
|
||||||
"White", &fg, &fg) == 0) return;
|
|
||||||
if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
|
|
||||||
"Red", &bg, &bg) == 0) return;
|
|
||||||
|
|
||||||
|
|
||||||
source= XCreateBitmapFromData(__glutDisplay, xdraw, data2, size, size);
|
|
||||||
mask= XCreateBitmapFromData(__glutDisplay, xdraw, data1, size, size);
|
|
||||||
|
|
||||||
cursor= XCreatePixmapCursor(__glutDisplay, source, mask, &fg, &bg, 7, 7);
|
|
||||||
|
|
||||||
XFreePixmap(__glutDisplay, source);
|
|
||||||
XFreePixmap(__glutDisplay, mask);
|
|
||||||
|
|
||||||
XDefineCursor(__glutDisplay, xdraw, cursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
@ -58,7 +58,7 @@ int BKE_ftype_to_imtype(int ftype);
|
|||||||
int BKE_imtype_to_ftype(int imtype);
|
int BKE_imtype_to_ftype(int imtype);
|
||||||
int BKE_imtype_is_movie(int imtype);
|
int BKE_imtype_is_movie(int imtype);
|
||||||
|
|
||||||
struct anim *openanim(char * name, int flags, int streamindex);
|
struct anim *openanim(const char *name, int flags, int streamindex);
|
||||||
|
|
||||||
void image_de_interlace(struct Image *ima, int odd);
|
void image_de_interlace(struct Image *ima, int odd);
|
||||||
|
|
||||||
|
@ -1500,7 +1500,7 @@ void BKE_makepicstring(char *string, const char *base, int frame, int imtype, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* used by sequencer too */
|
/* used by sequencer too */
|
||||||
struct anim *openanim(char *name, int flags, int streamindex)
|
struct anim *openanim(const char *name, int flags, int streamindex)
|
||||||
{
|
{
|
||||||
struct anim *anim;
|
struct anim *anim;
|
||||||
struct ImBuf *ibuf;
|
struct ImBuf *ibuf;
|
||||||
|
@ -567,7 +567,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin)
|
|||||||
// is a child of a node (not joint), root should be true since
|
// is a child of a node (not joint), root should be true since
|
||||||
// this is where we build armature bones from
|
// this is where we build armature bones from
|
||||||
|
|
||||||
void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , char *parentname, float parent_mat[][4])
|
void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4])
|
||||||
{
|
{
|
||||||
char * bone_name = (char *) bc_get_joint_name ( root_node);
|
char * bone_name = (char *) bc_get_joint_name ( root_node);
|
||||||
float mat[4][4];
|
float mat[4][4];
|
||||||
|
@ -113,7 +113,7 @@ private:
|
|||||||
|
|
||||||
void fix_leaf_bones();
|
void fix_leaf_bones();
|
||||||
|
|
||||||
void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node ,char * parentname, float parent_mat[][4]);
|
void set_pose ( Object * ob_arm , COLLADAFW::Node * root_node , const char *parentname, float parent_mat[][4]);
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -168,35 +168,35 @@ static int additional_slen_offset;
|
|||||||
* \param str char
|
* \param str char
|
||||||
* \param len int
|
* \param len int
|
||||||
*/
|
*/
|
||||||
int add_type(const char *str, int len);
|
static int add_type(const char *str, int len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add variable \c str to
|
* Add variable \c str to
|
||||||
* \param str
|
* \param str
|
||||||
*/
|
*/
|
||||||
int add_name(char *str);
|
static int add_name(const char *str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search whether this structure type was already found, and if not,
|
* Search whether this structure type was already found, and if not,
|
||||||
* add it.
|
* add it.
|
||||||
*/
|
*/
|
||||||
short *add_struct(int namecode);
|
static short *add_struct(int namecode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove comments from this buffer. Assumes that the buffer refers to
|
* Remove comments from this buffer. Assumes that the buffer refers to
|
||||||
* ascii-code text.
|
* ascii-code text.
|
||||||
*/
|
*/
|
||||||
int preprocess_include(char *maindata, int len);
|
static int preprocess_include(char *maindata, int len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan this file for serializable types.
|
* Scan this file for serializable types.
|
||||||
*/
|
*/
|
||||||
int convert_include(char *filename);
|
static int convert_include(char *filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine how many bytes are needed for an array.
|
* Determine how many bytes are needed for an array.
|
||||||
*/
|
*/
|
||||||
int arraysize(char *astr, int len);
|
static int arraysize(char *astr, int len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine how many bytes are needed for each struct.
|
* Determine how many bytes are needed for each struct.
|
||||||
@ -267,12 +267,12 @@ int add_type(const char *str, int len)
|
|||||||
* cases, unfortunately. These are explicitly checked.
|
* cases, unfortunately. These are explicitly checked.
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
int add_name(char *str)
|
static int add_name(const char *str)
|
||||||
{
|
{
|
||||||
int nr, i, j, k;
|
int nr, i, j, k;
|
||||||
char *cp;
|
char *cp;
|
||||||
char buf[255]; /* stupid limit, change it :) */
|
char buf[255]; /* stupid limit, change it :) */
|
||||||
char *name;
|
const char *name;
|
||||||
|
|
||||||
additional_slen_offset = 0;
|
additional_slen_offset = 0;
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ short *add_struct(int namecode)
|
|||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int preprocess_include(char *maindata, int len)
|
static int preprocess_include(char *maindata, int len)
|
||||||
{
|
{
|
||||||
int a, newlen, comment = 0;
|
int a, newlen, comment = 0;
|
||||||
char *cp, *temp, *md;
|
char *cp, *temp, *md;
|
||||||
@ -1087,7 +1087,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
|
|||||||
|
|
||||||
/* ************************* END MAKE DNA ********************** */
|
/* ************************* END MAKE DNA ********************** */
|
||||||
|
|
||||||
static void make_bad_file(char *file, int line)
|
static void make_bad_file(const char *file, int line)
|
||||||
{
|
{
|
||||||
FILE *fp= fopen(file, "w");
|
FILE *fp= fopen(file, "w");
|
||||||
fprintf(fp, "#error \"Error! can't make correct DNA.c file from %s:%d, STUPID!\"\n", __FILE__, line);
|
fprintf(fp, "#error \"Error! can't make correct DNA.c file from %s:%d, STUPID!\"\n", __FILE__, line);
|
||||||
|
@ -2768,14 +2768,14 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
|
|||||||
fprintf(f, "}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n");
|
fprintf(f, "}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void make_bad_file(char *file, int line)
|
static void make_bad_file(const char *file, int line)
|
||||||
{
|
{
|
||||||
FILE *fp= fopen(file, "w");
|
FILE *fp= fopen(file, "w");
|
||||||
fprintf(fp, "#error \"Error! can't make correct RNA file from %s:%d, STUPID!\"\n", __FILE__, line);
|
fprintf(fp, "#error \"Error! can't make correct RNA file from %s:%d, STUPID!\"\n", __FILE__, line);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rna_preprocess(char *outfile)
|
static int rna_preprocess(const char *outfile)
|
||||||
{
|
{
|
||||||
BlenderRNA *brna;
|
BlenderRNA *brna;
|
||||||
StructDefRNA *ds;
|
StructDefRNA *ds;
|
||||||
|
@ -124,7 +124,7 @@ PyObject *bpy_text_import(Text *text)
|
|||||||
return PyImport_ExecCodeModule(modulename, text->compiled);
|
return PyImport_ExecCodeModule(modulename, text->compiled);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *bpy_text_import_name(char *name, int *found)
|
PyObject *bpy_text_import_name(const char *name, int *found)
|
||||||
{
|
{
|
||||||
Text *text;
|
Text *text;
|
||||||
char txtname[MAX_ID_NAME-2];
|
char txtname[MAX_ID_NAME-2];
|
||||||
|
@ -49,7 +49,7 @@ struct Text;
|
|||||||
void bpy_import_init(PyObject *builtins);
|
void bpy_import_init(PyObject *builtins);
|
||||||
|
|
||||||
PyObject* bpy_text_import(struct Text *text);
|
PyObject* bpy_text_import(struct Text *text);
|
||||||
PyObject* bpy_text_import_name(char *name, int *found);
|
PyObject* bpy_text_import_name(const char *name, int *found);
|
||||||
PyObject* bpy_text_reimport(PyObject *module, int *found);
|
PyObject* bpy_text_reimport(PyObject *module, int *found);
|
||||||
/* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */
|
/* void bpy_text_clear_modules(int clear_all);*/ /* Clear user modules */
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ static const char *get_pass_name(int passtype, int channel)
|
|||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
static int passtype_from_name(char *str)
|
static int passtype_from_name(const char *str)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(strcmp(str, "Combined")==0)
|
if(strcmp(str, "Combined")==0)
|
||||||
|
@ -111,7 +111,7 @@ KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities et
|
|||||||
|
|
||||||
#define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x)
|
#define KX_BLENDERTRUNC(x) (( x < 0.0001 && x > -0.0001 ) ? 0.0 : x)
|
||||||
|
|
||||||
void BL_ConvertActuators(char* maggiename,
|
void BL_ConvertActuators(const char* maggiename,
|
||||||
struct Object* blenderobject,
|
struct Object* blenderobject,
|
||||||
KX_GameObject* gameobj,
|
KX_GameObject* gameobj,
|
||||||
SCA_LogicManager* logicmgr,
|
SCA_LogicManager* logicmgr,
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#ifndef __KX_CONVERTACTUATORS_H
|
#ifndef __KX_CONVERTACTUATORS_H
|
||||||
#define __KX_CONVERTACTUATORS_H
|
#define __KX_CONVERTACTUATORS_H
|
||||||
|
|
||||||
void BL_ConvertActuators(char* maggiename,
|
void BL_ConvertActuators(const char* maggiename,
|
||||||
struct Object* blenderobject,
|
struct Object* blenderobject,
|
||||||
class KX_GameObject* gameobj,
|
class KX_GameObject* gameobj,
|
||||||
class SCA_LogicManager* logicmgr,
|
class SCA_LogicManager* logicmgr,
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
// Initialize() functions are not put here since they have
|
// Initialize() functions are not put here since they have
|
||||||
// different prototypes for Unix and Windows
|
// different prototypes for Unix and Windows
|
||||||
void StartLoadingAnimation();
|
void StartLoadingAnimation();
|
||||||
bool Start(char *filename); // file-on-disk starter
|
bool Start(const char *filename); // file-on-disk starter
|
||||||
bool Start(unsigned char *blenderDataBuffer,
|
bool Start(unsigned char *blenderDataBuffer,
|
||||||
unsigned int blenderDataBufferSize); // file-in-memory starter
|
unsigned int blenderDataBufferSize); // file-in-memory starter
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CValue *KX_CameraActuator::findObject(char *obName)
|
CValue *KX_CameraActuator::findObject(const char *obName)
|
||||||
{
|
{
|
||||||
/* hook to object system */
|
/* hook to object system */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -77,7 +77,7 @@ private :
|
|||||||
float m_damping;
|
float m_damping;
|
||||||
|
|
||||||
/* get the KX_IGameObject with this name */
|
/* get the KX_IGameObject with this name */
|
||||||
CValue *findObject(char *obName);
|
CValue *findObject(const char *obName);
|
||||||
|
|
||||||
/* parse x or y to a toggle pick */
|
/* parse x or y to a toggle pick */
|
||||||
bool string2axischoice(const char *axisString);
|
bool string2axischoice(const char *axisString);
|
||||||
|
@ -382,7 +382,8 @@ void KX_IpoActuator::ResetStartTime()
|
|||||||
this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0;
|
this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int KX_IpoActuator::string2mode(char* modename) {
|
int KX_IpoActuator::string2mode(const char *modename)
|
||||||
|
{
|
||||||
IpoActType res = KX_ACT_IPO_NODEF;
|
IpoActType res = KX_ACT_IPO_NODEF;
|
||||||
|
|
||||||
if (strcmp(modename, S_KX_ACT_IPO_PLAY_STRING)==0) {
|
if (strcmp(modename, S_KX_ACT_IPO_PLAY_STRING)==0) {
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
static const char *S_KX_ACT_IPO_KEY2KEY_STRING;
|
static const char *S_KX_ACT_IPO_KEY2KEY_STRING;
|
||||||
static const char *S_KX_ACT_IPO_FROM_PROP_STRING;
|
static const char *S_KX_ACT_IPO_FROM_PROP_STRING;
|
||||||
|
|
||||||
int string2mode(char* modename);
|
int string2mode(const char *modename);
|
||||||
|
|
||||||
int m_type;
|
int m_type;
|
||||||
|
|
||||||
|
@ -1089,7 +1089,7 @@ static PyObject* gPyDisableMotionBlur(PyObject*)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getGLSLSettingFlag(char *setting)
|
static int getGLSLSettingFlag(const char *setting)
|
||||||
{
|
{
|
||||||
if(strcmp(setting, "lights") == 0)
|
if(strcmp(setting, "lights") == 0)
|
||||||
return GAME_GLSL_NO_LIGHTS;
|
return GAME_GLSL_NO_LIGHTS;
|
||||||
@ -1725,7 +1725,7 @@ static void backupPySysObjects(void)
|
|||||||
*
|
*
|
||||||
* "/home/me/foo.blend" -> "/home/me/scripts"
|
* "/home/me/foo.blend" -> "/home/me/scripts"
|
||||||
*/
|
*/
|
||||||
static void initPySysObjects__append(PyObject *sys_path, char *filename)
|
static void initPySysObjects__append(PyObject *sys_path, const char *filename)
|
||||||
{
|
{
|
||||||
PyObject *item;
|
PyObject *item;
|
||||||
char expanded[FILE_MAXDIR + FILE_MAXFILE];
|
char expanded[FILE_MAXDIR + FILE_MAXFILE];
|
||||||
@ -2339,7 +2339,7 @@ void pathGamePythonConfig( char *path )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setGamePythonPath(char *path)
|
void setGamePythonPath(const char *path)
|
||||||
{
|
{
|
||||||
BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath));
|
BLI_strncpy(gp_GamePythonPath, path, sizeof(gp_GamePythonPath));
|
||||||
BLI_cleanup_file(NULL, gp_GamePythonPath); /* not absolutely needed but makes resolving path problems less confusing later */
|
BLI_cleanup_file(NULL, gp_GamePythonPath); /* not absolutely needed but makes resolving path problems less confusing later */
|
||||||
|
@ -54,7 +54,7 @@ void exitGamePythonScripting();
|
|||||||
|
|
||||||
void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *blenderdata, PyObject *pyGlobalDict, PyObject **gameLogic, PyObject **gameLogic_keys, int argc, char** argv);
|
void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *blenderdata, PyObject *pyGlobalDict, PyObject **gameLogic, PyObject **gameLogic_keys, int argc, char** argv);
|
||||||
|
|
||||||
void setGamePythonPath(char *path);
|
void setGamePythonPath(const char *path);
|
||||||
void resetGamePythonPath();
|
void resetGamePythonPath();
|
||||||
void pathGamePythonConfig( char *path );
|
void pathGamePythonConfig( char *path );
|
||||||
int saveGamePythonConfig( char **marshal_buffer);
|
int saveGamePythonConfig( char **marshal_buffer);
|
||||||
|
@ -190,7 +190,7 @@ bool KX_SceneActuator::Update()
|
|||||||
|
|
||||||
|
|
||||||
/* returns a camera if the name is valid */
|
/* returns a camera if the name is valid */
|
||||||
KX_Camera* KX_SceneActuator::FindCamera(char *camName)
|
KX_Camera* KX_SceneActuator::FindCamera(const char *camName)
|
||||||
{
|
{
|
||||||
KX_SceneList* sl = m_KetsjiEngine->CurrentScenes();
|
KX_SceneList* sl = m_KetsjiEngine->CurrentScenes();
|
||||||
STR_String name = STR_String(camName);
|
STR_String name = STR_String(camName);
|
||||||
@ -208,7 +208,7 @@ KX_Camera* KX_SceneActuator::FindCamera(char *camName)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
KX_Scene* KX_SceneActuator::FindScene(char * sceneName)
|
KX_Scene* KX_SceneActuator::FindScene(const char * sceneName)
|
||||||
{
|
{
|
||||||
return m_KetsjiEngine->FindScene(sceneName);
|
return m_KetsjiEngine->FindScene(sceneName);
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ class KX_SceneActuator : public SCA_IActuator
|
|||||||
class KX_Camera* m_camera;
|
class KX_Camera* m_camera;
|
||||||
|
|
||||||
/** Is this a valid scene? */
|
/** Is this a valid scene? */
|
||||||
class KX_Scene* FindScene(char* sceneName);
|
class KX_Scene* FindScene(const char* sceneName);
|
||||||
/** Is this a valid camera? */
|
/** Is this a valid camera? */
|
||||||
class KX_Camera* FindCamera(char* cameraName);
|
class KX_Camera* FindCamera(const char* cameraName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum SCA_SceneActuatorMode
|
enum SCA_SceneActuatorMode
|
||||||
|
@ -107,7 +107,7 @@ RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID)
|
|||||||
|
|
||||||
|
|
||||||
// get material ID
|
// get material ID
|
||||||
short getMaterialID (PyObject * obj, char * name)
|
short getMaterialID(PyObject * obj, const char *name)
|
||||||
{
|
{
|
||||||
// search for material
|
// search for material
|
||||||
for (short matID = 0;; ++matID)
|
for (short matID = 0;; ++matID)
|
||||||
|
@ -85,7 +85,7 @@ void loadTexture (unsigned int texId, unsigned int * texture, short * size,
|
|||||||
RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID);
|
RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID);
|
||||||
|
|
||||||
// get material ID
|
// get material ID
|
||||||
short getMaterialID (PyObject * obj, char * name);
|
short getMaterialID (PyObject * obj, const char *name);
|
||||||
|
|
||||||
// Exceptions
|
// Exceptions
|
||||||
extern ExceptionID MaterialNotAvail;
|
extern ExceptionID MaterialNotAvail;
|
||||||
|
Loading…
Reference in New Issue
Block a user