minor edits, no functional changes.

- BGE was getting MCol array and not using it.
- use list lookup functions for getting constraint from pose bone.
- use const char * in more places.
This commit is contained in:
Campbell Barton 2011-02-07 22:48:23 +00:00
parent 16160f5fcc
commit 0d8416acc7
16 changed files with 36 additions and 43 deletions

@ -674,7 +674,7 @@ setTitle(
XChangeProperty(m_display, m_window,
name, utf8str, 8, PropModeReplace,
(const unsigned char*) title.ReadPtr(),
strlen(title.ReadPtr()));
title.Length());
// This should convert to valid x11 string
// and getTitle would need matching change

@ -62,7 +62,7 @@ struct Scene *add_scene(const char *name);
struct Base *object_in_scene(struct Object *ob, struct Scene *sce);
void set_scene_bg(struct Main *bmain, struct Scene *sce);
struct Scene *set_scene_name(struct Main *bmain, char *name);
struct Scene *set_scene_name(struct Main *bmain, const char *name);
struct Scene *copy_scene(struct Scene *sce, int type);
void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce);

@ -419,7 +419,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
/* ------------ General Target Matrix Tools ---------- */
/* function that sets the given matrix based on given vertex group in mesh */
static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, float mat[][4])
static void contarget_get_mesh_mat (Scene *scene, Object *ob, const char *substring, float mat[][4])
{
DerivedMesh *dm = NULL;
Mesh *me= ob->data;
@ -524,7 +524,7 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, f
}
/* function that sets the given matrix based on given vertex group in lattice */
static void contarget_get_lattice_mat (Object *ob, char *substring, float mat[][4])
static void contarget_get_lattice_mat (Object *ob, const char *substring, float mat[][4])
{
Lattice *lt= (Lattice *)ob->data;
@ -582,7 +582,7 @@ static void contarget_get_lattice_mat (Object *ob, char *substring, float mat[][
/* generic function to get the appropriate matrix for most target cases */
/* The cases where the target can be object data have not been implemented */
static void constraint_target_to_mat4 (Scene *scene, Object *ob, char *substring, float mat[][4], short from, short to, float headtail)
static void constraint_target_to_mat4 (Scene *scene, Object *ob, const char *substring, float mat[][4], short from, short to, float headtail)
{
/* Case OBJECT */
if (!strlen(substring)) {

@ -581,7 +581,7 @@ void set_scene_bg(Main *bmain, Scene *scene)
}
/* called from creator.c */
Scene *set_scene_name(Main *bmain, char *name)
Scene *set_scene_name(Main *bmain, const char *name)
{
Scene *sce= (Scene *)find_id("SC", name);
if(sce) {

@ -200,7 +200,7 @@ int BLO_has_bfile_extension(char *str);
int BLO_is_a_library(const char *path, char *dir, char *group);
struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, char *dir);
void BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, char *name, int idcode, short flag);
void BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag);
void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag);
/* deprecated */

@ -12500,7 +12500,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
}
}
static void append_named_part(const bContext *C, Main *mainl, FileData *fd, char *name, int idcode, short flag)
static void append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *name, int idcode, short flag)
{
Scene *scene= CTX_data_scene(C);
Object *ob;
@ -12566,7 +12566,7 @@ static void append_named_part(const bContext *C, Main *mainl, FileData *fd, char
}
}
void BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, char *name, int idcode, short flag)
void BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag)
{
FileData *fd= (FileData*)(*bh);
append_named_part(C, mainl, fd, name, idcode, flag);
@ -12744,7 +12744,7 @@ void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle**
/* tentatively removed, Python should be able to use the split functions too: */
/* BLO_library_append_begin, BLO_library_append_end, BLO_library_append_named_part */
#if 0
void BLO_script_library_append(BlendHandle **bh, char *dir, char *name,
void BLO_script_library_append(BlendHandle **bh, char *dir, const char *name,
int idcode, short flag, Main *mainvar, Scene *scene, ReportList *reports)
{
FileData *fd= (FileData*)(*bh);

@ -194,7 +194,7 @@ int paintface_minmax(struct Object *ob, float *min, float *max);
struct bDeformGroup *ED_vgroup_add(struct Object *ob);
struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name);
void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup);
void ED_vgroup_select_by_name(struct Object *ob, char *name);
void ED_vgroup_select_by_name(struct Object *ob, const char *name);
void ED_vgroup_data_create(struct ID *id);
int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);

@ -472,8 +472,8 @@ extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *s
struct ThemeUI;
void ui_widget_color_init(struct ThemeUI *tui);
void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state);
void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state);
void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
/* interface_style.c */
void uiStyleInit(void);

@ -3080,7 +3080,7 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
/* helper call to draw a menu item without button */
/* state: UI_ACTIVE or 0 */
void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state)
void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
{
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
rcti _rect= *rect;
@ -3126,7 +3126,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid,
}
}
void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state)
void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
{
rcti trect = *rect;

@ -550,7 +550,7 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
return get_vert_def_nr(ob, def_nr, vertnum);
}
void ED_vgroup_select_by_name(Object *ob, char *name)
void ED_vgroup_select_by_name(Object *ob, const char *name)
{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
ob->actdef= defgroup_name_index(ob, name) + 1;
}

@ -47,6 +47,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_library.h"
@ -1079,25 +1080,15 @@ static void draw_default_sensor_header(bSensor *sens,
"Invert the level (output) of this sensor");
}
static void get_armature_bone_constraint(Object *ob, char *posechannel, char *constraint_name, bConstraint **constraint)
static void get_armature_bone_constraint(Object *ob, const char *posechannel, const char *constraint_name, bConstraint **constraint)
{
/* check that bone exist in the active object */
if (ob->type == OB_ARMATURE && ob->pose) {
bPoseChannel *pchan;
bPose *pose = ob->pose;
for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
if (!strcmp(pchan->name, posechannel)) {
/* found it, now look for constraint channel */
bConstraint *con;
for (con=pchan->constraints.first; con; con=con->next) {
if (!strcmp(con->name, constraint_name)) {
/* found it, all ok */
*constraint = con;
return;
}
}
/* didn't find constraint, make empty */
return;
bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel);
if(pchan) {
bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name));
if(con) {
*constraint= con;
}
}
}

@ -1244,7 +1244,7 @@ void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
}
}
static int outliner_filter_has_name(TreeElement *te, char *name, int flags)
static int outliner_filter_has_name(TreeElement *te, const char *name, int flags)
{
#if 0
int found= 0;

@ -89,7 +89,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c)
return st->cwidth;
}
int text_font_width(SpaceText *UNUSED(st), char *str)
int text_font_width(SpaceText *UNUSED(st), const char *str)
{
return BLF_width(mono, str);
}
@ -124,7 +124,7 @@ static void flatten_string_append(FlattenString *fs, char c, int accum)
fs->pos++;
}
int flatten_string(SpaceText *st, FlattenString *fs, char *in)
int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
{
int r = 0, i = 0;
@ -645,7 +645,7 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
}
}
int text_get_char_pos(SpaceText *st, char *line, int cur)
int text_get_char_pos(SpaceText *st, const char *line, int cur)
{
int a=0, i;
@ -961,7 +961,7 @@ int text_get_visible_lines_no(SpaceText *st, int lineno)
return drawcache->line_height[lineno];
}
int text_get_visible_lines(SpaceText *st, ARegion *ar, char *str)
int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str)
{
int i, j, start, end, max, lines, chars;
char ch;

@ -45,7 +45,7 @@ struct wmWindowManager;
void draw_text_main(struct SpaceText *st, struct ARegion *ar);
int text_font_width_character(struct SpaceText *st);
int text_font_width(struct SpaceText *st, char *str);
int text_font_width(struct SpaceText *st, const char *str);
void text_update_line_edited(struct TextLine *line);
void text_update_edited(struct Text *text);
@ -79,13 +79,13 @@ typedef struct FlattenString {
int pos, len;
} FlattenString;
int flatten_string(struct SpaceText *st, FlattenString *fs, char *in);
int flatten_string(struct SpaceText *st, FlattenString *fs, const char *in);
void flatten_string_free(FlattenString *fs);
int wrap_width(struct SpaceText *st, struct ARegion *ar);
void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc);
void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc);
int text_get_char_pos(struct SpaceText *st, char *line, int cur);
int text_get_char_pos(struct SpaceText *st, const char *line, int cur);
void text_drawcache_tag_update(struct SpaceText *st, int full);
void text_free_caches(struct SpaceText *st);
@ -95,7 +95,7 @@ int text_file_modified(struct Text *text);
int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar);
void text_pop_suggest_list(void);
int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, char *str);
int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, const char *str);
int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to);
int text_get_total_lines(struct SpaceText *st, struct ARegion *ar);

@ -55,7 +55,6 @@ void wm_window_set_size (wmWindow *win, int width, int height);
void wm_window_get_size (wmWindow *win, int *width_r, int *height_r);
void wm_window_get_size_ghost (wmWindow *win, int *width_r, int *height_r);
void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r);
void wm_window_set_title (wmWindow *win, char *title);
void wm_window_swap_buffers (wmWindow *win);
void wm_get_cursor_position (wmWindow *win, int *x, int *y);

@ -742,6 +742,8 @@ static int CheckMaterialDM(int matnr, void *attribs)
memcpy(gattribs, &current_gpu_attribs, sizeof(GPUVertexAttribs));
return 1;
}
/*
static int CheckTexfaceDM(void *mcol, int index)
{
@ -769,6 +771,7 @@ static int CheckTexfaceDM(void *mcol, int index)
}
return 0;
}
*/
static int CheckTexDM(MTFace *tface, MCol *mcol, int matnr)
{
@ -811,7 +814,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
current_ms = &ms;
current_mesh = ms.m_mesh;
current_wireframe = wireframe;
MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL);
// MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL); /* UNUSED */
// handle two-side
if (current_polymat->GetDrawingMode() & RAS_IRasterizer::KX_TWOSIDE)