Use eObjectMode for function arguments

This commit is contained in:
2018-02-06 23:27:49 +11:00
parent 5376c739f5
commit 885d78150d
16 changed files with 56 additions and 37 deletions

View File

@@ -77,6 +77,8 @@ struct SpaceClip;
struct ID;
struct EvaluationContext;
#include "DNA_object_enums.h"
/* Structs */
struct bContext;
@@ -262,7 +264,7 @@ struct ToolSettings *CTX_data_tool_settings(const bContext *C);
const char *CTX_data_mode_string(const bContext *C);
int CTX_data_mode_enum_ex(
const struct Object *obedit, const struct Object *ob,
const short object_mode);
const eObjectMode object_mode);
int CTX_data_mode_enum(const bContext *C);
void CTX_data_main_set(bContext *C, struct Main *bmain);

View File

@@ -50,6 +50,8 @@ struct RigidBodyWorld;
struct HookModifierData;
struct ModifierData;
#include "DNA_object_enums.h"
void BKE_object_workob_clear(struct Object *workob);
void BKE_object_workob_calc_parent(const struct EvaluationContext *eval_ctx, struct Scene *scene, struct Object *ob, struct Object *workob);
@@ -113,9 +115,12 @@ void BKE_object_lod_add(struct Object *ob);
void BKE_object_lod_sort(struct Object *ob);
bool BKE_object_lod_remove(struct Object *ob, int level);
void BKE_object_lod_update(struct Object *ob, const float camera_position[3]);
bool BKE_object_lod_is_usable(struct Object *ob, struct ViewLayer *view_layer, const short object_mode);
struct Object *BKE_object_lod_meshob_get(struct Object *ob, struct ViewLayer *view_layer, const short object_mode);
struct Object *BKE_object_lod_matob_get(struct Object *ob, struct ViewLayer *view_layer, const short object_mode);
bool BKE_object_lod_is_usable(
struct Object *ob, struct ViewLayer *view_layer, const eObjectMode object_mode);
struct Object *BKE_object_lod_meshob_get(
struct Object *ob, struct ViewLayer *view_layer, const eObjectMode object_mode);
struct Object *BKE_object_lod_matob_get(
struct Object *ob, struct ViewLayer *view_layer, const eObjectMode object_mode);
void BKE_object_copy_data(struct Main *bmain, struct Object *ob_dst, const struct Object *ob_src, const int flag);
struct Object *BKE_object_copy(struct Main *bmain, const struct Object *ob);

View File

@@ -62,6 +62,8 @@ struct EvaluationContext;
enum eOverlayFlags;
#include "DNA_object_enums.h"
extern const char PAINT_CURSOR_SCULPT[3];
extern const char PAINT_CURSOR_VERTEX_PAINT[3];
extern const char PAINT_CURSOR_WEIGHT_PAINT[3];
@@ -124,10 +126,10 @@ void BKE_paint_copy(struct Paint *src, struct Paint *tar, const int flag);
void BKE_paint_cavity_curve_preset(struct Paint *p, int preset);
short BKE_paint_object_mode_from_paint_mode(ePaintMode mode);
eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode);
struct Paint *BKE_paint_get_active_from_paintmode(struct Scene *sce, ePaintMode mode);
struct Paint *BKE_paint_get_active(
struct Scene *sce, struct ViewLayer *view_layer, const short object_mode);
struct Scene *sce, struct ViewLayer *view_layer, const eObjectMode object_mode);
struct Paint *BKE_paint_get_active_from_context(const struct bContext *C);
ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C);
struct Brush *BKE_paint_brush(struct Paint *paint);

View File

@@ -997,7 +997,7 @@ SceneCollection *CTX_data_scene_collection(const bContext *C)
return BKE_collection_master(&scene->id);
}
int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, const short object_mode)
int CTX_data_mode_enum_ex(const Object *obedit, const Object *ob, const eObjectMode object_mode)
{
// Object *obedit = CTX_data_edit_object(C);
if (obedit) {

View File

@@ -884,7 +884,7 @@ static LodLevel *lod_level_select(Object *ob, const float camera_position[3])
return current;
}
bool BKE_object_lod_is_usable(Object *ob, ViewLayer *view_layer, const short object_mode)
bool BKE_object_lod_is_usable(Object *ob, ViewLayer *view_layer, const eObjectMode object_mode)
{
bool active = (view_layer) ? ob == OBACT(view_layer) : false;
return (object_mode == OB_MODE_OBJECT || !active);
@@ -900,7 +900,7 @@ void BKE_object_lod_update(Object *ob, const float camera_position[3])
}
}
static Object *lod_ob_get(Object *ob, ViewLayer *view_layer, int flag, const short object_mode)
static Object *lod_ob_get(Object *ob, ViewLayer *view_layer, int flag, const eObjectMode object_mode)
{
LodLevel *current = ob->currentlod;
@@ -914,12 +914,12 @@ static Object *lod_ob_get(Object *ob, ViewLayer *view_layer, int flag, const sho
return current->source;
}
struct Object *BKE_object_lod_meshob_get(Object *ob, ViewLayer *view_layer, const short object_mode)
struct Object *BKE_object_lod_meshob_get(Object *ob, ViewLayer *view_layer, const eObjectMode object_mode)
{
return lod_ob_get(ob, view_layer, OB_LOD_USE_MESH, object_mode);
}
struct Object *BKE_object_lod_matob_get(Object *ob, ViewLayer *view_layer, const short object_mode)
struct Object *BKE_object_lod_matob_get(Object *ob, ViewLayer *view_layer, const eObjectMode object_mode)
{
return lod_ob_get(ob, view_layer, OB_LOD_USE_MAT, object_mode);
}

View File

@@ -159,7 +159,7 @@ Paint *BKE_paint_get_active_from_paintmode(Scene *sce, ePaintMode mode)
return NULL;
}
Paint *BKE_paint_get_active(Scene *sce, ViewLayer *view_layer, const short object_mode)
Paint *BKE_paint_get_active(Scene *sce, ViewLayer *view_layer, const eObjectMode object_mode)
{
if (sce && view_layer) {
ToolSettings *ts = sce->toolsettings;
@@ -178,6 +178,8 @@ Paint *BKE_paint_get_active(Scene *sce, ViewLayer *view_layer, const short objec
if (ts->use_uv_sculpt)
return &ts->uvsculpt->paint;
return &ts->imapaint.paint;
default:
break;
}
}
@@ -507,7 +509,7 @@ void BKE_paint_cavity_curve_preset(Paint *p, int preset)
curvemapping_changed(p->cavity_curve, false);
}
short BKE_paint_object_mode_from_paint_mode(ePaintMode mode)
eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode)
{
switch (mode) {
case ePaintSculpt:
@@ -537,7 +539,7 @@ void BKE_paint_init(Scene *sce, ePaintMode mode, const char col[3])
/* If there's no brush, create one */
brush = BKE_paint_brush(paint);
if (brush == NULL) {
short ob_mode = BKE_paint_object_mode_from_paint_mode(mode);
eObjectMode ob_mode = BKE_paint_object_mode_from_paint_mode(mode);
brush = BKE_brush_first_search(G.main, ob_mode);
if (!brush) {

View File

@@ -75,6 +75,8 @@ typedef enum eEvaluationMode {
DAG_EVAL_RENDER = 2, /* evaluate for render purposes */
} eEvaluationMode;
#include "DNA_object_enums.h"
/* Dependency graph evaluation context
*
* This structure stores all the local dependency graph data,
@@ -83,7 +85,7 @@ typedef enum eEvaluationMode {
typedef struct EvaluationContext {
eEvaluationMode mode;
float ctime;
short object_mode;
eObjectMode object_mode;
struct Depsgraph *depsgraph;
struct ViewLayer *view_layer;
@@ -219,7 +221,7 @@ void DEG_evaluation_context_init_from_scene(
struct Scene *scene,
struct ViewLayer *view_layer,
struct RenderEngineType *engine_type,
const short object_mode,
const eObjectMode object_mode,
eEvaluationMode mode);
/* Free evaluation context. */

View File

@@ -81,7 +81,7 @@ void DEG_evaluation_context_init_from_scene(
Scene *scene,
ViewLayer *view_layer,
RenderEngineType *engine_type,
short object_mode,
eObjectMode object_mode,
eEvaluationMode mode)
{
DEG_evaluation_context_init(eval_ctx, mode);

View File

@@ -26,6 +26,8 @@
#ifndef __DRW_ENGINE_H__
#define __DRW_ENGINE_H__
#include "BLI_sys_types.h" /* for bool */
struct ARegion;
struct CollectionEngineSettings;
struct Depsgraph;
@@ -50,7 +52,7 @@ struct RenderEngine;
struct RenderEngineType;
struct WorkSpace;
#include "BLI_sys_types.h" /* for bool */
#include "DNA_object_enums.h"
/* Buffer and textures used by the viewport by default */
typedef struct DefaultFramebufferList {
@@ -91,25 +93,25 @@ void DRW_draw_view(const struct bContext *C);
void DRW_draw_render_loop_ex(
struct Depsgraph *depsgraph,
struct RenderEngineType *engine_type,
struct ARegion *ar, struct View3D *v3d, const short object_mode,
struct ARegion *ar, struct View3D *v3d, const eObjectMode object_mode,
const struct bContext *evil_C);
void DRW_draw_render_loop(
struct Depsgraph *depsgraph,
struct ARegion *ar, struct View3D *v3d, const short object_mode);
struct ARegion *ar, struct View3D *v3d, const eObjectMode object_mode);
void DRW_draw_render_loop_offscreen(
struct Depsgraph *depsgraph,
struct RenderEngineType *engine_type,
struct ARegion *ar, struct View3D *v3d, const short object_mode,
struct ARegion *ar, struct View3D *v3d, const eObjectMode object_mode,
const bool draw_background,
struct GPUOffScreen *ofs,
struct GPUViewport *viewport);
void DRW_draw_select_loop(
struct Depsgraph *depsgraph,
struct ARegion *ar, struct View3D *v3d, const short object_mode,
struct ARegion *ar, struct View3D *v3d, const eObjectMode object_mode,
bool use_obedit_skip, bool use_nearest, const struct rcti *rect);
void DRW_draw_depth_loop(
struct Depsgraph *depsgraph,
struct ARegion *ar, struct View3D *v3d, const short object_mode);
struct ARegion *ar, struct View3D *v3d, const eObjectMode object_mode);
/* This is here because GPUViewport needs it */
void DRW_pass_free(struct DRWPass *pass);

View File

@@ -470,7 +470,7 @@ typedef struct DRWContextState {
struct Depsgraph *depsgraph;
short object_mode;
eObjectMode object_mode;
/* Last resort (some functions take this as an arg so we can't easily avoid).
* May be NULL when used for selection or depth buffer. */

View File

@@ -3420,7 +3420,7 @@ void DRW_draw_view(const bContext *C)
void DRW_draw_render_loop_ex(
struct Depsgraph *depsgraph,
RenderEngineType *engine_type,
ARegion *ar, View3D *v3d, const short object_mode,
ARegion *ar, View3D *v3d, const eObjectMode object_mode,
const bContext *evil_C)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
@@ -3545,7 +3545,7 @@ void DRW_draw_render_loop_ex(
void DRW_draw_render_loop(
struct Depsgraph *depsgraph,
ARegion *ar, View3D *v3d, const short object_mode)
ARegion *ar, View3D *v3d, const eObjectMode object_mode)
{
/* Reset before using it. */
memset(&DST, 0x0, sizeof(DST));
@@ -3559,7 +3559,7 @@ void DRW_draw_render_loop(
/* @viewport CAN be NULL, in this case we create one. */
void DRW_draw_render_loop_offscreen(
struct Depsgraph *depsgraph, RenderEngineType *engine_type,
ARegion *ar, View3D *v3d, const short object_mode,
ARegion *ar, View3D *v3d, const eObjectMode object_mode,
const bool draw_background, GPUOffScreen *ofs,
GPUViewport *viewport)
{
@@ -3684,7 +3684,7 @@ void DRW_render_object_iter(
*/
void DRW_draw_select_loop(
struct Depsgraph *depsgraph,
ARegion *ar, View3D *v3d, const short object_mode,
ARegion *ar, View3D *v3d, const eObjectMode object_mode,
bool UNUSED(use_obedit_skip), bool UNUSED(use_nearest), const rcti *rect)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
@@ -3806,7 +3806,7 @@ void DRW_draw_select_loop(
*/
void DRW_draw_depth_loop(
Depsgraph *depsgraph,
ARegion *ar, View3D *v3d, const short object_mode)
ARegion *ar, View3D *v3d, const eObjectMode object_mode)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
RenderEngineType *engine_type = RE_engines_find(scene->view_render.engine_id);

View File

@@ -365,7 +365,7 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats)
}
}
static bool stats_is_object_dynamic_topology_sculpt(Object *ob, short object_mode)
static bool stats_is_object_dynamic_topology_sculpt(Object *ob, const eObjectMode object_mode)
{
return (ob &&
(object_mode & OB_MODE_SCULPT) &&
@@ -373,7 +373,7 @@ static bool stats_is_object_dynamic_topology_sculpt(Object *ob, short object_mod
}
/* Statistics displayed in info header. Called regularly on scene changes. */
static void stats_update(Scene *scene, ViewLayer *view_layer, const short object_mode)
static void stats_update(Scene *scene, ViewLayer *view_layer, const eObjectMode object_mode)
{
SceneStats stats = {0};
Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL;
@@ -406,7 +406,7 @@ static void stats_update(Scene *scene, ViewLayer *view_layer, const short object
*(view_layer->stats) = stats;
}
static void stats_string(Scene *scene, ViewLayer *view_layer, const short object_mode)
static void stats_string(Scene *scene, ViewLayer *view_layer, const eObjectMode object_mode)
{
#define MAX_INFO_MEM_LEN 64
SceneStats *stats = view_layer->stats;

View File

@@ -68,6 +68,8 @@ struct EditBone;
struct RenderEngineType;
struct SnapObjectContext;
#include "DNA_object_enums.h"
/* transinfo->redraw */
typedef enum {
TREDRAW_NOTHING = 0,
@@ -653,7 +655,7 @@ void restoreBones(TransInfo *t);
#define MANIPULATOR_AXIS_LINE_WIDTH 2.0f
/* return 0 when no gimbal for selection */
bool gimbal_axis(struct Object *ob, float gmat[3][3], const short object_mode);
bool gimbal_axis(struct Object *ob, float gmat[3][3], const eObjectMode object_mode);
/*********************** TransData Creation and General Handling *********** */
void createTransData(struct bContext *C, TransInfo *t);

View File

@@ -520,7 +520,7 @@ static bool test_rotmode_euler(short rotmode)
return (ELEM(rotmode, ROT_MODE_AXISANGLE, ROT_MODE_QUAT)) ? 0 : 1;
}
bool gimbal_axis(Object *ob, float gmat[3][3], const short object_mode)
bool gimbal_axis(Object *ob, float gmat[3][3], const eObjectMode object_mode)
{
if (object_mode & OB_MODE_POSE) {
bPoseChannel *pchan = BKE_pose_channel_active(ob);

View File

@@ -48,6 +48,8 @@ struct SmokeModifierData;
struct DupliObject;
struct EvaluationContext;
#include "DNA_object_enums.h"
/* OpenGL drawing functions related to shading. These are also
* shared with the game engine, where there were previously
* duplicates of some of these functions. */
@@ -77,7 +79,7 @@ void GPU_disable_program_point_size(void);
void GPU_begin_object_materials(
struct View3D *v3d, struct RegionView3D *rv3d,
struct Scene *scene, struct ViewLayer *view_layer,
struct Object *ob, bool glsl, const short object_mode, bool *do_alpha_after);
struct Object *ob, bool glsl, const eObjectMode object_mode, bool *do_alpha_after);
void GPU_end_object_materials(void);
bool GPU_object_materials_check(void);

View File

@@ -1460,7 +1460,7 @@ static struct GPUMaterialState {
Material *gmatbuf_fixed[FIXEDMAT];
Material *gboundmat;
Object *gob;
short gob_object_mode;
eObjectMode gob_object_mode;
DupliObject *dob;
Scene *gscene;
int glay;
@@ -1555,7 +1555,7 @@ void GPU_end_dupli_object(void)
void GPU_begin_object_materials(
View3D *v3d, RegionView3D *rv3d, Scene *scene, ViewLayer *view_layer, Object *ob,
bool glsl, const short object_mode, bool *do_alpha_after)
bool glsl, const eObjectMode object_mode, bool *do_alpha_after)
{
Material *ma;
GPUMaterial *gpumat;