diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-10-18 20:15:06 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-10-18 20:31:00 +0300 |
commit | 69b4c9f6e5ea3ececde73ba8d6199e6ce797d956 (patch) | |
tree | 08c11598948db7289d02b666e22a9ba8391784fa /source/blender | |
parent | c470620c169953e5c45ce3221d7f3dc3638814b9 (diff) | |
parent | 32145c4a88f9b4947e22e51b9f17459fe6eacd79 (diff) |
Merge branch 'blender2.8' into topbar
Diffstat (limited to 'source/blender')
346 files changed, 4457 insertions, 3491 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 7c2873046d5..e7af7400850 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -27,13 +27,14 @@ * General operations for brushes. */ +enum eCurveMappingPreset; struct Brush; struct ImBuf; struct ImagePool; struct Main; struct Scene; struct UnifiedPaintSettings; -// enum CurveMappingPreset; +// enum eCurveMappingPreset; /* globals for brush execution */ @@ -68,7 +69,7 @@ void BKE_brush_jitter_pos( void BKE_brush_randomize_texture_coords(struct UnifiedPaintSettings *ups, bool mask); /* brush curve */ -void BKE_brush_curve_preset(struct Brush *b, int preset); +void BKE_brush_curve_preset(struct Brush *b, enum eCurveMappingPreset preset); float BKE_brush_curve_strength_clamped(struct Brush *br, float p, const float len); float BKE_brush_curve_strength(const struct Brush *br, float p, const float len); diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 9eb4943528f..6530f3a60d2 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -54,6 +54,7 @@ struct SceneLayer; struct ScrArea; struct SpaceLink; struct View3D; +struct ViewRender; struct RegionView3D; struct StructRNA; struct ToolSettings; @@ -69,6 +70,7 @@ struct bGPDpalettecolor; struct bGPDbrush; struct wmWindow; struct wmWindowManager; +struct RenderEngineType; struct SpaceText; struct SpaceImage; struct SpaceClip; @@ -252,6 +254,8 @@ struct Scene *CTX_data_scene(const bContext *C); struct LayerCollection *CTX_data_layer_collection(const bContext *C); struct SceneCollection *CTX_data_scene_collection(const bContext *C); struct SceneLayer *CTX_data_scene_layer(const bContext *C); +struct ViewRender *CTX_data_view_render(const bContext *C); +struct RenderEngineType *CTX_data_engine(const bContext *C); struct ToolSettings *CTX_data_tool_settings(const bContext *C); const char *CTX_data_mode_string(const bContext *C); diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index b38f1299763..09f5ecce050 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -188,7 +188,7 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type); /* ---------------------- */ -struct FModifier *add_fmodifier(ListBase *modifiers, int type); +struct FModifier *add_fmodifier(ListBase *modifiers, int type, struct FCurve *owner_fcu); struct FModifier *copy_fmodifier(const struct FModifier *src); void copy_fmodifiers(ListBase *dst, const ListBase *src); bool remove_fmodifier(ListBase *modifiers, struct FModifier *fcm); @@ -266,6 +266,9 @@ bool fcurve_are_keyframes_usable(struct FCurve *fcu); bool fcurve_is_keyframable(struct FCurve *fcu); bool BKE_fcurve_is_protected(struct FCurve *fcu); +/* The curve is an infinite cycle via Cycles modifier */ +bool BKE_fcurve_is_cyclic(struct FCurve *fcu); + /* -------- Curve Sanity -------- */ void calchandles_fcurve(struct FCurve *fcu); diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 52d5405ec0a..1585742729c 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -57,7 +57,7 @@ struct WorkSpace; void BKE_layer_exit(void); struct SceneLayer *BKE_scene_layer_from_scene_get(const struct Scene *scene); -struct SceneLayer *BKE_scene_layer_from_workspace_get(const struct WorkSpace *workspace); +struct SceneLayer *BKE_scene_layer_from_workspace_get(const struct Scene *scene, const struct WorkSpace *workspace); struct SceneLayer *BKE_scene_layer_add(struct Scene *scene, const char *name); /* DEPRECATED */ @@ -65,8 +65,6 @@ struct SceneLayer *BKE_scene_layer_context_active_PLACEHOLDER(const struct Scene void BKE_scene_layer_free(struct SceneLayer *sl); -void BKE_scene_layer_engine_set(struct SceneLayer *sl, const char *engine); - void BKE_scene_layer_selected_objects_tag(struct SceneLayer *sl, const int tag); struct SceneLayer *BKE_scene_layer_find_from_collection(const struct Scene *scene, struct LayerCollection *lc); @@ -167,6 +165,10 @@ void BKE_visible_objects_iterator_begin(BLI_Iterator *iter, void *data_in); void BKE_visible_objects_iterator_next(BLI_Iterator *iter); void BKE_visible_objects_iterator_end(BLI_Iterator *iter); +void BKE_renderable_objects_iterator_begin(BLI_Iterator *iter, void *data_in); +void BKE_renderable_objects_iterator_next(BLI_Iterator *iter); +void BKE_renderable_objects_iterator_end(BLI_Iterator *iter); + void BKE_selected_bases_iterator_begin(BLI_Iterator *iter, void *data_in); void BKE_selected_bases_iterator_next(BLI_Iterator *iter); void BKE_selected_bases_iterator_end(BLI_Iterator *iter); @@ -248,6 +250,29 @@ void BKE_visible_bases_iterator_end(BLI_Iterator *iter); ITER_END \ } +typedef struct ObjectsRenderableIteratorData { + struct Scene *scene; + + struct { + struct SceneLayer *scene_layer; + struct Base *base; + struct Scene *set; + } iter; +} ObjectsRenderableIteratorData; + +#define FOREACH_OBJECT_RENDERABLE(scene_, _instance) \ + ObjectsRenderableIteratorData data_ = { \ + .scene = (scene_), \ + }; \ + ITER_BEGIN(BKE_renderable_objects_iterator_begin, \ + BKE_renderable_objects_iterator_next, \ + BKE_renderable_objects_iterator_end, \ + &data_, Object *, _instance) + + +#define FOREACH_OBJECT_RENDERABLE_END \ + ITER_END + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index ea0b350b8af..fe9fb2598d0 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -74,6 +74,7 @@ struct PointerRNA; struct RenderData; struct Scene; struct Tex; +struct ViewRender; struct SpaceNode; struct ARegion; struct ColorManagedViewSettings; @@ -251,9 +252,9 @@ typedef struct bNodeType { #define NODE_CLASS_LAYOUT 100 /* nodetype->compatibility */ -#define NODE_OLD_SHADING 1 -#define NODE_NEW_SHADING 2 -#define NODE_NEWER_SHADING 3 +#define NODE_OLD_SHADING (1 << 0) +#define NODE_NEW_SHADING (1 << 1) +#define NODE_NEWER_SHADING (1 << 2) /* node resize directions */ #define NODE_RESIZE_TOP 1 @@ -282,7 +283,7 @@ typedef struct bNodeTreeType { /* callbacks */ void (*free_cache)(struct bNodeTree *ntree); void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node); - void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func); /* iteration over all node classes */ + void (*foreach_nodeclass)(struct ViewRender *view_render, void *calldata, bNodeClassCallback func); /* iteration over all node classes */ /* Check visibility in the node editor */ int (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype); /* Select a node tree from the context */ diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index f88dfc6f817..3d8f7b7674b 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -60,14 +60,14 @@ struct ImagePool; struct UnifiedPaintSettings; struct EvaluationContext; -enum OverlayFlags; +enum eOverlayFlags; extern const char PAINT_CURSOR_SCULPT[3]; extern const char PAINT_CURSOR_VERTEX_PAINT[3]; extern const char PAINT_CURSOR_WEIGHT_PAINT[3]; extern const char PAINT_CURSOR_TEXTURE_PAINT[3]; -typedef enum PaintMode { +typedef enum ePaintMode { ePaintSculpt = 0, ePaintVertex = 1, ePaintWeight = 2, @@ -75,17 +75,17 @@ typedef enum PaintMode { ePaintTexture2D = 4, ePaintSculptUV = 5, ePaintInvalid = 6 -} PaintMode; +} ePaintMode; /* overlay invalidation */ -typedef enum OverlayControlFlags { +typedef enum eOverlayControlFlags { PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY = 1, PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY = (1 << 2), PAINT_INVALID_OVERLAY_CURVE = (1 << 3), PAINT_OVERLAY_OVERRIDE_CURSOR = (1 << 4), PAINT_OVERLAY_OVERRIDE_PRIMARY = (1 << 5), PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6) -} OverlayControlFlags; +} eOverlayControlFlags; #define PAINT_OVERRIDE_MASK (PAINT_OVERLAY_OVERRIDE_SECONDARY | \ PAINT_OVERLAY_OVERRIDE_PRIMARY | \ @@ -94,9 +94,9 @@ typedef enum OverlayControlFlags { void BKE_paint_invalidate_overlay_tex(struct Scene *scene, struct SceneLayer *sl, const struct Tex *tex); void BKE_paint_invalidate_cursor_overlay(struct Scene *scene, struct SceneLayer *sl, struct CurveMapping *curve); void BKE_paint_invalidate_overlay_all(void); -OverlayControlFlags BKE_paint_get_overlay_flags(void); -void BKE_paint_reset_overlay_invalid(OverlayControlFlags flag); -void BKE_paint_set_overlay_override(enum OverlayFlags flag); +eOverlayControlFlags BKE_paint_get_overlay_flags(void); +void BKE_paint_reset_overlay_invalid(eOverlayControlFlags flag); +void BKE_paint_set_overlay_override(enum eOverlayFlags flag); /* palettes */ void BKE_palette_free(struct Palette *palette); @@ -118,17 +118,17 @@ void BKE_paint_curve_copy_data( struct PaintCurve *BKE_paint_curve_copy(struct Main *bmain, const struct PaintCurve *pc); void BKE_paint_curve_make_local(struct Main *bmain, struct PaintCurve *pc, const bool lib_local); -void BKE_paint_init(struct Scene *sce, PaintMode mode, const char col[3]); +void BKE_paint_init(struct Scene *sce, ePaintMode mode, const char col[3]); void BKE_paint_free(struct Paint *p); 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(PaintMode mode); -struct Paint *BKE_paint_get_active_from_paintmode(struct Scene *sce, PaintMode mode); +short 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 SceneLayer *sl); struct Paint *BKE_paint_get_active_from_context(const struct bContext *C); -PaintMode BKE_paintmode_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); void BKE_paint_brush_set(struct Paint *paint, struct Brush *br); struct Palette *BKE_paint_palette(struct Paint *paint); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index f0819c8d79d..48fe8423233 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -90,6 +90,7 @@ struct ParticleKey; struct ParticleSystem; struct PointCache; struct Scene; +struct SceneLayer; struct SmokeModifierData; struct SoftBody; struct RigidBodyWorld; @@ -186,6 +187,7 @@ typedef struct PTCacheID { typedef struct PTCacheBaker { struct Main *main; struct Scene *scene; + struct SceneLayer *scene_layer; int bake; int render; int anim_init; @@ -319,7 +321,7 @@ struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, const st /********************** Baking *********************/ /* Bakes cache with cache_step sized jumps in time, not accurate but very fast. */ -void BKE_ptcache_quick_cache_all(struct Main *bmain, struct Scene *scene); +void BKE_ptcache_quick_cache_all(struct Main *bmain, struct Scene *scene, struct SceneLayer *scene_layer); /* Bake cache or simulate to current frame with settings defined in the baker. */ void BKE_ptcache_bake(struct PTCacheBaker *baker); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index e517b65cf3e..b31cd1742a2 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -50,7 +50,8 @@ struct Scene; struct SceneCollection; struct SceneLayer; struct UnitSettings; -struct Main; +struct ViewRender; +struct WorkSpace; typedef enum eSceneCopyMethod { SCE_COPY_NEW = 0, @@ -62,11 +63,21 @@ typedef enum eSceneCopyMethod { /* Use as the contents of a 'for' loop: for (SETLOOPER(...)) { ... */ #define SETLOOPER(_sce_basis, _sce_iter, _base) \ - _sce_iter = _sce_basis, _base = _setlooper_base_step(&_sce_iter, NULL); \ + _sce_iter = _sce_basis, _base = _setlooper_base_step(&_sce_iter, BKE_scene_layer_from_scene_get(_sce_basis), NULL); \ + _base; \ + _base = _setlooper_base_step(&_sce_iter, NULL, _base) + +#define SETLOOPER_SCENE_LAYER(_sce_basis, _scene_layer, _sce_iter, _base) \ + _sce_iter = _sce_basis, _base = _setlooper_base_step(&_sce_iter, _scene_layer, NULL); \ _base; \ - _base = _setlooper_base_step(&_sce_iter, _base) + _base = _setlooper_base_step(&_sce_iter, NULL, _base) -struct Base *_setlooper_base_step(struct Scene **sce_iter, struct Base *base); +#define SETLOOPER_SET_ONLY(_sce_basis, _sce_iter, _base) \ + _sce_iter = _sce_basis, _base = _setlooper_base_step(&_sce_iter, NULL, NULL); \ + _base; \ + _base = _setlooper_base_step(&_sce_iter, NULL, _base) + +struct Base *_setlooper_base_step(struct Scene **sce_iter, struct SceneLayer *scene_layer, struct Base *base); void free_avicodecdata(struct AviCodecData *acd); @@ -168,6 +179,22 @@ int BKE_render_num_threads(const struct RenderData *r); int BKE_render_preview_pixel_size(const struct RenderData *r); +/**********************************/ + +struct ViewRender *BKE_viewrender_get(struct Scene *scene, struct WorkSpace *workspace); +void BKE_viewrender_init(struct ViewRender *view_render); +void BKE_viewrender_free(struct ViewRender *view_render); +void BKE_viewrender_copy(struct ViewRender *view_render_dst, const struct ViewRender *view_render_src); +bool BKE_viewrender_use_new_shading_nodes(const struct ViewRender *view_render); +bool BKE_viewrender_use_shading_nodes_custom(const struct ViewRender *view_render); +bool BKE_viewrender_use_world_space_shading(const struct ViewRender *view_render); +bool BKE_viewrender_use_spherical_stereo(const struct ViewRender *view_render); +bool BKE_viewrender_uses_blender_internal(const struct ViewRender *view_render); +bool BKE_viewrender_uses_blender_game(const struct ViewRender *view_render); +bool BKE_viewrender_uses_blender_eevee(const struct ViewRender *view_render); + +/**********************************/ + double BKE_scene_unit_scale(const struct UnitSettings *unit, const int unit_type, double value); /* multiview */ diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 853bda6a087..fb6d8e7c75e 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -86,7 +86,8 @@ typedef struct SpaceType { void (*exit)(struct wmWindowManager *, struct ScrArea *); /* Listeners can react to bContext changes */ void (*listener)(struct bScreen *sc, struct ScrArea *, - struct wmNotifier *, const struct Scene *scene); + struct wmNotifier *, struct Scene *scene, + struct WorkSpace *workspace); /* refresh context, called after filereads, ED_area_tag_refresh() */ void (*refresh)(const struct bContext *, struct ScrArea *); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index bcc06a4ab25..dfb6b47a4e4 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -422,7 +422,8 @@ struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C, ListBase *seq /* view3d draw callback, run when not in background view */ typedef struct ImBuf *(*SequencerDrawView)( - const struct EvaluationContext *eval_ctx, struct Scene *, struct SceneLayer *sl, struct Object *, int, int, + const struct EvaluationContext *eval_ctx, struct Scene *, + struct SceneLayer *sl, struct Object *, int, int, unsigned int, int, bool, bool, bool, int, int, bool, const char *, struct GPUFX *, struct GPUOffScreen *, char[256]); diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index 43962c2eb35..bff40d7c85b 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -95,9 +95,9 @@ void BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *h struct bScreen *BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS; void BKE_workspace_active_screen_set( struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct bScreen *screen) SETTER_ATTRS; -enum ObjectMode BKE_workspace_object_mode_get(const struct WorkSpace *workspace) GETTER_ATTRS; +enum eObjectMode BKE_workspace_object_mode_get(const struct WorkSpace *workspace) GETTER_ATTRS; #ifdef USE_WORKSPACE_MODE -void BKE_workspace_object_mode_set(struct WorkSpace *workspace, const enum ObjectMode mode) SETTER_ATTRS; +void BKE_workspace_object_mode_set(struct WorkSpace *workspace, const enum eObjectMode mode) SETTER_ATTRS; #endif struct ListBase *BKE_workspace_transform_orientations_get(struct WorkSpace *workspace) GETTER_ATTRS; struct SceneLayer *BKE_workspace_render_layer_get(const struct WorkSpace *workspace) GETTER_ATTRS; @@ -115,6 +115,12 @@ struct WorkSpaceLayout *BKE_workspace_hook_layout_for_workspace_get( void BKE_workspace_hook_layout_for_workspace_set( struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL(); +struct ViewRender *BKE_workspace_view_render_get(struct WorkSpace *workspace) GETTER_ATTRS; + +/* flags */ +bool BKE_workspace_use_scene_settings_get(const struct WorkSpace *workspace) GETTER_ATTRS; +void BKE_workspace_use_scene_settings_set(struct WorkSpace *workspace, bool value) SETTER_ATTRS; + #undef GETTER_ATTRS #undef SETTER_ATTRS diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index dad862b87e7..b2883735343 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -541,8 +541,4 @@ endif() # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") #endif() -if(WITH_DEPSGRAPH_COPY_ON_WRITE) - add_definitions(-DWITH_COPY_ON_WRITE) -endif() - blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c index 9c86a22a1f8..c26112d3724 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_opensubdiv.c @@ -282,6 +282,7 @@ bool ccgSubSurf_prepareGLMesh(CCGSubSurf *ss, sizeof(GLfloat) * 6, (float *)12); glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindVertexArray(0); } else if (ss->osd_coarse_coords_invalid) { ccgSubSurf__updateGLMeshCoords(ss); @@ -299,6 +300,7 @@ void ccgSubSurf_drawGLMesh(CCGSubSurf *ss, bool fill_quads, int start_partition, int num_partitions) { if (LIKELY(ss->osd_mesh != NULL)) { + glBindVertexArray(ss->osd_vao); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, openSubdiv_getOsdGLMeshPatchIndexBuffer(ss->osd_mesh)); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index aeaead578a1..c36c6c56d5e 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -438,9 +438,8 @@ void BKE_brush_sculpt_reset(Brush *br) /** * Library Operations - * \param preset CurveMappingPreset */ -void BKE_brush_curve_preset(Brush *b, int preset) +void BKE_brush_curve_preset(Brush *b, eCurveMappingPreset preset) { CurveMap *cm = NULL; diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index acb48a9646f..bc50fdd5a11 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -47,6 +47,7 @@ #include "BKE_cloth.h" #include "BKE_effect.h" +#include "BKE_layer.h" #include "BKE_modifier.h" #include "BKE_scene.h" diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index d7afdc951a7..3462c8e411c 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -57,6 +57,8 @@ #include "BKE_sound.h" #include "BKE_workspace.h" +#include "RE_engine.h" + #include "RNA_access.h" #ifdef WITH_PYTHON @@ -935,10 +937,36 @@ SceneLayer *CTX_data_scene_layer(const bContext *C) return sl; } else { - return BKE_scene_layer_from_workspace_get(CTX_wm_workspace(C)); + return BKE_scene_layer_from_workspace_get(CTX_data_scene(C), CTX_wm_workspace(C)); + } +} + +ViewRender *CTX_data_view_render(const bContext *C) +{ + ViewRender *view_render; + + if (ctx_data_pointer_verify(C, "view_render", (void *)&view_render)) { + return view_render; + } + else { + Scene *scene = CTX_data_scene(C); + WorkSpace *workspace = CTX_wm_workspace(C); + return BKE_viewrender_get(scene, workspace); } } +RenderEngineType *CTX_data_engine(const bContext *C) +{ + const char *engine_id; + + if (!ctx_data_pointer_verify(C, "engine", (void *)&engine_id)) { + ViewRender *view_render = CTX_data_view_render(C); + engine_id = view_render->engine_id; + } + + return RE_engines_find(engine_id); +} + /** * This is tricky. Sometimes the user overrides the render_layer * but not the scene_collection. In this case what to do? @@ -1255,7 +1283,8 @@ void CTX_data_eval_ctx(const bContext *C, EvaluationContext *eval_ctx) Scene *scene = CTX_data_scene(C); SceneLayer *scene_layer = CTX_data_scene_layer(C); + RenderEngineType *engine = CTX_data_engine(C); DEG_evaluation_context_init_from_scene(eval_ctx, - scene, scene_layer, + scene, scene_layer, engine, DAG_EVAL_VIEWPORT); } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 5fbaae7212b..a93bda215a0 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -745,7 +745,7 @@ BezTriple *BKE_nurb_bezt_get_prev(Nurb *nu, BezTriple *bezt) BezTriple *bezt_prev; BLI_assert(ARRAY_HAS_ITEM(bezt, nu->bezt, nu->pntsu)); - BLI_assert(nu->pntsv == 1); + BLI_assert(nu->pntsv <= 1); if (bezt == nu->bezt) { if (nu->flagu & CU_NURB_CYCLIC) { @@ -4144,6 +4144,7 @@ bool BKE_nurb_type_convert(Nurb *nu, const short type, const bool use_handles) MEM_freeN(nu->bp); nu->bp = NULL; nu->pntsu = nr; + nu->pntsv = 0; nu->type = CU_BEZIER; BKE_nurb_handles_calc(nu); } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index db6c533ab57..103f23a2c18 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -86,12 +86,11 @@ void free_fcurve(FCurve *fcu) return; /* free curve data */ - if (fcu->bezt) MEM_freeN(fcu->bezt); - if (fcu->fpt) MEM_freeN(fcu->fpt); + MEM_SAFE_FREE(fcu->bezt); + MEM_SAFE_FREE(fcu->fpt); /* free RNA-path, as this were allocated when getting the path string */ - if (fcu->rna_path) - MEM_freeN(fcu->rna_path); + MEM_SAFE_FREE(fcu->rna_path); /* free extra data - i.e. modifiers, and driver */ fcurve_free_driver(fcu); @@ -882,6 +881,46 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample * that the handles are correctly */ +/* Checks if the F-Curve has a Cycles modifier with simple settings that warrant transition smoothing */ +bool BKE_fcurve_is_cyclic(FCurve *fcu) +{ + FModifier *fcm = fcu->modifiers.first; + + if (!fcm || fcm->type != FMODIFIER_TYPE_CYCLES) + return false; + + if (fcm->flag & (FMODIFIER_FLAG_DISABLED | FMODIFIER_FLAG_MUTED)) + return false; + + if (fcm->flag & (FMODIFIER_FLAG_RANGERESTRICT | FMODIFIER_FLAG_USEINFLUENCE)) + return false; + + FMod_Cycles *data = (FMod_Cycles*)fcm->data; + + return data && data->after_cycles == 0 && data->before_cycles == 0 && + ELEM(data->before_mode, FCM_EXTRAPOLATE_CYCLIC, FCM_EXTRAPOLATE_CYCLIC_OFFSET) && + ELEM(data->after_mode, FCM_EXTRAPOLATE_CYCLIC, FCM_EXTRAPOLATE_CYCLIC_OFFSET); +} + +/* Shifts 'in' by the difference in coordinates between 'to' and 'from', using 'out' as the output buffer. + * When 'to' and 'from' are end points of the loop, this moves the 'in' point one loop cycle. + */ +static BezTriple *cycle_offset_triple(bool cycle, BezTriple *out, const BezTriple *in, const BezTriple *from, const BezTriple *to) +{ + if (!cycle) + return NULL; + + memcpy(out, in, sizeof(BezTriple)); + + float delta[3]; + sub_v3_v3v3(delta, to->vec[1], from->vec[1]); + + for (int i = 0; i < 3; i++) + add_v3_v3(out->vec[i], delta); + + return out; +} + /* This function recalculates the handles of an F-Curve * If the BezTriples have been rearranged, sort them first before using this. */ @@ -897,10 +936,16 @@ void calchandles_fcurve(FCurve *fcu) */ if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN)*/) return; - + + /* if the first modifier is Cycles, smooth the curve through the cycle */ + BezTriple *first = &fcu->bezt[0], *last = &fcu->bezt[fcu->totvert-1]; + BezTriple tmp; + + bool cycle = BKE_fcurve_is_cyclic(fcu) && BEZT_IS_AUTOH(first) && BEZT_IS_AUTOH(last); + /* get initial pointers */ bezt = fcu->bezt; - prev = NULL; + prev = cycle_offset_triple(cycle, &tmp, &fcu->bezt[fcu->totvert-2], last, first); next = (bezt + 1); /* loop over all beztriples, adjusting handles */ @@ -913,7 +958,7 @@ void calchandles_fcurve(FCurve *fcu) BKE_nurb_handle_calc(bezt, prev, next, true); /* for automatic ease in and out */ - if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) { + if (BEZT_IS_AUTOH(bezt) && !cycle) { /* only do this on first or last beztriple */ if ((a == 0) || (a == fcu->totvert - 1)) { /* set both handles to have same horizontal value as keyframe */ @@ -925,8 +970,14 @@ void calchandles_fcurve(FCurve *fcu) /* advance pointers for next iteration */ prev = bezt; - if (a == 1) next = NULL; - else next++; + + if (a == 1) { + next = cycle_offset_triple(cycle, &tmp, &fcu->bezt[1], first, last); + } + else { + next++; + } + bezt++; } } diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index f1732ee7a9a..f1834bdf8a6 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -1077,7 +1077,7 @@ const FModifierTypeInfo *fmodifier_get_typeinfo(const FModifier *fcm) /* API --------------------------- */ /* Add a new F-Curve Modifier to the given F-Curve of a certain type */ -FModifier *add_fmodifier(ListBase *modifiers, int type) +FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu) { const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type); FModifier *fcm; @@ -1098,6 +1098,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type) fcm = MEM_callocN(sizeof(FModifier), "F-Curve Modifier"); fcm->type = type; fcm->flag = FMODIFIER_FLAG_EXPANDED; + fcm->curve = owner_fcu; fcm->influence = 1.0f; BLI_addtail(modifiers, fcm); @@ -1111,6 +1112,10 @@ FModifier *add_fmodifier(ListBase *modifiers, int type) /* init custom settings if necessary */ if (fmi->new_data) fmi->new_data(fcm->data); + + /* update the fcurve if the Cycles modifier is added */ + if ((owner_fcu) && (type == FMODIFIER_TYPE_CYCLES)) + calchandles_fcurve(owner_fcu); /* return modifier for further editing */ return fcm; @@ -1129,6 +1134,7 @@ FModifier *copy_fmodifier(const FModifier *src) /* copy the base data, clearing the links */ dst = MEM_dupallocN(src); dst->next = dst->prev = NULL; + dst->curve = NULL; /* make a new copy of the F-Modifier's data */ dst->data = MEM_dupallocN(src->data); @@ -1157,6 +1163,7 @@ void copy_fmodifiers(ListBase *dst, const ListBase *src) /* make a new copy of the F-Modifier's data */ fcm->data = MEM_dupallocN(fcm->data); + fcm->curve = NULL; /* only do specific constraints if required */ if (fmi && fmi->copy_data) @@ -1173,6 +1180,9 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm) if (fcm == NULL) return false; + /* removing the cycles modifier requires a handle update */ + FCurve *update_fcu = (fcm->type == FMODIFIER_TYPE_CYCLES) ? fcm->curve : NULL; + /* free modifier's special data (stored inside fcm->data) */ if (fcm->data) { if (fmi && fmi->free_data) @@ -1185,6 +1195,11 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm) /* remove modifier from stack */ if (modifiers) { BLI_freelinkN(modifiers, fcm); + + /* update the fcurve if the Cycles modifier is removed */ + if (update_fcu) + calchandles_fcurve(update_fcu); + return true; } else { diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index f3a85dcee2b..90247441631 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1192,7 +1192,7 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i /* Add a new FModifier (Cyclic) instead of setting extend value * as that's the new equivalent of that option. */ - FModifier *fcm = add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES); + FModifier *fcm = add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, fcu); FMod_Cycles *data = (FMod_Cycles *)fcm->data; /* if 'offset' one is in use, set appropriate settings */ diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index f20b96b8bc7..0e0290414a4 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -82,9 +82,14 @@ SceneLayer *BKE_scene_layer_from_scene_get(const Scene *scene) /** * Returns the SceneLayer to be used for drawing, outliner, and other context related areas. */ -SceneLayer *BKE_scene_layer_from_workspace_get(const struct WorkSpace *workspace) +SceneLayer *BKE_scene_layer_from_workspace_get(const struct Scene *scene, const struct WorkSpace *workspace) { - return BKE_workspace_render_layer_get(workspace); + if (BKE_workspace_use_scene_settings_get(workspace)) { + return BKE_scene_layer_from_scene_get(scene); + } + else { + return BKE_workspace_render_layer_get(workspace); + } } /** @@ -171,14 +176,6 @@ void BKE_scene_layer_free(SceneLayer *sl) } /** - * Set the render engine of a renderlayer - */ -void BKE_scene_layer_engine_set(SceneLayer *sl, const char *engine) -{ - BLI_strncpy_utf8(sl->engine, engine, sizeof(sl->engine)); -} - -/** * Tag all the selected objects of a renderlayer */ void BKE_scene_layer_selected_objects_tag(SceneLayer *sl, const int tag) @@ -1781,6 +1778,89 @@ void BKE_visible_bases_iterator_end(BLI_Iterator *UNUSED(iter)) /* do nothing */ } +void BKE_renderable_objects_iterator_begin(BLI_Iterator *iter, void *data_in) +{ + ObjectsRenderableIteratorData *data = data_in; + + for (Scene *scene = data->scene; scene; scene = scene->set) { + for (SceneLayer *sl = scene->render_layers.first; sl; sl = sl->next) { + for (Base *base = sl->object_bases.first; base; base = base->next) { + base->object->id.flag |= LIB_TAG_DOIT; + } + } + } + + SceneLayer *scene_layer = data->scene->render_layers.first; + data->iter.scene_layer = scene_layer; + + Base base = {(Base *)scene_layer->object_bases.first, NULL}; + data->iter.base = &base; + + data->iter.set = NULL; + + iter->data = data_in; + BKE_renderable_objects_iterator_next(iter); +} + +void BKE_renderable_objects_iterator_next(BLI_Iterator *iter) +{ + ObjectsRenderableIteratorData *data = iter->data; + Base *base = data->iter.base->next; + + /* There is still a base in the current scene layer. */ + if (base != NULL) { + Object *ob = base->object; + + iter->current = ob; + data->iter.base = base; + + if ((base->flag & BASE_VISIBLED) == 0) { + BKE_renderable_objects_iterator_next(iter); + } + return; + } + + /* Time to go to the next scene layer. */ + if (data->iter.set == NULL) { + while ((data->iter.scene_layer = data->iter.scene_layer->next)) { + SceneLayer *scene_layer = data->iter.scene_layer; + if (scene_layer->flag & SCENE_LAYER_RENDER) { + + Base base_iter = {(Base *)scene_layer->object_bases.first, NULL}; + data->iter.base = &base_iter; + + BKE_renderable_objects_iterator_next(iter); + return; + } + } + + /* Setup the "set" for the next iteration. */ + Scene scene = {.set = data->scene}; + data->iter.set = &scene; + BKE_renderable_objects_iterator_next(iter); + return; + } + + /* Look for an object in the next set. */ + while ((data->iter.set = data->iter.set->set)) { + SceneLayer *scene_layer = BKE_scene_layer_from_scene_get(data->iter.set); + + Base base_iter = {(Base *)scene_layer->object_bases.first, NULL}; + data->iter.base = &base_iter; + + BKE_renderable_objects_iterator_next(iter); + return; + } + + iter->current = NULL; + iter->valid = false; +} + +void BKE_renderable_objects_iterator_end(BLI_Iterator *UNUSED(iter)) +{ + /* Do nothing - iter->data was static allocated, we can't free it. */ +} + /* Evaluation */ /** diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 71fbb3d726a..f929672e830 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -524,7 +524,7 @@ static int id_copy_libmanagement_cb(void *user_data, ID *UNUSED(id_self), ID **i * * \note Usercount of new copy is always set to 1. * - * \param bmain Main database, may be NULL only if LIB_ID_COPY_NO_MAIN is specified. + * \param bmain Main database, may be NULL only if LIB_ID_CREATE_NO_MAIN is specified. * \param id Source datablock. * \param r_newid Pointer to new (copied) ID pointer. * \param flag Set of copy options, see DNA_ID.h enum for details (leave to zero for default, full copy). @@ -538,7 +538,7 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con ID_IP /* Deprecated */ BLI_assert(test || (r_newid != NULL)); - if (r_newid != NULL) { + if (r_newid != NULL && (flag & LIB_ID_CREATE_NO_ALLOCATE) == 0) { *r_newid = NULL; } if (id == NULL) { diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index c5d267ace9d..3495804f743 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -349,55 +349,55 @@ void BKE_object_eval_uber_data(const EvaluationContext *eval_ctx, break; } -#ifdef WITH_COPY_ON_WRITE - if (ob->type == OB_MESH) { - /* Quick hack to convert evaluated derivedMesh to Mesh. */ - DerivedMesh *dm = ob->derivedFinal; - if (dm != NULL) { - Mesh *mesh = (Mesh *)ob->data; - Mesh *new_mesh = BKE_libblock_alloc_notest(ID_ME); - BKE_mesh_init(new_mesh); - /* Copy ID name so GS(new_mesh->id) works correct later on. */ - BLI_strncpy(new_mesh->id.name, mesh->id.name, sizeof(new_mesh->id.name)); - /* Copy materials so render engines can access them. */ - new_mesh->mat = MEM_dupallocN(mesh->mat); - new_mesh->totcol = mesh->totcol; - DM_to_mesh(dm, new_mesh, ob, CD_MASK_MESH, true); - new_mesh->edit_btmesh = mesh->edit_btmesh; - /* Store result mesh as derived_mesh of object. This way we have - * explicit way to query final object evaluated data and know for sure - * who owns the newly created mesh datablock. - */ - ob->mesh_evaluated = new_mesh; - /* TODO(sergey): This is kind of compatibility thing, so all render - * engines can use object->data for mesh data for display. This is - * something what we might want to change in the future. - */ - ob->data = new_mesh; - /* Save some memory by throwing DerivedMesh away. */ - /* NOTE: Watch out, some tools might need it! - * So keep around for now.. - */ - /* Store original ID as a pointer in evaluated ID. - * This way we can restore original object data when we are freeing - * evaluated mesh. - */ - new_mesh->id.newid = &mesh->id; - } + if (DEG_depsgraph_use_copy_on_write()) { + if (ob->type == OB_MESH) { + /* Quick hack to convert evaluated derivedMesh to Mesh. */ + DerivedMesh *dm = ob->derivedFinal; + if (dm != NULL) { + Mesh *mesh = (Mesh *)ob->data; + Mesh *new_mesh = BKE_libblock_alloc_notest(ID_ME); + BKE_mesh_init(new_mesh); + /* Copy ID name so GS(new_mesh->id) works correct later on. */ + BLI_strncpy(new_mesh->id.name, mesh->id.name, sizeof(new_mesh->id.name)); + /* Copy materials so render engines can access them. */ + new_mesh->mat = MEM_dupallocN(mesh->mat); + new_mesh->totcol = mesh->totcol; + DM_to_mesh(dm, new_mesh, ob, CD_MASK_MESH, true); + new_mesh->edit_btmesh = mesh->edit_btmesh; + /* Store result mesh as derived_mesh of object. This way we have + * explicit way to query final object evaluated data and know for sure + * who owns the newly created mesh datablock. + */ + ob->mesh_evaluated = new_mesh; + /* TODO(sergey): This is kind of compatibility thing, so all render + * engines can use object->data for mesh data for display. This is + * something what we might want to change in the future. + */ + ob->data = new_mesh; + /* Save some memory by throwing DerivedMesh away. */ + /* NOTE: Watch out, some tools might need it! + * So keep around for now.. + */ + /* Store original ID as a pointer in evaluated ID. + * This way we can restore original object data when we are freeing + * evaluated mesh. + */ + new_mesh->id.newid = &mesh->id; + } #if 0 - if (ob->derivedFinal != NULL) { - ob->derivedFinal->needsFree = 1; - ob->derivedFinal->release(ob->derivedFinal); - ob->derivedFinal = NULL; - } - if (ob->derivedDeform != NULL) { - ob->derivedDeform->needsFree = 1; - ob->derivedDeform->release(ob->derivedDeform); - ob->derivedDeform = NULL; - } + if (ob->derivedFinal != NULL) { + ob->derivedFinal->needsFree = 1; + ob->derivedFinal->release(ob->derivedFinal); + ob->derivedFinal = NULL; + } + if (ob->derivedDeform != NULL) { + ob->derivedDeform->needsFree = 1; + ob->derivedDeform->release(ob->derivedDeform); + ob->derivedDeform = NULL; + } #endif + } } -#endif ob->recalc &= ~(OB_RECALC_DATA | OB_RECALC_TIME); } diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 7acddbbb90e..a2c59434862 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -73,7 +73,7 @@ const char PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255}; const char PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255}; const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255}; -static OverlayControlFlags overlay_flags = 0; +static eOverlayControlFlags overlay_flags = 0; void BKE_paint_invalidate_overlay_tex(Scene *scene, SceneLayer *sl, const Tex *tex) { @@ -105,12 +105,12 @@ void BKE_paint_invalidate_overlay_all(void) PAINT_INVALID_OVERLAY_CURVE); } -OverlayControlFlags BKE_paint_get_overlay_flags(void) +eOverlayControlFlags BKE_paint_get_overlay_flags(void) { return overlay_flags; } -void BKE_paint_set_overlay_override(OverlayFlags flags) +void BKE_paint_set_overlay_override(eOverlayFlags flags) { if (flags & BRUSH_OVERLAY_OVERRIDE_MASK) { if (flags & BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE) @@ -125,12 +125,12 @@ void BKE_paint_set_overlay_override(OverlayFlags flags) } } -void BKE_paint_reset_overlay_invalid(OverlayControlFlags flag) +void BKE_paint_reset_overlay_invalid(eOverlayControlFlags flag) { overlay_flags &= ~(flag); } -Paint *BKE_paint_get_active_from_paintmode(Scene *sce, PaintMode mode) +Paint *BKE_paint_get_active_from_paintmode(Scene *sce, ePaintMode mode) { if (sce) { ToolSettings *ts = sce->toolsettings; @@ -237,7 +237,7 @@ Paint *BKE_paint_get_active_from_context(const bContext *C) return NULL; } -PaintMode BKE_paintmode_get_active_from_context(const bContext *C) +ePaintMode BKE_paintmode_get_active_from_context(const bContext *C) { Scene *sce = CTX_data_scene(C); SceneLayer *sl = CTX_data_scene_layer(C); @@ -499,7 +499,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(PaintMode mode) +short BKE_paint_object_mode_from_paint_mode(ePaintMode mode) { switch (mode) { case ePaintSculpt: @@ -520,7 +520,7 @@ short BKE_paint_object_mode_from_paint_mode(PaintMode mode) } } -void BKE_paint_init(Scene *sce, PaintMode mode, const char col[3]) +void BKE_paint_init(Scene *sce, ePaintMode mode, const char col[3]) { UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings; Brush *brush; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 5ec3156f4df..35d65551483 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -3509,13 +3509,14 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, const ListBase *ptcach * every user action changing stuff, and then it runs a complete bake??? (ton) */ /* Baking */ -void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene) +void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene, SceneLayer *scene_layer) { PTCacheBaker baker; memset(&baker, 0, sizeof(baker)); baker.main = bmain; baker.scene = scene; + baker.scene_layer = scene_layer; baker.bake = 0; baker.render = 0; baker.anim_init = 0; @@ -3541,6 +3542,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) { Main *bmain = baker->main; Scene *scene = baker->scene; + SceneLayer *scene_layer = baker->scene_layer; Scene *sce_iter; /* SETLOOPER macro only */ Base *base; ListBase pidlist; @@ -3603,7 +3605,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) } } else { - for (SETLOOPER(scene, sce_iter, base)) { + for (SETLOOPER_SCENE_LAYER(scene, scene_layer, sce_iter, base)) { /* cache/bake everything in the scene */ BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR); @@ -3714,7 +3716,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) } } else { - for (SETLOOPER(scene, sce_iter, base)) { + for (SETLOOPER_SCENE_LAYER(scene, scene_layer, sce_iter, base)) { BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR); for (pid=pidlist.first; pid; pid=pid->next) { diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 6b2d809c31a..f49ba37faaa 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -49,6 +49,7 @@ #include "DNA_space_types.h" #include "DNA_view3d_types.h" #include "DNA_windowmanager_types.h" +#include "DNA_workspace_types.h" #include "DNA_gpencil_types.h" #include "BLI_math.h" @@ -905,7 +906,7 @@ void BKE_scene_init(Scene *sce) sce->r.ffcodecdata.audio_bitrate = 192; sce->r.ffcodecdata.audio_channels = 2; - BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(sce->r.engine)); + BKE_viewrender_init(&sce->view_render); sce->audio.distance_model = 2.0f; sce->audio.doppler_factor = 1.0f; @@ -1541,9 +1542,11 @@ static bool check_rendered_viewport_visible(Main *bmain) wmWindow *window; for (window = wm->windows.first; window != NULL; window = window->next) { const bScreen *screen = BKE_workspace_active_screen_get(window->workspace_hook); + WorkSpace *workspace = BKE_workspace_active_get(window->workspace_hook); Scene *scene = window->scene; + ViewRender *view_render = BKE_viewrender_get(scene, workspace); ScrArea *area; - RenderEngineType *type = RE_engines_find(scene->r.engine); + RenderEngineType *type = RE_engines_find(view_render->engine_id); if ((type->draw_engine != NULL) || (type->render_to_view == NULL)) { continue; } @@ -1833,38 +1836,32 @@ float get_render_aosss_error(const RenderData *r, float error) } /** - * Helper function for the SETLOOPER macro + * Helper function for the SETLOOPER and SETLOOPER_SCENE_LAYER macros * * It iterates over the bases of the active layer and then the bases * of the active layer of the background (set) scenes recursively. */ -Base *_setlooper_base_step(Scene **sce_iter, Base *base) +Base *_setlooper_base_step(Scene **sce_iter, SceneLayer *scene_layer, Base *base) { if (base && base->next) { - /* common case, step to the next */ + /* Common case, step to the next. */ return base->next; } - else if (base == NULL) { - /* first time looping, return the scenes first base */ - - /* for the first loop we should get the layer from context */ - SceneLayer *sl = BKE_scene_layer_context_active_PLACEHOLDER((*sce_iter)); - /* TODO For first scene (non-background set), we should pass the render layer as argument. - * In some cases we want it to be the workspace one, in other the scene one. */ - TODO_LAYER; - - if (sl->object_bases.first) { - return (Base *)sl->object_bases.first; + else if ((base == NULL) && (scene_layer != NULL)) { + /* First time looping, return the scenes first base. */ + /* For the first loop we should get the layer from workspace when available. */ + if (scene_layer->object_bases.first) { + return (Base *)scene_layer->object_bases.first; } - /* no base on this scene layer */ + /* No base on this scene layer. */ goto next_set; } else { next_set: - /* reached the end, get the next base in the set */ + /* Reached the end, get the next base in the set. */ while ((*sce_iter = (*sce_iter)->set)) { - SceneLayer *sl = BKE_scene_layer_from_scene_get((*sce_iter)); - base = (Base *)sl->object_bases.first; + SceneLayer *scene_layer_set = BKE_scene_layer_from_scene_get((*sce_iter)); + base = (Base *)scene_layer_set->object_bases.first; if (base) { return base; @@ -1877,42 +1874,39 @@ next_set: bool BKE_scene_use_new_shading_nodes(const Scene *scene) { - const RenderEngineType *type = RE_engines_find(scene->r.engine); - return (type && type->flag & RE_USE_SHADING_NODES); + return BKE_viewrender_use_new_shading_nodes(&scene->view_render); } bool BKE_scene_use_shading_nodes_custom(Scene *scene) { - RenderEngineType *type = RE_engines_find(scene->r.engine); - return (type && type->flag & RE_USE_SHADING_NODES_CUSTOM); + return BKE_viewrender_use_shading_nodes_custom(&scene->view_render); } bool BKE_scene_use_world_space_shading(Scene *scene) { - const RenderEngineType *type = RE_engines_find(scene->r.engine); + RenderEngineType *type = RE_engines_find(scene->view_render.engine_id); return ((scene->r.mode & R_USE_WS_SHADING) || (type && (type->flag & RE_USE_SHADING_NODES))); } bool BKE_scene_use_spherical_stereo(Scene *scene) { - RenderEngineType *type = RE_engines_find(scene->r.engine); - return (type && type->flag & RE_USE_SPHERICAL_STEREO); + return BKE_viewrender_use_spherical_stereo(&scene->view_render); } -bool BKE_scene_uses_blender_internal(const Scene *scene) +bool BKE_scene_uses_blender_internal(const Scene *scene) { - return STREQ(scene->r.engine, RE_engine_id_BLENDER_RENDER); + return BKE_viewrender_uses_blender_internal(&scene->view_render); } bool BKE_scene_uses_blender_game(const Scene *scene) { - return STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME); + return BKE_viewrender_uses_blender_game(&scene->view_render); } bool BKE_scene_uses_blender_eevee(const Scene *scene) { - return STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE); + return BKE_viewrender_uses_blender_eevee(&scene->view_render); } void BKE_scene_base_flag_to_objects(SceneLayer *sl) @@ -2027,6 +2021,81 @@ int BKE_render_preview_pixel_size(const RenderData *r) return r->preview_pixel_size; } +/* ***************************************************** */ +/* render engine settings */ + +ViewRender *BKE_viewrender_get(Scene *scene, WorkSpace *workspace) +{ + if (workspace == NULL || BKE_workspace_use_scene_settings_get(workspace)) { + return &scene->view_render; + } + return BKE_workspace_view_render_get(workspace); +} + +/** + * Initialize a static created struct for WorkSpace and Scene to store the viewport + * related drawing data. + */ +void BKE_viewrender_init(ViewRender *view_render) +{ + BLI_strncpy(view_render->engine_id, RE_engine_id_BLENDER_EEVEE, sizeof(view_render->engine_id)); +} + +/** + * Do not free ViewRender itself since it's not even allocated. + */ +void BKE_viewrender_free(ViewRender *UNUSED(view_render)) +{ + /* Do nothing. */ +} + +/** + * Copy used by libblock copying. + */ +void BKE_viewrender_copy(ViewRender *to, const ViewRender *from) +{ + *to = *from; +} + +bool BKE_viewrender_use_new_shading_nodes(const ViewRender *view_render) +{ + RenderEngineType *type = RE_engines_find(view_render->engine_id); + return (type && type->flag & RE_USE_SHADING_NODES); +} + +bool BKE_viewrender_use_shading_nodes_custom(const ViewRender *view_render) +{ + RenderEngineType *type = RE_engines_find(view_render->engine_id); + return (type && type->flag & RE_USE_SHADING_NODES_CUSTOM); +} + +bool BKE_viewrender_use_spherical_stereo(const ViewRender *view_render) +{ + const char *engine_id = view_render->engine_id; + RenderEngineType *type = RE_engines_find(engine_id); + return (type && type->flag & RE_USE_SPHERICAL_STEREO); +} + +bool BKE_viewrender_uses_blender_internal(const ViewRender *view_render) +{ + const char *engine_id = view_render->engine_id; + return STREQ(engine_id, RE_engine_id_BLENDER_RENDER); +} + +bool BKE_viewrender_uses_blender_game(const ViewRender *view_render) +{ + const char *engine_id = view_render->engine_id; + return STREQ(engine_id, RE_engine_id_BLENDER_GAME); +} + +bool BKE_viewrender_uses_blender_eevee(const ViewRender *view_render) +{ + const char *engine_id = view_render->engine_id; + return STREQ(engine_id, RE_engine_id_BLENDER_EEVEE); +} + +/* ***************************************************** */ + /* Apply the needed correction factor to value, based on unit_type (only length-related are affected currently) * and unit->scale_length. */ diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index a2568707b0a..6cf310461c1 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -806,13 +806,76 @@ void BKE_sound_read_waveform(bSound *sound, short *stop) BLI_spin_unlock(sound->spinlock); } -void BKE_sound_update_scene(Main *bmain, struct Scene *scene) +static void sound_update_base(Scene *scene, Base *base, void *new_set) { - Object *ob; - Base *base; + Object *ob = base->object; NlaTrack *track; NlaStrip *strip; Speaker *speaker; + float quat[4]; + + if ((ob->id.tag & LIB_TAG_DOIT) == 0) { + return; + } + + ob->id.tag &= ~LIB_TAG_DOIT; + + if ((ob->type != OB_SPEAKER) || !ob->adt) { + return; + } + + for (track = ob->adt->nla_tracks.first; track; track = track->next) { + for (strip = track->strips.first; strip; strip = strip->next) { + if (strip->type != NLASTRIP_TYPE_SOUND) { + continue; + } + speaker = (Speaker *)ob->data; + + if (AUD_removeSet(scene->speaker_handles, strip->speaker_handle)) { + if (speaker->sound) { + AUD_SequenceEntry_move(strip->speaker_handle, (double)strip->start / FPS, FLT_MAX, 0); + } + else { + AUD_Sequence_remove(scene->sound_scene, strip->speaker_handle); + strip->speaker_handle = NULL; + } + } + else { + if (speaker->sound) { + strip->speaker_handle = AUD_Sequence_add(scene->sound_scene, + speaker->sound->playback_handle, + (double)strip->start / FPS, FLT_MAX, 0); + AUD_SequenceEntry_setRelative(strip->speaker_handle, 0); + } + } + + if (strip->speaker_handle) { + const bool mute = ((strip->flag & NLASTRIP_FLAG_MUTED) || (speaker->flag & SPK_MUTED)); + AUD_addSet(new_set, strip->speaker_handle); + AUD_SequenceEntry_setVolumeMaximum(strip->speaker_handle, speaker->volume_max); + AUD_SequenceEntry_setVolumeMinimum(strip->speaker_handle, speaker->volume_min); + AUD_SequenceEntry_setDistanceMaximum(strip->speaker_handle, speaker->distance_max); + AUD_SequenceEntry_setDistanceReference(strip->speaker_handle, speaker->distance_reference); + AUD_SequenceEntry_setAttenuation(strip->speaker_handle, speaker->attenuation); + AUD_SequenceEntry_setConeAngleOuter(strip->speaker_handle, speaker->cone_angle_outer); + AUD_SequenceEntry_setConeAngleInner(strip->speaker_handle, speaker->cone_angle_inner); + AUD_SequenceEntry_setConeVolumeOuter(strip->speaker_handle, speaker->cone_volume_outer); + + mat4_to_quat(quat, ob->obmat); + AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_LOCATION, CFRA, ob->obmat[3], 1); + AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_ORIENTATION, CFRA, quat, 1); + AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_VOLUME, CFRA, &speaker->volume, 1); + AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_PITCH, CFRA, &speaker->pitch, 1); + AUD_SequenceEntry_setSound(strip->speaker_handle, speaker->sound->playback_handle); + AUD_SequenceEntry_setMuted(strip->speaker_handle, mute); + } + } + } +} + +void BKE_sound_update_scene(Main *bmain, Scene *scene) +{ + Base *base; Scene *sce_it; void *new_set = AUD_createSet(); @@ -821,59 +884,18 @@ void BKE_sound_update_scene(Main *bmain, struct Scene *scene) /* cheap test to skip looping over all objects (no speakers is a common case) */ if (!BLI_listbase_is_empty(&bmain->speaker)) { - for (SETLOOPER(scene, sce_it, base)) { - ob = base->object; - if ((ob->type != OB_SPEAKER) || !ob->adt) { - continue; - } - for (track = ob->adt->nla_tracks.first; track; track = track->next) { - for (strip = track->strips.first; strip; strip = strip->next) { - if (strip->type != NLASTRIP_TYPE_SOUND) { - continue; - } - speaker = (Speaker *)ob->data; - - if (AUD_removeSet(scene->speaker_handles, strip->speaker_handle)) { - if (speaker->sound) { - AUD_SequenceEntry_move(strip->speaker_handle, (double)strip->start / FPS, FLT_MAX, 0); - } - else { - AUD_Sequence_remove(scene->sound_scene, strip->speaker_handle); - strip->speaker_handle = NULL; - } - } - else { - if (speaker->sound) { - strip->speaker_handle = AUD_Sequence_add(scene->sound_scene, - speaker->sound->playback_handle, - (double)strip->start / FPS, FLT_MAX, 0); - AUD_SequenceEntry_setRelative(strip->speaker_handle, 0); - } - } - - if (strip->speaker_handle) { - const bool mute = ((strip->flag & NLASTRIP_FLAG_MUTED) || (speaker->flag & SPK_MUTED)); - AUD_addSet(new_set, strip->speaker_handle); - AUD_SequenceEntry_setVolumeMaximum(strip->speaker_handle, speaker->volume_max); - AUD_SequenceEntry_setVolumeMinimum(strip->speaker_handle, speaker->volume_min); - AUD_SequenceEntry_setDistanceMaximum(strip->speaker_handle, speaker->distance_max); - AUD_SequenceEntry_setDistanceReference(strip->speaker_handle, speaker->distance_reference); - AUD_SequenceEntry_setAttenuation(strip->speaker_handle, speaker->attenuation); - AUD_SequenceEntry_setConeAngleOuter(strip->speaker_handle, speaker->cone_angle_outer); - AUD_SequenceEntry_setConeAngleInner(strip->speaker_handle, speaker->cone_angle_inner); - AUD_SequenceEntry_setConeVolumeOuter(strip->speaker_handle, speaker->cone_volume_outer); - - mat4_to_quat(quat, ob->obmat); - AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_LOCATION, CFRA, ob->obmat[3], 1); - AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_ORIENTATION, CFRA, quat, 1); - AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_VOLUME, CFRA, &speaker->volume, 1); - AUD_SequenceEntry_setAnimationData(strip->speaker_handle, AUD_AP_PITCH, CFRA, &speaker->pitch, 1); - AUD_SequenceEntry_setSound(strip->speaker_handle, speaker->sound->playback_handle); - AUD_SequenceEntry_setMuted(strip->speaker_handle, mute); - } - } + BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true); + + for (SceneLayer *scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) { + for (base = scene_layer->object_bases.first; base; base = base->next) { + sound_update_base(scene, base, new_set); } } + + for (SETLOOPER_SET_ONLY(scene, sce_it, base)) { + sound_update_base(scene, base, new_set); + } + } while ((handle = AUD_getSet(scene->speaker_handles))) { diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index 05dab9208e5..04b18e6ecdb 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -29,12 +29,14 @@ #include "BLI_utildefines.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_string_utils.h" #include "BLI_listbase.h" #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_workspace.h" @@ -141,6 +143,12 @@ WorkSpace *BKE_workspace_add(Main *bmain, const char *name) return new_workspace; } +/** + * The function that actually frees the workspace data (not workspace itself). It shouldn't be called + * directly, instead #BKE_workspace_remove should be, which calls this through #BKE_libblock_free then. + * + * Should something like a bke_internal.h be added, this should go there! + */ void BKE_workspace_free(WorkSpace *workspace) { for (WorkSpaceDataRelation *relation = workspace->hook_layout_relations.first, *relation_next; @@ -152,15 +160,22 @@ void BKE_workspace_free(WorkSpace *workspace) } BLI_freelistN(&workspace->layouts); BLI_freelistN(&workspace->transform_orientations); + BKE_viewrender_free(&workspace->view_render); } +/** + * Remove \a workspace by freeing itself and its data. This is a higher-level wrapper that + * calls #BKE_workspace_free (through #BKE_libblock_free) to free the workspace data, and frees + * other data-blocks owned by \a workspace and its layouts (currently that is screens only). + * + * Always use this to remove (and free) workspaces. Don't free non-ID workspace members here. + */ void BKE_workspace_remove(Main *bmain, WorkSpace *workspace) { for (WorkSpaceLayout *layout = workspace->layouts.first, *layout_next; layout; layout = layout_next) { layout_next = layout->next; BKE_workspace_layout_remove(bmain, workspace, layout); } - BKE_libblock_free(bmain, workspace); } @@ -371,11 +386,11 @@ void BKE_workspace_active_screen_set(WorkSpaceInstanceHook *hook, WorkSpace *wor } #ifdef USE_WORKSPACE_MODE -ObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace) +eObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace) { return workspace->object_mode; } -void BKE_workspace_object_mode_set(WorkSpace *workspace, const ObjectMode mode) +void BKE_workspace_object_mode_set(WorkSpace *workspace, const eObjectMode mode) { workspace->object_mode = mode; } @@ -430,3 +445,27 @@ void BKE_workspace_hook_layout_for_workspace_set( hook->act_layout = layout; workspace_relation_ensure_updated(&workspace->hook_layout_relations, hook, layout); } + +/** + * Get the render engine of a workspace, to be used in the viewport. + */ +ViewRender *BKE_workspace_view_render_get(WorkSpace *workspace) +{ + return &workspace->view_render; +} + +/* Flags */ +bool BKE_workspace_use_scene_settings_get(const WorkSpace *workspace) +{ + return (workspace->flags & WORKSPACE_USE_SCENE_SETTINGS) != 0; +} + +void BKE_workspace_use_scene_settings_set(WorkSpace *workspace, bool value) +{ + if (value) { + workspace->flags |= WORKSPACE_USE_SCENE_SETTINGS; + } + else { + workspace->flags &= ~WORKSPACE_USE_SCENE_SETTINGS; + } +} diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index b47846cbdec..60a1bdb0458 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -75,7 +75,7 @@ typedef struct FFMpegContext { bool ffmpeg_preview; int ffmpeg_crf; /* set to 0 to not use CRF mode; we have another flag for lossless anyway. */ - int ffmpeg_preset; /* see FFMpegPreset */ + int ffmpeg_preset; /* see eFFMpegPreset */ AVFormatContext *outfile; AVStream *video_stream; diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h index b4d354b7e37..e7776aa0f0d 100644 --- a/source/blender/blenlib/BLI_string_cursor_utf8.h +++ b/source/blender/blenlib/BLI_string_cursor_utf8.h @@ -30,26 +30,28 @@ * \ingroup bli */ -typedef enum strCursorJumpType { +typedef enum eStrCursorJumpType { STRCUR_JUMP_NONE, STRCUR_JUMP_DELIM, STRCUR_JUMP_ALL -} strCursorJumpType; +} eStrCursorJumpType; -typedef enum strCursorJumpDirection { +typedef enum eStrCursorJumpDirection { STRCUR_DIR_PREV, STRCUR_DIR_NEXT -} strCursorJumpDirection; +} eStrCursorJumpDirection; bool BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos); bool BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos); -void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, - int *pos, strCursorJumpDirection direction, - strCursorJumpType jump, bool use_init_step); +void BLI_str_cursor_step_utf8( + const char *str, size_t maxlen, + int *pos, eStrCursorJumpDirection direction, + eStrCursorJumpType jump, bool use_init_step); -void BLI_str_cursor_step_wchar(const wchar_t *str, size_t maxlen, - int *pos, strCursorJumpDirection direction, - strCursorJumpType jump, bool use_init_step); +void BLI_str_cursor_step_wchar( + const wchar_t *str, size_t maxlen, + int *pos, eStrCursorJumpDirection direction, + eStrCursorJumpType jump, bool use_init_step); #endif /* __BLI_STRING_CURSOR_UTF8_H__ */ diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c index 09b7ecb2277..85e3106dc6e 100644 --- a/source/blender/blenlib/intern/string_cursor_utf8.c +++ b/source/blender/blenlib/intern/string_cursor_utf8.c @@ -40,7 +40,7 @@ # pragma GCC diagnostic error "-Wsign-conversion" #endif -typedef enum strCursorDelimType { +typedef enum eStrCursorDelimType { STRCUR_DELIM_NONE, STRCUR_DELIM_ALPHANUMERIC, STRCUR_DELIM_PUNCT, @@ -49,9 +49,9 @@ typedef enum strCursorDelimType { STRCUR_DELIM_QUOTE, STRCUR_DELIM_WHITESPACE, STRCUR_DELIM_OTHER -} strCursorDelimType; +} eStrCursorDelimType; -static strCursorDelimType cursor_delim_type_unicode(const unsigned int uch) +static eStrCursorDelimType cursor_delim_type_unicode(const unsigned int uch) { switch (uch) { case ',': @@ -108,7 +108,7 @@ static strCursorDelimType cursor_delim_type_unicode(const unsigned int uch) return STRCUR_DELIM_ALPHANUMERIC; /* Not quite true, but ok for now */ } -static strCursorDelimType cursor_delim_type_utf8(const char *ch_utf8) +static eStrCursorDelimType cursor_delim_type_utf8(const char *ch_utf8) { /* for full unicode support we really need to have large lookup tables to figure * out whats what in every possible char set - and python, glib both have these. */ @@ -146,9 +146,10 @@ bool BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int * return false; } -void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, - int *pos, strCursorJumpDirection direction, - strCursorJumpType jump, bool use_init_step) +void BLI_str_cursor_step_utf8( + const char *str, size_t maxlen, + int *pos, eStrCursorJumpDirection direction, + eStrCursorJumpType jump, bool use_init_step) { const int pos_orig = *pos; @@ -161,13 +162,16 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, } if (jump != STRCUR_JUMP_NONE) { - const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type_utf8(&str[*pos]) : STRCUR_DELIM_NONE; + const eStrCursorDelimType delim_type = + (*pos) < maxlen ? cursor_delim_type_utf8(&str[*pos]) : STRCUR_DELIM_NONE; /* jump between special characters (/,\,_,-, etc.), * look at function cursor_delim_type() for complete * list of special character, ctr -> */ while ((*pos) < maxlen) { if (BLI_str_cursor_step_next_utf8(str, maxlen, pos)) { - if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type_utf8(&str[*pos]))) { + if ((jump != STRCUR_JUMP_ALL) && + (delim_type != cursor_delim_type_utf8(&str[*pos]))) + { break; } } @@ -186,14 +190,17 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen, } if (jump != STRCUR_JUMP_NONE) { - const strCursorDelimType delim_type = (*pos) > 0 ? cursor_delim_type_utf8(&str[(*pos) - 1]) : STRCUR_DELIM_NONE; + const eStrCursorDelimType delim_type = + (*pos) > 0 ? cursor_delim_type_utf8(&str[(*pos) - 1]) : STRCUR_DELIM_NONE; /* jump between special characters (/,\,_,-, etc.), * look at function cursor_delim_type() for complete * list of special character, ctr -> */ while ((*pos) > 0) { const int pos_prev = *pos; if (BLI_str_cursor_step_prev_utf8(str, maxlen, pos)) { - if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type_utf8(&str[*pos]))) { + if ((jump != STRCUR_JUMP_ALL) && + (delim_type != cursor_delim_type_utf8(&str[*pos]))) + { /* left only: compensate for index/change in direction */ if ((pos_orig - (*pos)) >= 1) { *pos = pos_prev; @@ -235,9 +242,10 @@ static bool wchar_t_step_prev(const wchar_t *UNUSED(str), size_t UNUSED(maxlen), return true; } -void BLI_str_cursor_step_wchar(const wchar_t *str, size_t maxlen, - int *pos, strCursorJumpDirection direction, - strCursorJumpType jump, bool use_init_step) +void BLI_str_cursor_step_wchar( + const wchar_t *str, size_t maxlen, + int *pos, eStrCursorJumpDirection direction, + eStrCursorJumpType jump, bool use_init_step) { const int pos_orig = *pos; @@ -250,13 +258,16 @@ void BLI_str_cursor_step_wchar(const wchar_t *str, size_t maxlen, } if (jump != STRCUR_JUMP_NONE) { - const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type_unicode((unsigned int)str[*pos]) : STRCUR_DELIM_NONE; + const eStrCursorDelimType delim_type = + (*pos) < maxlen ? cursor_delim_type_unicode((unsigned int)str[*pos]) : STRCUR_DELIM_NONE; /* jump between special characters (/,\,_,-, etc.), * look at function cursor_delim_type_unicode() for complete * list of special character, ctr -> */ while ((*pos) < maxlen) { if (wchar_t_step_next(str, maxlen, pos)) { - if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type_unicode((unsigned int)str[*pos]))) { + if ((jump != STRCUR_JUMP_ALL) && + (delim_type != cursor_delim_type_unicode((unsigned int)str[*pos]))) + { break; } } @@ -275,14 +286,17 @@ void BLI_str_cursor_step_wchar(const wchar_t *str, size_t maxlen, } if (jump != STRCUR_JUMP_NONE) { - const strCursorDelimType delim_type = (*pos) > 0 ? cursor_delim_type_unicode((unsigned int)str[(*pos) - 1]) : STRCUR_DELIM_NONE; + const eStrCursorDelimType delim_type = + (*pos) > 0 ? cursor_delim_type_unicode((unsigned int)str[(*pos) - 1]) : STRCUR_DELIM_NONE; /* jump between special characters (/,\,_,-, etc.), * look at function cursor_delim_type() for complete * list of special character, ctr -> */ while ((*pos) > 0) { const int pos_prev = *pos; if (wchar_t_step_prev(str, maxlen, pos)) { - if ((jump != STRCUR_JUMP_ALL) && (delim_type != cursor_delim_type_unicode((unsigned int)str[*pos]))) { + if ((jump != STRCUR_JUMP_ALL) && + (delim_type != cursor_delim_type_unicode((unsigned int)str[*pos]))) + { /* left only: compensate for index/change in direction */ if ((pos_orig - (*pos)) >= 1) { *pos = pos_prev; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 74ca447eb5e..b639236e022 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -54,11 +54,11 @@ struct wmWindowManager; typedef struct BlendHandle BlendHandle; -typedef enum BlenFileType { +typedef enum eBlenFileType { BLENFILETYPE_BLEND = 1, BLENFILETYPE_PUB = 2, BLENFILETYPE_RUNTIME = 3 -} BlenFileType; +} eBlenFileType; typedef struct BlendFileData { struct Main *main; @@ -72,7 +72,7 @@ typedef struct BlendFileData { struct Scene *curscene; struct SceneLayer *cur_render_layer; /* layer to activate in workspaces when reading without UI */ - BlenFileType type; + eBlenFileType type; } BlendFileData; typedef struct WorkspaceConfigFileData { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 47fde5fb096..0ed3b228ea3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2453,13 +2453,14 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) /* NOTE: this assumes that link_list has already been called on the list */ -static void direct_link_fmodifiers(FileData *fd, ListBase *list) +static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve) { FModifier *fcm; for (fcm = list->first; fcm; fcm = fcm->next) { /* relink general data */ fcm->data = newdataadr(fd, fcm->data); + fcm->curve = curve; /* do relinking of data for specific types */ switch (fcm->type) { @@ -2549,7 +2550,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list) /* modifiers */ link_list(fd, &fcu->modifiers); - direct_link_fmodifiers(fd, &fcu->modifiers); + direct_link_fmodifiers(fd, &fcu->modifiers, fcu); } } @@ -2654,7 +2655,7 @@ static void direct_link_nladata_strips(FileData *fd, ListBase *list) /* strip's F-Modifiers */ link_list(fd, &strip->modifiers); - direct_link_fmodifiers(fd, &strip->modifiers); + direct_link_fmodifiers(fd, &strip->modifiers, NULL); } } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index a4072b2d321..a204f9fe6d3 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -101,6 +101,14 @@ static void do_version_workspaces_create_from_screens(Main *bmain) BKE_workspace_layout_add(workspace, screen, screen->id.name + 2); BKE_workspace_render_layer_set(workspace, layer); +#ifdef WITH_CLAY_ENGINE + BLI_strncpy(workspace->view_render.engine_id, RE_engine_id_BLENDER_CLAY, + sizeof(workspace->view_render.engine_id)); +#else + BLI_strncpy(workspace->view_render.engine_id, RE_engine_id_BLENDER_EEVEE, + sizeof(workspace->view_render.engine_id)); +#endif + transform_orientations = BKE_workspace_transform_orientations_get(workspace); BLI_duplicatelist(transform_orientations, &screen->scene->transform_spaces); } @@ -193,7 +201,6 @@ void do_versions_after_linking_280(Main *main) for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) { SceneLayer *sl = BKE_scene_layer_add(scene, srl->name); - BKE_scene_layer_engine_set(sl, scene->r.engine); if (srl->mat_override) { BKE_collection_override_datablock_add((LayerCollection *)sl->layer_collections.first, "material", (ID *)srl->mat_override); @@ -565,6 +572,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main) } } + { + if (!DNA_struct_elem_find(fd->filesdna, "Scene", "ViewRender", "view_render")) { + for (Scene *scene = main->scene.first; scene; scene = scene->id.next) { + BLI_strncpy_utf8(scene->view_render.engine_id, scene->r.engine, + sizeof(scene->view_render.engine_id)); + } + + for (WorkSpace *workspace = main->workspaces.first; workspace; workspace = workspace->id.next) { + BKE_viewrender_init(&workspace->view_render); + } + } + } + if (!DNA_struct_find(fd->filesdna, "SpaceTopBar")) { for (bScreen *screen = main->screen.first; screen; screen = screen->id.next) { for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) { diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 54ed29ab6fa..925a87cb653 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -45,6 +45,7 @@ #include "BKE_brush.h" #include "BKE_library.h" #include "BKE_main.h" +#include "BKE_scene.h" #include "BKE_workspace.h" #include "BLO_readfile.h" @@ -103,6 +104,7 @@ static void update_defaults_startup_workspaces(Main *bmain) if (STREQ(workspace->id.name + 2, "Default")) { /* don't rename within iterator, renaming causes listbase to be re-sorted */ workspace_default = workspace; + BKE_viewrender_init(&workspace->view_render); } else { BKE_workspace_remove(bmain, workspace); @@ -120,7 +122,7 @@ static void update_defaults_startup_workspaces(Main *bmain) void BLO_update_defaults_startup_blend(Main *bmain) { for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) { - BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine)); + BLI_strncpy(scene->view_render.engine_id, RE_engine_id_BLENDER_EEVEE, sizeof(scene->view_render.engine_id)); scene->r.im_format.planes = R_IMF_PLANES_RGBA; scene->r.im_format.compress = 15; diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index 17a13b66aaa..b4509c7a61a 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -128,8 +128,4 @@ if(WITH_OPENSUBDIV) add_definitions(-DWITH_OPENSUBDIV) endif() -if(WITH_DEPSGRAPH_COPY_ON_WRITE) - add_definitions(-DWITH_COPY_ON_WRITE) -endif() - blender_add_lib(bf_depsgraph "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 932a7c51286..894adbee8c9 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -65,6 +65,7 @@ struct Main; struct PointerRNA; struct PropertyRNA; +struct RenderEngineType; struct Scene; struct SceneLayer; @@ -84,6 +85,7 @@ typedef struct EvaluationContext { float ctime; struct SceneLayer *scene_layer; + struct RenderEngineType *engine; } EvaluationContext; /* DagNode->eval_flags */ @@ -103,9 +105,8 @@ enum { extern "C" { #endif -bool DEG_depsgraph_use_legacy(void); -void DEG_depsgraph_switch_to_legacy(void); -void DEG_depsgraph_switch_to_new(void); +bool DEG_depsgraph_use_copy_on_write(void); +void DEG_depsgraph_enable_copy_on_write(void); /* ************************************************ */ /* Depsgraph API */ @@ -213,6 +214,7 @@ void DEG_evaluation_context_init(struct EvaluationContext *eval_ctx, void DEG_evaluation_context_init_from_scene(struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *scene_layer, + struct RenderEngineType *engine, eEvaluationMode mode); /* Free evaluation context. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index deee2227f81..587d2021b52 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -47,6 +47,7 @@ namespace DEG { void deg_graph_build_finalize(Depsgraph *graph) { + const bool use_copy_on_write = DEG_depsgraph_use_copy_on_write(); /* Re-tag IDs for update if it was tagged before the relations * update tag. */ @@ -63,9 +64,12 @@ void deg_graph_build_finalize(Depsgraph *graph) id_node->tag_update(graph); } } -#ifdef WITH_COPY_ON_WRITE - DEG_id_tag_update_ex(graph->bmain, id_node->id_orig, DEG_TAG_COPY_ON_WRITE); -#endif + /* TODO(sergey): This is not ideal at all, since this forces + * re-evaluaiton of the whole tree. + */ + if (use_copy_on_write) { + DEG_id_tag_update_ex(graph->bmain, id_node->id_orig, DEG_TAG_COPY_ON_WRITE); + } } GHASH_FOREACH_END(); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index 02d20913177..a4c3c11d922 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -174,7 +174,9 @@ DepsgraphNodeBuilder::~DepsgraphNodeBuilder() IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id, bool do_tag) { -#ifdef WITH_COPY_ON_WRITE + if (!DEG_depsgraph_use_copy_on_write()) { + return m_graph->add_id_node(id); + } IDDepsNode *id_node = NULL; ID *id_cow = (ID *)BLI_ghash_lookup(m_cow_id_hash, id); if (id_cow != NULL) { @@ -197,10 +199,6 @@ IDDepsNode *DepsgraphNodeBuilder::add_id_node(ID *id, bool do_tag) "", -1); m_graph->operations.push_back(op_cow); } -#else - IDDepsNode *id_node = m_graph->add_id_node(id); - UNUSED_VARS(do_tag); -#endif return id_node; } @@ -358,23 +356,25 @@ void DepsgraphNodeBuilder::begin_build(Main *bmain) { } FOREACH_NODETREE_END; -#ifdef WITH_COPY_ON_WRITE - /* Store existing copy-on-write versions of datablock, so we can re-use - * them for new ID nodes. - */ - m_cow_id_hash = BLI_ghash_ptr_new("Depsgraph id hash"); - GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, m_graph->id_hash) - { - if (GS(id_node->id_orig->name) != ID_SCE) { - continue; - } - if (deg_copy_on_write_is_expanded(id_node->id_cow)) { - BLI_ghash_insert(m_cow_id_hash, id_node->id_orig, id_node->id_cow); - id_node->id_cow = NULL; + if (DEG_depsgraph_use_copy_on_write()) { + /* Store existing copy-on-write versions of datablock, so we can re-use + * them for new ID nodes. + */ + m_cow_id_hash = BLI_ghash_ptr_new("Depsgraph id hash"); + GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, m_graph->id_hash) + { + if (GS(id_node->id_orig->name) != ID_SCE) { + continue; + } + if (deg_copy_on_write_is_expanded(id_node->id_cow)) { + BLI_ghash_insert(m_cow_id_hash, + id_node->id_orig, + id_node->id_cow); + id_node->id_cow = NULL; + } } + GHASH_FOREACH_END(); } - GHASH_FOREACH_END(); -#endif /* Make sure graph has no nodes left from previous state. */ m_graph->clear_all_nodes(); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 7e28df1276d..dbb126e2078 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -32,6 +32,8 @@ #include "intern/depsgraph_types.h" +#include "DEG_depsgraph.h" /* used for DEG_depsgraph_use_copy_on_write() */ + struct CacheFile; struct bGPdata; struct ListBase; @@ -98,11 +100,12 @@ struct DepsgraphNodeBuilder { /* For a given COW datablock get corresponding original one. */ template<typename T> T *get_orig_datablock(const T *cow) const { -#ifdef WITH_COPY_ON_WRITE - return (T *)cow->id.newid; -#else - return (T *)cow; -#endif + if (DEG_depsgraph_use_copy_on_write()) { + return (T *)cow->id.newid; + } + else { + return (T *)cow; + } } void begin_build(Main *bmain); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc index b3a88d8ac4d..660d7fedb52 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_layer.cc @@ -96,12 +96,14 @@ void DepsgraphNodeBuilder::build_layer_collections(Scene *scene, void DepsgraphNodeBuilder::build_scene_layer_collections(Scene *scene) { -#ifdef WITH_COPY_ON_WRITE - /* Make sure we've got ID node, so we can get pointer to CoW datablock. */ - Scene *scene_cow = expand_cow_datablock(scene); -#else - Scene *scene_cow = scene; -#endif + Scene *scene_cow; + if (DEG_depsgraph_use_copy_on_write()) { + /* Make sure we've got ID node, so we can get pointer to CoW datablock. */ + scene_cow = expand_cow_datablock(scene); + } + else { + scene_cow = scene; + } LayerCollectionState state; state.index = 0; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index d610dc51080..20263e1d751 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -90,6 +90,9 @@ void DepsgraphNodeBuilder::build_ik_pose(Scene *scene, /* Find the chain's root. */ bPoseChannel *rootchan = BKE_armature_ik_solver_find_root(pchan, data); + if (rootchan == NULL) { + return; + } if (has_operation_node(&ob->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name, DEG_OPCODE_POSE_IK_SOLVER)) @@ -135,18 +138,22 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *object) { bArmature *armature = (bArmature *)object->data; const short armature_tag = armature->id.tag; -#ifdef WITH_COPY_ON_WRITE - /* NOTE: We need to expand both object and armature, so this way we can - * safely create object level pose. - */ - Scene *scene_cow = get_cow_datablock(scene); - Object *object_cow = expand_cow_datablock(object); - bArmature *armature_cow = expand_cow_datablock(armature); -#else - Scene *scene_cow = scene; - Object *object_cow = object; - bArmature *armature_cow = armature; -#endif + Scene *scene_cow; + Object *object_cow; + bArmature *armature_cow; + if (DEG_depsgraph_use_copy_on_write()) { + /* NOTE: We need to expand both object and armature, so this way we can + * safely create object level pose. + */ + scene_cow = get_cow_datablock(scene); + object_cow = expand_cow_datablock(object); + armature_cow = expand_cow_datablock(armature); + } + else { + scene_cow = scene; + object_cow = object; + armature_cow = armature; + } OperationDepsNode *op_node; /* Animation and/or drivers linking posebones to base-armature used to diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 0c5150f2f42..10c4c44d14e 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1803,18 +1803,18 @@ void DepsgraphRelationBuilder::build_lamp(Object *ob) /* textures */ build_texture_stack(la->mtex); -#ifdef WITH_COPY_ON_WRITE - /* Make sure copy on write of lamp data is always properly updated for - * visible lamps. - */ - OperationKey ob_copy_on_write_key(&ob->id, - DEG_NODE_TYPE_COPY_ON_WRITE, - DEG_OPCODE_COPY_ON_WRITE); - OperationKey lamp_copy_on_write_key(lamp_id, - DEG_NODE_TYPE_COPY_ON_WRITE, - DEG_OPCODE_COPY_ON_WRITE); - add_relation(lamp_copy_on_write_key, ob_copy_on_write_key, "Eval Order"); -#endif + if (DEG_depsgraph_use_copy_on_write()) { + /* Make sure copy on write of lamp data is always properly updated for + * visible lamps. + */ + OperationKey ob_copy_on_write_key(&ob->id, + DEG_NODE_TYPE_COPY_ON_WRITE, + DEG_OPCODE_COPY_ON_WRITE); + OperationKey lamp_copy_on_write_key(lamp_id, + DEG_NODE_TYPE_COPY_ON_WRITE, + DEG_OPCODE_COPY_ON_WRITE); + add_relation(lamp_copy_on_write_key, ob_copy_on_write_key, "Eval Order"); + } } void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index 88477e512d1..c23d6d3a2bd 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -83,6 +83,9 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob, * - see notes on direction of rel below... */ bPoseChannel *rootchan = BKE_armature_ik_solver_find_root(pchan, data); + if (rootchan == NULL) { + return; + } OperationKey pchan_local_key(&ob->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_LOCAL); OperationKey init_ik_key(&ob->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK); diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 81a4f2bc0cc..a20a0c2bb31 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -62,6 +62,18 @@ extern "C" { #include "intern/depsgraph_intern.h" #include "util/deg_util_foreach.h" +static bool use_copy_on_write = false; + +bool DEG_depsgraph_use_copy_on_write(void) +{ + return use_copy_on_write; +} + +void DEG_depsgraph_enable_copy_on_write(void) +{ + use_copy_on_write = true; +} + namespace DEG { static DEG_EditorUpdateIDCb deg_editor_update_id_cb = NULL; @@ -252,14 +264,6 @@ DepsNode *Depsgraph::find_node_from_pointer(const PointerRNA *ptr, /* Node Management ---------------------------- */ -#ifndef WITH_COPY_ON_WRITE -static void id_node_deleter(void *value) -{ - IDDepsNode *id_node = reinterpret_cast<IDDepsNode *>(value); - OBJECT_GUARDED_DELETE(id_node, IDDepsNode); -} -#endif - TimeSourceDepsNode *Depsgraph::add_time_source() { if (time_source == NULL) { @@ -305,33 +309,31 @@ IDDepsNode *Depsgraph::add_id_node(ID *id, bool do_tag, ID *id_cow_hint) void Depsgraph::clear_id_nodes() { -#ifndef WITH_COPY_ON_WRITE - BLI_ghash_clear(id_hash, NULL, id_node_deleter); -#else - /* Stupid workaround to ensure we free IDs in a proper order. */ - GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, id_hash) - { - if (id_node->id_cow == NULL) { - /* This means builder "stole" ownership of the copy-on-written - * datablock for her own dirty needs. - */ - continue; - } - if (!deg_copy_on_write_is_expanded(id_node->id_cow)) { - continue; - } - const ID_Type id_type = GS(id_node->id_cow->name); - if (id_type != ID_PA) { - id_node->destroy(); + if (use_copy_on_write) { + /* Stupid workaround to ensure we free IDs in a proper order. */ + GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, id_hash) + { + if (id_node->id_cow == NULL) { + /* This means builder "stole" ownership of the copy-on-written + * datablock for her own dirty needs. + */ + continue; + } + if (!deg_copy_on_write_is_expanded(id_node->id_cow)) { + continue; + } + const ID_Type id_type = GS(id_node->id_cow->name); + if (id_type != ID_PA) { + id_node->destroy(); + } } + GHASH_FOREACH_END(); } - GHASH_FOREACH_END(); GHASH_FOREACH_BEGIN(IDDepsNode *, id_node, id_hash) { OBJECT_GUARDED_DELETE(id_node, IDDepsNode); } GHASH_FOREACH_END(); -#endif } /* Add new relationship between two nodes. */ diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index e21c3d29aa5..e4b6434b9c7 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -216,9 +216,9 @@ void DEG_graph_build_from_scene(Depsgraph *graph, Main *bmain, Scene *scene) DEG::DepsgraphRelationBuilder relation_builder(deg_graph); relation_builder.begin_build(bmain); relation_builder.build_scene(bmain, scene); -#ifdef WITH_COPY_ON_WRITE - relation_builder.build_copy_on_write_relations(); -#endif + if (DEG_depsgraph_use_copy_on_write()) { + relation_builder.build_copy_on_write_relations(); + } /* Detect and solve cycles. */ DEG::deg_graph_detect_cycles(deg_graph); diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc index 77a32740524..9235069f531 100644 --- a/source/blender/depsgraph/intern/depsgraph_eval.cc +++ b/source/blender/depsgraph/intern/depsgraph_eval.cc @@ -79,10 +79,12 @@ void DEG_evaluation_context_init(EvaluationContext *eval_ctx, void DEG_evaluation_context_init_from_scene(EvaluationContext *eval_ctx, Scene *scene, SceneLayer *scene_layer, + RenderEngineType *engine, eEvaluationMode mode) { DEG_evaluation_context_init(eval_ctx, mode); eval_ctx->scene_layer = scene_layer; + eval_ctx->engine = engine; eval_ctx->ctime = BKE_scene_frame_get(scene); } diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 0df2420d662..927593b6d8f 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -269,16 +269,17 @@ void id_tag_update_shading(Depsgraph *graph, IDDepsNode *id_node) shading_comp->tag_update(graph); } -#ifdef WITH_COPY_ON_WRITE /* Tag corresponding to DEG_TAG_COPY_ON_WRITE. */ void id_tag_update_copy_on_write(Depsgraph *graph, IDDepsNode *id_node) { + if (!DEG_depsgraph_use_copy_on_write()) { + return; + } ComponentDepsNode *cow_comp = id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE); OperationDepsNode *cow_node = cow_comp->get_entry_operation(); cow_node->tag_update(graph); } -#endif void id_tag_update_ntree_special(Main *bmain, Depsgraph *graph, ID *id, int flag) { @@ -320,16 +321,16 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag) } if (flag & OB_RECALC_DATA) { id_tag_update_object_data(graph, id_node); -#ifdef WITH_COPY_ON_WRITE - if (flag & DEG_TAG_COPY_ON_WRITE) { - const ID_Type id_type = GS(id_node->id_orig->name); - if (id_type == ID_OB) { - Object *object = (Object *)id_node->id_orig; - ID *ob_data = (ID *)object->data; - DEG_id_tag_update_ex(bmain, ob_data, flag); + if (DEG_depsgraph_use_copy_on_write()) { + if (flag & DEG_TAG_COPY_ON_WRITE) { + const ID_Type id_type = GS(id_node->id_orig->name); + if (id_type == ID_OB) { + Object *object = (Object *)id_node->id_orig; + ID *ob_data = (ID *)object->data; + DEG_id_tag_update_ex(bmain, ob_data, flag); + } } } -#endif } if (flag & OB_RECALC_TIME) { id_tag_update_object_time(graph, id_node); @@ -340,11 +341,9 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag) if (flag & DEG_TAG_SHADING_UPDATE) { id_tag_update_shading(graph, id_node); } -#ifdef WITH_COPY_ON_WRITE if (flag & DEG_TAG_COPY_ON_WRITE) { id_tag_update_copy_on_write(graph, id_node); } -#endif id_tag_update_ntree_special(bmain, graph, id, flag); } diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 03be601ce2c..cca511ea6a8 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -248,32 +248,33 @@ struct ValidateData { bool is_valid; }; -/* Similar to generic id_copy() but does not require main. - * - * TODO(sergey): Get rid of this once T51804 is handled. +/* Similar to generic id_copy() but does not require main and assumes pointer + * is already allocated, */ -bool id_copy_no_main(const ID *id, ID **newid) +bool id_copy_inplace_no_main(const ID *id, ID *newid) { const ID *id_for_copy = id; - Main temp_bmain = {0}; - SpinLock lock; - temp_bmain.lock = (MainLock *)&lock; - BLI_spin_init(&lock); #ifdef NESTED_ID_NASTY_WORKAROUND NestedIDHackTempStorage id_hack_storage; id_for_copy = nested_id_hack_get_discarded_pointers(&id_hack_storage, id); #endif - bool result = id_copy(&temp_bmain, (ID *)id_for_copy, newid, false); + bool result = BKE_id_copy_ex(NULL, + (ID *)id_for_copy, + &newid, + LIB_ID_CREATE_NO_MAIN | + LIB_ID_CREATE_NO_USER_REFCOUNT | + LIB_ID_CREATE_NO_ALLOCATE | + LIB_ID_CREATE_NO_DEG_TAG, + false); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { - nested_id_hack_restore_pointers(id, *newid); + nested_id_hack_restore_pointers(id, newid); } #endif - BLI_spin_end(&lock); return result; } @@ -527,9 +528,9 @@ void update_copy_on_write_scene(const Depsgraph *depsgraph, scene_cow->obedit = NULL; } /* Synchronize active render engine. */ - BLI_strncpy_utf8(scene_cow->r.engine, - scene_orig->r.engine, - sizeof(scene_cow->r.engine)); + BLI_strncpy_utf8(scene_cow->view_render.engine_id, + scene_orig->view_render.engine_id, + sizeof(scene_cow->view_render.engine_id)); /* TODO(sergey): What else do we need here? */ } @@ -686,17 +687,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph, break; } if (!done) { - if (id_copy_no_main(id_orig, &newid)) { - /* We copy contents of new ID to our CoW placeholder and free ID memory - * returned by id_copy(). - * - * TODO(sergey): We can avoid having extra ID allocation here if we'll - * have some smarter id_copy() which can use externally allocated memory. - */ - const size_t size = BKE_libblock_get_alloc_info(GS(newid->name), NULL); - memcpy(id_cow, newid, size); - done = true; - } + done = id_copy_inplace_no_main(id_orig, id_cow); } if (!done) { BLI_assert(!"No idea how to perform CoW on datablock"); diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index 54a3a499e36..86e69458f41 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -82,6 +82,7 @@ static void flush_init_func(void *data_v, int i) */ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) { + const bool use_copy_on_write = DEG_depsgraph_use_copy_on_write(); /* Sanity check. */ if (graph == NULL) { return; @@ -146,18 +147,17 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) } if (comp_node->done != COMPONENT_STATE_DONE) { -#ifdef WITH_COPY_ON_WRITE /* Currently this is needed to get ob->mesh to be replaced with * original mesh (rather than being evaluated_mesh). * * TODO(sergey): This is something we need to avoid. */ - if (comp_node->depends_on_cow()) { + if (use_copy_on_write && comp_node->depends_on_cow()) { ComponentDepsNode *cow_comp = id_node->find_component(DEG_NODE_TYPE_COPY_ON_WRITE); cow_comp->tag_update(graph); } -#endif + Object *object = NULL; if (GS(id_orig->name) == ID_OB) { object = (Object *)id_orig; diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc index 5e7ed249365..b313059e1bd 100644 --- a/source/blender/depsgraph/intern/nodes/deg_node.cc +++ b/source/blender/depsgraph/intern/nodes/deg_node.cc @@ -177,7 +177,14 @@ void IDDepsNode::init(const ID *id, const char *UNUSED(subdata)) void IDDepsNode::init_copy_on_write(ID *id_cow_hint) { -#ifdef WITH_COPY_ON_WRITE + /* Early output for non-copy-on-write case: we keep CoW pointer same as + * an original one. + */ + if (!DEG_depsgraph_use_copy_on_write()) { + UNUSED_VARS(id_cow_hint); + id_cow = id_orig; + return; + } /* Create pointer as early as possible, so we can use it for function * bindings. Rest of data we'll be copying to the new datablock when * it is actually needed. @@ -200,10 +207,6 @@ void IDDepsNode::init_copy_on_write(ID *id_cow_hint) else { id_cow = id_orig; } -#else - UNUSED_VARS(id_cow_hint); - id_cow = id_orig; -#endif } /* Free 'id' node. */ @@ -222,7 +225,6 @@ void IDDepsNode::destroy() id_deps_node_hash_key_free, id_deps_node_hash_value_free); -#ifdef WITH_COPY_ON_WRITE /* Free memory used by this CoW ID. */ if (id_cow != id_orig && id_cow != NULL) { deg_free_copy_on_write_datablock(id_cow); @@ -230,7 +232,7 @@ void IDDepsNode::destroy() DEG_COW_PRINT("Destroy CoW for %s: id_orig=%p id_cow=%p\n", id_orig->name, id_orig, id_cow); } -#endif + /* Tag that the node is freed. */ id_orig = NULL; } diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 646d8716094..e96aec0766f 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -42,6 +42,8 @@ struct ViewportEngineData; struct View3D; struct rcti; struct GPUOffScreen; +struct RenderEngineType; +struct WorkSpace; #include "BLI_sys_types.h" /* for bool */ @@ -72,6 +74,7 @@ void DRW_draw_view(const struct bContext *C); void DRW_draw_render_loop_ex( struct Depsgraph *graph, + struct RenderEngineType *engine, struct ARegion *ar, struct View3D *v3d, const struct bContext *evil_C); void DRW_draw_render_loop( @@ -79,6 +82,7 @@ void DRW_draw_render_loop( struct ARegion *ar, struct View3D *v3d); void DRW_draw_render_loop_offscreen( struct Depsgraph *graph, + struct RenderEngineType *engine, struct ARegion *ar, struct View3D *v3d, struct GPUOffScreen *ofs); void DRW_draw_select_loop( diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c index f4b38b7ebbf..76f5b4d9840 100644 --- a/source/blender/draw/engines/external/external_engine.c +++ b/source/blender/draw/engines/external/external_engine.c @@ -151,17 +151,16 @@ static void external_draw_scene(void *vedata) /* Create render engine. */ if (!rv3d->render_engine) { - RenderEngine *engine; - type = RE_engines_find(scene->r.engine); + RenderEngineType *engine_type = draw_ctx->engine; - if (!(type->view_update && type->render_to_view)) { + if (!(engine_type->view_update && engine_type->render_to_view)) { return; } - engine = RE_engine_create_ex(type, true); + RenderEngine *engine = RE_engine_create_ex(engine_type, true); engine->tile_x = scene->r.tilex; engine->tile_y = scene->r.tiley; - type->view_update(engine, draw_ctx->evil_C); + engine_type->view_update(engine, draw_ctx->evil_C); rv3d->render_engine = engine; } diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 428bea17f7c..e8eedac7048 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -438,6 +438,8 @@ typedef struct DRWContextState { /* Use 'scene->obedit' for edit-mode */ struct Object *obact; /* 'OBACT_NEW' */ + struct RenderEngineType *engine; + /* 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. */ const struct bContext *evil_C; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 38a767b7e34..2a3d9fafd2a 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -37,6 +37,7 @@ #include "BKE_object.h" #include "BKE_pbvh.h" #include "BKE_paint.h" +#include "BKE_workspace.h" #include "BLT_translation.h" #include "BLF_api.h" @@ -2905,15 +2906,14 @@ static void use_drw_engine(DrawEngineType *engine) /* TODO revisit this when proper layering is implemented */ /* Gather all draw engines needed and store them in DST.enabled_engines * That also define the rendering order of engines */ -static void DRW_engines_enable_from_engine(const Scene *scene) +static void DRW_engines_enable_from_engine(RenderEngineType *engine) { /* TODO layers */ - RenderEngineType *type = RE_engines_find(scene->r.engine); - if (type->draw_engine != NULL) { - use_drw_engine(type->draw_engine); + if (engine->draw_engine != NULL) { + use_drw_engine(engine->draw_engine); } - if ((type->flag & RE_INTERNAL) == 0) { + if ((engine->flag & RE_INTERNAL) == 0) { DRW_engines_enable_external(); } } @@ -2990,11 +2990,12 @@ static void DRW_engines_enable_external(void) use_drw_engine(DRW_engine_viewport_external_type.draw_engine); } -static void DRW_engines_enable(const Scene *scene, SceneLayer *sl) +static void DRW_engines_enable(const Scene *scene, SceneLayer *sl, RenderEngineType *engine) { Object *obact = OBACT_NEW(sl); const int mode = CTX_data_mode_enum_ex(scene->obedit, obact); - DRW_engines_enable_from_engine(scene); + + DRW_engines_enable_from_engine(engine); if (DRW_state_draw_support()) { DRW_engines_enable_from_object_mode(); @@ -3153,7 +3154,8 @@ void DRW_notify_view_update(const bContext *C) View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = ar->regiondata; Scene *scene = DEG_get_evaluated_scene(graph); - SceneLayer *sl = DEG_get_evaluated_scene_layer(graph); + RenderEngineType *engine = CTX_data_engine(C); + SceneLayer *scene_layer = CTX_data_scene_layer(C); if (rv3d->viewport == NULL) { return; @@ -3165,17 +3167,17 @@ void DRW_notify_view_update(const bContext *C) DST.viewport = rv3d->viewport; DST.draw_ctx = (DRWContextState){ - ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), C, + ar, rv3d, v3d, scene, scene_layer, OBACT_NEW(scene_layer), engine, C, }; - DRW_engines_enable(scene, sl); + DRW_engines_enable(scene, scene_layer, engine); for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { - DrawEngineType *engine = link->data; - ViewportEngineData *data = DRW_viewport_engine_data_get(engine); + DrawEngineType *draw_engine = link->data; + ViewportEngineData *data = DRW_viewport_engine_data_get(draw_engine); - if (engine->view_update) { - engine->view_update(data); + if (draw_engine->view_update) { + draw_engine->view_update(data); } } @@ -3197,12 +3199,13 @@ void DRW_notify_view_update(const bContext *C) void DRW_draw_view(const bContext *C) { struct Depsgraph *graph = CTX_data_depsgraph(C); + RenderEngineType *engine = CTX_data_engine(C); ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); /* Reset before using it. */ memset(&DST, 0x0, sizeof(DST)); - DRW_draw_render_loop_ex(graph, ar, v3d, C); + DRW_draw_render_loop_ex(graph, engine, ar, v3d, C); } /** @@ -3211,11 +3214,12 @@ void DRW_draw_view(const bContext *C) */ void DRW_draw_render_loop_ex( struct Depsgraph *graph, + RenderEngineType *engine, ARegion *ar, View3D *v3d, const bContext *evil_C) { Scene *scene = DEG_get_evaluated_scene(graph); - SceneLayer *sl = DEG_get_evaluated_scene_layer(graph); + SceneLayer *scene_layer = DEG_get_evaluated_scene_layer(graph); RegionView3D *rv3d = ar->regiondata; DST.draw_ctx.evil_C = evil_C; @@ -3228,15 +3232,16 @@ void DRW_draw_render_loop_ex( cache_is_dirty = GPU_viewport_cache_validate(DST.viewport, DRW_engines_get_hash()); DST.draw_ctx = (DRWContextState){ - ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), - /* reuse if caller sets */ - DST.draw_ctx.evil_C, + ar, rv3d, v3d, scene, scene_layer, OBACT_NEW(scene_layer), engine, + + /* reuse if caller sets */ + DST.draw_ctx.evil_C, }; DRW_viewport_var_init(); /* Get list of enabled engines */ - DRW_engines_enable(scene, sl); + DRW_engines_enable(scene, scene_layer, engine); /* Update ubos */ DRW_globals_update(); @@ -3316,11 +3321,15 @@ void DRW_draw_render_loop( { /* Reset before using it. */ memset(&DST, 0x0, sizeof(DST)); - DRW_draw_render_loop_ex(graph, ar, v3d, NULL); + + Scene *scene = DEG_get_evaluated_scene(graph); + RenderEngineType *engine = RE_engines_find(scene->view_render.engine_id); + + DRW_draw_render_loop_ex(graph, engine, ar, v3d, NULL); } void DRW_draw_render_loop_offscreen( - struct Depsgraph *graph, + struct Depsgraph *graph, RenderEngineType *engine, ARegion *ar, View3D *v3d, GPUOffScreen *ofs) { RegionView3D *rv3d = ar->regiondata; @@ -3335,7 +3344,7 @@ void DRW_draw_render_loop_offscreen( /* Reset before using it. */ memset(&DST, 0x0, sizeof(DST)); DST.options.is_image_render = true; - DRW_draw_render_loop_ex(graph, ar, v3d, NULL); + DRW_draw_render_loop_ex(graph, engine, ar, v3d, NULL); /* restore */ { @@ -3360,6 +3369,7 @@ void DRW_draw_select_loop( bool UNUSED(use_obedit_skip), bool UNUSED(use_nearest), const rcti *rect) { Scene *scene = DEG_get_evaluated_scene(graph); + RenderEngineType *engine = RE_engines_find(scene->view_render.engine_id); SceneLayer *sl = DEG_get_evaluated_scene_layer(graph); #ifndef USE_GPU_SELECT UNUSED_VARS(vc, scene, sl, v3d, ar, rect); @@ -3412,7 +3422,7 @@ void DRW_draw_select_loop( /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ DST.draw_ctx = (DRWContextState){ - ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), (bContext *)NULL, + ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), engine, (bContext *)NULL, }; DRW_viewport_var_init(); @@ -3478,6 +3488,7 @@ void DRW_draw_depth_loop( ARegion *ar, View3D *v3d) { Scene *scene = DEG_get_evaluated_scene(graph); + RenderEngineType *engine = RE_engines_find(scene->view_render.engine_id); SceneLayer *sl = DEG_get_evaluated_scene_layer(graph); RegionView3D *rv3d = ar->regiondata; @@ -3508,7 +3519,7 @@ void DRW_draw_depth_loop( /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ DST.draw_ctx = (DRWContextState){ - ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), (bContext *)NULL, + ar, rv3d, v3d, scene, sl, OBACT_NEW(sl), engine, (bContext *)NULL, }; DRW_viewport_var_init(); diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 01575bff3c2..26ba61f0f20 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -682,7 +682,7 @@ typedef enum eRearrangeAnimChan_Mode { } eRearrangeAnimChan_Mode; /* defines for rearranging channels */ -static EnumPropertyItem prop_animchannel_rearrange_types[] = { +static const EnumPropertyItem prop_animchannel_rearrange_types[] = { {REARRANGE_ANIMCHAN_TOP, "TOP", 0, "To Top", ""}, {REARRANGE_ANIMCHAN_UP, "UP", 0, "Up", ""}, {REARRANGE_ANIMCHAN_DOWN, "DOWN", 0, "Down", ""}, @@ -1745,7 +1745,7 @@ static void ANIM_OT_channels_delete(wmOperatorType *ot) /* ********************** Set Flags Operator *********************** */ /* defines for setting animation-channel flags */ -static EnumPropertyItem prop_animchannel_setflag_types[] = { +static const EnumPropertyItem prop_animchannel_setflag_types[] = { {ACHANNEL_SETFLAG_TOGGLE, "TOGGLE", 0, "Toggle", ""}, {ACHANNEL_SETFLAG_CLEAR, "DISABLE", 0, "Disable", ""}, {ACHANNEL_SETFLAG_ADD, "ENABLE", 0, "Enable", ""}, @@ -1755,7 +1755,7 @@ static EnumPropertyItem prop_animchannel_setflag_types[] = { /* defines for set animation-channel settings */ // TODO: could add some more types, but those are really quite dependent on the mode... -static EnumPropertyItem prop_animchannel_settings_types[] = { +static const EnumPropertyItem prop_animchannel_settings_types[] = { {ACHANNEL_SETTING_PROTECT, "PROTECT", 0, "Protect", ""}, {ACHANNEL_SETTING_MUTE, "MUTE", 0, "Mute", ""}, {0, NULL, 0, NULL, NULL} @@ -2457,8 +2457,8 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; short selectmode = 0; - int gesture_mode; - bool extend; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -2466,17 +2466,17 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op) /* get settings from operator */ WM_operator_properties_border_to_rcti(op, &rect); - - gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - extend = RNA_boolean_get(op->ptr, "extend"); - if (!extend) + if (!extend) { ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, true, ACHANNEL_SETFLAG_CLEAR); + } - if (gesture_mode == GESTURE_MODAL_SELECT) + if (select) { selectmode = ACHANNEL_SETFLAG_ADD; - else + } + else { selectmode = ACHANNEL_SETFLAG_CLEAR; + } /* apply borderselect animation channels */ borderselect_anim_channels(&ac, &rect, selectmode); @@ -2495,10 +2495,10 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot) ot->description = "Select all animation channels within the specified region"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = animchannels_borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = animedit_poll_channels_nla_tweakmode_off; @@ -2506,7 +2506,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } /* ******************* Rename Operator ***************************** */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 8cf0e203a41..b24f48a10f9 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1249,7 +1249,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op) View2D *v2d = UI_view2d_fromcontext(C); ListBase *markers = ED_context_get_markers(C); TimeMarker *marker; - int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + bool select = !RNA_boolean_get(op->ptr, "deselect"); bool extend = RNA_boolean_get(op->ptr, "extend"); rctf rect; @@ -1262,13 +1262,11 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op) /* XXX marker context */ for (marker = markers->first; marker; marker = marker->next) { if (BLI_rctf_isect_x(&rect, marker->frame)) { - switch (gesture_mode) { - case GESTURE_MODAL_SELECT: - marker->flag |= SELECT; - break; - case GESTURE_MODAL_DESELECT: - marker->flag &= ~SELECT; - break; + if (select) { + marker->flag |= SELECT; + } + else { + marker->flag &= ~SELECT; } } else if (!extend) { @@ -1284,7 +1282,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op) static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event) { - return ed_markers_opwrap_invoke_custom(C, op, event, WM_border_select_invoke); + return ed_markers_opwrap_invoke_custom(C, op, event, WM_gesture_border_invoke); } static void MARKER_OT_select_border(wmOperatorType *ot) @@ -1297,8 +1295,8 @@ static void MARKER_OT_select_border(wmOperatorType *ot) /* api callbacks */ ot->exec = ed_marker_border_select_exec; ot->invoke = ed_marker_select_border_invoke_wrapper; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ed_markers_poll_markers_exist; @@ -1306,7 +1304,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } /* *********************** (de)select all ***************** */ diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index fcdd45d4ac3..f22c8c5b403 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -318,10 +318,10 @@ static void ANIM_OT_previewrange_set(wmOperatorType *ot) ot->description = "Interactively define frame range used for playback"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = previewrange_define_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_animview_active; diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 1a3d82e5002..dde531a6193 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -125,7 +125,7 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde * Create FModifier so that old scripts won't break * for now before 2.7 series -- (September 4, 2013) */ - add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR); + add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR, fcu); } else { /* add 2 keyframes so that user has something to work with @@ -767,7 +767,7 @@ EnumPropertyItem prop_driver_create_mapping_types[] = { }; /* Filtering callback for driver mapping types enum */ -static EnumPropertyItem *driver_mapping_type_itemsf(bContext *C, PointerRNA *UNUSED(owner_ptr), PropertyRNA *UNUSED(owner_prop), bool *r_free) +static const EnumPropertyItem *driver_mapping_type_itemsf(bContext *C, PointerRNA *UNUSED(owner_ptr), PropertyRNA *UNUSED(owner_prop), bool *r_free) { EnumPropertyItem *input = prop_driver_create_mapping_types; EnumPropertyItem *item = NULL; diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 6bb73416fec..8d77460e197 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -736,7 +736,7 @@ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active) /* 'Paste' the F-Modifier(s) from the buffer to the specified list * - replace: free all the existing modifiers to leave only the pasted ones */ -bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace) +bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, FCurve *curve) { FModifier *fcm; bool ok = false; @@ -745,6 +745,8 @@ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace) if (modifiers == NULL) return 0; + bool was_cyclic = curve && BKE_fcurve_is_cyclic(curve); + /* if replacing the list, free the existing modifiers */ if (replace) free_fmodifiers(modifiers); @@ -753,6 +755,8 @@ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace) for (fcm = fmodifier_copypaste_buf.first; fcm; fcm = fcm->next) { /* make a copy of it */ FModifier *fcmN = copy_fmodifier(fcm); + + fcmN->curve = curve; /* make sure the new one isn't active, otherwise the list may get several actives */ fcmN->flag &= ~FMODIFIER_FLAG_ACTIVE; @@ -762,6 +766,10 @@ bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace) ok = 1; } + /* adding or removing the Cycles modifier requires an update to handles */ + if (curve && BKE_fcurve_is_cyclic(curve) != was_cyclic) + calchandles_fcurve(curve); + /* did we succeed? */ return ok; } diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 071c5fab9d7..97f53561bfe 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -885,14 +885,14 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float /* ------------------- */ -EnumPropertyItem rna_enum_keyframe_paste_offset_items[] = { +const EnumPropertyItem rna_enum_keyframe_paste_offset_items[] = { {KEYFRAME_PASTE_OFFSET_CFRA_START, "START", 0, "Frame Start", "Paste keys starting at current frame"}, {KEYFRAME_PASTE_OFFSET_CFRA_END, "END", 0, "Frame End", "Paste keys ending at current frame"}, {KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE, "RELATIVE", 0, "Frame Relative", "Paste keys relative to the current frame when copying"}, {KEYFRAME_PASTE_OFFSET_NONE, "NONE", 0, "No Offset", "Paste keys from original time"}, {0, NULL, 0, NULL, NULL}}; -EnumPropertyItem rna_enum_keyframe_paste_merge_items[] = { +const EnumPropertyItem rna_enum_keyframe_paste_merge_items[] = { {KEYFRAME_PASTE_MERGE_MIX, "MIX", 0, "Mix", "Overlay existing with new keys"}, {KEYFRAME_PASTE_MERGE_OVER, "OVER_ALL", 0, "Overwrite All", "Replace all keys"}, {KEYFRAME_PASTE_MERGE_OVER_RANGE, "OVER_RANGE", 0, "Overwrite Range", "Overwrite keys in pasted range"}, diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index ce1379f760d..da206ac9a64 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -727,7 +727,7 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK /* Menu of All Keying Sets ----------------------------- */ /* Dynamically populate an enum of Keying Sets */ -EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Scene *scene = CTX_data_scene(C); KeyingSet *ks; diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index bbc81f522fa..cff161d9d93 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -778,7 +778,7 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) void ARMATURE_OT_symmetrize(wmOperatorType *ot) { /* subset of 'rna_enum_symmetrize_direction_items' */ - static EnumPropertyItem arm_symmetrize_direction_items[] = { + static const EnumPropertyItem arm_symmetrize_direction_items[] = { {-1, "NEGATIVE_X", 0, "-X to +X", ""}, {+1, "POSITIVE_X", 0, "+X to -X", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 51b76563c72..ab9a3e068d0 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -265,7 +265,7 @@ typedef enum eCalcRollTypes { CALC_ROLL_CURSOR, } eCalcRollTypes; -static EnumPropertyItem prop_calc_roll_types[] = { +static const EnumPropertyItem prop_calc_roll_types[] = { {0, "", 0, N_("Positive"), ""}, {CALC_ROLL_TAN_POS_X, "POS_X", 0, "Local +X Tangent", ""}, {CALC_ROLL_TAN_POS_Z, "POS_Z", 0, "Local +Z Tangent", ""}, @@ -967,7 +967,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op) void ARMATURE_OT_merge(wmOperatorType *ot) { - static EnumPropertyItem merge_types[] = { + static const EnumPropertyItem merge_types[] = { {1, "WITHIN_CHAIN", 0, "Within Chains", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index 712689396ae..0d114206c6b 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -436,7 +436,7 @@ static int armature_autoside_names_exec(bContext *C, wmOperator *op) void ARMATURE_OT_autoside_names(wmOperatorType *ot) { - static EnumPropertyItem axis_items[] = { + static const EnumPropertyItem axis_items[] = { {0, "XAXIS", 0, "X-Axis", "Left/Right"}, {1, "YAXIS", 0, "Y-Axis", "Front/Back"}, {2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"}, diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 99907e9e6ae..51c9836c741 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -743,7 +743,7 @@ static void bone_connect_to_new_parent(ListBase *edbo, EditBone *selbone, EditBo } -static EnumPropertyItem prop_editarm_make_parent_types[] = { +static const EnumPropertyItem prop_editarm_make_parent_types[] = { {ARM_PAR_CONNECT, "CONNECTED", 0, "Connected", ""}, {ARM_PAR_OFFSET, "OFFSET", 0, "Keep Offset", ""}, {0, NULL, 0, NULL, NULL} @@ -864,7 +864,7 @@ void ARMATURE_OT_parent_set(wmOperatorType *ot) -static EnumPropertyItem prop_editarm_clear_parent_types[] = { +static const EnumPropertyItem prop_editarm_clear_parent_types[] = { {1, "CLEAR", 0, "Clear Parent", ""}, {2, "DISCONNECT", 0, "Disconnect Bone", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index cbf16d38f6b..49619e13065 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -809,7 +809,7 @@ enum { SIMEDBONE_LAYER, }; -static EnumPropertyItem prop_similar_types[] = { +static const EnumPropertyItem prop_similar_types[] = { {SIMEDBONE_CHILDREN, "CHILDREN", 0, "Children", ""}, {SIMEDBONE_CHILDREN_IMMEDIATE, "CHILDREN_IMMEDIATE", 0, "Immediate children", ""}, {SIMEDBONE_SIBLINGS, "SIBLINGS", 0, "Siblings", ""}, @@ -1122,7 +1122,7 @@ static int armature_select_hierarchy_exec(bContext *C, wmOperator *op) void ARMATURE_OT_select_hierarchy(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {BONE_SELECT_PARENT, "PARENT", 0, "Select Parent", ""}, {BONE_SELECT_CHILD, "CHILD", 0, "Select Child", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 41c1c73e49c..1de7b99c6d2 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -998,7 +998,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S * the ideal would be to call this function only at the beginning of the snap operation, * or at the beginning of the operator itself */ struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), CTX_data_scene(C), CTX_data_scene_layer(C), 0, + CTX_data_main(C), CTX_data_scene(C), CTX_data_scene_layer(C), CTX_data_engine(C), 0, CTX_wm_region(C), CTX_wm_view3d(C)); float mvalf[2] = {UNPACK2(dd->mval)}; diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 7a8b89899a7..db8db2a2ded 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -675,7 +675,7 @@ static int pose_autoside_names_exec(bContext *C, wmOperator *op) void POSE_OT_autoside_names(wmOperatorType *ot) { - static EnumPropertyItem axis_items[] = { + static const EnumPropertyItem axis_items[] = { {0, "XAXIS", 0, "X-Axis", "Left/Right"}, {1, "YAXIS", 0, "Y-Axis", "Front/Back"}, {2, "ZAXIS", 0, "Z-Axis", "Top/Bottom"}, diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index c492772b282..c9b1d8613a9 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -328,7 +328,7 @@ static int group_move_exec(bContext *C, wmOperator *op) void POSE_OT_group_move(wmOperatorType *ot) { - static EnumPropertyItem group_slot_move[] = { + static const EnumPropertyItem group_slot_move[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index f11168525c0..7261ed0a11c 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -530,7 +530,7 @@ void POSELIB_OT_pose_add(wmOperatorType *ot) /* ----- */ /* can be called with C == NULL */ -static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = get_poselib_object(C); bAction *act = (ob) ? ob->poselib : NULL; @@ -786,7 +786,7 @@ static int poselib_move_exec(bContext *C, wmOperator *op) void POSELIB_OT_pose_move(wmOperatorType *ot) { PropertyRNA *prop; - static EnumPropertyItem pose_lib_pose_move[] = { + static const EnumPropertyItem pose_lib_pose_move[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index e43212c7bde..77b19130189 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -592,7 +592,7 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) void POSE_OT_select_hierarchy(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {BONE_SELECT_PARENT, "PARENT", 0, "Select Parent", ""}, {BONE_SELECT_CHILD, "CHILD", 0, "Select Child", ""}, {0, NULL, 0, NULL, NULL} @@ -841,7 +841,7 @@ static int pose_select_grouped_exec(bContext *C, wmOperator *op) void POSE_OT_select_grouped(wmOperatorType *ot) { - static EnumPropertyItem prop_select_grouped_types[] = { + static const EnumPropertyItem prop_select_grouped_types[] = { {POSE_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"}, {POSE_SEL_SAME_GROUP, "GROUP", 0, "Group", "Shared group"}, {POSE_SEL_SAME_KEYINGSET, "KEYINGSET", 0, "Keying Set", "All bones affected by active Keying Set"}, diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index f62073d56ef..e5331aff12b 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -136,7 +136,7 @@ typedef enum ePoseSlide_Channels { } ePoseSlide_Channels; /* Property enum for ePoseSlide_Channels */ -static EnumPropertyItem prop_channels_types[] = { +static const EnumPropertyItem prop_channels_types[] = { {PS_TFM_ALL, "ALL", 0, "All Properties", "All properties, including transforms, bendy bone shape, and custom properties"}, {PS_TFM_LOC, "LOC", 0, "Location", "Location only"}, @@ -155,7 +155,7 @@ typedef enum ePoseSlide_AxisLock { } ePoseSlide_AxisLock; /* Property enum for ePoseSlide_AxisLock */ -static EnumPropertyItem prop_axis_lock_types[] = { +static const EnumPropertyItem prop_axis_lock_types[] = { {0, "FREE", 0, "Free", "All axes are affected"}, {PS_LOCK_X, "X", 0, "X", "Only X-axis transforms are affected"}, {PS_LOCK_Y, "Y", 0, "Y", "Only Y-axis transforms are affected"}, @@ -1575,7 +1575,7 @@ static int pose_propagate_exec(bContext *C, wmOperator *op) void POSE_OT_propagate(wmOperatorType *ot) { - static EnumPropertyItem terminate_items[] = { + static const EnumPropertyItem terminate_items[] = { {POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behavior)"}, {POSE_PROPAGATE_NEXT_KEY, "NEXT_KEY", 0, "To Next Keyframe", diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 6327dbb8fae..4757c896650 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3596,7 +3596,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) void CURVE_OT_spline_type_set(wmOperatorType *ot) { - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {CU_POLY, "POLY", 0, "Poly", ""}, {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, // {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, @@ -3641,7 +3641,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op) void CURVE_OT_handle_type_set(wmOperatorType *ot) { /* keep in sync with graphkeys_handle_type_items */ - static EnumPropertyItem editcurve_handle_type_items[] = { + static const EnumPropertyItem editcurve_handle_type_items[] = { {HD_AUTO, "AUTOMATIC", 0, "Automatic", ""}, {HD_VECT, "VECTOR", 0, "Vector", ""}, {5, "ALIGNED", 0, "Aligned", ""}, @@ -4795,13 +4795,13 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat { Nurb *nu; - float minmax[2][3]; + float center[3]; float temp[3]; - bool nu_has_select = false; - + uint verts_len; bool changed = false; - INIT_MINMAX(minmax[0], minmax[1]); + zero_v3(center); + verts_len = 0; for (nu = editnurb->nurbs.first; nu; nu = nu->next) { int i; @@ -4810,8 +4810,8 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat for (i = 0, bezt = nu->bezt; i < nu->pntsu; i++, bezt++) { if (BEZT_ISSEL_ANY_HIDDENHANDLES(cu, bezt)) { - minmax_v3v3_v3(UNPACK2(minmax), bezt->vec[1]); - nu_has_select = true; + add_v3_v3(center, bezt->vec[1]); + verts_len += 1; } } } @@ -4820,18 +4820,18 @@ static int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, const float locat for (i = 0, bp = nu->bp; i < nu->pntsu; i++, bp++) { if (bp->f1 & SELECT) { - minmax_v3v3_v3(UNPACK2(minmax), bp->vec); - nu_has_select = true; + add_v3_v3(center, bp->vec); + verts_len += 1; } } } } - if (nu_has_select && ed_editcurve_extrude(cu, editnurb)) { - float ofs[3], center[3]; + if (verts_len && ed_editcurve_extrude(cu, editnurb)) { + float ofs[3]; int i; - mid_v3_v3v3(center, minmax[0], minmax[1]); + mul_v3_fl(center, 1.0f / (float)verts_len); sub_v3_v3v3(ofs, location_init, center); if ((cu->flag & CU_3D) == 0) { @@ -5017,7 +5017,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event) const float mval[2] = {UNPACK2(event->mval)}; struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), vc.scene, vc.scene_layer, 0, + CTX_data_main(C), vc.scene, vc.scene_layer, vc.engine, 0, vc.ar, vc.v3d); ED_transform_snap_object_project_view3d_mixed( @@ -5258,7 +5258,7 @@ static int toggle_cyclic_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS void CURVE_OT_cyclic_toggle(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {0, "CYCLIC_U", 0, "Cyclic U", ""}, {1, "CYCLIC_V", 0, "Cyclic V", ""}, {0, NULL, 0, NULL, NULL} @@ -5752,13 +5752,13 @@ static int curve_delete_exec(bContext *C, wmOperator *op) return retval; } -static EnumPropertyItem curve_delete_type_items[] = { +static const EnumPropertyItem curve_delete_type_items[] = { {CURVE_VERTEX, "VERT", 0, "Vertices", ""}, {CURVE_SEGMENT, "SEGMENT", 0, "Segments", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem *rna_curve_delete_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_curve_delete_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index f6bbff2f5d4..a1b73a54e3d 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -805,7 +805,7 @@ static int curve_draw_exec(bContext *C, wmOperator *op) const float radius_range = cps->radius_max - cps->radius_min; Nurb *nu = MEM_callocN(sizeof(Nurb), __func__); - nu->pntsv = 1; + nu->pntsv = 0; nu->resolu = cu->resolu; nu->resolv = cu->resolv; nu->flag |= CU_SMOOTH; diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index cad70443657..02b8970731c 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -1192,7 +1192,7 @@ enum { SIM_CMP_LT, }; -static EnumPropertyItem curve_prop_similar_compare_types[] = { +static const EnumPropertyItem curve_prop_similar_compare_types[] = { {SIM_CMP_EQ, "EQUAL", 0, "Equal", ""}, {SIM_CMP_GT, "GREATER", 0, "Greater", ""}, {SIM_CMP_LT, "LESS", 0, "Less", ""}, @@ -1207,7 +1207,7 @@ enum { SIMCURHAND_DIRECTION, }; -static EnumPropertyItem curve_prop_similar_types[] = { +static const EnumPropertyItem curve_prop_similar_types[] = { {SIMCURHAND_TYPE, "TYPE", 0, "Type", ""}, {SIMCURHAND_RADIUS, "RADIUS", 0, "Radius", ""}, {SIMCURHAND_WEIGHT, "WEIGHT", 0, "Weight", ""}, diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index e6447bf100c..f5a0b225974 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -564,7 +564,7 @@ static int kill_selection(Object *obedit, int ins) /* 1 == new character */ /******************* set style operator ********************/ -static EnumPropertyItem style_items[] = { +static const EnumPropertyItem style_items[] = { {CU_CHINFO_BOLD, "BOLD", 0, "Bold", ""}, {CU_CHINFO_ITALIC, "ITALIC", 0, "Italic", ""}, {CU_CHINFO_UNDERLINE, "UNDERLINE", 0, "Underline", ""}, @@ -884,7 +884,7 @@ void FONT_OT_text_paste(wmOperatorType *ot) /************************ move operator ************************/ -static EnumPropertyItem move_type_items[] = { +static const EnumPropertyItem move_type_items[] = { {LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""}, {LINE_END, "LINE_END", 0, "Line End", ""}, {PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""}, @@ -1176,7 +1176,7 @@ void FONT_OT_line_break(wmOperatorType *ot) /******************* delete operator **********************/ -static EnumPropertyItem delete_type_items[] = { +static const EnumPropertyItem delete_type_items[] = { {DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""}, {DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""}, {DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""}, @@ -1597,7 +1597,7 @@ void ED_curve_editfont_free(Object *obedit) /********************** set case operator *********************/ -static EnumPropertyItem case_items[] = { +static const EnumPropertyItem case_items[] = { {CASE_LOWER, "LOWER", 0, "Lower", ""}, {CASE_UPPER, "UPPER", 0, "Upper", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 1cee8db792a..38927cf91e1 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1851,8 +1851,6 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even void GPENCIL_OT_brush_paint(wmOperatorType *ot) { - PropertyRNA *prop; - /* identifiers */ ot->name = "Stroke Sculpt"; ot->idname = "GPENCIL_OT_brush_paint"; @@ -1869,7 +1867,9 @@ void GPENCIL_OT_brush_paint(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; /* properties */ - RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + PropertyRNA *prop; + prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Enter a mini 'sculpt-mode' if enabled, otherwise, exit after drawing a single stroke"); diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index a85a3cdf6dd..7da472c6573 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -109,20 +109,20 @@ enum { }; /* RNA enum define */ -static EnumPropertyItem prop_gpencil_convertmodes[] = { +static const EnumPropertyItem prop_gpencil_convertmodes[] = { {GP_STROKECONVERT_PATH, "PATH", ICON_CURVE_PATH, "Path", "Animation path"}, {GP_STROKECONVERT_CURVE, "CURVE", ICON_CURVE_BEZCURVE, "Bezier Curve", "Smooth Bezier curve"}, {GP_STROKECONVERT_POLY, "POLY", ICON_MESH_DATA, "Polygon Curve", "Bezier curve with straight-line segments (vector handles)"}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_gpencil_convert_timingmodes_restricted[] = { +static const EnumPropertyItem prop_gpencil_convert_timingmodes_restricted[] = { {GP_STROKECONVERT_TIMING_NONE, "NONE", 0, "No Timing", "Ignore timing"}, {GP_STROKECONVERT_TIMING_LINEAR, "LINEAR", 0, "Linear", "Simple linear timing"}, {0, NULL, 0, NULL, NULL}, }; -static EnumPropertyItem prop_gpencil_convert_timingmodes[] = { +static const EnumPropertyItem prop_gpencil_convert_timingmodes[] = { {GP_STROKECONVERT_TIMING_NONE, "NONE", 0, "No Timing", "Ignore timing"}, {GP_STROKECONVERT_TIMING_LINEAR, "LINEAR", 0, "Linear", "Simple linear timing"}, {GP_STROKECONVERT_TIMING_FULL, "FULL", 0, "Original", "Use the original timing, gaps included"}, @@ -131,7 +131,7 @@ static EnumPropertyItem prop_gpencil_convert_timingmodes[] = { {0, NULL, 0, NULL, NULL}, }; -static EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), +static const EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { if (RNA_boolean_get(ptr, "use_timing_data")) { diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 6980ad46241..93c9d21e717 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -302,7 +302,7 @@ static int gp_layer_move_exec(bContext *C, wmOperator *op) void GPENCIL_OT_layer_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_LAYER_MOVE_UP, "UP", 0, "Up", ""}, {GP_LAYER_MOVE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -831,7 +831,7 @@ static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) void GPENCIL_OT_stroke_arrange(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_STROKE_MOVE_UP, "UP", 0, "Bring Forward", ""}, {GP_STROKE_MOVE_DOWN, "DOWN", 0, "Send Backward", ""}, {GP_STROKE_MOVE_TOP, "TOP", 0, "Bring to Front", ""}, @@ -1165,7 +1165,7 @@ static int gp_brush_move_exec(bContext *C, wmOperator *op) void GPENCIL_OT_brush_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_BRUSH_MOVE_UP, "UP", 0, "Up", ""}, {GP_BRUSH_MOVE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL } @@ -1922,7 +1922,7 @@ static int gp_palettecolor_move_exec(bContext *C, wmOperator *op) void GPENCIL_OT_palettecolor_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {GP_COLOR_MOVE_UP, "UP", 0, "Up", ""}, {GP_COLOR_MOVE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 4cd628b7fd3..a82148788c8 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -653,7 +653,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) void GPENCIL_OT_paste(wmOperatorType *ot) { - static EnumPropertyItem copy_type[] = { + static const EnumPropertyItem copy_type[] = { {GP_COPY_ONLY, "COPY", 0, "Copy", ""}, {GP_COPY_MERGE, "MERGE", 0, "Merge", ""}, {0, NULL, 0, NULL, NULL} @@ -1318,7 +1318,7 @@ static int gp_delete_exec(bContext *C, wmOperator *op) void GPENCIL_OT_delete(wmOperatorType *ot) { - static EnumPropertyItem prop_gpencil_delete_types[] = { + static const EnumPropertyItem prop_gpencil_delete_types[] = { {GP_DELETEOP_POINTS, "POINTS", 0, "Points", "Delete selected points and split strokes into segments"}, {GP_DELETEOP_STROKES, "STROKES", 0, "Strokes", "Delete selected strokes"}, {GP_DELETEOP_FRAME, "FRAME", 0, "Frame", "Delete active frame"}, @@ -1738,7 +1738,7 @@ static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op) */ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot) { - static EnumPropertyItem cyclic_type[] = { + static const EnumPropertyItem cyclic_type[] = { {GP_STROKE_CYCLIC_CLOSE, "CLOSE", 0, "Close all", ""}, {GP_STROKE_CYCLIC_OPEN, "OPEN", 0, "Open all", ""}, {GP_STROKE_CYCLIC_TOGGLE, "TOGGLE", 0, "Toggle", ""}, @@ -2000,7 +2000,7 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op) void GPENCIL_OT_stroke_join(wmOperatorType *ot) { - static EnumPropertyItem join_type[] = { + static const EnumPropertyItem join_type[] = { {GP_STROKE_JOIN, "JOIN", 0, "Join", ""}, {GP_STROKE_JOINCOPY, "JOINCOPY", 0, "Join and Copy", ""}, {0, NULL, 0, NULL, NULL} @@ -2190,7 +2190,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) void GPENCIL_OT_reproject(wmOperatorType *ot) { - static EnumPropertyItem reproject_type[] = { + static const EnumPropertyItem reproject_type[] = { {GP_REPROJECT_PLANAR, "PLANAR", 0, "Planar", "Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint " "using 'Cursor' Stroke Placement"}, diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index a3734c56c59..04bcea02c9b 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -121,16 +121,22 @@ void gp_randomize_stroke(bGPDstroke *gps, bGPDbrush *brush); /* Layers Enums -------------------------------------- */ -struct EnumPropertyItem *ED_gpencil_layers_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -struct EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const struct EnumPropertyItem *ED_gpencil_layers_enum_itemf( + struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, + bool *r_free); +const struct EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf( + struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, + bool *r_free); /* Enums of GP Brushes */ -EnumPropertyItem *ED_gpencil_brushes_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), - bool *r_free); +const EnumPropertyItem *ED_gpencil_brushes_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), + bool *r_free); /* Enums of GP palettes */ -EnumPropertyItem *ED_gpencil_palettes_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), - bool *r_free); +const EnumPropertyItem *ED_gpencil_palettes_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), + bool *r_free); /* ***************************************************** */ /* Operator Defines */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e0751985bcd..0b4bdb9914d 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2758,7 +2758,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* ------------------------------- */ -static EnumPropertyItem prop_gpencil_drawmodes[] = { +static const EnumPropertyItem prop_gpencil_drawmodes[] = { {GP_PAINTMODE_DRAW, "DRAW", 0, "Draw Freehand", "Draw freehand stroke(s)"}, {GP_PAINTMODE_DRAW_STRAIGHT, "DRAW_STRAIGHT", 0, "Draw Straight Lines", "Draw straight line segment(s)"}, {GP_PAINTMODE_DRAW_POLY, "DRAW_POLY", 0, "Draw Poly Line", "Click to place endpoints of straight line segments (connected)"}, @@ -2784,8 +2784,10 @@ void GPENCIL_OT_draw(wmOperatorType *ot) ot->flag = OPTYPE_UNDO | OPTYPE_BLOCKING; /* settings for drawing */ + PropertyRNA *prop; ot->prop = RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to interpret mouse movements"); - RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); /* NOTE: wait for input is enabled by default, so that all UI code can work properly without needing users to know about this */ RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", "Wait for first click instead of painting immediately"); diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 2912a1ac4eb..07abab8af2e 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -371,7 +371,7 @@ static int gpencil_select_grouped_exec(bContext *C, wmOperator *op) void GPENCIL_OT_select_grouped(wmOperatorType *ot) { - static EnumPropertyItem prop_select_grouped_types[] = { + static const EnumPropertyItem prop_select_grouped_types[] = { {GP_SEL_SAME_LAYER, "LAYER", 0, "Layer", "Shared layers"}, {GP_SEL_SAME_COLOR, "COLOR", 0, "Color", "Shared colors"}, {0, NULL, 0, NULL, NULL} @@ -769,8 +769,7 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op) const int my = RNA_int_get(op->ptr, "y"); const int radius = RNA_int_get(op->ptr, "radius"); - const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - const bool select = (gesture_mode == GESTURE_MODAL_SELECT); + bool select = !RNA_boolean_get(op->ptr, "deselect"); GP_SpaceConversion gsc = {NULL}; rcti rect = {0}; /* for bounding rect around circle (for quicky intersection testing) */ @@ -830,10 +829,7 @@ void GPENCIL_OT_select_circle(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + WM_operator_properties_gesture_circle_select(ot); } /* ********************************************** */ @@ -843,8 +839,7 @@ static int gpencil_border_select_exec(bContext *C, wmOperator *op) { ScrArea *sa = CTX_wm_area(C); - const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - const bool select = (gesture_mode == GESTURE_MODAL_SELECT); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); const bool extend = RNA_boolean_get(op->ptr, "extend"); GP_SpaceConversion gsc = {NULL}; @@ -936,10 +931,10 @@ void GPENCIL_OT_select_border(wmOperatorType *ot) ot->idname = "GPENCIL_OT_select_border"; /* callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = gpencil_border_select_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = gpencil_select_poll; @@ -947,7 +942,7 @@ void GPENCIL_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } /* ********************************************** */ @@ -1056,9 +1051,8 @@ void GPENCIL_OT_select_lasso(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_UNDO; - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + /* properties */ + WM_operator_properties_gesture_lasso_select(ot); } /* ********************************************** */ diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index fae08bd771e..4023a343b22 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -309,7 +309,8 @@ int gp_active_palettecolor_poll(bContext *C) /* NOTE: These include an option to create a new layer and use that... */ /* Just existing layers */ -EnumPropertyItem *ED_gpencil_layers_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *ED_gpencil_layers_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { bGPdata *gpd = CTX_data_gpencil_data(C); bGPDlayer *gpl; @@ -342,7 +343,8 @@ EnumPropertyItem *ED_gpencil_layers_enum_itemf(bContext *C, PointerRNA *UNUSED(p } /* Existing + Option to add/use new layer */ -EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { bGPdata *gpd = CTX_data_gpencil_data(C); bGPDlayer *gpl; @@ -1104,7 +1106,7 @@ bool ED_gpencil_stroke_minmax( } /* Dynamic Enums of GP Brushes */ -EnumPropertyItem *ED_gpencil_brushes_enum_itemf( +const EnumPropertyItem *ED_gpencil_brushes_enum_itemf( bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { @@ -1139,7 +1141,7 @@ EnumPropertyItem *ED_gpencil_brushes_enum_itemf( } /* Dynamic Enums of GP Palettes */ -EnumPropertyItem *ED_gpencil_palettes_enum_itemf( +const EnumPropertyItem *ED_gpencil_palettes_enum_itemf( bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 797262c685b..77b2ce435c2 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -573,7 +573,7 @@ bool ANIM_fmodifiers_copy_to_buf(ListBase *modifiers, bool active); /* 'Paste' the F-Modifier(s) from the buffer to the specified list * - replace: free all the existing modifiers to leave only the pasted ones */ -bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace); +bool ANIM_fmodifiers_paste_from_buf(ListBase *modifiers, bool replace, struct FCurve *curve); /* ************************************************* */ /* ASSORTED TOOLS */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 07cdff687a3..4279e3d202c 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -222,7 +222,7 @@ int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks); struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const char *tranformKSName); /* Dynamically populate an enum of Keying Sets */ -struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); /* Check if KeyingSet can be used in the current context */ bool ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 56a91d9846c..5e3c91e15ab 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -213,7 +213,7 @@ bool ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v) /* object_select.c */ void ED_object_select_linked_by_id(struct bContext *C, struct ID *id); -struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( +const struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 1e984c15b22..55a5869c331 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -35,6 +35,7 @@ #include "DNA_space_types.h" #include "DNA_view2d_types.h" #include "DNA_view3d_types.h" +#include "DNA_workspace_types.h" #include "BLI_compiler_attrs.h" @@ -93,7 +94,8 @@ void ED_area_initialize(struct wmWindowManager *wm, struct wmWindow *win, str void ED_area_exit(struct bContext *C, struct ScrArea *sa); int ED_screen_area_active(const struct bContext *C); void ED_screen_global_areas_create(const struct bContext *C, struct wmWindow *win); -void ED_area_do_listen(struct bScreen *sc, ScrArea *sa, struct wmNotifier *note, const Scene *scene); +void ED_area_do_listen(struct bScreen *sc, ScrArea *sa, struct wmNotifier *note, Scene *scene, + struct WorkSpace *workspace); void ED_area_tag_redraw(ScrArea *sa); void ED_area_tag_redraw_regiontype(ScrArea *sa, int type); void ED_area_tag_refresh(ScrArea *sa); @@ -122,7 +124,7 @@ void ED_screen_ensure_updated(struct wmWindowManager *wm, struct wmWindow *wi void ED_screen_do_listen(struct bContext *C, struct wmNotifier *note); bool ED_screen_change(struct bContext *C, struct bScreen *sc); void ED_screen_update_after_scene_change(const struct bScreen *screen, struct Scene *scene_new); -void ED_screen_set_subwinactive(struct bContext *C, struct wmEvent *event); +void ED_screen_set_subwinactive(struct bContext *C, const struct wmEvent *event); void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen); void ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable); void ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh); @@ -140,7 +142,8 @@ void ED_screen_preview_render(const struct bScreen *screen, int size_x, int s struct WorkSpace *ED_workspace_add( struct Main *bmain, const char *name, - SceneLayer *act_render_layer) ATTR_NONNULL(); + SceneLayer *act_render_layer, + struct ViewRender *view_render) ATTR_NONNULL(); bool ED_workspace_change( struct WorkSpace *workspace_new, struct bContext *C, diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h index b802694444b..2639130acc0 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -30,6 +30,7 @@ struct BMEdge; struct BMFace; struct ListBase; +struct RenderEngineType; struct Scene; struct SceneLayer; struct Main; @@ -42,11 +43,11 @@ struct bContext; /* ED_transform_snap_object_*** API */ -typedef enum SnapSelect { +typedef enum eSnapSelect { SNAP_ALL = 0, SNAP_NOT_SELECTED = 1, SNAP_NOT_ACTIVE = 2, -} SnapSelect; +} eSnapSelect; /** used for storing multiple hits */ struct SnapObjectHitDepth { @@ -75,9 +76,9 @@ struct SnapObjectParams { typedef struct SnapObjectContext SnapObjectContext; SnapObjectContext *ED_transform_snap_object_context_create( - struct Main *bmain, struct Scene *scene, struct SceneLayer *sl, int flag); + struct Main *bmain, struct Scene *scene, struct SceneLayer *sl, struct RenderEngineType *engine, int flag); SnapObjectContext *ED_transform_snap_object_context_create_view3d( - struct Main *bmain, struct Scene *scene, struct SceneLayer *sl, int flag, + struct Main *bmain, struct Scene *scene, struct SceneLayer *sl, struct RenderEngineType *engine, int flag, /* extra args for view3d */ const struct ARegion *ar, const struct View3D *v3d); void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 0dcfd68c0f1..b55703bff0e 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -51,6 +51,7 @@ struct Nurb; struct Object; struct RV3DMatrixStore; struct RegionView3D; +struct RenderEngineType; struct Scene; struct SceneLayer; struct ScrArea; @@ -68,6 +69,7 @@ struct wmWindowManager; struct GPUFX; struct GPUOffScreen; struct GPUFXSettings; +struct WorkSpace; enum eGPUFXFlags; /* for derivedmesh drawing callbacks, for view3d_select, .... */ @@ -75,6 +77,7 @@ typedef struct ViewContext { struct Depsgraph *depsgraph; struct Scene *scene; struct SceneLayer *scene_layer; + struct RenderEngineType *engine; struct Object *obact; struct Object *obedit; struct ARegion *ar; @@ -369,9 +372,11 @@ void ED_draw_object_facemap(const struct EvaluationContext *eval_ctx, struct Sc bool ED_view3d_context_activate(struct bContext *C); void ED_view3d_draw_offscreen_init( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d); + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct SceneLayer *sl, struct View3D *v3d); void ED_view3d_draw_offscreen( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct SceneLayer *scene_layer, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, struct GPUFX *fx, struct GPUFXSettings *fx_settings, struct GPUOffScreen *ofs); @@ -380,12 +385,14 @@ void ED_view3d_draw_setup_view( float viewmat[4][4], float winmat[4][4], const struct rcti *rect); struct ImBuf *ED_view3d_draw_offscreen_imbuf( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct View3D *v3d, struct ARegion *ar, + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct SceneLayer *scene_layer, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( - const struct EvaluationContext *eval_ctx, struct Scene *scene, struct SceneLayer *sl, struct Object *camera, int width, int height, + const struct EvaluationContext *eval_ctx, struct Scene *scene, + struct SceneLayer *scene_layer, struct Object *camera, int width, int height, unsigned int flag, int drawtype, bool use_solid_tex, bool use_gpencil, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index c7d9cb27149..a3471e5c599 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3346,7 +3346,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu uiBut *but = (uiBut *)but_p; /* see comment in ui_item_enum_expand, re: uiname */ - EnumPropertyItem *item, *item_array; + const EnumPropertyItem *item, *item_array; bool free; uiLayout *split, *column = NULL; @@ -3456,9 +3456,8 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu UI_block_layout_set_current(block, layout); if (free) { - MEM_freeN(item_array); + MEM_freeN((void *)item_array); } - BLI_assert((block->flag & UI_BLOCK_IS_FLIP) == 0); block->flag |= UI_BLOCK_IS_FLIP; } @@ -3489,7 +3488,7 @@ static uiBut *ui_def_but_rna( /* use rna values if parameters are not specified */ if ((proptype == PROP_ENUM) && ELEM(type, UI_BTYPE_MENU, UI_BTYPE_ROW, UI_BTYPE_LISTROW)) { /* UI_BTYPE_MENU is handled a little differently here */ - EnumPropertyItem *item; + const EnumPropertyItem *item; int value; bool free; int i; @@ -3531,7 +3530,7 @@ static uiBut *ui_def_but_rna( } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } } else { @@ -4493,7 +4492,7 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c } else { PointerRNA *ptr = UI_but_operator_ptr_get(but); /* Will create it if needed! */ - EnumPropertyItem *item, *item_array; + const EnumPropertyItem *item, *item_array; bool do_free; RNA_property_enum_items_gettexted((bContext *)C, ptr, prop, &item_array, NULL, &do_free); @@ -4506,8 +4505,9 @@ static void operator_enum_search_cb(const struct bContext *C, void *but, const c } } - if (do_free) - MEM_freeN(item_array); + if (do_free) { + MEM_freeN((void *)item_array); + } } } @@ -4581,7 +4581,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) va_list args; uiStringInfo *si; - EnumPropertyItem *items = NULL, *item = NULL; + const EnumPropertyItem *items = NULL, *item = NULL; int totitems; bool free_items = false; @@ -4760,8 +4760,9 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...) } va_end(args); - if (free_items && items) - MEM_freeN(items); + if (free_items && items) { + MEM_freeN((void *)items); + } } /* Program Init/Exit */ diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index 2695d4c9dd9..5f690794028 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -92,7 +92,7 @@ enum { wmKeyMap *eyedropper_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {EYE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {EYE_MODAL_SAMPLE_CONFIRM, "SAMPLE_CONFIRM", 0, "Confirm Sampling", ""}, {EYE_MODAL_SAMPLE_BEGIN, "SAMPLE_BEGIN", 0, "Start Sampling", ""}, diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index ce1aad370d5..e70350e54e3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -2826,8 +2826,8 @@ static bool ui_textedit_insert_ascii(uiBut *but, uiHandleButtonData *data, char } static void ui_textedit_move( - uiBut *but, uiHandleButtonData *data, strCursorJumpDirection direction, - const bool select, strCursorJumpType jump) + uiBut *but, uiHandleButtonData *data, eStrCursorJumpDirection direction, + const bool select, eStrCursorJumpType jump) { const char *str = data->str; const int len = strlen(str); @@ -2903,7 +2903,7 @@ static void ui_textedit_move( } } -static bool ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, strCursorJumpType jump) +static bool ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, eStrCursorJumpType jump) { char *str = data->str; const int len = strlen(str); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index ac07756b372..d048324d35e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1195,7 +1195,7 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id) else { Object *ob = CTX_data_active_object(C); SpaceImage *sima; - EnumPropertyItem *items = NULL; + const EnumPropertyItem *items = NULL; int tool = PAINT_TOOL_DRAW, mode = 0; /* XXX: this is not nice, should probably make brushes diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 8f69df9404d..485d0ed879e 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -604,7 +604,7 @@ static void ui_item_enum_expand( uiBut *but; uiLayout *layout_radial = NULL; - EnumPropertyItem *item, *item_array; + const EnumPropertyItem *item, *item_array; const char *name; int itemw, icon, value; bool free; @@ -665,7 +665,7 @@ static void ui_item_enum_expand( UI_block_layout_set_current(block, layout); if (free) { - MEM_freeN(item_array); + MEM_freeN((void *)item_array); } } @@ -880,7 +880,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i static const char *ui_menu_enumpropname(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int retval) { - EnumPropertyItem *item; + const EnumPropertyItem *item; bool free; const char *name; @@ -893,7 +893,7 @@ static const char *ui_menu_enumpropname(uiLayout *layout, PointerRNA *ptr, Prope } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } return name; @@ -1079,7 +1079,7 @@ void uiItemsFullEnumO( BLI_assert((prop == NULL) || (RNA_property_type(prop) == PROP_ENUM)); if (prop && RNA_property_type(prop) == PROP_ENUM) { - EnumPropertyItem *item_array = NULL; + const EnumPropertyItem *item_array = NULL; int totitem; bool free; @@ -1096,7 +1096,7 @@ void uiItemsFullEnumO( item_array, totitem); if (free) { - MEM_freeN(item_array); + MEM_freeN((void *)item_array); } /* intentionally don't touch UI_BLOCK_IS_FLIP here, @@ -1152,7 +1152,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char PointerRNA ptr; PropertyRNA *prop; - EnumPropertyItem *item; + const EnumPropertyItem *item; int value; bool free; @@ -1166,14 +1166,14 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free); if (item == NULL || RNA_enum_value_from_id(item, value_str, &value) == 0) { if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } RNA_warning("%s.%s, enum %s not found", RNA_struct_identifier(ptr.type), propname, value_str); return; } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } } else { @@ -1273,7 +1273,7 @@ static void ui_item_rna_size( } else if (type == PROP_ENUM) { /* Find the longest enum item name, instead of using a dummy text! */ - EnumPropertyItem *item, *item_array; + const EnumPropertyItem *item, *item_array; bool free; RNA_property_enum_items_gettexted(layout->root->block->evil_C, ptr, prop, &item_array, NULL, &free); @@ -1283,7 +1283,7 @@ static void ui_item_rna_size( } } if (free) { - MEM_freeN(item_array); + MEM_freeN((void *)item_array); } } } @@ -1502,7 +1502,7 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); - EnumPropertyItem *item; + const EnumPropertyItem *item; int ivalue, a; bool free; @@ -1516,7 +1516,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr if (!RNA_enum_value_from_id(item, value, &ivalue)) { if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } ui_item_disabled(layout, propname); RNA_warning("enum property value not found: %s", value); @@ -1534,7 +1534,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } } @@ -1557,7 +1557,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname return; } else { - EnumPropertyItem *item; + const EnumPropertyItem *item; int totitem, i; bool free; uiLayout *split = uiLayoutSplit(layout, 0.0f, false); @@ -1590,7 +1590,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 7770e45e2ba..c3759e232b0 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1321,7 +1321,7 @@ static int ui_panel_drag_collapse_handler(bContext *C, const wmEvent *event, voi static void ui_panel_drag_collapse_handler_add(const bContext *C, const bool was_open) { wmWindow *win = CTX_wm_window(C); - wmEvent *event = win->eventstate; + const wmEvent *event = win->eventstate; uiPanelDragCollapseHandle *dragcol_data = MEM_mallocN(sizeof(*dragcol_data), __func__); dragcol_data->was_first_open = was_open; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0a32b1febf4..5ef5b677f51 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1291,7 +1291,7 @@ static uiLayout *draw_modifier( /* When Modifier is a simulation, show button to switch to context rather than the delete button. */ if (modifier_can_delete(md) && (!modifier_is_simulation(md) || - STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME))) + STREQ(scene->view_render.engine_id, RE_engine_id_BLENDER_GAME))) { uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove"); } @@ -2019,7 +2019,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) uiBlock *block; uiBut *but; int icon, value; - EnumPropertyItem *item; + const EnumPropertyItem *item; int a; bool free; int w, h; @@ -2059,7 +2059,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) UI_block_direction_set(block, UI_DIR_DOWN); if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } return block; @@ -2072,7 +2072,7 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); IconViewMenuArgs *cb_args; - EnumPropertyItem *items; + const EnumPropertyItem *items; uiBlock *block; uiBut *but; int value, icon = ICON_NONE, tot_items; @@ -2100,7 +2100,7 @@ void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW); if (free_items) { - MEM_freeN(items); + MEM_freeN((void *)items); } } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index fa2c1f25cfc..b271b0b5bc6 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1223,7 +1223,6 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) View2D *v2d = &ar->v2d; rctf rect; rctf cur_new = v2d->cur; - int gesture_mode; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); /* convert coordinates of rect to 'tot' rect coordinates */ @@ -1231,9 +1230,9 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) UI_view2d_region_to_view_rctf(v2d, &rect, &rect); /* check if zooming in/out view */ - gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool zoom_in = !RNA_boolean_get(op->ptr, "zoom_out"); - if (gesture_mode == GESTURE_MODAL_IN) { + if (zoom_in) { /* zoom in: * - 'cur' rect will be defined by the coordinates of the border region * - just set the 'cur' rect to have the same coordinates as the border region @@ -1248,8 +1247,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) cur_new.ymax = rect.ymax; } } - else { /* if (gesture_mode == GESTURE_MODAL_OUT) */ - + else { /* zoom out: * - the current 'cur' rect coordinates are going to end up where the 'rect' ones are, * but the 'cur' rect coordinates will need to be adjusted to take in more of the view @@ -1289,15 +1287,15 @@ static void VIEW2D_OT_zoom_border(wmOperatorType *ot) ot->idname = "VIEW2D_OT_zoom_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = view_borderzoom_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = view_zoom_poll; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border_zoom(ot); } #ifdef WITH_INPUT_NDOF @@ -1545,7 +1543,7 @@ static void VIEW2D_OT_smoothview(wmOperatorType *ot) ot->flag = OPTYPE_INTERNAL; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border(ot); } /* ********************************************************* */ diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index f9297c58cbb..9e79ca5b0e3 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -315,13 +315,13 @@ void WM_OT_collada_export(wmOperatorType *ot) { struct StructRNA *func = ot->srna; - static EnumPropertyItem prop_bc_export_mesh_type[] = { + static const EnumPropertyItem prop_bc_export_mesh_type[] = { {BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"}, {BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_bc_export_transformation_type[] = { + static const EnumPropertyItem prop_bc_export_transformation_type[] = { {BC_TRANSFORMATION_TYPE_MATRIX, "matrix", 0, "Matrix", "Use <matrix> to specify transformations"}, {BC_TRANSFORMATION_TYPE_TRANSROTLOC, "transrotloc", 0, "TransRotLoc", "Use <translate>, <rotate>, <scale> to specify transformations"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index d299bba93c3..c170fbde7dc 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -1910,7 +1910,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op) void MASK_OT_handle_type_set(wmOperatorType *ot) { - static EnumPropertyItem editcurve_handle_type_items[] = { + static const EnumPropertyItem editcurve_handle_type_items[] = { {HD_AUTO, "AUTO", 0, "Auto", ""}, {HD_VECT, "VECTOR", 0, "Vector", ""}, {HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""}, @@ -2152,7 +2152,7 @@ static int mask_layer_move_exec(bContext *C, wmOperator *op) void MASK_OT_layer_move(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index a4268bddaf5..9f2f6de8a09 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -408,8 +408,9 @@ static int border_select_exec(bContext *C, wmOperator *op) rcti rect; rctf rectf; - int mode; - bool changed = false, extend; + bool changed = false; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); /* get rectangle from operator */ WM_operator_properties_border_to_rcti(op, &rect); @@ -417,9 +418,6 @@ static int border_select_exec(bContext *C, wmOperator *op) ED_mask_point_pos(sa, ar, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin); ED_mask_point_pos(sa, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax); - mode = RNA_int_get(op->ptr, "gesture_mode"); - extend = RNA_boolean_get(op->ptr, "extend"); - /* do actual selection */ for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { MaskSpline *spline; @@ -439,8 +437,8 @@ static int border_select_exec(bContext *C, wmOperator *op) /* TODO: uw? */ if (BLI_rctf_isect_pt_v(&rectf, point_deform->bezt.vec[1])) { - BKE_mask_point_select_set(point, mode == GESTURE_MODAL_SELECT); - BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, mode == GESTURE_MODAL_SELECT); + BKE_mask_point_select_set(point, select); + BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, select); } else if (!extend) { BKE_mask_point_select_set(point, false); @@ -471,16 +469,16 @@ void MASK_OT_select_border(wmOperatorType *ot) ot->idname = "MASK_OT_select_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = border_select_exec; - ot->modal = WM_border_select_modal; + ot->modal = WM_gesture_border_modal; ot->poll = ED_maskedit_mask_poll; /* flags */ ot->flag = OPTYPE_UNDO; /* properties */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } static bool do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, short select) @@ -580,9 +578,7 @@ void MASK_OT_select_lasso(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + WM_operator_properties_gesture_lasso_select(ot); } /********************** circle select operator *********************/ @@ -608,15 +604,15 @@ static int circle_select_exec(bContext *C, wmOperator *op) int i; float zoomx, zoomy, offset[2], ellipse[2]; - int x, y, radius, width, height, mode; + int width, height; bool changed = false; /* get operator properties */ - x = RNA_int_get(op->ptr, "x"); - y = RNA_int_get(op->ptr, "y"); - radius = RNA_int_get(op->ptr, "radius"); + const int x = RNA_int_get(op->ptr, "x"); + const int y = RNA_int_get(op->ptr, "y"); + const int radius = RNA_int_get(op->ptr, "radius"); - mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); /* compute ellipse and position in unified coordinates */ ED_mask_get_size(sa, &width, &height); @@ -644,8 +640,8 @@ static int circle_select_exec(bContext *C, wmOperator *op) MaskSplinePoint *point_deform = &points_array[i]; if (mask_spline_point_inside_ellipse(&point_deform->bezt, offset, ellipse)) { - BKE_mask_point_select_set(point, mode == GESTURE_MODAL_SELECT); - BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, mode == GESTURE_MODAL_SELECT); + BKE_mask_point_select_set(point, select); + BKE_mask_point_select_set_handle(point, MASK_WHICH_HANDLE_BOTH, select); changed = true; } @@ -681,10 +677,7 @@ void MASK_OT_select_circle(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + WM_operator_properties_gesture_circle_select(ot); } static int mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event) diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 6b4f3516338..2af05a9ad8d 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -596,7 +596,7 @@ void MESH_OT_bevel(wmOperatorType *ot) { PropertyRNA *prop; - static EnumPropertyItem offset_type_items[] = { + static const EnumPropertyItem offset_type_items[] = { {BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"}, {BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"}, {BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"}, diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 9bc01687122..9b6c7c08b13 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -518,40 +518,46 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w ViewContext vc; BMVert *v1; BMIter iter; - float min[3], max[3]; - bool done = false; + float center[3]; + uint verts_len; bool use_proj; em_setup_viewcontext(C, &vc); + invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); + ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d); use_proj = ((vc.scene->toolsettings->snap_flag & SCE_SNAP) && (vc.scene->toolsettings->snap_mode == SCE_SNAP_MODE_FACE)); - INIT_MINMAX(min, max); + zero_v3(center); + verts_len = 0; BM_ITER_MESH (v1, &iter, vc.em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v1, BM_ELEM_SELECT)) { - minmax_v3v3_v3(min, max, v1->co); - done = true; + add_v3_v3(center, v1->co); + verts_len += 1; } } /* call extrude? */ - if (done) { + if (verts_len != 0) { const char extrude_htype = edbm_extrude_htype_from_em_select(vc.em); const bool rot_src = RNA_boolean_get(op->ptr, "rotate_source"); BMEdge *eed; - float vec[3], cent[3], mat[3][3]; + float mat[3][3]; + float vec[3], ofs[3]; float nor[3] = {0.0, 0.0, 0.0}; /* 2D normal calc */ const float mval_f[2] = {(float)event->mval[0], (float)event->mval[1]}; + mul_v3_fl(center, 1.0f / (float)verts_len); + /* check for edges that are half selected, use for rotation */ - done = false; + bool done = false; BM_ITER_MESH (eed, &iter, vc.em->bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { float co1[2], co2[2]; @@ -592,21 +598,20 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w } /* center */ - mid_v3_v3v3(cent, min, max); - copy_v3_v3(min, cent); + copy_v3_v3(ofs, center); - mul_m4_v3(vc.obedit->obmat, min); /* view space */ - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, min, event->mval, min); - mul_m4_v3(vc.obedit->imat, min); // back in object space + mul_m4_v3(vc.obedit->obmat, ofs); /* view space */ + ED_view3d_win_to_3d_int(vc.v3d, vc.ar, ofs, event->mval, ofs); + mul_m4_v3(vc.obedit->imat, ofs); // back in object space - sub_v3_v3(min, cent); + sub_v3_v3(ofs, center); /* calculate rotation */ unit_m3(mat); if (done) { float angle; - normalize_v3_v3(vec, min); + normalize_v3_v3(vec, ofs); angle = angle_normalized_v3v3(vec, nor); @@ -626,7 +631,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w if (rot_src) { EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v matrix=%m3", - BM_ELEM_SELECT, cent, mat); + BM_ELEM_SELECT, center, mat); /* also project the source, for retopo workflow */ if (use_proj) @@ -635,22 +640,21 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w edbm_extrude_ex(vc.obedit, vc.em, extrude_htype, BM_ELEM_SELECT, true, true); EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v matrix=%m3", - BM_ELEM_SELECT, cent, mat); + BM_ELEM_SELECT, center, mat); EDBM_op_callf(vc.em, op, "translate verts=%hv vec=%v", - BM_ELEM_SELECT, min); + BM_ELEM_SELECT, ofs); } else { - const float *curs = ED_view3d_cursor3d_get(vc.scene, vc.v3d); + const float *cursor = ED_view3d_cursor3d_get(vc.scene, vc.v3d); BMOperator bmop; BMOIter oiter; - - copy_v3_v3(min, curs); - ED_view3d_win_to_3d_int(vc.v3d, vc.ar, min, event->mval, min); - invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); - mul_m4_v3(vc.obedit->imat, min); // back in object space + copy_v3_v3(center, cursor); + ED_view3d_win_to_3d_int(vc.v3d, vc.ar, center, event->mval, center); + + mul_m4_v3(vc.obedit->imat, center); // back in object space - EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", min); + EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", center); BMO_op_exec(vc.em->bm, &bmop); BMO_ITER (v1, &oiter, bmop.slots_out, "vert.out", BM_VERT) { diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c index 49bfde77032..3498c6246d7 100644 --- a/source/blender/editors/mesh/editmesh_intersect.c +++ b/source/blender/editors/mesh/editmesh_intersect.c @@ -214,7 +214,7 @@ static int edbm_intersect_exec(bContext *C, wmOperator *op) void MESH_OT_intersect(struct wmOperatorType *ot) { - static EnumPropertyItem isect_mode_items[] = { + static const EnumPropertyItem isect_mode_items[] = { {ISECT_SEL, "SELECT", 0, "Self Intersect", "Self intersect selected faces"}, {ISECT_SEL_UNSEL, "SELECT_UNSELECT", 0, "Selected/Unselected", @@ -222,7 +222,7 @@ void MESH_OT_intersect(struct wmOperatorType *ot) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem isect_separate_items[] = { + static const EnumPropertyItem isect_separate_items[] = { {ISECT_SEPARATE_ALL, "ALL", 0, "All", "Separate all geometry from intersections"}, {ISECT_SEPARATE_CUT, "CUT", 0, "Cut", @@ -298,7 +298,7 @@ static int edbm_intersect_boolean_exec(bContext *C, wmOperator *op) void MESH_OT_intersect_boolean(struct wmOperatorType *ot) { - static EnumPropertyItem isect_boolean_operation_items[] = { + static const EnumPropertyItem isect_boolean_operation_items[] = { {BMESH_ISECT_BOOLEAN_ISECT, "INTERSECT", 0, "Intersect", ""}, {BMESH_ISECT_BOOLEAN_UNION, "UNION", 0, "Union", ""}, {BMESH_ISECT_BOOLEAN_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""}, diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 433163b2fab..c0501078424 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -274,6 +274,8 @@ static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f); static void knifetool_free_bmbvh(KnifeTool_OpData *kcd); +static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event); + static void knife_update_header(bContext *C, wmOperator *op, KnifeTool_OpData *kcd) { char header[UI_MAX_DRAW_STR]; @@ -2679,6 +2681,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event) { const bool only_select = RNA_boolean_get(op->ptr, "only_selected"); const bool cut_through = !RNA_boolean_get(op->ptr, "use_occlude_geometry"); + const bool wait_for_input = RNA_boolean_get(op->ptr, "wait_for_input"); KnifeTool_OpData *kcd; @@ -2706,6 +2709,18 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event) knifetool_update_mval_i(kcd, event->mval); + if (wait_for_input == false) { + /* Avoid copy-paste logic. */ + wmEvent event_modal = { + .prevval = KM_NOTHING, + .type = EVT_MODAL_MAP, + .val = KNF_MODAL_ADD_CUT, + }; + int ret = knifetool_modal(C, op, &event_modal); + BLI_assert(ret == OPERATOR_RUNNING_MODAL); + UNUSED_VARS_NDEBUG(ret); + } + knife_update_header(C, op, kcd); return OPERATOR_RUNNING_MODAL; @@ -2713,7 +2728,7 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event) wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {KNF_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {KNF_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {KNF_MODAL_MIDPOINT_ON, "SNAP_MIDPOINTS_ON", 0, "Snap To Midpoints On", ""}, @@ -2973,8 +2988,13 @@ void MESH_OT_knife_tool(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; + /* properties */ + PropertyRNA *prop; RNA_def_boolean(ot->srna, "use_occlude_geometry", true, "Occlude Geometry", "Only cut the front most geometry"); RNA_def_boolean(ot->srna, "only_selected", false, "Only Selected", "Only cut selected geometry"); + + prop = RNA_def_boolean(ot->srna, "wait_for_input", true, "Wait for Input", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); } diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 7fe4e58d2e0..4e0be704298 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -970,7 +970,7 @@ static int unified_findnearest( /* **************** SIMILAR "group" SELECTS. FACE, EDGE AND VERTEX ************** */ -static EnumPropertyItem prop_similar_compare_types[] = { +static const EnumPropertyItem prop_similar_compare_types[] = { {SIM_CMP_EQ, "EQUAL", 0, "Equal", ""}, {SIM_CMP_GT, "GREATER", 0, "Greater", ""}, {SIM_CMP_LT, "LESS", 0, "Less", ""}, @@ -978,7 +978,7 @@ static EnumPropertyItem prop_similar_compare_types[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_similar_types[] = { +static const EnumPropertyItem prop_similar_types[] = { {SIMVERT_NORMAL, "NORMAL", 0, "Normal", ""}, {SIMVERT_FACE, "FACE", 0, "Amount of Adjacent Faces", ""}, {SIMVERT_VGROUP, "VGROUP", 0, "Vertex Groups", ""}, @@ -1152,7 +1152,7 @@ static int edbm_select_similar_exec(bContext *C, wmOperator *op) else return similar_face_select_exec(C, op); } -static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), +static const EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *obedit; @@ -1347,14 +1347,14 @@ void MESH_OT_select_mode(wmOperatorType *ot) { PropertyRNA *prop; - static EnumPropertyItem elem_items[] = { + static const EnumPropertyItem elem_items[] = { {SCE_SELECT_VERTEX, "VERT", ICON_VERTEXSEL, "Vertices", ""}, {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edges", ""}, {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Faces", ""}, {0, NULL, 0, NULL, NULL}, }; - static EnumPropertyItem actions_items[] = { + static const EnumPropertyItem actions_items[] = { {0, "DISABLE", 0, "Disable", "Disable selected markers"}, {1, "ENABLE", 0, "Enable", "Enable selected markers"}, {2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"}, @@ -3820,14 +3820,14 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) void MESH_OT_select_axis(wmOperatorType *ot) { - static EnumPropertyItem axis_mode_items[] = { + static const EnumPropertyItem axis_mode_items[] = { {0, "POSITIVE", 0, "Positive Axis", ""}, {1, "NEGATIVE", 0, "Negative Axis", ""}, {-1, "ALIGNED", 0, "Aligned Axis", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem axis_items_xyz[] = { + static const EnumPropertyItem axis_items_xyz[] = { {0, "X_AXIS", 0, "X Axis", ""}, {1, "Y_AXIS", 0, "Y Axis", ""}, {2, "Z_AXIS", 0, "Z Axis", ""}, diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index b6434e58b1e..d80cca1071f 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -116,7 +116,7 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op) } /* Note, these values must match delete_mesh() event values */ -static EnumPropertyItem prop_mesh_cornervert_types[] = { +static const EnumPropertyItem prop_mesh_cornervert_types[] = { {SUBD_CORNER_INNERVERT, "INNERVERT", 0, "Inner Vert", ""}, {SUBD_CORNER_PATH, "PATH", 0, "Path", ""}, {SUBD_CORNER_STRAIGHT_CUT, "STRAIGHT_CUT", 0, "Straight Cut", ""}, @@ -175,7 +175,7 @@ struct EdgeRingOpSubdProps { static void mesh_operator_edgering_props(wmOperatorType *ot, const int cuts_min, const int cuts_default) { /* Note, these values must match delete_mesh() event values */ - static EnumPropertyItem prop_subd_edgering_types[] = { + static const EnumPropertyItem prop_subd_edgering_types[] = { {SUBD_RING_INTERP_LINEAR, "LINEAR", 0, "Linear", ""}, {SUBD_RING_INTERP_PATH, "PATH", 0, "Blend Path", ""}, {SUBD_RING_INTERP_SURF, "SURFACE", 0, "Blend Surface", ""}, @@ -309,7 +309,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, BMEditMesh *em) ED_view3d_init_mats_rv3d(obedit, ar->regiondata); struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), CTX_data_scene(C), CTX_data_scene_layer(C), 0, + CTX_data_main(C), CTX_data_scene(C), CTX_data_scene_layer(C), CTX_data_engine(C), 0, ar, CTX_wm_view3d(C)); BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) { @@ -395,7 +395,7 @@ static int edbm_delete_exec(bContext *C, wmOperator *op) void MESH_OT_delete(wmOperatorType *ot) { - static EnumPropertyItem prop_mesh_delete_types[] = { + static const EnumPropertyItem prop_mesh_delete_types[] = { {MESH_DELETE_VERT, "VERT", 0, "Vertices", ""}, {MESH_DELETE_EDGE, "EDGE", 0, "Edges", ""}, {MESH_DELETE_FACE, "FACE", 0, "Faces", ""}, @@ -2271,7 +2271,7 @@ static int edbm_merge_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem merge_type_items[] = { +static const EnumPropertyItem merge_type_items[] = { {MESH_MERGE_FIRST, "FIRST", 0, "At First", ""}, {MESH_MERGE_LAST, "LAST", 0, "At Last", ""}, {MESH_MERGE_CENTER, "CENTER", 0, "At Center", ""}, @@ -2280,7 +2280,7 @@ static EnumPropertyItem merge_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *obedit; EnumPropertyItem *item = NULL; @@ -2543,7 +2543,7 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em; @@ -2695,7 +2695,7 @@ void MESH_OT_solidify(wmOperatorType *ot) #define KNIFE_MIDPOINT 2 #define KNIFE_MULTICUT 3 -static EnumPropertyItem knife_items[] = { +static const EnumPropertyItem knife_items[] = { {KNIFE_EXACT, "EXACT", 0, "Exact", ""}, {KNIFE_MIDPOINT, "MIDPOINTS", 0, "Midpoints", ""}, {KNIFE_MULTICUT, "MULTICUT", 0, "Multicut", ""}, @@ -2981,8 +2981,6 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) void MESH_OT_knife_cut(wmOperatorType *ot) { - PropertyRNA *prop; - ot->name = "Knife Cut"; ot->description = "Cut selected edges and faces into parts"; ot->idname = "MESH_OT_knife_cut"; @@ -2995,10 +2993,13 @@ void MESH_OT_knife_cut(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + + /* properties */ + PropertyRNA *prop; + prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + RNA_def_enum(ot->srna, "type", knife_items, KNIFE_EXACT, "Type", ""); - prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); /* internal */ RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, BC_NUMCURSORS, "Cursor", "", 0, BC_NUMCURSORS); @@ -3383,7 +3384,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) void MESH_OT_separate(wmOperatorType *ot) { - static EnumPropertyItem prop_separate_types[] = { + static const EnumPropertyItem prop_separate_types[] = { {MESH_SEPARATE_SELECTED, "SELECTED", 0, "Selection", ""}, {MESH_SEPARATE_MATERIAL, "MATERIAL", 0, "By Material", ""}, {MESH_SEPARATE_LOOSE, "LOOSE", 0, "By loose parts", ""}, @@ -3849,7 +3850,7 @@ static int edbm_poke_face_exec(bContext *C, wmOperator *op) void MESH_OT_poke(wmOperatorType *ot) { - static EnumPropertyItem poke_center_modes[] = { + static const EnumPropertyItem poke_center_modes[] = { {BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED", 0, "Weighted Mean", "Weighted Mean Face Center"}, {BMOP_POKE_MEAN, "MEAN", 0, "Mean", "Mean Face Center"}, {BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face Bounds Center"}, @@ -5151,7 +5152,7 @@ static void edbm_sort_elements_ui(bContext *C, wmOperator *op) void MESH_OT_sort_elements(wmOperatorType *ot) { - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {SRT_VIEW_ZAXIS, "VIEW_ZAXIS", 0, "View Z Axis", "Sort selected elements from farthest to nearest one in current view"}, {SRT_VIEW_XAXIS, "VIEW_XAXIS", 0, "View X Axis", @@ -5168,7 +5169,7 @@ void MESH_OT_sort_elements(wmOperatorType *ot) {0, NULL, 0, NULL, NULL}, }; - static EnumPropertyItem elem_items[] = { + static const EnumPropertyItem elem_items[] = { {BM_VERT, "VERT", 0, "Vertices", ""}, {BM_EDGE, "EDGE", 0, "Edges", ""}, {BM_FACE, "FACE", 0, "Faces", ""}, @@ -5425,7 +5426,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) void MESH_OT_bridge_edge_loops(wmOperatorType *ot) { - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {MESH_BRIDGELOOP_SINGLE, "SINGLE", 0, "Open Loop", ""}, {MESH_BRIDGELOOP_CLOSED, "CLOSED", 0, "Closed Loop", ""}, {MESH_BRIDGELOOP_PAIRS, "PAIRS", 0, "Loop Pairs", ""}, diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 47d354ac72a..175b40d72ff 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -188,7 +188,7 @@ enum { SIMMBALL_ROTATION }; -static EnumPropertyItem prop_similar_types[] = { +static const EnumPropertyItem prop_similar_types[] = { {SIMMBALL_TYPE, "TYPE", 0, "Type", ""}, {SIMMBALL_RADIUS, "RADIUS", 0, "Radius", ""}, {SIMMBALL_STIFFNESS, "STIFFNESS", 0, "Stiffness", ""}, diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 7451268eac9..936f9b346b4 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -125,7 +125,7 @@ /* this is an exact copy of the define in rna_lamp.c * kept here because of linking order. * Icons are only defined here */ -EnumPropertyItem rna_enum_lamp_type_items[] = { +const EnumPropertyItem rna_enum_lamp_type_items[] = { {LA_LOCAL, "POINT", ICON_LAMP_POINT, "Point", "Omnidirectional point light source"}, {LA_SUN, "SUN", ICON_LAMP_SUN, "Sun", "Constant direction parallel ray light source"}, {LA_SPOT, "SPOT", ICON_LAMP_SPOT, "Spot", "Directional cone light source"}, @@ -135,7 +135,7 @@ EnumPropertyItem rna_enum_lamp_type_items[] = { }; /* copy from rna_object_force.c */ -static EnumPropertyItem field_type_items[] = { +static const EnumPropertyItem field_type_items[] = { {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", ""}, {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", ""}, {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", ""}, @@ -1073,7 +1073,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) group = (Group *)BKE_libblock_find_name(ID_GR, name); if (0 == RNA_struct_property_is_set(op->ptr, "location")) { - wmEvent *event = CTX_wm_window(C)->eventstate; + const wmEvent *event = CTX_wm_window(C)->eventstate; ARegion *ar = CTX_wm_region(C); const int mval[2] = {event->x - ar->winrct.xmin, event->y - ar->winrct.ymin}; @@ -1459,8 +1459,9 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, ob_dst->totcol = 0; } - BKE_collection_object_add_from(scene, ob_src, ob_dst); + BKE_collection_object_add_from(scene, base->object, ob_dst); base_dst = BKE_scene_layer_base_find(sl, ob_dst); + BLI_assert(base_dst != NULL); BKE_scene_object_base_flag_sync_from_base(base_dst); @@ -1627,7 +1628,7 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot) /**************************** Convert **************************/ -static EnumPropertyItem convert_target_items[] = { +static const EnumPropertyItem convert_target_items[] = { {OB_CURVE, "CURVE", ICON_OUTLINER_OB_CURVE, "Curve from Mesh/Text", ""}, {OB_MESH, "MESH", ICON_OUTLINER_OB_MESH, "Mesh from Curve/Meta/Surf/Text", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 1a4abec4d20..0174a307c16 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -89,7 +89,7 @@ typedef struct BakeAPIRender { ReportList *reports; ListBase selected_objects; - ScenePassType pass_type; + eScenePassType pass_type; int pass_filter; int margin; @@ -103,7 +103,7 @@ typedef struct BakeAPIRender { float cage_extrusion; int normal_space; - BakeNormalSwizzle normal_swizzle[3]; + eBakeNormalSwizzle normal_swizzle[3]; char uv_layer[MAX_CUSTOMDATA_LAYER_NAME]; char custom_cage[MAX_NAME]; @@ -342,7 +342,7 @@ static bool write_external_bake_pixels( return ok; } -static bool is_noncolor_pass(ScenePassType pass_type) +static bool is_noncolor_pass(eScenePassType pass_type) { return ELEM(pass_type, SCE_PASS_Z, @@ -433,7 +433,7 @@ static bool bake_object_check(Scene *scene, Object *ob, ReportList *reports) return true; } -static bool bake_pass_filter_check(ScenePassType pass_type, const int pass_filter, ReportList *reports) +static bool bake_pass_filter_check(eScenePassType pass_type, const int pass_filter, ReportList *reports) { switch (pass_type) { case SCE_PASS_COMBINED: @@ -636,10 +636,10 @@ static Mesh *bake_mesh_new_from_object(EvaluationContext *eval_ctx, Main *bmain, static int bake( Render *re, Main *bmain, Depsgraph *graph, Scene *scene, Object *ob_low, ListBase *selected_objects, ReportList *reports, - const ScenePassType pass_type, const int pass_filter, const int margin, - const BakeSaveMode save_mode, const bool is_clear, const bool is_split_materials, + const eScenePassType pass_type, const int pass_filter, const int margin, + const eBakeSaveMode save_mode, const bool is_clear, const bool is_split_materials, const bool is_automatic_name, const bool is_selected_to_active, const bool is_cage, - const float cage_extrusion, const int normal_space, const BakeNormalSwizzle normal_swizzle[], + const float cage_extrusion, const int normal_space, const eBakeNormalSwizzle normal_swizzle[], const char *custom_cage, const char *filepath, const int width, const int height, const char *identifier, ScrArea *sa, const char *uv_layer) { diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 4e578906e07..5392b5c3dd0 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -572,7 +572,7 @@ static void object_test_constraint(Object *owner, bConstraint *con) #define EDIT_CONSTRAINT_OWNER_OBJECT 0 #define EDIT_CONSTRAINT_OWNER_BONE 1 -static EnumPropertyItem constraint_owner_items[] = { +static const EnumPropertyItem constraint_owner_items[] = { {EDIT_CONSTRAINT_OWNER_OBJECT, "OBJECT", 0, "Object", "Edit a constraint on the active object"}, {EDIT_CONSTRAINT_OWNER_BONE, "BONE", 0, "Bone", "Edit a constraint on the active bone"}, {0, NULL, 0, NULL, NULL}}; @@ -1031,7 +1031,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op) * and define basic slope of this curve based on the properties */ if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first) { - FModifier *fcm = add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR); + FModifier *fcm = add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR, fcu); FMod_Generator *gen = fcm->data; /* Assume that we have the following equation: diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index b96f4fa9f31..bc8002010ef 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -64,7 +64,7 @@ /* All possible data to transfer. * Note some are 'fake' ones, i.e. they are not hold by real CDLayers. */ /* Not shared with modifier, since we use a usual enum here, not a multi-choice one. */ -static EnumPropertyItem DT_layer_items[] = { +static const EnumPropertyItem DT_layer_items[] = { {0, "", 0, "Vertex Data", ""}, {DT_TYPE_MDEFORMVERT, "VGROUP_WEIGHTS", 0, "Vertex Group(s)", "Transfer active or all vertex groups"}, #if 0 /* XXX For now, would like to finish/merge work from 2014 gsoc first. */ @@ -91,21 +91,20 @@ static EnumPropertyItem DT_layer_items[] = { }; /* Note: rna_enum_dt_layers_select_src_items enum is from rna_modifier.c */ -static EnumPropertyItem *dt_layers_select_src_itemf( +static const EnumPropertyItem *dt_layers_select_src_itemf( bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EvaluationContext eval_ctx; EnumPropertyItem *item = NULL, tmp_item = {0}; int totitem = 0; - - CTX_data_eval_ctx(C, &eval_ctx); - const int data_type = RNA_enum_get(ptr, "data_type"); if (!C) { /* needed for docs and i18n tools */ return rna_enum_dt_layers_select_src_items; } + CTX_data_eval_ctx(C, &eval_ctx); + RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ACTIVE_SRC); RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC); @@ -187,7 +186,7 @@ static EnumPropertyItem *dt_layers_select_src_itemf( } /* Note: rna_enum_dt_layers_select_dst_items enum is from rna_modifier.c */ -static EnumPropertyItem *dt_layers_select_dst_itemf( +static const EnumPropertyItem *dt_layers_select_dst_itemf( bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; @@ -213,7 +212,7 @@ static EnumPropertyItem *dt_layers_select_dst_itemf( return item; } -static EnumPropertyItem *dt_layers_select_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) +static const EnumPropertyItem *dt_layers_select_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) { const bool reverse_transfer = RNA_boolean_get(ptr, "use_reverse_transfer"); @@ -234,7 +233,7 @@ static EnumPropertyItem *dt_layers_select_itemf(bContext *C, PointerRNA *ptr, Pr } /* Note: rna_enum_dt_mix_mode_items enum is from rna_modifier.c */ -static EnumPropertyItem *dt_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *dt_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; int totitem = 0; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 289d0bb586b..771915a06dc 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1393,9 +1393,10 @@ static void UNUSED_FUNCTION(image_aspect) (Scene *scene, SceneLayer *sl) } -static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *object_mode_set_itemsf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { - EnumPropertyItem *input = rna_enum_object_mode_items; + const EnumPropertyItem *input = rna_enum_object_mode_items; EnumPropertyItem *item = NULL; Object *ob; bGPdata *gpd; @@ -1466,7 +1467,7 @@ static const char *object_mode_op_string(int mode) /* checks the mode to be set is compatible with the object * should be made into a generic function */ -static bool object_mode_compat_test(Object *ob, ObjectMode mode) +static bool object_mode_compat_test(Object *ob, eObjectMode mode) { if (ob) { if (mode == OB_MODE_OBJECT) @@ -1551,8 +1552,8 @@ static int object_mode_set_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = CTX_data_gpencil_data(C); - ObjectMode mode = RNA_enum_get(op->ptr, "mode"); - ObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT; + eObjectMode mode = RNA_enum_get(op->ptr, "mode"); + eObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT; const bool toggle = RNA_boolean_get(op->ptr, "toggle"); if (gpd) { @@ -1775,7 +1776,7 @@ static int game_property_move(bContext *C, wmOperator *op) void OBJECT_OT_game_property_move(wmOperatorType *ot) { - static EnumPropertyItem direction_property_move[] = { + static const EnumPropertyItem direction_property_move[] = { {GAME_PROPERTY_MOVE_UP, "UP", 0, "Up", ""}, {GAME_PROPERTY_MOVE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -1808,14 +1809,14 @@ void OBJECT_OT_game_property_move(wmOperatorType *ot) #define COPY_PROPERTIES_MERGE 2 #define COPY_PROPERTIES_COPY 3 -static EnumPropertyItem game_properties_copy_operations[] = { +static const EnumPropertyItem game_properties_copy_operations[] = { {COPY_PROPERTIES_REPLACE, "REPLACE", 0, "Replace Properties", ""}, {COPY_PROPERTIES_MERGE, "MERGE", 0, "Merge Properties", ""}, {COPY_PROPERTIES_COPY, "COPY", 0, "Copy a Property", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = ED_object_active_context(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index b32fb975ea8..ef7e48f2d1a 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -64,7 +64,7 @@ /********************* 3d view operators ***********************/ /* can be called with C == NULL */ -static EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *group_object_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob; EnumPropertyItem *item = NULL, item_tmp = {0}; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 314019b4f76..3f6651299be 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -669,7 +669,7 @@ static int object_hook_remove_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = CTX_data_edit_object(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 4eafe715a6f..557e0a0eccf 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -820,7 +820,7 @@ static int lattice_flip_exec(bContext *C, wmOperator *op) void LATTICE_OT_flip(wmOperatorType *ot) { - static EnumPropertyItem flip_items[] = { + static const EnumPropertyItem flip_items[] = { {LATTICE_FLIP_U, "U", 0, "U (X) Axis", ""}, {LATTICE_FLIP_V, "V", 0, "V (Y) Axis", ""}, {LATTICE_FLIP_W, "W", 0, "W (Z) Axis", ""}, diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 6e70734db19..b7ac6c5de32 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -752,10 +752,12 @@ static int modifier_add_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *modifier_add_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = ED_object_active_context(C); - EnumPropertyItem *item = NULL, *md_item, *group_item = NULL; + EnumPropertyItem *item = NULL; + const EnumPropertyItem *md_item, *group_item = NULL; const ModifierTypeInfo *mti; int totitem = 0, a; @@ -1027,7 +1029,7 @@ static int modifier_apply_invoke(bContext *C, wmOperator *op, const wmEvent *UNU return OPERATOR_CANCELLED; } -static EnumPropertyItem modifier_apply_as_items[] = { +static const EnumPropertyItem modifier_apply_as_items[] = { {MODIFIER_APPLY_DATA, "DATA", 0, "Object Data", "Apply modifier to the object's data"}, {MODIFIER_APPLY_SHAPE, "SHAPE", 0, "New Shape", "Apply deform-only modifier to a new shape on this object"}, {0, NULL, 0, NULL, NULL} @@ -1585,7 +1587,7 @@ static int skin_loose_mark_clear_exec(bContext *C, wmOperator *op) void OBJECT_OT_skin_loose_mark_clear(wmOperatorType *ot) { - static EnumPropertyItem action_items[] = { + static const EnumPropertyItem action_items[] = { {SKIN_LOOSE_MARK, "MARK", 0, "Mark", "Mark selected vertices as loose"}, {SKIN_LOOSE_CLEAR, "CLEAR", 0, "Clear", "Set selected vertices as not loose"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index f92d67deaff..896c90507c1 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -389,7 +389,7 @@ static int make_proxy_exec(bContext *C, wmOperator *op) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem item_tmp = {0}, *item = NULL; @@ -650,7 +650,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene, /* setup dummy 'generator' modifier here to get 1-1 correspondence still working */ if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first) - add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR); + add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR, fcu); } /* fall back on regular parenting now (for follow only) */ @@ -1142,7 +1142,7 @@ enum { CLEAR_TRACK_KEEP_TRANSFORM = 2, }; -static EnumPropertyItem prop_clear_track_types[] = { +static const EnumPropertyItem prop_clear_track_types[] = { {CLEAR_TRACK, "CLEAR", 0, "Clear Track", ""}, {CLEAR_TRACK_KEEP_TRANSFORM, "CLEAR_KEEP_TRANSFORM", 0, "Clear and Keep Transformation (Clear Track)", ""}, {0, NULL, 0, NULL, NULL} @@ -1211,7 +1211,7 @@ enum { CREATE_TRACK_LOCKTRACK = 3, }; -static EnumPropertyItem prop_make_track_types[] = { +static const EnumPropertyItem prop_make_track_types[] = { {CREATE_TRACK_DAMPTRACK, "DAMPTRACK", 0, "Damped Track Constraint", ""}, {CREATE_TRACK_TRACKTO, "TRACKTO", 0, "Track To Constraint", ""}, {CREATE_TRACK_LOCKTRACK, "LOCKTRACK", 0, "Lock Track Constraint", ""}, @@ -1596,7 +1596,7 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot) void OBJECT_OT_make_links_data(wmOperatorType *ot) { - static EnumPropertyItem make_links_items[] = { + static const EnumPropertyItem make_links_items[] = { {MAKE_LINKS_OBDATA, "OBDATA", 0, "Object Data", ""}, {MAKE_LINKS_MATERIALS, "MATERIAL", 0, "Materials", ""}, {MAKE_LINKS_ANIMDATA, "ANIMATION", 0, "Animation Data", ""}, @@ -2299,7 +2299,7 @@ static int make_local_exec(bContext *C, wmOperator *op) void OBJECT_OT_make_local(wmOperatorType *ot) { - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {MAKE_LOCAL_SELECT_OB, "SELECT_OBJECT", 0, "Selected Objects", ""}, {MAKE_LOCAL_SELECT_OBDATA, "SELECT_OBDATA", 0, "Selected Objects and Data", ""}, {MAKE_LOCAL_SELECT_OBDATA_MATERIAL, "SELECT_OBDATA_MATERIAL", 0, "Selected Objects, Data and Materials", ""}, @@ -2381,7 +2381,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op) void OBJECT_OT_make_single_user(wmOperatorType *ot) { - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {MAKE_SINGLE_USER_SELECTED, "SELECTED_OBJECTS", 0, "Selected Objects", ""}, {MAKE_SINGLE_USER_ALL, "ALL", 0, "All", ""}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 280294e714d..d0c37fc108a 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -233,7 +233,7 @@ enum { OBJECT_SELECT_LINKED_LIBRARY_OBDATA }; -static EnumPropertyItem prop_select_linked_types[] = { +static const EnumPropertyItem prop_select_linked_types[] = { //{OBJECT_SELECT_LINKED_IPO, "IPO", 0, "Object IPO", ""}, // XXX deprecated animation system stuff... {OBJECT_SELECT_LINKED_OBDATA, "OBDATA", 0, "Object Data", ""}, {OBJECT_SELECT_LINKED_MATERIAL, "MATERIAL", 0, "Material", ""}, @@ -530,7 +530,7 @@ enum { OBJECT_GRPSEL_LAMP_TYPE = 12, }; -static EnumPropertyItem prop_select_grouped_types[] = { +static const EnumPropertyItem prop_select_grouped_types[] = { {OBJECT_GRPSEL_CHILDREN_RECURSIVE, "CHILDREN_RECURSIVE", 0, "Children", ""}, {OBJECT_GRPSEL_CHILDREN, "CHILDREN", 0, "Immediate Children", ""}, {OBJECT_GRPSEL_PARENT, "PARENT", 0, "Parent", ""}, diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index b7c0a2679bc..4fefe03c6ab 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -479,7 +479,7 @@ static int shape_key_move_exec(bContext *C, wmOperator *op) void OBJECT_OT_shape_key_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {KB_MOVE_TOP, "TOP", 0, "Top", "Top of the list"}, {KB_MOVE_UP, "UP", 0, "Up", ""}, {KB_MOVE_DOWN, "DOWN", 0, "Down", ""}, diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 944fbb0bbe1..b9c8edf8614 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1114,7 +1114,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) void OBJECT_OT_origin_set(wmOperatorType *ot) { - static EnumPropertyItem prop_set_center_types[] = { + static const EnumPropertyItem prop_set_center_types[] = { {GEOMETRY_TO_ORIGIN, "GEOMETRY_ORIGIN", 0, "Geometry to Origin", "Move object geometry to object origin"}, {ORIGIN_TO_GEOMETRY, "ORIGIN_GEOMETRY", 0, "Origin to Geometry", "Calculate the center of geometry based on the current pivot point (median, otherwise bounding-box)"}, @@ -1128,7 +1128,7 @@ void OBJECT_OT_origin_set(wmOperatorType *ot) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_set_bounds_types[] = { + static const EnumPropertyItem prop_set_bounds_types[] = { {V3D_AROUND_CENTER_MEAN, "MEDIAN", 0, "Median Center", ""}, {V3D_AROUND_CENTER_BOUNDS, "BOUNDS", 0, "Bounds Center", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 386c63d4095..9d01ad6886c 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -668,7 +668,7 @@ static void vgroup_copy_active_to_sel(Object *ob, eVGroupSelect subset_type) /***********************Start weight transfer (WT)*********************************/ -static EnumPropertyItem WT_vertex_group_select_item[] = { +static const EnumPropertyItem WT_vertex_group_select_item[] = { {WT_VGROUP_ACTIVE, "ACTIVE", 0, "Active Group", "The active Vertex Group"}, {WT_VGROUP_BONE_SELECT, @@ -680,7 +680,7 @@ static EnumPropertyItem WT_vertex_group_select_item[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( +const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( const bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free, const unsigned int selection_mask) { @@ -688,9 +688,10 @@ EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( EnumPropertyItem *item = NULL; int totitem = 0; - - if (!C) /* needed for docs and i18n tools */ + if (C == NULL) { + /* needed for docs and i18n tools */ return WT_vertex_group_select_item; + } ob = CTX_data_active_object(C); if (selection_mask & (1 << WT_VGROUP_ACTIVE)) @@ -712,13 +713,13 @@ EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( return item; } -static EnumPropertyItem *rna_vertex_group_with_single_itemf(bContext *C, PointerRNA *ptr, +static const EnumPropertyItem *rna_vertex_group_with_single_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) { return ED_object_vgroup_selection_itemf_helper(C, ptr, prop, r_free, WT_VGROUP_MASK_ALL); } -static EnumPropertyItem *rna_vertex_group_select_itemf(bContext *C, PointerRNA *ptr, +static const EnumPropertyItem *rna_vertex_group_select_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) { return ED_object_vgroup_selection_itemf_helper(C, ptr, prop, r_free, WT_VGROUP_MASK_ALL & ~(1 << WT_VGROUP_ACTIVE)); @@ -1628,7 +1629,7 @@ enum { VGROUP_INVERT }; -static EnumPropertyItem vgroup_lock_actions[] = { +static const EnumPropertyItem vgroup_lock_actions[] = { {VGROUP_TOGGLE, "TOGGLE", 0, "Toggle", "Unlock all vertex groups if there is at least one locked group, lock all in other case"}, {VGROUP_LOCK, "LOCK", 0, "Lock", "Lock all vertex groups"}, {VGROUP_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock all vertex groups"}, @@ -3421,7 +3422,7 @@ static int set_active_group_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = ED_object_context(C); EnumPropertyItem tmp = {0, "", 0, "", ""}; @@ -3640,7 +3641,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op) void OBJECT_OT_vertex_group_sort(wmOperatorType *ot) { - static EnumPropertyItem vgroup_sort_type[] = { + static const EnumPropertyItem vgroup_sort_type[] = { {SORT_TYPE_NAME, "NAME", 0, "Name", ""}, {SORT_TYPE_BONEHIERARCHY, "BONE_HIERARCHY", 0, "Bone Hierarchy", ""}, {0, NULL, 0, NULL, NULL} @@ -3691,7 +3692,7 @@ static int vgroup_move_exec(bContext *C, wmOperator *op) void OBJECT_OT_vertex_group_move(wmOperatorType *ot) { - static EnumPropertyItem vgroup_slot_move[] = { + static const EnumPropertyItem vgroup_slot_move[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 1f0ee6862d2..93f010778f1 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -255,7 +255,7 @@ static int output_toggle_exec(bContext *C, wmOperator *op) void DPAINT_OT_output_toggle(wmOperatorType *ot) { - static EnumPropertyItem prop_output_toggle_types[] = { + static const EnumPropertyItem prop_output_toggle_types[] = { {0, "A", 0, "Output A", ""}, {1, "B", 0, "Output B", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 6a5a3c73f81..67ba1a1312a 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1630,7 +1630,7 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot) enum { RAN_HAIR, RAN_POINTS }; -static EnumPropertyItem select_random_type_items[] = { +static const EnumPropertyItem select_random_type_items[] = { {RAN_HAIR, "HAIR", 0, "Hair", ""}, {RAN_POINTS, "POINTS", 0, "Points", ""}, {0, NULL, 0, NULL, NULL} @@ -2771,7 +2771,7 @@ static void toggle_particle_cursor(bContext *C, int enable) enum { DEL_PARTICLE, DEL_KEY }; -static EnumPropertyItem delete_type_items[] = { +static const EnumPropertyItem delete_type_items[] = { {DEL_PARTICLE, "PARTICLE", 0, "Particle", ""}, {DEL_KEY, "KEY", 0, "Key", ""}, {0, NULL, 0, NULL, NULL}}; @@ -4127,7 +4127,9 @@ void PARTICLE_OT_brush_edit(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; /* properties */ - RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + PropertyRNA *prop; + prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); } /*********************** cut shape ***************************/ diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 571a8ab18f0..1e643ea7277 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -1211,7 +1211,7 @@ static int copy_particle_systems_exec(bContext *C, wmOperator *op) void PARTICLE_OT_copy_particle_systems(wmOperatorType *ot) { - static EnumPropertyItem space_items[] = { + static const EnumPropertyItem space_items[] = { {PAR_COPY_SPACE_OBJECT, "OBJECT", 0, "Object", "Copy inside each object's local space"}, {PAR_COPY_SPACE_WORLD, "WORLD", 0, "World", "Copy in world space"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index d4f949880ee..74946e3f44d 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -166,6 +166,7 @@ static PTCacheBaker *ptcache_baker_create(bContext *C, wmOperator *op, bool all) baker->main = CTX_data_main(C); baker->scene = CTX_data_scene(C); + baker->scene_layer = CTX_data_scene_layer(C); baker->bake = RNA_boolean_get(op->ptr, "bake"); baker->render = 0; baker->anim_init = 0; diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c index cf9dc8ff2a3..3b667520550 100644 --- a/source/blender/editors/physics/rigidbody_object.c +++ b/source/blender/editors/physics/rigidbody_object.c @@ -457,7 +457,7 @@ static const int NUM_RB_MATERIAL_PRESETS = sizeof(RB_MATERIAL_DENSITY_TABLE) / s * - Although there is a runtime cost, this has a lower maintenance cost * in the long run than other two-list solutions... */ -static EnumPropertyItem *rigidbody_materials_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rigidbody_materials_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem item_tmp = {0}; EnumPropertyItem *item = NULL; diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index ababd637e00..037e8adff9a 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -56,6 +56,7 @@ #include "BKE_colortools.h" #include "BKE_global.h" #include "BKE_image.h" +#include "BKE_layer.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_node.h" @@ -64,6 +65,7 @@ #include "BKE_sequencer.h" #include "BKE_screen.h" #include "BKE_scene.h" +#include "BKE_workspace.h" #include "DEG_depsgraph.h" @@ -787,33 +789,46 @@ static void screen_render_cancel(bContext *C, wmOperator *op) WM_jobs_kill_type(wm, scene, WM_JOB_TYPE_RENDER); } +static void clean_viewport_memory_base(Base *base) +{ + if ((base->flag & BASE_VISIBLED) == 0) { + return; + } + + Object *object = base->object; + + if (object->id.tag & LIB_TAG_DOIT) { + return; + } + + object->id.tag &= ~LIB_TAG_DOIT; + if (RE_allow_render_generic_object(object)) { + BKE_object_free_derived_caches(object); + } +} + static void clean_viewport_memory(Main *bmain, Scene *scene) { - Object *object; Scene *sce_iter; Base *base; - for (object = bmain->object.first; object; object = object->id.next) { - object->id.tag |= LIB_TAG_DOIT; - } + /* Tag all the available objects. */ + BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true); - for (SETLOOPER(scene, sce_iter, base)) { - if ((base->flag & BASE_VISIBLED) == 0) { - continue; - } - if (RE_allow_render_generic_object(base->object)) { - base->object->id.tag &= ~LIB_TAG_DOIT; - } - } + /* Go over all the visible objects. */ + for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) { + for (wmWindow *win = wm->windows.first; win; win = win->next) { + WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook); + SceneLayer *scene_layer = BKE_scene_layer_from_workspace_get(scene, workspace); - for (SETLOOPER(scene, sce_iter, base)) { - object = base->object; - if ((object->id.tag & LIB_TAG_DOIT) == 0) { - continue; + for (base = scene_layer->object_bases.first; base; base = base->next) { + clean_viewport_memory_base(base); + } } - object->id.tag &= ~LIB_TAG_DOIT; + } - BKE_object_free_derived_caches(object); + for (SETLOOPER_SET_ONLY(scene, sce_iter, base)) { + clean_viewport_memory_base(base); } } @@ -1256,10 +1271,10 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda /* initalize always */ if (use_border) { rdata.mode |= R_BORDER; - RE_InitState(re, NULL, &rdata, NULL, rp->ar->winx, rp->ar->winy, &cliprct); + RE_InitState(re, NULL, &rdata, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, &cliprct); } else - RE_InitState(re, NULL, &rdata, NULL, rp->ar->winx, rp->ar->winy, NULL); + RE_InitState(re, NULL, &rdata, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, NULL); } if (orth) @@ -1679,7 +1694,7 @@ static int render_shutter_curve_preset_exec(bContext *C, wmOperator *op) void RENDER_OT_shutter_curve_preset(wmOperatorType *ot) { PropertyRNA *prop; - static EnumPropertyItem prop_shape_items[] = { + static const EnumPropertyItem prop_shape_items[] = { {CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""}, {CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""}, {CURVE_PRESET_MAX, "MAX", 0, "Max", ""}, diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index af932c27c5e..c17beded91e 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -94,6 +94,7 @@ typedef struct OGLRender { Main *bmain; Render *re; Scene *scene; + WorkSpace *workspace; SceneLayer *scene_layer; View3D *v3d; @@ -267,7 +268,7 @@ static void screen_opengl_views_setup(OGLRender *oglrender) static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, RenderResult *rr) { Scene *scene = oglrender->scene; - SceneLayer *sl = oglrender->scene_layer; + SceneLayer *scene_layer = oglrender->scene_layer; ARegion *ar = oglrender->ar; View3D *v3d = oglrender->v3d; RegionView3D *rv3d = oglrender->rv3d; @@ -352,7 +353,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R if (view_context) { ibuf_view = ED_view3d_draw_offscreen_imbuf( - &eval_ctx, scene, sl, v3d, ar, sizex, sizey, + &eval_ctx, scene, scene_layer, v3d, ar, sizex, sizey, IB_rect, draw_bgpic, alpha_mode, oglrender->ofs_samples, oglrender->ofs_full_samples, viewname, oglrender->fx, oglrender->ofs, err_out); @@ -364,7 +365,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R } else { ibuf_view = ED_view3d_draw_offscreen_imbuf_simple( - &eval_ctx, scene, sl, scene->camera, oglrender->sizex, oglrender->sizey, + &eval_ctx, scene, scene_layer, scene->camera, oglrender->sizex, oglrender->sizey, IB_rect, OB_SOLID, false, true, true, alpha_mode, oglrender->ofs_samples, oglrender->ofs_full_samples, viewname, oglrender->fx, oglrender->ofs, err_out); @@ -591,6 +592,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) /* new render clears all callbacks */ wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); + WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene = CTX_data_scene(C); ScrArea *prevsa = CTX_wm_area(C); @@ -662,6 +664,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->sizey = sizey; oglrender->bmain = CTX_data_main(C); oglrender->scene = scene; + oglrender->workspace = workspace; oglrender->scene_layer = CTX_data_scene_layer(C); oglrender->cfrao = scene->r.cfra; @@ -698,6 +701,8 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) /* create render */ oglrender->re = RE_NewSceneRender(scene); + ViewRender *view_render = BKE_viewrender_get(scene, workspace); + RE_SetEngineByID(oglrender->re, view_render->engine_id); /* create image and image user */ oglrender->ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result"); @@ -708,7 +713,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->iuser.ok = 1; /* create render result */ - RE_InitState(oglrender->re, NULL, &scene->r, NULL, sizex, sizey, NULL); + RE_InitState(oglrender->re, NULL, &scene->r, view_render, NULL, sizex, sizey, NULL); /* create render views */ screen_opengl_views_setup(oglrender); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 3f817672c00..958f1585e84 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -173,6 +173,7 @@ typedef struct ShaderPreview { Main *bmain; Main *pr_main; + ViewRender *view_render; } ShaderPreview; typedef struct IconPreviewSize { @@ -187,6 +188,7 @@ typedef struct IconPreview { void *owner; ID *id; ListBase sizes; + ViewRender *view_render; } IconPreview; /* *************************** Preview for buttons *********************** */ @@ -229,7 +231,7 @@ void ED_preview_ensure_dbase(void) static bool check_engine_supports_textures(Scene *scene) { - RenderEngineType *type = RE_engines_find(scene->r.engine); + RenderEngineType *type = RE_engines_find(scene->view_render.engine_id); return type->flag & RE_USE_TEXTURE_PREVIEW; } @@ -383,10 +385,10 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty * seems commonly used render engines does not support * such kind of rendering. */ - BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_RENDER, sizeof(sce->r.engine)); + BLI_strncpy(sce->view_render.engine_id, RE_engine_id_BLENDER_RENDER, sizeof(sce->view_render.engine_id)); } else { - BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); + BLI_strncpy(sce->view_render.engine_id, scene->view_render.engine_id, sizeof(sce->view_render.engine_id)); } if (id_type == ID_MA) { @@ -857,7 +859,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs ((Camera *)sce->camera->data)->lens *= (float)sp->sizey / (float)sizex; /* entire cycle for render engine */ - RE_PreviewRender(re, pr_main, sce); + RE_PreviewRender(re, pr_main, sce, sp->view_render); ((Camera *)sce->camera->data)->lens = oldlens; @@ -1184,6 +1186,7 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short /* construct shader preview from image size and previewcustomdata */ sp->scene = ip->scene; + sp->view_render = ip->view_render; sp->owner = ip->owner; sp->sizex = cur_size->sizex; sp->sizey = cur_size->sizey; @@ -1268,6 +1271,7 @@ void ED_preview_icon_render(Main *bmain, Scene *scene, ID *id, unsigned int *rec ip.bmain = bmain; ip.scene = scene; + ip.view_render = &scene->view_render; ip.owner = BKE_previewimg_id_ensure(id); ip.id = id; @@ -1301,6 +1305,7 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r /* customdata for preview thread */ ip->bmain = CTX_data_main(C); ip->scene = CTX_data_scene(C); + ip->view_render = &ip->scene->view_render; ip->owner = owner; ip->id = id; @@ -1328,8 +1333,12 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M wmJob *wm_job; ShaderPreview *sp; Scene *scene = CTX_data_scene(C); + WorkSpace *workspace = CTX_wm_workspace(C); short id_type = GS(id->name); - bool use_new_shading = BKE_scene_use_new_shading_nodes(scene); + + /* Use workspace render only for buttons Window, since the other previews are related to the datablock. */ + ViewRender *view_render = (method == PR_BUTS_RENDER) ? BKE_viewrender_get(scene, workspace) : &scene->view_render; + bool use_new_shading = BKE_viewrender_use_new_shading_nodes(view_render); /* Only texture node preview is supported with Cycles. */ if (use_new_shading && method == PR_NODE_RENDER && id_type != ID_TE) { @@ -1352,6 +1361,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M sp->parent = parent; sp->slot = slot; sp->bmain = CTX_data_main(C); + sp->view_render = view_render; /* hardcoded preview .blend for cycles/internal, this should be solved * once with custom preview .blend path for external engines */ diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 58dd67f4923..ef436c44b74 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -434,7 +434,7 @@ static int material_slot_move_exec(bContext *C, wmOperator *op) void OBJECT_OT_material_slot_move(wmOperatorType *ot) { - static EnumPropertyItem material_slot_move[] = { + static const EnumPropertyItem material_slot_move[] = { {1, "UP", 0, "Up", ""}, {-1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -843,7 +843,7 @@ static int freestyle_module_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_module_move(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -1003,7 +1003,7 @@ static int freestyle_lineset_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -1380,7 +1380,7 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -1501,7 +1501,7 @@ static int texture_slot_move_exec(bContext *C, wmOperator *op) void TEXTURE_OT_slot_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {-1, "UP", 0, "Up", ""}, {1, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index ccea1e5930c..f38b190b92c 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -38,6 +38,7 @@ #include "DNA_screen_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" +#include "DNA_workspace_types.h" #include "DNA_world_types.h" #include "DNA_windowmanager_types.h" @@ -56,6 +57,7 @@ #include "BKE_node.h" #include "BKE_paint.h" #include "BKE_scene.h" +#include "BKE_workspace.h" #include "GPU_lamp.h" #include "GPU_material.h" @@ -113,7 +115,9 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated) ARegion *ar; CTX_wm_window_set(C, win); - + WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook); + ViewRender *view_render = BKE_viewrender_get(win->scene, workspace); + for (sa = sc->areabase.first; sa; sa = sa->next) { if (sa->spacetype != SPACE_VIEW3D) continue; @@ -141,7 +145,7 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated) engine->type->view_update(engine, C); } - else if ((RE_engines_find(scene->r.engine)->flag & RE_USE_LEGACY_PIPELINE) == 0) { + else if ((RE_engines_find(view_render->engine_id)->flag & RE_USE_LEGACY_PIPELINE) == 0) { if (updated) { CTX_wm_screen_set(C, sc); CTX_wm_area_set(C, sa); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 08be062aaf6..20af9ee215e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -145,11 +145,11 @@ void ED_region_do_listen(bScreen *sc, ScrArea *sa, ARegion *ar, wmNotifier *note } /* only exported for WM */ -void ED_area_do_listen(bScreen *sc, ScrArea *sa, wmNotifier *note, const Scene *scene) +void ED_area_do_listen(bScreen *sc, ScrArea *sa, wmNotifier *note, Scene *scene, WorkSpace *workspace) { /* no generic notes? */ if (sa->type && sa->type->listener) { - sa->type->listener(sc, sa, note, scene); + sa->type->listener(sc, sa, note, scene, workspace); } } diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 5813f317295..b8575b2da2a 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -89,7 +89,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult ScrArea *sa = CTX_wm_area(C); Scene *scene = WM_window_get_active_scene(win); WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook); - SceneLayer *sl = BKE_scene_layer_from_workspace_get(workspace); + SceneLayer *sl = BKE_scene_layer_from_workspace_get(scene, workspace); Object *obedit = scene->obedit; Object *obact = sl->basact ? sl->basact->object : NULL; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index df2619c9ea3..6544d42f6a8 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -957,7 +957,7 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen) /* *********************************** */ /* case when on area-edge or in azones, or outside window */ -static void screen_cursor_set(wmWindow *win, wmEvent *event) +static void screen_cursor_set(wmWindow *win, const wmEvent *event) { const bScreen *screen = WM_window_get_active_screen(win); const int screen_size_x = WM_window_screen_pixels_x(win); @@ -997,7 +997,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event) /* called in wm_event_system.c. sets state vars in screen, cursors */ /* event type is mouse move */ -void ED_screen_set_subwinactive(bContext *C, wmEvent *event) +void ED_screen_set_subwinactive(bContext *C, const wmEvent *event) { wmWindow *win = CTX_wm_window(C); bScreen *scr = WM_window_get_active_screen(win); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index dd609d8e2ac..9a3d1da2375 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1788,7 +1788,7 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_RUNNING_MODAL; } -static EnumPropertyItem prop_direction_items[] = { +static const EnumPropertyItem prop_direction_items[] = { {'h', "HORIZONTAL", 0, "Horizontal", ""}, {'v', "VERTICAL", 0, "Vertical", ""}, {0, NULL, 0, NULL, NULL} @@ -3806,9 +3806,9 @@ static void SCREEN_OT_border_select(wmOperatorType *ot) /* api callbacks */ ot->exec = border_select_exec; - ot->invoke = WM_border_select_invoke; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->invoke = WM_gesture_border_invoke; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_areaactive; @@ -4083,7 +4083,7 @@ enum { SPACE_CONTEXT_CYCLE_NEXT, }; -static EnumPropertyItem space_context_cycle_direction[] = { +static const EnumPropertyItem space_context_cycle_direction[] = { {SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""}, {SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""}, {0, NULL, 0, NULL, NULL} @@ -4222,7 +4222,7 @@ void ED_operatortypes_screen(void) static void keymap_modal_set(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {KM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {KM_MODAL_APPLY, "APPLY", 0, "Apply", ""}, {KM_MODAL_STEP10, "STEP10", 0, "Steps on", ""}, diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 312117f2bbe..2229ecce408 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -38,6 +38,7 @@ #include "BKE_main.h" #include "BKE_library.h" #include "BKE_report.h" +#include "BKE_scene.h" #include "BKE_screen.h" #include "BKE_workspace.h" @@ -51,6 +52,8 @@ #include "ED_object.h" #include "ED_screen.h" +#include "MEM_guardedalloc.h" + #include "RNA_access.h" #include "UI_interface.h" @@ -68,7 +71,7 @@ * \{ */ WorkSpace *ED_workspace_add( - Main *bmain, const char *name, SceneLayer *act_render_layer) + Main *bmain, const char *name, SceneLayer *act_render_layer, ViewRender *view_render) { WorkSpace *workspace = BKE_workspace_add(bmain, name); @@ -77,6 +80,7 @@ WorkSpace *ED_workspace_add( #endif BKE_workspace_render_layer_set(workspace, act_render_layer); + BKE_viewrender_copy(&workspace->view_render, view_render); return workspace; } @@ -90,8 +94,8 @@ static void workspace_change_update_mode( const WorkSpace *workspace_old, const WorkSpace *workspace_new, bContext *C, Object *ob_act, ReportList *reports) { - ObjectMode mode_old = BKE_workspace_object_mode_get(workspace_old); - ObjectMode mode_new = BKE_workspace_object_mode_get(workspace_new); + eObjectMode mode_old = BKE_workspace_object_mode_get(workspace_old); + eObjectMode mode_new = BKE_workspace_object_mode_get(workspace_new); if (mode_old != mode_new) { ED_object_mode_compat_set(C, ob_act, mode_new, reports); @@ -215,7 +219,8 @@ WorkSpace *ED_workspace_duplicate( ListBase *layouts_old = BKE_workspace_layouts_get(workspace_old); WorkSpace *workspace_new = ED_workspace_add( bmain, workspace_old->id.name + 2, - BKE_workspace_render_layer_get(workspace_old)); + BKE_workspace_render_layer_get(workspace_old), + &workspace_old->view_render); ListBase *transform_orientations_old = BKE_workspace_transform_orientations_get(workspace_old); ListBase *transform_orientations_new = BKE_workspace_transform_orientations_get(workspace_new); @@ -231,7 +236,6 @@ WorkSpace *ED_workspace_duplicate( win->workspace_hook->temp_layout_store = layout_new; } } - return workspace_new; } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 2d2d5fa33c9..e1e90506299 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -249,12 +249,12 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima TexSnapshot *target; MTex *mtex = (primary) ? &br->mtex : &br->mask_mtex; - OverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags(); + eOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags(); GLubyte *buffer = NULL; int size; bool refresh; - OverlayControlFlags invalid = (primary) ? (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) : + eOverlayControlFlags invalid = (primary) ? (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) : (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY); target = (primary) ? &primary_snap : &secondary_snap; @@ -397,7 +397,7 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) { bool init; - OverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags(); + eOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags(); GLubyte *buffer = NULL; int size; @@ -778,11 +778,11 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush, } static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush, - ViewContext *vc, int x, int y, float zoom, PaintMode mode) + ViewContext *vc, int x, int y, float zoom, ePaintMode mode) { /* color means that primary brush texture is colured and secondary is used for alpha/mask control */ bool col = ELEM(mode, ePaintTextureProjective, ePaintTexture2D, ePaintVertex) ? true : false; - OverlayControlFlags flags = BKE_paint_get_overlay_flags(); + eOverlayControlFlags flags = BKE_paint_get_overlay_flags(); gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT); /* coloured overlay should be drawn separately */ @@ -997,7 +997,7 @@ static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewCon } } -static bool ommit_cursor_drawing(Paint *paint, PaintMode mode, Brush *brush) +static bool ommit_cursor_drawing(Paint *paint, ePaintMode mode, Brush *brush) { if (paint->flags & PAINT_SHOW_BRUSH) { if (ELEM(mode, ePaintTexture2D, ePaintTextureProjective) && brush->imagepaint_tool == PAINT_TOOL_FILL) { @@ -1014,7 +1014,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; Paint *paint = BKE_paint_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); /* check that brush drawing is enabled */ if (ommit_cursor_drawing(paint, mode, brush)) diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c index 9704db9d035..0ee78d61fb8 100644 --- a/source/blender/editors/sculpt_paint/paint_curve.c +++ b/source/blender/editors/sculpt_paint/paint_curve.c @@ -128,7 +128,7 @@ static void paintcurve_undo_delete(ListBase *lb) static void paintcurve_undo_begin(bContext *C, wmOperator *op, PaintCurve *pc) { - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); ListBase *lb = NULL; int undo_stack_id; UndoCurve *uc; @@ -733,7 +733,7 @@ void PAINTCURVE_OT_slide(wmOperatorType *ot) static int paintcurve_draw_exec(bContext *C, wmOperator *UNUSED(op)) { - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); const char *name; switch (mode) { @@ -774,7 +774,7 @@ void PAINTCURVE_OT_draw(wmOperatorType *ot) static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); switch (mode) { case ePaintTexture2D: diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index d2e2df01238..8377b22756e 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -436,20 +436,20 @@ static int hide_show_invoke(bContext *C, wmOperator *op, const wmEvent *event) PartialVisArea area = RNA_enum_get(op->ptr, "area"); if (!ELEM(area, PARTIALVIS_ALL, PARTIALVIS_MASKED)) - return WM_border_select_invoke(C, op, event); + return WM_gesture_border_invoke(C, op, event); else return op->type->exec(C, op); } void PAINT_OT_hide_show(struct wmOperatorType *ot) { - static EnumPropertyItem action_items[] = { + static const EnumPropertyItem action_items[] = { {PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"}, {PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem area_items[] = { + static const EnumPropertyItem area_items[] = { {PARTIALVIS_OUTSIDE, "OUTSIDE", 0, "Outside", "Hide or show vertices outside the selection"}, {PARTIALVIS_INSIDE, "INSIDE", 0, "Inside", "Hide or show vertices inside the selection"}, {PARTIALVIS_ALL, "ALL", 0, "All", "Hide or show all vertices"}, @@ -464,7 +464,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot) /* api callbacks */ ot->invoke = hide_show_invoke; - ot->modal = WM_border_select_modal; + ot->modal = WM_gesture_border_modal; ot->exec = hide_show_exec; /* sculpt-only for now */ ot->poll = sculpt_mode_poll_view3d; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index e324f2b89f0..580e42e5974 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -511,7 +511,7 @@ BlurKernel *paint_new_blur_kernel(Brush *br, bool proj) BlurKernel *kernel = MEM_mallocN(sizeof(BlurKernel), "blur kernel"); float radius; int side; - BlurKernelType type = br->blur_mode; + eBlurKernelType type = br->blur_mode; if (proj) { radius = 0.5f; @@ -625,13 +625,13 @@ static int image_paint_2d_clone_poll(bContext *C) } /************************ paint operator ************************/ -typedef enum TexPaintMode { +typedef enum eTexPaintMode { PAINT_MODE_2D, PAINT_MODE_3D_PROJECT -} TexPaintMode; +} eTexPaintMode; typedef struct PaintOperation { - TexPaintMode mode; + eTexPaintMode mode; void *custom_paint; @@ -1208,7 +1208,7 @@ static int sample_color_exec(bContext *C, wmOperator *op) { Paint *paint = BKE_paint_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); ARegion *ar = CTX_wm_region(C); wmWindow *win = CTX_wm_window(C); const bool show_cursor = ((paint->flags & PAINT_SHOW_BRUSH) != 0); @@ -1260,7 +1260,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, const wmEvent *event RNA_int_set_array(op->ptr, "location", event->mval); - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); const bool use_sample_texture = (mode == ePaintTextureProjective) && !RNA_boolean_get(op->ptr, "merged"); paint_sample_color(C, ar, event->mval[0], event->mval[1], use_sample_texture, false); @@ -1296,7 +1296,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_FINISHED; } - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); const bool use_sample_texture = (mode == ePaintTextureProjective) && !RNA_boolean_get(op->ptr, "merged"); switch (event->type) { diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 2ffd9757f92..da2fcd6459d 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5455,7 +5455,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) char filename[FILE_MAX]; Scene *scene = CTX_data_scene(C); - SceneLayer *sl = CTX_data_scene_layer(C); + SceneLayer *scene_layer = CTX_data_scene_layer(C); EvaluationContext eval_ctx; ToolSettings *settings = scene->toolsettings; int w = settings->imapaint.screen_grab_size[0]; @@ -5473,7 +5473,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) if (h > maxsize) h = maxsize; ibuf = ED_view3d_draw_offscreen_imbuf( - &eval_ctx, scene, sl, CTX_wm_view3d(C), CTX_wm_region(C), + &eval_ctx, scene, scene_layer, CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, NULL, NULL, err_out); if (!ibuf) { @@ -5645,7 +5645,7 @@ bool BKE_paint_proj_mesh_data_check(Scene *scene, Object *ob, bool *uvs, bool *m /* Add layer operator */ -static EnumPropertyItem layer_type_items[] = { +static const EnumPropertyItem layer_type_items[] = { {MAP_COL, "DIFFUSE_COLOR", 0, "Diffuse Color", ""}, {MAP_REF, "DIFFUSE_INTENSITY", 0, "Diffuse Intensity", ""}, {MAP_ALPHA, "ALPHA", 0, "Alpha", ""}, diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index b3b7d40391a..28d9dfe13b0 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -54,7 +54,7 @@ struct wmOperator; struct wmOperatorType; struct wmWindowManager; struct DMCoNo; -enum PaintMode; +enum ePaintMode; /* paint_stroke.c */ typedef bool (*StrokeGetLocation)(struct bContext *C, float location[3], const float mouse[2]); @@ -69,12 +69,12 @@ struct PaintStroke *paint_stroke_new(struct bContext *C, struct wmOperator *op, StrokeDone done, int event_type); void paint_stroke_data_free(struct wmOperator *op); -bool paint_space_stroke_enabled(struct Brush *br, enum PaintMode mode); -bool paint_supports_dynamic_size(struct Brush *br, enum PaintMode mode); -bool paint_supports_dynamic_tex_coords(struct Brush *br, enum PaintMode mode); -bool paint_supports_smooth_stroke(struct Brush *br, enum PaintMode mode); -bool paint_supports_texture(enum PaintMode mode); -bool paint_supports_jitter(enum PaintMode mode); +bool paint_space_stroke_enabled(struct Brush *br, enum ePaintMode mode); +bool paint_supports_dynamic_size(struct Brush *br, enum ePaintMode mode); +bool paint_supports_dynamic_tex_coords(struct Brush *br, enum ePaintMode mode); +bool paint_supports_smooth_stroke(struct Brush *br, enum ePaintMode mode); +bool paint_supports_texture(enum ePaintMode mode); +bool paint_supports_jitter(enum ePaintMode mode); struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf); int paint_stroke_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); @@ -335,7 +335,7 @@ typedef struct { int pixel_len; /* pixels around center that kernel is wide */ } BlurKernel; -enum BlurKernelType; +enum eBlurKernelType; /* can be extended to other blur kernels later */ BlurKernel *paint_new_blur_kernel(struct Brush *br, bool proj); void paint_delete_blur_kernel(BlurKernel *); diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index b7159c375cd..0fec4c4fc80 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -69,7 +69,7 @@ #include <stdlib.h> -static EnumPropertyItem mode_items[] = { +static const EnumPropertyItem mode_items[] = { {PAINT_MASK_FLOOD_VALUE, "VALUE", 0, "Value", "Set mask to the level specified by the 'value' property"}, {PAINT_MASK_FLOOD_VALUE_INVERSE, "VALUE_INVERSE", 0, "Value Inverted", "Set mask to the level specified by the inverted 'value' property"}, {PAINT_MASK_INVERT, "INVERT", 0, "Invert", "Invert the mask"}, @@ -511,8 +511,6 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op) void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot) { - PropertyRNA *prop; - ot->name = "Mask Lasso Gesture"; ot->idname = "PAINT_OT_mask_lasso_gesture"; ot->description = "Add mask within the lasso as you move the brush"; @@ -525,8 +523,8 @@ void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); + /* properties */ + WM_operator_properties_gesture_lasso(ot); RNA_def_enum(ot->srna, "mode", mode_items, PAINT_MASK_FLOOD_VALUE, "Mode", NULL); RNA_def_float(ot->srna, "value", 1.0, 0, 1.0, "Value", diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 2899cfeedcf..40210d63566 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -66,7 +66,7 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) Paint *paint = BKE_paint_get_active_from_context(C); Brush *br = BKE_paint_brush(paint); Main *bmain = CTX_data_main(C); - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); if (br) br = BKE_brush_copy(bmain, br); @@ -195,7 +195,7 @@ static int palette_color_add_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); Paint *paint = BKE_paint_get_active_from_context(C); Brush *brush = paint->brush; - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); Palette *palette = paint->palette; PaletteColor *color; @@ -455,7 +455,7 @@ static int brush_select_exec(bContext *C, wmOperator *op) static void PAINT_OT_brush_select(wmOperatorType *ot) { - static EnumPropertyItem paint_mode_items[] = { + static const EnumPropertyItem paint_mode_items[] = { {OB_MODE_ACTIVE, "ACTIVE", 0, "Current", "Set brush for active paint mode"}, {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""}, {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""}, @@ -776,7 +776,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve static int stencil_control_poll(bContext *C) { - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); Paint *paint; Brush *br; @@ -793,14 +793,14 @@ static int stencil_control_poll(bContext *C) static void BRUSH_OT_stencil_control(wmOperatorType *ot) { - static EnumPropertyItem stencil_control_items[] = { + static const EnumPropertyItem stencil_control_items[] = { {STENCIL_TRANSLATE, "TRANSLATION", 0, "Translation", ""}, {STENCIL_SCALE, "SCALE", 0, "Scale", ""}, {STENCIL_ROTATE, "ROTATION", 0, "Rotation", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem stencil_texture_items[] = { + static const EnumPropertyItem stencil_texture_items[] = { {STENCIL_PRIMARY, "PRIMARY", 0, "Primary", ""}, {STENCIL_SECONDARY, "SECONDARY", 0, "Secondary", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index d92afd414f8..dacaea6a96e 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -201,7 +201,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) glDisable(GL_LINE_SMOOTH); } -static bool paint_tool_require_location(Brush *brush, PaintMode mode) +static bool paint_tool_require_location(Brush *brush, ePaintMode mode) { switch (mode) { case ePaintSculpt: @@ -223,7 +223,7 @@ static bool paint_tool_require_location(Brush *brush, PaintMode mode) /* Initialize the stroke cache variants from operator properties */ static bool paint_brush_update(bContext *C, Brush *brush, - PaintMode mode, + ePaintMode mode, struct PaintStroke *stroke, const float mouse_init[2], float mouse[2], float pressure, @@ -405,7 +405,7 @@ static bool paint_brush_update(bContext *C, return location_success; } -static bool paint_stroke_use_jitter(PaintMode mode, Brush *brush, bool invert) +static bool paint_stroke_use_jitter(ePaintMode mode, Brush *brush, bool invert) { bool use_jitter = (brush->flag & BRUSH_ABSOLUTE_JITTER) ? (brush->jitter_absolute != 0) : (brush->jitter != 0); @@ -425,7 +425,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float { Scene *scene = CTX_data_scene(C); Paint *paint = BKE_paint_get_active_from_context(C); - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); Brush *brush = BKE_paint_brush(paint); PaintStroke *stroke = op->customdata; UnifiedPaintSettings *ups = stroke->ups; @@ -500,7 +500,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float /* Returns zero if no sculpt changes should be made, non-zero otherwise */ static bool paint_smooth_stroke( - PaintStroke *stroke, const PaintSample *sample, PaintMode mode, + PaintStroke *stroke, const PaintSample *sample, ePaintMode mode, float r_mouse[2], float *r_pressure) { if (paint_supports_smooth_stroke(stroke->brush, mode)) { @@ -766,7 +766,7 @@ static void stroke_done(struct bContext *C, struct wmOperator *op) } /* Returns zero if the stroke dots should not be spaced, non-zero otherwise */ -bool paint_space_stroke_enabled(Brush *br, PaintMode mode) +bool paint_space_stroke_enabled(Brush *br, ePaintMode mode) { return (br->flag & BRUSH_SPACE) && paint_supports_dynamic_size(br, mode); } @@ -781,7 +781,7 @@ static bool sculpt_is_grab_tool(Brush *br) } /* return true if the brush size can change during paint (normally used for pressure) */ -bool paint_supports_dynamic_size(Brush *br, PaintMode mode) +bool paint_supports_dynamic_size(Brush *br, ePaintMode mode) { if (br->flag & BRUSH_ANCHORED) return false; @@ -807,7 +807,7 @@ bool paint_supports_dynamic_size(Brush *br, PaintMode mode) return true; } -bool paint_supports_smooth_stroke(Brush *br, PaintMode mode) +bool paint_supports_smooth_stroke(Brush *br, ePaintMode mode) { if (!(br->flag & BRUSH_SMOOTH_STROKE) || (br->flag & (BRUSH_ANCHORED | BRUSH_DRAG_DOT | BRUSH_LINE))) @@ -826,14 +826,14 @@ bool paint_supports_smooth_stroke(Brush *br, PaintMode mode) return true; } -bool paint_supports_texture(PaintMode mode) +bool paint_supports_texture(ePaintMode mode) { /* omit: PAINT_WEIGHT, PAINT_SCULPT_UV, PAINT_INVALID */ return ELEM(mode, ePaintSculpt, ePaintVertex, ePaintTextureProjective, ePaintTexture2D); } /* return true if the brush size can change during paint (normally used for pressure) */ -bool paint_supports_dynamic_tex_coords(Brush *br, PaintMode mode) +bool paint_supports_dynamic_tex_coords(Brush *br, ePaintMode mode) { if (br->flag & BRUSH_ANCHORED) return false; @@ -1095,7 +1095,7 @@ static void paint_stroke_line_constrain(PaintStroke *stroke, float mouse[2]) int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event) { Paint *p = BKE_paint_get_active_from_context(C); - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); PaintStroke *stroke = op->customdata; Brush *br = stroke->brush; PaintSample sample_average; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index bb69a5d3db9..bf00ce865e9 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -207,14 +207,17 @@ void paint_get_tex_pixel_col(const MTex *mtex, float u, float v, float rgba[4], void paint_stroke_operator_properties(wmOperatorType *ot) { - static EnumPropertyItem stroke_mode_items[] = { + static const EnumPropertyItem stroke_mode_items[] = { {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"}, {BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"}, {BRUSH_STROKE_SMOOTH, "SMOOTH", 0, "Smooth", "Switch brush to smooth mode for duration of stroke"}, {0} }; - RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + PropertyRNA *prop; + + prop = RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, "Stroke Mode", @@ -279,7 +282,7 @@ static void imapaint_pick_uv(EvaluationContext *eval_ctx, Scene *scene, Object * float p[2], w[3], absw, minabsw; float matrix[4][4], proj[4][4]; GLint view[4]; - const ImagePaintMode mode = scene->toolsettings->imapaint.mode; + const eImageePaintMode mode = scene->toolsettings->imapaint.mode; const MLoopTri *lt = dm->getLoopTriArray(dm); const MPoly *mpoly = dm->getPolyArray(dm); const MLoop *mloop = dm->getLoopArray(dm); @@ -582,7 +585,7 @@ static int brush_curve_preset_poll(bContext *C) void BRUSH_OT_curve_preset(wmOperatorType *ot) { PropertyRNA *prop; - static EnumPropertyItem prop_shape_items[] = { + static const EnumPropertyItem prop_shape_items[] = { {CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""}, {CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""}, {CURVE_PRESET_MAX, "MAX", 0, "Max", ""}, diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index ef86f3c773d..1348847167c 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -145,7 +145,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op) void PAINT_OT_weight_from_bones(wmOperatorType *ot) { - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights from bones"}, {ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"}, {0, NULL, 0, NULL, NULL}}; @@ -288,7 +288,7 @@ static bool weight_paint_sample_enum_itemf__helper(const MDeformVert *dvert, con } return found; } -static EnumPropertyItem *weight_paint_sample_enum_itemf( +static const EnumPropertyItem *weight_paint_sample_enum_itemf( bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { if (C) { @@ -827,7 +827,7 @@ static int paint_weight_gradient_invoke(bContext *C, wmOperator *op, const wmEve /* TODO, hardcoded, extend WM_gesture_straightline_ */ if (event->type == LEFTMOUSE && event->val == KM_PRESS) { wmGesture *gesture = op->customdata; - gesture->mode = 1; + gesture->is_active = true; } } } @@ -837,7 +837,7 @@ static int paint_weight_gradient_invoke(bContext *C, wmOperator *op, const wmEve void PAINT_OT_weight_gradient(wmOperatorType *ot) { /* defined in DNA_space_types.h */ - static EnumPropertyItem gradient_types[] = { + static const EnumPropertyItem gradient_types[] = { {WPAINT_GRADIENT_TYPE_LINEAR, "LINEAR", 0, "Linear", ""}, {WPAINT_GRADIENT_TYPE_RADIAL, "RADIAL", 0, "Radial", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index dff536f91f2..ca5d0f53ea4 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3920,7 +3920,7 @@ static const char *sculpt_tool_name(Sculpt *sd) { Brush *brush = BKE_paint_brush(&sd->paint); - switch ((BrushSculptTool)brush->sculpt_tool) { + switch ((eBrushSculptTool)brush->sculpt_tool) { case SCULPT_TOOL_DRAW: return "Draw Brush"; case SCULPT_TOOL_SMOOTH: diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 14e82e94d30..c9453f94e61 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -905,7 +905,7 @@ static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, const wmEvent *ev void SCULPT_OT_uv_sculpt_stroke(wmOperatorType *ot) { - static EnumPropertyItem stroke_mode_items[] = { + static const EnumPropertyItem stroke_mode_items[] = { {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"}, {BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"}, {BRUSH_STROKE_SMOOTH, "RELAX", 0, "Relax", "Switch brush to relax mode for duration of stroke"}, diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 4d67247e985..e82542cbcb2 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -397,7 +397,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op) } #ifdef WITH_AUDASPACE -static EnumPropertyItem container_items[] = { +static const EnumPropertyItem container_items[] = { #ifdef WITH_FFMPEG {AUD_CONTAINER_AC3, "AC3", 0, "ac3", "Dolby Digital ATRAC 3"}, #endif @@ -429,7 +429,7 @@ static bool sound_mixdown_check(bContext *UNUSED(C), wmOperator *op) const char *extension = NULL; - EnumPropertyItem *item = container_items; + const EnumPropertyItem *item = container_items; while (item->identifier != NULL) { if (item->value == container) { const char **ext = snd_ext_sound; @@ -491,7 +491,7 @@ static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA * static void sound_mixdown_draw(bContext *C, wmOperator *op) { - static EnumPropertyItem pcm_format_items[] = { + static const EnumPropertyItem pcm_format_items[] = { {AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"}, {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, #ifdef WITH_SNDFILE @@ -503,21 +503,21 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem mp3_format_items[] = { + static const EnumPropertyItem mp3_format_items[] = { {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, {AUD_FORMAT_S32, "S32", 0, "S32", "32 bit signed"}, {0, NULL, 0, NULL, NULL} }; #ifdef WITH_SNDFILE - static EnumPropertyItem flac_format_items[] = { + static const EnumPropertyItem flac_format_items[] = { {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, {AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"}, {0, NULL, 0, NULL, NULL} }; #endif - static EnumPropertyItem all_codec_items[] = { + static const EnumPropertyItem all_codec_items[] = { {AUD_CODEC_AAC, "AAC", 0, "AAC", "Advanced Audio Coding"}, {AUD_CODEC_AC3, "AC3", 0, "AC3", "Dolby Digital ATRAC 3"}, {AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"}, @@ -528,7 +528,7 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem ogg_codec_items[] = { + static const EnumPropertyItem ogg_codec_items[] = { {AUD_CODEC_FLAC, "FLAC", 0, "FLAC", "Free Lossless Audio Codec"}, {AUD_CODEC_VORBIS, "VORBIS", 0, "Vorbis", "Xiph.Org Vorbis Codec"}, {0, NULL, 0, NULL, NULL} @@ -641,7 +641,7 @@ static void sound_mixdown_draw(bContext *C, wmOperator *op) static void SOUND_OT_mixdown(wmOperatorType *ot) { #ifdef WITH_AUDASPACE - static EnumPropertyItem format_items[] = { + static const EnumPropertyItem format_items[] = { {AUD_FORMAT_U8, "U8", 0, "U8", "8 bit unsigned"}, {AUD_FORMAT_S16, "S16", 0, "S16", "16 bit signed"}, {AUD_FORMAT_S24, "S24", 0, "S24", "24 bit signed"}, @@ -651,7 +651,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem codec_items[] = { + static const EnumPropertyItem codec_items[] = { #ifdef WITH_FFMPEG {AUD_CODEC_AAC, "AAC", 0, "AAC", "Advanced Audio Coding"}, {AUD_CODEC_AC3, "AC3", 0, "AC3", "Dolby Digital ATRAC 3"}, diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index a9920389980..72b1245ca8a 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -660,7 +660,7 @@ void ACTION_OT_paste(wmOperatorType *ot) /* ******************** Insert Keyframes Operator ************************* */ /* defines for insert keyframes tool */ -static EnumPropertyItem prop_actkeys_insertkey_types[] = { +static const EnumPropertyItem prop_actkeys_insertkey_types[] = { {1, "ALL", 0, "All Channels", ""}, {2, "SEL", 0, "Only Selected Channels", ""}, {3, "GROUP", 0, "In Active Group", ""}, /* XXX not in all cases */ @@ -1110,7 +1110,7 @@ void ACTION_OT_sample(wmOperatorType *ot) #define CLEAR_CYCLIC_EXPO -2 /* defines for set extrapolation-type for selected keyframes tool */ -static EnumPropertyItem prop_actkeys_expo_types[] = { +static const EnumPropertyItem prop_actkeys_expo_types[] = { {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", "Values on endpoint keyframes are held"}, {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", "Straight-line slope of end segments are extended past the endpoint keyframes"}, @@ -1146,7 +1146,7 @@ static void setexpo_action_keys(bAnimContext *ac, short mode) /* only add if one doesn't exist */ if (list_has_suitable_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, -1) == 0) { /* TODO: add some more preset versions which set different extrapolation options? */ - add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES); + add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, fcu); } } else if (mode == CLEAR_CYCLIC_EXPO) { @@ -1550,7 +1550,7 @@ void ACTION_OT_frame_jump(wmOperatorType *ot) /* ******************** Snap Keyframes Operator *********************** */ /* defines for snap keyframes tool */ -static EnumPropertyItem prop_actkeys_snap_types[] = { +static const EnumPropertyItem prop_actkeys_snap_types[] = { {ACTKEYS_SNAP_CFRA, "CFRA", 0, "Current frame", "Snap selected keyframes to the current frame"}, {ACTKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", @@ -1659,7 +1659,7 @@ void ACTION_OT_snap(wmOperatorType *ot) /* ******************** Mirror Keyframes Operator *********************** */ /* defines for mirror keyframes tool */ -static EnumPropertyItem prop_actkeys_mirror_types[] = { +static const EnumPropertyItem prop_actkeys_mirror_types[] = { {ACTKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current frame", "Flip times of selected keyframes using the current frame as the mirror line"}, {ACTKEYS_MIRROR_XAXIS, "XAXIS", 0, "By Values over Value=0", diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 17edbc6cc1d..1c55a0d76cf 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -309,26 +309,27 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; short mode = 0, selectmode = 0; - int gesture_mode; - bool extend; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; /* clear all selection if not extending selection */ - extend = RNA_boolean_get(op->ptr, "extend"); - if (!extend) + if (!extend) { deselect_action_keys(&ac, 1, SELECT_SUBTRACT); + } /* get settings from operator */ WM_operator_properties_border_to_rcti(op, &rect); - - gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - if (gesture_mode == GESTURE_MODAL_SELECT) + + if (select) { selectmode = SELECT_ADD; - else + } + else { selectmode = SELECT_SUBTRACT; + } /* selection 'mode' depends on whether borderselect region only matters on one axis */ if (RNA_boolean_get(op->ptr, "axis_range")) { @@ -362,10 +363,10 @@ void ACTION_OT_select_border(wmOperatorType *ot) ot->description = "Select all keyframes within the specified region"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = actkeys_borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_action_active; @@ -373,7 +374,7 @@ void ACTION_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); } @@ -572,9 +573,7 @@ void ACTION_OT_select_lasso(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first"); + WM_operator_properties_gesture_lasso_select(ot); } /* ------------------- */ @@ -582,8 +581,8 @@ void ACTION_OT_select_lasso(wmOperatorType *ot) static int action_circle_select_exec(bContext *C, wmOperator *op) { bAnimContext ac; - const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - const short selectmode = (gesture_mode == GESTURE_MODAL_SELECT) ? SELECT_ADD : SELECT_SUBTRACT; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const short selectmode = select ? SELECT_ADD : SELECT_SUBTRACT; KeyframeEdit_CircleData data = {0}; rctf rect_fl; @@ -629,11 +628,9 @@ void ACTION_OT_select_circle(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_UNDO; - - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + + /* properties */ + WM_operator_properties_gesture_circle_select(ot); } /* ******************** Column Select Operator **************************** */ @@ -645,7 +642,7 @@ void ACTION_OT_select_circle(wmOperatorType *ot) */ /* defines for column-select mode */ -static EnumPropertyItem prop_column_select_types[] = { +static const EnumPropertyItem prop_column_select_types[] = { {ACTKEYS_COLUMNSEL_KEYS, "KEYS", 0, "On Selected Keyframes", ""}, {ACTKEYS_COLUMNSEL_CFRA, "CFRA", 0, "On Current Frame", ""}, {ACTKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", 0, "On Selected Markers", ""}, @@ -1013,7 +1010,7 @@ void ACTION_OT_select_less(wmOperatorType *ot) /* Select keyframes left/right of the current frame indicator */ /* defines for left-right select tool */ -static EnumPropertyItem prop_actkeys_leftright_select_types[] = { +static const EnumPropertyItem prop_actkeys_leftright_select_types[] = { {ACTKEYS_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""}, {ACTKEYS_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""}, {ACTKEYS_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""}, diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index f4affb90cc3..50882571dad 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -409,7 +409,8 @@ static void action_main_region_listener( /* editor level listener */ static void action_listener( - bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) + bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { SpaceAction *saction = (SpaceAction *)sa->spacedata.first; diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index f6c15f4d030..8aa4e674d11 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -57,6 +57,7 @@ #include "BKE_screen.h" #include "BKE_texture.h" #include "BKE_linestyle.h" +#include "BKE_workspace.h" #include "RNA_access.h" @@ -168,29 +169,53 @@ static int buttons_context_path_linestyle(ButsContextPath *path) return 0; } +static int buttons_context_path_workspace(ButsContextPath *path) +{ + PointerRNA *ptr = &path->ptr[path->len - 1]; + + /* This one just verifies. */ + return RNA_struct_is_a(ptr->type, &RNA_WorkSpace); +} + +static int buttons_context_path_collection(ButsContextPath *path) +{ + PointerRNA *ptr = &path->ptr[path->len - 1]; + + /* if we already have a (pinned) Collection, we're done */ + if (RNA_struct_is_a(ptr->type, &RNA_LayerCollection)) { + return 1; + } + + SceneLayer *sl = ptr->data; + LayerCollection *sc = BKE_layer_collection_get_active(sl); + + if (sc) { + RNA_pointer_create(NULL, &RNA_LayerCollection, sc, &path->ptr[path->len]); + path->len++; + return 1; + } + + /* no path to a collection possible */ + return 0; +} + static int buttons_context_path_object(ButsContextPath *path) { - Scene *scene; - Object *ob; PointerRNA *ptr = &path->ptr[path->len - 1]; /* if we already have a (pinned) object, we're done */ if (RNA_struct_is_a(ptr->type, &RNA_Object)) { return 1; } - /* if we have a scene, use the scene's active object */ - else if (buttons_context_path_scene(path)) { - scene = path->ptr[path->len - 1].data; - SceneLayer *sl = BKE_scene_layer_context_active_PLACEHOLDER(scene); - ob = (sl->basact) ? sl->basact->object : NULL; + SceneLayer *sl = ptr->data; + Object *ob = (sl->basact) ? sl->basact->object : NULL; - if (ob) { - RNA_id_pointer_create(&ob->id, &path->ptr[path->len]); - path->len++; + if (ob) { + RNA_id_pointer_create(&ob->id, &path->ptr[path->len]); + path->len++; - return 1; - } + return 1; } /* no path to a object possible */ @@ -559,39 +584,11 @@ static bool buttons_context_linestyle_pinnable(const bContext *C) } #endif -static int buttons_context_path_collection(const bContext *C, ButsContextPath *path) -{ - PointerRNA *ptr = &path->ptr[path->len - 1]; - - /* if we already have a (pinned) Collection, we're done */ - if (RNA_struct_is_a(ptr->type, &RNA_LayerCollection)) { - return 1; - } - - SceneLayer *sl = CTX_data_scene_layer(C); - LayerCollection *sc = BKE_layer_collection_get_active(sl); - - if (sc) { - RNA_pointer_create(NULL, &RNA_LayerCollection, sc, &path->ptr[path->len]); - path->len++; - - /* temporary object in context path to get edit mode */ - Object *ob = CTX_data_active_object(C); - if (ob) { - RNA_id_pointer_create(&ob->id, &path->ptr[path->len]); - path->len++; - } - - return 1; - } - - /* no path to a collection possible */ - return 0; -} - static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag) { SpaceButs *sbuts = CTX_wm_space_buts(C); + Scene *scene = CTX_data_scene(C); + WorkSpace *workspace = CTX_wm_workspace(C); ID *id; int found; @@ -599,18 +596,32 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma path->flag = flag; path->tex_ctx = sbuts->texture_context; - /* if some ID datablock is pinned, set the root pointer */ + const bool use_scene_settings = BKE_workspace_use_scene_settings_get(workspace); + + /* If some ID datablock is pinned, set the root pointer. */ if (sbuts->pinid) { id = sbuts->pinid; RNA_id_pointer_create(id, &path->ptr[0]); path->len++; } + /* No pinned root, use scene or workspace as initial root. */ + else { + if ((mainb != BCONTEXT_WORKSPACE) && (use_scene_settings || + ELEM(mainb, BCONTEXT_SCENE, BCONTEXT_RENDER, BCONTEXT_RENDER_LAYER, BCONTEXT_WORLD))) + { + RNA_id_pointer_create(&scene->id, &path->ptr[0]); + path->len++; + } + else { + RNA_id_pointer_create(&workspace->id, &path->ptr[0]); + path->len++; + } + } - /* no pinned root, use scene as root */ - if (path->len == 0) { - id = (ID *)CTX_data_scene(C); - RNA_id_pointer_create(id, &path->ptr[0]); + if (!ELEM(mainb, BCONTEXT_WORKSPACE, BCONTEXT_SCENE, BCONTEXT_RENDER, BCONTEXT_RENDER_LAYER, BCONTEXT_WORLD)) { + SceneLayer *scene_layer = BKE_scene_layer_from_workspace_get(scene, workspace); + RNA_pointer_create(NULL, &RNA_SceneLayer, scene_layer, &path->ptr[path->len]); path->len++; } @@ -635,6 +646,12 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma case BCONTEXT_WORLD: found = buttons_context_path_world(path); break; + case BCONTEXT_WORKSPACE: + found = buttons_context_path_workspace(path); + break; + case BCONTEXT_COLLECTION: + found = buttons_context_path_collection(path); + break; case BCONTEXT_OBJECT: case BCONTEXT_PHYSICS: case BCONTEXT_CONSTRAINT: @@ -663,9 +680,6 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma case BCONTEXT_BONE_CONSTRAINT: found = buttons_context_path_pose_bone(path); break; - case BCONTEXT_COLLECTION: - found = buttons_context_path_collection(C, path); - break; default: found = 0; break; @@ -783,7 +797,7 @@ const char *buttons_context_dir[] = { "texture", "texture_user", "texture_user_property", "bone", "edit_bone", "pose_bone", "particle_system", "particle_system_editable", "particle_settings", "cloth", "soft_body", "fluid", "smoke", "collision", "brush", "dynamic_paint", - "line_style", "collection", NULL + "line_style", "collection", "workspace", NULL }; int buttons_context(const bContext *C, const char *member, bContextDataResult *result) @@ -812,6 +826,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_World); return 1; } + else if (CTX_data_equals(member, "workspace")) { + /* Do not return one here if scene not found in path, in this case we want to get default context scene! */ + return set_pointer_type(path, result, &RNA_WorkSpace); + } else if (CTX_data_equals(member, "object")) { set_pointer_type(path, result, &RNA_Object); return 1; @@ -1168,10 +1186,14 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) name = RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL); if (name) { - if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_RENDER_LAYER) && ptr->type == &RNA_Scene) + if ((!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_RENDER_LAYER) && ptr->type == &RNA_Scene) || + (!ELEM(sbuts->mainb, BCONTEXT_WORKSPACE) && ptr->type == &RNA_WorkSpace)) + { uiItemLDrag(row, ptr, "", icon); /* save some space */ - else + } + else { uiItemLDrag(row, ptr, name, icon); + } if (name != namebuf) MEM_freeN(name); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 299ab7171d6..3607f817721 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -151,6 +151,10 @@ static void buttons_main_region_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, "render_layer", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_WORLD) ED_region_panels(C, ar, "world", sbuts->mainb, vertical); + else if (sbuts->mainb == BCONTEXT_WORKSPACE) + ED_region_panels(C, ar, "workspace", sbuts->mainb, vertical); + else if (sbuts->mainb == BCONTEXT_COLLECTION) + ED_region_panels(C, ar, "collection", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_OBJECT) ED_region_panels(C, ar, "object", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_DATA) @@ -171,8 +175,6 @@ static void buttons_main_region_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, "constraint", sbuts->mainb, vertical); else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT) ED_region_panels(C, ar, "bone_constraint", sbuts->mainb, vertical); - else if (sbuts->mainb == BCONTEXT_COLLECTION) - ED_region_panels(C, ar, "collection", sbuts->mainb, vertical); sbuts->re_align = 0; sbuts->mainbo = sbuts->mainb; @@ -235,7 +237,8 @@ static void buttons_area_redraw(ScrArea *sa, short buttons) /* reused! */ static void buttons_area_listener( - bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) + bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { SpaceButs *sbuts = sa->spacedata.first; diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index edac128d18b..e5a3cb6b57b 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -332,8 +332,7 @@ void CLIP_OT_graph_select(wmOperatorType *ot) typedef struct BorderSelectuserData { rctf rect; - int mode; - bool changed, extend; + bool select, extend, changed; } BorderSelectuserData; static void border_select_cb(void *userdata, MovieTrackingTrack *UNUSED(track), @@ -349,11 +348,12 @@ static void border_select_cb(void *userdata, MovieTrackingTrack *UNUSED(track), else flag = MARKER_GRAPH_SEL_Y; - if (data->mode == GESTURE_MODAL_SELECT) + if (data->select) { marker->flag |= flag; - else + } + else { marker->flag &= ~flag; - + } data->changed = true; } else if (!data->extend) { @@ -381,7 +381,7 @@ static int border_select_graph_exec(bContext *C, wmOperator *op) UI_view2d_region_to_view_rctf(&ar->v2d, &rect, &userdata.rect); userdata.changed = false; - userdata.mode = RNA_int_get(op->ptr, "gesture_mode"); + userdata.select = !RNA_boolean_get(op->ptr, "deselect"); userdata.extend = RNA_boolean_get(op->ptr, "extend"); clip_graph_tracking_values_iterate_track(sc, act_track, &userdata, border_select_cb, NULL, NULL); @@ -403,16 +403,16 @@ void CLIP_OT_graph_select_border(wmOperatorType *ot) ot->idname = "CLIP_OT_graph_select_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = border_select_graph_exec; - ot->modal = WM_border_select_modal; + ot->modal = WM_gesture_border_modal; ot->poll = clip_graph_knots_poll; /* flags */ ot->flag = OPTYPE_UNDO; /* properties */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } /********************** select all operator *********************/ @@ -701,7 +701,7 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op) void CLIP_OT_graph_disable_markers(wmOperatorType *ot) { - static EnumPropertyItem actions_items[] = { + static const EnumPropertyItem actions_items[] = { {0, "DISABLE", 0, "Disable", "Disable selected markers"}, {1, "ENABLE", 0, "Enable", "Enable selected markers"}, {2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"}, diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index f185eea6d32..478254fb165 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -330,7 +330,8 @@ static SpaceLink *clip_duplicate(SpaceLink *sl) return (SpaceLink *)scn; } -static void clip_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) +static void clip_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index ea7ede46887..2439ac06d9c 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1138,7 +1138,7 @@ static int clear_track_path_exec(bContext *C, wmOperator *op) void CLIP_OT_clear_track_path(wmOperatorType *ot) { - static EnumPropertyItem clear_path_actions[] = { + static const EnumPropertyItem clear_path_actions[] = { {TRACK_CLEAR_UPTO, "UPTO", 0, "Clear up-to", "Clear path up to current frame"}, {TRACK_CLEAR_REMAINED, "REMAINED", 0, "Clear remained", "Clear path at remaining frames (after current)"}, {TRACK_CLEAR_ALL, "ALL", 0, "Clear all", "Clear the whole path"}, @@ -1210,7 +1210,7 @@ static int disable_markers_exec(bContext *C, wmOperator *op) void CLIP_OT_disable_markers(wmOperatorType *ot) { - static EnumPropertyItem actions_items[] = { + static const EnumPropertyItem actions_items[] = { {MARKER_OP_DISABLE, "DISABLE", 0, "Disable", "Disable selected markers"}, {MARKER_OP_ENABLE, "ENABLE", 0, "Enable", @@ -1477,7 +1477,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op) void CLIP_OT_frame_jump(wmOperatorType *ot) { - static EnumPropertyItem position_items[] = { + static const EnumPropertyItem position_items[] = { {0, "PATHSTART", 0, "Path Start", "Jump to start of current path"}, {1, "PATHEND", 0, "Path End", "Jump to end of current path"}, {2, "FAILEDPREV", 0, "Previous Failed", "Jump to previous failed frame"}, @@ -1645,7 +1645,7 @@ static int lock_tracks_exec(bContext *C, wmOperator *op) void CLIP_OT_lock_tracks(wmOperatorType *ot) { - static EnumPropertyItem actions_items[] = { + static const EnumPropertyItem actions_items[] = { {TRACK_ACTION_LOCK, "LOCK", 0, "Lock", "Lock selected tracks"}, {TRACK_ACTION_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock selected tracks"}, {TRACK_ACTION_TOGGLE, "TOGGLE", 0, "Toggle", @@ -1701,7 +1701,7 @@ static int set_solver_keyframe_exec(bContext *C, wmOperator *op) void CLIP_OT_set_solver_keyframe(wmOperatorType *ot) { - static EnumPropertyItem keyframe_items[] = { + static const EnumPropertyItem keyframe_items[] = { {SOLVER_KEYFRAME_A, "KEYFRAME_A", 0, "Keyframe A", ""}, {SOLVER_KEYFRAME_B, "KEYFRAME_B", 0, "Keyframe B", ""}, {0, NULL, 0, NULL, NULL} @@ -1972,7 +1972,7 @@ static int clean_tracks_invoke(bContext *C, void CLIP_OT_clean_tracks(wmOperatorType *ot) { - static EnumPropertyItem actions_items[] = { + static const EnumPropertyItem actions_items[] = { {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"}, {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", diff --git a/source/blender/editors/space_clip/tracking_ops_detect.c b/source/blender/editors/space_clip/tracking_ops_detect.c index 992c347a630..0ee06b305da 100644 --- a/source/blender/editors/space_clip/tracking_ops_detect.c +++ b/source/blender/editors/space_clip/tracking_ops_detect.c @@ -128,7 +128,7 @@ static int detect_features_exec(bContext *C, wmOperator *op) void CLIP_OT_detect_features(wmOperatorType *ot) { - static EnumPropertyItem placement_items[] = { + static const EnumPropertyItem placement_items[] = { {0, "FRAME", 0, "Whole Frame", "Place markers across the whole frame"}, {1, "INSIDE_GPENCIL", 0, "Inside grease pencil", diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c index c411f64a88b..1abfa0ae2a4 100644 --- a/source/blender/editors/space_clip/tracking_ops_orient.c +++ b/source/blender/editors/space_clip/tracking_ops_orient.c @@ -509,7 +509,7 @@ static int set_plane_exec(bContext *C, wmOperator *op) void CLIP_OT_set_plane(wmOperatorType *ot) { - static EnumPropertyItem plane_items[] = { + static const EnumPropertyItem plane_items[] = { {0, "FLOOR", 0, "Floor", "Set floor plane"}, {1, "WALL", 0, "Wall", "Set wall plane"}, {0, NULL, 0, NULL, NULL} @@ -583,7 +583,7 @@ static int set_axis_exec(bContext *C, wmOperator *op) void CLIP_OT_set_axis(wmOperatorType *ot) { - static EnumPropertyItem axis_actions[] = { + static const EnumPropertyItem axis_actions[] = { {0, "X", 0, "X", "Align bundle align X axis"}, {1, "Y", 0, "Y", "Align bundle align Y axis"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index e970b1b9743..eddd65475a2 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -438,7 +438,6 @@ static int border_select_exec(bContext *C, wmOperator *op) rcti rect; rctf rectf; bool changed = false; - int mode, extend; int framenr = ED_space_clip_get_clip_frame_number(sc); /* get rectangle from operator */ @@ -447,8 +446,8 @@ static int border_select_exec(bContext *C, wmOperator *op) ED_clip_point_stable_pos(sc, ar, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin); ED_clip_point_stable_pos(sc, ar, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax); - mode = RNA_int_get(op->ptr, "gesture_mode"); - extend = RNA_boolean_get(op->ptr, "extend"); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); /* do actual selection */ track = tracksbase->first; @@ -458,10 +457,12 @@ static int border_select_exec(bContext *C, wmOperator *op) if (MARKER_VISIBLE(sc, track, marker)) { if (BLI_rctf_isect_pt_v(&rectf, marker->pos)) { - if (mode == GESTURE_MODAL_SELECT) + if (select) { BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT); - else + } + else { BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT); + } } else if (!extend) { BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT); @@ -485,7 +486,7 @@ static int border_select_exec(bContext *C, wmOperator *op) for (i = 0; i < 4; i++) { if (BLI_rctf_isect_pt_v(&rectf, plane_marker->corners[i])) { - if (mode == GESTURE_MODAL_SELECT) { + if (select) { plane_track->flag |= SELECT; } else { @@ -520,16 +521,16 @@ void CLIP_OT_select_border(wmOperatorType *ot) ot->idname = "CLIP_OT_select_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = border_select_exec; - ot->modal = WM_border_select_modal; + ot->modal = WM_gesture_border_modal; ot->poll = ED_space_clip_tracking_poll; /* flags */ ot->flag = OPTYPE_UNDO; /* properties */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } /********************** lasso select operator *********************/ @@ -656,9 +657,7 @@ void CLIP_OT_select_lasso(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + WM_operator_properties_gesture_lasso_select(ot); } /********************** circle select operator *********************/ @@ -690,17 +689,17 @@ static int circle_select_exec(bContext *C, wmOperator *op) MovieTrackingPlaneTrack *plane_track; ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking); ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking); - int x, y, radius, width, height, mode; + int width, height; bool changed = false; float zoomx, zoomy, offset[2], ellipse[2]; int framenr = ED_space_clip_get_clip_frame_number(sc); /* get operator properties */ - x = RNA_int_get(op->ptr, "x"); - y = RNA_int_get(op->ptr, "y"); - radius = RNA_int_get(op->ptr, "radius"); + const int x = RNA_int_get(op->ptr, "x"); + const int y = RNA_int_get(op->ptr, "y"); + const int radius = RNA_int_get(op->ptr, "radius"); - mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); /* compute ellipse and position in unified coordinates */ ED_space_clip_get_size(sc, &width, &height); @@ -718,11 +717,12 @@ static int circle_select_exec(bContext *C, wmOperator *op) MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr); if (MARKER_VISIBLE(sc, track, marker) && marker_inside_ellipse(marker, offset, ellipse)) { - if (mode == GESTURE_MODAL_SELECT) + if (select) { BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT); - else + } + else { BKE_tracking_track_flag_clear(track, TRACK_AREA_ALL, SELECT); - + } changed = true; } } @@ -741,7 +741,7 @@ static int circle_select_exec(bContext *C, wmOperator *op) for (i = 0; i < 4; i++) { if (point_inside_ellipse(plane_marker->corners[i], offset, ellipse)) { - if (mode == GESTURE_MODAL_SELECT) { + if (select) { plane_track->flag |= SELECT; } else { @@ -782,10 +782,7 @@ void CLIP_OT_select_circle(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + WM_operator_properties_gesture_circle_select(ot); } /********************** select all operator *********************/ @@ -975,7 +972,7 @@ static int select_groped_exec(bContext *C, wmOperator *op) void CLIP_OT_select_grouped(wmOperatorType *ot) { - static EnumPropertyItem select_group_items[] = { + static const EnumPropertyItem select_group_items[] = { {0, "KEYFRAMED", 0, "Keyframed tracks", "Select all keyframed tracks"}, {1, "ESTIMATED", 0, "Estimated tracks", "Select all estimated tracks"}, {2, "TRACKED", 0, "Tracked tracks", "Select all tracked tracks"}, diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 2b99c4dfa3d..b740ff4b397 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -299,7 +299,7 @@ static bool console_line_column_from_index( /* static funcs for text editing */ /* similar to the text editor, with some not used. keep compatible */ -static EnumPropertyItem console_move_type_items[] = { +static const EnumPropertyItem console_move_type_items[] = { {LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""}, {LINE_END, "LINE_END", 0, "Line End", ""}, {PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""}, @@ -570,7 +570,7 @@ void CONSOLE_OT_unindent(wmOperatorType *ot) ot->poll = ED_operator_console_active; } -static EnumPropertyItem console_delete_type_items[] = { +static const EnumPropertyItem console_delete_type_items[] = { {DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""}, {DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""}, {DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""}, @@ -895,7 +895,7 @@ static int console_scrollback_append_exec(bContext *C, wmOperator *op) void CONSOLE_OT_scrollback_append(wmOperatorType *ot) { /* defined in DNA_space_types.h */ - static EnumPropertyItem console_line_type_items[] = { + static const EnumPropertyItem console_line_type_items[] = { {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""}, {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""}, {CONSOLE_LINE_INFO, "INFO", 0, "Information", ""}, diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 22c1214d928..cca33cdd1a7 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -105,7 +105,7 @@ static void file_deselect_all(SpaceFile *sfile, unsigned int flag) filelist_entries_select_index_range_set(sfile->files, &sel, FILE_SEL_REMOVE, flag, CHECK_ALL); } -typedef enum FileSelect { +typedef enum FileSelect { FILE_SELECT_NOTHING = 0, FILE_SELECT_DIR = 1, FILE_SELECT_FILE = 2 @@ -370,7 +370,7 @@ static int file_border_select_modal(bContext *C, wmOperator *op, const wmEvent * int result; - result = WM_border_select_modal(C, op, event); + result = WM_gesture_border_modal(C, op, event); if (result == OPERATOR_RUNNING_MODAL) { WM_operator_properties_border_to_rcti(op, &rect); @@ -419,7 +419,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op) SpaceFile *sfile = CTX_wm_space_file(C); rcti rect; FileSelect ret; - const bool select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); const bool extend = RNA_boolean_get(op->ptr, "extend"); WM_operator_properties_border_to_rcti(op, &rect); @@ -452,14 +452,14 @@ void FILE_OT_select_border(wmOperatorType *ot) ot->idname = "FILE_OT_select_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = file_border_select_exec; ot->modal = file_border_select_modal; ot->poll = ED_operator_file_active; - ot->cancel = WM_border_select_cancel; + ot->cancel = WM_gesture_border_cancel; /* properties */ - WM_operator_properties_gesture_border(ot, 1); + WM_operator_properties_gesture_border_select(ot); } static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -730,7 +730,7 @@ static int file_walk_select_invoke(bContext *C, wmOperator *op, const wmEvent *U void FILE_OT_select_walk(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {FILE_SELECT_WALK_UP, "UP", 0, "Prev", ""}, {FILE_SELECT_WALK_DOWN, "DOWN", 0, "Next", ""}, {FILE_SELECT_WALK_LEFT, "LEFT", 0, "Left", ""}, @@ -1041,7 +1041,7 @@ static int bookmark_move_exec(bContext *C, wmOperator *op) void FILE_OT_bookmark_move(wmOperatorType *ot) { - static EnumPropertyItem slot_move[] = { + static const EnumPropertyItem slot_move[] = { {FILE_BOOKMARK_MOVE_TOP, "TOP", 0, "Top", "Top of the list"}, {FILE_BOOKMARK_MOVE_UP, "UP", 0, "Up", ""}, {FILE_BOOKMARK_MOVE_DOWN, "DOWN", 0, "Down", ""}, diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 6e4815af032..780c2ec5a47 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -292,7 +292,8 @@ static void file_refresh(const bContext *C, ScrArea *sa) } } -static void file_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) +static void file_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { SpaceFile *sfile = (SpaceFile *)sa->spacedata.first; diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 12d872a3c8a..2876fccaa51 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -503,7 +503,7 @@ typedef enum eGraphKeys_InsertKey_Types { } eGraphKeys_InsertKey_Types; /* RNA mode types for insert keyframes tool */ -static EnumPropertyItem prop_graphkeys_insertkey_types[] = { +static const EnumPropertyItem prop_graphkeys_insertkey_types[] = { {GRAPHKEYS_INSERTKEY_ALL, "ALL", 0, "All Channels", "Insert a keyframe on all visible and editable F-Curves using each curve's current value"}, {GRAPHKEYS_INSERTKEY_SEL, "SEL", 0, "Only Selected Channels", @@ -1467,7 +1467,7 @@ void GRAPH_OT_sample(wmOperatorType *ot) #define CLEAR_CYCLIC_EXPO -2 /* defines for set extrapolation-type for selected keyframes tool */ -static EnumPropertyItem prop_graphkeys_expo_types[] = { +static const EnumPropertyItem prop_graphkeys_expo_types[] = { {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant Extrapolation", "Values on endpoint keyframes are held"}, {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear Extrapolation", "Straight-line slope of end segments are extended past the endpoint keyframes"}, @@ -1505,7 +1505,7 @@ static void setexpo_graph_keys(bAnimContext *ac, short mode) /* only add if one doesn't exist */ if (list_has_suitable_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, -1) == 0) { // TODO: add some more preset versions which set different extrapolation options? - add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES); + add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, fcu); } } else if (mode == CLEAR_CYCLIC_EXPO) { @@ -2067,7 +2067,7 @@ void GRAPH_OT_frame_jump(wmOperatorType *ot) /* ******************** Snap Keyframes Operator *********************** */ /* defines for snap keyframes tool */ -static EnumPropertyItem prop_graphkeys_snap_types[] = { +static const EnumPropertyItem prop_graphkeys_snap_types[] = { {GRAPHKEYS_SNAP_CFRA, "CFRA", 0, "Current Frame", "Snap selected keyframes to the current frame"}, {GRAPHKEYS_SNAP_VALUE, "VALUE", 0, "Cursor Value", @@ -2196,7 +2196,7 @@ void GRAPH_OT_snap(wmOperatorType *ot) /* ******************** Mirror Keyframes Operator *********************** */ /* defines for mirror keyframes tool */ -static EnumPropertyItem prop_graphkeys_mirror_types[] = { +static const EnumPropertyItem prop_graphkeys_mirror_types[] = { {GRAPHKEYS_MIRROR_CFRA, "CFRA", 0, "By Times over Current Frame", "Flip times of selected keyframes using the current frame as the mirror line"}, {GRAPHKEYS_MIRROR_VALUE, "VALUE", 0, "By Values over Cursor Value", @@ -2387,7 +2387,7 @@ void GRAPH_OT_smooth(wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ -static EnumPropertyItem *graph_fmodifier_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *graph_fmodifier_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; int totitem = 0; @@ -2447,7 +2447,7 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op) FModifier *fcm; /* add F-Modifier of specified type to active F-Curve, and make it the active one */ - fcm = add_fmodifier(&fcu->modifiers, type); + fcm = add_fmodifier(&fcu->modifiers, type, fcu); if (fcm) { set_active_fmodifier(&fcu->modifiers, fcm); } @@ -2583,7 +2583,7 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op) FCurve *fcu = (FCurve *)ale->data; int tot; - tot = ANIM_fmodifiers_paste_from_buf(&fcu->modifiers, replace); + tot = ANIM_fmodifiers_paste_from_buf(&fcu->modifiers, replace, fcu); if (tot) { ale->update |= ANIM_UPDATE_DEPS; diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 67b960bfa53..68982275c79 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -332,25 +332,27 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op) rctf rect_fl; short mode = 0, selectmode = 0; bool incl_handles; - bool extend; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; /* clear all selection if not extending selection */ - extend = RNA_boolean_get(op->ptr, "extend"); + if (!extend) deselect_graph_keys(&ac, 1, SELECT_SUBTRACT, true); /* get select mode - * - 'gesture_mode' from the operator specifies how to select * - 'include_handles' from the operator specifies whether to include handles in the selection */ - if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT) + if (select) { selectmode = SELECT_ADD; - else + } + else { selectmode = SELECT_SUBTRACT; + } incl_handles = RNA_boolean_get(op->ptr, "include_handles"); @@ -391,10 +393,10 @@ void GRAPH_OT_select_border(wmOperatorType *ot) ot->description = "Select all keyframes within the specified region"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = graphkeys_borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = graphop_visible_keyframes_poll; @@ -402,7 +404,7 @@ void GRAPH_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria"); @@ -486,9 +488,7 @@ void GRAPH_OT_select_lasso(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first"); + WM_operator_properties_gesture_lasso_select(ot); } /* ------------------- */ @@ -496,8 +496,8 @@ void GRAPH_OT_select_lasso(wmOperatorType *ot) static int graph_circle_select_exec(bContext *C, wmOperator *op) { bAnimContext ac; - const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - const short selectmode = (gesture_mode == GESTURE_MODAL_SELECT) ? SELECT_ADD : SELECT_SUBTRACT; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const short selectmode = select ? SELECT_ADD : SELECT_SUBTRACT; bool incl_handles = false; KeyframeEdit_CircleData data = {0}; @@ -555,11 +555,9 @@ void GRAPH_OT_select_circle(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_UNDO; - - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + + /* properties */ + WM_operator_properties_gesture_circle_select(ot); } /* ******************** Column Select Operator **************************** */ @@ -571,7 +569,7 @@ void GRAPH_OT_select_circle(wmOperatorType *ot) */ /* defines for column-select mode */ -static EnumPropertyItem prop_column_select_types[] = { +static const EnumPropertyItem prop_column_select_types[] = { {GRAPHKEYS_COLUMNSEL_KEYS, "KEYS", 0, "On Selected Keyframes", ""}, {GRAPHKEYS_COLUMNSEL_CFRA, "CFRA", 0, "On Current Frame", ""}, {GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN, "MARKERS_COLUMN", 0, "On Selected Markers", ""}, @@ -916,7 +914,7 @@ void GRAPH_OT_select_less(wmOperatorType *ot) /* Select keyframes left/right of the current frame indicator */ /* defines for left-right select tool */ -static EnumPropertyItem prop_graphkeys_leftright_select_types[] = { +static const EnumPropertyItem prop_graphkeys_leftright_select_types[] = { {GRAPHKEYS_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""}, {GRAPHKEYS_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""}, {GRAPHKEYS_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""}, diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index d2358a494d5..4b89c8db9e6 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -475,7 +475,8 @@ static void graph_region_listener( } /* editor level listener */ -static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) +static void graph_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 806ddaa8a43..88613682b8b 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1003,7 +1003,7 @@ static int image_view_zoom_border_exec(bContext *C, wmOperator *op) SpaceImage *sima = CTX_wm_space_image(C); ARegion *ar = CTX_wm_region(C); rctf bounds; - const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool zoom_in = !RNA_boolean_get(op->ptr, "zoom_out"); WM_operator_properties_border_to_rctf(op, &bounds); @@ -1022,7 +1022,7 @@ static int image_view_zoom_border_exec(bContext *C, wmOperator *op) sima_zoom_set_from_bounds(sima, ar, &bounds); /* zoom out */ - if (gesture_mode == GESTURE_MODAL_OUT) { + if (!zoom_in) { sima->xof = sima_view_prev.xof + (sima->xof - sima_view_prev.xof); sima->yof = sima_view_prev.yof + (sima->yof - sima_view_prev.yof); sima->zoom = sima_view_prev.zoom * (sima_view_prev.zoom / sima->zoom); @@ -1041,15 +1041,15 @@ void IMAGE_OT_view_zoom_border(wmOperatorType *ot) ot->idname = "IMAGE_OT_view_zoom_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = image_view_zoom_border_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = space_image_main_region_poll; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border_zoom(ot); } /**************** load/replace/save callbacks ******************/ @@ -2556,7 +2556,7 @@ void IMAGE_OT_new(wmOperatorType *ot) PropertyRNA *prop; static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; - static EnumPropertyItem gen_context_items[] = { + static const EnumPropertyItem gen_context_items[] = { {GEN_CONTEXT_NONE, "NONE", 0, "None", ""}, {GEN_CONTEXT_PAINT_CANVAS, "PAINT_CANVAS", 0, "Paint Canvas", ""}, {GEN_CONTEXT_PAINT_STENCIL, "PAINT_STENCIL", 0, "Paint Stencil", ""}, @@ -3263,7 +3263,7 @@ void IMAGE_OT_sample_line(wmOperatorType *ot) void IMAGE_OT_curves_point_set(wmOperatorType *ot) { - static EnumPropertyItem point_items[] = { + static const EnumPropertyItem point_items[] = { {0, "BLACK_POINT", 0, "Black Point", ""}, {1, "WHITE_POINT", 0, "White Point", ""}, {0, NULL, 0, NULL, NULL} @@ -3691,10 +3691,10 @@ void IMAGE_OT_render_border(wmOperatorType *ot) ot->idname = "IMAGE_OT_render_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = render_border_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = image_cycle_render_slot_poll; /* flags */ diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 514cb1ab97e..cd4bfb918b3 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -442,7 +442,8 @@ static void image_refresh(const bContext *C, ScrArea *sa) } } -static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *scene) +static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *scene, + WorkSpace *workspace) { SpaceImage *sima = (SpaceImage *)sa->spacedata.first; @@ -536,7 +537,7 @@ static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, co case ND_TRANSFORM: case ND_MODIFIER: { - SceneLayer *sl = BKE_scene_layer_context_active_PLACEHOLDER(scene); + SceneLayer *sl = BKE_scene_layer_from_workspace_get(scene, workspace); Object *ob = OBACT_NEW(sl); if (ob && (ob == wmn->reference) && (ob->mode & OB_MODE_EDIT)) { if (sima->lock && (sima->flag & SI_DRAWSHADOW)) { diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 0cc01646e82..31df9b199ea 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -230,7 +230,7 @@ static int borderselect_exec(bContext *C, wmOperator *op) rcti rect; //rctf rectf, rq; - const bool select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); //int mval[2]; WM_operator_properties_border_to_rcti(op, &rect); @@ -298,10 +298,10 @@ void INFO_OT_select_border(wmOperatorType *ot) ot->idname = "INFO_OT_select_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_info_active; @@ -309,7 +309,7 @@ void INFO_OT_select_border(wmOperatorType *ot) /* ot->flag = OPTYPE_REGISTER; */ /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index bd1bdb952d6..463195f74f7 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -301,7 +301,7 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) } } - stats_object(ob, base->flag_legacy & SELECT, 1, stats); + stats_object(ob, base->flag & BASE_SELECTED, 1, stats); stats->totobj++; } else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS | OB_DUPLIFACES))) { @@ -317,23 +317,23 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats) } stats->totobj += tot; - stats_object(ob, base->flag_legacy & SELECT, tot, stats); + stats_object(ob, base->flag & BASE_SELECTED, tot, stats); } else if (ob->transflag & OB_DUPLIFRAMES) { /* Dupli Frames */ int tot = count_duplilist(ob); stats->totobj += tot; - stats_object(ob, base->flag_legacy & SELECT, tot, stats); + stats_object(ob, base->flag & BASE_SELECTED, tot, stats); } else if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) { /* Dupli Group */ int tot = count_duplilist(ob); stats->totobj += tot; - stats_object(ob, base->flag_legacy & SELECT, tot, stats); + stats_object(ob, base->flag & BASE_SELECTED, tot, stats); } else { /* No Dupli */ - stats_object(ob, base->flag_legacy & SELECT, 1, stats); + stats_object(ob, base->flag & BASE_SELECTED, 1, stats); stats->totobj++; } } diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index e5eee21ed08..54e6e217b77 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -142,8 +142,6 @@ static int cut_links_exec(bContext *C, wmOperator *op) void LOGIC_OT_links_cut(wmOperatorType *ot) { - PropertyRNA *prop; - ot->name = "Cut Links"; ot->idname = "LOGIC_OT_links_cut"; ot->description = "Remove logic brick connections"; @@ -158,8 +156,10 @@ void LOGIC_OT_links_cut(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; - prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); + /* properties */ + PropertyRNA *prop; + prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); /* internal */ RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); } diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index 1559515221e..35a29f4bad8 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -562,7 +562,7 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot) } /* ************* Move Logic Bricks Operator ************* */ -static EnumPropertyItem logicbricks_move_direction[] = { +static const EnumPropertyItem logicbricks_move_direction[] = { {1, "UP", 0, "Move Up", ""}, {2, "DOWN", 0, "Move Down", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index f7f7c82171d..31524f8450a 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -2089,7 +2089,7 @@ void NLA_OT_clear_scale(wmOperatorType *ot) /* Moves the start-point of the selected strips to the specified places */ /* defines for snap keyframes tool */ -static EnumPropertyItem prop_nlaedit_snap_types[] = { +static const EnumPropertyItem prop_nlaedit_snap_types[] = { {NLAEDIT_SNAP_CFRA, "CFRA", 0, "Current Frame", ""}, {NLAEDIT_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", ""}, // XXX as single entry? {NLAEDIT_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", ""}, // XXX as single entry? @@ -2239,7 +2239,7 @@ void NLA_OT_snap(wmOperatorType *ot) /* ******************** Add F-Modifier Operator *********************** */ -static EnumPropertyItem *nla_fmodifier_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *nla_fmodifier_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; int totitem = 0; @@ -2316,7 +2316,7 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op) continue; /* add F-Modifier of specified type to selected, and make it the active one */ - fcm = add_fmodifier(&strip->modifiers, type); + fcm = add_fmodifier(&strip->modifiers, type, NULL); if (fcm) { set_active_fmodifier(&strip->modifiers, fcm); @@ -2470,7 +2470,7 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op) } /* paste FModifiers from buffer */ - ok += ANIM_fmodifiers_paste_from_buf(&strip->modifiers, replace); + ok += ANIM_fmodifiers_paste_from_buf(&strip->modifiers, replace, NULL); ale->update |= ANIM_UPDATE_DEPS; } } diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 8261397c940..1179401f346 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -278,25 +278,28 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; short mode = 0, selectmode = 0; - int extend; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; /* clear all selection if not extending selection */ - extend = RNA_boolean_get(op->ptr, "extend"); - if (!extend) + if (!extend) { deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT); + } /* get settings from operator */ WM_operator_properties_border_to_rcti(op, &rect); - - if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT) + + if (select) { selectmode = SELECT_ADD; - else + } + else { selectmode = SELECT_SUBTRACT; - + } + /* selection 'mode' depends on whether borderselect region only matters on one axis */ if (RNA_boolean_get(op->ptr, "axis_range")) { /* mode depends on which axis of the range is larger to determine which axis to use @@ -329,10 +332,10 @@ void NLA_OT_select_border(wmOperatorType *ot) ot->description = "Use box selection to grab NLA-Strips"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = nlaedit_borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = nlaop_poll_tweakmode_off; @@ -340,7 +343,7 @@ void NLA_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, 1); + WM_operator_properties_gesture_border_select(ot); RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); } @@ -349,7 +352,7 @@ void NLA_OT_select_border(wmOperatorType *ot) /* Select keyframes left/right of the current frame indicator */ /* defines for left-right select tool */ -static EnumPropertyItem prop_nlaedit_leftright_select_types[] = { +static const EnumPropertyItem prop_nlaedit_leftright_select_types[] = { {NLAEDIT_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""}, {NLAEDIT_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""}, {NLAEDIT_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""}, diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index ab7a913ce62..f6068087f02 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -477,7 +477,8 @@ static void nla_channel_region_listener( } /* editor level listener */ -static void nla_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) +static void nla_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index dc6b06790e0..ec35727d176 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -277,8 +277,6 @@ static int add_reroute_exec(bContext *C, wmOperator *op) void NODE_OT_add_reroute(wmOperatorType *ot) { - PropertyRNA *prop; - ot->name = "Add Reroute"; ot->idname = "NODE_OT_add_reroute"; ot->description = "Add a reroute node"; @@ -293,8 +291,10 @@ void NODE_OT_add_reroute(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); + /* properties */ + PropertyRNA *prop; + prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); /* internal */ RNA_def_int(ot->srna, "cursor", BC_CROSSCURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); } @@ -517,7 +517,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static EnumPropertyItem *new_node_tree_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *new_node_tree_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { return rna_node_tree_type_itemf(NULL, NULL, r_free); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index a8bf68d92e2..a9bc58661a0 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -383,7 +383,7 @@ bool ED_node_is_texture(struct SpaceNode *snode) /* called from shading buttons or header */ void ED_node_shader_default(const bContext *C, ID *id) { - Scene *scene = CTX_data_scene(C); + ViewRender *view_render = CTX_data_view_render(C); bNode *in, *out; bNodeSocket *fromsock, *tosock, *sock; bNodeTree *ntree; @@ -398,11 +398,11 @@ void ED_node_shader_default(const bContext *C, ID *id) Material *ma = (Material *)id; ma->nodetree = ntree; - if (BKE_scene_uses_blender_eevee(scene)) { + if (BKE_viewrender_uses_blender_eevee(view_render)) { output_type = SH_NODE_OUTPUT_MATERIAL; shader_type = SH_NODE_BSDF_PRINCIPLED; } - else if (BKE_scene_use_new_shading_nodes(scene)) { + else if (BKE_viewrender_use_new_shading_nodes(view_render)) { output_type = SH_NODE_OUTPUT_MATERIAL; shader_type = SH_NODE_BSDF_DIFFUSE; } @@ -460,7 +460,7 @@ void ED_node_shader_default(const bContext *C, ID *id) nodeAddLink(ntree, in, fromsock, out, tosock); /* default values */ - if (BKE_scene_use_new_shading_nodes(scene)) { + if (BKE_viewrender_use_new_shading_nodes(view_render)) { PointerRNA sockptr; sock = in->inputs.first; RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sockptr); @@ -1910,7 +1910,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op) void NODE_OT_output_file_move_active_socket(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {1, "UP", 0, "Up", ""}, {2, "DOWN", 0, "Down", ""}, { 0, NULL, 0, NULL, NULL } @@ -2278,7 +2278,7 @@ void NODE_OT_tree_socket_remove(wmOperatorType *ot) /********************** Move interface socket operator *********************/ -static EnumPropertyItem move_direction_items[] = { +static const EnumPropertyItem move_direction_items[] = { { 1, "UP", 0, "Up", "" }, { 2, "DOWN", 0, "Down", "" }, { 0, NULL, 0, NULL, NULL }, @@ -2353,7 +2353,7 @@ void NODE_OT_tree_socket_move(wmOperatorType *ot) static int node_shader_script_update_poll(bContext *C) { Scene *scene = CTX_data_scene(C); - RenderEngineType *type = RE_engines_find(scene->r.engine); + RenderEngineType *type = RE_engines_find(scene->view_render.engine_id); SpaceNode *snode = CTX_wm_space_node(C); bNode *node; Text *text; @@ -2423,7 +2423,7 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op) bool found = false; /* setup render engine */ - type = RE_engines_find(scene->r.engine); + type = RE_engines_find(scene->view_render.engine_id); engine = RE_engine_create(type); engine->reports = op->reports; @@ -2568,17 +2568,17 @@ void NODE_OT_viewer_border(wmOperatorType *ot) ot->idname = "NODE_OT_viewer_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = viewer_border_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = composite_node_active; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } static int clear_viewer_border_exec(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 9d750bfe348..7eaf35c6c4f 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -515,7 +515,7 @@ typedef enum eNodeGroupSeparateType { } eNodeGroupSeparateType; /* Operator Property */ -static EnumPropertyItem node_group_separate_types[] = { +static const EnumPropertyItem node_group_separate_types[] = { {NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"}, {NODE_GS_MOVE, "MOVE", 0, "Move", "Move to parent node tree, remove from group"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 3b03399a5e7..64c019d12a3 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -1007,8 +1007,6 @@ static int cut_links_exec(bContext *C, wmOperator *op) void NODE_OT_links_cut(wmOperatorType *ot) { - PropertyRNA *prop; - ot->name = "Cut Links"; ot->idname = "NODE_OT_links_cut"; ot->description = "Use the mouse to cut (remove) some links"; @@ -1023,8 +1021,11 @@ void NODE_OT_links_cut(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); + /* properties */ + PropertyRNA *prop; + prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + /* internal */ RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX); } diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 7195d2a9838..dc7863bb354 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -333,7 +333,7 @@ static int node_select_grouped_exec(bContext *C, wmOperator *op) void NODE_OT_select_grouped(wmOperatorType *ot) { - static EnumPropertyItem prop_select_grouped_types[] = { + static const EnumPropertyItem prop_select_grouped_types[] = { {NODE_SELECT_GROUPED_TYPE, "TYPE", 0, "Type", ""}, {NODE_SELECT_GROUPED_COLOR, "COLOR", 0, "Color", ""}, {NODE_SELECT_GROUPED_PREFIX, "PREFIX", 0, "Prefix", ""}, @@ -524,23 +524,23 @@ static int node_borderselect_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); bNode *node; rctf rectf; - int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); const bool extend = RNA_boolean_get(op->ptr, "extend"); WM_operator_properties_border_to_rctf(op, &rectf); UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf); for (node = snode->edittree->nodes.first; node; node = node->next) { - bool select; + bool is_inside; if (node->type == NODE_FRAME) { - select = BLI_rctf_inside_rctf(&rectf, &node->totr); + is_inside = BLI_rctf_inside_rctf(&rectf, &node->totr); } else { - select = BLI_rctf_isect(&rectf, &node->totr, NULL); + is_inside = BLI_rctf_isect(&rectf, &node->totr, NULL); } - if (select) { - nodeSetSelected(node, (gesture_mode == GESTURE_MODAL_SELECT)); + if (is_inside) { + nodeSetSelected(node, select); } else if (!extend) { nodeSetSelected(node, false); @@ -571,7 +571,7 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, const wmEvent return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } - return WM_border_select_invoke(C, op, event); + return WM_gesture_border_invoke(C, op, event); } void NODE_OT_select_border(wmOperatorType *ot) @@ -584,8 +584,8 @@ void NODE_OT_select_border(wmOperatorType *ot) /* api callbacks */ ot->invoke = node_border_select_invoke; ot->exec = node_borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_node_active; @@ -593,7 +593,7 @@ void NODE_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture"); } @@ -605,12 +605,12 @@ static int node_circleselect_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); bNode *node; - int x, y, radius, gesture_mode; + int x, y, radius; float offset[2]; float zoom = (float)(BLI_rcti_size_x(&ar->winrct)) / (float)(BLI_rctf_size_x(&ar->v2d.cur)); - gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); /* get operator properties */ x = RNA_int_get(op->ptr, "x"); @@ -621,7 +621,7 @@ static int node_circleselect_exec(bContext *C, wmOperator *op) for (node = snode->edittree->nodes.first; node; node = node->next) { if (BLI_rctf_isect_circle(&node->totr, offset, radius / zoom)) { - nodeSetSelected(node, (gesture_mode == GESTURE_MODAL_SELECT)); + nodeSetSelected(node, select); } } @@ -647,11 +647,8 @@ void NODE_OT_select_circle(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* rna */ - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + /* properties */ + WM_operator_properties_gesture_circle_select(ot); } /* ****** Lasso Select ****** */ @@ -728,9 +725,7 @@ void NODE_OT_select_lasso(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + WM_operator_properties_gesture_lasso_select(ot); } /* ****** Select/Deselect All ****** */ diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index 5d0877a1eff..c791b9f6eae 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -559,6 +559,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); + ViewRender *view_render = CTX_data_view_render(C); uiBlock *block = uiLayoutGetBlock(layout); uiBut *but = (uiBut *)but_p; uiLayout *split, *column; @@ -575,7 +576,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ arg->layout = split; if (ntreetype && ntreetype->foreach_nodeclass) - ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb); + ntreetype->foreach_nodeclass(view_render, arg, node_menu_column_foreach_cb); column = uiLayoutColumn(split, false); UI_block_layout_set_current(block, column); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 7cb22dcc570..e1765e39f7a 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -382,12 +382,14 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)) } -static void node_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *scene) +static void node_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *scene, + WorkSpace *workspace) { /* note, ED_area_tag_refresh will re-execute compositor */ SpaceNode *snode = sa->spacedata.first; + ViewRender *view_render = BKE_viewrender_get(scene, workspace); /* shaderfrom is only used for new shading nodes, otherwise all shaders are from objects */ - short shader_type = BKE_scene_use_new_shading_nodes(scene) ? snode->shaderfrom : SNODE_SHADER_OBJECT; + short shader_type = BKE_viewrender_use_new_shading_nodes(view_render) ? snode->shaderfrom : SNODE_SHADER_OBJECT; /* preview renders */ switch (wmn->category) { diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index 092909cbcba..45d632dc293 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -160,7 +160,8 @@ static void collection_scene_collection_itemf_recursive( } } -static EnumPropertyItem *collection_scene_collection_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *collection_scene_collection_itemf( + bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem *item = NULL; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 98388ecb3ec..24f147a68bf 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -542,7 +542,7 @@ static int outliner_id_remap_invoke(bContext *C, wmOperator *op, const wmEvent * return WM_operator_props_dialog_popup(C, op, 200, 100); } -static EnumPropertyItem *outliner_id_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *outliner_id_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem item_tmp = {0}, *item = NULL; int totitem = 0; diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index a470711d9df..0ef39fc4c92 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -1059,12 +1059,12 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot) /* ****************************************************** */ /* **************** Border Select Tool ****************** */ -static void outliner_item_border_select(Scene *scene, rctf *rectf, TreeElement *te, int gesture_mode) +static void outliner_item_border_select(Scene *scene, rctf *rectf, TreeElement *te, bool select) { TreeStoreElem *tselem = TREESTORE(te); if (te->ys <= rectf->ymax && te->ys + UI_UNIT_Y >= rectf->ymin) { - if (gesture_mode == GESTURE_MODAL_SELECT) { + if (select) { tselem->flag |= TSE_SELECTED; } else { @@ -1075,7 +1075,7 @@ static void outliner_item_border_select(Scene *scene, rctf *rectf, TreeElement * /* Look at its children. */ if ((tselem->flag & TSE_CLOSED) == 0) { for (te = te->subtree.first; te; te = te->next) { - outliner_item_border_select(scene, rectf, te, gesture_mode); + outliner_item_border_select(scene, rectf, te, select); } } } @@ -1087,13 +1087,13 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); TreeElement *te; rctf rectf; - int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + bool select = !RNA_boolean_get(op->ptr, "deselect"); WM_operator_properties_border_to_rctf(op, &rectf); UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf); for (te = soops->tree.first; te; te = te->next) { - outliner_item_border_select(scene, &rectf, te, gesture_mode); + outliner_item_border_select(scene, &rectf, te, select); } WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); @@ -1110,10 +1110,10 @@ void OUTLINER_OT_select_border(wmOperatorType *ot) ot->description = "Use box selection to select tree elements"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = outliner_border_select_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_outliner_active; @@ -1121,7 +1121,7 @@ void OUTLINER_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border_ex(ot, true, false); } /* ****************************************************** */ diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index f2d73f40039..edd897fbbab 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -282,7 +282,7 @@ typedef enum eOutliner_PropSceneOps { OL_SCENE_OP_DELETE = 1 } eOutliner_PropSceneOps; -static EnumPropertyItem prop_scene_op_types[] = { +static const EnumPropertyItem prop_scene_op_types[] = { {OL_SCENE_OP_DELETE, "DELETE", ICON_X, "Delete", ""}, {0, NULL, 0, NULL, NULL} }; @@ -977,7 +977,7 @@ enum { OL_OP_RENAME, }; -static EnumPropertyItem prop_object_op_types[] = { +static const EnumPropertyItem prop_object_op_types[] = { {OL_OP_SELECT, "SELECT", 0, "Select", ""}, {OL_OP_DESELECT, "DESELECT", 0, "Deselect", ""}, {OL_OP_SELECT_HIERARCHY, "SELECT_HIERARCHY", 0, "Select Hierarchy", ""}, @@ -1110,7 +1110,7 @@ typedef enum eOutliner_PropGroupOps { OL_GROUPOP_RENAME, } eOutliner_PropGroupOps; -static EnumPropertyItem prop_group_op_types[] = { +static const EnumPropertyItem prop_group_op_types[] = { {OL_GROUPOP_UNLINK, "UNLINK", 0, "Unlink Group", ""}, {OL_GROUPOP_LOCAL, "LOCAL", 0, "Make Local Group", ""}, {OL_GROUPOP_LINK, "LINK", 0, "Link Group Objects to Scene", ""}, @@ -1208,7 +1208,7 @@ typedef enum eOutlinerIdOpTypes { } eOutlinerIdOpTypes; // TODO: implement support for changing the ID-block used -static EnumPropertyItem prop_id_op_types[] = { +static const EnumPropertyItem prop_id_op_types[] = { {OUTLINER_IDOP_UNLINK, "UNLINK", 0, "Unlink", ""}, {OUTLINER_IDOP_LOCAL, "LOCAL", 0, "Make Local", ""}, {OUTLINER_IDOP_SINGLE, "SINGLE", 0, "Make Single User", ""}, @@ -1395,7 +1395,7 @@ typedef enum eOutlinerLibOpTypes { OL_LIB_RELOAD, } eOutlinerLibOpTypes; -static EnumPropertyItem outliner_lib_op_type_items[] = { +static const EnumPropertyItem outliner_lib_op_type_items[] = { {OL_LIB_RENAME, "RENAME", 0, "Rename", ""}, {OL_LIB_DELETE, "DELETE", 0, "Delete", "Delete this library and all its item from Blender - WARNING: no undo"}, {OL_LIB_RELOCATE, "RELOCATE", 0, "Relocate", "Select a new path for this library, and reload all its data"}, @@ -1605,7 +1605,7 @@ typedef enum eOutliner_AnimDataOps { //OUTLINER_ANIMOP_PASTE_DRIVERS } eOutliner_AnimDataOps; -static EnumPropertyItem prop_animdata_op_types[] = { +static const EnumPropertyItem prop_animdata_op_types[] = { {OUTLINER_ANIMOP_CLEAR_ADT, "CLEAR_ANIMDATA", 0, "Clear Animation Data", "Remove this animation data container"}, {OUTLINER_ANIMOP_SET_ACT, "SET_ACT", 0, "Set Action", ""}, {OUTLINER_ANIMOP_CLEAR_ACT, "CLEAR_ACT", 0, "Unlink Action", ""}, @@ -1705,7 +1705,7 @@ void OUTLINER_OT_animdata_operation(wmOperatorType *ot) /* **************************************** */ -static EnumPropertyItem prop_constraint_op_types[] = { +static const EnumPropertyItem prop_constraint_op_types[] = { {OL_CONSTRAINTOP_ENABLE, "ENABLE", ICON_RESTRICT_VIEW_OFF, "Enable", ""}, {OL_CONSTRAINTOP_DISABLE, "DISABLE", ICON_RESTRICT_VIEW_ON, "Disable", ""}, {OL_CONSTRAINTOP_DELETE, "DELETE", ICON_X, "Delete", ""}, @@ -1751,7 +1751,7 @@ void OUTLINER_OT_constraint_operation(wmOperatorType *ot) /* ******************** */ -static EnumPropertyItem prop_modifier_op_types[] = { +static const EnumPropertyItem prop_modifier_op_types[] = { {OL_MODIFIER_OP_TOGVIS, "TOGVIS", ICON_RESTRICT_VIEW_OFF, "Toggle viewport use", ""}, {OL_MODIFIER_OP_TOGREN, "TOGREN", ICON_RESTRICT_RENDER_OFF, "Toggle render use", ""}, {OL_MODIFIER_OP_DELETE, "DELETE", ICON_X, "Delete", ""}, @@ -1844,7 +1844,7 @@ void OUTLINER_OT_collection_operation(wmOperatorType *ot) /* ******************** */ // XXX: select linked is for RNA structs only -static EnumPropertyItem prop_data_op_types[] = { +static const EnumPropertyItem prop_data_op_types[] = { {OL_DOP_SELECT, "SELECT", 0, "Select", ""}, {OL_DOP_DESELECT, "DESELECT", 0, "Deselect", ""}, {OL_DOP_HIDE, "HIDE", 0, "Hide", ""}, diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index f3a5af4b164..5331c76a0dc 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -386,7 +386,7 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s outliner_add_element(soops, lb, sce->world, te, 0, 0); #ifdef WITH_FREESTYLE - if (STREQ(sce->r.engine, RE_engine_id_BLENDER_RENDER) && (sce->r.mode & R_EDGE_FRS)) + if (STREQ(sce->view_render->engine_id, RE_engine_id_BLENDER_RENDER) && (sce->r.mode & R_EDGE_FRS)) outliner_add_line_styles(soops, lb, sce, te); #endif } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index a1549f39b7c..a8a5bc6e96b 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -107,7 +107,7 @@ EnumPropertyItem prop_side_types[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_side_lr_types[] = { +static const EnumPropertyItem prop_side_lr_types[] = { {SEQ_SIDE_LEFT, "LEFT", 0, "Left", ""}, {SEQ_SIDE_RIGHT, "RIGHT", 0, "Right", ""}, {0, NULL, 0, NULL, NULL} @@ -2010,7 +2010,7 @@ void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot) /* cut operator */ -static EnumPropertyItem prop_cut_types[] = { +static const EnumPropertyItem prop_cut_types[] = { {SEQ_CUT_SOFT, "SOFT", 0, "Soft", ""}, {SEQ_CUT_HARD, "HARD", 0, "Hard", ""}, {0, NULL, 0, NULL, NULL} @@ -2800,7 +2800,7 @@ void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot) #if 0 -static EnumPropertyItem view_type_items[] = { +static const EnumPropertyItem view_type_items[] = { {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""}, {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""}, {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""}, @@ -3398,17 +3398,17 @@ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot) ot->description = "Set the boundaries of the border used for offset-view"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = view_ghost_border_exec; - ot->modal = WM_border_select_modal; + ot->modal = WM_gesture_border_modal; ot->poll = sequencer_view_preview_poll; - ot->cancel = WM_border_select_cancel; + ot->cancel = WM_gesture_border_cancel; /* flags */ ot->flag = 0; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border(ot); } /* rebuild_proxy operator */ @@ -3562,7 +3562,7 @@ void SEQUENCER_OT_enable_proxies(wmOperatorType *ot) /* change ops */ -static EnumPropertyItem prop_change_effect_input_types[] = { +static const EnumPropertyItem prop_change_effect_input_types[] = { {0, "A_B", 0, "A -> B", ""}, {1, "B_C", 0, "B -> C", ""}, {2, "A_C", 0, "A -> C", ""}, diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index 1b3d458bb69..7ab9308f9a6 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -185,7 +185,7 @@ static int strip_modifier_move_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"}, {SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"}, {0, NULL, 0, NULL, NULL} @@ -258,7 +258,7 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op) void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot) { - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {SEQ_MODIFIER_COPY_REPLACE, "REPLACE", 0, "Replace", "Replace modifiers in destination"}, {SEQ_MODIFIER_COPY_APPEND, "APPEND", 0, "Append", diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index d88ed36e392..90a369760ac 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -548,7 +548,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, const wmEvent *e void SEQUENCER_OT_select(wmOperatorType *ot) { - static EnumPropertyItem sequencer_select_left_right_types[] = { + static const EnumPropertyItem sequencer_select_left_right_types[] = { {SEQ_SELECT_LR_NONE, "NONE", 0, "None", "Don't do left-right selection"}, {SEQ_SELECT_LR_MOUSE, "MOUSE", 0, "Mouse", "Use mouse position for selection"}, {SEQ_SELECT_LR_LEFT, "LEFT", 0, "Left", "Select left"}, @@ -889,7 +889,7 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op) Sequence *seq; rctf rectf, rq; - const bool select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); const bool extend = RNA_boolean_get(op->ptr, "extend"); if (ed == NULL) @@ -927,10 +927,10 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) ot->description = "Select strips using border selection"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = sequencer_borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_sequencer_active; @@ -938,7 +938,7 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } /* ****** Selected Grouped ****** */ @@ -953,7 +953,7 @@ enum { SEQ_SELECT_GROUP_OVERLAP, }; -static EnumPropertyItem sequencer_prop_select_grouped_types[] = { +static const EnumPropertyItem sequencer_prop_select_grouped_types[] = { {SEQ_SELECT_GROUP_TYPE, "TYPE", 0, "Type", "Shared strip type"}, {SEQ_SELECT_GROUP_TYPE_BASIC, "TYPE_BASIC", 0, "Global Type", "All strips of same basic type (Graphical or Sound)"}, {SEQ_SELECT_GROUP_TYPE_EFFECT, "TYPE_EFFECT", 0, "Effect Type", diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 3b04e6c80cd..da16ac5acaa 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -338,7 +338,8 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl) } static void sequencer_listener( - bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) + bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index ed1ef080e0c..539fe1c53bd 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -125,7 +125,8 @@ static SpaceLink *text_duplicate(SpaceLink *sl) return (SpaceLink *)stextn; } -static void text_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) +static void text_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { SpaceText *st = sa->spacedata.first; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 548cf157c0f..2a0c350ba54 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -1046,7 +1046,7 @@ void TEXT_OT_uncomment(wmOperatorType *ot) /******************* convert whitespace operator *********************/ enum { TO_SPACES, TO_TABS }; -static EnumPropertyItem whitespace_type_items[] = { +static const EnumPropertyItem whitespace_type_items[] = { {TO_SPACES, "SPACES", 0, "To Spaces", NULL}, {TO_TABS, "TABS", 0, "To Tabs", NULL}, {0, NULL, 0, NULL, NULL}}; @@ -1280,7 +1280,7 @@ static int move_lines_exec(bContext *C, wmOperator *op) void TEXT_OT_move_lines(wmOperatorType *ot) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {TXT_MOVE_LINE_UP, "UP", 0, "Up", ""}, {TXT_MOVE_LINE_DOWN, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL} @@ -1301,7 +1301,7 @@ void TEXT_OT_move_lines(wmOperatorType *ot) /************************ move operator ************************/ -static EnumPropertyItem move_type_items[] = { +static const EnumPropertyItem move_type_items[] = { {LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""}, {LINE_END, "LINE_END", 0, "Line End", ""}, {FILE_TOP, "FILE_TOP", 0, "File Top", ""}, @@ -1923,7 +1923,7 @@ void TEXT_OT_jump(wmOperatorType *ot) /******************* delete operator **********************/ -static EnumPropertyItem delete_type_items[] = { +static const EnumPropertyItem delete_type_items[] = { {DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""}, {DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""}, {DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""}, @@ -3086,7 +3086,7 @@ void TEXT_OT_replace_set_selected(wmOperatorType *ot) /****************** resolve conflict operator ******************/ enum { RESOLVE_IGNORE, RESOLVE_RELOAD, RESOLVE_SAVE, RESOLVE_MAKE_INTERNAL }; -static EnumPropertyItem resolution_items[] = { +static const EnumPropertyItem resolution_items[] = { {RESOLVE_IGNORE, "IGNORE", 0, "Ignore", ""}, {RESOLVE_RELOAD, "RELOAD", 0, "Reload", ""}, {RESOLVE_SAVE, "SAVE", 0, "Save", ""}, diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 7ecb5cb072d..b9a35de6779 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -468,7 +468,8 @@ static void time_draw_keyframes(const bContext *C, ARegion *ar) /* ---------------- */ /* editor level listener */ -static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, const Scene *UNUSED(scene)) +static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { /* mainly for updating cache display */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 07d072f0156..b49594d7a0d 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -650,7 +650,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const /* Function to draw an Image on an empty Object */ -static void draw_empty_image(Object *ob, const short dflag, const unsigned char ob_wire_col[4], StereoViews sview) +static void draw_empty_image(Object *ob, const short dflag, const unsigned char ob_wire_col[4], eStereoViews sview) { Image *ima = ob->data; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 0a4f400a721..9b5c5e6cd30 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1262,7 +1262,8 @@ static void view3d_tools_region_draw(const bContext *C, ARegion *ar) /* area (not region) level listener */ static void space_view3d_listener( - bScreen *UNUSED(sc), ScrArea *sa, struct wmNotifier *wmn, const Scene *UNUSED(scene)) + bScreen *UNUSED(sc), ScrArea *sa, struct wmNotifier *wmn, Scene *UNUSED(scene), + WorkSpace *UNUSED(workspace)) { View3D *v3d = sa->spacedata.first; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index ed4d7861d6d..ec2dcc75bc0 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1880,10 +1880,11 @@ static void view3d_draw_view(const bContext *C, ARegion *ar) void view3d_main_region_draw(const bContext *C, ARegion *ar) { Scene *scene = CTX_data_scene(C); + WorkSpace *workspace = CTX_wm_workspace(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = ar->regiondata; - /* XXX: In the future we should get RE from Layers/Depsgraph */ - RenderEngineType *type = RE_engines_find(scene->r.engine); + ViewRender *view_render = BKE_viewrender_get(scene, workspace); + RenderEngineType *type = RE_engines_find(view_render->engine_id); /* Provisory Blender Internal drawing */ if (type->flag & RE_USE_LEGACY_PIPELINE) { @@ -1931,7 +1932,7 @@ static void view3d_stereo3d_setup_offscreen( void ED_view3d_draw_offscreen_init(const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d) { - RenderEngineType *type = RE_engines_find(scene->r.engine); + RenderEngineType *type = eval_ctx->engine; if (type->flag & RE_USE_LEGACY_PIPELINE) { /* shadow buffers, before we setup matrices */ if (draw_glsl_material(scene, sl, NULL, v3d, v3d->drawtype)) { @@ -1959,7 +1960,8 @@ static void view3d_main_region_clear(Scene *scene, View3D *v3d, ARegion *ar) * stuff like shadow buffers */ void ED_view3d_draw_offscreen( - const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, int winx, int winy, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *scene_layer, + View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[4][4], float winmat[4][4], bool do_bgpic, bool do_sky, bool is_persp, const char *viewname, GPUFX *fx, GPUFXSettings *fx_settings, @@ -2013,7 +2015,7 @@ void ED_view3d_draw_offscreen( view3d_main_region_setup_view(eval_ctx, scene, v3d, ar, viewmat, winmat, NULL); /* main drawing call */ - RenderEngineType *type = RE_engines_find(scene->r.engine); + RenderEngineType *type = eval_ctx->engine; if (type->flag & RE_USE_LEGACY_PIPELINE) { /* framebuffer fx needed, we need to draw offscreen first */ @@ -2055,8 +2057,8 @@ void ED_view3d_draw_offscreen( } else { /* XXX, should take depsgraph as arg */ - Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, sl); - DRW_draw_render_loop_offscreen(depsgraph, ar, v3d, ofs); + Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, scene_layer); + DRW_draw_render_loop_offscreen(depsgraph, eval_ctx->engine, ar, v3d, ofs); } /* restore size */ @@ -2079,7 +2081,8 @@ void ED_view3d_draw_offscreen( * (avoids re-creating when doing multiple GL renders). */ ImBuf *ED_view3d_draw_offscreen_imbuf( - const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *ar, int sizex, int sizey, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *scene_layer, + View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, /* output vars */ @@ -2108,7 +2111,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( } } - ED_view3d_draw_offscreen_init(eval_ctx, scene, sl, v3d); + ED_view3d_draw_offscreen_init(eval_ctx, scene, scene_layer, v3d); GPU_offscreen_bind(ofs, true); @@ -2150,7 +2153,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( if ((samples && full_samples) == 0) { /* Single-pass render, common case */ ED_view3d_draw_offscreen( - eval_ctx, scene, sl, v3d, ar, sizex, sizey, NULL, winmat, + eval_ctx, scene, scene_layer, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, fx, &fx_settings, ofs); @@ -2174,7 +2177,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen( - eval_ctx, scene, sl, v3d, ar, sizex, sizey, NULL, winmat, + eval_ctx, scene, scene_layer, v3d, ar, sizex, sizey, NULL, winmat, draw_background, draw_sky, !is_ortho, viewname, fx, &fx_settings, ofs); GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, rect_temp); @@ -2193,7 +2196,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( (jit_ofs[j][1] * 2.0f) / sizey); ED_view3d_draw_offscreen( - eval_ctx, scene, sl, v3d, ar, sizex, sizey, NULL, winmat_jitter, + eval_ctx, scene, scene_layer, v3d, ar, sizex, sizey, NULL, winmat_jitter, draw_background, draw_sky, !is_ortho, viewname, fx, &fx_settings, ofs); GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, rect_temp); @@ -2244,7 +2247,8 @@ ImBuf *ED_view3d_draw_offscreen_imbuf( * \note used by the sequencer */ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( - const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *sl, Object *camera, int width, int height, + const EvaluationContext *eval_ctx, Scene *scene, SceneLayer *scene_layer, + Object *camera, int width, int height, unsigned int flag, int drawtype, bool use_solid_tex, bool use_gpencil, bool draw_background, int alpha_mode, int samples, bool full_samples, const char *viewname, GPUFX *fx, GPUOffScreen *ofs, char err_out[256]) @@ -2298,7 +2302,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple( invert_m4_m4(rv3d.persinv, rv3d.viewinv); return ED_view3d_draw_offscreen_imbuf( - eval_ctx, scene, sl, &v3d, &ar, width, height, flag, + eval_ctx, scene, scene_layer, &v3d, &ar, width, height, flag, draw_background, alpha_mode, samples, full_samples, viewname, fx, ofs, err_out); } diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index d24c8241855..3680470c734 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -1786,8 +1786,7 @@ void ED_scene_draw_fps(Scene *scene, const rcti *rect) static bool view3d_main_region_do_render_draw(const Scene *scene) { - RenderEngineType *type = RE_engines_find(scene->r.engine); - + RenderEngineType *type = RE_engines_find(scene->view_render.engine_id); return (type && type->view_update && type->render_to_view); } @@ -1849,8 +1848,7 @@ static bool view3d_main_region_draw_engine( /* create render engine */ if (!rv3d->render_engine) { RenderEngine *engine; - - type = RE_engines_find(scene->r.engine); + type = RE_engines_find(scene->view_render.engine_id); if (!(type->view_update && type->render_to_view)) return false; @@ -1979,7 +1977,7 @@ static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, Sce rv3d->rflag &= ~RV3D_IS_GAME_ENGINE; #ifdef WITH_GAMEENGINE - if (STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME)) { + if (STREQ(scene->view_render.engine_id, RE_engine_id_BLENDER_GAME)) { rv3d->rflag |= RV3D_IS_GAME_ENGINE; /* Make sure LoDs are up to date */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index b54d1254293..84f31020c32 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -916,7 +916,7 @@ enum { /* called in transform_ops.c, on each regeneration of keymaps */ void viewrotate_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {VIEWROT_MODAL_AXIS_SNAP_ENABLE, "AXIS_SNAP_ENABLE", 0, "Enable Axis Snap", ""}, @@ -1940,7 +1940,7 @@ void VIEW3D_OT_ndof_all(struct wmOperatorType *ot) /* called in transform_ops.c, on each regeneration of keymaps */ void viewmove_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"}, @@ -2119,7 +2119,7 @@ void VIEW3D_OT_move(wmOperatorType *ot) /* called in transform_ops.c, on each regeneration of keymaps */ void viewzoom_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"}, @@ -2511,7 +2511,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op) /* called in transform_ops.c, on each regeneration of keymaps */ void viewdolly_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"}, @@ -3524,10 +3524,10 @@ void VIEW3D_OT_render_border(wmOperatorType *ot) ot->idname = "VIEW3D_OT_render_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = render_border_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_view3d_active; @@ -3597,7 +3597,6 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); - int gesture_mode; const int smooth_viewtx = WM_operator_smooth_viewtx_get(op); /* Zooms in on a border drawn by the user */ @@ -3622,7 +3621,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) WM_operator_properties_border_to_rcti(op, &rect); /* check if zooming in/out view */ - gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); + const bool zoom_in = !RNA_boolean_get(op->ptr, "zoom_out"); ED_view3d_dist_range_get(v3d, dist_range); @@ -3705,7 +3704,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) new_dist *= max_ff(xscale, yscale); } - if (gesture_mode == GESTURE_MODAL_OUT) { + if (!zoom_in) { sub_v3_v3v3(dvec, new_ofs, rv3d->ofs); new_dist = rv3d->dist * (rv3d->dist / new_dist); add_v3_v3v3(new_ofs, rv3d->ofs, dvec); @@ -3731,7 +3730,7 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, const wmEvent /* if in camera view do not exec the operator so we do not conflict with set render border*/ if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) - return WM_border_select_invoke(C, op, event); + return WM_gesture_border_invoke(C, op, event); else return OPERATOR_PASS_THROUGH; } @@ -3746,8 +3745,8 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot) /* api callbacks */ ot->invoke = view3d_zoom_border_invoke; ot->exec = view3d_zoom_border_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_region_view3d_active; @@ -3755,7 +3754,7 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot) ot->flag = 0; /* rna */ - WM_operator_properties_gesture_border(ot, false); + WM_operator_properties_gesture_border_zoom(ot); } /* sets the view to 1:1 camera/render-pixel */ @@ -3805,7 +3804,7 @@ void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot) /* ********************* Changing view operator ****************** */ -static EnumPropertyItem prop_view_items[] = { +static const EnumPropertyItem prop_view_items[] = { {RV3D_VIEW_LEFT, "LEFT", ICON_TRIA_LEFT, "Left", "View From the Left"}, {RV3D_VIEW_RIGHT, "RIGHT", ICON_TRIA_RIGHT, "Right", "View From the Right"}, {RV3D_VIEW_BOTTOM, "BOTTOM", ICON_TRIA_DOWN, "Bottom", "View From the Bottom"}, @@ -4042,7 +4041,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -static EnumPropertyItem prop_view_orbit_items[] = { +static const EnumPropertyItem prop_view_orbit_items[] = { {V3D_VIEW_STEPLEFT, "ORBITLEFT", 0, "Orbit Left", "Orbit the view around to the Left"}, {V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the Right"}, {V3D_VIEW_STEPUP, "ORBITUP", 0, "Orbit Up", "Orbit the view Up"}, @@ -4265,7 +4264,7 @@ static int viewroll_modal(bContext *C, wmOperator *op, const wmEvent *event) return ret; } -static EnumPropertyItem prop_view_roll_items[] = { +static const EnumPropertyItem prop_view_roll_items[] = { {0, "ANGLE", 0, "Roll Angle", "Roll the view using an angle value"}, {V3D_VIEW_STEPLEFT, "LEFT", 0, "Roll Left", "Roll the view around to the Left"}, {V3D_VIEW_STEPRIGHT, "RIGHT", 0, "Roll Right", "Roll the view around to the Right"}, @@ -4400,7 +4399,7 @@ void VIEW3D_OT_view_roll(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -static EnumPropertyItem prop_view_pan_items[] = { +static const EnumPropertyItem prop_view_pan_items[] = { {V3D_VIEW_PANLEFT, "PANLEFT", 0, "Pan Left", "Pan the view to the Left"}, {V3D_VIEW_PANRIGHT, "PANRIGHT", 0, "Pan Right", "Pan the view to the Right"}, {V3D_VIEW_PANUP, "PANUP", 0, "Pan Up", "Pan the view Up"}, @@ -4671,7 +4670,7 @@ static int view3d_clipping_invoke(bContext *C, wmOperator *op, const wmEvent *ev return OPERATOR_FINISHED; } else { - return WM_border_select_invoke(C, op, event); + return WM_gesture_border_invoke(C, op, event); } } @@ -4687,8 +4686,8 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot) /* api callbacks */ ot->invoke = view3d_clipping_invoke; ot->exec = view3d_clipping_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = ED_operator_region_view3d_active; diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index bce27fc5c92..b3ed8e34755 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -99,7 +99,7 @@ typedef enum eFlyPanState { /* called in transform_ops.c, on each regeneration of keymaps */ void fly_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""}, diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 60e90121ad1..03f4f506c13 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -282,7 +282,7 @@ static void ruler_state_set(bContext *C, RulerInfo *ruler_info, int state) } else if (state == RULER_STATE_DRAG) { ruler_info->snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), CTX_data_scene(C), CTX_data_scene_layer(C), 0, + CTX_data_main(C), CTX_data_scene(C), CTX_data_scene_layer(C), CTX_data_engine(C), 0, ruler_info->ar, CTX_wm_view3d(C)); } else { diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 5ac3aa15d4c..5408269ce13 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -114,6 +114,7 @@ void view3d_set_viewcontext(bContext *C, ViewContext *vc) vc->depsgraph = CTX_data_depsgraph(C); vc->scene = CTX_data_scene(C); vc->scene_layer = CTX_data_scene_layer(C); + vc->engine = CTX_data_engine(C); vc->v3d = CTX_wm_view3d(C); vc->win = CTX_wm_window(C); vc->rv3d = CTX_wm_region_view3d(C); @@ -896,9 +897,8 @@ void VIEW3D_OT_select_lasso(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_UNDO; - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + /* properties */ + WM_operator_properties_gesture_lasso_select(ot); } @@ -966,7 +966,7 @@ typedef struct SelMenuItemF { static SelMenuItemF object_mouse_select_menu_data[SEL_MENU_SIZE]; /* special (crappy) operator only for menu select */ -static EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL, item_tmp = {0}; int totitem = 0; @@ -2161,9 +2161,9 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) CTX_data_eval_ctx(C, &eval_ctx); view3d_set_viewcontext(C, &vc); - select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); - WM_operator_properties_border_to_rcti(op, &rect); + select = !RNA_boolean_get(op->ptr, "deselect"); extend = RNA_boolean_get(op->ptr, "extend"); + WM_operator_properties_border_to_rcti(op, &rect); if (vc.obedit) { switch (vc.obedit->type) { @@ -2238,17 +2238,17 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) ot->idname = "VIEW3D_OT_select_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = view3d_borderselect_exec; - ot->modal = WM_border_select_modal; + ot->modal = WM_gesture_border_modal; ot->poll = view3d_selectable_data; - ot->cancel = WM_border_select_cancel; + ot->cancel = WM_gesture_border_cancel; /* flags */ ot->flag = OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } @@ -2860,8 +2860,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); const int radius = RNA_int_get(op->ptr, "radius"); - const int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - const bool select = (gesture_mode == GESTURE_MODAL_SELECT); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); const int mval[2] = {RNA_int_get(op->ptr, "x"), RNA_int_get(op->ptr, "y")}; @@ -2922,9 +2921,7 @@ void VIEW3D_OT_select_circle(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_UNDO; - - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX); + + /* properties */ + WM_operator_properties_gesture_circle_select(ot); } diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 44b7fadd29f..ce089aa29fa 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -58,6 +58,8 @@ #include "GPU_immediate.h" +#include "RE_engine.h" + #include "view3d_intern.h" /* own include */ #ifdef WITH_INPUT_NDOF @@ -130,7 +132,7 @@ typedef enum eWalkGravityState { /* called in transform_ops.c, on each regeneration of keymaps */ void walk_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {WALK_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {WALK_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, @@ -249,6 +251,7 @@ typedef struct WalkInfo { ARegion *ar; Scene *scene; SceneLayer *scene_layer; + RenderEngineType *engine; wmTimer *timer; /* needed for redraws */ @@ -512,6 +515,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) walk->ar = CTX_wm_region(C); walk->scene = CTX_data_scene(C); walk->scene_layer = CTX_data_scene_layer(C); + walk->engine = CTX_data_engine(C); #ifdef NDOF_WALK_DEBUG puts("\n-- walk begin --"); @@ -600,7 +604,7 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op) walk->rv3d->rflag |= RV3D_NAVIGATING; walk->snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), walk->scene, walk->scene_layer, 0, + CTX_data_main(C), walk->scene, walk->scene_layer, walk->engine, 0, walk->ar, walk->v3d); walk->v3d_camera_control = ED_view3d_cameracontrol_acquire( diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index fda15545ead..f38f6c064b8 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -29,6 +29,7 @@ set(INC ../../ikplugin ../../makesdna ../../makesrna + ../../render/extern/include ../../windowmanager ../../depsgraph ../../../../intern/guardedalloc diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 4745631e85c..40309b701a4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -808,7 +808,7 @@ enum { /* called in transform_ops.c, on each regeneration of keymaps */ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {TFM_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Translate", ""}, diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 92eb31aabe6..60ad61e3475 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -37,6 +37,8 @@ #include "ED_numinput.h" #include "ED_view3d.h" +#include "RE_engine.h" + #include "DNA_listBase.h" /* ************************** Types ***************************** */ @@ -60,6 +62,7 @@ struct wmTimer; struct ARegion; struct ReportList; struct EditBone; +struct RenderEngineType; struct SnapObjectContext; /* transinfo->redraw */ @@ -467,6 +470,7 @@ typedef struct TransInfo { struct ARegion *ar; struct Scene *scene; struct SceneLayer *scene_layer; + struct RenderEngineType *engine; struct ToolSettings *settings; struct wmTimer *animtimer; struct wmKeyMap *keymap; /* so we can do lookups for header text */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 166a5805fa1..b04767724ea 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2485,7 +2485,7 @@ static void createTransEditVerts(TransInfo *t) int *island_vert_map = NULL; DEG_evaluation_context_init_from_scene(&eval_ctx, - t->scene, t->scene_layer, + t->scene, t->scene_layer, t->engine, DAG_EVAL_VIEWPORT); /* Even for translation this is needed because of island-orientation, see: T51651. */ @@ -5557,7 +5557,7 @@ static void set_trans_object_base_flags(TransInfo *t) /* handle pending update events, otherwise they got copied below */ EvaluationContext eval_ctx; DEG_evaluation_context_init_from_scene(&eval_ctx, - t->scene, t->scene_layer, + t->scene, t->scene_layer, t->engine, DAG_EVAL_VIEWPORT); for (base = sl->object_bases.first; base; base = base->next) { if (base->object->recalc & OB_RECALC_ALL) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 2bed1dd28f2..5081b65c215 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -105,6 +105,8 @@ #include "WM_types.h" #include "WM_api.h" +#include "RE_engine.h" + #include "UI_resources.h" #include "UI_view2d.h" @@ -1122,10 +1124,12 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve Object *obedit = CTX_data_edit_object(C); Object *ob = CTX_data_active_object(C); bGPdata *gpd = CTX_data_gpencil_data(C); + RenderEngineType *engine = CTX_data_engine(C); PropertyRNA *prop; t->scene = sce; t->scene_layer = sl; + t->engine = engine; t->sa = sa; t->ar = ar; t->obedit = obedit; diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index d7ed80841da..ad855427ff1 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -122,7 +122,7 @@ static TransformModeItem transform_modes[] = {NULL, 0} }; -EnumPropertyItem rna_enum_transform_mode_types[] = +const EnumPropertyItem rna_enum_transform_mode_types[] = { {TFM_INIT, "INIT", 0, "Init", ""}, {TFM_DUMMY, "DUMMY", 0, "Dummy", ""}, @@ -568,9 +568,8 @@ void Transform_Properties(struct wmOperatorType *ot, int flags) } if ((flags & P_NO_DEFAULTS) == 0) { - // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit - /*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button"); - //RNA_def_property_flag(prop, PROP_HIDDEN); + prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button"); + RNA_def_property_flag(prop, PROP_HIDDEN); prop = RNA_def_boolean(ot->srna, "use_accurate", 0, "Accurate", "Use accurate transformation"); RNA_def_property_flag(prop, PROP_HIDDEN); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index e3ea8a51c6d..3aedb53cfce 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -105,7 +105,7 @@ static float ResizeBetween(TransInfo *t, const float p1[3], const float p2[3]); /****************** IMPLEMENTATIONS *********************/ -static bool snapNodeTest(View2D *v2d, bNode *node, SnapSelect snap_select); +static bool snapNodeTest(View2D *v2d, bNode *node, eSnapSelect snap_select); static NodeBorder snapNodeBorder(int snap_node_mode); #if 0 @@ -585,7 +585,7 @@ static void initSnappingMode(TransInfo *t) if (t->spacetype == SPACE_VIEW3D) { if (t->tsnap.object_context == NULL) { t->tsnap.object_context = ED_transform_snap_object_context_create_view3d( - G.main, t->scene, t->scene_layer, 0, + G.main, t->scene, t->scene_layer, t->engine, 0, t->ar, t->view); ED_transform_snap_object_context_set_editmesh_callbacks( @@ -1299,7 +1299,7 @@ bool peelObjectsTransform( /******************** NODES ***********************************/ -static bool snapNodeTest(View2D *v2d, bNode *node, SnapSelect snap_select) +static bool snapNodeTest(View2D *v2d, bNode *node, eSnapSelect snap_select) { /* node is use for snapping only if a) snap mode matches and b) node is inside the view */ return ((snap_select == SNAP_NOT_SELECTED && !(node->flag & NODE_SELECT)) || @@ -1378,7 +1378,7 @@ static bool snapNode( static bool snapNodes( ToolSettings *ts, SpaceNode *snode, ARegion *ar, - const int mval[2], SnapSelect snap_select, + const int mval[2], eSnapSelect snap_select, float r_loc[2], float *r_dist_px, char *r_node_border) { bNodeTree *ntree = snode->edittree; diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index e72bfa40480..af3c78f5d89 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -150,12 +150,12 @@ typedef void(*IterSnapObjsCallback)(SnapObjectContext *sctx, bool is_obedit, Obj * Walks through all objects in the scene to create the list of objets to snap. * * \param sctx: Snap context to store data. - * \param snap_select : from enum SnapSelect. + * \param snap_select : from enum eSnapSelect. * \param obedit : Object Edited to use its coordinates of BMesh(if any) to do the snapping. */ static void iter_snap_objects( SnapObjectContext *sctx, - const SnapSelect snap_select, + const eSnapSelect snap_select, Object *obedit, IterSnapObjsCallback sob_callback, void *data) @@ -799,7 +799,7 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, * * \param sctx: Snap context to store data. * \param snapdata: struct generated in `set_snapdata`. - * \param snap_select : from enum SnapSelect. + * \param snap_select : from enum eSnapSelect. * \param use_object_edit_cage : Uses the coordinates of BMesh(if any) to do the snapping. * \param obj_list: List with objects to snap (created in `create_object_list`). * @@ -823,7 +823,7 @@ static void raycast_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, static bool raycastObjects( SnapObjectContext *sctx, const float ray_start[3], const float ray_dir[3], - const SnapSelect snap_select, const bool use_object_edit_cage, + const eSnapSelect snap_select, const bool use_object_edit_cage, /* read/write args */ float *ray_depth, /* return args */ @@ -2040,7 +2040,7 @@ static void sanp_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, flo * * \param sctx: Snap context to store data. * \param snapdata: struct generated in `get_snapdata`. - * \param snap_select : from enum SnapSelect. + * \param snap_select : from enum eSnapSelect. * \param use_object_edit_cage : Uses the coordinates of BMesh(if any) to do the snapping. * * Read/Write Args @@ -2062,7 +2062,7 @@ static void sanp_obj_cb(SnapObjectContext *sctx, bool is_obedit, Object *ob, flo */ static bool snapObjectsRay( SnapObjectContext *sctx, SnapData *snapdata, - const SnapSelect snap_select, const bool use_object_edit_cage, + const eSnapSelect snap_select, const bool use_object_edit_cage, /* read/write args */ float *ray_depth, float *dist_px, /* return args */ @@ -2096,7 +2096,7 @@ static bool snapObjectsRay( * \{ */ SnapObjectContext *ED_transform_snap_object_context_create( - Main *bmain, Scene *scene, SceneLayer *sl, int flag) + Main *bmain, Scene *scene, SceneLayer *sl, RenderEngineType *engine, int flag) { SnapObjectContext *sctx = MEM_callocN(sizeof(*sctx), __func__); @@ -2105,7 +2105,7 @@ SnapObjectContext *ED_transform_snap_object_context_create( sctx->bmain = bmain; sctx->scene = scene; - DEG_evaluation_context_init_from_scene(&sctx->eval_ctx, scene, sl, DAG_EVAL_VIEWPORT); + DEG_evaluation_context_init_from_scene(&sctx->eval_ctx, scene, sl, engine, DAG_EVAL_VIEWPORT); sctx->cache.object_map = BLI_ghash_ptr_new(__func__); sctx->cache.mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); @@ -2114,11 +2114,11 @@ SnapObjectContext *ED_transform_snap_object_context_create( } SnapObjectContext *ED_transform_snap_object_context_create_view3d( - Main *bmain, Scene *scene, SceneLayer *sl, int flag, + Main *bmain, Scene *scene, SceneLayer *sl, RenderEngineType *engine, int flag, /* extra args for view3d */ const ARegion *ar, const View3D *v3d) { - SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, sl, flag); + SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, sl, engine, flag); sctx->use_v3d = true; sctx->v3d_data.ar = ar; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index ff328a28ee9..5b91ee4fc29 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -533,7 +533,7 @@ static int get_undo_system(bContext *C) } /* create enum based on undo items */ -static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem) +static const EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem) { EnumPropertyItem item_tmp = {0}, *item = NULL; int i = 0; @@ -586,7 +586,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE undosys = get_undo_system(C); if (undosys) { - EnumPropertyItem *item = rna_undo_itemf(C, undosys, &totitem); + const EnumPropertyItem *item = rna_undo_itemf(C, undosys, &totitem); if (totitem > 0) { uiPopupMenu *pup = UI_popup_menu_begin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE); @@ -609,7 +609,7 @@ static int undo_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE } } - MEM_freeN(item); + MEM_freeN((void *)item); UI_popup_menu_end(C, pup); } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 2a0eed6f438..12ff1ebe566 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1622,7 +1622,7 @@ static int uv_align_exec(bContext *C, wmOperator *op) static void UV_OT_align(wmOperatorType *ot) { - static EnumPropertyItem axis_items[] = { + static const EnumPropertyItem axis_items[] = { {'s', "ALIGN_S", 0, "Straighten", "Align UVs along the line defined by the endpoints"}, {'t', "ALIGN_T", 0, "Straighten X", "Align UVs along the line defined by the endpoints along the X axis"}, {'u', "ALIGN_U", 0, "Straighten Y", "Align UVs along the line defined by the endpoints along the Y axis"}, @@ -2760,9 +2760,9 @@ static int uv_border_select_exec(bContext *C, wmOperator *op) UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf); /* figure out what to select/deselect */ - select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT); - pinned = RNA_boolean_get(op->ptr, "pinned"); + select = !RNA_boolean_get(op->ptr, "deselect"); extend = RNA_boolean_get(op->ptr, "extend"); + pinned = RNA_boolean_get(op->ptr, "pinned"); if (!extend) uv_select_all_perform(scene, ima, em, SEL_DESELECT); @@ -2839,11 +2839,11 @@ static void UV_OT_select_border(wmOperatorType *ot) ot->idname = "UV_OT_select_border"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = uv_border_select_exec; - ot->modal = WM_border_select_modal; + ot->modal = WM_gesture_border_modal; ot->poll = ED_operator_uvedit_space_image; /* requires space image */; - ot->cancel = WM_border_select_cancel; + ot->cancel = WM_gesture_border_cancel; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2851,7 +2851,7 @@ static void UV_OT_select_border(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only"); - WM_operator_properties_gesture_border(ot, true); + WM_operator_properties_gesture_border_select(ot); } /* ******************** circle select operator **************** */ @@ -2892,8 +2892,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op) MLoopUV *luv; int x, y, radius, width, height; float zoomx, zoomy, offset[2], ellipse[2]; - int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); - const bool select = (gesture_mode == GESTURE_MODAL_SELECT); + const bool select = !RNA_boolean_get(op->ptr, "deselect"); bool changed = false; const bool use_face_center = (ts->uv_flag & UV_SYNC_SELECTION) ? (ts->selectmode == SCE_SELECT_FACE) : @@ -2971,12 +2970,9 @@ static void UV_OT_circle_select(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ - RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "radius", 1, 1, INT_MAX, "Radius", "", 1, INT_MAX); - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + WM_operator_properties_gesture_circle_select(ot); } @@ -3104,9 +3100,8 @@ static void UV_OT_select_lasso(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_UNDO; - RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items"); - RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); + /* properties */ + WM_operator_properties_gesture_lasso_select(ot); } @@ -3160,7 +3155,7 @@ static int uv_snap_cursor_exec(bContext *C, wmOperator *op) static void UV_OT_snap_cursor(wmOperatorType *ot) { - static EnumPropertyItem target_items[] = { + static const EnumPropertyItem target_items[] = { {0, "PIXELS", 0, "Pixels", ""}, {1, "SELECTED", 0, "Selected", ""}, {0, NULL, 0, NULL, NULL}}; @@ -3367,7 +3362,7 @@ static int uv_snap_selection_exec(bContext *C, wmOperator *op) static void UV_OT_snap_selected(wmOperatorType *ot) { - static EnumPropertyItem target_items[] = { + static const EnumPropertyItem target_items[] = { {0, "PIXELS", 0, "Pixels", ""}, {1, "CURSOR", 0, "Cursor", ""}, {2, "CURSOR_OFFSET", 0, "Cursor (Offset)", ""}, diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 4ff4c3223f0..fa936e998fa 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -2320,7 +2320,7 @@ void UV_OT_stitch(wmOperatorType *ot) { PropertyRNA *prop; - static EnumPropertyItem stitch_modes[] = { + static const EnumPropertyItem stitch_modes[] = { {STITCH_VERT, "VERTEX", 0, "Vertex", ""}, {STITCH_EDGE, "EDGE", 0, "Edge", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index b700c992a01..8a742735a06 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -995,13 +995,13 @@ static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float static void uv_transform_properties(wmOperatorType *ot, int radius) { - static EnumPropertyItem direction_items[] = { + static const EnumPropertyItem direction_items[] = { {VIEW_ON_EQUATOR, "VIEW_ON_EQUATOR", 0, "View on Equator", "3D view is on the equator"}, {VIEW_ON_POLES, "VIEW_ON_POLES", 0, "View on Poles", "3D view is on the poles"}, {ALIGN_TO_OBJECT, "ALIGN_TO_OBJECT", 0, "Align to Object", "Align according to object transform"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem align_items[] = { + static const EnumPropertyItem align_items[] = { {POLAR_ZX, "POLAR_ZX", 0, "Polar ZX", "Polar 0 is X"}, {POLAR_ZY, "POLAR_ZY", 0, "Polar ZY", "Polar 0 is Y"}, {0, NULL, 0, NULL, NULL} @@ -1236,7 +1236,7 @@ static int unwrap_exec(bContext *C, wmOperator *op) void UV_OT_unwrap(wmOperatorType *ot) { - static EnumPropertyItem method_items[] = { + static const EnumPropertyItem method_items[] = { {0, "ANGLE_BASED", 0, "Angle Based", ""}, {1, "CONFORMAL", 0, "Conformal", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 322acd9966c..6ab855ac6af 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -115,8 +115,8 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str freestyle_scene->r.filtertype = old_scene->r.filtertype; freestyle_scene->r.gauss = old_scene->r.gauss; freestyle_scene->r.dither_intensity = old_scene->r.dither_intensity; - BLI_strncpy(freestyle_scene->r.engine, old_scene->r.engine, sizeof(freestyle_scene->r.engine)); - freestyle_scene->r.im_format.planes = R_IMF_PLANES_RGBA; + BKE_viewrender_copy(&freestyle_scene->view_render, &old_scene->view_render); + freestyle_scene->r.im_format.planes = R_IMF_PLANES_RGBA; freestyle_scene->r.im_format.imtype = R_IMF_IMTYPE_PNG; if (G.debug & G_DEBUG_FREESTYLE) { @@ -463,7 +463,7 @@ void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const BLI_ghash_insert(_nodetree_hash, nt, ma); } - if (STREQ(freestyle_scene->r.engine, RE_engine_id_CYCLES)) { + if (STREQ(freestyle_scene->view_render.engine_id, RE_engine_id_CYCLES)) { PointerRNA scene_ptr, freestyle_scene_ptr; RNA_pointer_create(NULL, &RNA_Scene, old_scene, &scene_ptr); RNA_pointer_create(NULL, &RNA_Scene, freestyle_scene, &freestyle_scene_ptr); diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 1159603f721..231f1d8f7b1 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -180,7 +180,7 @@ void gpu_extensions_init(void) } /* XXX : TODO : Remove this once this sampling mipmap problem is gone. * https://github.com/dfelinto/opengl-sandbox/blob/downsample/README.md */ - else if (strstr(renderer, "AMD VEGA") || + else if (strstr(renderer, "AMD VEGA") && strstr(vendor, "X.Org")) { GG.device = GPU_DEVICE_AMD_VEGA; GG.driver = GPU_DRIVER_OPENSOURCE; diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index 1d157ecb14c..de5dff1b69c 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -576,23 +576,24 @@ void GPU_framebuffer_recursive_downsample( for (i = 1; i < num_iter + 1; i++) { + /* calculate next viewport size */ + current_dim[0] /= 2; + current_dim[1] /= 2; + if (GPU_type_matches(GPU_DEVICE_AMD_VEGA, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) { /* NOTE : here 16 is because of a bug on AMD Vega GPU + non-pro drivers, that prevents us * from sampling mipmaps that are smaller or equal to 16px. (9) */ - if (current_dim[0] / 2 > 16 && current_dim[1] / 2 > 16) { + if (current_dim[0] <= 16 && current_dim[1] <= 16) { break; } } else { - if (current_dim[0] / 2 > 1 && current_dim[1] / 2 > 1) { + if (current_dim[0] <= 2 && current_dim[1] <= 2) { + /* Cannot reduce further. */ break; } } - /* calculate next viewport size */ - current_dim[0] /= 2; - current_dim[1] /= 2; - /* ensure that the viewport size is always at least 1x1 */ CLAMP_MIN(current_dim[0], 1); CLAMP_MIN(current_dim[1], 1); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index a08bef4472a..55157246c19 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -50,6 +50,7 @@ #include "BKE_colortools.h" #include "BKE_global.h" #include "BKE_image.h" +#include "BKE_layer.h" #include "BKE_main.h" #include "BKE_node.h" #include "BKE_scene.h" @@ -2154,7 +2155,7 @@ GPUMaterial *GPU_material_from_nodetree( mat->engine_type = engine_type; mat->options = options; - ntreeGPUMaterialNodes(ntree, mat, NODE_NEWER_SHADING); + ntreeGPUMaterialNodes(ntree, mat, NODE_NEW_SHADING | NODE_NEWER_SHADING); /* Let Draw manager finish the construction. */ if (mat->outlink) { diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 7809d2d1c4a..cc8e9a18655 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -765,7 +765,7 @@ typedef struct bActionChannel { } bActionChannel; /* Action Channel flags (ONLY USED FOR DO_VERSIONS...) */ -typedef enum ACHAN_FLAG { +typedef enum eActionChannelFlag { ACHAN_SELECTED = (1 << 0), ACHAN_HIGHLIGHTED = (1 << 1), ACHAN_HIDDEN = (1 << 2), @@ -774,6 +774,6 @@ typedef enum ACHAN_FLAG { ACHAN_SHOWIPO = (1 << 5), ACHAN_SHOWCONS = (1 << 6), ACHAN_MOVED = (1u << 31) -} ACHAN_FLAG; +} eActionChannelFlag; #endif /* __DNA_ACTION_TYPES_H__ */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 935a893f689..977cd2347ad 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -52,6 +52,7 @@ extern "C" { typedef struct FModifier { struct FModifier *next, *prev; + struct FCurve *curve; /* containing curve, only used for updates to CYCLES */ void *data; /* pointer to modifier data */ char name[64]; /* user-defined description for the modifier - MAX_ID_NAME-2 */ diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h index f1930ffd643..44764eb012e 100644 --- a/source/blender/makesdna/DNA_boid_types.h +++ b/source/blender/makesdna/DNA_boid_types.h @@ -34,7 +34,7 @@ #include "DNA_listBase.h" -typedef enum BoidRuleType { +typedef enum eBoidRuleType { eBoidRuleType_None = 0, eBoidRuleType_Goal = 1, /* go to goal assigned object or loudest assigned signal source */ eBoidRuleType_Avoid = 2, /* get away from assigned object or loudest assigned signal source */ @@ -49,7 +49,7 @@ typedef enum BoidRuleType { //eBoidRuleType_FollowPath = 11, /* move along a assigned curve or closest curve in a group */ //eBoidRuleType_FollowWall = 12, /* move next to a deflector object's in direction of it's tangent */ NUM_BOID_RULE_TYPES -} BoidRuleType; +} eBoidRuleType; /* boidrule->flag */ #define BOIDRULE_CURRENT 1 @@ -96,14 +96,14 @@ typedef struct BoidRuleFight { float distance, flee_distance; } BoidRuleFight; -typedef enum BoidMode { +typedef enum eBoidMode { eBoidMode_InAir = 0, eBoidMode_OnLand = 1, eBoidMode_Climbing = 2, eBoidMode_Falling = 3, eBoidMode_Liftoff = 4, NUM_BOID_MODES -} BoidMode; +} eBoidMode; typedef struct BoidData { @@ -140,12 +140,12 @@ typedef struct BoidData { // int signal_id, channels; //} BoidCondition; -typedef enum BoidRulesetType { +typedef enum eBoidRulesetType { eBoidRulesetType_Fuzzy = 0, eBoidRulesetType_Random = 1, eBoidRulesetType_Average = 2, NUM_BOID_RULESET_TYPES -} BoidRulesetType; +} eBoidRulesetType; #define BOIDSTATE_CURRENT 1 typedef struct BoidState { struct BoidState *next, *prev; diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index c285b44c939..407d59f09da 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -105,7 +105,7 @@ typedef struct Brush { char sculpt_tool; /* active sculpt tool */ char vertexpaint_tool; /* active vertex/weight paint blend mode (poorly named) */ char imagepaint_tool; /* active image paint tool */ - char mask_tool; /* enum BrushMaskTool, only used if sculpt_tool is SCULPT_TOOL_MASK */ + char mask_tool; /* enum eBrushMaskTool, only used if sculpt_tool is SCULPT_TOOL_MASK */ float autosmooth_factor; @@ -171,19 +171,19 @@ typedef struct PaintCurve { } PaintCurve; /* Brush.gradient_source */ -typedef enum BrushGradientSourceStroke { +typedef enum eBrushGradientSourceStroke { BRUSH_GRADIENT_PRESSURE = 0, /* gradient from pressure */ BRUSH_GRADIENT_SPACING_REPEAT = 1, /* gradient from spacing */ BRUSH_GRADIENT_SPACING_CLAMP = 2 /* gradient from spacing */ -} BrushGradientSourceStroke; +} eBrushGradientSourceStroke; -typedef enum BrushGradientSourceFill { +typedef enum eBrushGradientSourceFill { BRUSH_GRADIENT_LINEAR = 0, /* gradient from pressure */ BRUSH_GRADIENT_RADIAL = 1 /* gradient from spacing */ -} BrushGradientSourceFill; +} eBrushGradientSourceFill; /* Brush.flag */ -typedef enum BrushFlags { +typedef enum eBrushFlags { BRUSH_AIRBRUSH = (1 << 0), BRUSH_FLAG_DEPRECATED_1 = (1 << 1), BRUSH_ALPHA_PRESSURE = (1 << 2), @@ -216,7 +216,7 @@ typedef enum BrushFlags { BRUSH_LINE = (1 << 29), BRUSH_ABSOLUTE_JITTER = (1 << 30), BRUSH_CURVE = (1u << 31) -} BrushFlags; +} eBrushFlags; typedef enum { BRUSH_MASK_PRESSURE_RAMP = (1 << 1), @@ -224,21 +224,21 @@ typedef enum { } BrushMaskPressureFlags; /* Brush.overlay_flags */ -typedef enum OverlayFlags { +typedef enum eOverlayFlags { BRUSH_OVERLAY_CURSOR = (1), BRUSH_OVERLAY_PRIMARY = (1 << 1), BRUSH_OVERLAY_SECONDARY = (1 << 2), BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE = (1 << 3), BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE = (1 << 4), BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE = (1 << 5) -} OverlayFlags; +} eOverlayFlags; #define BRUSH_OVERLAY_OVERRIDE_MASK (BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE | \ BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE | \ BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE) /* Brush.sculpt_tool */ -typedef enum BrushSculptTool { +typedef enum eBrushSculptTool { SCULPT_TOOL_DRAW = 1, SCULPT_TOOL_SMOOTH = 2, SCULPT_TOOL_PINCH = 3, @@ -258,7 +258,7 @@ typedef enum BrushSculptTool { SCULPT_TOOL_BLOB = 17, SCULPT_TOOL_CLAY_STRIPS = 18, SCULPT_TOOL_MASK = 19 -} BrushSculptTool; +} eBrushSculptTool; /** When #BRUSH_ACCUMULATE is used */ #define SCULPT_TOOL_HAS_ACCUMULATE(t) ELEM(t, \ @@ -295,14 +295,14 @@ typedef enum BrushSculptTool { ) == 0) /* ImagePaintSettings.tool */ -typedef enum BrushImagePaintTool { +typedef enum eBrushImagePaintTool { PAINT_TOOL_DRAW = 0, PAINT_TOOL_SOFTEN = 1, PAINT_TOOL_SMEAR = 2, PAINT_TOOL_CLONE = 3, PAINT_TOOL_FILL = 4, PAINT_TOOL_MASK = 5 -} BrushImagePaintTool; +} eBrushImagePaintTool; /* direction that the brush displaces along */ enum { @@ -343,10 +343,10 @@ typedef enum { } BrushMaskTool; /* blur kernel types, Brush.blur_mode */ -typedef enum BlurKernelType { +typedef enum eBlurKernelType { KERNEL_GAUSSIAN, KERNEL_BOX -} BlurKernelType; +} eBlurKernelType; /* Brush.falloff_shape */ enum { diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index f7ee1ff3915..6f9c407c6c6 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -91,7 +91,7 @@ typedef struct CurveMapping { #define CUMA_DRAW_SAMPLE 8 /* cumapping->preset */ -typedef enum CurveMappingPreset { +typedef enum eCurveMappingPreset { CURVE_PRESET_LINE = 0, CURVE_PRESET_SHARP = 1, CURVE_PRESET_SMOOTH = 2, @@ -99,7 +99,7 @@ typedef enum CurveMappingPreset { CURVE_PRESET_MID9 = 4, CURVE_PRESET_ROUND = 5, CURVE_PRESET_ROOT = 6, -} CurveMappingPreset; +} eCurveMappingPreset; /* histogram->mode */ enum { diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index ca774864e95..4c4440ad573 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -92,23 +92,22 @@ typedef struct bConstraintTarget { short space; /* space that target should be evaluated in (overrides bConstraint->tarspace) */ short flag; /* runtime settings (for editor, etc.) */ - short type; /* type of target (B_CONSTRAINT_OB_TYPE) */ + short type; /* type of target (eConstraintObType) */ short rotOrder; /* rotation order for target (as defined in BLI_math.h) */ } bConstraintTarget; /* bConstraintTarget -> flag */ -typedef enum B_CONSTRAINT_TARGET_FLAG { +typedef enum eConstraintTargetFlag { CONSTRAINT_TAR_TEMP = (1<<0) /* temporary target-struct that needs to be freed after use */ -} B_CONSTRAINT_TARGET_FLAG; +} eConstraintTargetFlag; /* bConstraintTarget/bConstraintOb -> type */ -typedef enum B_CONSTRAINT_OB_TYPE { +typedef enum eConstraintObType { CONSTRAINT_OBTYPE_OBJECT = 1, /* string is "" */ CONSTRAINT_OBTYPE_BONE = 2, /* string is bone-name */ CONSTRAINT_OBTYPE_VERT = 3, /* string is vertex-group name */ CONSTRAINT_OBTYPE_CV = 4 /* string is vertex-group name - is not available until curves get vgroups */ -} B_CONSTRAINT_OB_TYPE; - +} eConstraintObType; /* Python Script Constraint */ @@ -128,7 +127,7 @@ typedef struct bPythonConstraint { /* Inverse-Kinematics (IK) constraint * This constraint supports a variety of mode determine by the type field - * according to B_CONSTRAINT_IK_TYPE. + * according to eConstraint_IK_Type. * Some fields are used by all types, some are specific to some types * This is indicated in the comments for each field */ @@ -145,15 +144,15 @@ typedef struct bKinematicConstraint { float weight; /* All: Weight of constraint in IK tree */ float orientweight; /* CopyPose: Amount of rotation a target applies on chain */ float grabtarget[3]; /* CopyPose: for target-less IK */ - short type; /* subtype of IK constraint: B_CONSTRAINT_IK_TYPE */ + short type; /* subtype of IK constraint: eConstraint_IK_Type */ short mode; /* Distance: how to limit in relation to clamping sphere: LIMITDIST_.. */ float dist; /* Distance: distance (radius of clamping sphere) from target */ } bKinematicConstraint; -typedef enum B_CONSTRAINT_IK_TYPE { +typedef enum eConstraint_IK_Type { CONSTRAINT_IK_COPYPOSE = 0, /* 'standard' IK constraint: match position and/or orientation of target */ CONSTRAINT_IK_DISTANCE = 1 /* maintain distance with target */ -} B_CONSTRAINT_IK_TYPE; +} eConstraint_IK_Type; /* Spline IK Constraint diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index e598c32173c..ea446552874 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -437,6 +437,8 @@ typedef enum eBezTriple_KeyframeType { #define BEZT_SEL_ALL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; } ((void)0) #define BEZT_DESEL_ALL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; } ((void)0) +#define BEZT_IS_AUTOH(bezt) (ELEM((bezt)->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM((bezt)->h2, HD_AUTO, HD_AUTO_ANIM)) + /* *************** CHARINFO **************** */ /* CharInfo.flag */ diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index 7ef6e8c34dd..86931401aae 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -74,7 +74,6 @@ typedef struct LayerCollection { typedef struct SceneLayer { struct SceneLayer *next, *prev; char name[64]; /* MAX_NAME */ - char engine[32]; /* render engine */ short active_collection; short flag; short pad[2]; diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index d0a3c7bb95a..6d38fe22ea1 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -340,7 +340,7 @@ typedef struct GridPaintMask { int pad; } GridPaintMask; -typedef enum MVertSkinFlag { +typedef enum eMVertSkinFlag { /* Marks a vertex as the edge-graph root, used for calculating rotations for all connected edges (recursively). * Also used to choose a root when generating an armature. */ @@ -350,13 +350,13 @@ typedef enum MVertSkinFlag { * directly hulled together, rather than the default of generating intermediate frames. */ MVERT_SKIN_LOOSE = 2, -} MVertSkinFlag; +} eMVertSkinFlag; typedef struct MVertSkin { /* Radii of the skin, define how big the generated frames are. Currently only the first two elements are used. */ float radius[3]; - /* MVertSkinFlag */ + /* eMVertSkinFlag */ int flag; } MVertSkin; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index eaacee0d595..59d30d175a5 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -1226,19 +1226,19 @@ enum { }; /* Remesh modifier */ -typedef enum RemeshModifierFlags { +typedef enum eRemeshModifierFlags { MOD_REMESH_FLOOD_FILL = 1, MOD_REMESH_SMOOTH_SHADING = 2, } RemeshModifierFlags; -typedef enum RemeshModifierMode { +typedef enum eRemeshModifierMode { /* blocky */ MOD_REMESH_CENTROID = 0, /* smooth */ MOD_REMESH_MASS_POINT = 1, /* keeps sharp edges */ MOD_REMESH_SHARP_FEATURES = 2, -} RemeshModifierMode; +} eRemeshModifierMode; typedef struct RemeshModifierData { ModifierData modifier; diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h index 9413a21633b..63e1da4f90e 100644 --- a/source/blender/makesdna/DNA_object_force.h +++ b/source/blender/makesdna/DNA_object_force.h @@ -39,7 +39,7 @@ extern "C" { #include "DNA_listBase.h" /* pd->forcefield: Effector Fields types */ -typedef enum PFieldType { +typedef enum ePFieldType { PFIELD_NULL = 0, /* (this is used for general effector weight) */ PFIELD_FORCE = 1, /* Force away/towards a point depending on force strength */ PFIELD_VORTEX = 2, /* Force around the effector normal */ @@ -56,8 +56,8 @@ typedef enum PFieldType { PFIELD_DRAG = 12, /* Linear & quadratic drag */ PFIELD_SMOKEFLOW = 13, /* Force based on smoke simulation air flow */ NUM_PFIELD_TYPES -} PFieldType; - +} ePFieldType; + typedef struct PartDeflect { int flag; /* general settings flag */ short deflect; /* Deflection flag - does mesh deflect particles */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 529fcad21d4..ea3af3834b4 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -708,7 +708,7 @@ enum { }; /* ob->mode */ -typedef enum ObjectMode { +typedef enum eObjectMode { OB_MODE_OBJECT = 0, OB_MODE_EDIT = 1 << 0, OB_MODE_SCULPT = 1 << 1, @@ -718,7 +718,7 @@ typedef enum ObjectMode { OB_MODE_PARTICLE_EDIT = 1 << 5, OB_MODE_POSE = 1 << 6, OB_MODE_GPENCIL = 1 << 7, /* NOTE: Just a dummy to make the UI nicer */ -} ObjectMode; +} eObjectMode; /* any mode where the brush system is used */ #define OB_MODE_ALL_PAINT (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT) diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h index 56140c84cb1..00a54c2db7f 100644 --- a/source/blender/makesdna/DNA_packedFile_types.h +++ b/source/blender/makesdna/DNA_packedFile_types.h @@ -40,7 +40,7 @@ typedef struct PackedFile { void *data; } PackedFile; -enum PF_FileStatus { +enum ePF_FileStatus { PF_EQUAL = 0, PF_DIFFERS = 1, PF_NOFILE = 2, diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index d81a4625144..14bbb0f8f44 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -96,7 +96,7 @@ typedef struct AviCodecData { char avicodecname[128]; } AviCodecData; -typedef enum FFMpegPreset { +typedef enum eFFMpegPreset { FFM_PRESET_NONE, FFM_PRESET_ULTRAFAST, FFM_PRESET_SUPERFAST, @@ -107,7 +107,7 @@ typedef enum FFMpegPreset { FFM_PRESET_SLOW, FFM_PRESET_SLOWER, FFM_PRESET_VERYSLOW, -} FFMpegPreset; +} eFFMpegPreset; /* Mapping from easily-understandable descriptions to CRF values. @@ -116,7 +116,7 @@ typedef enum FFMpegPreset { * We use a slightly wider than "subjectively sane range" according * to https://trac.ffmpeg.org/wiki/Encode/H.264#a1.ChooseaCRFvalue */ -typedef enum FFMpegCrf { +typedef enum eFFMpegCrf { FFM_CRF_NONE = -1, FFM_CRF_LOSSLESS = 0, FFM_CRF_PERC_LOSSLESS = 17, @@ -125,7 +125,7 @@ typedef enum FFMpegCrf { FFM_CRF_LOW = 26, FFM_CRF_VERYLOW = 29, FFM_CRF_LOWEST = 32, -} FFMpegCrf; +} eFFMpegCrf; typedef struct FFMpegCodecData { int type; @@ -141,7 +141,7 @@ typedef struct FFMpegCodecData { int max_b_frames; /* only used if FFMPEG_USE_MAX_B_FRAMES flag is set. */ int flags; int constant_rate_factor; - int ffmpeg_preset; /* see FFMpegPreset */ + int ffmpeg_preset; /* see eFFMpegPreset */ int rc_min_rate; int rc_max_rate; @@ -214,7 +214,7 @@ typedef struct SceneRenderLayer { #define SCE_LAY_NEG_ZMASK 0x80000 /* srl->passflag */ -typedef enum ScenePassType { +typedef enum eScenePassType { SCE_PASS_COMBINED = (1 << 0), SCE_PASS_Z = (1 << 1), SCE_PASS_RGBA = (1 << 2), @@ -246,7 +246,7 @@ typedef enum ScenePassType { SCE_PASS_SUBSURFACE_DIRECT = (1 << 28), SCE_PASS_SUBSURFACE_INDIRECT = (1 << 29), SCE_PASS_SUBSURFACE_COLOR = (1 << 30), -} ScenePassType; +} eScenePassType; #define RE_PASSNAME_COMBINED "Combined" #define RE_PASSNAME_Z "Depth" @@ -508,23 +508,23 @@ typedef struct BakeData { } BakeData; /* (char) normal_swizzle */ -typedef enum BakeNormalSwizzle { +typedef enum eBakeNormalSwizzle { R_BAKE_POSX = 0, R_BAKE_POSY = 1, R_BAKE_POSZ = 2, R_BAKE_NEGX = 3, R_BAKE_NEGY = 4, R_BAKE_NEGZ = 5, -} BakeNormalSwizzle; +} eBakeNormalSwizzle; /* (char) save_mode */ -typedef enum BakeSaveMode { +typedef enum eBakeSaveMode { R_BAKE_SAVE_INTERNAL = 0, R_BAKE_SAVE_EXTERNAL = 1, -} BakeSaveMode; +} eBakeSaveMode; /* bake->pass_filter */ -typedef enum BakePassFilter { +typedef enum eBakePassFilter { R_BAKE_PASS_FILTER_NONE = 0, R_BAKE_PASS_FILTER_AO = (1 << 0), R_BAKE_PASS_FILTER_EMIT = (1 << 1), @@ -535,7 +535,7 @@ typedef enum BakePassFilter { R_BAKE_PASS_FILTER_DIRECT = (1 << 6), R_BAKE_PASS_FILTER_INDIRECT = (1 << 7), R_BAKE_PASS_FILTER_COLOR = (1 << 8), -} BakePassFilter; +} eBakePassFilter; #define R_BAKE_PASS_FILTER_ALL (~0) @@ -749,7 +749,7 @@ typedef struct RenderData { float unit_line_thickness; /* in pixels */ /* render engine */ - char engine[32]; + char engine[32] DNA_DEPRECATED; // XXX deprecated since 2.8 /* Cycles baking */ struct BakeData bake; @@ -773,6 +773,12 @@ typedef struct RenderData { } RenderData; /* *************************************************************** */ +/* Settings related to viewport drawing/render, only settings used by WorkSpace and Scene. */ +typedef struct ViewRender { + char engine_id[32]; +} ViewRender; + +/* *************************************************************** */ /* Render Conversion/Simplfication Settings */ /* control render convert and shading engine */ @@ -883,7 +889,6 @@ typedef struct GameData { /* Scene LoD */ short lodflag, pad2; int scehysteresis, pad5; - } GameData; #define STEREO_NOSTEREO 1 @@ -975,12 +980,12 @@ enum { #define STEREO_RIGHT_SUFFIX "_R" #define STEREO_LEFT_SUFFIX "_L" -typedef enum StereoViews { +typedef enum eStereoViews { STEREO_LEFT_ID = 0, STEREO_RIGHT_ID = 1, STEREO_3D_ID = 2, STEREO_MONO_ID = 3, -} StereoViews; +} eStereoViews; /* *************************************************************** */ /* Markers */ @@ -1008,7 +1013,7 @@ typedef struct Paint { void *paint_cursor; unsigned char paint_cursor_col[4]; - /* enum PaintFlags */ + /* enum ePaintFlags */ int flags; /* Paint stroke can use up to PAINT_MAX_INPUT_SAMPLES inputs to @@ -1344,7 +1349,7 @@ typedef enum { /* only used if unified alpha is enabled, mirrors the brush flag * BRUSH_ALPHA_PRESSURE */ UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE = (1 << 4) -} UnifiedPaintSettingsFlags; +} eUnifiedPaintSettingsFlags; typedef struct CurvePaintSettings { @@ -1699,6 +1704,8 @@ typedef struct Scene { IDProperty *layer_properties; /* settings to be override by workspaces */ int pad5[2]; + + ViewRender view_render; } Scene; /* **************** RENDERDATA ********************* */ @@ -2071,16 +2078,16 @@ enum { }; /* Paint.flags */ -typedef enum { +typedef enum ePaintFlags { PAINT_SHOW_BRUSH = (1 << 0), PAINT_FAST_NAVIGATE = (1 << 1), PAINT_SHOW_BRUSH_ON_SURFACE = (1 << 2), PAINT_USE_CAVITY_MASK = (1 << 3) -} PaintFlags; +} ePaintFlags; /* Paint.symmetry_flags * (for now just a duplicate of sculpt symmetry flags) */ -typedef enum SymmetryFlags { +typedef enum ePaintSymmetryFlags { PAINT_SYMM_X = (1 << 0), PAINT_SYMM_Y = (1 << 1), PAINT_SYMM_Z = (1 << 2), @@ -2088,13 +2095,13 @@ typedef enum SymmetryFlags { PAINT_TILE_X = (1 << 4), PAINT_TILE_Y = (1 << 5), PAINT_TILE_Z = (1 << 6), -} SymmetryFlags; +} ePaintSymmetryFlags; #define PAINT_SYMM_AXIS_ALL (PAINT_SYMM_X | PAINT_SYMM_Y | PAINT_SYMM_Z) /* Sculpt.flags */ /* These can eventually be moved to paint flags? */ -typedef enum SculptFlags { +typedef enum eSculptFlags { #ifdef DNA_DEPRECATED /* deprecated, part of paint struct symmetry_flags now */ SCULPT_SYMM_X = (1 << 0), @@ -2124,12 +2131,12 @@ typedef enum SculptFlags { /* If set, dynamic-topology detail size will be constant in object space */ SCULPT_DYNTOPO_DETAIL_CONSTANT = (1 << 13), SCULPT_DYNTOPO_DETAIL_BRUSH = (1 << 14), -} SculptFlags; +} eSculptFlags; -typedef enum ImagePaintMode { +typedef enum eImageePaintMode { IMAGEPAINT_MODE_MATERIAL, /* detect texture paint slots from the material */ IMAGEPAINT_MODE_IMAGE, /* select texture paint image directly */ -} ImagePaintMode; +} eImageePaintMode; /* ImagePaintSettings.flag */ #define IMAGEPAINT_DRAWING 1 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index d2b04e59815..b06880be515 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -182,6 +182,7 @@ typedef enum eSpaceButtons_Context { BCONTEXT_BONE_CONSTRAINT = 12, BCONTEXT_RENDER_LAYER = 13, BCONTEXT_COLLECTION = 14, + BCONTEXT_WORKSPACE = 15, /* always as last... */ BCONTEXT_TOT @@ -667,7 +668,7 @@ typedef struct FSMenuEntry { } FSMenuEntry; /* FileSelectParams.display */ -enum FileDisplayTypeE { +enum eFileDisplayType { FILE_DEFAULTDISPLAY = 0, FILE_SHORTDISPLAY = 1, FILE_LONGDISPLAY = 2, @@ -675,7 +676,7 @@ enum FileDisplayTypeE { }; /* FileSelectParams.sort */ -enum FileSortTypeE { +enum eFileSortType { FILE_SORT_NONE = 0, FILE_SORT_ALPHA = 1, FILE_SORT_EXTENSION = 2, diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index e2997f4ba0a..ca9b4e1aba0 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -319,7 +319,7 @@ typedef struct wmKeyMap { /* runtime */ int (*poll)(struct bContext *); /* verify if enabled in the current context */ - void *modal_items; /* for modal, EnumPropertyItem for now */ + const void *modal_items; /* for modal, EnumPropertyItem for now */ } wmKeyMap; /* wmKeyMap.flag */ diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h index 3805e1c0a8a..272d0cd110a 100644 --- a/source/blender/makesdna/DNA_workspace_types.h +++ b/source/blender/makesdna/DNA_workspace_types.h @@ -29,6 +29,7 @@ #ifndef __DNA_WORKSPACE_TYPES_H__ #define __DNA_WORKSPACE_TYPES_H__ +#include "DNA_scene_types.h" /* Same logic as DNA_DEPRECATED_ALLOW, but throws 'deprecated' * warnings if DNA_PRIVATE_WORKSPACE_ALLOW is not defined */ @@ -76,10 +77,13 @@ typedef struct WorkSpace { /* Custom transform orientations */ ListBase transform_orientations DNA_PRIVATE_WORKSPACE; - int object_mode DNA_PRIVATE_WORKSPACE; /* enum ObjectMode */ - int pad; + int object_mode DNA_PRIVATE_WORKSPACE; /* enum eObjectMode */ + int flags DNA_PRIVATE_WORKSPACE; /* enum eWorkSpaceFlags */ struct SceneLayer *render_layer DNA_PRIVATE_WORKSPACE; + + char engine_id[32]; /* Render Engine. */ + struct ViewRender view_render; } WorkSpace; /* internal struct, but exported for read/write */ @@ -132,4 +136,8 @@ typedef struct WorkSpaceInstanceHook { struct WorkSpaceLayout *temp_layout_store; } WorkSpaceInstanceHook; +typedef enum eWorkSpaceFlags { + WORKSPACE_USE_SCENE_SETTINGS = (1 << 0), +} eWorkSpaceFlags; + #endif /* __DNA_WORKSPACE_TYPES_H__ */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 114b0c32c15..7bb9e772697 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -708,6 +708,7 @@ extern StructRNA RNA_WaveModifier; extern StructRNA RNA_VertexWeightEditModifier; extern StructRNA RNA_VertexWeightMixModifier; extern StructRNA RNA_VertexWeightProximityModifier; +extern StructRNA RNA_ViewRenderSettings; extern StructRNA RNA_Window; extern StructRNA RNA_WindowManager; extern StructRNA RNA_WipeSequence; @@ -845,22 +846,25 @@ void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *soft int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value); int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value); -bool RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier); -int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **identifier); -bool RNA_enum_name(EnumPropertyItem *item, const int value, const char **r_name); -bool RNA_enum_description(EnumPropertyItem *item, const int value, const char **description); -int RNA_enum_from_value(EnumPropertyItem *item, const int value); -int RNA_enum_from_identifier(EnumPropertyItem *item, const char *identifier); +bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **identifier); +int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item, const int value, const char **identifier); +bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r_name); +bool RNA_enum_description(const EnumPropertyItem *item, const int value, const char **description); +int RNA_enum_from_value(const EnumPropertyItem *item, const int value); +int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier); void RNA_property_enum_items_ex( struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const bool use_static, - EnumPropertyItem **item, int *r_totitem, bool *r_free); -void RNA_property_enum_items(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, - EnumPropertyItem **item, int *r_totitem, bool *r_free); -void RNA_property_enum_items_gettexted(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, - EnumPropertyItem **r_item, int *r_totitem, bool *r_free); -void RNA_property_enum_items_gettexted_all(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, - EnumPropertyItem **r_item, int *r_totitem, bool *r_free); + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free); +void RNA_property_enum_items( + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free); +void RNA_property_enum_items_gettexted( + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free); +void RNA_property_enum_items_gettexted_all( + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free); bool RNA_property_enum_value(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value); bool RNA_property_enum_identifier(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier); bool RNA_property_enum_name(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name); @@ -1058,10 +1062,10 @@ void RNA_enum_set_identifier(struct bContext *C, PointerRNA *ptr, const char *na bool RNA_enum_is_equal(struct bContext *C, PointerRNA *ptr, const char *name, const char *enumname); /* lower level functions that don't use a PointerRNA */ -bool RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *r_value); -bool RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **r_identifier); -bool RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *r_icon); -bool RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **r_name); +bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value); +bool RNA_enum_id_from_value(const EnumPropertyItem *item, int value, const char **r_identifier); +bool RNA_enum_icon_from_value(const EnumPropertyItem *item, int value, int *r_icon); +bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name); void RNA_string_get(PointerRNA *ptr, const char *name, char *value); char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 7a61b3ec489..47648583e14 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -219,8 +219,8 @@ void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item); void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem); -void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item); -void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item, int value); +void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item); +void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value); void RNA_enum_item_end(EnumPropertyItem **items, int *totitem); /* Memory management */ diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 301c6fae3ca..760ddb34368 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -36,210 +36,212 @@ struct bNodeSocketType; /* Types */ /* use in cases where only dynamic types are used */ -extern EnumPropertyItem DummyRNA_NULL_items[]; -extern EnumPropertyItem DummyRNA_DEFAULT_items[]; +extern const EnumPropertyItem DummyRNA_NULL_items[]; +extern const EnumPropertyItem DummyRNA_DEFAULT_items[]; /* all others should follow 'rna_enum_*_items' naming */ -extern EnumPropertyItem rna_enum_id_type_items[]; +extern const EnumPropertyItem rna_enum_id_type_items[]; -extern EnumPropertyItem rna_enum_object_mode_items[]; -extern EnumPropertyItem rna_enum_object_empty_drawtype_items[]; -extern EnumPropertyItem rna_enum_metaelem_type_items[]; +extern const EnumPropertyItem rna_enum_object_mode_items[]; +extern const EnumPropertyItem rna_enum_object_empty_drawtype_items[]; +extern const EnumPropertyItem rna_enum_metaelem_type_items[]; -extern EnumPropertyItem rna_enum_proportional_falloff_items[]; -extern EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]; -extern EnumPropertyItem rna_enum_proportional_editing_items[]; -extern EnumPropertyItem rna_enum_snap_target_items[]; -extern EnumPropertyItem rna_enum_snap_element_items[]; -extern EnumPropertyItem rna_enum_snap_node_element_items[]; -extern EnumPropertyItem rna_enum_curve_fit_method_items[]; -extern EnumPropertyItem rna_enum_mesh_select_mode_items[]; -extern EnumPropertyItem rna_enum_mesh_delimit_mode_items[]; -extern EnumPropertyItem rna_enum_space_type_items[]; -extern EnumPropertyItem rna_enum_region_type_items[]; -extern EnumPropertyItem rna_enum_object_modifier_type_items[]; -extern EnumPropertyItem rna_enum_constraint_type_items[]; -extern EnumPropertyItem rna_enum_boidrule_type_items[]; -extern EnumPropertyItem rna_enum_sequence_modifier_type_items[]; -extern EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[]; +extern const EnumPropertyItem rna_enum_proportional_falloff_items[]; +extern const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]; +extern const EnumPropertyItem rna_enum_proportional_editing_items[]; +extern const EnumPropertyItem rna_enum_snap_target_items[]; +extern const EnumPropertyItem rna_enum_snap_element_items[]; +extern const EnumPropertyItem rna_enum_snap_node_element_items[]; +extern const EnumPropertyItem rna_enum_curve_fit_method_items[]; +extern const EnumPropertyItem rna_enum_mesh_select_mode_items[]; +extern const EnumPropertyItem rna_enum_mesh_delimit_mode_items[]; +extern const EnumPropertyItem rna_enum_space_type_items[]; +extern const EnumPropertyItem rna_enum_region_type_items[]; +extern const EnumPropertyItem rna_enum_object_modifier_type_items[]; +extern const EnumPropertyItem rna_enum_constraint_type_items[]; +extern const EnumPropertyItem rna_enum_boidrule_type_items[]; +extern const EnumPropertyItem rna_enum_sequence_modifier_type_items[]; +extern const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[]; -extern EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[]; -extern EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[]; +extern const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[]; +extern const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[]; -extern EnumPropertyItem rna_enum_image_type_items[]; -extern EnumPropertyItem rna_enum_image_color_mode_items[]; -extern EnumPropertyItem rna_enum_image_color_depth_items[]; -extern EnumPropertyItem rna_enum_image_generated_type_items[]; +extern const EnumPropertyItem rna_enum_image_type_items[]; +extern const EnumPropertyItem rna_enum_image_color_mode_items[]; +extern const EnumPropertyItem rna_enum_image_color_depth_items[]; +extern const EnumPropertyItem rna_enum_image_generated_type_items[]; -extern EnumPropertyItem rna_enum_normal_space_items[]; -extern EnumPropertyItem rna_enum_normal_swizzle_items[]; -extern EnumPropertyItem rna_enum_bake_save_mode_items[]; +extern const EnumPropertyItem rna_enum_normal_space_items[]; +extern const EnumPropertyItem rna_enum_normal_swizzle_items[]; +extern const EnumPropertyItem rna_enum_bake_save_mode_items[]; -extern EnumPropertyItem rna_enum_views_format_items[]; -extern EnumPropertyItem rna_enum_views_format_multilayer_items[]; -extern EnumPropertyItem rna_enum_views_format_multiview_items[]; -extern EnumPropertyItem rna_enum_stereo3d_display_items[]; -extern EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[]; -extern EnumPropertyItem rna_enum_stereo3d_interlace_type_items[]; +extern const EnumPropertyItem rna_enum_views_format_items[]; +extern const EnumPropertyItem rna_enum_views_format_multilayer_items[]; +extern const EnumPropertyItem rna_enum_views_format_multiview_items[]; +extern const EnumPropertyItem rna_enum_stereo3d_display_items[]; +extern const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[]; +extern const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[]; -extern EnumPropertyItem rna_enum_exr_codec_items[]; -extern EnumPropertyItem rna_enum_color_sets_items[]; +extern const EnumPropertyItem rna_enum_exr_codec_items[]; +extern const EnumPropertyItem rna_enum_color_sets_items[]; -extern EnumPropertyItem rna_enum_beztriple_keyframe_type_items[]; -extern EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[]; -extern EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[]; -extern EnumPropertyItem rna_enum_keyframe_handle_type_items[]; +extern const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[]; +extern const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[]; +extern const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[]; +extern const EnumPropertyItem rna_enum_keyframe_handle_type_items[]; -extern EnumPropertyItem rna_enum_keyblock_type_items[]; +extern const EnumPropertyItem rna_enum_keyblock_type_items[]; -extern EnumPropertyItem rna_enum_keyingset_path_grouping_items[]; -extern EnumPropertyItem rna_enum_keying_flag_items[]; +extern const EnumPropertyItem rna_enum_keyingset_path_grouping_items[]; +extern const EnumPropertyItem rna_enum_keying_flag_items[]; -extern EnumPropertyItem rna_enum_keyframe_paste_offset_items[]; -extern EnumPropertyItem rna_enum_keyframe_paste_merge_items[]; +extern const EnumPropertyItem rna_enum_keyframe_paste_offset_items[]; +extern const EnumPropertyItem rna_enum_keyframe_paste_merge_items[]; -extern EnumPropertyItem rna_enum_fmodifier_type_items[]; +extern const EnumPropertyItem rna_enum_fmodifier_type_items[]; -extern EnumPropertyItem rna_enum_nla_mode_extend_items[]; -extern EnumPropertyItem rna_enum_nla_mode_blend_items[]; +extern const EnumPropertyItem rna_enum_nla_mode_extend_items[]; +extern const EnumPropertyItem rna_enum_nla_mode_blend_items[]; -extern EnumPropertyItem rna_enum_motionpath_bake_location_items[]; +extern const EnumPropertyItem rna_enum_motionpath_bake_location_items[]; -extern EnumPropertyItem rna_enum_event_value_items[]; -extern EnumPropertyItem rna_enum_event_type_items[]; -extern EnumPropertyItem rna_enum_operator_return_items[]; +extern const EnumPropertyItem rna_enum_event_value_items[]; +extern const EnumPropertyItem rna_enum_event_type_items[]; +extern const EnumPropertyItem rna_enum_operator_return_items[]; -extern EnumPropertyItem rna_enum_brush_sculpt_tool_items[]; -extern EnumPropertyItem rna_enum_brush_vertex_tool_items[]; -extern EnumPropertyItem rna_enum_brush_image_tool_items[]; +extern const EnumPropertyItem rna_enum_brush_sculpt_tool_items[]; +extern const EnumPropertyItem rna_enum_brush_vertex_tool_items[]; +extern const EnumPropertyItem rna_enum_brush_image_tool_items[]; -extern EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[]; +extern const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[]; -extern EnumPropertyItem rna_enum_uv_sculpt_tool_items[]; +extern const EnumPropertyItem rna_enum_uv_sculpt_tool_items[]; -extern EnumPropertyItem rna_enum_axis_xy_items[]; -extern EnumPropertyItem rna_enum_axis_xyz_items[]; +extern const EnumPropertyItem rna_enum_axis_xy_items[]; +extern const EnumPropertyItem rna_enum_axis_xyz_items[]; -extern EnumPropertyItem rna_enum_axis_flag_xyz_items[]; +extern const EnumPropertyItem rna_enum_axis_flag_xyz_items[]; -extern EnumPropertyItem rna_enum_symmetrize_direction_items[]; +extern const EnumPropertyItem rna_enum_symmetrize_direction_items[]; -extern EnumPropertyItem rna_enum_texture_type_items[]; +extern const EnumPropertyItem rna_enum_texture_type_items[]; -extern EnumPropertyItem rna_enum_lamp_type_items[]; +extern const EnumPropertyItem rna_enum_lamp_type_items[]; -extern EnumPropertyItem rna_enum_unpack_method_items[]; +extern const EnumPropertyItem rna_enum_unpack_method_items[]; -extern EnumPropertyItem rna_enum_object_type_items[]; +extern const EnumPropertyItem rna_enum_object_type_items[]; -extern EnumPropertyItem rna_enum_object_type_curve_items[]; +extern const EnumPropertyItem rna_enum_object_type_curve_items[]; -extern EnumPropertyItem rna_enum_rigidbody_object_type_items[]; -extern EnumPropertyItem rna_enum_rigidbody_object_shape_items[]; -extern EnumPropertyItem rna_enum_rigidbody_constraint_type_items[]; +extern const EnumPropertyItem rna_enum_rigidbody_object_type_items[]; +extern const EnumPropertyItem rna_enum_rigidbody_object_shape_items[]; +extern const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[]; -extern EnumPropertyItem rna_enum_object_axis_items[]; +extern const EnumPropertyItem rna_enum_object_axis_items[]; -extern EnumPropertyItem rna_enum_controller_type_items[]; +extern const EnumPropertyItem rna_enum_controller_type_items[]; -extern EnumPropertyItem rna_enum_render_pass_type_items[]; -extern EnumPropertyItem rna_enum_render_pass_debug_type_items[]; +extern const EnumPropertyItem rna_enum_render_pass_type_items[]; +extern const EnumPropertyItem rna_enum_render_pass_debug_type_items[]; -extern EnumPropertyItem rna_enum_bake_pass_type_items[]; -extern EnumPropertyItem rna_enum_bake_pass_filter_type_items[]; +extern const EnumPropertyItem rna_enum_bake_pass_type_items[]; +extern const EnumPropertyItem rna_enum_bake_pass_filter_type_items[]; -extern EnumPropertyItem rna_enum_keymap_propvalue_items[]; +extern const EnumPropertyItem rna_enum_keymap_propvalue_items[]; -extern EnumPropertyItem rna_enum_operator_context_items[]; +extern const EnumPropertyItem rna_enum_operator_context_items[]; -extern EnumPropertyItem rna_enum_wm_report_items[]; +extern const EnumPropertyItem rna_enum_wm_report_items[]; -extern EnumPropertyItem rna_enum_transform_mode_types[]; +extern const EnumPropertyItem rna_enum_transform_mode_types[]; -extern EnumPropertyItem rna_enum_posebone_rotmode_items[]; +extern const EnumPropertyItem rna_enum_posebone_rotmode_items[]; -extern EnumPropertyItem rna_enum_property_type_items[]; -extern EnumPropertyItem rna_enum_property_subtype_items[]; -extern EnumPropertyItem rna_enum_property_unit_items[]; +extern const EnumPropertyItem rna_enum_property_type_items[]; +extern const EnumPropertyItem rna_enum_property_subtype_items[]; +extern const EnumPropertyItem rna_enum_property_unit_items[]; -extern EnumPropertyItem rna_enum_gameproperty_type_items[]; +extern const EnumPropertyItem rna_enum_gameproperty_type_items[]; -extern EnumPropertyItem rna_enum_viewport_shade_items[]; +extern const EnumPropertyItem rna_enum_viewport_shade_items[]; -extern EnumPropertyItem rna_enum_navigation_mode_items[]; +extern const EnumPropertyItem rna_enum_navigation_mode_items[]; -extern EnumPropertyItem rna_enum_file_sort_items[]; +extern const EnumPropertyItem rna_enum_file_sort_items[]; -extern EnumPropertyItem rna_enum_node_socket_in_out_items[]; -extern EnumPropertyItem rna_enum_node_icon_items[]; +extern const EnumPropertyItem rna_enum_node_socket_in_out_items[]; +extern const EnumPropertyItem rna_enum_node_icon_items[]; -extern EnumPropertyItem rna_enum_node_math_items[]; -extern EnumPropertyItem rna_enum_node_vec_math_items[]; -extern EnumPropertyItem rna_enum_node_filter_items[]; +extern const EnumPropertyItem rna_enum_node_math_items[]; +extern const EnumPropertyItem rna_enum_node_vec_math_items[]; +extern const EnumPropertyItem rna_enum_node_filter_items[]; -extern EnumPropertyItem rna_enum_ramp_blend_items[]; +extern const EnumPropertyItem rna_enum_ramp_blend_items[]; -extern EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[]; +extern const EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[]; -extern EnumPropertyItem rna_enum_clip_editor_mode_items[]; +extern const EnumPropertyItem rna_enum_clip_editor_mode_items[]; -extern EnumPropertyItem rna_enum_icon_items[]; -extern EnumPropertyItem rna_enum_uilist_layout_type_items[]; +extern const EnumPropertyItem rna_enum_icon_items[]; +extern const EnumPropertyItem rna_enum_uilist_layout_type_items[]; -extern EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[]; -extern EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[]; -extern EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[]; -extern EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[]; +extern const EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[]; +extern const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[]; +extern const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[]; +extern const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[]; -extern EnumPropertyItem rna_enum_window_cursor_items[]; +extern const EnumPropertyItem rna_enum_window_cursor_items[]; -extern EnumPropertyItem rna_enum_dt_method_vertex_items[]; -extern EnumPropertyItem rna_enum_dt_method_edge_items[]; -extern EnumPropertyItem rna_enum_dt_method_loop_items[]; -extern EnumPropertyItem rna_enum_dt_method_poly_items[]; -extern EnumPropertyItem rna_enum_dt_mix_mode_items[]; -extern EnumPropertyItem rna_enum_dt_layers_select_src_items[]; -extern EnumPropertyItem rna_enum_dt_layers_select_dst_items[]; +extern const EnumPropertyItem rna_enum_dt_method_vertex_items[]; +extern const EnumPropertyItem rna_enum_dt_method_edge_items[]; +extern const EnumPropertyItem rna_enum_dt_method_loop_items[]; +extern const EnumPropertyItem rna_enum_dt_method_poly_items[]; +extern const EnumPropertyItem rna_enum_dt_mix_mode_items[]; +extern const EnumPropertyItem rna_enum_dt_layers_select_src_items[]; +extern const EnumPropertyItem rna_enum_dt_layers_select_dst_items[]; -extern EnumPropertyItem rna_enum_abc_compression_items[]; +extern const EnumPropertyItem rna_enum_abc_compression_items[]; /* API calls */ int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo); int rna_node_tree_idname_to_enum(const char *idname); struct bNodeTreeType *rna_node_tree_type_from_enum(int value); -EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, struct bNodeTreeType *), bool *r_free); +const EnumPropertyItem *rna_node_tree_type_itemf( + void *data, int (*poll)(void *data, struct bNodeTreeType *), bool *r_free); int rna_node_type_to_enum(struct bNodeType *typeinfo); int rna_node_idname_to_enum(const char *idname); struct bNodeType *rna_node_type_from_enum(int value); -EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, struct bNodeType *), bool *r_free); +const EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, struct bNodeType *), bool *r_free); int rna_node_socket_type_to_enum(struct bNodeSocketType *typeinfo); int rna_node_socket_idname_to_enum(const char *idname); struct bNodeSocketType *rna_node_socket_type_from_enum(int value); -EnumPropertyItem *rna_node_socket_type_itemf(void *data, int (*poll)(void *data, struct bNodeSocketType *), bool *r_free); +const EnumPropertyItem *rna_node_socket_type_itemf( + void *data, int (*poll)(void *data, struct bNodeSocketType *), bool *r_free); struct bContext; struct PointerRNA; struct PropertyRNA; -EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *rna_Sensor_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *rna_Sensor_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); /* Generic functions, return an enum from library data, index is the position * in the linked list can add more for different types as needed */ -EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); // EnumPropertyItem *RNA_action_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_group_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_movieclip_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_movieclip_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_mask_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); -EnumPropertyItem *RNA_mask_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_group_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_movieclip_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_movieclip_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_mask_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const EnumPropertyItem *RNA_mask_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); #endif /* __RNA_ENUM_TYPES_H__ */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 2ec25bc8e46..167e1776a57 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -361,7 +361,7 @@ typedef void (*StringPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA typedef int (*EnumPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*EnumPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); /* same as PropEnumItemFunc */ -typedef EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +typedef const EnumPropertyItem *(*EnumPropertyItemFunc)(struct bContext *C, PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); typedef struct PropertyRNA PropertyRNA; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index f232a1aef48..3e67eeb3951 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2872,7 +2872,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr int i, defaultfound = 0, totflag = 0; if (eprop->item) { - fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier, + fprintf(f, "static const EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier, strnest, prop->identifier, eprop->totitem + 1); for (i = 0; i < eprop->totitem; i++) { diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 90b7ffd71bb..c519c61e9e9 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -48,7 +48,7 @@ /* enum of ID-block types * NOTE: need to keep this in line with the other defines for these */ -EnumPropertyItem rna_enum_id_type_items[] = { +const EnumPropertyItem rna_enum_id_type_items[] = { {ID_AC, "ACTION", ICON_ACTION, "Action", ""}, {ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""}, {ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""}, @@ -964,7 +964,7 @@ static void rna_def_ID(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *prop, *parm; - static EnumPropertyItem update_flag_items[] = { + static const EnumPropertyItem update_flag_items[] = { {OB_RECALC_OB, "OBJECT", 0, "Object", ""}, {OB_RECALC_DATA, "DATA", 0, "Data", ""}, {OB_RECALC_TIME, "TIME", 0, "Time", ""}, diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 114ded9b0c0..d24b2ccc91d 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1340,26 +1340,26 @@ int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *va } /* Reuse for dynamic types */ -EnumPropertyItem DummyRNA_NULL_items[] = { +const EnumPropertyItem DummyRNA_NULL_items[] = { {0, NULL, 0, NULL, NULL} }; /* Reuse for dynamic types with default value */ -EnumPropertyItem DummyRNA_DEFAULT_items[] = { +const EnumPropertyItem DummyRNA_DEFAULT_items[] = { {0, "DEFAULT", 0, "Default", ""}, {0, NULL, 0, NULL, NULL} }; void RNA_property_enum_items_ex( bContext *C, PointerRNA *ptr, PropertyRNA *prop, const bool use_static, - EnumPropertyItem **r_item, int *r_totitem, bool *r_free) + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free) { EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop); *r_free = false; if (!use_static && eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) { - EnumPropertyItem *item; + const EnumPropertyItem *item; if (prop->flag & PROP_ENUM_NO_CONTEXT) item = eprop->itemf(NULL, ptr, prop, r_free); @@ -1387,13 +1387,15 @@ void RNA_property_enum_items_ex( } void RNA_property_enum_items( - bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **r_item, int *r_totitem, bool *r_free) + bContext *C, PointerRNA *ptr, PropertyRNA *prop, + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free) { RNA_property_enum_items_ex(C, ptr, prop, false, r_item, r_totitem, r_free); } #ifdef WITH_INTERNATIONAL -static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item, int *r_totitem, bool *r_free) +static void property_enum_translate( + PropertyRNA *prop, EnumPropertyItem **r_item, int *r_totitem, bool *r_free) { if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) { int i; @@ -1410,7 +1412,7 @@ static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item nitem = *r_item; } else { - EnumPropertyItem *item = *r_item; + const EnumPropertyItem *item = *r_item; int tot; if (r_totitem) { @@ -1443,31 +1445,36 @@ static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item } #endif -void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, - EnumPropertyItem **r_item, int *r_totitem, bool *r_free) +void RNA_property_enum_items_gettexted( + bContext *C, PointerRNA *ptr, PropertyRNA *prop, + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free) { RNA_property_enum_items(C, ptr, prop, r_item, r_totitem, r_free); #ifdef WITH_INTERNATIONAL - property_enum_translate(prop, r_item, r_totitem, r_free); + /* Normally dropping 'const' is _not_ ok, in this case it's only modified if we own the memory + * so allow the exception (callers are creating new arrays in this case). */ + property_enum_translate(prop, (EnumPropertyItem **)r_item, r_totitem, r_free); #endif } -void RNA_property_enum_items_gettexted_all(bContext *C, PointerRNA *ptr, PropertyRNA *prop, - EnumPropertyItem **r_item, int *r_totitem, bool *r_free) +void RNA_property_enum_items_gettexted_all( + bContext *C, PointerRNA *ptr, PropertyRNA *prop, + const EnumPropertyItem **r_item, int *r_totitem, bool *r_free) { EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop); int mem_size = sizeof(EnumPropertyItem) * (eprop->totitem + 1); /* first return all items */ + EnumPropertyItem *item_array = MEM_mallocN(mem_size, "enum_gettext_all"); *r_free = true; - *r_item = MEM_mallocN(mem_size, "enum_gettext_all"); - memcpy(*r_item, eprop->item, mem_size); + memcpy(item_array, eprop->item, mem_size); - if (r_totitem) + if (r_totitem) { *r_totitem = eprop->totitem; + } if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) { - EnumPropertyItem *item; + const EnumPropertyItem *item; int i; bool free = false; @@ -1485,30 +1492,32 @@ void RNA_property_enum_items_gettexted_all(bContext *C, PointerRNA *ptr, Propert /* items that do not exist on list are returned, but have their names/identifiers NULLed out */ for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) { - if (STREQ(item[i_fixed].identifier, (*r_item)[i].identifier)) { + if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) { exists = true; break; } } if (!exists) { - (*r_item)[i].name = NULL; - (*r_item)[i].identifier = ""; + item_array[i].name = NULL; + item_array[i].identifier = ""; } } - if (free) - MEM_freeN(item); + if (free) { + MEM_freeN((void *)item); + } } #ifdef WITH_INTERNATIONAL - property_enum_translate(prop, r_item, r_totitem, r_free); + property_enum_translate(prop, &item_array, r_totitem, r_free); #endif + *r_item = item_array; } bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value) { - EnumPropertyItem *item; + const EnumPropertyItem *item; bool free; bool found; @@ -1525,7 +1534,7 @@ bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, co } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } } else { @@ -1534,7 +1543,7 @@ bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, co return found; } -bool RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **r_identifier) +bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **r_identifier) { const int i = RNA_enum_from_value(item, value); if (i != -1) { @@ -1546,7 +1555,7 @@ bool RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **r } } -int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **r_identifier) +int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item, const int value, const char **r_identifier) { int index = 0; for (; item->identifier; item++) { @@ -1558,7 +1567,7 @@ int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const return index; } -bool RNA_enum_name(EnumPropertyItem *item, const int value, const char **r_name) +bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r_name) { const int i = RNA_enum_from_value(item, value); if (i != -1) { @@ -1570,7 +1579,7 @@ bool RNA_enum_name(EnumPropertyItem *item, const int value, const char **r_name) } } -bool RNA_enum_description(EnumPropertyItem *item, const int value, const char **r_description) +bool RNA_enum_description(const EnumPropertyItem *item, const int value, const char **r_description) { const int i = RNA_enum_from_value(item, value); if (i != -1) { @@ -1582,7 +1591,7 @@ bool RNA_enum_description(EnumPropertyItem *item, const int value, const char ** } } -int RNA_enum_from_identifier(EnumPropertyItem *item, const char *identifier) +int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier) { int i = 0; for (; item->identifier; item++, i++) { @@ -1593,7 +1602,7 @@ int RNA_enum_from_identifier(EnumPropertyItem *item, const char *identifier) return -1; } -int RNA_enum_from_value(EnumPropertyItem *item, const int value) +int RNA_enum_from_value(const EnumPropertyItem *item, const int value) { int i = 0; for (; item->identifier; item++, i++) { @@ -1607,16 +1616,16 @@ int RNA_enum_from_value(EnumPropertyItem *item, const int value) bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier) { - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; bool free; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); if (item) { bool result; result = RNA_enum_identifier(item, value, identifier); - if (free) - MEM_freeN(item); - + if (free) { + MEM_freeN((void *)item); + } return result; } return false; @@ -1624,15 +1633,16 @@ bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *pro bool RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name) { - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; bool free; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); if (item) { bool result; result = RNA_enum_name(item, value, name); - if (free) - MEM_freeN(item); + if (free) { + MEM_freeN((void *)item); + } return result; } @@ -1660,7 +1670,7 @@ bool RNA_property_enum_item_from_value( bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, EnumPropertyItem *r_item) { - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; bool free; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); @@ -1676,8 +1686,9 @@ bool RNA_property_enum_item_from_value( result = false; } - if (free) - MEM_freeN(item); + if (free) { + MEM_freeN((void *)item); + } return result; } @@ -1704,7 +1715,7 @@ bool RNA_property_enum_item_from_value_gettexted( int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier) { - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; bool free; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); @@ -1712,7 +1723,7 @@ int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, Property int result; result = RNA_enum_bitflag_identifiers(item, value, identifier); if (free) - MEM_freeN(item); + MEM_freeN((void *)item); return result; } @@ -3058,7 +3069,7 @@ void *RNA_property_enum_py_data_get(PropertyRNA *prop) */ int RNA_property_enum_step(const bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int step) { - EnumPropertyItem *item_array; + const EnumPropertyItem *item_array; int totitem; bool free; int result_value = from_value; @@ -3082,7 +3093,7 @@ int RNA_property_enum_step(const bContext *C, PointerRNA *ptr, PropertyRNA *prop } if (free) { - MEM_freeN(item_array); + MEM_freeN((void *)item_array); } return result_value; @@ -5356,7 +5367,7 @@ void RNA_enum_set_identifier(bContext *C, PointerRNA *ptr, const char *name, con bool RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); - EnumPropertyItem *item; + const EnumPropertyItem *item; bool free; if (prop) { @@ -5370,7 +5381,7 @@ bool RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const cha } if (free) { - MEM_freeN(item); + MEM_freeN((void *)item); } if (i != -1) { @@ -5386,7 +5397,7 @@ bool RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const cha } } -bool RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *r_value) +bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value) { const int i = RNA_enum_from_identifier(item, identifier); if (i != -1) { @@ -5398,7 +5409,7 @@ bool RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int } } -bool RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **r_identifier) +bool RNA_enum_id_from_value(const EnumPropertyItem *item, int value, const char **r_identifier) { const int i = RNA_enum_from_value(item, value); if (i != -1) { @@ -5410,7 +5421,7 @@ bool RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **r_id } } -bool RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *r_icon) +bool RNA_enum_icon_from_value(const EnumPropertyItem *item, int value, int *r_icon) { const int i = RNA_enum_from_value(item, value); if (i != -1) { @@ -5422,7 +5433,7 @@ bool RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *r_icon) } } -bool RNA_enum_name_from_value(EnumPropertyItem *item, int value, const char **r_name) +bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name) { const int i = RNA_enum_from_value(item, value); if (i != -1) { @@ -5943,14 +5954,14 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in if (RNA_property_flag(prop) & PROP_ENUM_FLAG) { /* represent as a python set */ if (val) { - EnumPropertyItem *item_array; + const EnumPropertyItem *item_array; bool free; BLI_dynstr_append(dynstr, "{"); RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free); if (item_array) { - EnumPropertyItem *item = item_array; + const EnumPropertyItem *item = item_array; bool is_first = true; for (; item->identifier; item++) { if (item->identifier[0] && item->value & val) { @@ -5960,7 +5971,7 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in } if (free) { - MEM_freeN(item_array); + MEM_freeN((void *)item_array); } } diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 004acbe4dbd..26ec813a14f 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -47,7 +47,7 @@ #include "WM_types.h" /* Always keep in alphabetical order */ -static EnumPropertyItem actuator_type_items[] = { +static const EnumPropertyItem actuator_type_items[] = { {ACT_ACTION, "ACTION", 0, "Action", ""}, {ACT_ARMATURE, "ARMATURE", 0, "Armature", ""}, {ACT_CAMERA, "CAMERA", 0, "Camera", ""}, @@ -432,7 +432,7 @@ static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values) } /* Always keep in alphabetical order */ -EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; Object *ob = NULL; @@ -579,7 +579,7 @@ static void rna_def_action_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_ACTION_PLAY, "PLAY", 0, "Play", ""}, {ACT_ACTION_PINGPONG, "PINGPONG", 0, "Ping Pong", ""}, {ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""}, @@ -592,7 +592,7 @@ static void rna_def_action_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_blend_items[] = { + static const EnumPropertyItem prop_blend_items[] = { {ACT_ACTION_BLEND, "BLEND", 0, "Blend", ""}, {ACT_ACTION_ADD, "ADD", 0, "Add", ""}, {0, NULL, 0, NULL, NULL} @@ -714,7 +714,7 @@ static void rna_def_object_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""}, {ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""}, {ACT_OBJECT_CHARACTER, "OBJECT_CHARACTER", 0, "Character Motion", ""}, @@ -915,7 +915,7 @@ static void rna_def_camera_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_axis_items[] = { + static const EnumPropertyItem prop_axis_items[] = { {OB_POSX, "POS_X", 0, "+X", "Camera tries to get behind the X axis"}, {OB_POSY, "POS_Y", 0, "+Y", "Camera tries to get behind the Y axis"}, {OB_NEGX, "NEG_X", 0, "-X", "Camera tries to get behind the -X axis"}, @@ -970,7 +970,7 @@ static void rna_def_sound_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_SND_PLAY_STOP_SOUND, "PLAYSTOP", 0, "Play Stop", ""}, {ACT_SND_PLAY_END_SOUND, "PLAYEND", 0, "Play End", ""}, {ACT_SND_LOOP_STOP_SOUND, "LOOPSTOP", 0, "Loop Stop", ""}, @@ -1072,7 +1072,7 @@ static void rna_def_property_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_PROP_ASSIGN, "ASSIGN", 0, "Assign", ""}, {ACT_PROP_ADD, "ADD", 0, "Add", ""}, {ACT_PROP_COPY, "COPY", 0, "Copy", ""}, @@ -1120,7 +1120,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""}, {ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""}, {ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""}, @@ -1128,7 +1128,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_limit_items[] = { + static const EnumPropertyItem prop_limit_items[] = { {ACT_CONST_NONE, "NONE", 0, "None", ""}, {ACT_CONST_LOCX, "LOCX", 0, "Loc X", ""}, {ACT_CONST_LOCY, "LOCY", 0, "Loc Y", ""}, @@ -1136,7 +1136,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_direction_items[] = { + static const EnumPropertyItem prop_direction_items[] = { {ACT_CONST_NONE, "NONE", 0, "None", ""}, {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""}, {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""}, @@ -1147,7 +1147,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_direction_pos_items[] = { + static const EnumPropertyItem prop_direction_pos_items[] = { {ACT_CONST_NONE, "NONE", 0, "None", ""}, {ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""}, {ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""}, @@ -1339,7 +1339,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_dyn_items[] = { + static const EnumPropertyItem prop_dyn_items[] = { {ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""}, {ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""}, {ACT_EDOB_ENABLE_RB, "ENABLERIGIDBODY", 0, "Enable Rigid Body", ""}, @@ -1348,7 +1348,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""}, {ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""}, {ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""}, @@ -1357,7 +1357,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_track_axis_items[] = { + static const EnumPropertyItem prop_track_axis_items[] = { {ACT_TRACK_TRAXIS_X, "TRACKAXISX", 0, "X axis", ""}, {ACT_TRACK_TRAXIS_Y, "TRACKAXISY", 0, "Y axis", ""}, {ACT_TRACK_TRAXIS_Z, "TRACKAXISZ", 0, "Z axis", ""}, @@ -1367,7 +1367,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_up_axis_items[] = { + static const EnumPropertyItem prop_up_axis_items[] = { {ACT_TRACK_UP_X, "UPAXISX", 0, "X axis", ""}, {ACT_TRACK_UP_Y, "UPAXISY", 0, "Y axis", ""}, {ACT_TRACK_UP_Z, "UPAXISZ", 0, "Z axis", ""}, @@ -1484,7 +1484,7 @@ static void rna_def_scene_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_SCENE_RESTART, "RESTART", 0, "Restart", ""}, {ACT_SCENE_SET, "SET", 0, "Set Scene", ""}, {ACT_SCENE_CAMERA, "CAMERA", 0, "Set Camera", ""}, @@ -1525,7 +1525,7 @@ static void rna_def_random_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_distribution_items[] = { + static const EnumPropertyItem prop_distribution_items[] = { {ACT_RANDOM_BOOL_CONST, "BOOL_CONSTANT", 0, "Bool Constant", ""}, {ACT_RANDOM_BOOL_UNIFORM, "BOOL_UNIFORM", 0, "Bool Uniform", ""}, {ACT_RANDOM_BOOL_BERNOUILLI, "BOOL_BERNOUILLI", 0, "Bool Bernoulli", ""}, @@ -1653,7 +1653,7 @@ static void rna_def_message_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_body_type_items[] = { + static const EnumPropertyItem prop_body_type_items[] = { {ACT_MESG_MESG, "TEXT", 0, "Text", ""}, {ACT_MESG_PROP, "PROPERTY", 0, "Property", ""}, {0, NULL, 0, NULL, NULL} @@ -1696,7 +1696,7 @@ static void rna_def_game_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { /* {ACT_GAME_LOAD, "LOAD", 0, "Load Game", ""}, */ /* {ACT_GAME_START, "START", 0, "Start Loaded Game", ""}, */ /* keeping the load/start hacky for compatibility with 2.49 */ @@ -1765,7 +1765,7 @@ static void rna_def_twodfilter_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_2DFILTER_ENABLED, "ENABLE", 0, "Enable Filter", ""}, {ACT_2DFILTER_DISABLED, "DISABLE", 0, "Disable Filter", ""}, {ACT_2DFILTER_NOFILTER, "REMOVE", 0, "Remove Filter", ""}, @@ -1826,7 +1826,7 @@ static void rna_def_parent_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_PARENT_SET, "SETPARENT", 0, "Set Parent", ""}, {ACT_PARENT_REMOVE, "REMOVEPARENT", 0, "Remove Parent", ""}, {0, NULL, 0, NULL, NULL} @@ -1868,7 +1868,7 @@ static void rna_def_state_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_STATE_SET, "SET", 0, "Set State", ""}, {ACT_STATE_ADD, "ADD", 0, "Add State", ""}, {ACT_STATE_REMOVE, "REMOVE", 0, "Remove State", ""}, @@ -1898,7 +1898,7 @@ static void rna_def_armature_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_ARM_RUN, "RUN", 0, "Run Armature", ""}, {ACT_ARM_ENABLE, "ENABLE", 0, "Enable", ""}, {ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""}, @@ -1961,14 +1961,14 @@ static void rna_def_steering_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_STEERING_SEEK, "SEEK", 0, "Seek", ""}, {ACT_STEERING_FLEE, "FLEE", 0, "Flee", ""}, {ACT_STEERING_PATHFOLLOWING, "PATHFOLLOWING", 0, "Path following", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem facingaxis_items[] = { + static const EnumPropertyItem facingaxis_items[] = { {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, {3, "Z", 0, "Z", ""}, @@ -2070,13 +2070,13 @@ static void rna_def_mouse_actuator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {ACT_MOUSE_VISIBILITY, "VISIBILITY", 0, "Visibility", ""}, {ACT_MOUSE_LOOK, "LOOK", 0, "Look", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_object_axis_items[] = { + static const EnumPropertyItem prop_object_axis_items[] = { {ACT_MOUSE_OBJECT_AXIS_X, "OBJECT_AXIS_X", 0, "X Axis", ""}, {ACT_MOUSE_OBJECT_AXIS_Y, "OBJECT_AXIS_Y", 0, "Y Axis", ""}, {ACT_MOUSE_OBJECT_AXIS_Z, "OBJECT_AXIS_Z", 0, "Z Axis", ""}, diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 1f5ddddb74f..6e436b8ff32 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -47,7 +47,7 @@ #include "ED_keyframing.h" /* exported for use in API */ -EnumPropertyItem rna_enum_keyingset_path_grouping_items[] = { +const EnumPropertyItem rna_enum_keyingset_path_grouping_items[] = { {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""}, {KSP_GROUP_NONE, "NONE", 0, "None", ""}, {KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""}, @@ -57,7 +57,7 @@ EnumPropertyItem rna_enum_keyingset_path_grouping_items[] = { /* It would be cool to get rid of this 'INSERTKEY_' prefix in 'py strings' values, but it would break existing * exported keyingset... :/ */ -EnumPropertyItem rna_enum_keying_flag_items[] = { +const EnumPropertyItem rna_enum_keying_flag_items[] = { {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"}, {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Visual Keying", diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c index eea24bfb1e0..0ae07874853 100644 --- a/source/blender/makesrna/intern/rna_animviz.c +++ b/source/blender/makesrna/intern/rna_animviz.c @@ -43,7 +43,7 @@ /* Which part of bone(s) get baked */ // TODO: icons? -EnumPropertyItem rna_enum_motionpath_bake_location_items[] = { +const EnumPropertyItem rna_enum_motionpath_bake_location_items[] = { {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"}, {0, "TAILS", 0, "Tails", "Calculate bone paths from tails"}, //{MOTIONPATH_BAKE_CENTERS, "CENTROID", 0, "Centers", "Calculate bone paths from center of mass"}, diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index a2c5d90b91e..2ed147a75cf 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -975,7 +975,7 @@ static void rna_def_armature(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem prop_drawtype_items[] = { + static const EnumPropertyItem prop_drawtype_items[] = { {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"}, {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"}, {ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"}, @@ -984,12 +984,12 @@ static void rna_def_armature(BlenderRNA *brna) {ARM_WIRE, "WIRE", 0, "Wire", "Display bones as thin wires, showing subdivision and B-Splines"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_vdeformer[] = { + static const EnumPropertyItem prop_vdeformer[] = { {ARM_VDEF_BLENDER, "BLENDER", 0, "Blender", "Use Blender's armature vertex deformation"}, {ARM_VDEF_BGE_CPU, "BGE_CPU", 0, "BGE", "Use vertex deformation code optimized for the BGE"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_ghost_type_items[] = { + static const EnumPropertyItem prop_ghost_type_items[] = { {ARM_GHOST_CUR, "CURRENT_FRAME", 0, "Around Frame", "Display Ghosts of poses within a fixed number of frames around the current frame"}, {ARM_GHOST_RANGE, "RANGE", 0, "In Range", "Display Ghosts of poses within specified range"}, diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index cee2b7ed9bc..98ca58e0edd 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -48,7 +48,7 @@ #include "WM_api.h" #include "WM_types.h" -EnumPropertyItem rna_enum_boidrule_type_items[] = { +const EnumPropertyItem rna_enum_boidrule_type_items[] = { {eBoidRuleType_Goal, "GOAL", 0, "Goal", "Go to assigned object or loudest assigned signal source"}, {eBoidRuleType_Avoid, "AVOID", 0, "Avoid", "Get away from assigned object or loudest assigned signal source"}, {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision", @@ -71,7 +71,7 @@ EnumPropertyItem rna_enum_boidrule_type_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem boidruleset_type_items[] = { +static const EnumPropertyItem boidruleset_type_items[] = { {eBoidRulesetType_Fuzzy, "FUZZY", 0, "Fuzzy", "Rules are gone through top to bottom (only the first rule which effect is above " "fuzziness threshold is evaluated)"}, diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index f79ff4486dd..b7d108fc769 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -43,13 +43,13 @@ #include "WM_types.h" -static EnumPropertyItem prop_direction_items[] = { +static const EnumPropertyItem prop_direction_items[] = { {0, "ADD", 0, "Add", "Add effect of brush"}, {BRUSH_DIR_IN, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem sculpt_stroke_method_items[] = { +static const EnumPropertyItem sculpt_stroke_method_items[] = { {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"}, {BRUSH_DRAG_DOT, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"}, {BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"}, @@ -62,7 +62,7 @@ static EnumPropertyItem sculpt_stroke_method_items[] = { }; -EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = { +const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = { {SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""}, {SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""}, {SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""}, @@ -86,7 +86,7 @@ EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = { }; -EnumPropertyItem rna_enum_brush_vertex_tool_items[] = { +const EnumPropertyItem rna_enum_brush_vertex_tool_items[] = { {PAINT_BLEND_MIX, "MIX", ICON_BRUSH_MIX, "Mix", "Use mix blending mode while painting"}, {PAINT_BLEND_ADD, "ADD", ICON_BRUSH_ADD, "Add", "Use add blending mode while painting"}, {PAINT_BLEND_SUB, "SUB", ICON_BRUSH_SUBTRACT, "Subtract", "Use subtract blending mode while painting"}, @@ -112,7 +112,7 @@ EnumPropertyItem rna_enum_brush_vertex_tool_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_brush_image_tool_items[] = { +const EnumPropertyItem rna_enum_brush_image_tool_items[] = { {PAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_TEXDRAW, "Draw", ""}, {PAINT_TOOL_SOFTEN, "SOFTEN", ICON_BRUSH_SOFTEN, "Soften", ""}, {PAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_SMEAR, "Smear", ""}, @@ -486,48 +486,48 @@ static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value) brush->unprojected_radius = value; } -static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, +static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); - static EnumPropertyItem prop_default_items[] = { + static const EnumPropertyItem prop_default_items[] = { {0, NULL, 0, NULL, NULL} }; /* sculpt mode */ - static EnumPropertyItem prop_flatten_contrast_items[] = { + static const EnumPropertyItem prop_flatten_contrast_items[] = { {0, "FLATTEN", 0, "Flatten", "Add effect of brush"}, {BRUSH_DIR_IN, "CONTRAST", 0, "Contrast", "Subtract effect of brush"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_fill_deepen_items[] = { + static const EnumPropertyItem prop_fill_deepen_items[] = { {0, "FILL", 0, "Fill", "Add effect of brush"}, {BRUSH_DIR_IN, "DEEPEN", 0, "Deepen", "Subtract effect of brush"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_scrape_peaks_items[] = { + static const EnumPropertyItem prop_scrape_peaks_items[] = { {0, "SCRAPE", 0, "Scrape", "Add effect of brush"}, {BRUSH_DIR_IN, "PEAKS", 0, "Peaks", "Subtract effect of brush"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_pinch_magnify_items[] = { + static const EnumPropertyItem prop_pinch_magnify_items[] = { {0, "PINCH", 0, "Pinch", "Add effect of brush"}, {BRUSH_DIR_IN, "MAGNIFY", 0, "Magnify", "Subtract effect of brush"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_inflate_deflate_items[] = { + static const EnumPropertyItem prop_inflate_deflate_items[] = { {0, "INFLATE", 0, "Inflate", "Add effect of brush"}, {BRUSH_DIR_IN, "DEFLATE", 0, "Deflate", "Subtract effect of brush"}, {0, NULL, 0, NULL, NULL} }; /* texture paint mode */ - static EnumPropertyItem prop_soften_sharpen_items[] = { + static const EnumPropertyItem prop_soften_sharpen_items[] = { {0, "SOFTEN", 0, "Soften", "Blur effect of brush"}, {BRUSH_DIR_IN, "SHARPEN", 0, "Sharpen", "Sharpen effect of brush"}, {0, NULL, 0, NULL, NULL} @@ -592,12 +592,12 @@ static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, } } -static EnumPropertyItem *rna_Brush_stroke_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_Brush_stroke_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { - PaintMode mode = BKE_paintmode_get_active_from_context(C); + ePaintMode mode = BKE_paintmode_get_active_from_context(C); - static EnumPropertyItem brush_stroke_method_items[] = { + static const EnumPropertyItem brush_stroke_method_items[] = { {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"}, {BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"}, {BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"}, @@ -623,7 +623,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_map_mode_items[] = { + static const EnumPropertyItem prop_map_mode_items[] = { {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""}, {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, @@ -633,7 +633,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_tex_paint_map_mode_items[] = { + static const EnumPropertyItem prop_tex_paint_map_mode_items[] = { {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, @@ -642,7 +642,7 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_mask_paint_map_mode_items[] = { + static const EnumPropertyItem prop_mask_paint_map_mode_items[] = { {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, @@ -815,7 +815,7 @@ static void rna_def_brush(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_blend_items[] = { + static const EnumPropertyItem prop_blend_items[] = { {IMB_BLEND_MIX, "MIX", 0, "Mix", "Use mix blending mode while painting"}, {IMB_BLEND_ADD, "ADD", 0, "Add", "Use add blending mode while painting"}, {IMB_BLEND_SUB, "SUB", 0, "Subtract", "Use subtract blending mode while painting"}, @@ -843,7 +843,7 @@ static void rna_def_brush(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem brush_sculpt_plane_items[] = { + static const EnumPropertyItem brush_sculpt_plane_items[] = { {SCULPT_DISP_DIR_AREA, "AREA", 0, "Area Plane", ""}, {SCULPT_DISP_DIR_VIEW, "VIEW", 0, "View Plane", ""}, {SCULPT_DISP_DIR_X, "X", 0, "X Plane", ""}, @@ -852,32 +852,32 @@ static void rna_def_brush(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem brush_mask_tool_items[] = { + static const EnumPropertyItem brush_mask_tool_items[] = { {BRUSH_MASK_DRAW, "DRAW", 0, "Draw", ""}, {BRUSH_MASK_SMOOTH, "SMOOTH", 0, "Smooth", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem brush_blur_mode_items[] = { + static const EnumPropertyItem brush_blur_mode_items[] = { {KERNEL_BOX, "BOX", 0, "Box", ""}, {KERNEL_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem brush_gradient_items[] = { + static const EnumPropertyItem brush_gradient_items[] = { {BRUSH_GRADIENT_PRESSURE, "PRESSURE", 0, "Pressure", ""}, {BRUSH_GRADIENT_SPACING_REPEAT, "SPACING_REPEAT", 0, "Repeat", ""}, {BRUSH_GRADIENT_SPACING_CLAMP, "SPACING_CLAMP", 0, "Clamp", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem brush_gradient_fill_items[] = { + static const EnumPropertyItem brush_gradient_fill_items[] = { {BRUSH_GRADIENT_LINEAR, "LINEAR", 0, "Linear", ""}, {BRUSH_GRADIENT_RADIAL, "RADIAL", 0, "Radial", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem brush_mask_pressure_items[] = { + static const EnumPropertyItem brush_mask_pressure_items[] = { {0, "NONE", 0, "Off", ""}, {BRUSH_MASK_PRESSURE_RAMP, "RAMP", ICON_STYLUS_PRESSURE, "Ramp", ""}, {BRUSH_MASK_PRESSURE_CUTOFF, "CUTOFF", ICON_STYLUS_PRESSURE, "Cutoff", ""}, diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 1127940de44..c0d487ddbf6 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -103,14 +103,14 @@ static void rna_def_camera_stereo_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem convergence_mode_items[] = { + static const EnumPropertyItem convergence_mode_items[] = { {CAM_S3D_OFFAXIS, "OFFAXIS", 0, "Off-Axis", "Off-axis frustums converging in a plane"}, {CAM_S3D_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel cameras with no convergence"}, {CAM_S3D_TOE, "TOE", 0, "Toe-in", "Rotated cameras, looking at the convergence distance"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem pivot_items[] = { + static const EnumPropertyItem pivot_items[] = { {CAM_S3D_PIVOT_LEFT, "LEFT", 0, "Left", ""}, {CAM_S3D_PIVOT_RIGHT, "RIGHT", 0, "Right", ""}, {CAM_S3D_PIVOT_CENTER, "CENTER", 0, "Center", ""}, @@ -177,13 +177,13 @@ void RNA_def_camera(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {CAM_PERSP, "PERSP", 0, "Perspective", ""}, {CAM_ORTHO, "ORTHO", 0, "Orthographic", ""}, {CAM_PANO, "PANO", 0, "Panoramic", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_draw_type_extra_items[] = { + static const EnumPropertyItem prop_draw_type_extra_items[] = { {CAM_DTX_CENTER, "CENTER", 0, "Center", ""}, {CAM_DTX_CENTER_DIAG, "CENTER_DIAGONAL", 0, "Center Diagonal", ""}, {CAM_DTX_THIRDS, "THIRDS", 0, "Thirds", ""}, @@ -194,12 +194,12 @@ void RNA_def_camera(BlenderRNA *brna) {CAM_DTX_HARMONY_TRI_B, "HARMONY_TRIANGLE_B", 0, "Harmonious Triangle B", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_lens_unit_items[] = { + static const EnumPropertyItem prop_lens_unit_items[] = { {0, "MILLIMETERS", 0, "Millimeters", "Specify the lens in millimeters"}, {CAM_ANGLETOGGLE, "FOV", 0, "Field of View", "Specify the lens as the field of view's angle"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem sensor_fit_items[] = { + static const EnumPropertyItem sensor_fit_items[] = { {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Fit to the sensor width or height depending on image resolution"}, {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"}, {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"}, diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index effd140ab15..3d1a1458102 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -292,7 +292,7 @@ static void rna_def_cloth_solver_result(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem status_items[] = { + static const EnumPropertyItem status_items[] = { {BPH_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"}, {BPH_SOLVER_NUMERICAL_ISSUE, "NUMERICAL_ISSUE", 0, "Numerical Issue", "The provided data did not satisfy the prerequisites"}, {BPH_SOLVER_NO_CONVERGENCE, "NO_CONVERGENCE", 0, "No Convergence", "Iterative procedure did not converge"}, diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 4d9dcdf0fce..ad2586635c9 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -421,7 +421,7 @@ static void rna_ColorManagedDisplaySettings_display_device_set(struct PointerRNA } } -static EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf( +static const EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf( bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *items = NULL; @@ -475,7 +475,7 @@ static void rna_ColorManagedViewSettings_view_transform_set(PointerRNA *ptr, int } } -static EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf( +static const EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf( bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Scene *scene = CTX_data_scene(C); @@ -508,7 +508,7 @@ static void rna_ColorManagedViewSettings_look_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf( +static const EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data; @@ -561,7 +561,7 @@ static void rna_ColorManagedColorspaceSettings_colorspace_set(struct PointerRNA } } -static EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf( +static const EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf( bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *items = NULL; @@ -690,7 +690,7 @@ static void rna_def_curvemappoint(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_handle_type_items[] = { + static const EnumPropertyItem prop_handle_type_items[] = { {0, "AUTO", 0, "Auto Handle", ""}, {CUMA_HANDLE_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped Handle", ""}, {CUMA_HANDLE_VECTOR, "VECTOR", 0, "Vector Handle", ""}, @@ -749,7 +749,7 @@ static void rna_def_curvemap(BlenderRNA *brna) PropertyRNA *prop, *parm; FunctionRNA *func; - static EnumPropertyItem prop_extend_items[] = { + static const EnumPropertyItem prop_extend_items[] = { {0, "HORIZONTAL", 0, "Horizontal", ""}, {CUMA_EXTEND_EXTRAPOLATE, "EXTRAPOLATED", 0, "Extrapolated", ""}, {0, NULL, 0, NULL, NULL} @@ -912,7 +912,7 @@ static void rna_def_color_ramp(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem prop_interpolation_items[] = { + static const EnumPropertyItem prop_interpolation_items[] = { {COLBAND_INTERP_EASE, "EASE", 0, "Ease", ""}, {COLBAND_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, {COLBAND_INTERP_LINEAR, "LINEAR", 0, "Linear", ""}, @@ -921,14 +921,14 @@ static void rna_def_color_ramp(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_mode_items[] = { + static const EnumPropertyItem prop_mode_items[] = { {COLBAND_BLEND_RGB, "RGB", 0, "RGB", ""}, {COLBAND_BLEND_HSV, "HSV", 0, "HSV", ""}, {COLBAND_BLEND_HSL, "HSL", 0, "HSL", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_hsv_items[] = { + static const EnumPropertyItem prop_hsv_items[] = { {COLBAND_HUE_NEAR, "NEAR", 0, "Near", ""}, {COLBAND_HUE_FAR, "FAR", 0, "Far", ""}, {COLBAND_HUE_CW, "CW", 0, "Clockwise", ""}, @@ -992,7 +992,7 @@ static void rna_def_histogram(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_mode_items[] = { + static const EnumPropertyItem prop_mode_items[] = { {HISTO_MODE_LUMA, "LUMA", 0, "Luma", "Luma"}, {HISTO_MODE_RGB, "RGB", 0, "RGB", "Red Green Blue"}, {HISTO_MODE_R, "R", 0, "R", "Red"}, @@ -1021,7 +1021,7 @@ static void rna_def_scopes(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_wavefrm_mode_items[] = { + static const EnumPropertyItem prop_wavefrm_mode_items[] = { {SCOPES_WAVEFRM_LUMA, "LUMA", ICON_COLOR, "Luma", ""}, {SCOPES_WAVEFRM_RGB_PARADE, "PARADE", ICON_COLOR, "Parade", ""}, {SCOPES_WAVEFRM_YCC_601, "YCBCR601", ICON_COLOR, "YCbCr (ITU 601)", ""}, @@ -1073,22 +1073,22 @@ static void rna_def_colormanage(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem display_device_items[] = { + static const EnumPropertyItem display_device_items[] = { {0, "DEFAULT", 0, "Default", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem look_items[] = { + static const EnumPropertyItem look_items[] = { {0, "NONE", 0, "None", "Do not modify image in an artistic manner"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem view_transform_items[] = { + static const EnumPropertyItem view_transform_items[] = { {0, "NONE", 0, "None", "Do not perform any color transform on display, use old non-color managed technique for display"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem color_space_items[] = { + static const EnumPropertyItem color_space_items[] = { {0, "NONE", 0, "None", "Do not perform any color transform on load, treat colors as in scene linear space already"}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 8ecbd438c2e..8eb6bc1261e 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -46,7 +46,7 @@ #include "ED_object.h" /* please keep the names in sync with constraint.c */ -EnumPropertyItem rna_enum_constraint_type_items[] = { +const EnumPropertyItem rna_enum_constraint_type_items[] = { {0, "", 0, N_("Motion Tracking"), ""}, {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""}, {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""}, @@ -109,7 +109,7 @@ EnumPropertyItem rna_enum_constraint_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem target_space_pchan_items[] = { +static const EnumPropertyItem target_space_pchan_items[] = { {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world " "coordinate system"}, @@ -125,7 +125,7 @@ static EnumPropertyItem target_space_pchan_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem owner_space_pchan_items[] = { +static const EnumPropertyItem owner_space_pchan_items[] = { {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The constraint is applied relative to the world coordinate system"}, {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space", @@ -140,7 +140,7 @@ static EnumPropertyItem owner_space_pchan_items[] = { #ifdef RNA_RUNTIME -static EnumPropertyItem space_object_items[] = { +static const EnumPropertyItem space_object_items[] = { {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"}, {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", @@ -315,7 +315,7 @@ static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Object *ob = (Object *)ptr->id.data; @@ -327,7 +327,7 @@ static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), P return space_object_items; } -static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { bConstraint *con = (bConstraint *)ptr->data; @@ -493,7 +493,7 @@ static void rna_Constraint_transformCache_object_path_update(Main *bmain, Scene #else -static EnumPropertyItem constraint_distance_items[] = { +static const EnumPropertyItem constraint_distance_items[] = { {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", "The object is constrained inside a virtual sphere around the target object, " "with a radius defined by the limit distance"}, @@ -658,13 +658,13 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem constraint_ik_axisref_items[] = { + static const EnumPropertyItem constraint_ik_axisref_items[] = { {0, "BONE", 0, "Bone", ""}, {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""}, {0, NULL, 0, NULL, NULL}, }; - static EnumPropertyItem constraint_ik_type_items[] = { + static const EnumPropertyItem constraint_ik_type_items[] = { {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""}, {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""}, {0, NULL, 0, NULL, NULL}, @@ -806,7 +806,7 @@ static void rna_def_constraint_track_to(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem track_items[] = { + static const EnumPropertyItem track_items[] = { {TRACK_X, "TRACK_X", 0, "X", ""}, {TRACK_Y, "TRACK_Y", 0, "Y", ""}, {TRACK_Z, "TRACK_Z", 0, "Z", ""}, @@ -816,7 +816,7 @@ static void rna_def_constraint_track_to(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem up_items[] = { + static const EnumPropertyItem up_items[] = { {TRACK_X, "UP_X", 0, "X", ""}, {TRACK_Y, "UP_Y", 0, "Y", ""}, {TRACK_Z, "UP_Z", 0, "Z", ""}, @@ -1022,7 +1022,7 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem volume_items[] = { + static const EnumPropertyItem volume_items[] = { {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""}, {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""}, {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""}, @@ -1076,7 +1076,7 @@ static void rna_def_constraint_minmax(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem minmax_items[] = { + static const EnumPropertyItem minmax_items[] = { {TRACK_X, "FLOOR_X", 0, "X", ""}, {TRACK_Y, "FLOOR_Y", 0, "Y", ""}, {TRACK_Z, "FLOOR_Z", 0, "Z", ""}, @@ -1128,7 +1128,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem transform_channel_items[] = { + static const EnumPropertyItem transform_channel_items[] = { {20, "LOCATION_X", 0, "X Location", ""}, {21, "LOCATION_Y", 0, "Y Location", ""}, {22, "LOCATION_Z", 0, "Z Location", ""}, @@ -1209,7 +1209,7 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem locktrack_items[] = { + static const EnumPropertyItem locktrack_items[] = { {TRACK_X, "TRACK_X", 0, "X", ""}, {TRACK_Y, "TRACK_Y", 0, "Y", ""}, {TRACK_Z, "TRACK_Z", 0, "Z", ""}, @@ -1219,7 +1219,7 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem lock_items[] = { + static const EnumPropertyItem lock_items[] = { {TRACK_X, "LOCK_X", 0, "X", ""}, {TRACK_Y, "LOCK_Y", 0, "Y", ""}, {TRACK_Z, "LOCK_Z", 0, "Z", ""}, @@ -1263,7 +1263,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem forwardpath_items[] = { + static const EnumPropertyItem forwardpath_items[] = { {TRACK_X, "FORWARD_X", 0, "X", ""}, {TRACK_Y, "FORWARD_Y", 0, "Y", ""}, {TRACK_Z, "FORWARD_Z", 0, "Z", ""}, @@ -1273,7 +1273,7 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem pathup_items[] = { + static const EnumPropertyItem pathup_items[] = { {TRACK_X, "UP_X", 0, "X", ""}, {TRACK_Y, "UP_Y", 0, "Y", ""}, {TRACK_Z, "UP_Z", 0, "Z", ""}, @@ -1337,7 +1337,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem volume_items[] = { + static const EnumPropertyItem volume_items[] = { {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""}, {VOLUME_X, "VOLUME_X", 0, "X", ""}, {VOLUME_Z, "VOLUME_Z", 0, "Z", ""}, @@ -1345,7 +1345,7 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem plane_items[] = { + static const EnumPropertyItem plane_items[] = { {PLANE_X, "PLANE_X", 0, "X", "Keep X Axis"}, {PLANE_Z, "PLANE_Z", 0, "Z", "Keep Z Axis"}, {0, NULL, 0, NULL, NULL} @@ -1424,7 +1424,7 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem pivot_items[] = { + static const EnumPropertyItem pivot_items[] = { {CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"}, {CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"}, {CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", @@ -1596,7 +1596,7 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem clamp_items[] = { + static const EnumPropertyItem clamp_items[] = { {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""}, {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""}, {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""}, @@ -1633,7 +1633,7 @@ static void rna_def_constraint_transform(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem transform_items[] = { + static const EnumPropertyItem transform_items[] = { {TRANS_LOCATION, "LOCATION", 0, "Loc", ""}, {TRANS_ROTATION, "ROTATION", 0, "Rot", ""}, {TRANS_SCALE, "SCALE", 0, "Scale", ""}, @@ -2184,7 +2184,7 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrink the location to the nearest target surface"}, {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", @@ -2243,7 +2243,7 @@ static void rna_def_constraint_damped_track(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem damptrack_items[] = { + static const EnumPropertyItem damptrack_items[] = { {TRACK_X, "TRACK_X", 0, "X", ""}, {TRACK_Y, "TRACK_Y", 0, "Y", ""}, {TRACK_Z, "TRACK_Z", 0, "Z", ""}, @@ -2284,7 +2284,7 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem splineik_xz_scale_mode[] = { + static const EnumPropertyItem splineik_xz_scale_mode[] = { {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"}, {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", "Use the original scaling of the bones"}, @@ -2397,7 +2397,7 @@ static void rna_def_constraint_pivot(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem pivot_rotAxis_items[] = { + static const EnumPropertyItem pivot_rotAxis_items[] = { {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"}, {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot", "Use the pivot point in the negative rotation range around the X-axis"}, diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index 5701150b1bf..39f050924f4 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -39,6 +39,8 @@ #ifdef RNA_RUNTIME +#include "RE_engine.h" + static PointerRNA rna_Context_manager_get(PointerRNA *ptr) { bContext *C = (bContext *)ptr->data; @@ -133,6 +135,26 @@ static PointerRNA rna_Context_scene_layer_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_SceneLayer, CTX_data_scene_layer(C)); } +static PointerRNA rna_Context_view_render_get(PointerRNA *ptr) +{ + bContext *C = (bContext *)ptr->data; + return rna_pointer_inherit_refine(ptr, &RNA_ViewRenderSettings, CTX_data_view_render(C)); +} + +static void rna_Context_engine_get(PointerRNA *ptr, char *value) + { + bContext *C = (bContext *)ptr->data; + RenderEngineType *engine = CTX_data_engine(C); + strcpy(value, engine->idname); +} + +static int rna_Context_engine_length(PointerRNA *ptr) +{ + bContext *C = (bContext *)ptr->data; + RenderEngineType *engine = CTX_data_engine(C); + return strlen(engine->idname); +} + static PointerRNA rna_Context_scene_collection_get(PointerRNA *ptr) { bContext *C = (bContext *)ptr->data; @@ -174,7 +196,7 @@ void RNA_def_context(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem mode_items[] = { + static const EnumPropertyItem mode_items[] = { {CTX_MODE_EDIT_MESH, "EDIT_MESH", 0, "Mesh Edit", ""}, {CTX_MODE_EDIT_CURVE, "EDIT_CURVE", 0, "Curve Edit", ""}, {CTX_MODE_EDIT_SURFACE, "EDIT_SURFACE", 0, "Surface Edit", ""}, @@ -263,6 +285,15 @@ void RNA_def_context(BlenderRNA *brna) RNA_def_property_struct_type(prop, "SceneLayer"); RNA_def_property_pointer_funcs(prop, "rna_Context_scene_layer_get", NULL, NULL, NULL); + prop = RNA_def_property(srna, "view_render", PROP_POINTER, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_struct_type(prop, "ViewRenderSettings"); + RNA_def_property_pointer_funcs(prop, "rna_Context_view_render_get", NULL, NULL, NULL); + + prop = RNA_def_property(srna, "engine", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs(prop, "rna_Context_engine_get", "rna_Context_engine_length", NULL); + prop = RNA_def_property(srna, "scene_collection", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "SceneCollection"); diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index 3fa9d7ef270..bdb3daedebb 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -41,7 +41,7 @@ #include "WM_types.h" -EnumPropertyItem rna_enum_controller_type_items[] = { +const EnumPropertyItem rna_enum_controller_type_items[] = { {CONT_LOGIC_AND, "LOGIC_AND", 0, "And", "Logic And"}, {CONT_LOGIC_OR, "LOGIC_OR", 0, "Or", "Logic Or"}, {CONT_LOGIC_NAND, "LOGIC_NAND", 0, "Nand", "Logic Nand"}, @@ -190,7 +190,7 @@ void RNA_def_controller(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem python_controller_modes[] = { + static const EnumPropertyItem python_controller_modes[] = { {CONT_PY_SCRIPT, "SCRIPT", 0, "Script", ""}, {CONT_PY_MODULE, "MODULE", 0, "Module", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 50938eb75dc..894af338c12 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -47,7 +47,7 @@ #include "WM_types.h" #ifndef RNA_RUNTIME -static EnumPropertyItem beztriple_handle_type_items[] = { +static const EnumPropertyItem beztriple_handle_type_items[] = { {HD_FREE, "FREE", 0, "Free", ""}, {HD_VECT, "VECTOR", 0, "Vector", ""}, {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, @@ -56,7 +56,7 @@ static EnumPropertyItem beztriple_handle_type_items[] = { }; #endif -EnumPropertyItem rna_enum_keyframe_handle_type_items[] = { +const EnumPropertyItem rna_enum_keyframe_handle_type_items[] = { {HD_FREE, "FREE", 0, "Free", ""}, {HD_VECT, "VECTOR", 0, "Vector", ""}, {HD_ALIGN, "ALIGNED", 0, "Aligned", ""}, @@ -65,7 +65,7 @@ EnumPropertyItem rna_enum_keyframe_handle_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[] = { +const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[] = { /* interpolation */ {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"}, {BEZT_IPO_CONST, "CONSTANT", ICON_IPO_CONSTANT, "Constant", "No interpolation, value of A gets held until B is encountered"}, @@ -91,7 +91,7 @@ EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem curve_type_items[] = { +static const EnumPropertyItem curve_type_items[] = { {CU_POLY, "POLY", 0, "Poly", ""}, {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""}, @@ -302,7 +302,7 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) BKE_curve_curve_dimension_update(cu); } -static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Curve *cu = (Curve *)ptr->id.data; @@ -955,7 +955,7 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem prop_align_items[] = { + static const EnumPropertyItem prop_align_items[] = { {CU_ALIGN_X_LEFT, "LEFT", 0, "Left", "Align text to the left"}, {CU_ALIGN_X_MIDDLE, "CENTER", 0, "Center", "Center text"}, {CU_ALIGN_X_RIGHT, "RIGHT", 0, "Right", "Align text to the right"}, @@ -964,7 +964,7 @@ static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_align_y_items[] = { + static const EnumPropertyItem prop_align_y_items[] = { {CU_ALIGN_Y_TOP_BASELINE, "TOP_BASELINE", 0, "Top Base-Line", "Align to top but use the base-line of the text"}, {CU_ALIGN_Y_TOP, "TOP", 0, "Top", "Align text to the top"}, {CU_ALIGN_Y_CENTER, "CENTER", 0, "Center", "Align text to the middle"}, @@ -1336,7 +1336,7 @@ static void rna_def_curve(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem curve_twist_mode_items[] = { + static const EnumPropertyItem curve_twist_mode_items[] = { {CU_TWIST_Z_UP, "Z_UP", 0, "Z-Up", "Use Z-Up axis to calculate the curve twist at each point"}, {CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"}, {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"}, @@ -1350,7 +1350,7 @@ static void rna_def_curve(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bevfac_mapping_items[] = { + static const EnumPropertyItem bevfac_mapping_items[] = { {CU_BEVFAC_MAP_RESOLU, "RESOLUTION", 0, "Resolution", "Map the bevel factor to the number of subdivisions of a spline (U resolution)"}, {CU_BEVFAC_MAP_SEGMENT, "SEGMENTS", 0, "Segments", "Map the bevel factor to the length of a segment and to the number of subdivisions of a segment"}, {CU_BEVFAC_MAP_SPLINE, "SPLINE", 0, "Spline", "Map the bevel factor to the length of a spline"}, @@ -1602,7 +1602,7 @@ static void rna_def_curve(BlenderRNA *brna) static void rna_def_curve_nurb(BlenderRNA *brna) { - static EnumPropertyItem spline_interpolation_items[] = { + static const EnumPropertyItem spline_interpolation_items[] = { {KEY_LINEAR, "LINEAR", 0, "Linear", ""}, {KEY_CARDINAL, "CARDINAL", 0, "Cardinal", ""}, {KEY_BSPLINE, "BSPLINE", 0, "BSpline", ""}, diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 118dd0b15de..fd511655c5f 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -3284,17 +3284,17 @@ void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropert void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem) { - static EnumPropertyItem sepr = {0, "", 0, NULL, NULL}; + static const EnumPropertyItem sepr = {0, "", 0, NULL, NULL}; RNA_enum_item_add(items, totitem, &sepr); } -void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item) +void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item) { for (; item->identifier; item++) RNA_enum_item_add(items, totitem, item); } -void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item, int value) +void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value) { for (; item->identifier; item++) { if (item->value == value) { @@ -3308,7 +3308,7 @@ void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumProper void RNA_enum_item_end(EnumPropertyItem **items, int *totitem) { - static EnumPropertyItem empty = {0, NULL, 0, NULL, NULL}; + static const EnumPropertyItem empty = {0, NULL, 0, NULL, NULL}; RNA_enum_item_add(items, totitem, &empty); } @@ -3425,12 +3425,12 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA eprop->item = earray; for (a = 0; a < eprop->totitem; a++) { - if (eprop->item[a].identifier) - eprop->item[a].identifier = BLI_strdup(eprop->item[a].identifier); - if (eprop->item[a].name) - eprop->item[a].name = BLI_strdup(eprop->item[a].name); - if (eprop->item[a].description) - eprop->item[a].description = BLI_strdup(eprop->item[a].description); + if (earray[a].identifier) + earray[a].identifier = BLI_strdup(earray[a].identifier); + if (earray[a].name) + earray[a].name = BLI_strdup(earray[a].name); + if (earray[a].description) + earray[a].description = BLI_strdup(earray[a].description); } } break; diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index f51bd9d93cc..596aff6de8f 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -45,7 +45,7 @@ #include "WM_types.h" -EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[] = { +const EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[] = { {MOD_DYNAMICPAINT_TYPE_CANVAS, "CANVAS", 0, "Canvas", ""}, {MOD_DYNAMICPAINT_TYPE_BRUSH, "BRUSH", 0, "Brush", ""}, {0, NULL, 0, NULL, NULL} @@ -246,7 +246,7 @@ static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Objec } -static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf( +static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; @@ -332,7 +332,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) FunctionRNA *func; /* Surface format */ - static EnumPropertyItem prop_dynamicpaint_surface_format[] = { + static const EnumPropertyItem prop_dynamicpaint_surface_format[] = { /*{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""}, */ {MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""}, {MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""}, @@ -340,20 +340,20 @@ static void rna_def_canvas_surface(BlenderRNA *brna) }; /* Surface type - generated dynamically based on surface format */ - static EnumPropertyItem prop_dynamicpaint_surface_type[] = { + static const EnumPropertyItem prop_dynamicpaint_surface_type[] = { {MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""}, {0, NULL, 0, NULL, NULL} }; /* Surface output preview. currently only paint has multiple outputs */ - static EnumPropertyItem prop_dynamicpaint_surface_preview[] = { + static const EnumPropertyItem prop_dynamicpaint_surface_preview[] = { {MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""}, {MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""}, {0, NULL, 0, NULL, NULL} }; /* Initial color setting */ - static EnumPropertyItem prop_dynamicpaint_init_color_type[] = { + static const EnumPropertyItem prop_dynamicpaint_init_color_type[] = { {MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""}, {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""}, {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""}, @@ -363,7 +363,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) /* Effect type * Only used by ui to view per effect settings */ - static EnumPropertyItem prop_dynamicpaint_effecttype[] = { + static const EnumPropertyItem prop_dynamicpaint_effecttype[] = { {1, "SPREAD", 0, "Spread", ""}, {2, "DRIP", 0, "Drip", ""}, {3, "SHRINK", 0, "Shrink", ""}, @@ -371,7 +371,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) }; /* Displacemap file format */ - static EnumPropertyItem prop_dynamicpaint_image_fileformat[] = { + static const EnumPropertyItem prop_dynamicpaint_image_fileformat[] = { {MOD_DPAINT_IMGFORMAT_PNG, "PNG", 0, "PNG", ""}, #ifdef WITH_OPENEXR {MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""}, @@ -380,7 +380,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna) }; /* Displacemap type */ - static EnumPropertyItem prop_dynamicpaint_displace_type[] = { + static const EnumPropertyItem prop_dynamicpaint_displace_type[] = { {MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""}, {MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""}, {0, NULL, 0, NULL, NULL} @@ -773,7 +773,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) PropertyRNA *prop; /* paint collision type */ - static EnumPropertyItem prop_dynamicpaint_collisiontype[] = { + static const EnumPropertyItem prop_dynamicpaint_collisiontype[] = { {MOD_DPAINT_COL_PSYS, "PARTICLE_SYSTEM", ICON_PARTICLES, "Particle System", ""}, {MOD_DPAINT_COL_POINT, "POINT", ICON_META_EMPTY, "Object Center", ""}, {MOD_DPAINT_COL_DIST, "DISTANCE", ICON_META_EMPTY, "Proximity", ""}, @@ -782,14 +782,14 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_dynamicpaint_prox_falloff[] = { + static const EnumPropertyItem prop_dynamicpaint_prox_falloff[] = { {MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""}, {MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""}, {MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = { + static const EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = { {MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""}, {MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""}, {MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""}, @@ -797,7 +797,7 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = { + static const EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = { {MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""}, {MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""}, {MOD_DPAINT_RAY_ZPLUS, "Z_AXIS", 0, "Z-Axis", ""}, diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index e951e15ca8c..08aa681e17b 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -50,7 +50,7 @@ #include "ED_keyframing.h" #include "ED_keyframes_edit.h" -EnumPropertyItem rna_enum_fmodifier_type_items[] = { +const EnumPropertyItem rna_enum_fmodifier_type_items[] = { {FMODIFIER_TYPE_NULL, "NULL", 0, "Invalid", ""}, {FMODIFIER_TYPE_GENERATOR, "GENERATOR", 0, "Generator", "Generate a curve using a factorized or expanded polynomial"}, @@ -71,7 +71,7 @@ EnumPropertyItem rna_enum_fmodifier_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = { +const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = { {BEZT_KEYTYPE_KEYFRAME, "KEYFRAME", VICO_KEYTYPE_KEYFRAME_VEC, "Keyframe", "Normal keyframe - e.g. for key poses"}, {BEZT_KEYTYPE_BREAKDOWN, "BREAKDOWN", VICO_KEYTYPE_BREAKDOWN_VEC, "Breakdown", "A breakdown pose - e.g. for transitions between key poses"}, {BEZT_KEYTYPE_MOVEHOLD, "MOVING_HOLD", VICO_KEYTYPE_MOVING_HOLD_VEC, "Moving Hold", "A keyframe that is part of a moving hold"}, @@ -80,7 +80,7 @@ EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[] = { +const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[] = { /* XXX: auto-easing is currently using a placeholder icon... */ {BEZT_IPO_EASE_AUTO, "AUTO", ICON_IPO_EASE_IN_OUT, "Automatic Easing", "Easing type is chosen automatically based on what the type of interpolation used " @@ -497,7 +497,7 @@ static void rna_FCurve_active_modifier_set(PointerRNA *ptr, PointerRNA value) static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, int type) { - return add_fmodifier(&fcu->modifiers, type); + return add_fmodifier(&fcu->modifiers, type, fcu); } static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, PointerRNA *fcm_ptr) @@ -588,11 +588,15 @@ static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max static void rna_FModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id = ptr->id.data; + FModifier *fcm = (FModifier *)ptr->data; AnimData *adt = BKE_animdata_from_id(id); DEG_id_tag_update(id, (GS(id->name) == ID_OB) ? OB_RECALC_OB : OB_RECALC_DATA); if (adt != NULL) { adt->recalc |= ADT_RECALC_ANIM; } + if (fcm->curve && fcm->type == FMODIFIER_TYPE_CYCLES) { + calchandles_fcurve(fcm->curve); + } } static void rna_FModifier_verify_data_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -919,7 +923,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem generator_mode_items[] = { + static const EnumPropertyItem generator_mode_items[] = { {FCM_GENERATOR_POLYNOMIAL, "POLYNOMIAL", 0, "Expanded Polynomial", ""}, {FCM_GENERATOR_POLYNOMIAL_FACTORISED, "POLYNOMIAL_FACTORISED", 0, "Factorized Polynomial", ""}, {0, NULL, 0, NULL, NULL} @@ -966,7 +970,7 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {0, "SIN", 0, "Sine", ""}, {1, "COS", 0, "Cosine", ""}, {2, "TAN", 0, "Tangent", ""}, @@ -1117,7 +1121,7 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"}, {FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"}, {FCM_EXTRAPOLATE_CYCLIC_OFFSET, "REPEAT_OFFSET", 0, "Repeat with Offset", @@ -1234,7 +1238,7 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_modification_items[] = { + static const EnumPropertyItem prop_modification_items[] = { {FCM_NOISE_MODIF_REPLACE, "REPLACE", 0, "Replace", ""}, {FCM_NOISE_MODIF_ADD, "ADD", 0, "Add", ""}, {FCM_NOISE_MODIF_SUBTRACT, "SUBTRACT", 0, "Subtract", ""}, @@ -1439,7 +1443,7 @@ static void rna_def_drivertarget(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_trans_chan_items[] = { + static const EnumPropertyItem prop_trans_chan_items[] = { {DTAR_TRANSCHAN_LOCX, "LOC_X", 0, "X Location", ""}, {DTAR_TRANSCHAN_LOCY, "LOC_Y", 0, "Y Location", ""}, {DTAR_TRANSCHAN_LOCZ, "LOC_Z", 0, "Z Location", ""}, @@ -1452,7 +1456,7 @@ static void rna_def_drivertarget(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_local_space_items[] = { + static const EnumPropertyItem prop_local_space_items[] = { {0, "WORLD_SPACE", 0, "World Space", "Transforms include effects of parenting/restpose and constraints"}, {DTAR_FLAG_LOCALSPACE, "TRANSFORM_SPACE", 0, "Transform Space", "Transforms don't include parenting/restpose or constraints"}, @@ -1517,7 +1521,7 @@ static void rna_def_drivervar(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {DVAR_TYPE_SINGLE_PROP, "SINGLE_PROP", ICON_RNA, "Single Property", "Use the value from some RNA property (Default)"}, {DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", ICON_MANIPUL, "Transform Channel", "Final transformation value of object or bone"}, @@ -1600,7 +1604,7 @@ static void rna_def_channeldriver(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {DRIVER_TYPE_AVERAGE, "AVERAGE", 0, "Averaged Value", ""}, {DRIVER_TYPE_SUM, "SUM", 0, "Sum Values", ""}, {DRIVER_TYPE_PYTHON, "SCRIPTED", 0, "Scripted Expression", ""}, @@ -1830,7 +1834,7 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem keyframe_flag_items[] = { + static const EnumPropertyItem keyframe_flag_items[] = { {INSERTKEY_REPLACE, "REPLACE", 0, "Replace", "Don't add any new keyframes, but just replace existing ones"}, {INSERTKEY_NEEDED, "NEEDED", 0, "Needed", "Only adds keyframes that are needed"}, {INSERTKEY_FAST, "FAST", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time"}, @@ -1877,12 +1881,12 @@ static void rna_def_fcurve(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem prop_mode_extend_items[] = { + static const EnumPropertyItem prop_mode_extend_items[] = { {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant", "Hold values of endpoint keyframes"}, {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear", "Use slope of curve leading in/out of endpoint keyframes"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_mode_color_items[] = { + static const EnumPropertyItem prop_mode_color_items[] = { {FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", 0, "Auto Rainbow", "Cycle through the rainbow, trying to give each curve a unique color"}, {FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", 0, "Auto XYZ to RGB", diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index de2076868ec..074db855c17 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -215,7 +215,7 @@ static void rna_def_fluidsim_slip(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem slip_items[] = { + static const EnumPropertyItem slip_items[] = { {OB_FSBND_NOSLIP, "NOSLIP", 0, "No Slip", "Obstacle causes zero normal and tangential velocity (=sticky), default for all " "(only option for moving objects)"}, @@ -261,7 +261,7 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem quality_items[] = { + static const EnumPropertyItem quality_items[] = { {OB_FSDOM_GEOM, "GEOMETRY", 0, "Geometry", "Display geometry"}, {OB_FSDOM_PREVIEW, "PREVIEW", 0, "Preview", "Display preview quality results"}, {OB_FSDOM_FINAL, "FINAL", 0, "Final", "Display final quality results"}, @@ -445,7 +445,7 @@ static void rna_def_fluidsim_volume(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem volume_type_items[] = { + static const EnumPropertyItem volume_type_items[] = { {1, "VOLUME", 0, "Volume", "Use only the inner volume of the mesh"}, {2, "SHELL", 0, "Shell", "Use only the outer shell of the mesh"}, {3, "BOTH", 0, "Both", "Use both the inner volume and the outer shell of the mesh"}, @@ -668,7 +668,7 @@ void RNA_def_fluidsim(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_fluid_type_items[] = { + static const EnumPropertyItem prop_fluid_type_items[] = { {OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""}, {OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain", "Bounding box of this object represents the computational domain of the " diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 79e1e95b27a..a2733b91427 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -46,7 +46,7 @@ #include "ED_gpencil.h" /* parent type */ -static EnumPropertyItem parent_type_items[] = { +static const EnumPropertyItem parent_type_items[] = { {PAROBJECT, "OBJECT", 0, "Object", "The layer is parented to an object"}, {PARSKEL, "ARMATURE", 0, "Armature", ""}, {PARBONE, "BONE", 0, "Bone", "The layer is parented to a bone"}, @@ -249,7 +249,7 @@ static void rna_GPencilLayer_parent_bone_set(PointerRNA *ptr, const char *value) /* parent types enum */ -static EnumPropertyItem *rna_Object_parent_type_itemf( +static const EnumPropertyItem *rna_Object_parent_type_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { @@ -981,7 +981,7 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem stroke_draw_mode_items[] = { + static const EnumPropertyItem stroke_draw_mode_items[] = { {0, "SCREEN", 0, "Screen", "Stroke is in screen-space"}, {GP_STROKE_3DSPACE, "3DSPACE", 0, "3D Space", "Stroke is in 3D-space"}, {GP_STROKE_2DSPACE, "2DSPACE", 0, "2D Space", "Stroke is in 2D-space"}, diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index b51a4258a2d..09ea2efcd85 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -45,14 +45,14 @@ #include "WM_types.h" #include "WM_api.h" -EnumPropertyItem rna_enum_image_generated_type_items[] = { +const EnumPropertyItem rna_enum_image_generated_type_items[] = { {IMA_GENTYPE_BLANK, "BLANK", 0, "Blank", "Generate a blank image"}, {IMA_GENTYPE_GRID, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"}, {IMA_GENTYPE_GRID_COLOR, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem image_source_items[] = { +static const EnumPropertyItem image_source_items[] = { {IMA_SRC_FILE, "FILE", 0, "Single Image", "Single image file"}, {IMA_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"}, {IMA_SRC_MOVIE, "MOVIE", 0, "Movie", "Movie file"}, @@ -201,7 +201,7 @@ static char *rna_ImageUser_path(PointerRNA *ptr) return BLI_strdup(""); } -static EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { Image *ima = (Image *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index cc6443e2154..bf34d42116e 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -79,8 +79,9 @@ typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr); typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value); typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr); typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value); -typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr, - struct PropertyRNA *prop, bool *r_free); +typedef const EnumPropertyItem *(*PropEnumItemFunc)( + struct bContext *C, struct PointerRNA *ptr, + struct PropertyRNA *prop, bool *r_free); typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr); typedef StructRNA *(*PropPointerTypeFunc)(struct PointerRNA *ptr); typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value); @@ -307,7 +308,7 @@ typedef struct EnumPropertyRNA { PropEnumSetFuncEx set_ex; void *py_data; /* store py callback here */ - EnumPropertyItem *item; + const EnumPropertyItem *item; int totitem; int defaultvalue; diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index f28c02bf20d..a47a5c604b4 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -592,7 +592,7 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr) #else -EnumPropertyItem rna_enum_keyblock_type_items[] = { +const EnumPropertyItem rna_enum_keyblock_type_items[] = { {KEY_LINEAR, "KEY_LINEAR", 0, "Linear", ""}, {KEY_CARDINAL, "KEY_CARDINAL", 0, "Cardinal", ""}, {KEY_CATMULL_ROM, "KEY_CATMULL_ROM", 0, "Catmull-Rom", ""}, diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index e40183e40b5..9e28e31057d 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -167,7 +167,7 @@ static void rna_Lamp_use_nodes_update(bContext *C, PointerRNA *ptr) #else /* Don't define icons here, so they don't show up in the Lamp UI (properties Editor) - DingTo */ -EnumPropertyItem rna_enum_lamp_type_items[] = { +const EnumPropertyItem rna_enum_lamp_type_items[] = { {LA_LOCAL, "POINT", 0, "Point", "Omnidirectional point light source"}, {LA_SUN, "SUN", 0, "Sun", "Constant direction parallel ray light source"}, {LA_SPOT, "SPOT", 0, "Spot", "Directional cone light source"}, @@ -181,7 +181,7 @@ static void rna_def_lamp_mtex(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_texture_coordinates_items[] = { + static const EnumPropertyItem prop_texture_coordinates_items[] = { {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"}, {TEXCO_VIEW, "VIEW", 0, "View", "Use view coordinates for the texture coordinates"}, {TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"}, @@ -231,7 +231,7 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_skycolorspace_items[] = { + static const EnumPropertyItem prop_skycolorspace_items[] = { {0, "SMPTE", 0, "SMPTE", ""}, {1, "REC709", 0, "REC709", ""}, {2, "CIE", 0, "CIE", ""}, @@ -417,7 +417,7 @@ static void rna_def_lamp_falloff(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem prop_fallofftype_items[] = { + static const EnumPropertyItem prop_fallofftype_items[] = { {LA_FALLOFF_CONSTANT, "CONSTANT", 0, "Constant", ""}, {LA_FALLOFF_INVLINEAR, "INVERSE_LINEAR", 0, "Inverse Linear", ""}, {LA_FALLOFF_INVSQUARE, "INVERSE_SQUARE", 0, "Inverse Square", ""}, @@ -480,33 +480,33 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area, int sun) { PropertyRNA *prop; - static EnumPropertyItem prop_shadow_items[] = { + static const EnumPropertyItem prop_shadow_items[] = { {0, "NOSHADOW", 0, "No Shadow", ""}, {LA_SHAD_RAY, "RAY_SHADOW", 0, "Ray Shadow", "Use ray tracing for shadow"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_spot_shadow_items[] = { + static const EnumPropertyItem prop_spot_shadow_items[] = { {0, "NOSHADOW", 0, "No Shadow", ""}, {LA_SHAD_BUF, "BUFFER_SHADOW", 0, "Buffer Shadow", "Let spotlight produce shadows using shadow buffer"}, {LA_SHAD_RAY, "RAY_SHADOW", 0, "Ray Shadow", "Use ray tracing for shadow"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_ray_sampling_method_items[] = { + static const EnumPropertyItem prop_ray_sampling_method_items[] = { {LA_SAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", ""}, {LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_spot_ray_sampling_method_items[] = { + static const EnumPropertyItem prop_spot_ray_sampling_method_items[] = { {LA_SAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", ""}, {LA_SAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", ""}, {LA_SAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_shadbuftype_items[] = { + static const EnumPropertyItem prop_shadbuftype_items[] = { {LA_SHADBUF_REGULAR, "REGULAR", 0, "Classical", "Classic shadow buffer"}, {LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway", "Regular buffer, averaging the closest and 2nd closest Z value to reducing " @@ -519,14 +519,14 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area, int sun) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_shadbuffiltertype_items[] = { + static const EnumPropertyItem prop_shadbuffiltertype_items[] = { {LA_SHADBUF_BOX, "BOX", 0, "Box", "Apply the Box filter to shadow buffer samples"}, {LA_SHADBUF_TENT, "TENT", 0, "Tent", "Apply the Tent Filter to shadow buffer samples"}, {LA_SHADBUF_GAUSS, "GAUSS", 0, "Gauss", "Apply the Gauss filter to shadow buffer samples"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_numbuffer_items[] = { + static const EnumPropertyItem prop_numbuffer_items[] = { {1, "BUFFERS_1", 0, "1", "Only one buffer rendered"}, {4, "BUFFERS_4", 0, "4", "Render 4 buffers for better AA, this quadruples memory usage"}, {9, "BUFFERS_9", 0, "9", "Render 9 buffers for better AA, this uses nine times more memory"}, @@ -534,7 +534,7 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area, int sun) }; /* GE only */ - static EnumPropertyItem prop_ge_shadowbuffer_type_items[] = { + static const EnumPropertyItem prop_ge_shadowbuffer_type_items[] = { {LA_SHADMAP_SIMPLE, "SIMPLE", 0, "Simple", "Simple shadow maps"}, {LA_SHADMAP_VARIANCE, "VARIANCE", 0, "Variance", "Variance shadow maps"}, {0, NULL, 0, NULL, NULL} @@ -779,7 +779,7 @@ static void rna_def_area_lamp(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_areashape_items[] = { + static const EnumPropertyItem prop_areashape_items[] = { {LA_AREA_SQUARE, "SQUARE", 0, "Square", ""}, {LA_AREA_RECT, "RECTANGLE", 0, "Rectangle", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index 13d655f81bf..e138d0d98d8 100644 --- a/source/blender/makesrna/intern/rna_linestyle.c +++ b/source/blender/makesrna/intern/rna_linestyle.c @@ -42,7 +42,7 @@ #include "WM_types.h" #include "WM_api.h" -EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[] = { +const EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[] = { {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""}, {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""}, {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""}, @@ -54,7 +54,7 @@ EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[] = { +const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[] = { {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""}, {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""}, {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""}, @@ -66,7 +66,7 @@ EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[] = { +const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[] = { {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""}, {LS_MODIFIER_CALLIGRAPHY, "CALLIGRAPHY", ICON_MODIFIER, "Calligraphy", ""}, {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""}, @@ -79,7 +79,7 @@ EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[] = { +const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[] = { {LS_MODIFIER_2D_OFFSET, "2D_OFFSET", ICON_MODIFIER, "2D Offset", ""}, {LS_MODIFIER_2D_TRANSFORM, "2D_TRANSFORM", ICON_MODIFIER, "2D Transform", ""}, {LS_MODIFIER_BACKBONE_STRETCHER, "BACKBONE_STRETCHER", ICON_MODIFIER, "Backbone Stretcher", ""}, @@ -475,7 +475,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem texco_items[] = { + static const EnumPropertyItem texco_items[] = { {TEXCO_WINDOW, "WINDOW", 0, "Window", "Use screen coordinates as texture coordinates"}, {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"}, {TEXCO_STROKE, "ALONG_STROKE", 0, "Along stroke", "Use stroke length for texture coordinates"}, @@ -483,7 +483,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_mapping_items[] = { + static const EnumPropertyItem prop_mapping_items[] = { {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"}, {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"}, {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"}, @@ -491,7 +491,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_x_mapping_items[] = { + static const EnumPropertyItem prop_x_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -499,7 +499,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_y_mapping_items[] = { + static const EnumPropertyItem prop_y_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -507,7 +507,7 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_z_mapping_items[] = { + static const EnumPropertyItem prop_z_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -579,13 +579,13 @@ static void rna_def_linestyle_mtex(BlenderRNA *brna) } static void rna_def_modifier_type_common( - StructRNA *srna, EnumPropertyItem *modifier_type_items, + StructRNA *srna, const EnumPropertyItem *modifier_type_items, const char *set_name_func, const bool blend, const bool color) { PropertyRNA *prop; /* TODO: Check this is not already defined somewhere else, e.g. in nodes... */ - static EnumPropertyItem value_blend_items[] = { + static const EnumPropertyItem value_blend_items[] = { {LS_VALUE_BLEND, "MIX", 0, "Mix", ""}, {LS_VALUE_ADD, "ADD", 0, "Add", ""}, {LS_VALUE_SUB, "SUBTRACT", 0, "Subtract", ""}, @@ -685,7 +685,7 @@ static void rna_def_modifier_curve_common(StructRNA *srna, bool range, bool valu { PropertyRNA *prop; - static EnumPropertyItem mapping_items[] = { + static const EnumPropertyItem mapping_items[] = { {0, "LINEAR", 0, "Linear", "Use linear mapping"}, {LS_MODIFIER_USE_CURVE, "CURVE", 0, "Curve", "Use curve mapping"}, {0, NULL, 0, NULL, NULL} @@ -737,7 +737,7 @@ static void rna_def_modifier_material_common(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem mat_attr_items[] = { + static const EnumPropertyItem mat_attr_items[] = { {LS_MODIFIER_MATERIAL_LINE, "LINE", 0, "Line Color", ""}, {LS_MODIFIER_MATERIAL_LINE_R, "LINE_R", 0, "Line Color Red", ""}, {LS_MODIFIER_MATERIAL_LINE_G, "LINE_G", 0, "Line Color Green", ""}, @@ -769,14 +769,14 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem blueprint_shape_items[] = { + static const EnumPropertyItem blueprint_shape_items[] = { {LS_MODIFIER_BLUEPRINT_CIRCLES, "CIRCLES", 0, "Circles", "Draw a blueprint using circular contour strokes"}, {LS_MODIFIER_BLUEPRINT_ELLIPSES, "ELLIPSES", 0, "Ellipses", "Draw a blueprint using elliptic contour strokes"}, {LS_MODIFIER_BLUEPRINT_SQUARES, "SQUARES", 0, "Squares", "Draw a blueprint using square contour strokes"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem transform_pivot_items[] = { + static const EnumPropertyItem transform_pivot_items[] = { {LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER, "CENTER", 0, "Stroke Center", ""}, {LS_MODIFIER_2D_TRANSFORM_PIVOT_START, "START", 0, "Stroke Start", ""}, {LS_MODIFIER_2D_TRANSFORM_PIVOT_END, "END", 0, "Stroke End", ""}, @@ -1559,7 +1559,7 @@ static void rna_def_linestyle(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem panel_items[] = { + static const EnumPropertyItem panel_items[] = { {LS_PANEL_STROKES, "STROKES", 0, "Strokes", "Show the panel for stroke construction"}, {LS_PANEL_COLOR, "COLOR", 0, "Color", "Show the panel for line color options"}, {LS_PANEL_ALPHA, "ALPHA", 0, "Alpha", "Show the panel for alpha transparency options"}, @@ -1571,37 +1571,37 @@ static void rna_def_linestyle(BlenderRNA *brna) #endif {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem chaining_items[] = { + static const EnumPropertyItem chaining_items[] = { {LS_CHAINING_PLAIN, "PLAIN", 0, "Plain", "Plain chaining"}, {LS_CHAINING_SKETCHY, "SKETCHY", 0, "Sketchy", "Sketchy chaining with a multiple touch"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem cap_items[] = { + static const EnumPropertyItem cap_items[] = { {LS_CAPS_BUTT, "BUTT", 0, "Butt", "Butt cap (flat)"}, {LS_CAPS_ROUND, "ROUND", 0, "Round", "Round cap (half-circle)"}, {LS_CAPS_SQUARE, "SQUARE", 0, "Square", "Square cap (flat and extended)"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem thickness_position_items[] = { + static const EnumPropertyItem thickness_position_items[] = { {LS_THICKNESS_CENTER, "CENTER", 0, "Center", "Silhouettes and border edges are centered along stroke geometry"}, {LS_THICKNESS_INSIDE, "INSIDE", 0, "Inside", "Silhouettes and border edges are drawn inside of stroke geometry"}, {LS_THICKNESS_OUTSIDE, "OUTSIDE", 0, "Outside", "Silhouettes and border edges are drawn outside of stroke geometry"}, {LS_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", "Silhouettes and border edges are shifted by a user-defined ratio"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem sort_key_items[] = { + static const EnumPropertyItem sort_key_items[] = { {LS_SORT_KEY_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", 0, "Distance from Camera", "Sort by distance from camera (closer lines lie on top of further lines)"}, {LS_SORT_KEY_2D_LENGTH, "2D_LENGTH", 0, "2D Length", "Sort by curvilinear 2D length (longer lines lie on top of shorter lines)"}, {LS_SORT_KEY_PROJECTED_X, "PROJECTED_X", 0, "Projected X", "Sort by the projected X value in the image coordinate system"}, {LS_SORT_KEY_PROJECTED_Y, "PROJECTED_Y", 0, "Projected Y", "Sort by the projected Y value in the image coordinate system"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem sort_order_items[] = { + static const EnumPropertyItem sort_order_items[] = { {0, "DEFAULT", 0, "Default", "Default order of the sort key"}, {LS_REVERSE_ORDER, "REVERSE", 0, "Reverse", "Reverse order"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem integration_type_items[] = { + static const EnumPropertyItem integration_type_items[] = { {LS_INTEGRATION_MEAN, "MEAN", 0, "Mean", "The value computed for the chain is the mean of the values obtained for chain vertices"}, {LS_INTEGRATION_MIN, "MIN", 0, "Min", "The value computed for the chain is the minimum of the values obtained for chain vertices"}, {LS_INTEGRATION_MAX, "MAX", 0, "Max", "The value computed for the chain is the maximum of the values obtained for chain vertices"}, diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index c8c1c7be280..3f1e9ae7f7d 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -266,7 +266,7 @@ static Material *rna_Main_materials_new(Main *bmain, const char *name) return (Material *)id; } -static EnumPropertyItem *rna_Main_nodetree_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_Main_nodetree_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { return rna_node_tree_type_itemf(NULL, NULL, r_free); } @@ -830,7 +830,7 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop) PropertyRNA *parm; PropertyRNA *prop; - static EnumPropertyItem dummy_items[] = { + static const EnumPropertyItem dummy_items[] = { {0, "DUMMY", 0, "", ""}, {0, NULL, 0, NULL, NULL} }; @@ -878,7 +878,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) PropertyRNA *parm; PropertyRNA *prop; - static EnumPropertyItem mesh_type_items[] = { + static const EnumPropertyItem mesh_type_items[] = { {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index 12f8a584c2c..1c7e6fb9587 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -594,11 +594,11 @@ static void rna_def_maskParent(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem mask_id_type_items[] = { + static const EnumPropertyItem mask_id_type_items[] = { {ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem parent_type_items[] = { + static const EnumPropertyItem parent_type_items[] = { {MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""}, {MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""}, {0, NULL, 0, NULL, NULL}}; @@ -678,7 +678,7 @@ static void rna_def_maskSplinePoint(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem handle_type_items[] = { + static const EnumPropertyItem handle_type_items[] = { {HD_AUTO, "AUTO", 0, "Auto", ""}, {HD_VECT, "VECTOR", 0, "Vector", ""}, {HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""}, @@ -825,13 +825,13 @@ static void rna_def_maskSplinePoints(BlenderRNA *brna) static void rna_def_maskSpline(BlenderRNA *brna) { - static EnumPropertyItem spline_interpolation_items[] = { + static const EnumPropertyItem spline_interpolation_items[] = { {MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""}, {MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem spline_offset_mode_items[] = { + static const EnumPropertyItem spline_offset_mode_items[] = { {MASK_SPLINE_OFFSET_EVEN, "EVEN", 0, "Even", "Calculate even feather offset"}, {MASK_SPLINE_OFFSET_SMOOTH, "SMOOTH", 0, "Smooth", "Calculate feather offset as a second curve"}, {0, NULL, 0, NULL, NULL} @@ -889,7 +889,7 @@ static void rna_def_maskSpline(BlenderRNA *brna) static void rna_def_mask_layer(BlenderRNA *brna) { - static EnumPropertyItem masklay_blend_mode_items[] = { + static const EnumPropertyItem masklay_blend_mode_items[] = { {MASK_BLEND_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""}, {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""}, {MASK_BLEND_ADD, "ADD", 0, "Add", ""}, diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index c31b70c57ed..e62832a8b76 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -38,7 +38,7 @@ #include "WM_api.h" #include "WM_types.h" -static EnumPropertyItem prop_texture_coordinates_items[] = { +static const EnumPropertyItem prop_texture_coordinates_items[] = { {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"}, {TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"}, {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"}, @@ -54,7 +54,7 @@ static EnumPropertyItem prop_texture_coordinates_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_ramp_blend_items[] = { +const EnumPropertyItem rna_enum_ramp_blend_items[] = { {MA_RAMP_BLEND, "MIX", 0, "Mix", ""}, {MA_RAMP_ADD, "ADD", 0, "Add", ""}, {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""}, @@ -346,7 +346,7 @@ static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr) rna_Material_draw_update(CTX_data_main(C), CTX_data_scene(C), ptr); } -static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { Material *ma = (Material *)ptr->id.data; @@ -442,7 +442,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_mapping_items[] = { + static const EnumPropertyItem prop_mapping_items[] = { {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"}, {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"}, {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"}, @@ -450,7 +450,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_x_mapping_items[] = { + static const EnumPropertyItem prop_x_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -458,7 +458,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_y_mapping_items[] = { + static const EnumPropertyItem prop_y_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -466,7 +466,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_z_mapping_items[] = { + static const EnumPropertyItem prop_z_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -474,7 +474,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_normal_map_space_items[] = { + static const EnumPropertyItem prop_normal_map_space_items[] = { {MTEX_NSPACE_CAMERA, "CAMERA", 0, "Camera", ""}, {MTEX_NSPACE_WORLD, "WORLD", 0, "World", ""}, {MTEX_NSPACE_OBJECT, "OBJECT", 0, "Object", ""}, @@ -482,7 +482,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_bump_method_items[] = { + static const EnumPropertyItem prop_bump_method_items[] = { {0, "BUMP_ORIGINAL", 0, "Original", ""}, {MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""}, {MTEX_3TAP_BUMP, "BUMP_LOW_QUALITY", 0, "Low Quality", "Use 3 tap filtering"}, @@ -493,7 +493,7 @@ static void rna_def_material_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_bump_space_items[] = { + static const EnumPropertyItem prop_bump_space_items[] = { {0, "BUMP_VIEWSPACE", 0, "ViewSpace", ""}, {MTEX_BUMP_OBJECTSPACE, "BUMP_OBJECTSPACE", 0, "ObjectSpace", ""}, {MTEX_BUMP_TEXTURESPACE, "BUMP_TEXTURESPACE", 0, "TextureSpace", ""}, @@ -830,7 +830,7 @@ static void rna_def_material_gamesettings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_alpha_blend_items[] = { + static const EnumPropertyItem prop_alpha_blend_items[] = { {GEMAT_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"}, {GEMAT_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"}, {GEMAT_CLIP, "CLIP", 0, "Alpha Clip", "Use the image alpha values clipped with no blending (binary alpha)"}, @@ -843,7 +843,7 @@ static void rna_def_material_gamesettings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_face_orientation_items[] = { + static const EnumPropertyItem prop_face_orientation_items[] = { {GEMAT_NORMAL, "NORMAL", 0, "Normal", "No transformation"}, {GEMAT_HALO, "HALO", 0, "Halo", "Screen aligned billboard"}, {GEMAT_BILLBOARD, "BILLBOARD", 0, "Billboard", "Billboard with Z-axis constraint"}, @@ -890,7 +890,7 @@ static void rna_def_material_colors(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem prop_ramp_input_items[] = { + static const EnumPropertyItem prop_ramp_input_items[] = { {MA_RAMP_IN_SHADER, "SHADER", 0, "Shader", ""}, {MA_RAMP_IN_ENERGY, "ENERGY", 0, "Energy", ""}, {MA_RAMP_IN_NOR, "NORMAL", 0, "Normal", ""}, @@ -1007,7 +1007,7 @@ static void rna_def_material_diffuse(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem prop_diff_shader_items[] = { + static const EnumPropertyItem prop_diff_shader_items[] = { {MA_DIFF_LAMBERT, "LAMBERT", 0, "Lambert", "Use a Lambertian shader"}, {MA_DIFF_ORENNAYAR, "OREN_NAYAR", 0, "Oren-Nayar", "Use an Oren-Nayar shader"}, {MA_DIFF_TOON, "TOON", 0, "Toon", "Use a toon shader"}, @@ -1068,7 +1068,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_fadeto_mir_items[] = { + static const EnumPropertyItem prop_fadeto_mir_items[] = { {MA_RAYMIR_FADETOSKY, "FADE_TO_SKY", 0, "Sky", ""}, {MA_RAYMIR_FADETOMAT, "FADE_TO_MATERIAL", 0, "Material", ""}, {0, NULL, 0, NULL, NULL} @@ -1238,7 +1238,7 @@ static void rna_def_material_volume(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_lighting_items[] = { + static const EnumPropertyItem prop_lighting_items[] = { {MA_VOL_SHADE_SHADELESS, "SHADELESS", 0, "Shadeless", "Do not calculate lighting and shadows"}, {MA_VOL_SHADE_SHADOWED, "SHADOWED", 0, "Shadowed", ""}, {MA_VOL_SHADE_SHADED, "SHADED", 0, "Shaded", ""}, @@ -1247,7 +1247,7 @@ static void rna_def_material_volume(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_stepsize_items[] = { + static const EnumPropertyItem prop_stepsize_items[] = { {MA_VOL_STEP_RANDOMIZED, "RANDOMIZED", 0, "Randomized", ""}, {MA_VOL_STEP_CONSTANT, "CONSTANT", 0, "Constant", ""}, /*{MA_VOL_STEP_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", ""}, */ @@ -1595,7 +1595,7 @@ static void rna_def_material_specularity(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem prop_specular_shader_items[] = { + static const EnumPropertyItem prop_specular_shader_items[] = { {MA_SPEC_COOKTORR, "COOKTORR", 0, "CookTorr", "Use a Cook-Torrance shader"}, {MA_SPEC_PHONG, "PHONG", 0, "Phong", "Use a Phong shader"}, {MA_SPEC_BLINN, "BLINN", 0, "Blinn", "Use a Blinn shader"}, @@ -1772,14 +1772,14 @@ void RNA_def_material(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {MA_TYPE_SURFACE, "SURFACE", 0, "Surface", "Render object as a surface"}, {MA_TYPE_WIRE, "WIRE", 0, "Wire", "Render the edges of faces as wires (not supported in raytracing)"}, {MA_TYPE_VOLUME, "VOLUME", 0, "Volume", "Render object as a volume"}, {MA_TYPE_HALO, "HALO", 0, "Halo", "Render object as halo particles"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem transparency_items[] = { + static const EnumPropertyItem transparency_items[] = { {0, "MASK", 0, "Mask", "Mask the background"}, {MA_ZTRANSP, "Z_TRANSPARENCY", 0, "Z Transparency", "Use alpha buffer for transparent faces"}, {MA_RAYTRANSP, "RAYTRACE", 0, "Raytrace", "Use raytracing for transparent refraction rendering"}, @@ -1787,7 +1787,7 @@ void RNA_def_material(BlenderRNA *brna) }; /* Render Preview Types */ - static EnumPropertyItem preview_type_items[] = { + static const EnumPropertyItem preview_type_items[] = { {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"}, {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"}, {MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"}, @@ -1797,7 +1797,7 @@ void RNA_def_material(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_shadows_only_items[] = { + static const EnumPropertyItem prop_shadows_only_items[] = { {MA_SO_OLD, "SHADOW_ONLY_OLD", 0, "Shadow and Distance", "Old shadow only method"}, {MA_SO_SHADOW, "SHADOW_ONLY", 0, "Shadow Only", "Improved shadow only method"}, {MA_SO_SHADED, "SHADOW_ONLY_SHADED", 0, "Shadow and Shading", diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index beb5430b63b..bc24b76c137 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -52,7 +52,7 @@ #include "WM_types.h" -EnumPropertyItem rna_enum_mesh_delimit_mode_items[] = { +const EnumPropertyItem rna_enum_mesh_delimit_mode_items[] = { {BMO_DELIM_NORMAL, "NORMAL", 0, "Normal", "Delimit by face directions"}, {BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"}, {BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"}, diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index 9c91bea7c45..8589d819360 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -296,7 +296,7 @@ static void rna_def_metaball(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_update_items[] = { + static const EnumPropertyItem prop_update_items[] = { {MB_UPDATE_ALWAYS, "UPDATE_ALWAYS", 0, "Always", "While editing, update metaball always"}, {MB_UPDATE_HALFRES, "HALFRES", 0, "Half", "While editing, update metaball in half resolution"}, {MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization"}, diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 0dc5ab5d6bf..d482f7e1b94 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -62,7 +62,7 @@ #include "WM_api.h" #include "WM_types.h" -EnumPropertyItem rna_enum_object_modifier_type_items[] = { +const EnumPropertyItem rna_enum_object_modifier_type_items[] = { {0, "", 0, N_("Modify"), ""}, {eModifierType_DataTransfer, "DATA_TRANSFER", ICON_MOD_DATA_TRANSFER, "Data Transfer", ""}, {eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""}, @@ -123,7 +123,7 @@ EnumPropertyItem rna_enum_object_modifier_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = { +const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = { {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY", 0, "Beauty ", "Split the quads in nice triangles, slower method"}, {MOD_TRIANGULATE_QUAD_FIXED, "FIXED", 0, "Fixed", "Split the quads on the first and third vertices"}, {MOD_TRIANGULATE_QUAD_ALTERNATE, "FIXED_ALTERNATE", 0, "Fixed Alternate", @@ -133,7 +133,7 @@ EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[] = { +const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[] = { {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY", 0, "Beauty", "Arrange the new triangles evenly (slow)"}, {MOD_TRIANGULATE_NGON_EARCLIP, "CLIP", 0, "Clip", "Split the polygons with an ear clipping algorithm"}, {0, NULL, 0, NULL, NULL} @@ -141,7 +141,7 @@ EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[] = { #ifndef RNA_RUNTIME /* use eWarp_Falloff_*** & eHook_Falloff_***, they're in sync */ -static EnumPropertyItem modifier_warp_falloff_items[] = { +static const EnumPropertyItem modifier_warp_falloff_items[] = { {eWarp_Falloff_None, "NONE", 0, "No Falloff", ""}, {eWarp_Falloff_Curve, "CURVE", 0, "Curve", ""}, {eWarp_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""}, @@ -157,7 +157,7 @@ static EnumPropertyItem modifier_warp_falloff_items[] = { /* ***** Data Transfer ***** */ -EnumPropertyItem rna_enum_dt_method_vertex_items[] = { +const EnumPropertyItem rna_enum_dt_method_vertex_items[] = { {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"}, {MREMAP_MODE_VERT_NEAREST, "NEAREST", 0, "Nearest vertex", @@ -175,7 +175,7 @@ EnumPropertyItem rna_enum_dt_method_vertex_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_dt_method_edge_items[] = { +const EnumPropertyItem rna_enum_dt_method_edge_items[] = { {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"}, {MREMAP_MODE_EDGE_VERT_NEAREST, "VERT_NEAREST", 0, "Nearest Vertices", @@ -189,7 +189,7 @@ EnumPropertyItem rna_enum_dt_method_edge_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_dt_method_loop_items[] = { +const EnumPropertyItem rna_enum_dt_method_loop_items[] = { {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"}, {MREMAP_MODE_LOOP_NEAREST_LOOPNOR, "NEAREST_NORMAL", 0, "Nearest Corner And Best Matching Normal", @@ -205,7 +205,7 @@ EnumPropertyItem rna_enum_dt_method_loop_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_dt_method_poly_items[] = { +const EnumPropertyItem rna_enum_dt_method_poly_items[] = { {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"}, {MREMAP_MODE_POLY_NEAREST, "NEAREST", 0, "Nearest Face", @@ -217,7 +217,7 @@ EnumPropertyItem rna_enum_dt_method_poly_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_dt_mix_mode_items[] = { +const EnumPropertyItem rna_enum_dt_mix_mode_items[] = { {CDT_MIX_TRANSFER, "REPLACE", 0, "Replace", "Overwrite all elements' data"}, {CDT_MIX_REPLACE_ABOVE_THRESHOLD, "ABOVE_THRESHOLD", 0, "Above Threshold", @@ -236,7 +236,7 @@ EnumPropertyItem rna_enum_dt_mix_mode_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_dt_layers_select_src_items[] = { +const EnumPropertyItem rna_enum_dt_layers_select_src_items[] = { {DT_LAYERS_ACTIVE_SRC, "ACTIVE", 0, "Active Layer", "Only transfer active data layer"}, {DT_LAYERS_ALL_SRC, "ALL", 0, "All Layers", @@ -248,7 +248,7 @@ EnumPropertyItem rna_enum_dt_layers_select_src_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = { +const EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = { {DT_LAYERS_ACTIVE_DST, "ACTIVE", 0, "Active Layer", "Affect active data layer of all targets"}, {DT_LAYERS_NAME_DST, "NAME", 0, "By Name", @@ -258,20 +258,20 @@ EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_axis_xy_items[] = { +const EnumPropertyItem rna_enum_axis_xy_items[] = { {0, "X", 0, "X", ""}, {1, "Y", 0, "Y", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_axis_xyz_items[] = { +const EnumPropertyItem rna_enum_axis_xyz_items[] = { {0, "X", 0, "X", ""}, {1, "Y", 0, "Y", ""}, {2, "Z", 0, "Z", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_axis_flag_xyz_items[] = { +const EnumPropertyItem rna_enum_axis_flag_xyz_items[] = { {(1 << 0), "X", 0, "X", ""}, {(1 << 1), "Y", 0, "Y", ""}, {(1 << 2), "Z", 0, "Z", ""}, @@ -891,7 +891,7 @@ static void rna_DataTransferModifier_polys_data_types_set(struct PointerRNA *ptr dtmd->data_types |= value; } -static EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) +static const EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) { DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data; EnumPropertyItem *item = NULL, tmp_item = {0}; @@ -983,7 +983,7 @@ static EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bConte return item; } -static EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) +static const EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) { DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data; EnumPropertyItem *item = NULL, tmp_item = {0}; @@ -1075,7 +1075,7 @@ static EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf(bConte return item; } -static EnumPropertyItem *rna_DataTransferModifier_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_DataTransferModifier_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data; EnumPropertyItem *item = NULL; @@ -1161,7 +1161,7 @@ static void rna_MeshSequenceCache_object_path_update(Main *bmain, Scene *scene, static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[]) { - static EnumPropertyItem prop_subdivision_type_items[] = { + static const EnumPropertyItem prop_subdivision_type_items[] = { {0, "CATMULL_CLARK", 0, "Catmull-Clark", ""}, {1, "SIMPLE", 0, "Simple", ""}, {0, NULL, 0, NULL, NULL} @@ -1222,7 +1222,7 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) static void rna_def_modifier_generic_map_info(StructRNA *srna) { - static EnumPropertyItem prop_texture_coordinates_items[] = { + static const EnumPropertyItem prop_texture_coordinates_items[] = { {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"}, {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"}, {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", @@ -1405,7 +1405,7 @@ static void rna_def_modifier_curve(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_deform_axis_items[] = { + static const EnumPropertyItem prop_deform_axis_items[] = { {MOD_CURVE_POSX, "POS_X", 0, "X", ""}, {MOD_CURVE_POSY, "POS_Y", 0, "Y", ""}, {MOD_CURVE_POSZ, "POS_Z", 0, "Z", ""}, @@ -1572,7 +1572,7 @@ static void rna_def_modifier_mirror(BlenderRNA *brna) static void rna_def_modifier_decimate(BlenderRNA *brna) { - static EnumPropertyItem modifier_decim_mode_items[] = { + static const EnumPropertyItem modifier_decim_mode_items[] = { {MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"}, {MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"}, {MOD_DECIM_MODE_DISSOLVE, "DISSOLVE", 0, "Planar", "Dissolve geometry to form planar polygons"}, @@ -1952,7 +1952,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_operation_items[] = { + static const EnumPropertyItem prop_operation_items[] = { {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect", "Keep the part of the mesh that intersects with the other selected object"}, {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"}, @@ -1960,7 +1960,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_solver_items[] = { + static const EnumPropertyItem prop_solver_items[] = { {eBooleanModifierSolver_BMesh, "BMESH", 0, "BMesh", "Use the BMesh boolean solver"}, {eBooleanModifierSolver_Carve, "CARVE", 0, "Carve", "Use the Carve boolean solver"}, {0, NULL, 0, NULL, NULL} @@ -1997,7 +1997,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna) /* BMesh debugging options, only used when G_DEBUG is set */ /* BMesh intersection options */ - static EnumPropertyItem debug_items[] = { + static const EnumPropertyItem debug_items[] = { {eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""}, {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "No Dissolve", ""}, {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "No Connect Regions", ""}, @@ -2017,7 +2017,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_fit_type_items[] = { + static const EnumPropertyItem prop_fit_type_items[] = { {MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"}, {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length", "Duplicate the object as many times as fits in a certain length"}, @@ -2158,7 +2158,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_direction_items[] = { + static const EnumPropertyItem prop_direction_items[] = { {MOD_DISP_DIR_X, "X", 0, "X", "Use the texture's intensity value to displace in the X direction"}, {MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"}, {MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"}, @@ -2171,7 +2171,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_space_items[] = { + static const EnumPropertyItem prop_space_items[] = { {MOD_DISP_SPACE_LOCAL, "LOCAL", 0, "Local", "Direction is defined in local coordinates"}, {MOD_DISP_SPACE_GLOBAL, "GLOBAL", 0, "Global", "Direction is defined in global coordinates"}, {0, NULL, 0, NULL, NULL} @@ -2344,7 +2344,7 @@ static void rna_def_modifier_correctivesmooth(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem modifier_smooth_type_items[] = { + static const EnumPropertyItem modifier_smooth_type_items[] = { {MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE, "SIMPLE", 0, "Simple", "Use the average of adjacent edge-vertices"}, {MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT, "LENGTH_WEIGHTED", 0, "Length Weight", @@ -2352,7 +2352,7 @@ static void rna_def_modifier_correctivesmooth(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem modifier_rest_source_items[] = { + static const EnumPropertyItem modifier_rest_source_items[] = { {MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO, "ORCO", 0, "Original Coords", "Use base mesh vert coords as the rest position"}, {MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND, "BIND", 0, "Bind Coords", @@ -2490,7 +2490,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_cast_type_items[] = { + static const EnumPropertyItem prop_cast_type_items[] = { {MOD_CAST_TYPE_SPHERE, "SPHERE", 0, "Sphere", ""}, {MOD_CAST_TYPE_CYLINDER, "CYLINDER", 0, "Cylinder", ""}, {MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""}, @@ -2573,7 +2573,7 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; #if 0 - static EnumPropertyItem prop_mode_items[] = { + static const EnumPropertyItem prop_mode_items[] = { {0, "VOLUME", 0, "Volume", "Bind to volume inside cage mesh"}, {1, "SURFACE", 0, "Surface", "Bind to surface of cage mesh"}, {0, NULL, 0, NULL, NULL} @@ -2828,7 +2828,7 @@ static void rna_def_modifier_smoke(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_smoke_type_items[] = { + static const EnumPropertyItem prop_smoke_type_items[] = { {0, "NONE", 0, "None", ""}, {MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""}, {MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"}, @@ -2909,7 +2909,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_limit_method_items[] = { + static const EnumPropertyItem prop_limit_method_items[] = { {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"}, {MOD_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"}, {MOD_BEVEL_WEIGHT, "WEIGHT", 0, "Weight", @@ -2919,7 +2919,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_val_type_items[] = { + static const EnumPropertyItem prop_val_type_items[] = { {MOD_BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"}, {MOD_BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"}, {MOD_BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"}, @@ -2928,7 +2928,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) }; /* TO BE DEPRECATED */ - static EnumPropertyItem prop_edge_weight_method_items[] = { + static const EnumPropertyItem prop_edge_weight_method_items[] = { {0, "AVERAGE", 0, "Average", ""}, {MOD_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""}, {MOD_BEVEL_EMAX, "LARGEST", 0, "Largest", ""}, @@ -3018,7 +3018,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem shrink_type_items[] = { + static const EnumPropertyItem shrink_type_items[] = { {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point", "Shrink the mesh to the nearest target surface"}, {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", @@ -3028,7 +3028,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem shrink_face_cull_items[] = { + static const EnumPropertyItem shrink_face_cull_items[] = { {0, "OFF", 0, "Off", "No culling"}, {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"}, {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"}, @@ -3155,7 +3155,7 @@ static void rna_def_modifier_mask(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem modifier_mask_mode_items[] = { + static const EnumPropertyItem modifier_mask_mode_items[] = { {MOD_MASK_MODE_VGROUP, "VERTEX_GROUP", 0, "Vertex Group", ""}, {MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""}, {0, NULL, 0, NULL, NULL} @@ -3195,7 +3195,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem simple_deform_mode_items[] = { + static const EnumPropertyItem simple_deform_mode_items[] = { {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"}, {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"}, {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"}, @@ -3557,7 +3557,7 @@ static void rna_def_modifier_uvwarp(BlenderRNA *brna) static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA *srna, const char *mask_vgroup_setter, const char *mask_uvlayer_setter) { - static EnumPropertyItem weightvg_mask_tex_map_items[] = { + static const EnumPropertyItem weightvg_mask_tex_map_items[] = { {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use local generated coordinates"}, {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use global coordinates"}, {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Use local generated coordinates of another object"}, @@ -3565,7 +3565,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA * {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem weightvg_mask_tex_used_items[] = { + static const EnumPropertyItem weightvg_mask_tex_used_items[] = { {MOD_WVG_MASK_TEX_USE_INT, "INT", 0, "Intensity", ""}, {MOD_WVG_MASK_TEX_USE_RED, "RED", 0, "Red", ""}, {MOD_WVG_MASK_TEX_USE_GREEN, "GREEN", 0, "Green", ""}, @@ -3623,7 +3623,7 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA * static void rna_def_modifier_weightvgedit(BlenderRNA *brna) { - static EnumPropertyItem weightvg_edit_falloff_type_items[] = { + static const EnumPropertyItem weightvg_edit_falloff_type_items[] = { {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"}, {MOD_WVG_MAPPING_CURVE, "CURVE", ICON_RNDCURVE, "Custom Curve", ""}, {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""}, @@ -3704,7 +3704,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) static void rna_def_modifier_weightvgmix(BlenderRNA *brna) { - static EnumPropertyItem weightvg_mix_modes_items[] = { + static const EnumPropertyItem weightvg_mix_modes_items[] = { {MOD_WVG_MIX_SET, "SET", 0, "Replace", "Replace VGroup A's weights by VGroup B's ones"}, {MOD_WVG_MIX_ADD, "ADD", 0, "Add", "Add VGroup B's weights to VGroup A's ones"}, {MOD_WVG_MIX_SUB, "SUB", 0, "Subtract", "Subtract VGroup B's weights from VGroup A's ones"}, @@ -3715,7 +3715,7 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem weightvg_mix_set_items[] = { + static const EnumPropertyItem weightvg_mix_set_items[] = { {MOD_WVG_SET_ALL, "ALL", 0, "All", "Affect all vertices (might add some to VGroup A)"}, {MOD_WVG_SET_A, "A", 0, "VGroup A", "Affect vertices in VGroup A"}, {MOD_WVG_SET_B, "B", 0, "VGroup B", "Affect vertices in VGroup B (might add some to VGroup A)"}, @@ -3778,7 +3778,7 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna) static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) { - static EnumPropertyItem weightvg_proximity_modes_items[] = { + static const EnumPropertyItem weightvg_proximity_modes_items[] = { {MOD_WVG_PROXIMITY_OBJECT, "OBJECT", 0, "Object", "Use distance between affected and target objects"}, {MOD_WVG_PROXIMITY_GEOMETRY, "GEOMETRY", 0, "Geometry", @@ -3787,14 +3787,14 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem proximity_geometry_items[] = { + static const EnumPropertyItem proximity_geometry_items[] = { {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", 0, "Vertex", "Compute distance to nearest vertex"}, {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", 0, "Edge", "Compute distance to nearest edge"}, {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", 0, "Face", "Compute distance to nearest face"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem weightvg_proximity_falloff_type_items[] = { + static const EnumPropertyItem weightvg_proximity_falloff_type_items[] = { {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"}, /* No curve mapping here! */ {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""}, @@ -3870,7 +3870,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) static void rna_def_modifier_remesh(BlenderRNA *brna) { - static EnumPropertyItem mode_items[] = { + static const EnumPropertyItem mode_items[] = { {MOD_REMESH_CENTROID, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"}, {MOD_REMESH_MASS_POINT, "SMOOTH", 0, "Smooth", "Output a smooth surface with no sharp-features detection"}, {MOD_REMESH_SHARP_FEATURES, "SHARP", 0, "Sharp", @@ -3937,7 +3937,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem geometry_items[] = { + static const EnumPropertyItem geometry_items[] = { {MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate", "Generate ocean surface geometry at the specified resolution"}, {MOD_OCEAN_GEOM_DISPLACE, "DISPLACE", 0, "Displace", "Displace existing geometry according to simulation"}, @@ -4174,13 +4174,13 @@ static void rna_def_modifier_triangulate(BlenderRNA *brna) static void rna_def_modifier_meshcache(BlenderRNA *brna) { - static EnumPropertyItem prop_format_type_items[] = { + static const EnumPropertyItem prop_format_type_items[] = { {MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""}, {MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_deform_mode_items[] = { + static const EnumPropertyItem prop_deform_mode_items[] = { {MOD_MESHCACHE_DEFORM_OVERWRITE, "OVERWRITE", 0, "Overwrite", "Replace vertex coords with cached values"}, {MOD_MESHCACHE_DEFORM_INTEGRATE, "INTEGRATE", 0, "Integrate", @@ -4188,7 +4188,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_interpolation_type_items[] = { + static const EnumPropertyItem prop_interpolation_type_items[] = { {MOD_MESHCACHE_INTERP_NONE, "NONE", 0, "None ", ""}, {MOD_MESHCACHE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""}, /* for cardinal we'd need to read 4x cache's */ @@ -4196,7 +4196,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_time_type_items[] = { + static const EnumPropertyItem prop_time_type_items[] = { /* use 'eval_frame' */ {MOD_MESHCACHE_TIME_FRAME, "FRAME", 0, "Frame", "Control playback using a frame-number " "(ignoring time FPS and start frame from the file)"}, @@ -4207,7 +4207,7 @@ static void rna_def_modifier_meshcache(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_time_play_items[] = { + static const EnumPropertyItem prop_time_play_items[] = { {MOD_MESHCACHE_PLAY_CFEA, "SCENE", 0, "Scene", "Use the time from the scene"}, {MOD_MESHCACHE_PLAY_EVAL, "CUSTOM", 0, "Custom", "Use the modifier's own time evaluation"}, {0, NULL, 0, NULL, NULL} @@ -4338,7 +4338,7 @@ static void rna_def_modifier_meshseqcache(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Object Path", "Path to the object in the Alembic archive used to lookup geometric data"); RNA_def_property_update(prop, 0, "rna_MeshSequenceCache_object_path_update"); - static EnumPropertyItem read_flag_items[] = { + static const EnumPropertyItem read_flag_items[] = { {MOD_MESHSEQ_READ_VERT, "VERT", 0, "Vertex", ""}, {MOD_MESHSEQ_READ_POLY, "POLY", 0, "Faces", ""}, {MOD_MESHSEQ_READ_UV, "UV", 0, "UV", ""}, @@ -4472,7 +4472,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem DT_layer_vert_items[] = { + static const EnumPropertyItem DT_layer_vert_items[] = { {DT_TYPE_MDEFORMVERT, "VGROUP_WEIGHTS", 0, "Vertex Group(s)", "Transfer active or all vertex groups"}, #if 0 /* TODO */ {DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"}, @@ -4484,7 +4484,7 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem DT_layer_edge_items[] = { + static const EnumPropertyItem DT_layer_edge_items[] = { {DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"}, {DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"}, {DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"}, @@ -4493,14 +4493,14 @@ static void rna_def_modifier_datatransfer(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem DT_layer_loop_items[] = { + static const EnumPropertyItem DT_layer_loop_items[] = { {DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"}, {DT_TYPE_VCOL, "VCOL", 0, "VCol", "Vertex (face corners) colors"}, {DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem DT_layer_poly_items[] = { + static const EnumPropertyItem DT_layer_poly_items[] = { {DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"}, {DT_TYPE_FREESTYLE_FACE, "FREESTYLE_FACE", 0, "Freestyle Mark", "Transfer Freestyle face mark"}, {0, NULL, 0, NULL, NULL} @@ -4695,7 +4695,7 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_mode_items[] = { + static const EnumPropertyItem prop_mode_items[] = { {MOD_NORMALEDIT_MODE_RADIAL, "RADIAL", 0, "Radial", "From an ellipsoid (shape defined by the boundbox's dimensions, target is optional)"}, {MOD_NORMALEDIT_MODE_DIRECTIONAL, "DIRECTIONAL", 0, "Directional", @@ -4703,7 +4703,7 @@ static void rna_def_modifier_normaledit(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_mix_mode_items[] = { + static const EnumPropertyItem prop_mix_mode_items[] = { {MOD_NORMALEDIT_MIX_COPY, "COPY", 0, "Copy", "Copy new normals (overwrite existing)"}, {MOD_NORMALEDIT_MIX_ADD, "ADD", 0, "Add", "Copy sum of new and old normals"}, {MOD_NORMALEDIT_MIX_SUB, "SUB", 0, "Subtract", "Copy new normals minus old normals"}, diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index 925bc048bc3..850b1cd706b 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -211,7 +211,7 @@ static void rna_def_moviecliUser(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem clip_render_size_items[] = { + static const EnumPropertyItem clip_render_size_items[] = { {MCLIP_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""}, {MCLIP_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""}, {MCLIP_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""}, @@ -258,7 +258,7 @@ static void rna_def_movieclip(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem clip_source_items[] = { + static const EnumPropertyItem clip_source_items[] = { {MCLIP_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"}, {MCLIP_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 0e43f12b64b..a14508ecb18 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -470,7 +470,7 @@ static void rna_NlaTrack_solo_set(PointerRNA *ptr, int value) #else /* enum defines exported for rna_animation.c */ -EnumPropertyItem rna_enum_nla_mode_blend_items[] = { +const EnumPropertyItem rna_enum_nla_mode_blend_items[] = { {NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace", "Result strip replaces the accumulated results by amount specified by influence"}, {NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumulated results"}, @@ -481,7 +481,7 @@ EnumPropertyItem rna_enum_nla_mode_blend_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_nla_mode_extend_items[] = { +const EnumPropertyItem rna_enum_nla_mode_extend_items[] = { {NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents"}, {NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold", "Hold the first frame if no previous strips in track, and always hold last frame"}, @@ -520,7 +520,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) PropertyRNA *prop; /* enum defs */ - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {NLASTRIP_TYPE_CLIP, "CLIP", 0, "Action Clip", "NLA Strip references some Action"}, {NLASTRIP_TYPE_TRANSITION, "TRANSITION", 0, "Transition", "NLA Strip 'transitions' between adjacent strips"}, {NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips"}, diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 29d68111bac..9147d0a0bc8 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -68,21 +68,21 @@ #include "DEG_depsgraph.h" -EnumPropertyItem rna_enum_node_socket_in_out_items[] = { +const EnumPropertyItem rna_enum_node_socket_in_out_items[] = { { SOCK_IN, "IN", 0, "Input", "" }, { SOCK_OUT, "OUT", 0, "Output", "" }, { 0, NULL, 0, NULL, NULL } }; #ifndef RNA_RUNTIME -static EnumPropertyItem rna_enum_node_socket_draw_shape_items[] = { +static const EnumPropertyItem rna_enum_node_socket_draw_shape_items[] = { {SOCK_DRAW_SHAPE_CIRCLE, "CIRCLE", 0, "Circle", ""}, {SOCK_DRAW_SHAPE_SQUARE, "SQUARE", 0, "Square", ""}, {SOCK_DRAW_SHAPE_DIAMOND, "DIAMOND", 0, "Diamond", ""}, {0, NULL, 0, NULL, NULL } }; -static EnumPropertyItem node_socket_type_items[] = { +static const EnumPropertyItem node_socket_type_items[] = { {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""}, {SOCK_FLOAT, "VALUE", 0, "Value", ""}, {SOCK_INT, "INT", 0, "Int", ""}, @@ -94,14 +94,14 @@ static EnumPropertyItem node_socket_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_quality_items[] = { +static const EnumPropertyItem node_quality_items[] = { {NTREE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"}, {NTREE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", "Medium quality"}, {NTREE_QUALITY_LOW, "LOW", 0, "Low", "Low quality"}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_chunksize_items[] = { +static const EnumPropertyItem node_chunksize_items[] = { {NTREE_CHUNCKSIZE_32, "32", 0, "32x32", "Chunksize of 32x32"}, {NTREE_CHUNCKSIZE_64, "64", 0, "64x64", "Chunksize of 64x64"}, {NTREE_CHUNCKSIZE_128, "128", 0, "128x128", "Chunksize of 128x128"}, @@ -115,14 +115,14 @@ static EnumPropertyItem node_chunksize_items[] = { #define DEF_ICON_BLANK_SKIP #define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""}, #define DEF_VICO(name) -EnumPropertyItem rna_enum_node_icon_items[] = { +const EnumPropertyItem rna_enum_node_icon_items[] = { #include "UI_icons.h" {0, NULL, 0, NULL, NULL}}; #undef DEF_ICON_BLANK_SKIP #undef DEF_ICON #undef DEF_VICO -EnumPropertyItem rna_enum_node_math_items[] = { +const EnumPropertyItem rna_enum_node_math_items[] = { {NODE_MATH_ADD, "ADD", 0, "Add", ""}, {NODE_MATH_SUB, "SUBTRACT", 0, "Subtract", ""}, {NODE_MATH_MUL, "MULTIPLY", 0, "Multiply", ""}, @@ -145,7 +145,7 @@ EnumPropertyItem rna_enum_node_math_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_node_vec_math_items[] = { +const EnumPropertyItem rna_enum_node_vec_math_items[] = { {0, "ADD", 0, "Add", ""}, {1, "SUBTRACT", 0, "Subtract", ""}, {2, "AVERAGE", 0, "Average", ""}, @@ -155,7 +155,7 @@ EnumPropertyItem rna_enum_node_vec_math_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_node_filter_items[] = { +const EnumPropertyItem rna_enum_node_filter_items[] = { {0, "SOFTEN", 0, "Soften", ""}, {1, "SHARPEN", 0, "Sharpen", ""}, {2, "LAPLACE", 0, "Laplace", ""}, @@ -167,7 +167,7 @@ EnumPropertyItem rna_enum_node_filter_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem node_sampler_type_items[] = { +static const EnumPropertyItem node_sampler_type_items[] = { {0, "NEAREST", 0, "Nearest", ""}, {1, "BILINEAR", 0, "Bilinear", ""}, {2, "BICUBIC", 0, "Bicubic", ""}, @@ -247,7 +247,7 @@ bNodeTreeType *rna_node_tree_type_from_enum(int value) return result; } -EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, bNodeTreeType *), bool *r_free) +const EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, bNodeTreeType *), bool *r_free) { EnumPropertyItem tmp = {0}; EnumPropertyItem *item = NULL; @@ -323,7 +323,7 @@ bNodeType *rna_node_type_from_enum(int value) return result; } -EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, bNodeType *), bool *r_free) +const EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, bNodeType *), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0}; @@ -397,7 +397,8 @@ bNodeSocketType *rna_node_socket_type_from_enum(int value) return result; } -EnumPropertyItem *rna_node_socket_type_itemf(void *data, int (*poll)(void *data, bNodeSocketType *), bool *r_free) +const EnumPropertyItem *rna_node_socket_type_itemf( + void *data, int (*poll)(void *data, bNodeSocketType *), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0}; @@ -433,7 +434,7 @@ EnumPropertyItem *rna_node_socket_type_itemf(void *data, int (*poll)(void *data, return item; } -static EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp; @@ -2655,7 +2656,7 @@ static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *p } } -static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) +static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0}; @@ -2678,12 +2679,12 @@ static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) return item; } -static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; Image *ima = (Image *)node->id; - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; RenderLayer *rl; if (ima == NULL || ima->rr == NULL) { @@ -2719,7 +2720,7 @@ static int rna_Node_image_has_views_get(PointerRNA *ptr) return BLI_listbase_count_ex(&ima->rr->views, 2) > 1; } -static EnumPropertyItem *renderresult_views_add_enum(RenderView *rv) +static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0, "ALL", 0, "All", ""}; @@ -2745,12 +2746,12 @@ static EnumPropertyItem *renderresult_views_add_enum(RenderView *rv) return item; } -static EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; Image *ima = (Image *)node->id; - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; RenderView *rv; if (ima == NULL || ima->rr == NULL) { @@ -2766,12 +2767,12 @@ static EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), PointerR return item; } -static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; Scene *sce = (Scene *)node->id; - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; RenderLayer *rl; if (sce == NULL) { @@ -2795,7 +2796,7 @@ static void rna_Node_scene_layer_update(Main *bmain, Scene *scene, PointerRNA *p } } -static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { bNode *node = (bNode *)ptr->data; @@ -3027,7 +3028,7 @@ static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *p { bNodeTree *ntree = (bNodeTree *)ptr->id.data; bNode *node = (bNode *)ptr->data; - RenderEngineType *engine_type = RE_engines_find(scene->r.engine); + RenderEngineType *engine_type = RE_engines_find(scene->view_render.engine_id); if (engine_type && engine_type->update_script_node) { /* auto update node */ @@ -3224,43 +3225,43 @@ void rna_ShaderNodePointDensity_density_minmax(bNode *self, #else -static EnumPropertyItem prop_image_layer_items[] = { +static const EnumPropertyItem prop_image_layer_items[] = { { 0, "PLACEHOLDER", 0, "Placeholder", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_image_view_items[] = { +static const EnumPropertyItem prop_image_view_items[] = { { 0, "ALL", 0, "All", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_scene_layer_items[] = { +static const EnumPropertyItem prop_scene_layer_items[] = { { 0, "PLACEHOLDER", 0, "Placeholder", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_tri_channel_items[] = { +static const EnumPropertyItem prop_tri_channel_items[] = { { 1, "R", 0, "R", ""}, { 2, "G", 0, "G", ""}, { 3, "B", 0, "B", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_flip_items[] = { +static const EnumPropertyItem node_flip_items[] = { {0, "X", 0, "Flip X", ""}, {1, "Y", 0, "Flip Y", ""}, {2, "XY", 0, "Flip X & Y", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_ycc_items[] = { +static const EnumPropertyItem node_ycc_items[] = { { 0, "ITUBT601", 0, "ITU 601", ""}, { 1, "ITUBT709", 0, "ITU 709", ""}, { 2, "JFIF", 0, "Jpeg", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_glossy_items[] = { +static const EnumPropertyItem node_glossy_items[] = { {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""}, {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""}, {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""}, @@ -3269,7 +3270,7 @@ static EnumPropertyItem node_glossy_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_anisotropic_items[] = { +static const EnumPropertyItem node_anisotropic_items[] = { {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""}, {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""}, {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""}, @@ -3277,7 +3278,7 @@ static EnumPropertyItem node_anisotropic_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_glass_items[] = { +static const EnumPropertyItem node_glass_items[] = { {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""}, {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""}, {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""}, @@ -3285,32 +3286,32 @@ static EnumPropertyItem node_glass_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_refraction_items[] = { +static const EnumPropertyItem node_refraction_items[] = { {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""}, {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""}, {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_toon_items[] = { +static const EnumPropertyItem node_toon_items[] = { {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""}, {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_hair_items[] = { +static const EnumPropertyItem node_hair_items[] = { {SHD_HAIR_REFLECTION, "Reflection", 0, "Reflection", ""}, {SHD_HAIR_TRANSMISSION, "Transmission", 0, "Transmission", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_script_mode_items[] = { +static const EnumPropertyItem node_script_mode_items[] = { {NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"}, {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem node_principled_distribution_items[] = { +static const EnumPropertyItem node_principled_distribution_items[] = { { SHD_GLOSSY_GGX, "GGX", 0, "GGX", "" }, { SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", "" }, { 0, NULL, 0, NULL, NULL } @@ -3570,7 +3571,7 @@ static void def_sh_material(StructRNA *srna) static void def_sh_mapping(StructRNA *srna) { - static EnumPropertyItem prop_vect_type_items[] = { + static const EnumPropertyItem prop_vect_type_items[] = { {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transform a texture by inverse mapping the texture coordinate"}, {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"}, {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"}, @@ -3689,7 +3690,7 @@ static void def_sh_tex(StructRNA *srna) static void def_sh_tex_sky(StructRNA *srna) { - static EnumPropertyItem prop_sky_type[] = { + static const EnumPropertyItem prop_sky_type[] = { {SHD_SKY_OLD, "PREETHAM", 0, "Preetham", ""}, {SHD_SKY_NEW, "HOSEK_WILKIE", 0, "Hosek / Wilkie", ""}, {0, NULL, 0, NULL, NULL} @@ -3806,7 +3807,7 @@ static void def_sh_tex_image(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_image_extension[] = { + static const EnumPropertyItem prop_image_extension[] = { {SHD_IMAGE_EXTENSION_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"}, {SHD_IMAGE_EXTENSION_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, {SHD_IMAGE_EXTENSION_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"}, @@ -3860,7 +3861,7 @@ static void def_sh_tex_image(StructRNA *srna) static void def_sh_tex_gradient(StructRNA *srna) { - static EnumPropertyItem prop_gradient_type[] = { + static const EnumPropertyItem prop_gradient_type[] = { {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Create a linear progression"}, {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"}, {SHD_BLEND_EASING, "EASING", 0, "Easing", "Create a progression easing from one step to the next"}, @@ -3948,7 +3949,7 @@ static void def_sh_tex_magic(StructRNA *srna) static void def_sh_tex_musgrave(StructRNA *srna) { - static EnumPropertyItem prop_musgrave_type[] = { + static const EnumPropertyItem prop_musgrave_type[] = { {SHD_MUSGRAVE_MULTIFRACTAL, "MULTIFRACTAL", 0, "Multifractal", ""}, {SHD_MUSGRAVE_RIDGED_MULTIFRACTAL, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", ""}, {SHD_MUSGRAVE_HYBRID_MULTIFRACTAL, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", ""}, @@ -3971,7 +3972,7 @@ static void def_sh_tex_musgrave(StructRNA *srna) static void def_sh_tex_voronoi(StructRNA *srna) { - static EnumPropertyItem prop_coloring_items[] = { + static const EnumPropertyItem prop_coloring_items[] = { {SHD_VORONOI_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"}, {SHD_VORONOI_CELLS, "CELLS", 0, "Cells", "Color cells by position"}, {0, NULL, 0, NULL, NULL} @@ -3991,13 +3992,13 @@ static void def_sh_tex_voronoi(StructRNA *srna) static void def_sh_tex_wave(StructRNA *srna) { - static EnumPropertyItem prop_wave_type_items[] = { + static const EnumPropertyItem prop_wave_type_items[] = { {SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"}, {SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_wave_profile_items[] = { + static const EnumPropertyItem prop_wave_profile_items[] = { {SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"}, {SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"}, {0, NULL, 0, NULL, NULL} @@ -4040,14 +4041,14 @@ static void def_sh_tex_coord(StructRNA *srna) static void def_sh_vect_transform(StructRNA *srna) { - static EnumPropertyItem prop_vect_type_items[] = { + static const EnumPropertyItem prop_vect_type_items[] = { {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"}, {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"}, {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_vect_space_items[] = { + static const EnumPropertyItem prop_vect_space_items[] = { {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""}, {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""}, {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""}, @@ -4092,7 +4093,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem point_source_items[] = { + static const EnumPropertyItem point_source_items[] = { {SHD_POINTDENSITY_SOURCE_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", "Generate point density from a particle system"}, {SHD_POINTDENSITY_SOURCE_OBJECT, "OBJECT", 0, "Object Vertices", @@ -4110,13 +4111,13 @@ static void def_sh_tex_pointdensity(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem space_items[] = { + static const EnumPropertyItem space_items[] = { {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""}, {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem particle_color_source_items[] = { + static const EnumPropertyItem particle_color_source_items[] = { {SHD_POINTDENSITY_COLOR_PARTAGE, "PARTICLE_AGE", 0, "Particle Age", "Lifetime mapped as 0.0 - 1.0 intensity"}, {SHD_POINTDENSITY_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", @@ -4126,7 +4127,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem vertex_color_source_items[] = { + static const EnumPropertyItem vertex_color_source_items[] = { {SHD_POINTDENSITY_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"}, {SHD_POINTDENSITY_COLOR_VERTWEIGHT, "VERTEX_WEIGHT", 0, "Vertex Weight", "Vertex group weight"}, {SHD_POINTDENSITY_COLOR_VERTNOR, "VERTEX_NORMAL", 0, "Vertex Normal", @@ -4135,7 +4136,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna) }; /* TODO(sergey): Use some mnemonic names for the hardcoded values here. */ - static EnumPropertyItem calc_mode_items[] = { + static const EnumPropertyItem calc_mode_items[] = { {0, "VIEWPORT", 0, "Viewport", "Canculate density using viewport settings"}, {1, "RENDER", 0, "Render", "Canculate duplis using render settings"}, {0, NULL, 0, NULL, NULL} @@ -4348,7 +4349,7 @@ static void def_sh_uvalongstroke(StructRNA *srna) static void def_sh_normal_map(StructRNA *srna) { - static EnumPropertyItem prop_space_items[] = { + static const EnumPropertyItem prop_space_items[] = { {SHD_NORMAL_MAP_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"}, {SHD_NORMAL_MAP_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"}, {SHD_NORMAL_MAP_WORLD, "WORLD", 0, "World Space", "World space normal mapping"}, @@ -4375,13 +4376,13 @@ static void def_sh_normal_map(StructRNA *srna) static void def_sh_tangent(StructRNA *srna) { - static EnumPropertyItem prop_direction_type_items[] = { + static const EnumPropertyItem prop_direction_type_items[] = { {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"}, {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_axis_items[] = { + static const EnumPropertyItem prop_axis_items[] = { {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"}, {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"}, {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"}, @@ -4412,7 +4413,7 @@ static void def_sh_tangent(StructRNA *srna) static void def_sh_subsurface(StructRNA *srna) { - static EnumPropertyItem prop_subsurface_falloff_items[] = { + static const EnumPropertyItem prop_subsurface_falloff_items[] = { {SHD_SUBSURFACE_CUBIC, "CUBIC", 0, "Cubic", "Simple cubic falloff function"}, {SHD_SUBSURFACE_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", "Normal distribution, multiple can be combined to fit more complex profiles"}, {SHD_SUBSURFACE_BURLEY, "BURLEY", 0, "Christensen-Burley", "Approximation to physically based volume scattering"}, @@ -4524,7 +4525,7 @@ static void def_cmp_blur(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem filter_type_items[] = { + static const EnumPropertyItem filter_type_items[] = { {R_FILTER_BOX, "FLAT", 0, "Flat", ""}, {R_FILTER_TENT, "TENT", 0, "Tent", ""}, {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""}, @@ -4536,7 +4537,7 @@ static void def_cmp_blur(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem aspect_correction_type_items[] = { + static const EnumPropertyItem aspect_correction_type_items[] = { {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""}, {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""}, {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""}, @@ -4723,7 +4724,7 @@ static void def_cmp_levels(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem channel_items[] = { + static const EnumPropertyItem channel_items[] = { {1, "COMBINED_RGB", 0, "C", "Combined RGB"}, {2, "RED", 0, "R", "Red Channel"}, {3, "GREEN", 0, "G", "Green Channel"}, @@ -4807,7 +4808,7 @@ static void def_cmp_image(StructRNA *srna) PropertyRNA *prop; #if 0 - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {IMA_SRC_FILE, "IMAGE", 0, "Image", ""}, {IMA_SRC_MOVIE, "MOVIE", "Movie", ""}, {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""}, @@ -4981,7 +4982,7 @@ static void def_cmp_dilate_erode(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem mode_items[] = { + static const EnumPropertyItem mode_items[] = { {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""}, {CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""}, {CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""}, @@ -5061,7 +5062,7 @@ static void def_cmp_scale(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem space_items[] = { + static const EnumPropertyItem space_items[] = { {CMP_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""}, {CMP_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""}, {CMP_SCALE_SCENEPERCENT, "SCENE_SIZE", 0, "Scene Size", ""}, @@ -5162,7 +5163,7 @@ static void def_cmp_distance_matte(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem color_space_items[] = { + static const EnumPropertyItem color_space_items[] = { {1, "RGB", 0, "RGB", "RGB color space"}, {2, "YCC", 0, "YCC", "YCbCr Suppression"}, {0, NULL, 0, NULL, NULL} @@ -5196,21 +5197,21 @@ static void def_cmp_color_spill(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem channel_items[] = { + static const EnumPropertyItem channel_items[] = { {1, "R", 0, "R", "Red Spill Suppression"}, {2, "G", 0, "G", "Green Spill Suppression"}, {3, "B", 0, "B", "Blue Spill Suppression"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem limit_channel_items[] = { + static const EnumPropertyItem limit_channel_items[] = { {0, "R", 0, "R", "Limit by Red"}, {1, "G", 0, "G", "Limit by Green"}, {2, "B", 0, "B", "Limit by Blue"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem algorithm_items[] = { + static const EnumPropertyItem algorithm_items[] = { {0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"}, {1, "AVERAGE", 0, "Average", "Average Limit Algorithm"}, {0, NULL, 0, NULL, NULL} @@ -5340,7 +5341,7 @@ static void def_cmp_channel_matte(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem color_space_items[] = { + static const EnumPropertyItem color_space_items[] = { {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB Color Space"}, {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV Color Space"}, {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV Color Space"}, @@ -5348,7 +5349,7 @@ static void def_cmp_channel_matte(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem algorithm_items[] = { + static const EnumPropertyItem algorithm_items[] = { {0, "SINGLE", 0, "Single", "Limit by single channel"}, {1, "MAX", 0, "Max", "Limit by max of other channels "}, {0, NULL, 0, NULL, NULL} @@ -5445,13 +5446,13 @@ static void def_cmp_double_edge_mask(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem BufEdgeMode_items[] = { + static const EnumPropertyItem BufEdgeMode_items[] = { {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"}, {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem InnerEdgeMode_items[] = { + static const EnumPropertyItem InnerEdgeMode_items[] = { {0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"}, {1, "ADJACENT_ONLY", 0, "Adjacent Only", "Only inner mask pixels adjacent to outer mask pixels are considered during mask calculation"}, @@ -5486,7 +5487,7 @@ static void def_cmp_defocus(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem bokeh_items[] = { + static const EnumPropertyItem bokeh_items[] = { {8, "OCTAGON", 0, "Octagonal", "8 sides"}, {7, "HEPTAGON", 0, "Heptagonal", "7 sides"}, {6, "HEXAGON", 0, "Hexagonal", "6 sides"}, @@ -5730,7 +5731,7 @@ static void def_cmp_premul_key(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {0, "STRAIGHT_TO_PREMUL", 0, "Straight to Premul", ""}, {1, "PREMUL_TO_STRAIGHT", 0, "Premul to Straight", ""}, {0, NULL, 0, NULL, NULL} @@ -5748,7 +5749,7 @@ static void def_cmp_glare(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {3, "GHOSTS", 0, "Ghosts", ""}, {2, "STREAKS", 0, "Streaks", ""}, {1, "FOG_GLOW", 0, "Fog Glow", ""}, @@ -5756,7 +5757,7 @@ static void def_cmp_glare(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem quality_items[] = { + static const EnumPropertyItem quality_items[] = { {0, "HIGH", 0, "High", ""}, {1, "MEDIUM", 0, "Medium", ""}, {2, "LOW", 0, "Low", ""}, @@ -5844,7 +5845,7 @@ static void def_cmp_tonemap(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""}, {0, "RH_SIMPLE", 0, "Rh Simple", ""}, {0, NULL, 0, NULL, NULL} @@ -5931,7 +5932,7 @@ static void def_cmp_colorbalance(StructRNA *srna) PropertyRNA *prop; static float default_1[3] = {1.f, 1.f, 1.f}; - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""}, {1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"}, {0, NULL, 0, NULL, NULL} @@ -6080,7 +6081,7 @@ static void def_cmp_moviedistortion(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem distortion_type_items[] = { + static const EnumPropertyItem distortion_type_items[] = { {0, "UNDISTORT", 0, "Undistort", ""}, {1, "DISTORT", 0, "Distort", ""}, {0, NULL, 0, NULL, NULL} @@ -6104,7 +6105,7 @@ static void def_cmp_mask(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem aspect_type_items[] = { + static const EnumPropertyItem aspect_type_items[] = { {0, "SCENE", 0, "Scene Size", ""}, {CMP_NODEFLAG_MASK_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"}, {CMP_NODEFLAG_MASK_FIXED_SCENE, "FIXED_SCENE", 0, "Fixed/Scene", "Pixel size scaled by scene percentage"}, @@ -6178,7 +6179,7 @@ static void dev_cmd_transform(StructRNA *srna) /* -- Compositor Nodes ------------------------------------------------------ */ -static EnumPropertyItem node_masktype_items[] = { +static const EnumPropertyItem node_masktype_items[] = { {0, "ADD", 0, "Add", ""}, {1, "SUBTRACT", 0, "Subtract", ""}, {2, "MULTIPLY", 0, "Multiply", ""}, @@ -6554,7 +6555,7 @@ static void def_cmp_colorcorrection(StructRNA *srna) static void def_cmp_viewer(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem tileorder_items[] = { + static const EnumPropertyItem tileorder_items[] = { {0, "CENTEROUT", 0, "Center", "Expand from center"}, {1, "RANDOM", 0, "Random", "Random tiles"}, {2, "BOTTOMUP", 0, "Bottom up", "Expand from bottom"}, @@ -6701,7 +6702,7 @@ static void def_cmp_trackpos(StructRNA *srna) { PropertyRNA *prop; - static EnumPropertyItem position_items[] = { + static const EnumPropertyItem position_items[] = { {CMP_TRACKPOS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Output absolute position of a marker"}, {CMP_TRACKPOS_RELATIVE_START, "RELATIVE_START", 0, @@ -6746,7 +6747,7 @@ static void def_cmp_trackpos(StructRNA *srna) static void def_cmp_translate(StructRNA *srna) { - static EnumPropertyItem translate_items[] = { + static const EnumPropertyItem translate_items[] = { {CMP_NODE_WRAP_NONE, "NONE", 0, "None", "No wrapping on X and Y"}, {CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"}, {CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"}, @@ -7702,11 +7703,11 @@ static void rna_def_node(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem dummy_static_type_items[] = { + static const EnumPropertyItem dummy_static_type_items[] = { {NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem node_shading_compatibilities[] = { + static const EnumPropertyItem node_shading_compatibilities[] = { {NODE_OLD_SHADING, "OLD_SHADING", 0, "Old Shading", "Old shading system compatibility"}, {NODE_NEW_SHADING, "NEW_SHADING", 0, "New Shading", "New shading system compatibility"}, {0, NULL, 0, NULL, NULL} @@ -8163,7 +8164,7 @@ static void rna_def_nodetree(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem static_type_items[] = { + static const EnumPropertyItem static_type_items[] = { {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"}, {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"}, {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"}, diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index e57333fb8a7..02f3b048f3a 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -61,7 +61,7 @@ #include "WM_api.h" #include "WM_types.h" -EnumPropertyItem rna_enum_object_mode_items[] = { +const EnumPropertyItem rna_enum_object_mode_items[] = { {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""}, {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""}, {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""}, @@ -74,7 +74,7 @@ EnumPropertyItem rna_enum_object_mode_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_object_empty_drawtype_items[] = { +const EnumPropertyItem rna_enum_object_empty_drawtype_items[] = { {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""}, {OB_ARROWS, "ARROWS", 0, "Arrows", ""}, {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""}, @@ -87,7 +87,7 @@ EnumPropertyItem rna_enum_object_empty_drawtype_items[] = { }; -static EnumPropertyItem parent_type_items[] = { +static const EnumPropertyItem parent_type_items[] = { {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"}, {PARSKEL, "ARMATURE", 0, "Armature", ""}, {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */ @@ -105,7 +105,7 @@ static EnumPropertyItem parent_type_items[] = { #define DUPLI_ITEM_GROUP \ {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"} -static EnumPropertyItem dupli_items[] = { +static const EnumPropertyItem dupli_items[] = { DUPLI_ITEMS_SHARED, DUPLI_ITEM_GROUP, {0, NULL, 0, NULL, NULL} @@ -119,7 +119,7 @@ static EnumPropertyItem dupli_items_nogroup[] = { #undef DUPLI_ITEMS_SHARED #undef DUPLI_ITEM_GROUP -static EnumPropertyItem collision_bounds_items[] = { +static const EnumPropertyItem collision_bounds_items[] = { {OB_BOUND_BOX, "BOX", ICON_MESH_CUBE, "Box", ""}, {OB_BOUND_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""}, {OB_BOUND_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""}, @@ -131,7 +131,7 @@ static EnumPropertyItem collision_bounds_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_metaelem_type_items[] = { +const EnumPropertyItem rna_enum_metaelem_type_items[] = { {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""}, {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""}, {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""}, @@ -145,7 +145,7 @@ EnumPropertyItem rna_enum_metaelem_type_items[] = { #define OBTYPE_CU_SURF {OB_SURF, "SURFACE", 0, "Surface", ""} #define OBTYPE_CU_FONT {OB_FONT, "FONT", 0, "Font", ""} -EnumPropertyItem rna_enum_object_type_items[] = { +const EnumPropertyItem rna_enum_object_type_items[] = { {OB_MESH, "MESH", 0, "Mesh", ""}, OBTYPE_CU_CURVE, OBTYPE_CU_SURF, @@ -163,14 +163,14 @@ EnumPropertyItem rna_enum_object_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_object_type_curve_items[] = { +const EnumPropertyItem rna_enum_object_type_curve_items[] = { OBTYPE_CU_CURVE, OBTYPE_CU_SURF, OBTYPE_CU_FONT, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_object_axis_items[] = { +const EnumPropertyItem rna_enum_object_axis_items[] = { {OB_POSX, "POS_X", 0, "+X", ""}, {OB_POSY, "POS_Y", 0, "+Y", ""}, {OB_POSZ, "POS_Z", 0, "+Z", ""}, @@ -452,7 +452,7 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value) ED_object_parent(ob, ob->parent, value, ob->parsubstr); } -static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = (Object *)ptr->data; @@ -493,7 +493,7 @@ static void rna_Object_empty_draw_type_set(PointerRNA *ptr, int value) BKE_object_empty_draw_type_set(ob, value); } -static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = (Object *)ptr->data; @@ -526,12 +526,12 @@ static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value) ED_object_parent(ob, ob->parent, ob->partype, value); } -static EnumPropertyItem *rna_Object_dupli_type_itemf( +static const EnumPropertyItem *rna_Object_dupli_type_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Object *ob = (Object *)ptr->data; - EnumPropertyItem *item; + const EnumPropertyItem *item; if (ob->type == OB_EMPTY) { item = dupli_items; @@ -1703,7 +1703,7 @@ static void rna_def_vertex_group(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem assign_mode_items[] = { + static const EnumPropertyItem assign_mode_items[] = { {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"}, {WEIGHT_ADD, "ADD", 0, "Add", "Add"}, {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"}, @@ -1808,7 +1808,7 @@ static void rna_def_material_slot(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem link_items[] = { + static const EnumPropertyItem link_items[] = { {1, "OBJECT", 0, "Object", ""}, {0, "DATA", 0, "Data", ""}, {0, NULL, 0, NULL, NULL} @@ -1849,7 +1849,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem body_type_items[] = { + static const EnumPropertyItem body_type_items[] = { {OB_BODY_TYPE_NO_COLLISION, "NO_COLLISION", 0, "No Collision", "Disable collision for this object"}, {OB_BODY_TYPE_STATIC, "STATIC", 0, "Static", "Stationary object"}, {OB_BODY_TYPE_DYNAMIC, "DYNAMIC", 0, "Dynamic", "Linear physics"}, @@ -2432,14 +2432,14 @@ static void rna_def_object(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem up_items[] = { + static const EnumPropertyItem up_items[] = { {OB_POSX, "X", 0, "X", ""}, {OB_POSY, "Y", 0, "Y", ""}, {OB_POSZ, "Z", 0, "Z", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem drawtype_items[] = { + static const EnumPropertyItem drawtype_items[] = { {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounds of the object"}, {OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"}, {OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"}, @@ -2448,7 +2448,7 @@ static void rna_def_object(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem boundtype_items[] = { + static const EnumPropertyItem boundtype_items[] = { {OB_BOUND_BOX, "BOX", 0, "Box", "Draw bounds as box"}, {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"}, @@ -2460,7 +2460,7 @@ static void rna_def_object(BlenderRNA *brna) /* XXX: this RNA enum define is currently duplicated for objects, * since there is some text here which is not applicable */ - static EnumPropertyItem prop_rotmode_items[] = { + static const EnumPropertyItem prop_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"}, {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"}, {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"}, diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index d1dcfa41e28..5486db84b0b 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -50,7 +50,7 @@ #include "rna_internal.h" /* own include */ -static EnumPropertyItem space_items[] = { +static const EnumPropertyItem space_items[] = { {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The most gobal space in Blender"}, {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space", @@ -545,13 +545,13 @@ void RNA_api_object(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem mesh_type_items[] = { + static const EnumPropertyItem mesh_type_items[] = { {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem dupli_eval_mode_items[] = { + static const EnumPropertyItem dupli_eval_mode_items[] = { {DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Generate duplis using viewport settings"}, {DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Generate duplis using preview settings"}, {DAG_EVAL_RENDER, "RENDER", 0, "Render", "Generate duplis using render settings"}, @@ -559,7 +559,7 @@ void RNA_api_object(StructRNA *srna) }; #ifndef NDEBUG - static EnumPropertyItem mesh_dm_info_items[] = { + static const EnumPropertyItem mesh_dm_info_items[] = { {0, "SOURCE", 0, "Source", "Source mesh"}, {1, "DEFORM", 0, "Deform", "Objects deform mesh"}, {2, "FINAL", 0, "Final", "Objects final mesh"}, diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 2ae674ea961..198a47c007e 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -41,7 +41,7 @@ #include "WM_api.h" #include "WM_types.h" -static EnumPropertyItem effector_shape_items[] = { +static const EnumPropertyItem effector_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", ""}, @@ -55,20 +55,20 @@ static EnumPropertyItem effector_shape_items[] = { /* type specific return values only used from functions */ -static EnumPropertyItem curve_shape_items[] = { +static const EnumPropertyItem curve_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem empty_shape_items[] = { +static const EnumPropertyItem empty_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem vortex_shape_items[] = { +static const EnumPropertyItem vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""}, @@ -76,14 +76,14 @@ static EnumPropertyItem vortex_shape_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem curve_vortex_shape_items[] = { +static const EnumPropertyItem curve_vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem empty_vortex_shape_items[] = { +static const EnumPropertyItem empty_vortex_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, {0, NULL, 0, NULL, NULL} @@ -739,7 +739,7 @@ static void rna_softbody_dependency_update(Main *bmain, Scene *scene, PointerRNA rna_softbody_update(bmain, scene, ptr); } -static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Object *ob = NULL; @@ -798,7 +798,7 @@ static void rna_def_pointcache(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem point_cache_compress_items[] = { + static const EnumPropertyItem point_cache_compress_items[] = { {PTCACHE_COMPRESS_NO, "NO", 0, "No", "No compression"}, {PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Light", "Fast but not so effective compression"}, {PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"}, @@ -1126,7 +1126,7 @@ static void rna_def_field(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem field_type_items[] = { + static const EnumPropertyItem field_type_items[] = { {0, "NONE", 0, "None", ""}, {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"}, {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"}, @@ -1149,28 +1149,28 @@ static void rna_def_field(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem falloff_items[] = { + static const EnumPropertyItem falloff_items[] = { {PFIELD_FALL_SPHERE, "SPHERE", 0, "Sphere", ""}, {PFIELD_FALL_TUBE, "TUBE", 0, "Tube", ""}, {PFIELD_FALL_CONE, "CONE", 0, "Cone", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem texture_items[] = { + static const EnumPropertyItem texture_items[] = { {PFIELD_TEX_RGB, "RGB", 0, "RGB", ""}, {PFIELD_TEX_GRAD, "GRADIENT", 0, "Gradient", ""}, {PFIELD_TEX_CURL, "CURL", 0, "Curl", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem zdirection_items[] = { + static const EnumPropertyItem zdirection_items[] = { {PFIELD_Z_BOTH, "BOTH", 0, "Both Z", ""}, {PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""}, {PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem guide_kink_items[] = { + static const EnumPropertyItem guide_kink_items[] = { {0, "NONE", 0, "Nothing", ""}, {1, "CURL", 0, "Curl", ""}, {2, "RADIAL", 0, "Radial", ""}, @@ -1568,7 +1568,7 @@ static void rna_def_softbody(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem collision_type_items[] = { + static const EnumPropertyItem collision_type_items[] = { {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"}, {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring length * Ball Size"}, {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"}, @@ -1577,7 +1577,7 @@ static void rna_def_softbody(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem aerodynamics_type[] = { + static const EnumPropertyItem aerodynamics_type[] = { {0, "SIMPLE", 0, "Simple", "Edges receive a drag force from surrounding media"}, {1, "LIFT_FORCE", 0, "Lift Force", "Edges receive a lift force when passing through surrounding media"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c index f3da03714a1..c7891680adb 100644 --- a/source/blender/makesrna/intern/rna_packedfile.c +++ b/source/blender/makesrna/intern/rna_packedfile.c @@ -35,7 +35,7 @@ #include "rna_internal.h" -EnumPropertyItem rna_enum_unpack_method_items[] = { +const EnumPropertyItem rna_enum_unpack_method_items[] = { {PF_USE_LOCAL, "USE_LOCAL", 0, "Use Local File", ""}, {PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write Local File (overwrite existing)", ""}, {PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use Original File", ""}, diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 93801a508c5..021417648d0 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -55,7 +55,7 @@ #include "WM_api.h" #ifdef RNA_RUNTIME -static EnumPropertyItem part_from_items[] = { +static const EnumPropertyItem part_from_items[] = { {PART_FROM_VERT, "VERT", 0, "Verts", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, @@ -64,7 +64,7 @@ static EnumPropertyItem part_from_items[] = { #endif #ifndef RNA_RUNTIME -static EnumPropertyItem part_reactor_from_items[] = { +static const EnumPropertyItem part_reactor_from_items[] = { {PART_FROM_VERT, "VERT", 0, "Verts", ""}, {PART_FROM_FACE, "FACE", 0, "Faces", ""}, {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""}, @@ -72,7 +72,7 @@ static EnumPropertyItem part_reactor_from_items[] = { }; #endif -static EnumPropertyItem part_dist_items[] = { +static const EnumPropertyItem part_dist_items[] = { {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, {PART_DISTR_RAND, "RAND", 0, "Random", ""}, {PART_DISTR_GRID, "GRID", 0, "Grid", ""}, @@ -80,14 +80,14 @@ static EnumPropertyItem part_dist_items[] = { }; #ifdef RNA_RUNTIME -static EnumPropertyItem part_hair_dist_items[] = { +static const EnumPropertyItem part_hair_dist_items[] = { {PART_DISTR_JIT, "JIT", 0, "Jittered", ""}, {PART_DISTR_RAND, "RAND", 0, "Random", ""}, {0, NULL, 0, NULL, NULL} }; #endif -static EnumPropertyItem part_draw_as_items[] = { +static const EnumPropertyItem part_draw_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_REND, "RENDER", 0, "Rendered", ""}, {PART_DRAW_DOT, "DOT", 0, "Point", ""}, @@ -98,7 +98,7 @@ static EnumPropertyItem part_draw_as_items[] = { }; #ifdef RNA_RUNTIME -static EnumPropertyItem part_hair_draw_as_items[] = { +static const EnumPropertyItem part_hair_draw_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_REND, "RENDER", 0, "Rendered", ""}, {PART_DRAW_PATH, "PATH", 0, "Path", ""}, @@ -106,7 +106,7 @@ static EnumPropertyItem part_hair_draw_as_items[] = { }; #endif -static EnumPropertyItem part_ren_as_items[] = { +static const EnumPropertyItem part_ren_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_HALO, "HALO", 0, "Halo", ""}, {PART_DRAW_LINE, "LINE", 0, "Line", ""}, @@ -118,7 +118,7 @@ static EnumPropertyItem part_ren_as_items[] = { }; #ifdef RNA_RUNTIME -static EnumPropertyItem part_hair_ren_as_items[] = { +static const EnumPropertyItem part_hair_ren_as_items[] = { {PART_DRAW_NOT, "NONE", 0, "None", ""}, {PART_DRAW_PATH, "PATH", 0, "Path", ""}, {PART_DRAW_OB, "OBJECT", 0, "Object", ""}, @@ -399,7 +399,7 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o } -static EnumPropertyItem *rna_Particle_Material_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_Particle_Material_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { Object *ob = CTX_data_pointer_get(C, "object").data; @@ -1149,7 +1149,7 @@ static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr) return strlen(tstr); } -static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { /*if (part->type==PART_REACTOR) */ @@ -1158,7 +1158,7 @@ static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA return part_from_items; } -static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ParticleSettings *part = ptr->id.data; @@ -1169,7 +1169,7 @@ static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA return part_dist_items; } -static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ParticleSettings *part = ptr->id.data; @@ -1180,7 +1180,7 @@ static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), Pointer return part_draw_as_items; } -static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ParticleSettings *part = ptr->id.data; @@ -1434,7 +1434,7 @@ static void rna_def_particle(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem alive_items[] = { + static const EnumPropertyItem alive_items[] = { /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */ {PARS_DEAD, "DEAD", 0, "Dead", ""}, {PARS_UNBORN, "UNBORN", 0, "Unborn", ""}, @@ -1578,7 +1578,7 @@ static void rna_def_fluid_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem sph_solver_items[] = { + static const EnumPropertyItem sph_solver_items[] = { {SPH_SOLVER_DDR, "DDR", 0, "Double-Density", "An artistic solver with strong surface tension effects (original)"}, {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"}, {0, NULL, 0, NULL, NULL} @@ -1728,7 +1728,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem texco_items[] = { + static const EnumPropertyItem texco_items[] = { {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"}, {TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"}, {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"}, @@ -1738,7 +1738,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_mapping_items[] = { + static const EnumPropertyItem prop_mapping_items[] = { {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"}, {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"}, {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"}, @@ -1746,7 +1746,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_x_mapping_items[] = { + static const EnumPropertyItem prop_x_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -1754,7 +1754,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_y_mapping_items[] = { + static const EnumPropertyItem prop_y_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -1762,7 +1762,7 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_z_mapping_items[] = { + static const EnumPropertyItem prop_z_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -1971,14 +1971,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {PART_EMITTER, "EMITTER", 0, "Emitter", ""}, /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */ {PART_HAIR, "HAIR", 0, "Hair", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem phys_type_items[] = { + static const EnumPropertyItem phys_type_items[] = { {PART_PHYS_NO, "NO", 0, "No", ""}, {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""}, {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""}, @@ -1987,7 +1987,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem rot_mode_items[] = { + static const EnumPropertyItem rot_mode_items[] = { {0, "NONE", 0, "None", ""}, {PART_ROT_NOR, "NOR", 0, "Normal", ""}, {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""}, @@ -2001,7 +2001,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem ave_mode_items[] = { + static const EnumPropertyItem ave_mode_items[] = { {0, "NONE", 0, "None", ""}, {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""}, {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""}, @@ -2013,14 +2013,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem react_event_items[] = { + static const EnumPropertyItem react_event_items[] = { {PART_EVENT_DEATH, "DEATH", 0, "Death", ""}, {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""}, {PART_EVENT_NEAR, "NEAR", 0, "Near", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem child_type_items[] = { + static const EnumPropertyItem child_type_items[] = { {0, "NONE", 0, "None", ""}, {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""}, {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""}, @@ -2028,7 +2028,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) }; /*TODO: names, tooltips */ - static EnumPropertyItem integrator_type_items[] = { + static const EnumPropertyItem integrator_type_items[] = { {PART_INT_EULER, "EULER", 0, "Euler", ""}, {PART_INT_VERLET, "VERLET", 0, "Verlet", ""}, {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""}, @@ -2036,7 +2036,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem kink_type_items[] = { + static const EnumPropertyItem kink_type_items[] = { {PART_KINK_NO, "NO", 0, "Nothing", ""}, {PART_KINK_CURL, "CURL", 0, "Curl", ""}, {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""}, @@ -2046,7 +2046,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bb_align_items[] = { + static const EnumPropertyItem bb_align_items[] = { {PART_BB_X, "X", 0, "X", ""}, {PART_BB_Y, "Y", 0, "Y", ""}, {PART_BB_Z, "Z", 0, "Z", ""}, @@ -2055,7 +2055,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bb_anim_items[] = { + static const EnumPropertyItem bb_anim_items[] = { {PART_BB_ANIM_NONE, "NONE", 0, "None", ""}, {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""}, {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""}, @@ -2063,14 +2063,14 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bb_split_offset_items[] = { + static const EnumPropertyItem bb_split_offset_items[] = { {PART_BB_OFF_NONE, "NONE", 0, "None", ""}, {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""}, {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem draw_col_items[] = { + static const EnumPropertyItem draw_col_items[] = { {PART_DRAW_COL_NONE, "NONE", 0, "None", ""}, {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""}, {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""}, @@ -2078,7 +2078,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem part_mat_items[] = { + static const EnumPropertyItem part_mat_items[] = { {0, "DUMMY", 0, "Dummy", ""}, {0, NULL, 0, NULL, NULL} }; @@ -3182,7 +3182,7 @@ static void rna_def_particle_target(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem mode_items[] = { + static const EnumPropertyItem mode_items[] = { {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""}, {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""}, {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""}, @@ -3245,7 +3245,7 @@ static void rna_def_particle_system(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem resolution_items[] = { + static const EnumPropertyItem resolution_items[] = { {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"}, {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index d9e7d3f6a84..b4c721a88b3 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -52,7 +52,7 @@ /* XXX: this RNA enum define is currently duplicated for objects, * since there is some text here which is not applicable */ -EnumPropertyItem rna_enum_posebone_rotmode_items[] = { +const EnumPropertyItem rna_enum_posebone_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock (default)"}, {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order (prone to Gimbal Lock)"}, {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order (prone to Gimbal Lock)"}, @@ -66,7 +66,7 @@ EnumPropertyItem rna_enum_posebone_rotmode_items[] = { }; /* Bone and Group Color Sets */ -EnumPropertyItem rna_enum_color_sets_items[] = { +const EnumPropertyItem rna_enum_color_sets_items[] = { {0, "DEFAULT", 0, "Default Colors", ""}, {1, "THEME01", VICO_COLORSET_01_VEC, "01 - Theme Color Set", ""}, {2, "THEME02", VICO_COLORSET_02_VEC, "02 - Theme Color Set", ""}, @@ -731,13 +731,13 @@ static void rna_def_bone_group(BlenderRNA *brna) rna_def_actionbone_group_common(srna, NC_OBJECT | ND_POSE, "rna_Pose_update"); } -static EnumPropertyItem prop_iksolver_items[] = { +static const EnumPropertyItem prop_iksolver_items[] = { {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"}, {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_solver_items[] = { +static const EnumPropertyItem prop_solver_items[] = { {ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"}, {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index fb70870f49b..7ee792b5d1f 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -43,7 +43,7 @@ #include "WM_types.h" -EnumPropertyItem rna_enum_gameproperty_type_items[] = { +const EnumPropertyItem rna_enum_gameproperty_type_items[] = { {GPROP_BOOL, "BOOL", 0, "Boolean", "Boolean Property"}, {GPROP_INT, "INT", 0, "Integer", "Integer Property"}, {GPROP_FLOAT, "FLOAT", 0, "Float", "Floating-Point Property"}, diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 8304fa452e4..5ab4488b1b7 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -48,7 +48,7 @@ #include "ED_render.h" /* Deprecated, only provided for API compatibility. */ -EnumPropertyItem rna_enum_render_pass_type_items[] = { +const EnumPropertyItem rna_enum_render_pass_type_items[] = { {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, {SCE_PASS_Z, "Z", 0, "Z", ""}, {SCE_PASS_RGBA, "COLOR", 0, "Color", ""}, @@ -84,7 +84,7 @@ EnumPropertyItem rna_enum_render_pass_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_bake_pass_type_items[] = { +const EnumPropertyItem rna_enum_bake_pass_type_items[] = { {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""}, {SCE_PASS_AO, "AO", 0, "AO", ""}, {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""}, @@ -486,7 +486,7 @@ static void rna_def_render_engine(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem render_pass_type_items[] = { + static const EnumPropertyItem render_pass_type_items[] = { {SOCK_FLOAT, "VALUE", 0, "Value", ""}, {SOCK_VECTOR, "VECTOR", 0, "Vector", ""}, {SOCK_RGBA, "COLOR", 0, "Color", ""}, diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 1ed375706df..bc85e9c6503 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -44,13 +44,13 @@ #include "WM_types.h" /* roles of objects in RigidBody Sims */ -EnumPropertyItem rna_enum_rigidbody_object_type_items[] = { +const EnumPropertyItem rna_enum_rigidbody_object_type_items[] = { {RBO_TYPE_ACTIVE, "ACTIVE", 0, "Active", "Object is directly controlled by simulation results"}, {RBO_TYPE_PASSIVE, "PASSIVE", 0, "Passive", "Object is directly controlled by animation system"}, {0, NULL, 0, NULL, NULL}}; /* collision shapes of objects in rigid body sim */ -EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = { +const EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = { {RB_SHAPE_BOX, "BOX", ICON_MESH_CUBE, "Box", "Box-like shapes (i.e. cubes), including planes (i.e. ground planes)"}, {RB_SHAPE_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""}, {RB_SHAPE_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""}, @@ -64,7 +64,7 @@ EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = { {0, NULL, 0, NULL, NULL}}; /* collision shapes of constraints in rigid body sim */ -EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = { +const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = { {RBC_TYPE_FIXED, "FIXED", ICON_NONE, "Fixed", "Glue rigid bodies together"}, {RBC_TYPE_POINT, "POINT", ICON_NONE, "Point", "Constrain rigid bodies to move around common pivot point"}, {RBC_TYPE_HINGE, "HINGE", ICON_NONE, "Hinge", "Restrict rigid body rotation to one axis"}, @@ -78,7 +78,7 @@ EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = { #ifndef RNA_RUNTIME /* mesh source for collision shape creation */ -static EnumPropertyItem rigidbody_mesh_source_items[] = { +static const EnumPropertyItem rigidbody_mesh_source_items[] = { {RBO_MESH_BASE, "BASE", 0, "Base", "Base mesh"}, {RBO_MESH_DEFORM, "DEFORM", 0, "Deform", "Deformations (shape keys, deform modifiers)"}, {RBO_MESH_FINAL, "FINAL", 0, "Final", "All modifiers"}, diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 502a9c42363..1d87bdb972e 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -36,7 +36,7 @@ #include "rna_internal.h" -EnumPropertyItem rna_enum_property_type_items[] = { +const EnumPropertyItem rna_enum_property_type_items[] = { {PROP_BOOLEAN, "BOOLEAN", 0, "Boolean", ""}, {PROP_INT, "INT", 0, "Integer", ""}, {PROP_FLOAT, "FLOAT", 0, "Float", ""}, @@ -50,7 +50,7 @@ EnumPropertyItem rna_enum_property_type_items[] = { /* XXX Keep in sync with bpy_props.c's property_subtype_xxx_items ??? * Currently it is not... */ -EnumPropertyItem rna_enum_property_subtype_items[] = { +const EnumPropertyItem rna_enum_property_subtype_items[] = { {PROP_NONE, "NONE", 0, "None", ""}, /* strings */ @@ -90,7 +90,7 @@ EnumPropertyItem rna_enum_property_subtype_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_property_unit_items[] = { +const EnumPropertyItem rna_enum_property_unit_items[] = { {PROP_UNIT_NONE, "NONE", 0, "None", ""}, {PROP_UNIT_LENGTH, "LENGTH", 0, "Length", ""}, {PROP_UNIT_AREA, "AREA", 0, "Area", ""}, @@ -824,7 +824,7 @@ static int rna_StringProperty_max_length_get(PointerRNA *ptr) return ((StringPropertyRNA *)prop)->maxlength; } -static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, +static const EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop_parent, bool *r_free) { PropertyRNA *prop = (PropertyRNA *)ptr->data; @@ -870,7 +870,7 @@ static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, Point { PropertyRNA *prop = (PropertyRNA *)ptr->data; /* EnumPropertyRNA *eprop; *//* UNUSED */ - EnumPropertyItem *item = NULL; + const EnumPropertyItem *item = NULL; int totitem; bool free; @@ -1118,7 +1118,7 @@ static void rna_def_property(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem subtype_items[] = { + static const EnumPropertyItem subtype_items[] = { {PROP_NONE, "NONE", 0, "None", ""}, {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""}, {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""}, @@ -1442,7 +1442,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna) PropertyRNA *prop; /* the itemf func is used instead, keep blender happy */ - static EnumPropertyItem default_dummy_items[] = { + static const EnumPropertyItem default_dummy_items[] = { {PROP_NONE, "DUMMY", 0, "Dummy", ""}, {0, NULL, 0, NULL, NULL} }; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 685844149e1..ab1802ed0e0 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -78,7 +78,7 @@ #include "BLI_threads.h" #ifdef WITH_OPENEXR -EnumPropertyItem rna_enum_exr_codec_items[] = { +const EnumPropertyItem rna_enum_exr_codec_items[] = { {R_IMF_EXR_CODEC_NONE, "NONE", 0, "None", ""}, {R_IMF_EXR_CODEC_PXR24, "PXR24", 0, "Pxr24 (lossy)", ""}, {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""}, @@ -95,14 +95,14 @@ EnumPropertyItem rna_enum_exr_codec_items[] = { #endif #ifndef RNA_RUNTIME -static EnumPropertyItem uv_sculpt_relaxation_items[] = { +static const EnumPropertyItem uv_sculpt_relaxation_items[] = { {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"}, {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"}, {0, NULL, 0, NULL, NULL} }; #endif -EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = { +const EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = { {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"}, {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"}, {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"}, @@ -110,7 +110,7 @@ EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = { }; -EnumPropertyItem rna_enum_snap_target_items[] = { +const EnumPropertyItem rna_enum_snap_target_items[] = { {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"}, {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target"}, {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"}, @@ -118,7 +118,7 @@ EnumPropertyItem rna_enum_snap_target_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_proportional_falloff_items[] = { +const EnumPropertyItem rna_enum_proportional_falloff_items[] = { {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"}, {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"}, {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"}, @@ -131,7 +131,7 @@ EnumPropertyItem rna_enum_proportional_falloff_items[] = { }; /* subset of the enum - only curves, missing random and const */ -EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[] = { +const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[] = { {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"}, {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"}, {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"}, @@ -142,7 +142,7 @@ EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[] = { }; -EnumPropertyItem rna_enum_proportional_editing_items[] = { +const EnumPropertyItem rna_enum_proportional_editing_items[] = { {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"}, {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"}, {PROP_EDIT_PROJECTED, "PROJECTED", ICON_PROP_ON, "Projected (2D)", @@ -153,14 +153,14 @@ EnumPropertyItem rna_enum_proportional_editing_items[] = { }; /* keep for operators, not used here */ -EnumPropertyItem rna_enum_mesh_select_mode_items[] = { +const EnumPropertyItem rna_enum_mesh_select_mode_items[] = { {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"}, {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"}, {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_snap_element_items[] = { +const EnumPropertyItem rna_enum_snap_element_items[] = { {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"}, {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"}, @@ -169,7 +169,7 @@ EnumPropertyItem rna_enum_snap_element_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_snap_node_element_items[] = { +const EnumPropertyItem rna_enum_snap_node_element_items[] = { {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_GRID, "Grid", "Snap to grid"}, {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"}, {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"}, @@ -178,14 +178,14 @@ EnumPropertyItem rna_enum_snap_node_element_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem snap_uv_element_items[] = { +static const EnumPropertyItem snap_uv_element_items[] = { {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"}, {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, {0, NULL, 0, NULL, NULL} }; #endif -EnumPropertyItem rna_enum_curve_fit_method_items[] = { +const EnumPropertyItem rna_enum_curve_fit_method_items[] = { {CURVE_PAINT_FIT_METHOD_REFIT, "REFIT", 0, "Refit", "Incrementally re-fit the curve (high quality)"}, {CURVE_PAINT_FIT_METHOD_SPLIT, "SPLIT", 0, "Split", "Split the curve until the tolerance is met (fast)"}, {0, NULL, 0, NULL, NULL}}; @@ -270,7 +270,7 @@ EnumPropertyItem rna_enum_curve_fit_method_items[] = { #ifdef RNA_RUNTIME -static EnumPropertyItem image_only_type_items[] = { +static const EnumPropertyItem image_only_type_items[] = { IMAGE_TYPE_ITEMS_IMAGE_ONLY @@ -278,7 +278,7 @@ static EnumPropertyItem image_only_type_items[] = { }; #endif -EnumPropertyItem rna_enum_image_type_items[] = { +const EnumPropertyItem rna_enum_image_type_items[] = { {0, "", 0, N_("Image"), NULL}, IMAGE_TYPE_ITEMS_IMAGE_ONLY @@ -295,7 +295,7 @@ EnumPropertyItem rna_enum_image_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_image_color_mode_items[] = { +const EnumPropertyItem rna_enum_image_color_mode_items[] = { {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"}, {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"}, {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"}, @@ -308,7 +308,7 @@ EnumPropertyItem rna_enum_image_color_mode_items[] = { #define IMAGE_COLOR_MODE_RGBA rna_enum_image_color_mode_items[2] #endif -EnumPropertyItem rna_enum_image_color_depth_items[] = { +const EnumPropertyItem rna_enum_image_color_depth_items[] = { /* 1 (monochrome) not used */ {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"}, {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"}, @@ -319,13 +319,13 @@ EnumPropertyItem rna_enum_image_color_depth_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_normal_space_items[] = { +const EnumPropertyItem rna_enum_normal_space_items[] = { {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"}, {R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_normal_swizzle_items[] = { +const EnumPropertyItem rna_enum_normal_swizzle_items[] = { {R_BAKE_POSX, "POS_X", 0, "+X", ""}, {R_BAKE_POSY, "POS_Y", 0, "+Y", ""}, {R_BAKE_POSZ, "POS_Z", 0, "+Z", ""}, @@ -335,7 +335,7 @@ EnumPropertyItem rna_enum_normal_swizzle_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_bake_save_mode_items[] = { +const EnumPropertyItem rna_enum_bake_save_mode_items[] = { {R_BAKE_SAVE_INTERNAL, "INTERNAL", 0, "Internal", "Save the baking map in an internal image data-block"}, {R_BAKE_SAVE_EXTERNAL, "EXTERNAL", 0, "External", "Save the baking map in an external file"}, {0, NULL, 0, NULL, NULL} @@ -347,19 +347,19 @@ EnumPropertyItem rna_enum_bake_save_mode_items[] = { "Single file with an encoded stereo pair"}, #define R_IMF_VIEWS_ENUM_MV {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"}, -EnumPropertyItem rna_enum_views_format_items[] = { +const EnumPropertyItem rna_enum_views_format_items[] = { R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_views_format_multilayer_items[] = { +const EnumPropertyItem rna_enum_views_format_multilayer_items[] = { R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_MV {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_views_format_multiview_items[] = { +const EnumPropertyItem rna_enum_views_format_multiview_items[] = { R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D R_IMF_VIEWS_ENUM_MV @@ -370,7 +370,7 @@ EnumPropertyItem rna_enum_views_format_multiview_items[] = { #undef R_IMF_VIEWS_ENUM_S3D #undef R_IMF_VIEWS_ENUM_MV -EnumPropertyItem rna_enum_stereo3d_display_items[] = { +const EnumPropertyItem rna_enum_stereo3d_display_items[] = { {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", "Render views for left and right eyes as two differently filtered colors in a single image " "(anaglyph glasses are required)"}, @@ -383,21 +383,21 @@ EnumPropertyItem rna_enum_stereo3d_display_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[] = { +const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[] = { {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""}, {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""}, {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_stereo3d_interlace_type_items[] = { +const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[] = { {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""}, {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""}, {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = { +const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = { {R_BAKE_PASS_FILTER_NONE, "NONE", 0, "None", ""}, {R_BAKE_PASS_FILTER_AO, "AO", 0, "AO", ""}, {R_BAKE_PASS_FILTER_EMIT, "EMIT", 0, "Emit", ""}, @@ -412,7 +412,7 @@ EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { +static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { /* interpolation */ {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"}, {GP_IPO_LINEAR, "LINEAR", ICON_IPO_LINEAR, "Linear", "Straight-line interpolation between A and B (i.e. no ease in/out)"}, @@ -438,7 +438,7 @@ static EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { #endif -EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = { +const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = { {COLLECTION_MODE_OBJECT, "OBJECT", 0, "Object", ""}, {COLLECTION_MODE_EDIT, "EDIT", 0, "Edit", ""}, {COLLECTION_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""}, @@ -454,6 +454,7 @@ EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[] = { #include "DNA_object_types.h" #include "DNA_mesh_types.h" #include "DNA_text_types.h" +#include "DNA_workspace_types.h" #include "RNA_access.h" @@ -1007,6 +1008,11 @@ static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *ite rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip); } +static char *rna_ViewRenderSettings_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_sprintfN("viewport_render"); +} + static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("render"); @@ -1144,7 +1150,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf( +static const EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ID *id = ptr->id.data; @@ -1156,7 +1162,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf( } } -static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf( +static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -1201,7 +1207,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf( } } -static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf( +static const EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -1213,11 +1219,11 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf( const int depth_ok = BKE_imtype_valid_depths(imf->imtype); const int is_float = ELEM(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER); - EnumPropertyItem *item_8bit = &rna_enum_image_color_depth_items[0]; - EnumPropertyItem *item_10bit = &rna_enum_image_color_depth_items[1]; - EnumPropertyItem *item_12bit = &rna_enum_image_color_depth_items[2]; - EnumPropertyItem *item_16bit = &rna_enum_image_color_depth_items[3]; - EnumPropertyItem *item_32bit = &rna_enum_image_color_depth_items[4]; + const EnumPropertyItem *item_8bit = &rna_enum_image_color_depth_items[0]; + const EnumPropertyItem *item_10bit = &rna_enum_image_color_depth_items[1]; + const EnumPropertyItem *item_12bit = &rna_enum_image_color_depth_items[2]; + const EnumPropertyItem *item_16bit = &rna_enum_image_color_depth_items[3]; + const EnumPropertyItem *item_32bit = &rna_enum_image_color_depth_items[4]; int totitem = 0; EnumPropertyItem *item = NULL; @@ -1264,7 +1270,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf( } } -static EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf( +static const EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -1286,7 +1292,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf( #ifdef WITH_OPENEXR /* OpenEXR */ -static EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf( +static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { ImageFormatData *imf = (ImageFormatData *)ptr->data; @@ -1482,19 +1488,32 @@ static void rna_RenderView_remove( WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL); } -static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value) +static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) { RenderData *rd = (RenderData *)ptr->data; - RenderEngineType *type = BLI_findlink(&R_engines, value); - Scene *scene = (Scene *)ptr->id.data; - if (type) - BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine)); + if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && + value == SCE_VIEWS_FORMAT_STEREO_3D) + { + /* make sure the actview is visible */ + if (rd->actview > 1) rd->actview = 1; + } + + rd->views_format = value; +} + +static void rna_ViewRenderSettings_engine_set(PointerRNA *ptr, int value) +{ + ViewRender *view_render = (ViewRender *)ptr->data; + RenderEngineType *type = BLI_findlink(&R_engines, value); - DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE); + if (type) { + BLI_strncpy_utf8(view_render->engine_id, type->idname, sizeof(view_render->engine_id)); + DEG_id_tag_update(ptr->id.data, DEG_TAG_COPY_ON_WRITE); + } } -static EnumPropertyItem *rna_RenderSettings_engine_itemf( +static const EnumPropertyItem *rna_ViewRenderSettings_engine_itemf( bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { RenderEngineType *type; @@ -1515,20 +1534,20 @@ static EnumPropertyItem *rna_RenderSettings_engine_itemf( return item; } -static int rna_RenderSettings_engine_get(PointerRNA *ptr) +static int rna_ViewRenderSettings_engine_get(PointerRNA *ptr) { - RenderData *rd = (RenderData *)ptr->data; + ViewRender *view_render = (ViewRender *)ptr->data; RenderEngineType *type; int a = 0; for (type = R_engines.first; type; type = type->next, a++) - if (STREQ(type->idname, rd->engine)) + if (STREQ(type->idname, view_render->engine_id)) return a; return 0; } -static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) +static void rna_ViewRenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) { ED_render_engine_changed(bmain); } @@ -1624,44 +1643,30 @@ static char *rna_SceneRenderView_path(PointerRNA *ptr) return BLI_sprintfN("render.views[\"%s\"]", srv->name); } -static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value) -{ - RenderData *rd = (RenderData *)ptr->data; - - if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && - value == SCE_VIEWS_FORMAT_STEREO_3D) - { - /* make sure the actview is visible */ - if (rd->actview > 1) rd->actview = 1; - } - - rd->views_format = value; -} - -static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) +static int rna_ViewRenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) { return (BLI_listbase_count(&R_engines) > 1); } -static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr) +static int rna_ViewRenderSettings_use_shading_nodes_get(PointerRNA *ptr) { - Scene *scene = (Scene *)ptr->id.data; - return BKE_scene_use_new_shading_nodes(scene); + ViewRender *view_render = (ViewRender *)ptr->data; + return BKE_viewrender_use_new_shading_nodes(view_render); } -static int rna_RenderSettings_use_spherical_stereo_get(PointerRNA *ptr) +static int rna_ViewRenderSettings_use_spherical_stereo_get(PointerRNA *ptr) { - Scene *scene = (Scene *)ptr->id.data; - return BKE_scene_use_spherical_stereo(scene); + ViewRender *view_render = (ViewRender *)ptr->data; + return BKE_viewrender_use_spherical_stereo(view_render); } -static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr) +static int rna_ViewRenderSettings_use_game_engine_get(PointerRNA *ptr) { - RenderData *rd = (RenderData *)ptr->data; + ViewRender *view_render = (ViewRender *)ptr->data; RenderEngineType *type; for (type = R_engines.first; type; type = type->next) - if (STREQ(type->idname, rd->engine)) + if (STREQ(type->idname, view_render->engine_id)) return (type->flag & RE_GAME) != 0; return 0; @@ -1771,26 +1776,32 @@ static void object_simplify_update(Object *ob) } } -static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Scene_use_simplify_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Scene *sce = ptr->id.data; Scene *sce_iter; Base *base; - BKE_main_id_tag_listbase(&bmain->object, LIB_TAG_DOIT, true); - for (SETLOOPER(sce, sce_iter, base)) + FOREACH_SCENE_OBJECT(sce, ob) + { + object_simplify_update(ob); + } + FOREACH_SCENE_OBJECT_END + + for (SETLOOPER_SET_ONLY(sce, sce_iter, base)) { object_simplify_update(base->object); + } WM_main_add_notifier(NC_GEOM | ND_DATA, NULL); - DEG_id_tag_update(&scene->id, 0); + DEG_id_tag_update(&sce->id, 0); } -static void rna_Scene_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) +static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Scene *sce = ptr->id.data; if (sce->r.mode & R_SIMPLIFY) - rna_Scene_use_simplify_update(bmain, sce, ptr); + rna_Scene_use_simplify_update(bmain, scene, ptr); } static void rna_SceneRenderData_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -2977,59 +2988,6 @@ static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, Po rna_iterator_listbase_begin(iter, &sl->object_bases, rna_SceneLayer_objects_selected_skip); } -static void rna_SceneLayer_engine_set(PointerRNA *ptr, int value) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - RenderEngineType *type = BLI_findlink(&R_engines, value); - - if (type) - BKE_scene_layer_engine_set(sl, type->idname); -} - -static EnumPropertyItem *rna_SceneLayer_engine_itemf( - bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) -{ - RenderEngineType *type; - EnumPropertyItem *item = NULL; - EnumPropertyItem tmp = {0, "", 0, "", ""}; - int a = 0, totitem = 0; - - for (type = R_engines.first; type; type = type->next, a++) { - tmp.value = a; - tmp.identifier = type->idname; - tmp.name = type->name; - RNA_enum_item_add(&item, &totitem, &tmp); - } - - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; -} - -static int rna_SceneLayer_engine_get(PointerRNA *ptr) -{ - SceneLayer *sl = (SceneLayer *)ptr->data; - RenderEngineType *type; - int a = 0; - - for (type = R_engines.first; type; type = type->next, a++) - if (STREQ(type->idname, sl->engine)) - return a; - - return 0; -} - -static void rna_SceneLayer_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr)) -{ - ED_render_engine_changed(bmain); -} - -static int rna_SceneLayer_multiple_engines_get(PointerRNA *UNUSED(ptr)) -{ - return (BLI_listbase_count(&R_engines) > 1); -} - static void rna_SceneLayer_update_tagged(SceneLayer *UNUSED(sl), bContext *C) { Depsgraph *graph = CTX_data_depsgraph(C); @@ -3383,7 +3341,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem uv_select_mode_items[] = { + static const EnumPropertyItem uv_select_mode_items[] = { {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"}, {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"}, {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"}, @@ -3395,20 +3353,20 @@ static void rna_def_tool_settings(BlenderRNA *brna) * with 1st position only for for on/off (and exposed as boolean), while others are mutually * exclusive options but which will only have any effect when autokey is enabled */ - static EnumPropertyItem auto_key_items[] = { + static const EnumPropertyItem auto_key_items[] = { {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""}, {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem retarget_roll_items[] = { + static const EnumPropertyItem retarget_roll_items[] = { {SK_RETARGET_ROLL_NONE, "NONE", 0, "None", "Don't adjust roll"}, {SK_RETARGET_ROLL_VIEW, "VIEW", 0, "View", "Roll bones to face the view"}, {SK_RETARGET_ROLL_JOINT, "JOINT", 0, "Joint", "Roll bone to original joint plane offset"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem sketch_convert_items[] = { + static const EnumPropertyItem sketch_convert_items[] = { {SK_CONVERT_CUT_FIXED, "FIXED", 0, "Fixed", "Subdivide stroke in fixed number of bones"}, {SK_CONVERT_CUT_LENGTH, "LENGTH", 0, "Length", "Subdivide stroke in bones of specific length"}, {SK_CONVERT_CUT_ADAPTATIVE, "ADAPTIVE", 0, "Adaptive", @@ -3417,7 +3375,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem edge_tag_items[] = { + static const EnumPropertyItem edge_tag_items[] = { {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""}, {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""}, {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""}, @@ -3427,21 +3385,21 @@ static void rna_def_tool_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem draw_groupuser_items[] = { + static const EnumPropertyItem draw_groupuser_items[] = { {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""}, {OB_DRAW_GROUPUSER_ACTIVE, "ACTIVE", 0, "Active", "Show vertices with no weights in the active group"}, {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem vertex_group_select_items[] = { + static const EnumPropertyItem vertex_group_select_items[] = { {WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"}, {WT_VGROUP_BONE_DEFORM, "BONE_DEFORM", 0, "Deform", "Vertex Groups assigned to Deform Bones"}, {WT_VGROUP_BONE_DEFORM_OFF, "OTHER_DEFORM", 0, "Other", "Vertex Groups assigned to non Deform Bones"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem gpencil_source_3d_items[] = { + static const EnumPropertyItem gpencil_source_3d_items[] = { {GP_TOOL_SOURCE_SCENE, "SCENE", 0, "Scene", "Grease Pencil data attached to the current scene is used, " "unless the active object already has Grease Pencil data (i.e. for old files)"}, @@ -3451,7 +3409,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem gpencil_stroke_placement_items[] = { + static const EnumPropertyItem gpencil_stroke_placement_items[] = { {GP_PROJECT_VIEWSPACE, "CURSOR", 0, "Cursor", "Draw stroke at the 3D cursor"}, {0, "VIEW", 0, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */ {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", 0, "Surface", "Stick stroke to surfaces"}, @@ -4012,7 +3970,7 @@ static void rna_def_curve_paint_settings(BlenderRNA *brna) RNA_def_struct_path_func(srna, "rna_CurvePaintSettings_path"); RNA_def_struct_ui_text(srna, "Curve Paint Settings", ""); - static EnumPropertyItem curve_type_items[] = { + static const EnumPropertyItem curve_type_items[] = { {CU_POLY, "POLY", 0, "Poly", ""}, {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, {0, NULL, 0, NULL, NULL}}; @@ -4079,7 +4037,7 @@ static void rna_def_curve_paint_settings(BlenderRNA *brna) RNA_def_property_ui_range(prop, -1.0f, 1.0, 1, 2); RNA_def_property_ui_text(prop, "Offset", "Offset the stroke from the surface"); - static EnumPropertyItem depth_mode_items[] = { + static const EnumPropertyItem depth_mode_items[] = { {CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""}, {CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""}, {0, NULL, 0, NULL, NULL}}; @@ -4089,7 +4047,7 @@ static void rna_def_curve_paint_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, depth_mode_items); RNA_def_property_ui_text(prop, "Depth", "Method of projecting depth"); - static EnumPropertyItem surface_plane_items[] = { + static const EnumPropertyItem surface_plane_items[] = { {CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW, "NORMAL_VIEW", 0, "Normal/View", "Draw perpendicular to the surface"}, {CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE, "NORMAL_SURFACE", 0, "Normal/Surface", "Draw aligned to the surface"}, {CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Draw aligned to the viewport"}, @@ -4106,7 +4064,7 @@ static void rna_def_statvis(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem stat_type[] = { + static const EnumPropertyItem stat_type[] = { {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""}, {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""}, {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""}, @@ -4222,14 +4180,14 @@ static void rna_def_unit_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem unit_systems[] = { + static const EnumPropertyItem unit_systems[] = { {USER_UNIT_NONE, "NONE", 0, "None", ""}, {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""}, {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem rotation_units[] = { + static const EnumPropertyItem rotation_units[] = { {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"}, {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""}, {0, NULL, 0, NULL, NULL} @@ -4712,42 +4670,42 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem edge_type_negation_items[] = { + static const EnumPropertyItem edge_type_negation_items[] = { {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions"}, {FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not satisfying the given edge type conditions"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem edge_type_combination_items[] = { + static const EnumPropertyItem edge_type_combination_items[] = { {0, "OR", 0, "Logical OR", "Select feature edges satisfying at least one of edge type conditions"}, {FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND", "Select feature edges satisfying all edge type conditions"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem group_negation_items[] = { + static const EnumPropertyItem group_negation_items[] = { {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges belonging to some object in the group"}, {FREESTYLE_LINESET_GR_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not belonging to any object in the group"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem face_mark_negation_items[] = { + static const EnumPropertyItem face_mark_negation_items[] = { {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given face mark conditions"}, {FREESTYLE_LINESET_FM_NOT, "EXCLUSIVE", 0, "Exclusive", "Select feature edges not satisfying the given face mark conditions"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem face_mark_condition_items[] = { + static const EnumPropertyItem face_mark_condition_items[] = { {0, "ONE", 0, "One Face", "Select a feature edge if either of its adjacent faces is marked"}, {FREESTYLE_LINESET_FM_BOTH, "BOTH", 0, "Both Faces", "Select a feature edge if both of its adjacent faces are marked"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem freestyle_ui_mode_items[] = { + static const EnumPropertyItem freestyle_ui_mode_items[] = { {FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode", "Advanced mode for using style modules written in Python"}, {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode", @@ -4755,7 +4713,7 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem visibility_items[] = { + static const EnumPropertyItem visibility_items[] = { {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"}, {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"}, {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range", @@ -5082,7 +5040,7 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem rna_enum_partitioning_items[] = { + static const EnumPropertyItem rna_enum_partitioning_items[] = { {RC_PARTITION_WATERSHED, "WATERSHED", 0, "Watershed", "Classic Recast partitioning method generating the nicest tessellation"}, {RC_PARTITION_MONOTONE, "MONOTONE", 0, "Monotone", "Fastest navmesh generation method, may create long thin polygons"}, {RC_PARTITION_LAYERS, "LAYERS", 0, "Layers", "Reasonably fast method that produces better triangles than monotone partitioning"}, @@ -5362,7 +5320,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem aasamples_items[] = { + static const EnumPropertyItem aasamples_items[] = { {0, "SAMPLES_0", 0, "Off", ""}, {2, "SAMPLES_2", 0, "2x", ""}, {4, "SAMPLES_4", 0, "4x", ""}, @@ -5371,7 +5329,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem framing_types_items[] = { + static const EnumPropertyItem framing_types_items[] = { {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox", "Show the entire viewport in the display window, using bar horizontally or vertically"}, {SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend", @@ -5381,7 +5339,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem dome_modes_items[] = { + static const EnumPropertyItem dome_modes_items[] = { {DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""}, {DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""}, {DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""}, @@ -5390,7 +5348,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem stereo_modes_items[] = { + static const EnumPropertyItem stereo_modes_items[] = { {STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""}, {STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""}, {STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""}, @@ -5401,40 +5359,40 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem stereo_items[] = { + static const EnumPropertyItem stereo_items[] = { {STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"}, {STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"}, {STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem physics_engine_items[] = { + static const EnumPropertyItem physics_engine_items[] = { {WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"}, {WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem material_items[] = { + static const EnumPropertyItem material_items[] = { {GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"}, {GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem obstacle_simulation_items[] = { + static const EnumPropertyItem obstacle_simulation_items[] = { {OBSTSIMULATION_NONE, "NONE", 0, "None", ""}, {OBSTSIMULATION_TOI_rays, "RVO_RAYS", 0, "RVO (rays)", ""}, {OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem vsync_items[] = { + static const EnumPropertyItem vsync_items[] = { {VSYNC_OFF, "OFF", 0, "Off", "Disable vsync"}, {VSYNC_ON, "ON", 0, "On", "Enable vsync"}, {VSYNC_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", "Enable adaptive vsync (if supported)"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem storage_items[] = { + static const EnumPropertyItem storage_items[] = { {RAS_STORE_AUTO, "AUTO", 0, "Auto Select", "Choose the best supported mode"}, {RAS_STORE_VA, "VERTEX_ARRAY", 0, "Vertex Arrays", "Usually the best choice (good performance with display lists)"}, {RAS_STORE_VBO, "VERTEX_BUFFER_OBJECT", 0, "Vertex Buffer Objects", @@ -6153,13 +6111,13 @@ static void rna_def_scene_layer_engine_settings_eevee(BlenderRNA *brna) PropertyRNA *prop; /* Keep in sync with eevee_private.h */ - static EnumPropertyItem eevee_shadow_method_items[] = { + static const EnumPropertyItem eevee_shadow_method_items[] = { {1, "ESM", 0, "ESM", "Exponential Shadow Mapping"}, {2, "VSM", 0, "VSM", "Variance Shadow Mapping"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem eevee_shadow_size_items[] = { + static const EnumPropertyItem eevee_shadow_size_items[] = { {64, "64", 0, "64px", ""}, {128, "128", 0, "128px", ""}, {256, "256", 0, "256px", ""}, @@ -6555,7 +6513,7 @@ static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem clay_matcap_items[] = { + static const EnumPropertyItem clay_matcap_items[] = { {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""}, {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""}, {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""}, @@ -7067,11 +7025,6 @@ static void rna_def_scene_layer(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem engine_items[] = { - {0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering"}, - {0, NULL, 0, NULL, NULL} - }; - srna = RNA_def_struct(brna, "SceneLayer", NULL); RNA_def_struct_ui_text(srna, "Render Layer", "Render layer"); RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS); @@ -7107,20 +7060,6 @@ static void rna_def_scene_layer(BlenderRNA *brna) RNA_def_property_struct_type(prop, "SceneLayerSettings"); RNA_def_property_ui_text(prop, "Layer Settings", "Override of engine specific render settings"); - /* engine */ - prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, engine_items); - RNA_def_property_enum_funcs(prop, "rna_SceneLayer_engine_get", "rna_SceneLayer_engine_set", - "rna_SceneLayer_engine_itemf"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); - RNA_def_property_update(prop, NC_WINDOW, "rna_SceneLayer_engine_update"); - - prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_SceneLayer_multiple_engines_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available"); - /* debug update routine */ func = RNA_def_function(srna, "update", "rna_SceneLayer_update_tagged"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); @@ -7353,7 +7292,7 @@ static void rna_def_image_format_stereo3d_format(BlenderRNA *brna) PropertyRNA *prop; /* rna_enum_stereo3d_display_items, without (S3D_DISPLAY_PAGEFLIP) */ - static EnumPropertyItem stereo3d_display_items[] = { + static const EnumPropertyItem stereo3d_display_items[] = { {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", "Render views for left and right eyes as two differently filtered colors in a single image " "(anaglyph glasses are required)"}, @@ -7410,7 +7349,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) { #ifdef WITH_OPENJPEG - static EnumPropertyItem jp2_codec_items[] = { + static const EnumPropertyItem jp2_codec_items[] = { {R_IMF_JP2_CODEC_JP2, "JP2", 0, "JP2", ""}, {R_IMF_JP2_CODEC_J2K, "J2K", 0, "J2K", ""}, {0, NULL, 0, NULL, NULL} @@ -7418,7 +7357,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) #endif #ifdef WITH_TIFF - static EnumPropertyItem tiff_codec_items[] = { + static const EnumPropertyItem tiff_codec_items[] = { {R_IMF_TIFF_CODEC_NONE, "NONE", 0, "None", ""}, {R_IMF_TIFF_CODEC_DEFLATE, "DEFLATE", 0, "Deflate", ""}, {R_IMF_TIFF_CODEC_LZW, "LZW", 0, "LZW", ""}, @@ -7593,7 +7532,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) #ifdef WITH_FFMPEG /* Container types */ - static EnumPropertyItem ffmpeg_format_items[] = { + static const EnumPropertyItem ffmpeg_format_items[] = { {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""}, {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""}, {FFMPEG_MPEG4, "MPEG4", 0, "MPEG-4", ""}, @@ -7608,7 +7547,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem ffmpeg_codec_items[] = { + static const EnumPropertyItem ffmpeg_codec_items[] = { {AV_CODEC_ID_NONE, "NONE", 0, "None", ""}, {AV_CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""}, {AV_CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""}, @@ -7625,7 +7564,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem ffmpeg_preset_items[] = { + static const EnumPropertyItem ffmpeg_preset_items[] = { {FFM_PRESET_ULTRAFAST, "ULTRAFAST", 0, "Ultra fast; biggest file", ""}, {FFM_PRESET_SUPERFAST, "SUPERFAST", 0, "Super fast", ""}, {FFM_PRESET_VERYFAST, "VERYFAST", 0, "Very fast", ""}, @@ -7638,7 +7577,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem ffmpeg_crf_items[] = { + static const EnumPropertyItem ffmpeg_crf_items[] = { {FFM_CRF_NONE, "NONE", 0, "None; use constant bit-rate", "Use constant bit rate, rather than constant output quality"}, {FFM_CRF_LOSSLESS, "LOSSLESS", 0, "Lossless", ""}, @@ -7651,7 +7590,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem ffmpeg_audio_codec_items[] = { + static const EnumPropertyItem ffmpeg_audio_codec_items[] = { {AV_CODEC_ID_NONE, "NONE", 0, "None", ""}, {AV_CODEC_ID_MP2, "MP2", 0, "MP2", ""}, {AV_CODEC_ID_MP3, "MP3", 0, "MP3", ""}, @@ -7664,7 +7603,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) }; #endif - static EnumPropertyItem audio_channel_items[] = { + static const EnumPropertyItem audio_channel_items[] = { {1, "MONO", 0, "Mono", "Set audio channels to mono"}, {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"}, {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"}, @@ -7832,7 +7771,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem pixel_filter_items[] = { + static const EnumPropertyItem pixel_filter_items[] = { {R_FILTER_BOX, "BOX", 0, "Box", "Use a box filter for anti-aliasing"}, {R_FILTER_TENT, "TENT", 0, "Tent", "Use a tent filter for anti-aliasing"}, {R_FILTER_QUAD, "QUADRATIC", 0, "Quadratic", "Use a quadratic filter for anti-aliasing"}, @@ -7843,13 +7782,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem alpha_mode_items[] = { + static const EnumPropertyItem alpha_mode_items[] = { {R_ADDSKY, "SKY", 0, "Sky", "Transparent pixels are filled with sky color"}, {R_ALPHAPREMUL, "TRANSPARENT", 0, "Transparent", "World background is transparent with premultiplied alpha"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem display_mode_items[] = { + static const EnumPropertyItem display_mode_items[] = { {R_OUTPUT_SCREEN, "SCREEN", 0, "Full Screen", "Images are rendered in full Screen"}, {R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in Image Editor"}, {R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in new Window"}, @@ -7858,7 +7797,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) }; /* Bake */ - static EnumPropertyItem bake_mode_items[] = { + static const EnumPropertyItem bake_mode_items[] = { {RE_BAKE_ALL, "FULL", 0, "Full Render", "Bake everything"}, {RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"}, {RE_BAKE_SHADOW, "SHADOW", 0, "Shadow", "Bake shadows"}, @@ -7876,7 +7815,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bake_normal_space_items[] = { + static const EnumPropertyItem bake_normal_space_items[] = { {R_BAKE_SPACE_CAMERA, "CAMERA", 0, "Camera", "Bake the normals in camera space"}, {R_BAKE_SPACE_WORLD, "WORLD", 0, "World", "Bake the normals in world space"}, {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"}, @@ -7884,14 +7823,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bake_qyad_split_items[] = { + static const EnumPropertyItem bake_qyad_split_items[] = { {0, "AUTO", 0, "Automatic", "Split quads to give the least distortion while baking"}, {1, "FIXED", 0, "Fixed", "Split quads predictably (0,1,2) (0,2,3)"}, {2, "FIXED_ALT", 0, "Fixed Alternate", "Split quads predictably (1,2,3) (1,3,0)"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem pixel_size_items[] = { + static const EnumPropertyItem pixel_size_items[] = { {0, "AUTO", 0, "Automatic", "Automatic pixel size, depends on the UI scale"}, {1, "1", 0, "1x", "Render at full resolution"}, {2, "2", 0, "2x", "Render at 50% resolution"}, @@ -7900,7 +7839,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem octree_resolution_items[] = { + static const EnumPropertyItem octree_resolution_items[] = { {64, "64", 0, "64", ""}, {128, "128", 0, "128", ""}, {256, "256", 0, "256", ""}, @@ -7908,7 +7847,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem raytrace_structure_items[] = { + static const EnumPropertyItem raytrace_structure_items[] = { {R_RAYSTRUCTURE_AUTO, "AUTO", 0, "Auto", "Automatically select acceleration structure"}, {R_RAYSTRUCTURE_OCTREE, "OCTREE", 0, "Octree", "Use old Octree structure"}, {R_RAYSTRUCTURE_VBVH, "VBVH", 0, "vBVH", "Use vBVH"}, @@ -7917,7 +7856,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem fixed_oversample_items[] = { + static const EnumPropertyItem fixed_oversample_items[] = { {5, "5", 0, "5", ""}, {8, "8", 0, "8", ""}, {11, "11", 0, "11", ""}, @@ -7925,31 +7864,26 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem field_order_items[] = { + static const EnumPropertyItem field_order_items[] = { {0, "EVEN_FIRST", 0, "Upper First", "Upper field first"}, {R_ODDFIELD, "ODD_FIRST", 0, "Lower First", "Lower field first"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem threads_mode_items[] = { + static const EnumPropertyItem threads_mode_items[] = { {0, "AUTO", 0, "Auto-detect", "Automatically determine the number of threads, based on CPUs"}, {R_FIXED_THREADS, "FIXED", 0, "Fixed", "Manually determine the number of threads"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem engine_items[] = { - {0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering"}, - {0, NULL, 0, NULL, NULL} - }; - - static EnumPropertyItem freestyle_thickness_items[] = { + static const EnumPropertyItem freestyle_thickness_items[] = { {R_LINE_THICKNESS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Specify unit line thickness in pixels"}, {R_LINE_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", "Unit line thickness is scaled by the proportion of the present vertical image " "resolution to 480 pixels"}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem views_format_items[] = { + static const EnumPropertyItem views_format_items[] = { {SCE_VIEWS_FORMAT_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", "Single stereo camera system, adjust the stereo settings in the camera panel"}, {SCE_VIEWS_FORMAT_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", @@ -8678,35 +8612,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_views_format_set", NULL); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - /* engine */ - prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, engine_items); - RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set", - "rna_RenderSettings_engine_itemf"); - RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); - RNA_def_property_update(prop, NC_WINDOW, "rna_RenderSettings_engine_update"); - - prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_multiple_engines_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available"); - - prop = RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_shading_nodes_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system"); - - prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_spherical_stereo_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Use Spherical Stereo", "Active render engine supports spherical stereo rendering"); - - prop = RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_game_engine_get", NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine"); - /* simplify */ prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SIMPLIFY); @@ -8788,6 +8693,52 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_api_scene_render(srna); } +static void rna_def_scene_view_render(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static const EnumPropertyItem engine_items[] = { + {0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "ViewRenderSettings", NULL); + RNA_def_struct_sdna(srna, "ViewRender"); + RNA_def_struct_nested(brna, srna, "Scene"); + RNA_def_struct_path_func(srna, "rna_ViewRenderSettings_path"); + RNA_def_struct_ui_text(srna, "View Render", "Rendering settings related to viewport drawing/rendering"); + + /* engine */ + prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, engine_items); + RNA_def_property_enum_funcs(prop, "rna_ViewRenderSettings_engine_get", "rna_ViewRenderSettings_engine_set", + "rna_ViewRenderSettings_engine_itemf"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); + RNA_def_property_update(prop, NC_WINDOW, "rna_ViewRenderSettings_engine_update"); + + prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_multiple_engines_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available"); + + prop = RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_shading_nodes_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system"); + + prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_spherical_stereo_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Spherical Stereo", "Active render engine supports spherical stereo rendering"); + + prop = RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_ViewRenderSettings_use_game_engine_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine"); +} + /* scene.objects */ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) { @@ -9031,7 +8982,7 @@ void RNA_def_scene(BlenderRNA *brna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem audio_distance_model_items[] = { + static const EnumPropertyItem audio_distance_model_items[] = { {0, "NONE", 0, "None", "No distance attenuation"}, {1, "INVERSE", 0, "Inverse", "Inverse distance model"}, {2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping"}, @@ -9042,7 +8993,7 @@ void RNA_def_scene(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem sync_mode_items[] = { + static const EnumPropertyItem sync_mode_items[] = { {0, "NONE", 0, "No Sync", "Do not sync, play every frame"}, {SCE_FRAME_DROP, "FRAME_DROP", 0, "Frame Dropping", "Drop frames if playback is too slow"}, {AUDIO_SYNC, "AUDIO_SYNC", 0, "AV-sync", "Sync to audio playback, dropping frames"}, @@ -9335,6 +9286,12 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "RenderSettings"); RNA_def_property_ui_text(prop, "Render Data", ""); + /* View Render */ + prop = RNA_def_property(srna, "view_render", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "ViewRenderSettings"); + RNA_def_property_ui_text(prop, "View Render", ""); + /* Render Engine Data */ prop = RNA_def_property(srna, "layer_properties", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "layer_properties->data.group", NULL); @@ -9497,6 +9454,7 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_scene_layer_settings(brna); rna_def_layer_collection_settings(brna); rna_def_scene_render_data(brna); + rna_def_scene_view_render(brna); rna_def_scene_render_layer(brna); rna_def_gpu_fx(brna); rna_def_scene_render_view(brna); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index a1ef3f17bd6..e4c39aa3b60 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -49,7 +49,7 @@ # include "../../alembic/ABC_alembic.h" #endif -EnumPropertyItem rna_enum_abc_compression_items[] = { +const EnumPropertyItem rna_enum_abc_compression_items[] = { #ifdef WITH_ALEMBIC { ABC_ARCHIVE_OGAWA, "OGAWA", 0, "Ogawa", "" }, { ABC_ARCHIVE_HDF5, "HDF5", 0, "HDF5", "" }, @@ -151,14 +151,24 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, int previe } static void rna_Scene_ray_cast( - Scene *scene, SceneLayer *sl, float origin[3], float direction[3], float ray_dist, + Scene *scene, SceneLayer *scene_layer, const char *engine_id, + float origin[3], float direction[3], float ray_dist, int *r_success, float r_location[3], float r_normal[3], int *r_index, Object **r_ob, float r_obmat[16]) { + RenderEngineType *engine; + + if (engine_id == NULL || engine_id[0] == '\0') { + engine = RE_engines_find(scene->view_render.engine_id); + } + else { + engine = RE_engines_find(engine_id); + } + normalize_v3(direction); SnapObjectContext *sctx = ED_transform_snap_object_context_create( - G.main, scene, sl, 0); + G.main, scene, scene_layer, engine, 0); bool ret = ED_transform_snap_object_project_ray_ex( sctx, @@ -354,6 +364,7 @@ void RNA_api_scene(StructRNA *srna) RNA_def_function_ui_description(func, "Cast a ray onto in object space"); parm = RNA_def_pointer(func, "scene_layer", "SceneLayer", "", "Scene Layer"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + parm = RNA_def_string(func, "engine", NULL, MAX_NAME, "Engine", "Render engine, use scene one by default"); /* ray start and end */ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 13b9b068c2e..21a77019f32 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -37,7 +37,7 @@ #include "DNA_scene_types.h" #include "DNA_workspace_types.h" -EnumPropertyItem rna_enum_region_type_items[] = { +const EnumPropertyItem rna_enum_region_type_items[] = { {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""}, {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""}, {RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""}, @@ -135,7 +135,7 @@ static int rna_Screen_fullscreen_get(PointerRNA *ptr) /* UI compatible list: should not be needed, but for now we need to keep EMPTY * at least in the static version of this enum for python scripts. */ -static EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { /* +1 to skip SPACE_EMPTY */ diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index cfe8670b0f5..551b38771f9 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -49,7 +49,7 @@ #include "BLI_utildefines.h" #include "bmesh.h" -static EnumPropertyItem particle_edit_hair_brush_items[] = { +static const EnumPropertyItem particle_edit_hair_brush_items[] = { {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"}, {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"}, @@ -61,7 +61,7 @@ static EnumPropertyItem particle_edit_hair_brush_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = { +const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = { {GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth stroke points"}, {GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", 0, "Thickness", "Adjust thickness of strokes"}, { GP_EDITBRUSH_TYPE_STRENGTH, "STRENGTH", 0, "Strength", "Adjust color strength of strokes" }, @@ -77,7 +77,7 @@ EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = { +static const EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = { { GP_LOCKAXIS_NONE, "GP_LOCKAXIS_NONE", 0, "None", "" }, { GP_LOCKAXIS_X, "GP_LOCKAXIS_X", 0, "X", "Project strokes to plane locked to X" }, { GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", 0, "Y", "Project strokes to plane locked to Y" }, @@ -86,7 +86,7 @@ static EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = { }; #endif -EnumPropertyItem rna_enum_symmetrize_direction_items[] = { +const EnumPropertyItem rna_enum_symmetrize_direction_items[] = { {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""}, {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""}, @@ -118,7 +118,7 @@ static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); } -static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = { +static const EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = { {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"}, {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"}, @@ -128,7 +128,7 @@ static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem particle_edit_cache_brush_items[] = { +static const EnumPropertyItem particle_edit_cache_brush_items[] = { {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"}, {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"}, @@ -188,7 +188,7 @@ static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) pset->brushtype = value; } -static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { SceneLayer *sl = CTX_data_scene_layer(C); @@ -540,7 +540,7 @@ static void rna_def_paint(BlenderRNA *brna) static void rna_def_sculpt(BlenderRNA *brna) { - static EnumPropertyItem detail_refine_items[] = { + static const EnumPropertyItem detail_refine_items[] = { {SCULPT_DYNTOPO_SUBDIVIDE, "SUBDIVIDE", 0, "Subdivide Edges", "Subdivide long edges to add mesh detail where needed"}, {SCULPT_DYNTOPO_COLLAPSE, "COLLAPSE", 0, @@ -550,7 +550,7 @@ static void rna_def_sculpt(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem detail_type_items[] = { + static const EnumPropertyItem detail_type_items[] = { {0, "RELATIVE", 0, "Relative Detail", "Mesh detail is relative to the brush size and detail size"}, {SCULPT_DYNTOPO_DETAIL_CONSTANT, "CONSTANT", 0, @@ -712,7 +712,7 @@ static void rna_def_image_paint(BlenderRNA *brna) PropertyRNA *prop; FunctionRNA *func; - static EnumPropertyItem paint_type_items[] = { + static const EnumPropertyItem paint_type_items[] = { {IMAGEPAINT_MODE_MATERIAL, "MATERIAL", 0, "Material", "Detect image slots from the material"}, {IMAGEPAINT_MODE_IMAGE, "IMAGE", 0, @@ -843,26 +843,26 @@ static void rna_def_particle_edit(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem select_mode_items[] = { + static const EnumPropertyItem select_mode_items[] = { {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"}, {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"}, {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem puff_mode[] = { + static const EnumPropertyItem puff_mode[] = { {0, "ADD", 0, "Add", "Make hairs more puffy"}, {1, "SUB", 0, "Sub", "Make hairs less puffy"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem length_mode[] = { + static const EnumPropertyItem length_mode[] = { {0, "GROW", 0, "Grow", "Make hairs longer"}, {1, "SHRINK", 0, "Shrink", "Make hairs shorter"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem edit_type_items[] = { + static const EnumPropertyItem edit_type_items[] = { {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""}, {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""}, {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""}, @@ -1028,7 +1028,7 @@ static void rna_def_particle_edit(BlenderRNA *brna) static void rna_def_gpencil_sculpt(BlenderRNA *brna) { - static EnumPropertyItem prop_direction_items[] = { + static const EnumPropertyItem prop_direction_items[] = { {0, "ADD", 0, "Add", "Add effect of brush"}, {GP_EDITBRUSH_FLAG_INVERT, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index d0afab7a1e3..735df471721 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -45,7 +45,7 @@ #include "WM_types.h" /* Always keep in alphabetical order */ -static EnumPropertyItem sensor_type_items[] = { +static const EnumPropertyItem sensor_type_items[] = { {SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""}, {SENS_ALWAYS, "ALWAYS", 0, "Always", ""}, {SENS_ARMATURE, "ARMATURE", 0, "Armature", ""}, @@ -137,7 +137,7 @@ static int rna_Sensor_controllers_length(PointerRNA *ptr) return (int) sens->totlinks; } -EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; Object *ob = NULL; @@ -392,7 +392,7 @@ static void rna_def_mouse_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem mouse_event_items[] = { + static const EnumPropertyItem mouse_event_items[] = { {BL_SENS_MOUSE_LEFT_BUTTON, "LEFTCLICK", 0, "Left Button", ""}, {BL_SENS_MOUSE_MIDDLE_BUTTON, "MIDDLECLICK", 0, "Middle Button", ""}, {BL_SENS_MOUSE_RIGHT_BUTTON, "RIGHTCLICK", 0, "Right Button", ""}, @@ -501,7 +501,7 @@ static void rna_def_property_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {SENS_PROP_EQUAL, "PROPEQUAL", 0, "Equal", ""}, {SENS_PROP_NEQUAL, "PROPNEQUAL", 0, "Not Equal", ""}, {SENS_PROP_INTERVAL, "PROPINTERVAL", 0, "Interval", ""}, @@ -547,7 +547,7 @@ static void rna_def_armature_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_type_items[] = { + static const EnumPropertyItem prop_type_items[] = { {SENS_ARM_STATE_CHANGED, "STATECHG", 0, "State Changed", ""}, {SENS_ARM_LIN_ERROR_BELOW, "LINERRORBELOW", 0, "Lin error below", ""}, {SENS_ARM_LIN_ERROR_ABOVE, "LINERRORABOVE", 0, "Lin error above", ""}, @@ -675,7 +675,7 @@ static void rna_def_radar_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem axis_items[] = { + static const EnumPropertyItem axis_items[] = { {SENS_RADAR_X_AXIS, "XAXIS", 0, "+X axis", ""}, {SENS_RADAR_Y_AXIS, "YAXIS", 0, "+Y axis", ""}, {SENS_RADAR_Z_AXIS, "ZAXIS", 0, "+Z axis", ""}, @@ -731,7 +731,7 @@ static void rna_def_ray_sensor(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem axis_items[] = { + static const EnumPropertyItem axis_items[] = { {SENS_RAY_X_AXIS, "XAXIS", 0, "+X axis", ""}, {SENS_RAY_Y_AXIS, "YAXIS", 0, "+Y axis", ""}, {SENS_RAY_Z_AXIS, "ZAXIS", 0, "+Z axis", ""}, @@ -817,7 +817,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem event_type_joystick_items[] = { + static const EnumPropertyItem event_type_joystick_items[] = { {SENS_JOY_BUTTON, "BUTTON", 0, "Button", ""}, {SENS_JOY_AXIS, "AXIS", 0, "Axis", ""}, {SENS_JOY_HAT, "HAT", 0, "Hat", ""}, @@ -825,7 +825,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem axis_direction_items[] = { + static const EnumPropertyItem axis_direction_items[] = { {SENS_JOY_X_AXIS, "RIGHTAXIS", 0, "Right Axis", ""}, {SENS_JOY_Y_AXIS, "UPAXIS", 0, "Up Axis", ""}, {SENS_JOY_NEG_X_AXIS, "LEFTAXIS", 0, "Left Axis", ""}, @@ -833,7 +833,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem hat_direction_items[] = { + static const EnumPropertyItem hat_direction_items[] = { {SENS_JOY_HAT_UP, "UP", 0, "Up", ""}, {SENS_JOY_HAT_DOWN, "DOWN", 0, "Down", ""}, {SENS_JOY_HAT_LEFT, "LEFT", 0, "Left", ""}, diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 520a1c2f730..fbc29039539 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -60,7 +60,7 @@ typedef struct EffectInfo { int inputs; } EffectInfo; -EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { +const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { {seqModifierType_ColorBalance, "COLOR_BALANCE", ICON_NONE, "Color Balance", ""}, {seqModifierType_Curves, "CURVES", ICON_NONE, "Curves", ""}, {seqModifierType_HueCorrect, "HUE_CORRECT", ICON_NONE, "Hue Correct", ""}, @@ -1328,7 +1328,7 @@ static void rna_def_strip_color_balance(BlenderRNA *brna) RNA_def_struct_sdna(srna, "StripColorBalance"); } -static EnumPropertyItem blend_mode_items[] = { +static const EnumPropertyItem blend_mode_items[] = { {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""}, {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""}, {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, @@ -2308,13 +2308,13 @@ static void rna_def_gaussian_blur(StructRNA *srna) static void rna_def_text(StructRNA *srna) { - static EnumPropertyItem text_align_x_items[] = { + static const EnumPropertyItem text_align_x_items[] = { {SEQ_TEXT_ALIGN_X_LEFT, "LEFT", 0, "Left", ""}, {SEQ_TEXT_ALIGN_X_CENTER, "CENTER", 0, "Center", ""}, {SEQ_TEXT_ALIGN_X_RIGHT, "RIGHT", 0, "Right", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem text_align_y_items[] = { + static const EnumPropertyItem text_align_y_items[] = { {SEQ_TEXT_ALIGN_Y_TOP, "TOP", 0, "Top", ""}, {SEQ_TEXT_ALIGN_Y_CENTER, "CENTER", 0, "Center", ""}, {SEQ_TEXT_ALIGN_Y_BOTTOM, "BOTTOM", 0, "Bottom", ""}, @@ -2592,7 +2592,7 @@ static void rna_def_tonemap_modifier(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem type_items[] = { + static const EnumPropertyItem type_items[] = { {SEQ_TONEMAP_RD_PHOTORECEPTOR, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""}, {SEQ_TONEMAP_RH_SIMPLE, "RH_SIMPLE", 0, "Rh Simple", ""}, {0, NULL, 0, NULL, NULL} diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index 76f5a4934cf..e1d3f3958a5 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -457,7 +457,7 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop) PropertyRNA *parm; FunctionRNA *func; - static EnumPropertyItem seq_effect_items[] = { + static const EnumPropertyItem seq_effect_items[] = { {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""}, {SEQ_TYPE_ADD, "ADD", 0, "Add", ""}, {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""}, diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 687541b96b0..7c0c5267daf 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -405,7 +405,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_noise_type_items[] = { + static const EnumPropertyItem prop_noise_type_items[] = { {MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""}, #ifdef WITH_FFTW3 {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""}, @@ -414,7 +414,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_compression_items[] = { + static const EnumPropertyItem prop_compression_items[] = { { VDB_COMPRESSION_ZIP, "ZIP", 0, "Zip", "Effective but slow compression" }, #ifdef WITH_OPENVDB_BLOSC { VDB_COMPRESSION_BLOSC, "BLOSC", 0, "Blosc", "Multithreaded compression, similar in size and quality as 'Zip'" }, @@ -423,26 +423,26 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) { 0, NULL, 0, NULL, NULL } }; - static EnumPropertyItem smoke_cache_comp_items[] = { + static const EnumPropertyItem smoke_cache_comp_items[] = { {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Fast but not so effective compression"}, {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem smoke_highres_sampling_items[] = { + static const EnumPropertyItem smoke_highres_sampling_items[] = { {SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""}, {SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""}, {SM_HRES_NEAREST, "NEAREST", 0, "Nearest", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem smoke_data_depth_items[] = { + static const EnumPropertyItem smoke_data_depth_items[] = { {16, "16", 0, "Float (Half)", "Half float (16 bit data)"}, {0, "32", 0, "Float (Full)", "Full float (32 bit data)"}, /* default */ {0, NULL, 0, NULL, NULL}, }; - static EnumPropertyItem smoke_domain_colli_items[] = { + static const EnumPropertyItem smoke_domain_colli_items[] = { {SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"}, {SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open", "Smoke doesn't collide with top and bottom sides"}, @@ -450,7 +450,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem cache_file_type_items[] = { + static const EnumPropertyItem cache_file_type_items[] = { {PTCACHE_FILE_PTCACHE, "POINTCACHE", 0, "Point Cache", "Blender specific point cache file format"}, #ifdef WITH_OPENVDB {PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format"}, @@ -458,19 +458,19 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem smoke_view_items[] = { + static const EnumPropertyItem smoke_view_items[] = { {MOD_SMOKE_SLICE_VIEW_ALIGNED, "VIEW_ALIGNED", 0, "View", "Slice volume parallel to the view plane"}, {MOD_SMOKE_SLICE_AXIS_ALIGNED, "AXIS_ALIGNED", 0, "Axis", "Slice volume parallel to the major axis"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem axis_slice_method_items[] = { + static const EnumPropertyItem axis_slice_method_items[] = { {AXIS_SLICE_FULL, "FULL", 0, "Full", "Slice the whole domain object"}, {AXIS_SLICE_SINGLE, "SINGLE", 0, "Single", "Perform a single slice of the domain object"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem axis_slice_position_items[] = { + static const EnumPropertyItem axis_slice_position_items[] = { {SLICE_AXIS_AUTO, "AUTO", 0, "Auto", "Adjust slice direction according to the view direction"}, {SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"}, {SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"}, @@ -478,7 +478,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem vector_draw_items[] = { + static const EnumPropertyItem vector_draw_items[] = { {VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Draw vectors as needles"}, {VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Draw vectors as streamlines"}, {0, NULL, 0, NULL, NULL} @@ -830,7 +830,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) "Render a simulation field while mapping its voxels values to the colors of a ramp"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); - static EnumPropertyItem coba_field_items[] = { + static const EnumPropertyItem coba_field_items[] = { {FLUID_FIELD_COLOR_R, "COLOR_R", 0, "Red", "Red component of the color field"}, {FLUID_FIELD_COLOR_G, "COLOR_G", 0, "Green", "Green component of the color field"}, {FLUID_FIELD_COLOR_B, "COLOR_B", 0, "Blue", "Blue component of the color field"}, @@ -862,7 +862,7 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem smoke_flow_types[] = { + static const EnumPropertyItem smoke_flow_types[] = { {MOD_SMOKE_FLOW_TYPE_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete smoke from simulation"}, {MOD_SMOKE_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"}, {MOD_SMOKE_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"}, @@ -870,13 +870,13 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem smoke_flow_sources[] = { + static const EnumPropertyItem smoke_flow_sources[] = { {MOD_SMOKE_FLOW_SOURCE_PARTICLES, "PARTICLES", ICON_PARTICLES, "Particle System", "Emit smoke from particles"}, {MOD_SMOKE_FLOW_SOURCE_MESH, "MESH", ICON_META_CUBE, "Mesh", "Emit smoke from mesh surface or volume"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem smoke_flow_texture_types[] = { + static const EnumPropertyItem smoke_flow_texture_types[] = { {MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO, "AUTO", 0, "Generated", "Generated coordinates centered to flow object"}, {MOD_SMOKE_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"}, {0, NULL, 0, NULL, NULL} @@ -1037,7 +1037,7 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) static void rna_def_smoke_coll_settings(BlenderRNA *brna) { - static EnumPropertyItem smoke_coll_type_items[] = { + static const EnumPropertyItem smoke_coll_type_items[] = { {SM_COLL_STATIC, "COLLSTATIC", 0, "Static", "Non moving obstacle"}, {SM_COLL_RIGID, "COLLRIGID", 0, "Rigid", "Rigid obstacle"}, {SM_COLL_ANIMATED, "COLLANIMATED", 0, "Animated", "Animated obstacle"}, diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 37f4c6ec16e..83d60044811 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -61,7 +61,7 @@ #include "RNA_enum_types.h" -EnumPropertyItem rna_enum_space_type_items[] = { +const EnumPropertyItem rna_enum_space_type_items[] = { /* empty must be here for python, is skipped for UI */ {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""}, {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D View", "3D viewport"}, @@ -98,7 +98,7 @@ EnumPropertyItem rna_enum_space_type_items[] = { #define V3D_S3D_CAMERA_VIEWS {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""}, #endif -static EnumPropertyItem stereo3d_camera_items[] = { +static const EnumPropertyItem stereo3d_camera_items[] = { V3D_S3D_CAMERA_LEFT V3D_S3D_CAMERA_RIGHT V3D_S3D_CAMERA_S3D @@ -106,7 +106,7 @@ static EnumPropertyItem stereo3d_camera_items[] = { }; #ifdef RNA_RUNTIME -static EnumPropertyItem multiview_camera_items[] = { +static const EnumPropertyItem multiview_camera_items[] = { V3D_S3D_CAMERA_VIEWS V3D_S3D_CAMERA_S3D {0, NULL, 0, NULL, NULL} @@ -119,14 +119,14 @@ static EnumPropertyItem multiview_camera_items[] = { #undef V3D_S3D_CAMERA_VIEWS #ifndef RNA_RUNTIME -static EnumPropertyItem stereo3d_eye_items[] = { +static const EnumPropertyItem stereo3d_eye_items[] = { {STEREO_LEFT_ID, "LEFT_EYE", ICON_NONE, "Left Eye"}, {STEREO_RIGHT_ID, "RIGHT_EYE", ICON_NONE, "Right Eye"}, {0, NULL, 0, NULL, NULL} }; #endif -static EnumPropertyItem pivot_items_full[] = { +static const EnumPropertyItem pivot_items_full[] = { {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, @@ -138,7 +138,7 @@ static EnumPropertyItem pivot_items_full[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem draw_channels_items[] = { +static const EnumPropertyItem draw_channels_items[] = { {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, @@ -151,7 +151,7 @@ static EnumPropertyItem draw_channels_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem transform_orientation_items[] = { +static const EnumPropertyItem transform_orientation_items[] = { {V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", "Align the transformation axes to world space"}, {V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"}, {V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", @@ -164,7 +164,7 @@ static EnumPropertyItem transform_orientation_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem autosnap_items[] = { +static const EnumPropertyItem autosnap_items[] = { {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""}, /* {-1, "", 0, "", ""}, */ {SACTSNAP_STEP, "STEP", 0, "Frame Step", "Snap to 1.0 frame intervals"}, @@ -178,7 +178,7 @@ static EnumPropertyItem autosnap_items[] = { }; #endif -EnumPropertyItem rna_enum_viewport_shade_items[] = { +const EnumPropertyItem rna_enum_viewport_shade_items[] = { {OB_BOUNDBOX, "BOUNDBOX", ICON_BBOX, "Bounding Box", "Display the object's local bounding boxes only"}, {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"}, {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display the object solid, lit with default OpenGL lights"}, @@ -189,14 +189,14 @@ EnumPropertyItem rna_enum_viewport_shade_items[] = { }; -EnumPropertyItem rna_enum_clip_editor_mode_items[] = { +const EnumPropertyItem rna_enum_clip_editor_mode_items[] = { {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"}, {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"}, {0, NULL, 0, NULL, NULL} }; /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */ -static EnumPropertyItem buttons_context_items[] = { +static const EnumPropertyItem buttons_context_items[] = { {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"}, {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"}, {BCONTEXT_RENDER_LAYER, "RENDER_LAYER", ICON_RENDERLAYERS, "Render Layers", "Render layers"}, @@ -212,11 +212,12 @@ static EnumPropertyItem buttons_context_items[] = { {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"}, {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, {BCONTEXT_COLLECTION, "COLLECTION", ICON_COLLAPSEMENU, "Collection", "Collection"}, + {BCONTEXT_WORKSPACE, "WORKSPACE", ICON_RENDER_RESULT, "Workspace", "Workspace"}, {0, NULL, 0, NULL, NULL} }; /* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */ -static EnumPropertyItem buttons_texture_context_items[] = { +static const EnumPropertyItem buttons_texture_context_items[] = { {SB_TEXC_MATERIAL, "MATERIAL", ICON_MATERIAL, "", "Show material textures"}, {SB_TEXC_WORLD, "WORLD", ICON_WORLD, "", "Show world textures"}, {SB_TEXC_LAMP, "LAMP", ICON_LAMP, "", "Show lamp textures"}, @@ -227,7 +228,7 @@ static EnumPropertyItem buttons_texture_context_items[] = { }; -static EnumPropertyItem fileselectparams_recursion_level_items[] = { +static const EnumPropertyItem fileselectparams_recursion_level_items[] = { {0, "NONE", 0, "None", "Only list current directory's content, with no recursion"}, {1, "BLEND", 0, "Blend File", "List .blend files' content"}, {2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"}, @@ -236,7 +237,7 @@ static EnumPropertyItem fileselectparams_recursion_level_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_file_sort_items[] = { +const EnumPropertyItem rna_enum_file_sort_items[] = { {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"}, {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"}, {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"}, @@ -445,7 +446,8 @@ static PointerRNA rna_View3D_current_orientation_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation); } -EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *rna_TransformOrientation_itemf( + bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { WorkSpace *workspace; ListBase *transform_orientations; @@ -728,8 +730,14 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value static int rna_SpaceView3D_viewport_shade_get(PointerRNA *ptr) { - Scene *scene = WM_windows_scene_get_from_screen(G.main->wm.first, ptr->id.data); - RenderEngineType *type = RE_engines_find(scene->r.engine); + bScreen *screen = ptr->id.data; + + Scene *scene = WM_windows_scene_get_from_screen(G.main->wm.first, screen); + WorkSpace *workspace = WM_windows_workspace_get_from_screen(G.main->wm.first, screen); + + ViewRender *view_render = BKE_viewrender_get(scene, workspace); + RenderEngineType *type = RE_engines_find(view_render->engine_id); + View3D *v3d = (View3D *)ptr->data; int drawtype = v3d->drawtype; @@ -748,12 +756,14 @@ static void rna_SpaceView3D_viewport_shade_set(PointerRNA *ptr, int value) v3d->drawtype = value; } -static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { wmWindow *win = CTX_wm_window(C); Scene *scene = WM_window_get_active_scene(win); - RenderEngineType *type = RE_engines_find(scene->r.engine); + WorkSpace *workspace = WM_window_get_active_workspace(win); + ViewRender *view_render = BKE_viewrender_get(scene, workspace); + RenderEngineType *type = RE_engines_find(view_render->engine_id); EnumPropertyItem *item = NULL; int totitem = 0; @@ -773,7 +783,7 @@ static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *C, Point return item; } -static EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { Scene *scene = CTX_data_scene(C); @@ -875,7 +885,7 @@ static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value) ED_space_image_set_mask(NULL, sima, (Mask *)value.data); } -static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { SpaceImage *sima = (SpaceImage *)ptr->data; @@ -997,10 +1007,10 @@ static void rna_SpaceImageEditor_scopes_update(struct bContext *C, struct Pointe ED_space_image_release_buffer(sima, ibuf, lock); } -static EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { - static EnumPropertyItem pivot_items[] = { + static const EnumPropertyItem pivot_items[] = { {V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_ROTATE, "Bounding Box Center", ""}, {V3D_AROUND_CENTER_MEAN, "MEDIAN", ICON_ROTATECENTER, "Median Point", ""}, {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""}, @@ -1100,7 +1110,7 @@ static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value) sbuts->mainbuser = value; } -static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), PointerRNA *ptr, +static const EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { SpaceButs *sbuts = (SpaceButs *)(ptr->data); @@ -1119,14 +1129,18 @@ static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE); } - if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) { - RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_COLLECTION); - } - if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD); } + if (sbuts->pathflag & (1 << BCONTEXT_WORKSPACE)) { + RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORKSPACE); + } + + if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) { + RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_COLLECTION); + } + if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) { RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT); } @@ -1191,7 +1205,7 @@ static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value) sbuts->re_align = 1; } -static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; @@ -1544,7 +1558,7 @@ static int rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type) else return true; } -static EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, r_free); @@ -1646,7 +1660,7 @@ static int rna_FileSelectParams_use_lib_get(PointerRNA *ptr) return params && (params->type == FILE_LOADLIB); } -static EnumPropertyItem *rna_FileSelectParams_recursion_level_itemf( +static const EnumPropertyItem *rna_FileSelectParams_recursion_level_itemf( bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { FileSelectParams *params = ptr->data; @@ -1935,7 +1949,7 @@ static void rna_FileBrowser_FSMenuRecent_active_range(PointerRNA *ptr, int *min, #else -static EnumPropertyItem dt_uv_items[] = { +static const EnumPropertyItem dt_uv_items[] = { {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"}, {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"}, {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"}, @@ -1971,7 +1985,7 @@ static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *m { PropertyRNA *prop; - static EnumPropertyItem overlay_mode_items[] = { + static const EnumPropertyItem overlay_mode_items[] = { {MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"}, {MASK_OVERLAY_COMBINED, "COMBINED", ICON_NONE, "Combined", "Combine space background image with the mask"}, {0, NULL, 0, NULL, NULL} @@ -2013,7 +2027,7 @@ static void rna_def_space_image_uv(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem sticky_mode_items[] = { + static const EnumPropertyItem sticky_mode_items[] = { {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"}, {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location", "Select UVs that are at the same location and share a mesh vertex"}, @@ -2022,13 +2036,13 @@ static void rna_def_space_image_uv(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem dt_uvstretch_items[] = { + static const EnumPropertyItem dt_uvstretch_items[] = { {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"}, {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem other_uv_filter_items[] = { + static const EnumPropertyItem other_uv_filter_items[] = { {SI_FILTER_ALL, "ALL", 0, "All", "No filter, show all islands from other objects"}, {SI_FILTER_SAME_IMAGE, "SAME_IMAGE", ICON_IMAGE_DATA, "Same Image", "Only show others' UV islands whose active image matches image of the active face"}, @@ -2136,7 +2150,7 @@ static void rna_def_space_outliner(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem display_mode_items[] = { + static const EnumPropertyItem display_mode_items[] = { {SO_ALL_SCENES, "ALL_SCENES", 0, "All Scenes", "Display data-blocks in all scenes"}, {SO_CUR_SCENE, "CURRENT_SCENE", 0, "Current Scene", "Display data-blocks in current scene"}, {SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display data-blocks in visible layers"}, @@ -2200,7 +2214,7 @@ static void rna_def_background_image(BlenderRNA *brna) PropertyRNA *prop; /* note: combinations work but don't flip so arnt that useful */ - static EnumPropertyItem bgpic_axis_items[] = { + static const EnumPropertyItem bgpic_axis_items[] = { {0, "", 0, N_("X Axis"), ""}, {(1 << RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"}, {(1 << RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", "Show background image while looking to the right"}, @@ -2219,7 +2233,7 @@ static void rna_def_background_image(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bgpic_source_items[] = { + static const EnumPropertyItem bgpic_source_items[] = { {V3D_BGPIC_IMAGE, "IMAGE", 0, "Image", ""}, {V3D_BGPIC_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""}, {0, NULL, 0, NULL, NULL} @@ -2387,7 +2401,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem manipulators_items[] = { + static const EnumPropertyItem manipulators_items[] = { {V3D_MANIP_TRANSLATE, "TRANSLATE", ICON_MAN_TRANS, "Translate", "Use the manipulator for movement transformations"}, {V3D_MANIP_ROTATE, "ROTATE", ICON_MAN_ROT, "Rotate", @@ -2397,14 +2411,14 @@ static void rna_def_space_view3d(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem rv3d_persp_items[] = { + static const EnumPropertyItem rv3d_persp_items[] = { {RV3D_PERSP, "PERSP", 0, "Perspective", ""}, {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""}, {RV3D_CAMOB, "CAMERA", 0, "Camera", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem bundle_drawtype_items[] = { + static const EnumPropertyItem bundle_drawtype_items[] = { {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""}, {OB_ARROWS, "ARROWS", 0, "Arrows", ""}, {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""}, @@ -2415,7 +2429,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem view3d_matcap_items[] = { + static const EnumPropertyItem view3d_matcap_items[] = { {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""}, {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""}, {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""}, @@ -2949,7 +2963,7 @@ static void rna_def_space_buttons(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem align_items[] = { + static const EnumPropertyItem align_items[] = { {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""}, {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""}, {0, NULL, 0, NULL, NULL} @@ -3002,7 +3016,7 @@ static void rna_def_space_buttons(BlenderRNA *brna) static void rna_def_space_image(BlenderRNA *brna) { - static EnumPropertyItem image_space_mode_items[] = { + static const EnumPropertyItem image_space_mode_items[] = { {SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image and UV edit in mesh editmode"}, {SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode"}, {SI_MODE_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask editing"}, @@ -3155,14 +3169,14 @@ static void rna_def_space_sequencer(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem view_type_items[] = { + static const EnumPropertyItem view_type_items[] = { {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""}, {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""}, {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer and Image Preview", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem display_mode_items[] = { + static const EnumPropertyItem display_mode_items[] = { {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""}, {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""}, {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""}, @@ -3170,7 +3184,7 @@ static void rna_def_space_sequencer(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem proxy_render_size_items[] = { + static const EnumPropertyItem proxy_render_size_items[] = { {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""}, {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""}, {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""}, @@ -3181,21 +3195,21 @@ static void rna_def_space_sequencer(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem overlay_type_items[] = { + static const EnumPropertyItem overlay_type_items[] = { {SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"}, {SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"}, {SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem preview_channels_items[] = { + static const EnumPropertyItem preview_channels_items[] = { {SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem waveform_type_draw_items[] = { + static const EnumPropertyItem waveform_type_draw_items[] = { {SEQ_NO_WAVEFORMS, "NO_WAVEFORMS", 0, "Waveforms Off", "No waveforms drawn for any sound strips"}, {SEQ_ALL_WAVEFORMS, "ALL_WAVEFORMS", 0, "Waveforms On", @@ -3547,7 +3561,7 @@ static void rna_def_space_graph(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem mode_items[] = { + static const EnumPropertyItem mode_items[] = { {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve", "Edit animation/keyframes displayed as 2D curves"}, {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"}, @@ -3555,7 +3569,7 @@ static void rna_def_space_graph(BlenderRNA *brna) }; /* this is basically the same as the one for the 3D-View, but with some entries omitted */ - static EnumPropertyItem gpivot_items[] = { + static const EnumPropertyItem gpivot_items[] = { {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""}, {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""}, {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""}, @@ -3803,7 +3817,7 @@ static void rna_def_space_time(BlenderRNA *brna) static void rna_def_console_line(BlenderRNA *brna) { - static EnumPropertyItem console_line_type_items[] = { + static const EnumPropertyItem console_line_type_items[] = { {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""}, {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""}, {CONSOLE_LINE_INFO, "INFO", 0, "Info", ""}, @@ -3882,14 +3896,14 @@ static void rna_def_fileselect_params(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem file_display_items[] = { + static const EnumPropertyItem file_display_items[] = { {FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"}, {FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"}, {FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem display_size_items[] = { + static const EnumPropertyItem display_size_items[] = { {32, "TINY", 0, "Tiny", ""}, {64, "SMALL", 0, "Small", ""}, {128, "NORMAL", 0, "Normal", ""}, @@ -3897,7 +3911,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem file_filter_idtypes_items[] = { + static const EnumPropertyItem file_filter_idtypes_items[] = { {FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide Action data-blocks"}, {FILTER_ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armatures", "Show/hide Armature data-blocks"}, {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushes data-blocks"}, @@ -3934,7 +3948,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem file_filter_idcategories_items[] = { + static const EnumPropertyItem file_filter_idcategories_items[] = { {FILTER_ID_SCE, "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide scenes"}, {FILTER_ID_AC, @@ -4258,7 +4272,7 @@ static void rna_def_space_info(BlenderRNA *brna) static void rna_def_space_userpref(BlenderRNA *brna) { - static EnumPropertyItem filter_type_items[] = { + static const EnumPropertyItem filter_type_items[] = { {0, "NAME", 0, "Name", "Filter based on the operator name"}, {1, "KEY", 0, "Key-Binding", "Filter based on key bindings"}, {0, NULL, 0, NULL, NULL}}; @@ -4342,7 +4356,7 @@ static void rna_def_space_node(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem texture_id_type_items[] = { + static const EnumPropertyItem texture_id_type_items[] = { {SNODE_TEX_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit texture nodes from Object"}, {SNODE_TEX_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit texture nodes from World"}, {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"}, @@ -4352,7 +4366,7 @@ static void rna_def_space_node(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem shader_type_items[] = { + static const EnumPropertyItem shader_type_items[] = { {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"}, {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"}, #ifdef WITH_FREESTYLE @@ -4361,7 +4375,7 @@ static void rna_def_space_node(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem backdrop_channels_items[] = { + static const EnumPropertyItem backdrop_channels_items[] = { {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, {0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"}, @@ -4372,13 +4386,13 @@ static void rna_def_space_node(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem insert_ofs_dir_items[] = { + static const EnumPropertyItem insert_ofs_dir_items[] = { {SNODE_INSERTOFS_DIR_RIGHT, "RIGHT", 0, "Right"}, {SNODE_INSERTOFS_DIR_LEFT, "LEFT", 0, "Left"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem dummy_items[] = { + static const EnumPropertyItem dummy_items[] = { {0, "DUMMY", 0, "", ""}, {0, NULL, 0, NULL, NULL}}; @@ -4573,20 +4587,20 @@ static void rna_def_space_clip(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem view_items[] = { + static const EnumPropertyItem view_items[] = { {SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"}, {SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"}, {SC_VIEW_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dopesheet", "Dopesheet view for tracking data"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem gpencil_source_items[] = { + static const EnumPropertyItem gpencil_source_items[] = { {SC_GPENCIL_SRC_CLIP, "CLIP", 0, "Clip", "Show grease pencil data-block which belongs to movie clip"}, {SC_GPENCIL_SRC_TRACK, "TRACK", 0, "Track", "Show grease pencil data-block which belongs to active track"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem pivot_items[] = { + static const EnumPropertyItem pivot_items[] = { {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", "Pivot around bounding box center of selected object(s)"}, {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", "Pivot around the 2D cursor"}, diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index 9490dfd0478..040273925cb 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -52,7 +52,7 @@ #include "WM_types.h" #ifndef RNA_RUNTIME -static EnumPropertyItem texture_filter_items[] = { +static const EnumPropertyItem texture_filter_items[] = { {TXF_BOX, "BOX", 0, "Box", ""}, {TXF_EWA, "EWA", 0, "EWA", ""}, {TXF_FELINE, "FELINE", 0, "FELINE", ""}, @@ -61,7 +61,7 @@ static EnumPropertyItem texture_filter_items[] = { }; #endif -EnumPropertyItem rna_enum_texture_type_items[] = { +const EnumPropertyItem rna_enum_texture_type_items[] = { {0, "NONE", 0, "None", ""}, {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - create a ramp texture"}, {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", "Procedural - create a cloud-like fractal noise texture"}, @@ -85,7 +85,7 @@ EnumPropertyItem rna_enum_texture_type_items[] = { }; #ifndef RNA_RUNTIME -static EnumPropertyItem blend_type_items[] = { +static const EnumPropertyItem blend_type_items[] = { {MTEX_BLEND, "MIX", 0, "Mix", ""}, {MTEX_ADD, "ADD", 0, "Add", ""}, {MTEX_SUB, "SUBTRACT", 0, "Subtract", ""}, @@ -362,8 +362,9 @@ static int rna_TextureSlot_output_node_get(PointerRNA *ptr) } -static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *UNUSED(C), PointerRNA *ptr, - PropertyRNA *UNUSED(prop), bool *r_free) +static const EnumPropertyItem *rna_TextureSlot_output_node_itemf( + bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), bool *r_free) { MTex *mtex = ptr->data; Tex *tex = mtex->tex; @@ -483,7 +484,7 @@ static char *rna_OceanTex_path(PointerRNA *UNUSED(ptr)) static void rna_def_texmapping(BlenderRNA *brna) { - static EnumPropertyItem prop_mapping_items[] = { + static const EnumPropertyItem prop_mapping_items[] = { {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"}, {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"}, {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"}, @@ -491,7 +492,7 @@ static void rna_def_texmapping(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_vect_type_items[] = { + static const EnumPropertyItem prop_vect_type_items[] = { {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transform a texture by inverse mapping the texture coordinate"}, {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"}, {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"}, @@ -499,7 +500,7 @@ static void rna_def_texmapping(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_xyz_mapping_items[] = { + static const EnumPropertyItem prop_xyz_mapping_items[] = { {0, "NONE", 0, "None", ""}, {1, "X", 0, "X", ""}, {2, "Y", 0, "Y", ""}, @@ -636,7 +637,7 @@ static void rna_def_mtex(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem output_node_items[] = { + static const EnumPropertyItem output_node_items[] = { {0, "DUMMY", 0, "Dummy", ""}, {0, NULL, 0, NULL, NULL} }; @@ -782,14 +783,14 @@ static void rna_def_environment_map(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_source_items[] = { + static const EnumPropertyItem prop_source_items[] = { {ENV_STATIC, "STATIC", 0, "Static", "Calculate environment map only once"}, {ENV_ANIM, "ANIMATED", 0, "Animated", "Calculate environment map at each rendering"}, {ENV_LOAD, "IMAGE_FILE", 0, "Image File", "Load a saved environment map image from disk"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_mapping_items[] = { + static const EnumPropertyItem prop_mapping_items[] = { {ENV_CUBE, "CUBE", 0, "Cube", "Use environment map with six cube sides"}, {ENV_PLANE, "PLANE", 0, "Plane", "Only one side is rendered, with Z axis pointing in direction of image"}, {0, NULL, 0, NULL, NULL} @@ -865,7 +866,7 @@ static void rna_def_environment_map(BlenderRNA *brna) RNA_api_environment_map(srna); } -static EnumPropertyItem prop_noise_basis_items[] = { +static const EnumPropertyItem prop_noise_basis_items[] = { {TEX_BLENDER, "BLENDER_ORIGINAL", 0, "Blender Original", "Noise algorithm - Blender original: Smooth interpolated noise"}, {TEX_STDPERLIN, "ORIGINAL_PERLIN", 0, "Original Perlin", @@ -888,7 +889,7 @@ static EnumPropertyItem prop_noise_basis_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem prop_noise_type[] = { +static const EnumPropertyItem prop_noise_type[] = { {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"}, {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"}, {0, NULL, 0, NULL, NULL} @@ -900,7 +901,7 @@ static void rna_def_texture_clouds(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_clouds_stype[] = { + static const EnumPropertyItem prop_clouds_stype[] = { {TEX_DEFAULT, "GRAYSCALE", 0, "Grayscale", ""}, {TEX_COLOR, "COLOR", 0, "Color", ""}, {0, NULL, 0, NULL, NULL} @@ -954,7 +955,7 @@ static void rna_def_texture_wood(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_wood_stype[] = { + static const EnumPropertyItem prop_wood_stype[] = { {TEX_BAND, "BANDS", 0, "Bands", "Use standard wood texture in bands"}, {TEX_RING, "RINGS", 0, "Rings", "Use wood texture in rings"}, {TEX_BANDNOISE, "BANDNOISE", 0, "Band Noise", "Add noise to standard wood"}, @@ -962,7 +963,7 @@ static void rna_def_texture_wood(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_wood_noisebasis2[] = { + static const EnumPropertyItem prop_wood_noisebasis2[] = { {TEX_SIN, "SIN", 0, "Sine", "Use a sine wave to produce bands"}, {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"}, {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"}, @@ -1024,14 +1025,14 @@ static void rna_def_texture_marble(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_marble_stype[] = { + static const EnumPropertyItem prop_marble_stype[] = { {TEX_SOFT, "SOFT", 0, "Soft", "Use soft marble"}, {TEX_SHARP, "SHARP", 0, "Sharp", "Use more clearly defined marble"}, {TEX_SHARPER, "SHARPER", 0, "Sharper", "Use very clearly defined marble"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_marble_noisebasis2[] = { + static const EnumPropertyItem prop_marble_noisebasis2[] = { {TEX_SIN, "SIN", 0, "Sin", "Use a sine wave to produce bands"}, {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"}, {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"}, @@ -1124,7 +1125,7 @@ static void rna_def_texture_blend(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_blend_progression[] = { + static const EnumPropertyItem prop_blend_progression[] = { {TEX_LIN, "LINEAR", 0, "Linear", "Create a linear progression"}, {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"}, {TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"}, @@ -1165,7 +1166,7 @@ static void rna_def_texture_stucci(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_stucci_stype[] = { + static const EnumPropertyItem prop_stucci_stype[] = { {TEX_PLASTIC, "PLASTIC", 0, "Plastic", "Use standard stucci"}, {TEX_WALLIN, "WALL_IN", 0, "Wall in", "Create Dimples"}, {TEX_WALLOUT, "WALL_OUT", 0, "Wall out", "Create Ridges"}, @@ -1223,7 +1224,7 @@ static void rna_def_texture_image(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_image_extension[] = { + static const EnumPropertyItem prop_image_extension[] = { {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"}, {TEX_CLIPCUBE, "CLIP_CUBE", 0, "Clip Cube", @@ -1414,7 +1415,7 @@ static void rna_def_texture_musgrave(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_musgrave_type[] = { + static const EnumPropertyItem prop_musgrave_type[] = { {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Use Perlin noise as a basis"}, {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", "Use Perlin noise with inflection as a basis"}, @@ -1496,7 +1497,7 @@ static void rna_def_texture_voronoi(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem prop_distance_metric_items[] = { + static const EnumPropertyItem prop_distance_metric_items[] = { {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "sqrt(x*x+y*y+z*z)"}, {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "(x*x+y*y+z*z)"}, {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan", @@ -1513,7 +1514,7 @@ static void rna_def_texture_voronoi(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_coloring_items[] = { + static const EnumPropertyItem prop_coloring_items[] = { /* XXX: OK names / descriptions? */ {TEX_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"}, {TEX_COL1, "POSITION", 0, "Position", "Color cells by position"}, @@ -1636,28 +1637,28 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem point_source_items[] = { + static const EnumPropertyItem point_source_items[] = { {TEX_PD_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", "Generate point density from a particle system"}, {TEX_PD_OBJECT, "OBJECT", 0, "Object Vertices", "Generate point density from an object's vertices"}, /*{TEX_PD_FILE, "FILE", 0, "File", ""}, */ {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem particle_cache_items[] = { + static const EnumPropertyItem particle_cache_items[] = { {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Emit Object Location", ""}, {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Emit Object Space", ""}, {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0, "Global Space", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem vertex_cache_items[] = { + static const EnumPropertyItem vertex_cache_items[] = { {TEX_PD_OBJECTLOC, "OBJECT_LOCATION", 0, "Object Location", ""}, {TEX_PD_OBJECTSPACE, "OBJECT_SPACE", 0, "Object Space", ""}, {TEX_PD_WORLDSPACE, "WORLD_SPACE", 0, "Global Space", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem falloff_items[] = { + static const EnumPropertyItem falloff_items[] = { {TEX_PD_FALLOFF_STD, "STANDARD", 0, "Standard", ""}, {TEX_PD_FALLOFF_SMOOTH, "SMOOTH", 0, "Smooth", ""}, {TEX_PD_FALLOFF_SOFT, "SOFT", 0, "Soft", ""}, @@ -1668,7 +1669,7 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem particle_color_source_items[] = { + static const EnumPropertyItem particle_color_source_items[] = { {TEX_PD_COLOR_CONSTANT, "CONSTANT", 0, "Constant", ""}, {TEX_PD_COLOR_PARTAGE, "PARTICLE_AGE", 0, "Particle Age", "Lifetime mapped as 0.0 - 1.0 intensity"}, {TEX_PD_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed", @@ -1677,7 +1678,7 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem vertex_color_source_items[] = { + static const EnumPropertyItem vertex_color_source_items[] = { {TEX_PD_COLOR_CONSTANT, "CONSTANT", 0, "Constant", ""}, {TEX_PD_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"}, {TEX_PD_COLOR_VERTWEIGHT, "VERTEX_WEIGHT", 0, "Vertex Weight", "Vertex group weight"}, @@ -1685,7 +1686,7 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem turbulence_influence_items[] = { + static const EnumPropertyItem turbulence_influence_items[] = { {TEX_PD_NOISE_STATIC, "STATIC", 0, "Static", "Noise patterns will remain unchanged, faster and suitable for stills"}, {TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", @@ -1849,7 +1850,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem interpolation_type_items[] = { + static const EnumPropertyItem interpolation_type_items[] = { {TEX_VD_NEARESTNEIGHBOR, "NEREASTNEIGHBOR", 0, "Nearest Neighbor", "No interpolation, fast but blocky and low quality"}, {TEX_VD_LINEAR, "TRILINEAR", 0, "Linear", "Good smoothness and speed"}, @@ -1860,7 +1861,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem file_format_items[] = { + static const EnumPropertyItem file_format_items[] = { {TEX_VD_BLENDERVOXEL, "BLENDER_VOXEL", 0, "Blender Voxel", "Default binary voxel file format"}, {TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit grayscale binary data"}, /*{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""}, */ @@ -1871,14 +1872,14 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem voxeldata_extension[] = { + static const EnumPropertyItem voxeldata_extension[] = { {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"}, {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem smoked_type_items[] = { + static const EnumPropertyItem smoked_type_items[] = { {TEX_VD_SMOKEDENSITY, "SMOKEDENSITY", 0, "Smoke", "Use smoke density and color as texture data"}, {TEX_VD_SMOKEFLAME, "SMOKEFLAME", 0, "Flame", "Use flame temperature as texture data"}, {TEX_VD_SMOKEHEAT, "SMOKEHEAT", 0, "Heat", "Use smoke heat as texture data. Values from -2.0 to 2.0 are used"}, @@ -1886,7 +1887,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem hair_type_items[] = { + static const EnumPropertyItem hair_type_items[] = { {TEX_VD_HAIRDENSITY, "HAIRDENSITY", 0, "Density", "Use hair density as texture data"}, {TEX_VD_HAIRRESTDENSITY, "HAIRRESTDENSITY", 0, "Rest Density", "Use hair rest density as texture data"}, {TEX_VD_HAIRVELOCITY, "HAIRVELOCITY", 0, "Velocity", "Use hair velocity as texture data"}, @@ -1993,7 +1994,7 @@ static void rna_def_texture_ocean(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem ocean_output_items[] = { + static const EnumPropertyItem ocean_output_items[] = { {TEX_OCN_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Output XYZ displacement in RGB channels"}, /*{TEX_OCN_NORMALS, "NORMALS", 0, "Normals", "Outputs wave normals"}, *//* these are in nor channel now */ {TEX_OCN_FOAM, "FOAM", 0, "Foam", "Output Foam (wave overlap) amount in single channel"}, diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index ea45b08458c..d23017429c1 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -827,7 +827,7 @@ static void rna_trackingCameras_matrix_from_frame(ID *id, MovieTrackingReconstru #else -static EnumPropertyItem tracker_motion_model[] = { +static const EnumPropertyItem tracker_motion_model[] = { {TRACK_MOTION_MODEL_HOMOGRAPHY, "Perspective", 0, "Perspective", "Search for markers that are perspectively deformed (homography) between frames"}, {TRACK_MOTION_MODEL_AFFINE, "Affine", 0, "Affine", @@ -843,7 +843,7 @@ static EnumPropertyItem tracker_motion_model[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem pattern_match_items[] = { +static const EnumPropertyItem pattern_match_items[] = { {TRACK_MATCH_KEYFRAME, "KEYFRAME", 0, "Keyframe", "Track pattern from keyframe to next frame"}, {TRACK_MATCH_PREVFRAME, "PREV_FRAME", 0, "Previous frame", "Track pattern from current frame to next frame"}, {0, NULL, 0, NULL, NULL} @@ -854,7 +854,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem speed_items[] = { + static const EnumPropertyItem speed_items[] = { {0, "FASTEST", 0, "Fastest", "Track as fast as it's possible"}, {TRACKING_SPEED_DOUBLE, "DOUBLE", 0, "Double", "Track with double speed"}, {TRACKING_SPEED_REALTIME, "REALTIME", 0, "Realtime", "Track with realtime speed"}, @@ -863,14 +863,14 @@ static void rna_def_trackingSettings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem cleanup_items[] = { + static const EnumPropertyItem cleanup_items[] = { {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"}, {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"}, {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem refine_items[] = { + static const EnumPropertyItem refine_items[] = { {0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"}, {REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"}, {REFINE_FOCAL_LENGTH | REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1", @@ -1086,14 +1086,14 @@ static void rna_def_trackingCamera(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem distortion_model_items[] = { + static const EnumPropertyItem distortion_model_items[] = { {TRACKING_DISTORTION_MODEL_POLYNOMIAL, "POLYNOMIAL", 0, "Polynomial", "Radial distortion model which fits common cameras"}, {TRACKING_DISTORTION_MODEL_DIVISION, "DIVISION", 0, "Divisions", "Division distortion model which " "better represents wide-angle cameras"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem camera_units_items[] = { + static const EnumPropertyItem camera_units_items[] = { {CAMERA_UNITS_PX, "PIXELS", 0, "px", "Use pixels for units of focal length"}, {CAMERA_UNITS_MM, "MILLIMETERS", 0, "mm", "Use millimeters for units of focal length"}, {0, NULL, 0, NULL, NULL} @@ -1674,7 +1674,7 @@ static void rna_def_trackingStabilization(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem filter_items[] = { + static const EnumPropertyItem filter_items[] = { {TRACKING_FILTER_NEAREST, "NEAREST", 0, "Nearest", "No interpolation, use nearest neighbor pixel"}, {TRACKING_FILTER_BILINEAR, "BILINEAR", 0, "Bilinear", "Simple interpolation between adjacent pixels"}, {TRACKING_FILTER_BICUBIC, "BICUBIC", 0, "Bicubic", "High quality pixel interpolation"}, @@ -2125,7 +2125,7 @@ static void rna_def_trackingDopesheet(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem sort_items[] = { + static const EnumPropertyItem sort_items[] = { {TRACKING_DOPE_SORT_NAME, "NAME", 0, "Name", "Sort channels by their names"}, {TRACKING_DOPE_SORT_LONGEST, "LONGEST", 0, "Longest", "Sort channels by longest tracked segment"}, {TRACKING_DOPE_SORT_TOTAL, "TOTAL", 0, "Total", "Sort channels by overall amount of tracked segments"}, diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index bb6a9b075fe..e88f79eda18 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -43,7 +43,7 @@ #include "WM_types.h" /* see WM_types.h */ -EnumPropertyItem rna_enum_operator_context_items[] = { +const EnumPropertyItem rna_enum_operator_context_items[] = { {WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", ""}, {WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke Region Window", ""}, {WM_OP_INVOKE_REGION_CHANNELS, "INVOKE_REGION_CHANNELS", 0, "Invoke Region Channels", ""}, @@ -59,7 +59,7 @@ EnumPropertyItem rna_enum_operator_context_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_uilist_layout_type_items[] = { +const EnumPropertyItem rna_enum_uilist_layout_type_items[] = { {UILST_LAYOUT_DEFAULT, "DEFAULT", 0, "Default Layout", "Use the default, multi-rows layout"}, {UILST_LAYOUT_COMPACT, "COMPACT", 0, "Compact Layout", "Use the compact, single-row layout"}, {UILST_LAYOUT_GRID, "GRID", 0, "Grid Layout", "Use the grid-based layout"}, @@ -897,7 +897,7 @@ static void rna_def_ui_layout(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem alignment_items[] = { + static const EnumPropertyItem alignment_items[] = { {UI_LAYOUT_ALIGN_EXPAND, "EXPAND", 0, "Expand", ""}, {UI_LAYOUT_ALIGN_LEFT, "LEFT", 0, "Left", ""}, {UI_LAYOUT_ALIGN_CENTER, "CENTER", 0, "Center", ""}, @@ -951,7 +951,7 @@ static void rna_def_panel(BlenderRNA *brna) PropertyRNA *parm; FunctionRNA *func; - static EnumPropertyItem panel_flag_items[] = { + static const EnumPropertyItem panel_flag_items[] = { {PNL_DEFAULT_CLOSED, "DEFAULT_CLOSED", 0, "Default Closed", "Defines if the panel has to be open or collapsed at the time of its creation"}, {PNL_NO_HEADER, "HIDE_HEADER", 0, "Hide Header", diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 125da43bf93..b4d5fd3a247 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -50,7 +50,7 @@ #define DEF_ICON_BLANK_SKIP #define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""}, #define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""}, -EnumPropertyItem rna_enum_icon_items[] = { +const EnumPropertyItem rna_enum_icon_items[] = { #include "UI_icons.h" {0, NULL, 0, NULL, NULL} }; @@ -285,7 +285,7 @@ static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon) static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier) { PropertyRNA *prop = NULL; - EnumPropertyItem *items = NULL, *item; + const EnumPropertyItem *items = NULL, *item; bool free; const char *name = ""; @@ -305,7 +305,7 @@ static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char } } if (free) { - MEM_freeN(items); + MEM_freeN((void *)items); } } @@ -316,7 +316,7 @@ static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, con const char *identifier) { PropertyRNA *prop = NULL; - EnumPropertyItem *items = NULL, *item; + const EnumPropertyItem *items = NULL, *item; bool free; const char *desc = ""; @@ -336,7 +336,7 @@ static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, con } } if (free) { - MEM_freeN(items); + MEM_freeN((void *)items); } } @@ -346,7 +346,7 @@ static const char *rna_ui_get_enum_description(bContext *C, PointerRNA *ptr, con static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier) { PropertyRNA *prop = NULL; - EnumPropertyItem *items = NULL, *item; + const EnumPropertyItem *items = NULL, *item; bool free; int icon = ICON_NONE; @@ -366,7 +366,7 @@ static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propna } } if (free) { - MEM_freeN(items); + MEM_freeN((void *)items); } } @@ -421,7 +421,7 @@ void RNA_api_ui_layout(StructRNA *srna) FunctionRNA *func; PropertyRNA *parm; - static EnumPropertyItem curve_type_items[] = { + static const EnumPropertyItem curve_type_items[] = { {0, "NONE", 0, "None", ""}, {'v', "VECTOR", 0, "Vector", ""}, {'c', "COLOR", 0, "Color", ""}, diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index b884546f197..cbbe0df1d60 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -53,7 +53,7 @@ #include "GPU_buffers.h" #ifdef WITH_OPENSUBDIV -static EnumPropertyItem opensubdiv_compute_type_items[] = { +static const EnumPropertyItem opensubdiv_compute_type_items[] = { {USER_OPENSUBDIV_COMPUTE_NONE, "NONE", 0, "None", ""}, {USER_OPENSUBDIV_COMPUTE_CPU, "CPU", 0, "CPU", ""}, {USER_OPENSUBDIV_COMPUTE_OPENMP, "OPENMP", 0, "OpenMP", ""}, @@ -65,19 +65,19 @@ static EnumPropertyItem opensubdiv_compute_type_items[] = { }; #endif -static EnumPropertyItem audio_device_items[] = { +static const EnumPropertyItem audio_device_items[] = { {0, "Null", 0, "None", "Null device - there will be no audio output"}, {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_navigation_mode_items[] = { +const EnumPropertyItem rna_enum_navigation_mode_items[] = { {VIEW_NAVIGATION_WALK, "WALK", 0, "Walk", "Interactively walk or free navigate around the scene"}, {VIEW_NAVIGATION_FLY, "FLY", 0, "Fly", "Use fly dynamics to navigate the scene"}, {0, NULL, 0, NULL, NULL} }; #if defined(WITH_INTERNATIONAL) || !defined(RNA_RUNTIME) -static EnumPropertyItem rna_enum_language_default_items[] = { +static const EnumPropertyItem rna_enum_language_default_items[] = { {0, "DEFAULT", 0, "Default (Default)", ""}, {0, NULL, 0, NULL, NULL} }; @@ -456,7 +456,7 @@ static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr) #ifdef WITH_OPENSUBDIV -static EnumPropertyItem *rna_userdef_opensubdiv_compute_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_userdef_opensubdiv_compute_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { EnumPropertyItem *item = NULL; @@ -503,7 +503,7 @@ static void rna_userdef_opensubdiv_update(Main *bmain, Scene *UNUSED(scene), Poi #endif -static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { int index = 0; @@ -529,10 +529,10 @@ static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), Poi } #ifdef WITH_INTERNATIONAL -static EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), +static const EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { - EnumPropertyItem *items = BLT_lang_RNA_enum_properties(); + const EnumPropertyItem *items = BLT_lang_RNA_enum_properties(); if (items == NULL) { items = rna_enum_language_default_items; } @@ -643,7 +643,7 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem font_kerning_style[] = { + static const EnumPropertyItem font_kerning_style[] = { {0, "UNFITTED", 0, "Unfitted", "Use scaled but un-grid-fitted kerning distances"}, {1, "FITTED", 0, "Fitted", "Use scaled and grid-fitted kerning distances"}, {0, NULL, 0, NULL, NULL} @@ -2966,7 +2966,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem active_theme_area[] = { + static const EnumPropertyItem active_theme_area[] = { {0, "USER_INTERFACE", ICON_UI, "User Interface", ""}, {19, "STYLE", ICON_FONTPREVIEW, "Text Style", ""}, {18, "BONE_COLOR_SETS", ICON_COLOR, "Bone Color Sets", ""}, @@ -3306,7 +3306,7 @@ static void rna_def_userdef_walk_navigation(BlenderRNA *brna) static void rna_def_userdef_view(BlenderRNA *brna) { - static EnumPropertyItem timecode_styles[] = { + static const EnumPropertyItem timecode_styles[] = { {USER_TIMECODE_MINIMAL, "MINIMAL", 0, "Minimal Info", "Most compact representation, uses '+' as separator for sub-second frame numbers, " "with left and right truncation of the timecode as necessary"}, @@ -3322,14 +3322,14 @@ static void rna_def_userdef_view(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem zoom_frame_modes[] = { + static const EnumPropertyItem zoom_frame_modes[] = { {ZOOM_FRAME_MODE_KEEP_RANGE, "KEEP_RANGE", 0, "Keep Range", ""}, {ZOOM_FRAME_MODE_SECONDS, "SECONDS", 0, "Seconds", ""}, {ZOOM_FRAME_MODE_KEYFRAMES, "KEYFRAMES", 0, "Keyframes", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem line_width[] = { + static const EnumPropertyItem line_width[] = { {-1, "THIN", 0, "Thin", "Thinner lines than the default"}, { 0, "AUTO", 0, "Auto", "Automatic line width based on UI scale"}, { 1, "THICK", 0, "Thick", "Thicker lines than the default"}, @@ -3602,7 +3602,7 @@ static void rna_def_userdef_edit(BlenderRNA *brna) PropertyRNA *prop; StructRNA *srna; - static EnumPropertyItem auto_key_modes[] = { + static const EnumPropertyItem auto_key_modes[] = { {AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""}, {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""}, {0, NULL, 0, NULL, NULL} @@ -3832,7 +3832,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) PropertyRNA *prop; StructRNA *srna; - static EnumPropertyItem gl_texture_clamp_items[] = { + static const EnumPropertyItem gl_texture_clamp_items[] = { {0, "CLAMP_OFF", 0, "Off", ""}, {8192, "CLAMP_8192", 0, "8192", ""}, {4096, "CLAMP_4096", 0, "4096", ""}, @@ -3844,7 +3844,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem anisotropic_items[] = { + static const EnumPropertyItem anisotropic_items[] = { {1, "FILTER_0", 0, "Off", ""}, {2, "FILTER_2", 0, "2x", ""}, {4, "FILTER_4", 0, "4x", ""}, @@ -3853,7 +3853,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem audio_mixing_samples_items[] = { + static const EnumPropertyItem audio_mixing_samples_items[] = { {256, "SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"}, {512, "SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"}, {1024, "SAMPLES_1024", 0, "1024", "Set audio mixing buffer size to 1024 samples"}, @@ -3865,7 +3865,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem audio_rate_items[] = { + static const EnumPropertyItem audio_rate_items[] = { /* {8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second"}, */ /* {11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second"}, */ /* {16000, "RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second"}, */ @@ -3879,7 +3879,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem audio_format_items[] = { + static const EnumPropertyItem audio_format_items[] = { {0x01, "U8", 0, "8-bit Unsigned", "Set audio sample format to 8 bit unsigned integer"}, {0x12, "S16", 0, "16-bit Signed", "Set audio sample format to 16 bit signed integer"}, {0x13, "S24", 0, "24-bit Signed", "Set audio sample format to 24 bit signed integer"}, @@ -3889,7 +3889,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem audio_channel_items[] = { + static const EnumPropertyItem audio_channel_items[] = { {1, "MONO", 0, "Mono", "Set audio channels to mono"}, {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"}, {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"}, @@ -3898,7 +3898,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem draw_method_items[] = { + static const EnumPropertyItem draw_method_items[] = { {USER_DRAW_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically set based on graphics card and driver"}, {USER_DRAW_TRIPLE, "TRIPLE_BUFFER", 0, "Triple Buffer", "Use a third buffer for minimal redraws at the cost of more memory"}, @@ -3912,7 +3912,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem color_picker_types[] = { + static const EnumPropertyItem color_picker_types[] = { {USER_CP_CIRCLE_HSV, "CIRCLE_HSV", 0, "Circle (HSV)", "A circular Hue/Saturation color wheel, with Value slider"}, {USER_CP_CIRCLE_HSL, "CIRCLE_HSL", 0, "Circle (HSL)", "A circular Hue/Saturation color wheel, with Lightness slider"}, {USER_CP_SQUARE_SV, "SQUARE_SV", 0, "Square (SV + H)", "A square showing Saturation/Value, with Hue slider"}, @@ -3921,7 +3921,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem multi_sample_levels[] = { + static const EnumPropertyItem multi_sample_levels[] = { {USER_MULTISAMPLE_NONE, "NONE", 0, "No MultiSample", "Do not use OpenGL MultiSample"}, {USER_MULTISAMPLE_2, "2", 0, "MultiSample: 2", "Use 2x OpenGL MultiSample (requires restart)"}, {USER_MULTISAMPLE_4, "4", 0, "MultiSample: 4", "Use 4x OpenGL MultiSample (requires restart)"}, @@ -3930,14 +3930,14 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem image_draw_methods[] = { + static const EnumPropertyItem image_draw_methods[] = { {IMAGE_DRAW_METHOD_2DTEXTURE, "2DTEXTURE", 0, "2D Texture", "Use CPU for display transform and draw image with 2D texture"}, {IMAGE_DRAW_METHOD_GLSL, "GLSL", 0, "GLSL", "Use GLSL shaders for display transform and draw image with 2D texture"}, {IMAGE_DRAW_METHOD_DRAWPIXELS, "DRAWPIXELS", 0, "DrawPixels", "Use CPU for display transform and draw image using DrawPixels"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem gpu_select_method_items[] = { + static const EnumPropertyItem gpu_select_method_items[] = { {USER_SELECT_AUTO, "AUTO", 0, "Automatic", ""}, {USER_SELECT_USE_SELECT_RENDERMODE, "GL_SELECT", 0, "OpenGL Select", ""}, {USER_SELECT_USE_OCCLUSION_QUERY, "GL_QUERY", 0, "OpenGL Occlusion Queries", ""}, @@ -4237,33 +4237,33 @@ static void rna_def_userdef_input(BlenderRNA *brna) PropertyRNA *prop; StructRNA *srna; - static EnumPropertyItem select_mouse_items[] = { + static const EnumPropertyItem select_mouse_items[] = { {USER_LMOUSESELECT, "LEFT", 0, "Left", "Use left Mouse Button for selection"}, {0, "RIGHT", 0, "Right", "Use Right Mouse Button for selection"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem view_rotation_items[] = { + static const EnumPropertyItem view_rotation_items[] = { {0, "TURNTABLE", 0, "Turntable", "Use turntable style rotation in the viewport"}, {USER_TRACKBALL, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"}, {0, NULL, 0, NULL, NULL} }; #ifdef WITH_INPUT_NDOF - static EnumPropertyItem ndof_view_navigation_items[] = { + static const EnumPropertyItem ndof_view_navigation_items[] = { {0, "FREE", 0, "Free", "Use full 6 degrees of freedom by default"}, {NDOF_MODE_ORBIT, "ORBIT", 0, "Orbit", "Orbit about the view center by default"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem ndof_view_rotation_items[] = { + static const EnumPropertyItem ndof_view_rotation_items[] = { {NDOF_TURNTABLE, "TURNTABLE", 0, "Turntable", "Use turntable style rotation in the viewport"}, {0, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"}, {0, NULL, 0, NULL, NULL} }; #endif /* WITH_INPUT_NDOF */ - static EnumPropertyItem view_zoom_styles[] = { + static const EnumPropertyItem view_zoom_styles[] = { {USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"}, {USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zoom in and out based on vertical mouse movement"}, {USER_ZOOM_SCALE, "SCALE", 0, "Scale", @@ -4271,7 +4271,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem view_zoom_axes[] = { + static const EnumPropertyItem view_zoom_axes[] = { {0, "VERTICAL", 0, "Vertical", "Zoom in and out based on vertical mouse movement"}, {USER_ZOOM_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zoom in and out based on horizontal mouse movement"}, {0, NULL, 0, NULL, NULL} @@ -4472,7 +4472,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) PropertyRNA *prop; StructRNA *srna; - static EnumPropertyItem anim_player_presets[] = { + static const EnumPropertyItem anim_player_presets[] = { {0, "INTERNAL", 0, "Internal", "Built-in animation player"}, {2, "DJV", 0, "Djv", "Open source frame player: http://djv.sourceforge.net"}, {3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"}, @@ -4667,7 +4667,7 @@ void RNA_def_userdef(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem user_pref_sections[] = { + static const EnumPropertyItem user_pref_sections[] = { {USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""}, {USER_SECTION_EDIT, "EDITING", 0, "Editing", ""}, {USER_SECTION_INPUT, "INPUT", 0, "Input", ""}, diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 689a6406375..31393d0923d 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -45,7 +45,7 @@ #include "WM_types.h" #ifdef RNA_RUNTIME -static EnumPropertyItem event_keymouse_value_items[] = { +static const EnumPropertyItem event_keymouse_value_items[] = { {KM_ANY, "ANY", 0, "Any", ""}, {KM_PRESS, "PRESS", 0, "Press", ""}, {KM_RELEASE, "RELEASE", 0, "Release", ""}, @@ -54,7 +54,7 @@ static EnumPropertyItem event_keymouse_value_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem event_tweak_value_items[] = { +static const EnumPropertyItem event_tweak_value_items[] = { {KM_ANY, "ANY", 0, "Any", ""}, {EVT_GESTURE_N, "NORTH", 0, "North", ""}, {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""}, @@ -67,7 +67,7 @@ static EnumPropertyItem event_tweak_value_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem event_tweak_type_items[] = { +static const EnumPropertyItem event_tweak_type_items[] = { {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""}, {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""}, {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""}, @@ -76,7 +76,7 @@ static EnumPropertyItem event_tweak_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem event_mouse_type_items[] = { +static const EnumPropertyItem event_mouse_type_items[] = { {LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""}, {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""}, {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""}, @@ -102,7 +102,7 @@ static EnumPropertyItem event_mouse_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem event_timer_type_items[] = { +static const EnumPropertyItem event_timer_type_items[] = { {TIMER, "TIMER", 0, "Timer", ""}, {TIMER0, "TIMER0", 0, "Timer 0", ""}, {TIMER1, "TIMER1", 0, "Timer 1", ""}, @@ -114,12 +114,12 @@ static EnumPropertyItem event_timer_type_items[] = { {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem event_textinput_type_items[] = { +static const EnumPropertyItem event_textinput_type_items[] = { {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""}, {0, NULL, 0, NULL, NULL} }; -static EnumPropertyItem event_ndof_type_items[] = { +static const EnumPropertyItem event_ndof_type_items[] = { {NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""}, /* buttons on all 3dconnexion devices */ {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""}, @@ -171,7 +171,7 @@ static EnumPropertyItem event_ndof_type_items[] = { #endif /* RNA_RUNTIME */ /* not returned: CAPSLOCKKEY, UNKNOWNKEY */ -EnumPropertyItem rna_enum_event_type_items[] = { +const EnumPropertyItem rna_enum_event_type_items[] = { /* Note we abuse 'tooltip' message here to store a 'compact' form of some (too) long names. */ {0, "NONE", 0, "", ""}, {LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", "LMB"}, @@ -382,7 +382,7 @@ EnumPropertyItem rna_enum_event_type_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_event_value_items[] = { +const EnumPropertyItem rna_enum_event_value_items[] = { {KM_ANY, "ANY", 0, "Any", ""}, {KM_NOTHING, "NOTHING", 0, "Nothing", ""}, {KM_PRESS, "PRESS", 0, "Press", ""}, @@ -400,13 +400,13 @@ EnumPropertyItem rna_enum_event_value_items[] = { {0, NULL, 0, NULL, NULL} }; -EnumPropertyItem rna_enum_keymap_propvalue_items[] = { +const EnumPropertyItem rna_enum_keymap_propvalue_items[] = { {0, "NONE", 0, "", ""}, {0, NULL, 0, NULL, NULL} }; #if 0 -static EnumPropertyItem keymap_modifiers_items[] = { +static const EnumPropertyItem keymap_modifiers_items[] = { {KM_ANY, "ANY", 0, "Any", ""}, {0, "NONE", 0, "None", ""}, {1, "FIRST", 0, "First", ""}, @@ -417,7 +417,7 @@ static EnumPropertyItem keymap_modifiers_items[] = { #ifndef RNA_RUNTIME -static EnumPropertyItem operator_flag_items[] = { +static const EnumPropertyItem operator_flag_items[] = { {OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"}, {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"}, {OPTYPE_UNDO_GROUPED, "UNDO_GROUPED", 0, "Grouped Undo", "Push a single undo event for repetead instances of this operator"}, @@ -432,7 +432,7 @@ static EnumPropertyItem operator_flag_items[] = { }; #endif -EnumPropertyItem rna_enum_operator_return_items[] = { +const EnumPropertyItem rna_enum_operator_return_items[] = { {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"}, {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"}, {OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"}, @@ -443,7 +443,7 @@ EnumPropertyItem rna_enum_operator_return_items[] = { }; /* flag/enum */ -EnumPropertyItem rna_enum_wm_report_items[] = { +const EnumPropertyItem rna_enum_wm_report_items[] = { {RPT_DEBUG, "DEBUG", 0, "Debug", ""}, {RPT_INFO, "INFO", 0, "Info", ""}, {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""}, @@ -824,7 +824,7 @@ static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value) } -static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), +static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { int map_type = rna_wmKeyMapItem_map_type_get(ptr); @@ -837,7 +837,7 @@ static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerR else return rna_enum_event_type_items; } -static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), +static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { int map_type = rna_wmKeyMapItem_map_type_get(ptr); @@ -850,7 +850,7 @@ static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), Pointer return rna_enum_event_value_items; } -static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), +static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { wmWindowManager *wm = CTX_wm_manager(C); @@ -2147,7 +2147,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem map_type_items[] = { + static const EnumPropertyItem map_type_items[] = { {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""}, {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""}, {KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""}, diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index b9f0ae22fd2..188b63d7d24 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -46,7 +46,7 @@ #include "rna_internal.h" /* own include */ /* confusingm 2 enums mixed up here */ -EnumPropertyItem rna_enum_window_cursor_items[] = { +const EnumPropertyItem rna_enum_window_cursor_items[] = { {CURSOR_STD, "DEFAULT", 0, "Default", ""}, {CURSOR_NONE, "NONE", 0, "None", ""}, {CURSOR_WAIT, "WAIT", 0, "Wait", ""}, diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index c09cc204bbc..4e04581a0a8 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -28,11 +28,18 @@ #include "BKE_workspace.h" +#include "ED_render.h" + +#include "RE_engine.h" + #include "WM_api.h" #include "WM_types.h" #include "rna_internal.h" +/* Allow accessing private members of DNA_workspace_types.h */ +#define DNA_PRIVATE_WORKSPACE_ALLOW +#include "DNA_workspace_types.h" #ifdef RNA_RUNTIME @@ -42,7 +49,6 @@ #include "DNA_object_types.h" #include "DNA_screen_types.h" -#include "DNA_workspace_types.h" #include "RNA_access.h" @@ -154,6 +160,20 @@ static void rna_def_workspace(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Active Render Layer", "The active render layer used in this workspace"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL); + + /* View Render */ + prop = RNA_def_property(srna, "view_render", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "ViewRenderSettings"); + RNA_def_property_ui_text(prop, "View Render", ""); + + /* Flags */ + prop = RNA_def_property(srna, "use_scene_settings", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", WORKSPACE_USE_SCENE_SETTINGS); + RNA_def_property_ui_text(prop, "Scene Settings", + "Use scene settings instead of workspace settings"); + RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL); } static void rna_def_transform_orientation(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 8e3e5b67a76..6c6cf24c67e 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -130,7 +130,7 @@ static void rna_def_world_mtex(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem texco_items[] = { + static const EnumPropertyItem texco_items[] = { {TEXCO_VIEW, "VIEW", 0, "View", "Use view vector for the texture coordinates"}, {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates (interior mist)"}, {TEXCO_ANGMAP, "ANGMAP", 0, "AngMap", "Use 360 degree angular coordinates, e.g. for spherical light probes"}, @@ -210,27 +210,27 @@ static void rna_def_lighting(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem blend_mode_items[] = { + static const EnumPropertyItem blend_mode_items[] = { {WO_AOMUL, "MULTIPLY", 0, "Multiply", "Multiply direct lighting with ambient occlusion, darkening the result"}, {WO_AOADD, "ADD", 0, "Add", "Add light and shadow"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_color_items[] = { + static const EnumPropertyItem prop_color_items[] = { {WO_AOPLAIN, "PLAIN", 0, "White", "Plain diffuse energy (white.)"}, {WO_AOSKYCOL, "SKY_COLOR", 0, "Sky Color", "Use horizon and zenith color for diffuse energy"}, {WO_AOSKYTEX, "SKY_TEXTURE", 0, "Sky Texture", "Does full Sky texture render for diffuse energy"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_sample_method_items[] = { + static const EnumPropertyItem prop_sample_method_items[] = { {WO_AOSAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", "Fastest and gives the most noise"}, {WO_AOSAMP_HALTON, "ADAPTIVE_QMC", 0, "Adaptive QMC", "Fast in high-contrast areas"}, {WO_AOSAMP_HAMMERSLEY, "CONSTANT_QMC", 0, "Constant QMC", "Best quality"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_gather_method_items[] = { + static const EnumPropertyItem prop_gather_method_items[] = { {WO_AOGATHER_RAYTRACE, "RAYTRACE", 0, "Raytrace", "Accurate, but slow when noise-free results are required"}, {WO_AOGATHER_APPROX, "APPROXIMATE", 0, "Approximate", "Inaccurate, but faster and without noise"}, {0, NULL, 0, NULL, NULL} @@ -391,7 +391,7 @@ static void rna_def_world_mist(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem falloff_items[] = { + static const EnumPropertyItem falloff_items[] = { {0, "QUADRATIC", 0, "Quadratic", "Use quadratic progression"}, {1, "LINEAR", 0, "Linear", "Use linear progression"}, {2, "INVERSE_QUADRATIC", 0, "Inverse Quadratic", "Use inverse quadratic progression"}, diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 36778a18f77..8228ec079ff 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -65,7 +65,7 @@ static void composite_get_from_context(const bContext *C, bNodeTreeType *UNUSED( *r_ntree = scene->nodetree; } -static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func) +static void foreach_nodeclass(ViewRender *UNUSED(view_render), void *calldata, bNodeClassCallback func) { func(calldata, NODE_CLASS_INPUT, N_("Input")); func(calldata, NODE_CLASS_OUTPUT, N_("Output")); diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index a95c3233132..0ca36ef548e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -41,6 +41,7 @@ #include "BKE_context.h" #include "BKE_global.h" #include "BKE_main.h" +#include "BKE_scene.h" /* **************** IMAGE (and RenderResult, multilayer image) ******************** */ @@ -218,7 +219,7 @@ static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNo Scene *scene = (Scene *)node->id; if (scene) { - RenderEngineType *engine_type = RE_engines_find(scene->r.engine); + RenderEngineType *engine_type = RE_engines_find(scene->view_render.engine_id); if (engine_type && engine_type->update_render_passes) { SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, node->custom1); if (srl) { diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 35a8c712905..b014da90145 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -39,6 +39,7 @@ #include "DNA_space_types.h" #include "DNA_world_types.h" #include "DNA_linestyle_types.h" +#include "DNA_workspace_types.h" #include "BLI_listbase.h" #include "BLI_threads.h" @@ -67,23 +68,29 @@ static int shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype)) { Scene *scene = CTX_data_scene(C); + WorkSpace *workspace = CTX_wm_workspace(C); + ViewRender *view_render = BKE_viewrender_get(scene, workspace); + const char *engine_id = view_render->engine_id; + /* allow empty engine string too, this is from older versions that didn't have registerable engines yet */ - return (scene->r.engine[0] == '\0' || - STREQ(scene->r.engine, RE_engine_id_BLENDER_RENDER) || - STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME) || - STREQ(scene->r.engine, RE_engine_id_CYCLES) || - !BKE_scene_use_shading_nodes_custom(scene)); + return (engine_id[0] == '\0' || + STREQ(engine_id, RE_engine_id_BLENDER_RENDER) || + STREQ(engine_id, RE_engine_id_BLENDER_GAME) || + STREQ(engine_id, RE_engine_id_CYCLES) || + !BKE_viewrender_use_shading_nodes_custom(view_render)); } static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from) { SpaceNode *snode = CTX_wm_space_node(C); Scene *scene = CTX_data_scene(C); + WorkSpace *workspace = CTX_wm_workspace(C); SceneLayer *sl = CTX_data_scene_layer(C); Object *ob = OBACT_NEW(sl); + ViewRender *view_render = BKE_viewrender_get(scene, workspace); if ((snode->shaderfrom == SNODE_SHADER_OBJECT) || - (BKE_scene_use_new_shading_nodes(scene) == false)) + (BKE_viewrender_use_new_shading_nodes(view_render) == false)) { if (ob) { *r_from = &ob->id; @@ -119,12 +126,12 @@ static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tre } } -static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback func) +static void foreach_nodeclass(ViewRender *view_render, void *calldata, bNodeClassCallback func) { func(calldata, NODE_CLASS_INPUT, N_("Input")); func(calldata, NODE_CLASS_OUTPUT, N_("Output")); - if (BKE_scene_use_new_shading_nodes(scene)) { + if (BKE_viewrender_use_new_shading_nodes(view_render)) { func(calldata, NODE_CLASS_SHADER, N_("Shader")); func(calldata, NODE_CLASS_TEXTURE, N_("Texture")); } @@ -504,7 +511,7 @@ static bool ntree_tag_ssr_bsdf_cb(bNode *fromnode, bNode *UNUSED(tonode), void * */ static void ntree_shader_tag_ssr_node(bNodeTree *ntree, short compatibility) { - if (compatibility != NODE_NEWER_SHADING) { + if (compatibility & NODE_NEWER_SHADING) { /* We can only deal with new shading system here. */ return; } diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c index dcf6fec41a4..52f659d8321 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output.c +++ b/source/blender/nodes/shader/nodes/node_shader_output.c @@ -76,10 +76,6 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSE GPU_material_enable_alpha(mat); #endif - if (BKE_scene_uses_blender_eevee(GPU_material_scene(mat))) { - return false; - } - GPU_stack_link(mat, node, "output_node", in, out, &outlink); GPU_material_output_link(mat, outlink); diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 2ac4ce2f48c..6db5e106ed7 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -121,7 +121,7 @@ static void texture_get_from_context(const bContext *C, bNodeTreeType *UNUSED(tr } } -static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCallback func) +static void foreach_nodeclass(ViewRender *UNUSED(view_render), void *calldata, bNodeClassCallback func) { func(calldata, NODE_CLASS_INPUT, N_("Input")); func(calldata, NODE_CLASS_OUTPUT, N_("Output")); diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 5c938ef2ee3..9672b824843 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -476,34 +476,29 @@ int BGL_typeSize(int type) return -1; } -static int gl_buffer_type_from_py_format_char(char *typestr) +static int gl_buffer_type_from_py_buffer(Py_buffer *pybuffer) { + char *typestr = pybuffer->format; + Py_ssize_t itemsize = pybuffer->itemsize; + if (ELEM(typestr[0], '<', '>', '|')) { typestr += 1; } - char format = typestr[0]; - char byte_num = typestr[1]; - switch (format) { + switch (typestr[0]) { case 't': case 'b': case 'h': - if (!byte_num) return GL_BYTE; - ATTR_FALLTHROUGH; case 'i': - if (!byte_num) return GL_SHORT; - ATTR_FALLTHROUGH; case 'l': - if (!byte_num || byte_num == '4') return GL_INT; - if (byte_num == '1') return GL_BYTE; - if (byte_num == '2') return GL_SHORT; + if (itemsize == 1) return GL_BYTE; + if (itemsize == 2) return GL_SHORT; + if (itemsize == 4) return GL_INT; break; case 'f': - if (!byte_num) return GL_FLOAT; - ATTR_FALLTHROUGH; case 'd': - if (!byte_num || byte_num == '8') return GL_DOUBLE; - if (byte_num == '4') return GL_FLOAT; + if (itemsize == 4) return GL_FLOAT; + if (itemsize == 8) return GL_DOUBLE; break; } return -1; /* UNKNOWN */ @@ -801,7 +796,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject return NULL; } - if (type != gl_buffer_type_from_py_format_char(pybuffer.format)) { + if (type != gl_buffer_type_from_py_buffer(&pybuffer)) { PyErr_Format(PyExc_TypeError, "`GL_TYPE` and `typestr` of object with buffer interface do not match. '%s'", pybuffer.format); } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index a46fda7ea63..daef323058c 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -60,7 +60,7 @@ enum { extern BPy_StructRNA *bpy_context_module; -static EnumPropertyItem property_flag_items[] = { +static const EnumPropertyItem property_flag_items[] = { {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""}, {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""}, {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""}, @@ -73,11 +73,8 @@ static EnumPropertyItem property_flag_items[] = { " :arg options: Enumerator in ['HIDDEN', 'SKIP_SAVE', 'ANIMATABLE', 'LIBRARY_EDITABLE', 'PROPORTIONAL'," \ "'TEXTEDIT_UPDATE'].\n" \ " :type options: set\n" \ -" :arg poll: function to be called to determine whether an item is valid for this property.\n" \ -" The function must take 2 values (self,object) and return Bool.\n" \ -" :type poll: function\n" \ -static EnumPropertyItem property_flag_enum_items[] = { +static const EnumPropertyItem property_flag_enum_items[] = { {PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""}, {PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""}, {PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""}, @@ -93,7 +90,7 @@ static EnumPropertyItem property_flag_enum_items[] = { /* XXX Keep in sync with rna_rna.c's rna_enum_property_subtype_items ??? * Currently it is not... */ -static EnumPropertyItem property_subtype_string_items[] = { +static const EnumPropertyItem property_subtype_string_items[] = { {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""}, {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""}, {PROP_FILENAME, "FILE_NAME", 0, "Filename", ""}, @@ -107,7 +104,7 @@ static EnumPropertyItem property_subtype_string_items[] = { " :arg subtype: Enumerator in ['FILE_PATH', 'DIR_PATH', 'FILE_NAME', 'BYTE_STRING', 'PASSWORD', 'NONE'].\n" \ " :type subtype: string\n" \ -static EnumPropertyItem property_subtype_number_items[] = { +static const EnumPropertyItem property_subtype_number_items[] = { {PROP_PIXEL, "PIXEL", 0, "Pixel", ""}, {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""}, {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""}, @@ -123,7 +120,7 @@ static EnumPropertyItem property_subtype_number_items[] = { " :arg subtype: Enumerator in ['PIXEL', 'UNSIGNED', 'PERCENTAGE', 'FACTOR', 'ANGLE', 'TIME', 'DISTANCE', 'NONE'].\n" \ " :type subtype: string\n" \ -static EnumPropertyItem property_subtype_array_items[] = { +static const EnumPropertyItem property_subtype_array_items[] = { {PROP_COLOR, "COLOR", 0, "Color", ""}, {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""}, {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""}, @@ -1338,7 +1335,7 @@ static size_t strswapbufcpy(char *buf, const char **orig) static int icon_id_from_name(const char *name) { - EnumPropertyItem *item; + const EnumPropertyItem *item; int id; if (name[0]) { @@ -1352,7 +1349,7 @@ static int icon_id_from_name(const char *name) return 0; } -static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const bool is_enum_flag) +static const EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, int *defvalue, const bool is_enum_flag) { EnumPropertyItem *items; PyObject *item; @@ -1508,7 +1505,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i return items; } -static EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) +static const EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free) { PyGILState_STATE gilstate; @@ -1517,7 +1514,7 @@ static EnumPropertyItem *bpy_prop_enum_itemf_cb(struct bContext *C, PointerRNA * PyObject *args; PyObject *items; /* returned from the function call */ - EnumPropertyItem *eitems = NULL; + const EnumPropertyItem *eitems = NULL; int err = 0; if (C) { @@ -1941,6 +1938,11 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, PyObject *ge " *Warning* there are no safety checks to avoid infinite recursion.\n" \ " :type update: function\n" \ +#define BPY_PROPDEF_POLL_DOC \ +" :arg poll: function to be called to determine whether an item is valid for this property.\n" \ +" The function must take 2 values (self, object) and return Bool.\n" \ +" :type poll: function\n" \ + #define BPY_PROPDEF_GET_DOC \ " :arg get: Function to be called when this value is 'read',\n" \ " This function must take 1 value (self) and return the value of the property.\n" \ @@ -2746,7 +2748,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) int id_len; int defvalue = 0; PyObject *items, *items_fast; - EnumPropertyItem *eitems; + const EnumPropertyItem *eitems; PropertyRNA *prop; PyObject *pyopts = NULL; int opts = 0; @@ -2839,7 +2841,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw) * otherwise if this is a generator it may free the strings before we copy them */ Py_DECREF(items_fast); - MEM_freeN(eitems); + MEM_freeN((void *)eitems); } } Py_RETURN_NONE; @@ -2884,6 +2886,7 @@ BPY_PROPDEF_TYPE_DOC BPY_PROPDEF_NAME_DOC BPY_PROPDEF_DESC_DOC BPY_PROPDEF_OPTIONS_DOC +BPY_PROPDEF_POLL_DOC BPY_PROPDEF_UPDATE_DOC ); PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 02cb5233166..9630beb6e8b 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -758,7 +758,7 @@ thick_wrap_slice: /* same as RNA_enum_value_from_id but raises an exception */ int pyrna_enum_value_from_id( - EnumPropertyItem *item, const char *identifier, int *r_value, + const EnumPropertyItem *item, const char *identifier, int *r_value, const char *error_prefix) { if (RNA_enum_value_from_id(item, identifier, r_value) == 0) { @@ -1167,7 +1167,7 @@ static void pyrna_prop_array_dealloc(BPy_PropertyRNA *self) static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) { - EnumPropertyItem *item; + const EnumPropertyItem *item; const char *result; bool free = false; @@ -1179,8 +1179,9 @@ static const char *pyrna_enum_as_string(PointerRNA *ptr, PropertyRNA *prop) result = ""; } - if (free) - MEM_freeN(item); + if (free) { + MEM_freeN((void *)item); + } return result; } @@ -1221,7 +1222,7 @@ static int pyrna_string_to_enum( * needed when we want to use the full range of a signed short/char. */ BLI_bitmap *pyrna_set_to_enum_bitmap( - EnumPropertyItem *items, PyObject *value, + const EnumPropertyItem *items, PyObject *value, int type_size, bool type_convert_sign, int bitmap_size, const char *error_prefix) @@ -1277,7 +1278,7 @@ error: /* 'value' _must_ be a set type, error check before calling */ int pyrna_set_to_enum_bitfield( - EnumPropertyItem *items, PyObject *value, int *r_value, + const EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix) { /* set of enum items, concatenate all values with OR */ @@ -1315,7 +1316,7 @@ static int pyrna_prop_to_enum_bitfield( PointerRNA *ptr, PropertyRNA *prop, PyObject *value, int *r_value, const char *error_prefix) { - EnumPropertyItem *item; + const EnumPropertyItem *item; int ret; bool free = false; @@ -1346,13 +1347,14 @@ static int pyrna_prop_to_enum_bitfield( } } - if (free) - MEM_freeN(item); + if (free) { + MEM_freeN((void *)item); + } return ret; } -PyObject *pyrna_enum_bitfield_to_py(EnumPropertyItem *items, int value) +PyObject *pyrna_enum_bitfield_to_py(const EnumPropertyItem *items, int value) { PyObject *ret = PySet_New(NULL); const char *identifier[RNA_ENUM_BITFLAG_SIZE + 1]; @@ -1396,7 +1398,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) ret = PyUnicode_FromString(identifier); } else { - EnumPropertyItem *enum_item; + const EnumPropertyItem *enum_item; bool free; /* don't throw error here, can't trust blender 100% to give the @@ -1407,7 +1409,7 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) } else { if (free) { - MEM_freeN(enum_item); + MEM_freeN((void *)enum_item); } RNA_property_enum_items(NULL, ptr, prop, &enum_item, NULL, &free); @@ -1439,8 +1441,9 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) ret = PyUnicode_FromString(""); } - if (free) - MEM_freeN(enum_item); + if (free) { + MEM_freeN((void *)enum_item); + } #if 0 PyErr_Format(PyExc_AttributeError, "RNA Error: Current value \"%d\" matches no enum", val); diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 605f79b1ad8..f666294666e 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -186,14 +186,17 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const bool all_args, co PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop); unsigned int *pyrna_set_to_enum_bitmap( - struct EnumPropertyItem *items, PyObject *value, + const struct EnumPropertyItem *items, PyObject *value, int type_size, bool type_convert_sign, int bitmap_size, const char *error_prefix); -PyObject *pyrna_enum_bitfield_to_py(struct EnumPropertyItem *items, int value); -int pyrna_set_to_enum_bitfield(EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix); +PyObject *pyrna_enum_bitfield_to_py( + const struct EnumPropertyItem *items, int value); +int pyrna_set_to_enum_bitfield( + const struct EnumPropertyItem *items, PyObject *value, int *r_value, const char *error_prefix); -int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix); +int pyrna_enum_value_from_id( + const EnumPropertyItem *item, const char *identifier, int *value, const char *error_prefix); int pyrna_deferred_register_class(struct StructRNA *srna, PyTypeObject *py_class); diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index df1c4155a6d..fe3565fc44e 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -53,7 +53,7 @@ #define RNA_CAPSULE_ID "RNA_HANDLE" #define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED" -static EnumPropertyItem region_draw_mode_items[] = { +static const EnumPropertyItem region_draw_mode_items[] = { {REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""}, {REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Post View", ""}, {REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""}, diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index 2b8ad6ccb90..c15ff50df04 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -47,10 +47,10 @@ static bContext *__py_context = NULL; bContext *BPy_GetContext(void) { return __py_context; } void BPy_SetContext(bContext *C) { __py_context = C; } -char *BPy_enum_as_string(EnumPropertyItem *item) +char *BPy_enum_as_string(const EnumPropertyItem *item) { DynStr *dynstr = BLI_dynstr_new(); - EnumPropertyItem *e; + const EnumPropertyItem *e; char *cstring; for (e = item; item->identifier; item++) { diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h index 6000bf94aef..466941359a8 100644 --- a/source/blender/python/intern/bpy_util.h +++ b/source/blender/python/intern/bpy_util.h @@ -34,7 +34,7 @@ struct EnumPropertyItem; struct ReportList; -char *BPy_enum_as_string(struct EnumPropertyItem *item); +char *BPy_enum_as_string(const struct EnumPropertyItem *item); #define BLANK_PYTHON_TYPE {PyVarObject_HEAD_INIT(NULL, 0) NULL} diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/extern/include/RE_bake.h index a04d1d6632c..090e0e6c28d 100644 --- a/source/blender/render/extern/include/RE_bake.h +++ b/source/blender/render/extern/include/RE_bake.h @@ -72,13 +72,13 @@ bool RE_bake_has_engine(struct Render *re); bool RE_bake_engine( struct Render *re, struct Object *object, const int object_id, const BakePixel pixel_array[], - const size_t num_pixels, const int depth, const ScenePassType pass_type, const int pass_filter, float result[]); + const size_t num_pixels, const int depth, const eScenePassType pass_type, const int pass_filter, float result[]); /* bake.c */ -int RE_pass_depth(const ScenePassType pass_type); +int RE_pass_depth(const eScenePassType pass_type); bool RE_bake_internal( struct Render *re, struct Object *object, const BakePixel pixel_array[], - const size_t num_pixels, const int depth, const ScenePassType pass_type, float result[]); + const size_t num_pixels, const int depth, const eScenePassType pass_type, float result[]); bool RE_bake_pixels_populate_from_objects( struct Mesh *me_low, BakePixel pixel_array_from[], BakePixel pixel_array_to[], @@ -95,13 +95,13 @@ void RE_bake_margin(struct ImBuf *ibuf, char *mask, const int margin); void RE_bake_normal_world_to_object( const BakePixel pixel_array[], const size_t num_pixels, const int depth, float result[], - struct Object *ob, const BakeNormalSwizzle normal_swizzle[3]); + struct Object *ob, const eBakeNormalSwizzle normal_swizzle[3]); void RE_bake_normal_world_to_tangent( const BakePixel pixel_array[], const size_t num_pixels, const int depth, float result[], - struct Mesh *me, const BakeNormalSwizzle normal_swizzle[3], float mat[4][4]); + struct Mesh *me, const eBakeNormalSwizzle normal_swizzle[3], float mat[4][4]); void RE_bake_normal_world_to_world( const BakePixel pixel_array[], const size_t num_pixels, const int depth, float result[], - const BakeNormalSwizzle normal_swizzle[3]); + const eBakeNormalSwizzle normal_swizzle[3]); void RE_bake_ibuf_clear(struct Image *image, const bool is_tangent); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 09f308da10a..c19c332c677 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -51,6 +51,7 @@ struct Scene; struct SceneRenderLayer; struct EnvMap; struct StampData; +struct ViewRender; /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* this include is what is exposed of render to outside world */ @@ -243,7 +244,7 @@ struct RenderPass *RE_create_gp_pass(struct RenderResult *rr, const char *layern /* obligatory initialize call, disprect is optional */ void RE_InitState(struct Render *re, struct Render *source, struct RenderData *rd, - struct SceneRenderLayer *srl, + struct ViewRender *view_render, struct SceneRenderLayer *srl, int winx, int winy, rcti *disprect); void RE_ChangeResolution(struct Render *re, int winx, int winy, rcti *disprect); void RE_ChangeModeFlag(struct Render *re, int flag, bool clear); @@ -304,11 +305,13 @@ void RE_RenderFreestyleExternal(struct Render *re); void RE_SetActiveRenderView(struct Render *re, const char *viewname); const char *RE_GetActiveRenderView(struct Render *re); +void RE_SetEngineByID(struct Render *re, const char *engine_id); + /* error reporting */ void RE_SetReports(struct Render *re, struct ReportList *reports); /* main preview render call */ -void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene); +void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene, struct ViewRender *render_view); bool RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); bool RE_WriteRenderResult( diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 1de1f23f351..c97832f32c5 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -192,6 +192,7 @@ struct Render { Scene *scene; RenderData r; World wrld; + ViewRender view_render; struct Object *camera_override; unsigned int lay, layer_override; diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/include/renderpipeline.h index c5d6e3b44b1..44df2726847 100644 --- a/source/blender/render/intern/include/renderpipeline.h +++ b/source/blender/render/intern/include/renderpipeline.h @@ -37,11 +37,13 @@ struct Render; struct RenderData; struct RenderLayer; struct RenderResult; +struct ViewRender; struct RenderLayer *render_get_active_layer(struct Render *re, struct RenderResult *rr); float panorama_pixel_rot(struct Render *re); void render_update_anim_renderdata(struct Render *re, struct RenderData *rd); void render_copy_renderdata(struct RenderData *to, struct RenderData *from); +void render_copy_viewrender(struct ViewRender *to, struct ViewRender *from); #endif /* __RENDERPIPELINE_H__ */ diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/source/bake_api.c index 588c327ab91..505af3c2fa8 100644 --- a/source/blender/render/intern/source/bake_api.c +++ b/source/blender/render/intern/source/bake_api.c @@ -734,7 +734,7 @@ static void normal_uncompress(float out[3], const float in[3]) out[i] = 2.0f * in[i] - 1.0f; } -static void normal_compress(float out[3], const float in[3], const BakeNormalSwizzle normal_swizzle[3]) +static void normal_compress(float out[3], const float in[3], const eBakeNormalSwizzle normal_swizzle[3]) { const int swizzle_index[6] = { 0, /* R_BAKE_POSX */ @@ -777,7 +777,7 @@ static void normal_compress(float out[3], const float in[3], const BakeNormalSwi */ void RE_bake_normal_world_to_tangent( const BakePixel pixel_array[], const size_t num_pixels, const int depth, - float result[], Mesh *me, const BakeNormalSwizzle normal_swizzle[3], + float result[], Mesh *me, const eBakeNormalSwizzle normal_swizzle[3], float mat[4][4]) { size_t i; @@ -888,7 +888,7 @@ void RE_bake_normal_world_to_tangent( void RE_bake_normal_world_to_object( const BakePixel pixel_array[], const size_t num_pixels, const int depth, - float result[], struct Object *ob, const BakeNormalSwizzle normal_swizzle[3]) + float result[], struct Object *ob, const eBakeNormalSwizzle normal_swizzle[3]) { size_t i; float iobmat[4][4]; @@ -916,7 +916,7 @@ void RE_bake_normal_world_to_object( void RE_bake_normal_world_to_world( const BakePixel pixel_array[], const size_t num_pixels, const int depth, - float result[], const BakeNormalSwizzle normal_swizzle[3]) + float result[], const eBakeNormalSwizzle normal_swizzle[3]) { size_t i; @@ -975,7 +975,7 @@ static bool bake_uv(const BakePixel pixel_array[], const size_t num_pixels, cons bool RE_bake_internal( Render *UNUSED(re), Object *UNUSED(object), const BakePixel pixel_array[], - const size_t num_pixels, const int depth, const ScenePassType pass_type, float result[]) + const size_t num_pixels, const int depth, const eScenePassType pass_type, float result[]) { switch (pass_type) { case SCE_PASS_UV: @@ -988,7 +988,7 @@ bool RE_bake_internal( return false; } -int RE_pass_depth(const ScenePassType pass_type) +int RE_pass_depth(const eScenePassType pass_type) { /* IMB_buffer_byte_from_float assumes 4 channels * making it work for now - XXX */ diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 1329ad484ea..76daa635df2 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -71,6 +71,7 @@ #include "BKE_key.h" #include "BKE_image.h" #include "BKE_lattice.h" +#include "BKE_layer.h" #include "BKE_material.h" #include "BKE_main.h" #include "BKE_mball.h" @@ -4848,6 +4849,8 @@ void RE_Database_Free(Render *re) BLI_memarena_free(re->memArena); re->memArena = NULL; } + + BKE_viewrender_free(&re->view_render); } static int allow_render_object(Render *re, Object *ob, int nolamps, int onlyselected, Object *actob) @@ -5200,6 +5203,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l re->i.infostr= "Preparing Scene data"; re->i.cfra= scene->r.cfra; BLI_strncpy(re->i.scene_name, scene->id.name + 2, sizeof(re->i.scene_name)); + re->view_render = scene->view_render; /* XXX add test if dbase was filled already? */ @@ -5909,6 +5913,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, /* renderdata setup and exceptions */ render_copy_renderdata(&re->r, &scene->r); + render_copy_viewrender(&re->view_render, &scene->view_render); RE_init_threadcount(re); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 7bd8c6decf0..1aab70c0fb9 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -142,7 +142,6 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) envre->flag = re->flag; /* set up renderdata */ - render_copy_renderdata(&envre->r, &re->r); envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR); BLI_freelistN(&envre->r.layers); BLI_freelistN(&envre->r.views); @@ -152,7 +151,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) envre->r.size = 100; envre->r.yasp = envre->r.xasp = 1; - RE_InitState(envre, NULL, &envre->r, NULL, cuberes, cuberes, NULL); + RE_InitState(envre, NULL, &envre->r, &envre->view_render, NULL, cuberes, cuberes, NULL); envre->main = re->main; envre->scene = re->scene; /* unsure about this... */ envre->scene_color_manage = re->scene_color_manage; diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index c2e6d540ad8..2c1fcd037e6 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -152,8 +152,7 @@ RenderEngineType *RE_engines_find(const char *idname) bool RE_engine_is_external(Render *re) { - RenderEngineType *type = RE_engines_find(re->r.engine); - return (type && type->render_to_image); + return (re->engine && re->engine->type && re->engine->type->render_to_image); } /* Create, Free */ @@ -521,11 +520,12 @@ void RE_bake_engine_set_engine_parameters(Render *re, Main *bmain, Depsgraph *gr re->scene = scene; re->main = bmain; render_copy_renderdata(&re->r, &scene->r); + render_copy_viewrender(&re->view_render, &scene->view_render); } bool RE_bake_has_engine(Render *re) { - RenderEngineType *type = RE_engines_find(re->r.engine); + RenderEngineType *type = RE_engines_find(re->view_render.engine_id); return (type->bake != NULL); } @@ -533,10 +533,10 @@ bool RE_bake_engine( Render *re, Object *object, const int object_id, const BakePixel pixel_array[], const size_t num_pixels, const int depth, - const ScenePassType pass_type, const int pass_filter, + const eScenePassType pass_type, const int pass_filter, float result[]) { - RenderEngineType *type = RE_engines_find(re->r.engine); + RenderEngineType *type = RE_engines_find(re->view_render.engine_id); RenderEngine *engine; bool persistent_data = (re->r.mode & R_PERSISTENT_DATA) != 0; @@ -630,7 +630,7 @@ void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe) int RE_engine_render(Render *re, int do_all) { - RenderEngineType *type = RE_engines_find(re->r.engine); + RenderEngineType *type = RE_engines_find(re->view_render.engine_id); RenderEngine *engine; bool persistent_data = (re->r.mode & R_PERSISTENT_DATA) != 0; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 2a390c5fb97..019773a91db 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -660,12 +660,13 @@ void RE_FreePersistentData(void) /* ********* initialize state ******** */ /* clear full sample and tile flags if needed */ -static int check_mode_full_sample(RenderData *rd) +static int check_mode_full_sample(RenderData *rd, ViewRender *view_render) { + const char *engine_id = view_render->engine_id; int scemode = rd->scemode; - if (!STREQ(rd->engine, RE_engine_id_BLENDER_RENDER) && - !STREQ(rd->engine, RE_engine_id_BLENDER_GAME)) + if (!STREQ(engine_id, RE_engine_id_BLENDER_RENDER) && + !STREQ(engine_id, RE_engine_id_BLENDER_GAME)) { scemode &= ~R_FULL_SAMPLE; } @@ -738,10 +739,15 @@ void render_copy_renderdata(RenderData *to, RenderData *from) curvemapping_copy_data(&to->mblur_shutter_curve, &from->mblur_shutter_curve); } +void render_copy_viewrender(ViewRender *to, ViewRender *from) +{ + BKE_viewrender_copy(to, from); +} + /* what doesn't change during entire render sequence */ /* disprect is optional, if NULL it assumes full window render */ void RE_InitState(Render *re, Render *source, RenderData *rd, - SceneRenderLayer *srl, + ViewRender *view_render, SceneRenderLayer *srl, int winx, int winy, rcti *disprect) { bool had_freestyle = (re->r.mode & R_EDGE_FRS) != 0; @@ -752,6 +758,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, /* copy render data and render layers for thread safety */ render_copy_renderdata(&re->r, rd); + render_copy_viewrender(&re->view_render, view_render); if (source) { /* reuse border flags from source renderer */ @@ -781,7 +788,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, return; } - re->r.scemode = check_mode_full_sample(&re->r); + re->r.scemode = check_mode_full_sample(&re->r, &re->view_render); /* fullsample wants uniform osa levels */ if (source && (re->r.scemode & R_FULL_SAMPLE)) { @@ -1968,7 +1975,7 @@ static void render_scene(Render *re, Scene *sce, int cfra) } /* initial setup */ - RE_InitState(resc, re, &sce->r, NULL, winx, winy, &re->disprect); + RE_InitState(resc, re, &sce->r, &sce->view_render, NULL, winx, winy, &re->disprect); /* We still want to use 'rendercache' setting from org (main) scene... */ resc->r.scemode = (resc->r.scemode & ~R_EXR_CACHE_FILE) | (re->r.scemode & R_EXR_CACHE_FILE); @@ -2058,15 +2065,8 @@ bool RE_allow_render_generic_object(Object *ob) #ifdef DEPSGRAPH_WORKAROUND_HACK static void tag_dependend_objects_for_render(Scene *scene, int UNUSED(renderlay)) { - Scene *sce_iter; - Base *base; - for (SETLOOPER(scene, sce_iter, base)) { - Object *object = base->object; - - if ((base->flag & BASE_VISIBLED) == 0) { - continue; - } - + FOREACH_OBJECT_RENDERABLE(scene, object) + { if (object->type == OB_MESH) { if (RE_allow_render_generic_object(object)) { ModifierData *md; @@ -2105,6 +2105,7 @@ static void tag_dependend_objects_for_render(Scene *scene, int UNUSED(renderlay) } } } + FOREACH_OBJECT_RENDERABLE_END } #endif @@ -2875,7 +2876,7 @@ static void do_render_all_options(Render *re) bool RE_force_single_renderlayer(Scene *scene) { - int scemode = check_mode_full_sample(&scene->r); + int scemode = check_mode_full_sample(&scene->r, &scene->view_render); if (scemode & R_SINGLE_LAYER) { SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); /* force layer to be enabled */ @@ -3022,7 +3023,7 @@ static int check_composite_output(Scene *scene) bool RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *reports) { - int scemode = check_mode_full_sample(&scene->r); + int scemode = check_mode_full_sample(&scene->r, &scene->view_render); if (scene->r.mode & R_BORDER) { if (scene->r.border.xmax <= scene->r.border.xmin || @@ -3135,13 +3136,14 @@ static void validate_render_settings(Render *re) } } -static void update_physics_cache(Render *re, Scene *scene, int UNUSED(anim_init)) +static void update_physics_cache(Render *re, Scene *scene, SceneLayer *scene_layer, int UNUSED(anim_init)) { PTCacheBaker baker; memset(&baker, 0, sizeof(baker)); baker.main = re->main; baker.scene = scene; + baker.scene_layer = scene_layer; baker.bake = 0; baker.render = 1; baker.anim_init = 1; @@ -3160,9 +3162,15 @@ const char *RE_GetActiveRenderView(Render *re) return re->viewname; } +void RE_SetEngineByID(Render *re, const char *engine_id) +{ + BLI_strncpy(re->view_render.engine_id, engine_id, sizeof(re->view_render.engine_id)); +} + /* evaluating scene options for general Blender render */ -static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, Scene *scene, SceneRenderLayer *srl, - Object *camera_override, unsigned int lay_override, int anim, int anim_init) +static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, Scene *scene, ViewRender *view_render, + SceneRenderLayer *srl, Object *camera_override, unsigned int lay_override, + int anim, int anim_init) { int winx, winy; rcti disprect; @@ -3196,6 +3204,7 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, re->layer_override = lay_override; re->i.localview = (re->lay & 0xFF000000) != 0; re->viewname[0] = '\0'; + RE_SetEngineByID(re, view_render->engine_id); /* not too nice, but it survives anim-border render */ if (anim) { @@ -3214,7 +3223,8 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, */ if (0) { /* make sure dynamics are up to date */ - update_physics_cache(re, scene, anim_init); + SceneLayer *scene_layer = BKE_scene_layer_from_scene_get(scene); + update_physics_cache(re, scene, scene_layer, anim_init); } if (srl || scene->r.scemode & R_SINGLE_LAYER) { @@ -3223,7 +3233,7 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, BLI_rw_mutex_unlock(&re->resultmutex); } - RE_InitState(re, NULL, &scene->r, srl, winx, winy, &disprect); + RE_InitState(re, NULL, &scene->r, &scene->view_render, srl, winx, winy, &disprect); if (!re->ok) /* if an error was printed, abort */ return 0; @@ -3254,7 +3264,9 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr scene->r.cfra = frame; - if (render_initialize_from_main(re, &scene->r, bmain, scene, srl, camera_override, lay_override, 0, 0)) { + if (render_initialize_from_main(re, &scene->r, bmain, scene, &scene->view_render, srl, + camera_override, lay_override, 0, 0)) + { MEM_reset_peak_memory(); BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); @@ -3293,7 +3305,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene, int render) { re->result_ok= 0; - if (render_initialize_from_main(re, &scene->r, bmain, scene, NULL, NULL, scene->lay, 0, 0)) { + if (render_initialize_from_main(re, &scene->r, bmain, scene, &scene->view_render, NULL, NULL, scene->lay, 0, 0)) { if (render) do_render_fields_blur_3d(re); } @@ -3591,7 +3603,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_INIT); /* do not fully call for each frame, it initializes & pops output window */ - if (!render_initialize_from_main(re, &rd, bmain, scene, NULL, camera_override, lay_override, 0, 1)) + if (!render_initialize_from_main(re, &rd, bmain, scene, &scene->view_render, NULL, camera_override, lay_override, 0, 1)) return; /* MULTIVIEW_TODO: @@ -3681,7 +3693,8 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri } /* only border now, todo: camera lens. (ton) */ - render_initialize_from_main(re, &rd, bmain, scene, NULL, camera_override, lay_override, 1, 0); + render_initialize_from_main(re, &rd, bmain, scene, &scene->view_render, + NULL, camera_override, lay_override, 1, 0); if (nfra != scene->r.cfra) { /* Skip this frame, but update for physics and particles system. */ @@ -3831,7 +3844,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri G.is_rendering = false; } -void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) +void RE_PreviewRender(Render *re, Main *bmain, Scene *sce, ViewRender *view_render) { Object *camera; SceneLayer *scene_layer = BKE_scene_layer_from_scene_get(sce); @@ -3840,7 +3853,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) winx = (sce->r.size * sce->r.xsch) / 100; winy = (sce->r.size * sce->r.ysch) / 100; - RE_InitState(re, NULL, &sce->r, NULL, winx, winy, NULL); + RE_InitState(re, NULL, &sce->r, view_render, NULL, winx, winy, NULL); re->pool = BKE_image_pool_new(); @@ -3895,7 +3908,7 @@ bool RE_ReadRenderResult(Scene *scene, Scene *scenode) re = RE_GetSceneRender(scene); if (re == NULL) re = RE_NewSceneRender(scene); - RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect); + RE_InitState(re, NULL, &scene->r, &scene->view_render, NULL, winx, winy, &disprect); re->scene = scene; re->scene_color_manage = BKE_scene_check_color_management_enabled(scene); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 63fe7e4471a..4ba6e914c68 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -945,7 +945,7 @@ static void particle_system_minmax(EvaluationContext *eval_ctx, void RE_point_density_cache( Scene *scene, - SceneLayer *sl, + SceneLayer *scene_layer, PointDensity *pd, const bool use_render_params) { @@ -955,7 +955,7 @@ void RE_point_density_cache( DEG_evaluation_context_init(&eval_ctx, use_render_params ? DAG_EVAL_RENDER : DAG_EVAL_VIEWPORT); - eval_ctx.scene_layer = sl; + eval_ctx.scene_layer = scene_layer; /* Same matricies/resolution as dupli_render_particle_set(). */ unit_m4(mat); diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 8a6d4bc95c7..464906dad1e 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -63,6 +63,7 @@ set(SRC intern/wm_files.c intern/wm_files_link.c intern/wm_gesture.c + intern/wm_gesture_ops.c intern/wm_init_exit.c intern/wm_jobs.c intern/wm_keymap.c diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 7eaf7222714..e7437c2e2b8 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -103,6 +103,7 @@ bool WM_window_is_fullscreen(struct wmWindow *win); void WM_windows_scene_data_sync(const ListBase *win_lb, struct Scene *scene) ATTR_NONNULL(); struct Scene *WM_windows_scene_get_from_screen(const struct wmWindowManager *wm, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; +struct WorkSpace *WM_windows_workspace_get_from_screen(const wmWindowManager *wm, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; struct Scene *WM_window_get_active_scene(const struct wmWindow *win) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; void WM_window_change_active_scene(struct Main *bmain, struct bContext *C, struct wmWindow *win, @@ -335,9 +336,18 @@ void WM_operator_properties_filesel( void WM_operator_properties_border(struct wmOperatorType *ot); void WM_operator_properties_border_to_rcti(struct wmOperator *op, struct rcti *rect); void WM_operator_properties_border_to_rctf(struct wmOperator *op, rctf *rect); -void WM_operator_properties_gesture_border(struct wmOperatorType *ot, bool extend); -void WM_operator_properties_mouse_select(struct wmOperatorType *ot); +void WM_operator_properties_gesture_border_ex(struct wmOperatorType *ot, bool deselect, bool extend); +void WM_operator_properties_gesture_border(struct wmOperatorType *ot); +void WM_operator_properties_gesture_border_select(struct wmOperatorType *ot); +void WM_operator_properties_gesture_border_zoom(struct wmOperatorType *ot); +void WM_operator_properties_gesture_lasso_ex(struct wmOperatorType *ot, bool deselect, bool extend); +void WM_operator_properties_gesture_lasso(struct wmOperatorType *ot); +void WM_operator_properties_gesture_lasso_select(struct wmOperatorType *ot); void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor); +void WM_operator_properties_gesture_circle_ex(struct wmOperatorType *ot, bool deselect); +void WM_operator_properties_gesture_circle(struct wmOperatorType *ot); +void WM_operator_properties_gesture_circle_select(struct wmOperatorType *ot); +void WM_operator_properties_mouse_select(struct wmOperatorType *ot); void WM_operator_properties_select_all(struct wmOperatorType *ot); void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action); void WM_operator_properties_select_action_simple(struct wmOperatorType *ot, int default_action); @@ -397,10 +407,10 @@ bool WM_menutype_add(struct MenuType *mt); void WM_menutype_freelink(struct MenuType *mt); void WM_menutype_free(void); - /* default operator callbacks for border/circle/lasso */ -int WM_border_select_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -int WM_border_select_modal (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); -void WM_border_select_cancel(struct bContext *C, struct wmOperator *op); +/* wm_gesture_ops.c */ +int WM_gesture_border_invoke (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); +int WM_gesture_border_modal (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); +void WM_gesture_border_cancel(struct bContext *C, struct wmOperator *op); int WM_gesture_circle_invoke(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_gesture_circle_modal(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); void WM_gesture_circle_cancel(struct bContext *C, struct wmOperator *op); diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index a6413369a8f..4f96e40d9ff 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -90,7 +90,7 @@ char *WM_modalkeymap_operator_items_to_string_buf( struct wmOperatorType *ot, const int propvalue, const bool compact, const int max_len, int *r_available_len, char **r_str); -wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, struct EnumPropertyItem *items); +wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, const struct EnumPropertyItem *items); wmKeyMap *WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname); wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value); wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 6b723b034c9..f88ed3e87f6 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -415,11 +415,17 @@ typedef struct wmNotifier { typedef struct wmGesture { struct wmGesture *next, *prev; int event_type; /* event->type */ - int mode; /* for modal callback */ int type; /* gesture type define */ int swinid; /* initial subwindow id where it started */ int points; /* optional, amount of points stored */ - int size; /* optional, maximum amount of points stored */ + int points_alloc; /* optional, maximum amount of points stored */ + int modal_state; + + /* For modal operators which may be running idle, waiting for an event to activate the gesture. + * Typically this is set when the user is click-dragging the gesture (border and circle select for eg). */ + uint is_active : 1; + /* Use for gestures that support both immediate or delayed activation. */ + uint wait_for_input : 1; void *customdata; /* customdata for border is a recti */ diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 40a2bf42a28..05d9689565c 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -187,7 +187,7 @@ void WM_drag_free_list(struct ListBase *lb) } } -static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, wmEvent *event) +static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, const wmEvent *event) { wmEventHandler *handler = handlers->first; for (; handler; handler = handler->next) { @@ -205,7 +205,7 @@ static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, } /* return active operator name when mouse is in box */ -static const char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event) +static const char *wm_dropbox_active(bContext *C, wmDrag *drag, const wmEvent *event) { wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); @@ -225,7 +225,7 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event) } -static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event) +static void wm_drop_operator_options(bContext *C, wmDrag *drag, const wmEvent *event) { wmWindow *win = CTX_wm_window(C); const int winsize_x = WM_window_pixels_x(win); @@ -255,7 +255,7 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event) } /* called in inner handler loop, region context */ -void wm_drags_check_ops(bContext *C, wmEvent *event) +void wm_drags_check_ops(bContext *C, const wmEvent *event) { wmWindowManager *wm = CTX_wm_manager(C); wmDrag *drag; diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 97f581f4d66..8fcebc6f560 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -647,7 +647,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) } } -static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, StereoViews sview) +static void wm_method_draw_triple_multiview(bContext *C, wmWindow *win, eStereoViews sview) { wmWindowManager *wm = CTX_wm_manager(C); wmDrawData *drawdata; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a34e3d76a4c..f598f2a50f6 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -84,6 +84,9 @@ #include "RNA_enum_types.h" +/* Motion in pixels allowed before we don't consider single/double click. */ +#define WM_EVENT_CLICK_WIGGLE_ROOM 2 + static void wm_notifier_clear(wmNotifier *note); static void update_tablet_data(wmWindow *win, wmEvent *event); @@ -413,12 +416,13 @@ void wm_event_do_notifiers(bContext *C) for (win = wm->windows.first; win; win = win->next) { Scene *scene = WM_window_get_active_scene(win); bScreen *screen = WM_window_get_active_screen(win); + WorkSpace *workspace = WM_window_get_active_workspace(win); /* filter out notifiers */ if (note->category == NC_SCREEN && note->reference && note->reference != screen && - note->reference != WM_window_get_active_workspace(win) && + note->reference != workspace && note->reference != WM_window_get_active_layout(win)) { /* pass */ @@ -440,7 +444,7 @@ void wm_event_do_notifiers(bContext *C) } ED_screen_areas_iter(win, screen, sa) { - ED_area_do_listen(screen, sa, note, scene); + ED_area_do_listen(screen, sa, note, scene, workspace); for (ar = sa->regionbase.first; ar; ar = ar->next) { ED_region_do_listen(screen, sa, ar, note, scene); } @@ -776,12 +780,16 @@ static bool wm_operator_register_check(wmWindowManager *wm, wmOperatorType *ot) return wm && (wm->op_undo_depth == 0) && (ot->flag & (OPTYPE_REGISTER | OPTYPE_UNDO)); } -static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat) +static void wm_operator_finished(bContext *C, wmOperator *op, const bool repeat, const bool store) { wmWindowManager *wm = CTX_wm_manager(C); op->customdata = NULL; + if (store) { + WM_operator_last_properties_store(op); + } + /* we don't want to do undo pushes for operators that are being * called from operators that already do an undo push. usually * this will happen for python operators that call C operators */ @@ -844,12 +852,7 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons wm_operator_reports(C, op, retval, false); if (retval & OPERATOR_FINISHED) { - if (store) { - if (wm->op_undo_depth == 0) { /* not called by py script */ - WM_operator_last_properties_store(op); - } - } - wm_operator_finished(C, op, repeat); + wm_operator_finished(C, op, repeat, store && wm->op_undo_depth == 0); } else if (repeat == 0) { /* warning: modal from exec is bad practice, but avoid crashing. */ @@ -1205,10 +1208,8 @@ static int wm_operator_invoke( /* do nothing, wm_operator_exec() has been called somewhere */ } else if (retval & OPERATOR_FINISHED) { - if (!is_nested_call) { /* not called by py script */ - WM_operator_last_properties_store(op); - } - wm_operator_finished(C, op, 0); + const bool store = !is_nested_call; + wm_operator_finished(C, op, false, store); } else if (retval & OPERATOR_RUNNING_MODAL) { /* take ownership of reports (in case python provided own) */ @@ -1819,7 +1820,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand /* important to run 'wm_operator_finished' before NULLing the context members */ if (retval & OPERATOR_FINISHED) { - wm_operator_finished(C, op, 0); + wm_operator_finished(C, op, false, true); handler->op = NULL; } else if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) { @@ -2408,7 +2409,9 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) if ((event->val == KM_RELEASE) && (win->eventstate->prevval == KM_PRESS) && - (win->eventstate->check_click == true)) + (win->eventstate->check_click == true) && + ((abs(event->x - win->eventstate->prevclickx)) <= WM_EVENT_CLICK_WIGGLE_ROOM && + (abs(event->y - win->eventstate->prevclicky)) <= WM_EVENT_CLICK_WIGGLE_ROOM)) { event->val = KM_CLICK; @@ -3408,8 +3411,9 @@ static bool wm_event_is_double_click(wmEvent *event, const wmEvent *event_state) (event_state->prevval == KM_RELEASE) && (event->val == KM_PRESS)) { - if ((ISMOUSE(event->type) == false) || ((ABS(event->x - event_state->prevclickx)) <= 2 && - (ABS(event->y - event_state->prevclicky)) <= 2)) + if ((ISMOUSE(event->type) == false) || + ((abs(event->x - event_state->prevclickx)) <= WM_EVENT_CLICK_WIGGLE_ROOM && + (abs(event->y - event_state->prevclicky)) <= WM_EVENT_CLICK_WIGGLE_ROOM)) { if ((PIL_check_seconds_timer() - event_state->prevclicktime) * 1000 < U.dbl_click_time) { return true; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 096d92aee6d..9ad781ab700 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -434,8 +434,9 @@ void wm_file_read_report(bContext *C) Scene *sce; for (sce = G.main->scene.first; sce; sce = sce->id.next) { - if (sce->r.engine[0] && - BLI_findstring(&R_engines, sce->r.engine, offsetof(RenderEngineType, idname)) == NULL) + ViewRender *view_render = &sce->view_render; + if (view_render->engine_id[0] && + BLI_findstring(&R_engines, view_render->engine_id, offsetof(RenderEngineType, idname)) == NULL) { if (reports == NULL) { reports = CTX_wm_reports(C); @@ -443,7 +444,7 @@ void wm_file_read_report(bContext *C) BKE_reportf(reports, RPT_ERROR, "Engine '%s' not available for scene '%s' (an add-on may need to be installed or enabled)", - sce->r.engine, sce->id.name + 2); + view_render->engine_id, sce->id.name + 2); } } @@ -1001,7 +1002,7 @@ static void wm_history_file_update(void) /* screen can be NULL */ -static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, SceneLayer *sl, bScreen *screen, BlendThumbnail **thumb_pt) +static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, SceneLayer *scene_layer, bScreen *screen, BlendThumbnail **thumb_pt) { /* will be scaled down, but gives some nice oversampling */ ImBuf *ibuf; @@ -1042,14 +1043,14 @@ static ImBuf *blend_file_thumb(const bContext *C, Scene *scene, SceneLayer *sl, /* gets scaled to BLEN_THUMB_SIZE */ if (scene->camera) { ibuf = ED_view3d_draw_offscreen_imbuf_simple( - &eval_ctx, scene, sl, scene->camera, + &eval_ctx, scene, scene_layer, scene->camera, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, OB_SOLID, false, false, false, R_ALPHAPREMUL, 0, false, NULL, NULL, NULL, err_out); } else { ibuf = ED_view3d_draw_offscreen_imbuf( - &eval_ctx, scene, sl, v3d, ar, + &eval_ctx, scene, scene_layer, v3d, ar, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, false, R_ALPHAPREMUL, 0, false, NULL, NULL, NULL, err_out); diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 77030fac5ea..fa5fd38b7b2 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -72,6 +72,7 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type) gesture->event_type = event->type; gesture->swinid = ar->swinid; /* means only in area-region context! */ gesture->userdata_free = true; /* Free if userdata is set. */ + gesture->modal_state = GESTURE_MODAL_NOP; wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy); @@ -84,11 +85,7 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type) rect->xmin = event->x - sx; rect->ymin = event->y - sy; if (type == WM_GESTURE_CIRCLE) { -#ifdef GESTURE_MEMORY - rect->xmax = circle_select_size; -#else - rect->xmax = 25; // XXX temp -#endif + /* caller is responsible for initializing 'xmax' to radius. */ } else { rect->xmax = event->x - sx; @@ -97,11 +94,11 @@ wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type) } else if (ELEM(type, WM_GESTURE_LINES, WM_GESTURE_LASSO)) { short *lasso; - gesture->customdata = lasso = MEM_callocN(2 * sizeof(short) * WM_LASSO_MIN_POINTS, "lasso points"); + gesture->points_alloc = 1024; + gesture->customdata = lasso = MEM_mallocN(sizeof(short[2]) * gesture->points_alloc, "lasso points"); lasso[0] = event->x - sx; lasso[1] = event->y - sy; gesture->points = 1; - gesture->size = WM_LASSO_MIN_POINTS; } return gesture; @@ -437,10 +434,12 @@ void wm_gesture_draw(wmWindow *win) else if (gt->type == WM_GESTURE_CIRCLE) wm_gesture_draw_circle(gt); else if (gt->type == WM_GESTURE_CROSS_RECT) { - if (gt->mode == 1) + if (gt->is_active) { wm_gesture_draw_rect(gt); - else + } + else { wm_gesture_draw_cross(win, gt); + } } else if (gt->type == WM_GESTURE_LINES) wm_gesture_draw_lasso(win, gt, false); diff --git a/source/blender/windowmanager/intern/wm_gesture_ops.c b/source/blender/windowmanager/intern/wm_gesture_ops.c new file mode 100644 index 00000000000..a554727cacd --- /dev/null +++ b/source/blender/windowmanager/intern/wm_gesture_ops.c @@ -0,0 +1,883 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2007 Blender Foundation. + * All rights reserved. + * + * Contributor(s): Blender Foundation + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/windowmanager/intern/wm_gesture_ops.c + * \ingroup wm + * + * Default operator callbacks for use with gestures (border/circle/lasso/straightline). + * Operators themselves are defined elsewhere. + * + * - Keymaps are in ``wm_operators.c``. + * - Property definitions are in ``wm_operator_props.c``. + */ + +#include "MEM_guardedalloc.h" + +#include "DNA_windowmanager_types.h" + +#include "BLI_math.h" + +#include "BKE_context.h" + +#include "WM_types.h" +#include "WM_api.h" + +#include "wm.h" +#include "wm_event_types.h" +#include "wm_event_system.h" +#include "wm_subwindow.h" + +#include "ED_screen.h" + +#include "RNA_access.h" +#include "RNA_define.h" + +/* -------------------------------------------------------------------- */ +/** \name Internal Gesture Utilities + * + * Border gesture has two types: + * -# #WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border. + * -# #WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends. + * + * It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type). + * + * \{ */ + +static void gesture_modal_end(bContext *C, wmOperator *op) +{ + wmGesture *gesture = op->customdata; + + WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */ + op->customdata = NULL; + + ED_area_tag_redraw(CTX_wm_area(C)); + + if (RNA_struct_find_property(op->ptr, "cursor")) { + WM_cursor_modal_restore(CTX_wm_window(C)); + } +} + +static void gesture_modal_state_to_operator(wmOperator *op, int modal_state) +{ + PropertyRNA *prop; + + switch (modal_state) { + case GESTURE_MODAL_SELECT: + case GESTURE_MODAL_DESELECT: + if ((prop = RNA_struct_find_property(op->ptr, "deselect"))) { + RNA_property_boolean_set(op->ptr, prop, (modal_state == GESTURE_MODAL_DESELECT)); + } + break; + case GESTURE_MODAL_IN: + case GESTURE_MODAL_OUT: + if ((prop = RNA_struct_find_property(op->ptr, "zoom_out"))) { + RNA_property_boolean_set(op->ptr, prop, (modal_state == GESTURE_MODAL_OUT)); + } + break; + } +} + +static int gesture_modal_state_from_operator(wmOperator *op) +{ + PropertyRNA *prop; + + if ((prop = RNA_struct_find_property(op->ptr, "deselect"))) { + if (RNA_property_is_set(op->ptr, prop)) { + return RNA_property_boolean_get(op->ptr, prop) ? GESTURE_MODAL_DESELECT : GESTURE_MODAL_SELECT; + } + } + if ((prop = RNA_struct_find_property(op->ptr, "zoom_out"))) { + if (RNA_property_is_set(op->ptr, prop)) { + return RNA_property_boolean_get(op->ptr, prop) ? GESTURE_MODAL_OUT : GESTURE_MODAL_IN; + } + } + return GESTURE_MODAL_NOP; +} +/** \} */ + + +/* -------------------------------------------------------------------- */ +/** \name Border Gesture + * + * Border gesture has two types: + * -# #WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border. + * -# #WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends. + * + * It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type). + * + * \{ */ + +static bool gesture_border_apply_rect(wmOperator *op) +{ + wmGesture *gesture = op->customdata; + rcti *rect = gesture->customdata; + + if (rect->xmin == rect->xmax || rect->ymin == rect->ymax) + return 0; + + + /* operator arguments and storage. */ + RNA_int_set(op->ptr, "xmin", min_ii(rect->xmin, rect->xmax)); + RNA_int_set(op->ptr, "ymin", min_ii(rect->ymin, rect->ymax)); + RNA_int_set(op->ptr, "xmax", max_ii(rect->xmin, rect->xmax)); + RNA_int_set(op->ptr, "ymax", max_ii(rect->ymin, rect->ymax)); + + return 1; +} + +static bool gesture_border_apply(bContext *C, wmOperator *op) +{ + wmGesture *gesture = op->customdata; + + int retval; + + if (!gesture_border_apply_rect(op)) { + return 0; + } + + gesture_modal_state_to_operator(op, gesture->modal_state); + + retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + + return 1; +} + +int WM_gesture_border_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + int modal_state = gesture_modal_state_from_operator(op); + + if (ISTWEAK(event->type) || (modal_state != GESTURE_MODAL_NOP)) { + op->customdata = WM_gesture_new(C, event, WM_GESTURE_RECT); + } + else { + op->customdata = WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT); + } + + /* Starting with the mode starts immediately, like having 'wait_for_input' disabled (some tools use this). */ + if (modal_state == GESTURE_MODAL_NOP) { + wmGesture *gesture = op->customdata; + gesture->wait_for_input = true; + } + else { + wmGesture *gesture = op->customdata; + gesture->modal_state = modal_state; + } + + /* add modal handler */ + WM_event_add_modal_handler(C, op); + + wm_gesture_tag_redraw(C); + + return OPERATOR_RUNNING_MODAL; +} + +int WM_gesture_border_modal(bContext *C, wmOperator *op, const wmEvent *event) +{ + wmGesture *gesture = op->customdata; + rcti *rect = gesture->customdata; + int sx, sy; + + if (event->type == MOUSEMOVE) { + wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); + + if (gesture->type == WM_GESTURE_CROSS_RECT && gesture->is_active == false) { + rect->xmin = rect->xmax = event->x - sx; + rect->ymin = rect->ymax = event->y - sy; + } + else { + rect->xmax = event->x - sx; + rect->ymax = event->y - sy; + } + gesture_border_apply_rect(op); + + wm_gesture_tag_redraw(C); + } + else if (event->type == EVT_MODAL_MAP) { + switch (event->val) { + case GESTURE_MODAL_BEGIN: + if (gesture->type == WM_GESTURE_CROSS_RECT && gesture->is_active == false) { + gesture->is_active = true; + wm_gesture_tag_redraw(C); + } + break; + case GESTURE_MODAL_SELECT: + case GESTURE_MODAL_DESELECT: + case GESTURE_MODAL_IN: + case GESTURE_MODAL_OUT: + if (gesture->wait_for_input) { + gesture->modal_state = event->val; + } + if (gesture_border_apply(C, op)) { + gesture_modal_end(C, op); + return OPERATOR_FINISHED; + } + gesture_modal_end(C, op); + return OPERATOR_CANCELLED; + + case GESTURE_MODAL_CANCEL: + gesture_modal_end(C, op); + return OPERATOR_CANCELLED; + } + + } +#ifdef WITH_INPUT_NDOF + else if (event->type == NDOF_MOTION) { + return OPERATOR_PASS_THROUGH; + } +#endif + +#if 0 + /* Allow view navigation??? */ + else { + return OPERATOR_PASS_THROUGH; + } +#endif + + return OPERATOR_RUNNING_MODAL; +} + +void WM_gesture_border_cancel(bContext *C, wmOperator *op) +{ + gesture_modal_end(C, op); +} + +/** \} */ + + +/* -------------------------------------------------------------------- */ +/** \name Circle Gesture + * + * Currently only used for selection or modal paint stuff, + * calls ``exec`` while hold mouse, exits on release (with no difference between cancel and confirm). + * + * \{ */ + +static void gesture_circle_apply(bContext *C, wmOperator *op); + +int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + int modal_state = gesture_modal_state_from_operator(op); + + op->customdata = WM_gesture_new(C, event, WM_GESTURE_CIRCLE); + wmGesture *gesture = op->customdata; + rcti *rect = gesture->customdata; + + /* Default or previously stored value. */ + rect->xmax = RNA_int_get(op->ptr, "radius"); + + /* Starting with the mode starts immediately, like having 'wait_for_input' disabled (some tools use this). */ + if (modal_state == GESTURE_MODAL_NOP) { + gesture->wait_for_input = true; + } + else { + gesture->is_active = true; + gesture->modal_state = modal_state; + gesture_circle_apply(C, op); + } + + /* add modal handler */ + WM_event_add_modal_handler(C, op); + + wm_gesture_tag_redraw(C); + + return OPERATOR_RUNNING_MODAL; +} + +static void gesture_circle_apply(bContext *C, wmOperator *op) +{ + wmGesture *gesture = op->customdata; + rcti *rect = gesture->customdata; + + if (gesture->modal_state == GESTURE_MODAL_NOP) { + return; + } + + /* operator arguments and storage. */ + RNA_int_set(op->ptr, "x", rect->xmin); + RNA_int_set(op->ptr, "y", rect->ymin); + RNA_int_set(op->ptr, "radius", rect->xmax); + + gesture_modal_state_to_operator(op, gesture->modal_state); + + if (op->type->exec) { + int retval; + retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + } +} + +int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event) +{ + wmGesture *gesture = op->customdata; + rcti *rect = gesture->customdata; + int sx, sy; + + if (event->type == MOUSEMOVE) { + wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); + + rect->xmin = event->x - sx; + rect->ymin = event->y - sy; + + wm_gesture_tag_redraw(C); + + if (gesture->is_active) { + gesture_circle_apply(C, op); + } + } + else if (event->type == EVT_MODAL_MAP) { + bool is_circle_size = false; + bool is_finished = false; + float fac; + + switch (event->val) { + case GESTURE_MODAL_CIRCLE_SIZE: + fac = 0.3f * (event->y - event->prevy); + if (fac > 0) + rect->xmax += ceil(fac); + else + rect->xmax += floor(fac); + if (rect->xmax < 1) rect->xmax = 1; + is_circle_size = true; + break; + case GESTURE_MODAL_CIRCLE_ADD: + rect->xmax += 2 + rect->xmax / 10; + is_circle_size = true; + break; + case GESTURE_MODAL_CIRCLE_SUB: + rect->xmax -= 2 + rect->xmax / 10; + if (rect->xmax < 1) rect->xmax = 1; + is_circle_size = true; + break; + case GESTURE_MODAL_SELECT: + case GESTURE_MODAL_DESELECT: + case GESTURE_MODAL_NOP: + { + if (gesture->wait_for_input) { + gesture->modal_state = event->val; + } + if (event->val == GESTURE_MODAL_NOP) { + /* Single action, click-drag & release to exit. */ + if (gesture->wait_for_input == false) { + is_finished = true; + } + } + else { + /* apply first click */ + gesture_circle_apply(C, op); + gesture->is_active = true; + wm_gesture_tag_redraw(C); + } + break; + } + case GESTURE_MODAL_CANCEL: + case GESTURE_MODAL_CONFIRM: + is_finished = true; + } + + if (is_finished) { + gesture_modal_end(C, op); + return OPERATOR_FINISHED; /* use finish or we don't get an undo */ + } + + if (is_circle_size) { + wm_gesture_tag_redraw(C); + + /* So next use remembers last seen size, even if we didn't apply it. */ + RNA_int_set(op->ptr, "radius", rect->xmax); + } + } +#ifdef WITH_INPUT_NDOF + else if (event->type == NDOF_MOTION) { + return OPERATOR_PASS_THROUGH; + } +#endif + +#if 0 + /* Allow view navigation??? */ + /* note, this gives issues: + * 1) other modal ops run on top (border select), + * 2) middlemouse is used now 3) tablet/trackpad? */ + else { + return OPERATOR_PASS_THROUGH; + } +#endif + + + return OPERATOR_RUNNING_MODAL; +} + +void WM_gesture_circle_cancel(bContext *C, wmOperator *op) +{ + gesture_modal_end(C, op); +} + +#if 0 +/* template to copy from */ +void WM_OT_circle_gesture(wmOperatorType *ot) +{ + ot->name = "Circle Gesture"; + ot->idname = "WM_OT_circle_gesture"; + ot->description = "Enter rotate mode with a circular gesture"; + + ot->invoke = WM_gesture_circle_invoke; + ot->modal = WM_gesture_circle_modal; + ot->poll = WM_operator_winactive; + + /* properties */ + WM_operator_properties_gesture_circle(ot); + +} +#endif + +/** \} */ + + +/* -------------------------------------------------------------------- */ +/** \name Tweak Gesture + * \{ */ + +static void gesture_tweak_modal(bContext *C, const wmEvent *event) +{ + wmWindow *window = CTX_wm_window(C); + wmGesture *gesture = window->tweak; + rcti *rect = gesture->customdata; + int sx, sy, val; + + switch (event->type) { + case MOUSEMOVE: + case INBETWEEN_MOUSEMOVE: + + wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy); + + rect->xmax = event->x - sx; + rect->ymax = event->y - sy; + + if ((val = wm_gesture_evaluate(gesture))) { + wmEvent tevent; + + wm_event_init_from_window(window, &tevent); + /* We want to get coord from start of drag, not from point where it becomes a tweak event, see T40549 */ + tevent.x = rect->xmin + sx; + tevent.y = rect->ymin + sy; + if (gesture->event_type == LEFTMOUSE) + tevent.type = EVT_TWEAK_L; + else if (gesture->event_type == RIGHTMOUSE) + tevent.type = EVT_TWEAK_R; + else + tevent.type = EVT_TWEAK_M; + tevent.val = val; + /* mouse coords! */ + + /* important we add immediately after this event, so future mouse releases + * (which may be in the queue already), are handled in order, see T44740 */ + wm_event_add_ex(window, &tevent, event); + + WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */ + } + + break; + + case LEFTMOUSE: + case RIGHTMOUSE: + case MIDDLEMOUSE: + if (gesture->event_type == event->type) { + WM_gesture_end(C, gesture); + + /* when tweak fails we should give the other keymap entries a chance */ + + /* XXX, assigning to readonly, BAD JUJU! */ + ((wmEvent *)event)->val = KM_RELEASE; + } + break; + default: + if (!ISTIMER(event->type) && event->type != EVENT_NONE) { + WM_gesture_end(C, gesture); + } + break; + } +} + +/* standard tweak, called after window handlers passed on event */ +void wm_tweakevent_test(bContext *C, const wmEvent *event, int action) +{ + wmWindow *win = CTX_wm_window(C); + + if (win->tweak == NULL) { + if (CTX_wm_region(C)) { + if (event->val == KM_PRESS) { + if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) { + win->tweak = WM_gesture_new(C, event, WM_GESTURE_TWEAK); + } + } + } + } + else { + /* no tweaks if event was handled */ + if ((action & WM_HANDLER_BREAK)) { + WM_gesture_end(C, win->tweak); + } + else + gesture_tweak_modal(C, event); + } +} + +/** \} */ + + +/* -------------------------------------------------------------------- */ +/** \name Lasso Gesture + * \{ */ + +int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + PropertyRNA *prop; + + op->customdata = WM_gesture_new(C, event, WM_GESTURE_LASSO); + + /* add modal handler */ + WM_event_add_modal_handler(C, op); + + wm_gesture_tag_redraw(C); + + if ((prop = RNA_struct_find_property(op->ptr, "cursor"))) { + WM_cursor_modal_set(CTX_wm_window(C), RNA_property_int_get(op->ptr, prop)); + } + + return OPERATOR_RUNNING_MODAL; +} + +int WM_gesture_lines_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + PropertyRNA *prop; + + op->customdata = WM_gesture_new(C, event, WM_GESTURE_LINES); + + /* add modal handler */ + WM_event_add_modal_handler(C, op); + + wm_gesture_tag_redraw(C); + + if ((prop = RNA_struct_find_property(op->ptr, "cursor"))) { + WM_cursor_modal_set(CTX_wm_window(C), RNA_property_int_get(op->ptr, prop)); + } + + return OPERATOR_RUNNING_MODAL; +} + + +static void gesture_lasso_apply(bContext *C, wmOperator *op) +{ + wmGesture *gesture = op->customdata; + PointerRNA itemptr; + float loc[2]; + int i; + const short *lasso = gesture->customdata; + + /* operator storage as path. */ + + RNA_collection_clear(op->ptr, "path"); + for (i = 0; i < gesture->points; i++, lasso += 2) { + loc[0] = lasso[0]; + loc[1] = lasso[1]; + RNA_collection_add(op->ptr, "path", &itemptr); + RNA_float_set_array(&itemptr, "loc", loc); + } + + gesture_modal_end(C, op); + + if (op->type->exec) { + int retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + } +} + +int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event) +{ + wmGesture *gesture = op->customdata; + int sx, sy; + + switch (event->type) { + case MOUSEMOVE: + case INBETWEEN_MOUSEMOVE: + + wm_gesture_tag_redraw(C); + + wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); + + if (gesture->points == gesture->points_alloc) { + gesture->points_alloc *= 2; + gesture->customdata = MEM_reallocN(gesture->customdata, sizeof(short[2]) * gesture->points_alloc); + } + + { + int x, y; + short *lasso = gesture->customdata; + + lasso += (2 * gesture->points - 2); + x = (event->x - sx - lasso[0]); + y = (event->y - sy - lasso[1]); + + /* make a simple distance check to get a smoother lasso + * add only when at least 2 pixels between this and previous location */ + if ((x * x + y * y) > 4) { + lasso += 2; + lasso[0] = event->x - sx; + lasso[1] = event->y - sy; + gesture->points++; + } + } + break; + + case LEFTMOUSE: + case MIDDLEMOUSE: + case RIGHTMOUSE: + if (event->val == KM_RELEASE) { /* key release */ + gesture_lasso_apply(C, op); + return OPERATOR_FINISHED; + } + break; + case ESCKEY: + gesture_modal_end(C, op); + return OPERATOR_CANCELLED; + } + return OPERATOR_RUNNING_MODAL; +} + +int WM_gesture_lines_modal(bContext *C, wmOperator *op, const wmEvent *event) +{ + return WM_gesture_lasso_modal(C, op, event); +} + +void WM_gesture_lasso_cancel(bContext *C, wmOperator *op) +{ + gesture_modal_end(C, op); +} + +void WM_gesture_lines_cancel(bContext *C, wmOperator *op) +{ + gesture_modal_end(C, op); +} + +/** + * helper function, we may want to add options for conversion to view space + * + * caller must free. + */ +const int (*WM_gesture_lasso_path_to_array(bContext *UNUSED(C), wmOperator *op, int *mcords_tot))[2] +{ + PropertyRNA *prop = RNA_struct_find_property(op->ptr, "path"); + int (*mcords)[2] = NULL; + BLI_assert(prop != NULL); + + if (prop) { + const int len = RNA_property_collection_length(op->ptr, prop); + + if (len) { + int i = 0; + mcords = MEM_mallocN(sizeof(int) * 2 * len, __func__); + + RNA_PROP_BEGIN (op->ptr, itemptr, prop) + { + float loc[2]; + + RNA_float_get_array(&itemptr, "loc", loc); + mcords[i][0] = (int)loc[0]; + mcords[i][1] = (int)loc[1]; + i++; + } + RNA_PROP_END; + } + *mcords_tot = len; + } + else { + *mcords_tot = 0; + } + + /* cast for 'const' */ + return (const int (*)[2])mcords; +} + +#if 0 +/* template to copy from */ + +static int gesture_lasso_exec(bContext *C, wmOperator *op) +{ + RNA_BEGIN (op->ptr, itemptr, "path") + { + float loc[2]; + + RNA_float_get_array(&itemptr, "loc", loc); + printf("Location: %f %f\n", loc[0], loc[1]); + } + RNA_END; + + return OPERATOR_FINISHED; +} + +void WM_OT_lasso_gesture(wmOperatorType *ot) +{ + PropertyRNA *prop; + + ot->name = "Lasso Gesture"; + ot->idname = "WM_OT_lasso_gesture"; + ot->description = "Select objects within the lasso as you move the pointer"; + + ot->invoke = WM_gesture_lasso_invoke; + ot->modal = WM_gesture_lasso_modal; + ot->exec = gesture_lasso_exec; + + ot->poll = WM_operator_winactive; + + prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); + RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); +} +#endif + + +/** \} */ + + +/* -------------------------------------------------------------------- */ +/** \name Straight Line Gesture + * \{ */ + +static bool gesture_straightline_apply(bContext *C, wmOperator *op) +{ + wmGesture *gesture = op->customdata; + rcti *rect = gesture->customdata; + + if (rect->xmin == rect->xmax && rect->ymin == rect->ymax) + return 0; + + /* operator arguments and storage. */ + RNA_int_set(op->ptr, "xstart", rect->xmin); + RNA_int_set(op->ptr, "ystart", rect->ymin); + RNA_int_set(op->ptr, "xend", rect->xmax); + RNA_int_set(op->ptr, "yend", rect->ymax); + + if (op->type->exec) { + int retval = op->type->exec(C, op); + OPERATOR_RETVAL_CHECK(retval); + } + + return 1; +} + +int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + PropertyRNA *prop; + + op->customdata = WM_gesture_new(C, event, WM_GESTURE_STRAIGHTLINE); + + if (ISTWEAK(event->type)) { + wmGesture *gesture = op->customdata; + gesture->is_active = true; + } + + /* add modal handler */ + WM_event_add_modal_handler(C, op); + + wm_gesture_tag_redraw(C); + + if ((prop = RNA_struct_find_property(op->ptr, "cursor"))) { + WM_cursor_modal_set(CTX_wm_window(C), RNA_property_int_get(op->ptr, prop)); + } + + return OPERATOR_RUNNING_MODAL; +} + +int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *event) +{ + wmGesture *gesture = op->customdata; + rcti *rect = gesture->customdata; + int sx, sy; + + if (event->type == MOUSEMOVE) { + wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); + + if (gesture->is_active == false) { + rect->xmin = rect->xmax = event->x - sx; + rect->ymin = rect->ymax = event->y - sy; + } + else { + rect->xmax = event->x - sx; + rect->ymax = event->y - sy; + gesture_straightline_apply(C, op); + } + + wm_gesture_tag_redraw(C); + } + else if (event->type == EVT_MODAL_MAP) { + switch (event->val) { + case GESTURE_MODAL_BEGIN: + if (gesture->is_active == false) { + gesture->is_active = true; + wm_gesture_tag_redraw(C); + } + break; + case GESTURE_MODAL_SELECT: + if (gesture_straightline_apply(C, op)) { + gesture_modal_end(C, op); + return OPERATOR_FINISHED; + } + gesture_modal_end(C, op); + return OPERATOR_CANCELLED; + + case GESTURE_MODAL_CANCEL: + gesture_modal_end(C, op); + return OPERATOR_CANCELLED; + } + } + + return OPERATOR_RUNNING_MODAL; +} + +void WM_gesture_straightline_cancel(bContext *C, wmOperator *op) +{ + gesture_modal_end(C, op); +} + +#if 0 +/* template to copy from */ +void WM_OT_straightline_gesture(wmOperatorType *ot) +{ + PropertyRNA *prop; + + ot->name = "Straight Line Gesture"; + ot->idname = "WM_OT_straightline_gesture"; + ot->description = "Draw a straight line as you move the pointer"; + + ot->invoke = WM_gesture_straightline_invoke; + ot->modal = WM_gesture_straightline_modal; + ot->exec = gesture_straightline_exec; + + ot->poll = WM_operator_winactive; + + WM_operator_properties_gesture_straightline(ot, 0); +} +#endif + +/** \} */ diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index db5fc23146f..8dab50a6f29 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -785,7 +785,7 @@ wmKeyMap *WM_keymap_find_all(const bContext *C, const char *idname, int spaceid, /* modal maps get linked to a running operator, and filter the keys before sending to modal() callback */ -wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, EnumPropertyItem *items) +wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items) { wmKeyMap *km = WM_keymap_find(keyconf, idname, 0, 0); km->flag |= KEYMAP_MODAL; @@ -919,7 +919,7 @@ static void wm_user_modal_keymap_set_items(wmWindowManager *wm, wmKeyMap *km) const char *WM_key_event_string(const short type, const bool compact) { - EnumPropertyItem *it; + const EnumPropertyItem *it; const int i = RNA_enum_from_value(rna_enum_event_type_items, (int)type); if (i == -1) { diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c index 18836f34c99..72e4ff1d83a 100644 --- a/source/blender/windowmanager/intern/wm_operator_props.c +++ b/source/blender/windowmanager/intern/wm_operator_props.c @@ -49,7 +49,7 @@ void WM_operator_properties_filesel( { PropertyRNA *prop; - static EnumPropertyItem file_display_items[] = { + static const EnumPropertyItem file_display_items[] = { {FILE_DEFAULTDISPLAY, "DEFAULT", 0, "Default", "Automatically determine display type for files"}, {FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"}, {FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"}, @@ -135,7 +135,7 @@ static void wm_operator_properties_select_action_ex(wmOperatorType *ot, int defa void WM_operator_properties_select_action(wmOperatorType *ot, int default_action) { - static EnumPropertyItem select_actions[] = { + static const EnumPropertyItem select_actions[] = { {SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"}, {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"}, {SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"}, @@ -151,7 +151,7 @@ void WM_operator_properties_select_action(wmOperatorType *ot, int default_action */ void WM_operator_properties_select_action_simple(wmOperatorType *ot, int default_action) { - static EnumPropertyItem select_actions[] = { + static const EnumPropertyItem select_actions[] = { {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"}, {SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"}, {0, NULL, 0, NULL, NULL} @@ -224,30 +224,69 @@ void WM_operator_properties_border_to_rctf(struct wmOperator *op, rctf *rect) BLI_rctf_rcti_copy(rect, &rect_i); } -void WM_operator_properties_gesture_border(wmOperatorType *ot, bool extend) +/** + * Use with #WM_gesture_border_invoke + */ +void WM_operator_properties_gesture_border_ex(wmOperatorType *ot, bool deselect, bool extend) { - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); - WM_operator_properties_border(ot); + if (deselect) { + RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items"); + } if (extend) { RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first"); } } -void WM_operator_properties_mouse_select(wmOperatorType *ot) +void WM_operator_properties_gesture_border_select(wmOperatorType *ot) +{ + WM_operator_properties_gesture_border_ex(ot, true, true); +} +void WM_operator_properties_gesture_border(wmOperatorType *ot) +{ + WM_operator_properties_gesture_border_ex(ot, false, false); +} + +void WM_operator_properties_gesture_border_zoom(wmOperatorType *ot) { + WM_operator_properties_border(ot); + PropertyRNA *prop; + prop = RNA_def_boolean(ot->srna, "zoom_out", false, "Zoom Out", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); +} - prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", - "Extend selection instead of deselecting everything first"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Remove from selection"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "toggle", false, "Toggle Selection", "Toggle the selection"); - RNA_def_property_flag(prop, PROP_SKIP_SAVE); +/** + * Use with #WM_gesture_lasso_invoke + */ +void WM_operator_properties_gesture_lasso_ex(wmOperatorType *ot, bool deselect, bool extend) +{ + PropertyRNA *prop; + prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + + if (deselect) { + RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items"); + } + if (extend) { + RNA_def_boolean(ot->srna, "extend", true, "Extend", "Extend selection instead of deselecting everything first"); + } } +void WM_operator_properties_gesture_lasso(wmOperatorType *ot) +{ + WM_operator_properties_gesture_lasso_ex(ot, false, false); +} + +void WM_operator_properties_gesture_lasso_select(wmOperatorType *ot) +{ + WM_operator_properties_gesture_lasso_ex(ot, true, true); +} + +/** + * Use with #WM_gesture_straightline_invoke + */ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor) { PropertyRNA *prop; @@ -269,6 +308,48 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor) } /** + * Use with #WM_gesture_circle_invoke + */ +void WM_operator_properties_gesture_circle_ex(wmOperatorType *ot, bool deselect) +{ + PropertyRNA *prop; + const int radius_default = 25; + + prop = RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + prop = RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX); + RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + RNA_def_int(ot->srna, "radius", radius_default, 1, INT_MAX, "Radius", "", 1, INT_MAX); + + if (deselect) { + RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Deselect rather than select items"); + } +} + +void WM_operator_properties_gesture_circle(wmOperatorType *ot) +{ + WM_operator_properties_gesture_circle_ex(ot, false); +} + +void WM_operator_properties_gesture_circle_select(wmOperatorType *ot) +{ + WM_operator_properties_gesture_circle_ex(ot, true); +} + +void WM_operator_properties_mouse_select(wmOperatorType *ot) +{ + PropertyRNA *prop; + + prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", + "Extend selection instead of deselecting everything first"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Remove from selection"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "toggle", false, "Toggle Selection", "Toggle the selection"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); +} + +/** * \param nth_can_disable: Enable if we want to be able to select no interval at all. */ void WM_operator_properties_checker_interval(wmOperatorType *ot, bool nth_can_disable) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 2f12dd5b672..970b6ebf51d 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -115,7 +115,6 @@ #include "wm_event_system.h" #include "wm_event_types.h" #include "wm_files.h" -#include "wm_subwindow.h" #include "wm_window.h" static GHash *global_ops_hash = NULL; @@ -2298,705 +2297,6 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle) } } -/* ************ window gesture operator-callback definitions ************** */ -/* - * These are default callbacks for use in operators requiring gesture input - */ - -/* **************** Border gesture *************** */ - -/** - * Border gesture has two types: - * -# #WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border. - * -# #WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends. - * - * It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type) - */ - -static int border_apply_rect(wmOperator *op) -{ - wmGesture *gesture = op->customdata; - rcti *rect = gesture->customdata; - - if (rect->xmin == rect->xmax || rect->ymin == rect->ymax) - return 0; - - - /* operator arguments and storage. */ - RNA_int_set(op->ptr, "xmin", min_ii(rect->xmin, rect->xmax)); - RNA_int_set(op->ptr, "ymin", min_ii(rect->ymin, rect->ymax)); - RNA_int_set(op->ptr, "xmax", max_ii(rect->xmin, rect->xmax)); - RNA_int_set(op->ptr, "ymax", max_ii(rect->ymin, rect->ymax)); - - return 1; -} - -static int border_apply(bContext *C, wmOperator *op, int gesture_mode) -{ - PropertyRNA *prop; - - int retval; - - if (!border_apply_rect(op)) - return 0; - - /* XXX weak; border should be configured for this without reading event types */ - if ((prop = RNA_struct_find_property(op->ptr, "gesture_mode"))) { - RNA_property_int_set(op->ptr, prop, gesture_mode); - } - - retval = op->type->exec(C, op); - OPERATOR_RETVAL_CHECK(retval); - - return 1; -} - -static void wm_gesture_end(bContext *C, wmOperator *op) -{ - wmGesture *gesture = op->customdata; - - WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */ - op->customdata = NULL; - - ED_area_tag_redraw(CTX_wm_area(C)); - - if (RNA_struct_find_property(op->ptr, "cursor")) { - WM_cursor_modal_restore(CTX_wm_window(C)); - } -} - -int WM_border_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - if (ISTWEAK(event->type)) - op->customdata = WM_gesture_new(C, event, WM_GESTURE_RECT); - else - op->customdata = WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT); - - /* add modal handler */ - WM_event_add_modal_handler(C, op); - - wm_gesture_tag_redraw(C); - - return OPERATOR_RUNNING_MODAL; -} - -int WM_border_select_modal(bContext *C, wmOperator *op, const wmEvent *event) -{ - wmGesture *gesture = op->customdata; - rcti *rect = gesture->customdata; - int sx, sy; - - if (event->type == MOUSEMOVE) { - wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); - - if (gesture->type == WM_GESTURE_CROSS_RECT && gesture->mode == 0) { - rect->xmin = rect->xmax = event->x - sx; - rect->ymin = rect->ymax = event->y - sy; - } - else { - rect->xmax = event->x - sx; - rect->ymax = event->y - sy; - } - border_apply_rect(op); - - wm_gesture_tag_redraw(C); - } - else if (event->type == EVT_MODAL_MAP) { - switch (event->val) { - case GESTURE_MODAL_BEGIN: - if (gesture->type == WM_GESTURE_CROSS_RECT && gesture->mode == 0) { - gesture->mode = 1; - wm_gesture_tag_redraw(C); - } - break; - case GESTURE_MODAL_SELECT: - case GESTURE_MODAL_DESELECT: - case GESTURE_MODAL_IN: - case GESTURE_MODAL_OUT: - if (border_apply(C, op, event->val)) { - wm_gesture_end(C, op); - return OPERATOR_FINISHED; - } - wm_gesture_end(C, op); - return OPERATOR_CANCELLED; - - case GESTURE_MODAL_CANCEL: - wm_gesture_end(C, op); - return OPERATOR_CANCELLED; - } - - } -#ifdef WITH_INPUT_NDOF - else if (event->type == NDOF_MOTION) { - return OPERATOR_PASS_THROUGH; - } -#endif -// /* Allow view navigation??? */ -// else { -// return OPERATOR_PASS_THROUGH; -// } - - return OPERATOR_RUNNING_MODAL; -} - -void WM_border_select_cancel(bContext *C, wmOperator *op) -{ - wm_gesture_end(C, op); -} - -/* **************** circle gesture *************** */ -/* works now only for selection or modal paint stuff, calls exec while hold mouse, exit on release */ - -#ifdef GESTURE_MEMORY -int circle_select_size = 25; /* XXX - need some operator memory thing! */ -#endif - -int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - op->customdata = WM_gesture_new(C, event, WM_GESTURE_CIRCLE); - - /* add modal handler */ - WM_event_add_modal_handler(C, op); - - wm_gesture_tag_redraw(C); - - return OPERATOR_RUNNING_MODAL; -} - -static void gesture_circle_apply(bContext *C, wmOperator *op) -{ - wmGesture *gesture = op->customdata; - rcti *rect = gesture->customdata; - - if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_NOP) - return; - - /* operator arguments and storage. */ - RNA_int_set(op->ptr, "x", rect->xmin); - RNA_int_set(op->ptr, "y", rect->ymin); - RNA_int_set(op->ptr, "radius", rect->xmax); - - if (op->type->exec) { - int retval; - retval = op->type->exec(C, op); - OPERATOR_RETVAL_CHECK(retval); - } -#ifdef GESTURE_MEMORY - circle_select_size = rect->xmax; -#endif -} - -int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event) -{ - wmGesture *gesture = op->customdata; - rcti *rect = gesture->customdata; - int sx, sy; - - if (event->type == MOUSEMOVE) { - wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); - - rect->xmin = event->x - sx; - rect->ymin = event->y - sy; - - wm_gesture_tag_redraw(C); - - if (gesture->mode) - gesture_circle_apply(C, op); - } - else if (event->type == EVT_MODAL_MAP) { - float fac; - - switch (event->val) { - case GESTURE_MODAL_CIRCLE_SIZE: - fac = 0.3f * (event->y - event->prevy); - if (fac > 0) - rect->xmax += ceil(fac); - else - rect->xmax += floor(fac); - if (rect->xmax < 1) rect->xmax = 1; - wm_gesture_tag_redraw(C); - break; - case GESTURE_MODAL_CIRCLE_ADD: - rect->xmax += 2 + rect->xmax / 10; - wm_gesture_tag_redraw(C); - break; - case GESTURE_MODAL_CIRCLE_SUB: - rect->xmax -= 2 + rect->xmax / 10; - if (rect->xmax < 1) rect->xmax = 1; - wm_gesture_tag_redraw(C); - break; - case GESTURE_MODAL_SELECT: - case GESTURE_MODAL_DESELECT: - case GESTURE_MODAL_NOP: - if (RNA_struct_find_property(op->ptr, "gesture_mode")) - RNA_int_set(op->ptr, "gesture_mode", event->val); - - if (event->val != GESTURE_MODAL_NOP) { - /* apply first click */ - gesture_circle_apply(C, op); - gesture->mode = 1; - wm_gesture_tag_redraw(C); - } - break; - - case GESTURE_MODAL_CANCEL: - case GESTURE_MODAL_CONFIRM: - wm_gesture_end(C, op); - return OPERATOR_FINISHED; /* use finish or we don't get an undo */ - } - } -#ifdef WITH_INPUT_NDOF - else if (event->type == NDOF_MOTION) { - return OPERATOR_PASS_THROUGH; - } -#endif - /* Allow view navigation??? */ - /* note, this gives issues: 1) other modal ops run on top (border select), 2) middlemouse is used now 3) tablet/trackpad? */ -// else { -// return OPERATOR_PASS_THROUGH; -// } - - return OPERATOR_RUNNING_MODAL; -} - -void WM_gesture_circle_cancel(bContext *C, wmOperator *op) -{ - wm_gesture_end(C, op); -} - -#if 0 -/* template to copy from */ -void WM_OT_circle_gesture(wmOperatorType *ot) -{ - ot->name = "Circle Gesture"; - ot->idname = "WM_OT_circle_gesture"; - ot->description = "Enter rotate mode with a circular gesture"; - - ot->invoke = WM_gesture_circle_invoke; - ot->modal = WM_gesture_circle_modal; - - ot->poll = WM_operator_winactive; - - RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE); - RNA_def_property(ot->srna, "radius", PROP_INT, PROP_NONE); - -} -#endif - -/* **************** Tweak gesture *************** */ - -static void tweak_gesture_modal(bContext *C, const wmEvent *event) -{ - wmWindow *window = CTX_wm_window(C); - wmGesture *gesture = window->tweak; - rcti *rect = gesture->customdata; - int sx, sy, val; - - switch (event->type) { - case MOUSEMOVE: - case INBETWEEN_MOUSEMOVE: - - wm_subwindow_origin_get(window, gesture->swinid, &sx, &sy); - - rect->xmax = event->x - sx; - rect->ymax = event->y - sy; - - if ((val = wm_gesture_evaluate(gesture))) { - wmEvent tevent; - - wm_event_init_from_window(window, &tevent); - /* We want to get coord from start of drag, not from point where it becomes a tweak event, see T40549 */ - tevent.x = rect->xmin + sx; - tevent.y = rect->ymin + sy; - if (gesture->event_type == LEFTMOUSE) - tevent.type = EVT_TWEAK_L; - else if (gesture->event_type == RIGHTMOUSE) - tevent.type = EVT_TWEAK_R; - else - tevent.type = EVT_TWEAK_M; - tevent.val = val; - /* mouse coords! */ - - /* important we add immediately after this event, so future mouse releases - * (which may be in the queue already), are handled in order, see T44740 */ - wm_event_add_ex(window, &tevent, event); - - WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */ - } - - break; - - case LEFTMOUSE: - case RIGHTMOUSE: - case MIDDLEMOUSE: - if (gesture->event_type == event->type) { - WM_gesture_end(C, gesture); - - /* when tweak fails we should give the other keymap entries a chance */ - - /* XXX, assigning to readonly, BAD JUJU! */ - ((wmEvent *)event)->val = KM_RELEASE; - } - break; - default: - if (!ISTIMER(event->type) && event->type != EVENT_NONE) { - WM_gesture_end(C, gesture); - } - break; - } -} - -/* standard tweak, called after window handlers passed on event */ -void wm_tweakevent_test(bContext *C, wmEvent *event, int action) -{ - wmWindow *win = CTX_wm_window(C); - - if (win->tweak == NULL) { - if (CTX_wm_region(C)) { - if (event->val == KM_PRESS) { - if (ELEM(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) { - win->tweak = WM_gesture_new(C, event, WM_GESTURE_TWEAK); - } - } - } - } - else { - /* no tweaks if event was handled */ - if ((action & WM_HANDLER_BREAK)) { - WM_gesture_end(C, win->tweak); - } - else - tweak_gesture_modal(C, event); - } -} - -/* *********************** lasso gesture ****************** */ - -int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - PropertyRNA *prop; - - op->customdata = WM_gesture_new(C, event, WM_GESTURE_LASSO); - - /* add modal handler */ - WM_event_add_modal_handler(C, op); - - wm_gesture_tag_redraw(C); - - if ((prop = RNA_struct_find_property(op->ptr, "cursor"))) { - WM_cursor_modal_set(CTX_wm_window(C), RNA_property_int_get(op->ptr, prop)); - } - - return OPERATOR_RUNNING_MODAL; -} - -int WM_gesture_lines_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - PropertyRNA *prop; - - op->customdata = WM_gesture_new(C, event, WM_GESTURE_LINES); - - /* add modal handler */ - WM_event_add_modal_handler(C, op); - - wm_gesture_tag_redraw(C); - - if ((prop = RNA_struct_find_property(op->ptr, "cursor"))) { - WM_cursor_modal_set(CTX_wm_window(C), RNA_property_int_get(op->ptr, prop)); - } - - return OPERATOR_RUNNING_MODAL; -} - - -static void gesture_lasso_apply(bContext *C, wmOperator *op) -{ - wmGesture *gesture = op->customdata; - PointerRNA itemptr; - float loc[2]; - int i; - const short *lasso = gesture->customdata; - - /* operator storage as path. */ - - RNA_collection_clear(op->ptr, "path"); - for (i = 0; i < gesture->points; i++, lasso += 2) { - loc[0] = lasso[0]; - loc[1] = lasso[1]; - RNA_collection_add(op->ptr, "path", &itemptr); - RNA_float_set_array(&itemptr, "loc", loc); - } - - wm_gesture_end(C, op); - - if (op->type->exec) { - int retval = op->type->exec(C, op); - OPERATOR_RETVAL_CHECK(retval); - } -} - -int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event) -{ - wmGesture *gesture = op->customdata; - int sx, sy; - - switch (event->type) { - case MOUSEMOVE: - case INBETWEEN_MOUSEMOVE: - - wm_gesture_tag_redraw(C); - - wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); - - if (gesture->points == gesture->size) { - short *old_lasso = gesture->customdata; - gesture->customdata = MEM_callocN(2 * sizeof(short) * (gesture->size + WM_LASSO_MIN_POINTS), "lasso points"); - memcpy(gesture->customdata, old_lasso, 2 * sizeof(short) * gesture->size); - gesture->size = gesture->size + WM_LASSO_MIN_POINTS; - MEM_freeN(old_lasso); - // printf("realloc\n"); - } - - { - int x, y; - short *lasso = gesture->customdata; - - lasso += (2 * gesture->points - 2); - x = (event->x - sx - lasso[0]); - y = (event->y - sy - lasso[1]); - - /* make a simple distance check to get a smoother lasso - * add only when at least 2 pixels between this and previous location */ - if ((x * x + y * y) > 4) { - lasso += 2; - lasso[0] = event->x - sx; - lasso[1] = event->y - sy; - gesture->points++; - } - } - break; - - case LEFTMOUSE: - case MIDDLEMOUSE: - case RIGHTMOUSE: - if (event->val == KM_RELEASE) { /* key release */ - gesture_lasso_apply(C, op); - return OPERATOR_FINISHED; - } - break; - case ESCKEY: - wm_gesture_end(C, op); - return OPERATOR_CANCELLED; - } - return OPERATOR_RUNNING_MODAL; -} - -int WM_gesture_lines_modal(bContext *C, wmOperator *op, const wmEvent *event) -{ - return WM_gesture_lasso_modal(C, op, event); -} - -void WM_gesture_lasso_cancel(bContext *C, wmOperator *op) -{ - wm_gesture_end(C, op); -} - -void WM_gesture_lines_cancel(bContext *C, wmOperator *op) -{ - wm_gesture_end(C, op); -} - -/** - * helper function, we may want to add options for conversion to view space - * - * caller must free. - */ -const int (*WM_gesture_lasso_path_to_array(bContext *UNUSED(C), wmOperator *op, int *mcords_tot))[2] -{ - PropertyRNA *prop = RNA_struct_find_property(op->ptr, "path"); - int (*mcords)[2] = NULL; - BLI_assert(prop != NULL); - - if (prop) { - const int len = RNA_property_collection_length(op->ptr, prop); - - if (len) { - int i = 0; - mcords = MEM_mallocN(sizeof(int) * 2 * len, __func__); - - RNA_PROP_BEGIN (op->ptr, itemptr, prop) - { - float loc[2]; - - RNA_float_get_array(&itemptr, "loc", loc); - mcords[i][0] = (int)loc[0]; - mcords[i][1] = (int)loc[1]; - i++; - } - RNA_PROP_END; - } - *mcords_tot = len; - } - else { - *mcords_tot = 0; - } - - /* cast for 'const' */ - return (const int (*)[2])mcords; -} - -#if 0 -/* template to copy from */ - -static int gesture_lasso_exec(bContext *C, wmOperator *op) -{ - RNA_BEGIN (op->ptr, itemptr, "path") - { - float loc[2]; - - RNA_float_get_array(&itemptr, "loc", loc); - printf("Location: %f %f\n", loc[0], loc[1]); - } - RNA_END; - - return OPERATOR_FINISHED; -} - -void WM_OT_lasso_gesture(wmOperatorType *ot) -{ - PropertyRNA *prop; - - ot->name = "Lasso Gesture"; - ot->idname = "WM_OT_lasso_gesture"; - ot->description = "Select objects within the lasso as you move the pointer"; - - ot->invoke = WM_gesture_lasso_invoke; - ot->modal = WM_gesture_lasso_modal; - ot->exec = gesture_lasso_exec; - - ot->poll = WM_operator_winactive; - - prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE); - RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath); -} -#endif - -/* *********************** straight line gesture ****************** */ - -static int straightline_apply(bContext *C, wmOperator *op) -{ - wmGesture *gesture = op->customdata; - rcti *rect = gesture->customdata; - - if (rect->xmin == rect->xmax && rect->ymin == rect->ymax) - return 0; - - /* operator arguments and storage. */ - RNA_int_set(op->ptr, "xstart", rect->xmin); - RNA_int_set(op->ptr, "ystart", rect->ymin); - RNA_int_set(op->ptr, "xend", rect->xmax); - RNA_int_set(op->ptr, "yend", rect->ymax); - - if (op->type->exec) { - int retval = op->type->exec(C, op); - OPERATOR_RETVAL_CHECK(retval); - } - - return 1; -} - - -int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *event) -{ - PropertyRNA *prop; - - op->customdata = WM_gesture_new(C, event, WM_GESTURE_STRAIGHTLINE); - - /* add modal handler */ - WM_event_add_modal_handler(C, op); - - wm_gesture_tag_redraw(C); - - if ((prop = RNA_struct_find_property(op->ptr, "cursor"))) { - WM_cursor_modal_set(CTX_wm_window(C), RNA_property_int_get(op->ptr, prop)); - } - - return OPERATOR_RUNNING_MODAL; -} - -int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *event) -{ - wmGesture *gesture = op->customdata; - rcti *rect = gesture->customdata; - int sx, sy; - - if (event->type == MOUSEMOVE) { - wm_subwindow_origin_get(CTX_wm_window(C), gesture->swinid, &sx, &sy); - - if (gesture->mode == 0) { - rect->xmin = rect->xmax = event->x - sx; - rect->ymin = rect->ymax = event->y - sy; - } - else { - rect->xmax = event->x - sx; - rect->ymax = event->y - sy; - straightline_apply(C, op); - } - - wm_gesture_tag_redraw(C); - } - else if (event->type == EVT_MODAL_MAP) { - switch (event->val) { - case GESTURE_MODAL_BEGIN: - if (gesture->mode == 0) { - gesture->mode = 1; - wm_gesture_tag_redraw(C); - } - break; - case GESTURE_MODAL_SELECT: - if (straightline_apply(C, op)) { - wm_gesture_end(C, op); - return OPERATOR_FINISHED; - } - wm_gesture_end(C, op); - return OPERATOR_CANCELLED; - - case GESTURE_MODAL_CANCEL: - wm_gesture_end(C, op); - return OPERATOR_CANCELLED; - } - - } - - return OPERATOR_RUNNING_MODAL; -} - -void WM_gesture_straightline_cancel(bContext *C, wmOperator *op) -{ - wm_gesture_end(C, op); -} - -#if 0 -/* template to copy from */ -void WM_OT_straightline_gesture(wmOperatorType *ot) -{ - PropertyRNA *prop; - - ot->name = "Straight Line Gesture"; - ot->idname = "WM_OT_straightline_gesture"; - ot->description = "Draw a straight line as you move the pointer"; - - ot->invoke = WM_gesture_straightline_invoke; - ot->modal = WM_gesture_straightline_modal; - ot->exec = gesture_straightline_exec; - - ot->poll = WM_operator_winactive; - - WM_operator_properties_gesture_straightline(ot, 0); -} -#endif - /* *********************** radial control ****************** */ #define WM_RADIAL_CONTROL_DISPLAY_SIZE (200 * UI_DPI_FAC) @@ -3873,7 +3173,7 @@ enum { eRTUndo = 6, }; -static EnumPropertyItem redraw_timer_type_items[] = { +static const EnumPropertyItem redraw_timer_type_items[] = { {eRTDrawRegion, "DRAW", 0, "Draw Region", "Draw Region"}, {eRTDrawRegionSwap, "DRAW_SWAP", 0, "Draw Region + Swap", "Draw Region and Swap"}, {eRTDrawWindow, "DRAW_WIN", 0, "Draw Window", "Draw Window"}, @@ -4120,7 +3420,7 @@ static void WM_OT_previews_ensure(wmOperatorType *ot) /* *************************** Datablocks previews clear ************* */ /* Only types supporting previews currently. */ -static EnumPropertyItem preview_id_type_items[] = { +static const EnumPropertyItem preview_id_type_items[] = { {FILTER_ID_SCE, "SCENE", 0, "Scenes", ""}, {FILTER_ID_GR, "GROUP", 0, "Groups", ""}, {FILTER_ID_OB, "OBJECT", 0, "Objects", ""}, @@ -4325,7 +3625,7 @@ void wm_operatortype_init(void) /* circleselect-like modal operators */ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""}, @@ -4356,14 +3656,15 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_SELECT); + /* Note: use 'KM_ANY' for release, so the circle exits on any mouse release, + * this is needed when circle select is activated as a tool. */ + /* left mouse shift for deselect too */ WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_DESELECT); - WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_SHIFT, 0, GESTURE_MODAL_NOP); + WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_NOP); WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_DESELECT); // default 2.4x - WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); // default 2.4x - - WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); + WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_NOP); // default 2.4x WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_CIRCLE_SUB); WM_modalkeymap_add_item(keymap, PADMINUS, KM_PRESS, 0, 0, GESTURE_MODAL_CIRCLE_SUB); @@ -4386,7 +3687,7 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) /* straight line modal operators */ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, @@ -4405,7 +3706,7 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN); - WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_SELECT); + WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT); /* assign map to operators */ WM_modalkeymap_assign(keymap, "IMAGE_OT_sample_line"); @@ -4417,7 +3718,7 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf) /* borderselect-like modal operators */ static void gesture_border_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, {GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""}, @@ -4483,7 +3784,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf) /* zoom to border modal operators */ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf) { - static EnumPropertyItem modal_items[] = { + static const EnumPropertyItem modal_items[] = { {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, {GESTURE_MODAL_IN, "IN", 0, "In", ""}, {GESTURE_MODAL_OUT, "OUT", 0, "Out", ""}, @@ -4633,7 +3934,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), bool *r_free, ID *id, bool local) +static const EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), bool *r_free, ID *id, bool local) { EnumPropertyItem item_tmp = {0}, *item = NULL; int totitem = 0; @@ -4654,58 +3955,58 @@ static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(pt } /* can add more as needed */ -EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, false); } #if 0 /* UNUSED */ -EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, true); } #endif -EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->group.first : NULL, false); } -EnumPropertyItem *RNA_group_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_group_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->group.first : NULL, true); } -EnumPropertyItem *RNA_image_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_image_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->image.first : NULL, false); } -EnumPropertyItem *RNA_image_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_image_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->image.first : NULL, true); } -EnumPropertyItem *RNA_scene_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_scene_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, false); } -EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, true); } -EnumPropertyItem *RNA_movieclip_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_movieclip_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, false); } -EnumPropertyItem *RNA_movieclip_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_movieclip_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, true); } -EnumPropertyItem *RNA_mask_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_mask_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->mask.first : NULL, false); } -EnumPropertyItem *RNA_mask_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +const EnumPropertyItem *RNA_mask_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) { return rna_id_itemf(C, ptr, r_free, C ? (ID *)CTX_data_main(C)->mask.first : NULL, true); } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index f6cb0be67d0..450e684c727 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -59,9 +59,9 @@ #include "BKE_screen.h" #include "BKE_workspace.h" - #include "RNA_access.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "WM_api.h" #include "WM_types.h" @@ -895,9 +895,12 @@ int wm_window_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(even } } -struct EnumPropertyItem *wm_window_new_screen_itemf( +const EnumPropertyItem *wm_window_new_screen_itemf( bContext *C, struct PointerRNA *UNUSED(ptr), struct PropertyRNA *UNUSED(prop), bool *r_free) { + if (C == NULL) { + return DummyRNA_NULL_items; + } wmWindow *win = CTX_wm_window(C); WorkSpace *workspace = WM_window_get_active_workspace(win); ListBase *listbase = BKE_workspace_layouts_get(workspace); @@ -1969,6 +1972,16 @@ Scene *WM_windows_scene_get_from_screen(const wmWindowManager *wm, const bScreen return NULL; } +WorkSpace *WM_windows_workspace_get_from_screen(const wmWindowManager *wm, const bScreen *screen) +{ + for (wmWindow *win = wm->windows.first; win; win = win->next) { + if (WM_window_get_active_screen(win) == screen) { + return WM_window_get_active_workspace(win); + } + } + return NULL; +} + Scene *WM_window_get_active_scene(const wmWindow *win) { return win->scene; diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index f63246580ea..83d20aa2612 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -59,14 +59,14 @@ void wm_operatortype_free(void); void wm_operatortype_init(void); void wm_window_keymap(wmKeyConfig *keyconf); -void wm_tweakevent_test(bContext *C, wmEvent *event, int action); - /* wm_gesture.c */ -#define WM_LASSO_MIN_POINTS 1024 void wm_gesture_draw(struct wmWindow *win); int wm_gesture_evaluate(wmGesture *gesture); void wm_gesture_tag_redraw(bContext *C); +/* wm_gesture_ops.c */ +void wm_tweakevent_test(bContext *C, const wmEvent *event, int action); + /* wm_jobs.c */ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt); void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt); @@ -91,12 +91,4 @@ void wm_stereo3d_set_cancel(bContext *C, wmOperator *op); void wm_open_init_load_ui(wmOperator *op, bool use_prefs); void wm_open_init_use_scripts(wmOperator *op, bool use_prefs); -/* hack to store circle select size - campbell, must replace with nice operator memory */ -#define GESTURE_MEMORY - -#ifdef GESTURE_MEMORY -extern int circle_select_size; -#endif - #endif /* __WM_H__ */ - diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h index af72a1542f2..7e217122561 100644 --- a/source/blender/windowmanager/wm_event_system.h +++ b/source/blender/windowmanager/wm_event_system.h @@ -95,7 +95,7 @@ void wm_event_do_notifiers(bContext *C); /* wm_dropbox.c */ void wm_dropbox_free(void); -void wm_drags_check_ops(bContext *C, wmEvent *event); +void wm_drags_check_ops(bContext *C, const wmEvent *event); void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect); #endif /* __WM_EVENT_SYSTEM_H__ */ diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 9d34bc24e6c..e327bd81d81 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -433,6 +433,7 @@ enum { GESTURE_MODAL_CANCEL = 1, GESTURE_MODAL_CONFIRM = 2, + /* Uses 'deselect' operator property. */ GESTURE_MODAL_SELECT = 3, GESTURE_MODAL_DESELECT = 4, @@ -443,6 +444,7 @@ enum { GESTURE_MODAL_BEGIN = 8, /* border select/straight line, activate, use release to detect which button */ + /* Uses 'zoom_out' operator property. */ GESTURE_MODAL_IN = 9, GESTURE_MODAL_OUT = 10, diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index c8f89a5bf62..0264955a4c5 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -82,7 +82,8 @@ void wm_window_IME_end (wmWindow *win); int wm_window_close_exec(bContext *C, struct wmOperator *op); int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op); -struct EnumPropertyItem *wm_window_new_screen_itemf(bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); +const struct EnumPropertyItem *wm_window_new_screen_itemf( + bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free); int wm_window_new_exec(bContext *C, struct wmOperator *op); int wm_window_new_invoke(bContext *C, struct wmOperator *op, const struct wmEvent *event); |