Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2019-05-16 04:48:45 +0300
committerYimingWu <xp8110@outlook.com>2019-05-16 04:48:45 +0300
commit54804117e89931a1e7bfa67b2aaf4fe237881ab6 (patch)
tree72f60f4ee18426243c986e973029508ab706569a /source/blender/blenkernel
parent2753611c4e2482885021416f1b2af46250fd09dd (diff)
parent2384564149b54374572ea28f91b5f64dc61143e2 (diff)
Merge branch 'master' into soc-2018-npr
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_appdir.h1
-rw-r--r--source/blender/blenkernel/BKE_armature.h4
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/BKE_blendfile.h2
-rw-r--r--source/blender/blenkernel/BKE_collection.h2
-rw-r--r--source/blender/blenkernel/BKE_curve.h11
-rw-r--r--source/blender/blenkernel/BKE_displist.h9
-rw-r--r--source/blender/blenkernel/BKE_global.h4
-rw-r--r--source/blender/blenkernel/BKE_image.h5
-rw-r--r--source/blender/blenkernel/BKE_material.h2
-rw-r--r--source/blender/blenkernel/BKE_mesh.h2
-rw-r--r--source/blender/blenkernel/BKE_movieclip.h3
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h2
-rw-r--r--source/blender/blenkernel/BKE_scene.h8
-rw-r--r--source/blender/blenkernel/BKE_sound.h25
-rw-r--r--source/blender/blenkernel/BKE_workspace.h2
-rw-r--r--source/blender/blenkernel/BKE_writeavi.h3
-rw-r--r--source/blender/blenkernel/intern/action.c1
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c12
-rw-r--r--source/blender/blenkernel/intern/appdir.c20
-rw-r--r--source/blender/blenkernel/intern/armature.c51
-rw-r--r--source/blender/blenkernel/intern/armature_update.c60
-rw-r--r--source/blender/blenkernel/intern/blendfile.c122
-rw-r--r--source/blender/blenkernel/intern/collection.c9
-rw-r--r--source/blender/blenkernel/intern/constraint.c33
-rw-r--r--source/blender/blenkernel/intern/curve.c234
-rw-r--r--source/blender/blenkernel/intern/displist.c207
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c2
-rw-r--r--source/blender/blenkernel/intern/fcurve.c5
-rw-r--r--source/blender/blenkernel/intern/image.c6
-rw-r--r--source/blender/blenkernel/intern/layer.c38
-rw-r--r--source/blender/blenkernel/intern/library.c2
-rw-r--r--source/blender/blenkernel/intern/light.c1
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c2
-rw-r--r--source/blender/blenkernel/intern/object.c11
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c2
-rw-r--r--source/blender/blenkernel/intern/object_update.c6
-rw-r--r--source/blender/blenkernel/intern/paint.c3
-rw-r--r--source/blender/blenkernel/intern/scene.c47
-rw-r--r--source/blender/blenkernel/intern/screen.c13
-rw-r--r--source/blender/blenkernel/intern/sequencer.c31
-rw-r--r--source/blender/blenkernel/intern/sound.c331
-rw-r--r--source/blender/blenkernel/intern/workspace.c51
-rw-r--r--source/blender/blenkernel/intern/writeavi.c1
45 files changed, 489 insertions, 901 deletions
diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index 7ff8514f675..e956aeb769a 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -36,6 +36,7 @@ const char *BKE_appdir_folder_id_version(const int folder_id, const int ver, con
bool BKE_appdir_app_is_portable_install(void);
bool BKE_appdir_app_template_any(void);
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len);
+bool BKE_appdir_app_template_has_userpref(const char *app_template);
void BKE_appdir_app_templates(struct ListBase *templates);
/* Initialize path to program executable */
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index b5da30e725d..6839e13ffe1 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -84,7 +84,9 @@ bool BKE_pose_minmax(
int bone_autoside_name(char name[64], int strip_number, short axis, float head, float tail);
struct Bone *BKE_armature_find_bone_name(struct bArmature *arm, const char *name);
-struct GHash *BKE_armature_bone_from_name_map(struct bArmature *arm);
+
+void BKE_armature_bone_hash_make(struct bArmature *arm);
+void BKE_armature_bone_hash_free(struct bArmature *arm);
bool BKE_armature_bone_flag_test_recursive(const struct Bone *bone, int flag);
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index e01f6a6b751..a36ead4630e 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 60
+#define BLENDER_SUBVERSION 64
/** Several breakages with 280, e.g. collections vs layers. */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_blendfile.h b/source/blender/blenkernel/BKE_blendfile.h
index 216bef0d1e3..76c05b0411a 100644
--- a/source/blender/blenkernel/BKE_blendfile.h
+++ b/source/blender/blenkernel/BKE_blendfile.h
@@ -62,6 +62,8 @@ struct UserDef *BKE_blendfile_userdef_read_from_memory(const void *filebuf,
bool BKE_blendfile_userdef_write(const char *filepath, struct ReportList *reports);
bool BKE_blendfile_userdef_write_app_template(const char *filepath, struct ReportList *reports);
+bool BKE_blendfile_userdef_write_all(struct ReportList *reports);
+
struct WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepath,
const void *filebuf,
int filelength,
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index 47786629aed..0e093bb086b 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -161,6 +161,8 @@ bool BKE_collection_move(struct Main *bmain,
bool BKE_collection_find_cycle(struct Collection *new_ancestor, struct Collection *collection);
+bool BKE_collection_has_collection(struct Collection *parent, struct Collection *collection);
+
/* Iteration callbacks. */
typedef void (*BKE_scene_objects_Cb)(struct Object *ob, void *data);
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 4eaa0fbe057..4356d39be36 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -134,10 +134,6 @@ void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex);
void BKE_curve_editNurb_free(struct Curve *cu);
struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu);
-float *BKE_curve_make_orco(struct Depsgraph *depsgraph,
- struct Scene *scene,
- struct Object *ob,
- int *r_numVerts);
float *BKE_curve_surf_make_orco(struct Object *ob);
void BKE_curve_bevelList_free(struct ListBase *bev);
@@ -147,7 +143,6 @@ void BKE_curve_bevel_make(struct Depsgraph *depsgraph,
struct Object *ob,
struct ListBase *disp,
const bool for_render,
- const bool use_render_resolution,
struct LinkNode *ob_cyclic_list);
void BKE_curve_forward_diff_bezier(
@@ -212,9 +207,9 @@ void BKE_nurb_knot_calc_u(struct Nurb *nu);
void BKE_nurb_knot_calc_v(struct Nurb *nu);
/* nurb checks if they can be drawn, also clamp order func */
-bool BKE_nurb_check_valid_u(struct Nurb *nu);
-bool BKE_nurb_check_valid_v(struct Nurb *nu);
-bool BKE_nurb_check_valid_uv(struct Nurb *nu);
+bool BKE_nurb_check_valid_u(const struct Nurb *nu);
+bool BKE_nurb_check_valid_v(const struct Nurb *nu);
+bool BKE_nurb_check_valid_uv(const struct Nurb *nu);
bool BKE_nurb_order_clamp_u(struct Nurb *nu);
bool BKE_nurb_order_clamp_v(struct Nurb *nu);
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index 9bf5a2f9971..db57df42d02 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -85,8 +85,7 @@ void BKE_displist_make_surf(struct Depsgraph *depsgraph,
struct ListBase *dispbase,
struct Mesh **r_final,
const bool for_render,
- const bool for_orco,
- const bool use_render_resolution);
+ const bool for_orco);
void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob,
@@ -99,13 +98,7 @@ void BKE_displist_make_curveTypes_forRender(struct Depsgraph *depsgraph,
struct ListBase *dispbase,
struct Mesh **r_final,
const bool for_orco,
- const bool use_render_resolution,
struct LinkNode *ob_cyclic_list);
-void BKE_displist_make_curveTypes_forOrco(struct Depsgraph *depsgraph,
- struct Scene *scene,
- struct Object *ob,
- struct ListBase *dispbase,
- struct LinkNode *ob_cyclic_list);
void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob);
void BKE_displist_make_mball_forRender(struct Depsgraph *depsgraph,
struct Scene *scene,
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 2c19c1e2006..387e7f2182b 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -111,6 +111,7 @@ enum {
G_FLAG_PICKSEL = (1 << 2),
/** Support simulating events (for testing). */
G_FLAG_EVENT_SIMULATE = (1 << 3),
+ G_FLAG_USERPREF_NO_SAVE_ON_EXIT = (1 << 4),
G_FLAG_SCRIPT_AUTOEXEC = (1 << 13),
/** When this flag is set ignore the prefs #USER_SCRIPT_AUTOEXEC_DISABLE. */
@@ -121,7 +122,8 @@ enum {
/** Don't overwrite these flags when reading a file. */
#define G_FLAG_ALL_RUNTIME \
- (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF | G_FLAG_EVENT_SIMULATE)
+ (G_FLAG_SCRIPT_AUTOEXEC | G_FLAG_SCRIPT_OVERRIDE_PREF | G_FLAG_EVENT_SIMULATE | \
+ G_FLAG_USERPREF_NO_SAVE_ON_EXIT)
/** Flags to read from blend file. */
#define G_FLAG_ALL_READFILE 0
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 28886a5a195..d5304ec5434 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -340,12 +340,15 @@ void BKE_image_buf_fill_checker_color(unsigned char *rect,
unsigned char *BKE_image_get_pixels_for_frame(struct Image *image, int frame);
float *BKE_image_get_float_pixels_for_frame(struct Image *image, int frame);
+/* Image modifications */
+bool BKE_image_is_dirty(struct Image *image);
+void BKE_image_mark_dirty(struct Image *image, struct ImBuf *ibuf);
+
/* Guess offset for the first frame in the sequence */
int BKE_image_sequence_guess_offset(struct Image *image);
bool BKE_image_has_anim(struct Image *image);
bool BKE_image_has_packedfile(struct Image *image);
bool BKE_image_is_animated(struct Image *image);
-bool BKE_image_is_dirty(struct Image *image);
void BKE_image_file_format_set(struct Image *image,
int ftype,
const struct ImbFormatOptions *options);
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 9d8b9218a79..37c502b3b0c 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -113,7 +113,7 @@ void free_matcopybuf(void);
void copy_matcopybuf(struct Main *bmain, struct Material *ma);
void paste_matcopybuf(struct Main *bmain, struct Material *ma);
-/* Dependency graph evaluation. */
+/* Evaluation. */
struct Depsgraph;
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index ecee00b1b3f..b094dc5f400 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -671,11 +671,9 @@ void BKE_mesh_eval_geometry(struct Depsgraph *depsgraph, struct Mesh *mesh);
/* Draw Cache */
enum {
BKE_MESH_BATCH_DIRTY_ALL = 0,
- BKE_MESH_BATCH_DIRTY_MAYBE_ALL,
BKE_MESH_BATCH_DIRTY_SELECT,
BKE_MESH_BATCH_DIRTY_SELECT_PAINT,
BKE_MESH_BATCH_DIRTY_SHADING,
- BKE_MESH_BATCH_DIRTY_SCULPT_COORDS,
BKE_MESH_BATCH_DIRTY_UVEDIT_ALL,
BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT,
};
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index 9425f396bc5..43ee284a201 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -116,8 +116,7 @@ bool BKE_movieclip_put_frame_if_possible(struct MovieClip *clip,
struct MovieClipUser *user,
struct ImBuf *ibuf);
-/* Dependency graph evaluation. */
-
+/* Evaluation. */
void BKE_movieclip_eval_update(struct Depsgraph *depsgraph, struct MovieClip *clip);
void BKE_movieclip_eval_selection_update(struct Depsgraph *depsgraph, struct MovieClip *clip);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 49b35bfccc1..c373fbfe478 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -100,6 +100,8 @@ bool BKE_object_is_mode_compat(const struct Object *ob, eObjectMode object_mode)
bool BKE_object_data_is_in_editmode(const struct ID *id);
+void BKE_object_update_select_id(struct Main *bmain);
+
typedef enum eObjectVisibilityResult {
OB_VISIBLE_SELF = 1,
OB_VISIBLE_PARTICLES = 2,
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 9b15462de6b..315c0224b11 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -34,13 +34,13 @@ struct CCGKey;
struct CustomData;
struct DMFlagMat;
struct GPUBatch;
+struct GPU_PBVH_Buffers;
struct MLoop;
struct MLoopTri;
struct MPoly;
struct MVert;
struct PBVH;
struct PBVHNode;
-struct GPU_PBVH_Buffers;
typedef struct PBVH PBVH;
typedef struct PBVHNode PBVHNode;
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 3b5db883cf3..75ff5eace3c 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -240,14 +240,6 @@ void BKE_scene_cursor_quat_to_rot(struct View3DCursor *cursor,
const float quat[4],
bool use_compat);
-/* Dependency graph evaluation. */
-
-/* Evaluate parts of sequences which needs to be done as a part of a dependency graph evaluation.
- * This does NOT include actual rendering of the strips, but rather makes them up-to-date for
- * animation playback and makes them ready for the sequencer's rendering pipeline to render them.
- */
-void BKE_scene_eval_sequencer_sequences(struct Depsgraph *depsgraph, struct Scene *scene);
-
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index f526dd579ce..91e23d35f0e 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -32,7 +32,6 @@
struct Main;
struct Sequence;
struct bSound;
-struct Depsgraph;
typedef struct SoundWaveform {
int length;
@@ -72,17 +71,10 @@ void BKE_sound_cache(struct bSound *sound);
void BKE_sound_delete_cache(struct bSound *sound);
-void BKE_sound_reset_runtime(struct bSound *sound);
void BKE_sound_load(struct Main *main, struct bSound *sound);
-void BKE_sound_ensure_loaded(struct Main *bmain, struct bSound *sound);
void BKE_sound_free(struct bSound *sound);
-/* Is used by sequencer to temporarily load audio to access information about channels and
- * duration. */
-void BKE_sound_load_audio(struct Main *main, struct bSound *sound);
-void BKE_sound_free_audio(struct bSound *sound);
-
void BKE_sound_copy_data(struct Main *bmain,
struct bSound *sound_dst,
const struct bSound *sound_src,
@@ -94,9 +86,7 @@ void BKE_sound_make_local(struct Main *bmain, struct bSound *sound, const bool l
AUD_Device *BKE_sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
#endif
-void BKE_sound_reset_scene_runtime(struct Scene *scene);
void BKE_sound_create_scene(struct Scene *scene);
-void BKE_sound_ensure_scene(struct Scene *scene);
void BKE_sound_destroy_scene(struct Scene *scene);
@@ -144,10 +134,6 @@ void BKE_sound_stop_scene(struct Scene *scene);
void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
-/* Use this after original scene's frame has been changed. It will take care of doing all the
- * updates required for BKE_sound_seek_scene(). */
-void BKE_sound_update_and_seek(struct Main *bmain, struct Depsgraph *depsgraph);
-
float BKE_sound_sync_scene(struct Scene *scene);
int BKE_sound_scene_playing(struct Scene *scene);
@@ -164,15 +150,4 @@ float BKE_sound_get_length(struct bSound *sound);
char **BKE_sound_get_device_names(void);
-typedef void (*SoundJackSyncCallback)(struct Main *bmain, int mode, float time);
-
-void BKE_sound_jack_sync_callback_set(SoundJackSyncCallback callback);
-void BKE_sound_jack_scene_update(struct Scene *scene, int mode, float time);
-
-/* Dependency graph evaluation. */
-
-struct Depsgraph;
-
-void BKE_sound_evaluate(struct Depsgraph *depsgraph, struct Main *bmain, struct bSound *sound);
-
#endif /* __BKE_SOUND_H__ */
diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h
index 0a4ad4cd994..133cf2d6cf5 100644
--- a/source/blender/blenkernel/BKE_workspace.h
+++ b/source/blender/blenkernel/BKE_workspace.h
@@ -110,6 +110,8 @@ void BKE_workspace_hook_layout_for_workspace_set(struct WorkSpaceInstanceHook *h
bool BKE_workspace_owner_id_check(const struct WorkSpace *workspace, const char *owner_id)
ATTR_NONNULL();
+void BKE_workspace_id_tag_all_visible(struct Main *bmain, int tag) ATTR_NONNULL();
+
#undef GETTER_ATTRS
#undef SETTER_ATTRS
diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h
index 72817217a0a..3212bad75cb 100644
--- a/source/blender/blenkernel/BKE_writeavi.h
+++ b/source/blender/blenkernel/BKE_writeavi.h
@@ -53,9 +53,6 @@ typedef struct bMovieHandle {
const char *suffix,
struct ReportList *reports);
void (*end_movie)(void *context_v);
- int (*get_next_frame)(void *context_v,
- struct RenderData *rd,
- struct ReportList *reports); /* optional */
void (*get_movie_path)(char *string,
struct RenderData *rd,
bool preview,
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 9b321ff4e44..34c50865073 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -978,6 +978,7 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f
}
pchan->custom_scale = pchan_from->custom_scale;
+ pchan->drawflag = pchan_from->drawflag;
}
/* checks for IK constraint, Spline IK, and also for Follow-Path constraint.
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index cc5cd3b03ae..663eb4027f6 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1893,6 +1893,10 @@ static void animsys_evaluate_fcurves(Depsgraph *depsgraph,
if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED))) {
continue;
}
+ /* Skip empty curves, as if muted. */
+ if (fcu->totvert == 0) {
+ continue;
+ }
PathResolvedRNA anim_rna;
if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) {
const float curval = calculate_fcurve(&anim_rna, fcu, ctime);
@@ -2005,7 +2009,7 @@ void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup *
/* calculate then execute each curve */
for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcu->next) {
/* check if this curve should be skipped */
- if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) {
+ if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0 && fcu->totvert != 0) {
PathResolvedRNA anim_rna;
if (animsys_store_rna_setting(ptr, fcu->rna_path, fcu->array_index, &anim_rna)) {
const float curval = calculate_fcurve(&anim_rna, fcu, ctime);
@@ -3101,6 +3105,9 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr,
if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) {
continue;
}
+ if (fcu->totvert == 0) {
+ continue;
+ }
/* evaluate the F-Curve's value for the time given in the strip
* NOTE: we use the modified time here, since strip's F-Curve Modifiers
@@ -3327,6 +3334,9 @@ static void nla_eval_domain_action(PointerRNA *ptr,
if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) {
continue;
}
+ if (fcu->totvert == 0) {
+ continue;
+ }
NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path);
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 2b4123c74e2..c1ea57c5fcc 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -838,6 +838,26 @@ bool BKE_appdir_app_template_id_search(const char *app_template, char *path, siz
return false;
}
+bool BKE_appdir_app_template_has_userpref(const char *app_template)
+{
+ /* Test if app template provides a userpref.blend.
+ * If not, we will share user preferences with the rest of Blender. */
+ if (!app_template && app_template[0]) {
+ return false;
+ }
+
+ char app_template_path[FILE_MAX];
+ if (!BKE_appdir_app_template_id_search(
+ app_template, app_template_path, sizeof(app_template_path))) {
+ return false;
+ }
+
+ char userpref_path[FILE_MAX];
+ BLI_path_join(
+ userpref_path, sizeof(userpref_path), app_template_path, BLENDER_USERPREF_FILE, NULL);
+ return BLI_exists(userpref_path);
+}
+
void BKE_appdir_app_templates(ListBase *templates)
{
BLI_listbase_clear(templates);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 60446bf60b6..bd9907acb24 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -125,6 +125,7 @@ void BKE_armature_free(bArmature *arm)
{
BKE_animdata_free(&arm->id, false);
+ BKE_armature_bone_hash_free(arm);
BKE_armature_bonelist_free(&arm->bonebase);
/* free editmode data */
@@ -169,25 +170,20 @@ static void copy_bonechildren(Bone *bone_dst,
}
}
-static void copy_bonechildren_custom_handles(Bone *bone_dst, bArmature *arm_dst, GHash **bone_hash)
+static void copy_bonechildren_custom_handles(Bone *bone_dst, bArmature *arm_dst)
{
Bone *bone_dst_child;
- /* Lazily create the name -> bone hashtable. */
- if ((bone_dst->bbone_prev || bone_dst->bbone_next) && *bone_hash == NULL) {
- *bone_hash = BKE_armature_bone_from_name_map(arm_dst);
- }
-
if (bone_dst->bbone_prev) {
- bone_dst->bbone_prev = BLI_ghash_lookup(*bone_hash, bone_dst->bbone_prev->name);
+ bone_dst->bbone_prev = BKE_armature_find_bone_name(arm_dst, bone_dst->bbone_prev->name);
}
if (bone_dst->bbone_next) {
- bone_dst->bbone_next = BLI_ghash_lookup(*bone_hash, bone_dst->bbone_next->name);
+ bone_dst->bbone_next = BKE_armature_find_bone_name(arm_dst, bone_dst->bbone_next->name);
}
for (bone_dst_child = bone_dst->childbase.first; bone_dst_child;
bone_dst_child = bone_dst_child->next) {
- copy_bonechildren_custom_handles(bone_dst_child, arm_dst, bone_hash);
+ copy_bonechildren_custom_handles(bone_dst_child, arm_dst);
}
}
@@ -212,6 +208,8 @@ void BKE_armature_copy_data(Main *UNUSED(bmain),
/* We never handle usercount here for own data. */
const int flag_subdata = flag | LIB_ID_CREATE_NO_USER_REFCOUNT;
+ arm_dst->bonehash = NULL;
+
BLI_duplicatelist(&arm_dst->bonebase, &arm_src->bonebase);
/* Duplicate the childrens' lists */
@@ -224,15 +222,11 @@ void BKE_armature_copy_data(Main *UNUSED(bmain),
arm_dst->act_bone = bone_dst_act;
- /* Fix custom handle references. */
- GHash *bone_hash = NULL; /* lazily created */
+ BKE_armature_bone_hash_make(arm_dst);
+ /* Fix custom handle references. */
for (bone_dst = arm_dst->bonebase.first; bone_dst; bone_dst = bone_dst->next) {
- copy_bonechildren_custom_handles(bone_dst, arm_dst, &bone_hash);
- }
-
- if (bone_hash) {
- BLI_ghash_free(bone_hash, NULL, NULL);
+ copy_bonechildren_custom_handles(bone_dst, arm_dst);
}
arm_dst->edbo = NULL;
@@ -274,6 +268,10 @@ Bone *BKE_armature_find_bone_name(bArmature *arm, const char *name)
return NULL;
}
+ if (arm->bonehash) {
+ return BLI_ghash_lookup(arm->bonehash, name);
+ }
+
return get_named_bone_bonechildren(&arm->bonebase, name);
}
@@ -291,7 +289,7 @@ static void armature_bone_from_name_insert_recursive(GHash *bone_hash, ListBase
* \note typically #bPose.chanhash us used via #BKE_pose_channel_find_name
* this is for the cases we can't use pose channels.
*/
-GHash *BKE_armature_bone_from_name_map(bArmature *arm)
+static GHash *armature_bone_from_name_map(bArmature *arm)
{
const int bones_count = BKE_armature_bonelist_count(&arm->bonebase);
GHash *bone_hash = BLI_ghash_str_new_ex(__func__, bones_count);
@@ -299,6 +297,21 @@ GHash *BKE_armature_bone_from_name_map(bArmature *arm)
return bone_hash;
}
+void BKE_armature_bone_hash_make(bArmature *arm)
+{
+ if (!arm->bonehash) {
+ arm->bonehash = armature_bone_from_name_map(arm);
+ }
+}
+
+void BKE_armature_bone_hash_free(bArmature *arm)
+{
+ if (arm->bonehash) {
+ BLI_ghash_free(arm->bonehash, NULL, NULL);
+ arm->bonehash = NULL;
+ }
+}
+
bool BKE_armature_bone_flag_test_recursive(const Bone *bone, int flag)
{
if (bone->flag & flag) {
@@ -2458,11 +2471,9 @@ void BKE_pose_clear_pointers(bPose *pose)
void BKE_pose_remap_bone_pointers(bArmature *armature, bPose *pose)
{
- GHash *bone_hash = BKE_armature_bone_from_name_map(armature);
for (bPoseChannel *pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
- pchan->bone = BLI_ghash_lookup(bone_hash, pchan->name);
+ pchan->bone = BKE_armature_find_bone_name(armature, pchan->name);
}
- BLI_ghash_free(bone_hash, NULL, NULL);
}
/** Find the matching pose channel using the bone name, if not NULL. */
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index c71c2dc86cf..bf7d81e5d63 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -273,11 +273,12 @@ static void splineik_evaluate_bone(
/* first, adjust the point positions on the curve */
float curveLen = tree->points[index] - tree->points[index + 1];
float pointStart = state->curve_position;
+ float poseScale = len_v3v3(poseHead, poseTail) / pchan->bone->length;
float baseScale = 1.0f;
if (ikData->yScaleMode == CONSTRAINT_SPLINEIK_YS_ORIGINAL) {
/* Carry over the bone Y scale to the curve range. */
- baseScale = len_v3v3(poseHead, poseTail) / pchan->bone->length;
+ baseScale = poseScale;
}
float pointEnd = pointStart + curveLen * baseScale * state->curve_scale;
@@ -339,8 +340,8 @@ static void splineik_evaluate_bone(
sub_v3_v3v3(splineVec, poseTail, poseHead);
scaleFac = len_v3(splineVec) / pchan->bone->length;
- /* Adjust the scale factor towards the neutral state when rolling off the curve end. */
- scaleFac = interpf(scaleFac, baseScale, tailBlendFac);
+ /* Extrapolate the full length of the bone as it rolls off the end of the curve. */
+ scaleFac = (tailBlendFac < 1e-5f) ? baseScale : scaleFac / tailBlendFac;
/* Step 3: compute the shortest rotation needed
* to map from the bone rotation to the current axis.
@@ -394,24 +395,31 @@ static void splineik_evaluate_bone(
}
/* step 4: set the scaling factors for the axes */
- {
- /* only multiply the y-axis by the scaling factor to get nice volume-preservation */
- mul_v3_fl(poseMat[1], scaleFac);
- /* set the scaling factors of the x and z axes from... */
- switch (ikData->xzScaleMode) {
- case CONSTRAINT_SPLINEIK_XZS_ORIGINAL: {
- /* original scales get used */
- float scale;
+ /* Always multiply the y-axis by the scaling factor to get the correct length. */
+ mul_v3_fl(poseMat[1], scaleFac);
+
+ /* After that, apply x/z scaling modes. */
+ if (ikData->xzScaleMode != CONSTRAINT_SPLINEIK_XZS_NONE) {
+ /* First, apply the original scale if enabled. */
+ if (ikData->xzScaleMode == CONSTRAINT_SPLINEIK_XZS_ORIGINAL ||
+ (ikData->flag & CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE) != 0) {
+ float scale;
+
+ /* x-axis scale */
+ scale = len_v3(pchan->pose_mat[0]);
+ mul_v3_fl(poseMat[0], scale);
+ /* z-axis scale */
+ scale = len_v3(pchan->pose_mat[2]);
+ mul_v3_fl(poseMat[2], scale);
+
+ /* Adjust the scale factor used for volume preservation
+ * to consider the pre-IK scaling as the initial volume. */
+ scaleFac /= poseScale;
+ }
- /* x-axis scale */
- scale = len_v3(pchan->pose_mat[0]);
- mul_v3_fl(poseMat[0], scale);
- /* z-axis scale */
- scale = len_v3(pchan->pose_mat[2]);
- mul_v3_fl(poseMat[2], scale);
- break;
- }
+ /* Apply volume preservation. */
+ switch (ikData->xzScaleMode) {
case CONSTRAINT_SPLINEIK_XZS_INVERSE: {
/* old 'volume preservation' method using the inverse scale */
float scale;
@@ -483,14 +491,14 @@ static void splineik_evaluate_bone(
break;
}
}
+ }
- /* finally, multiply the x and z scaling by the radius of the curve too,
- * to allow automatic scales to get tweaked still
- */
- if ((ikData->flag & CONSTRAINT_SPLINEIK_NO_CURVERAD) == 0) {
- mul_v3_fl(poseMat[0], radius);
- mul_v3_fl(poseMat[2], radius);
- }
+ /* Finally, multiply the x and z scaling by the radius of the curve too,
+ * to allow automatic scales to get tweaked still.
+ */
+ if ((ikData->flag & CONSTRAINT_SPLINEIK_NO_CURVERAD) == 0) {
+ mul_v3_fl(poseMat[0], radius);
+ mul_v3_fl(poseMat[2], radius);
}
/* Blend the scaling of the matrix according to the influence. */
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index d1a3045a829..570c1b9bd4c 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -98,6 +98,25 @@ static bool wm_scene_is_visible(wmWindowManager *wm, Scene *scene)
return false;
}
+static void setup_app_userdef(BlendFileData *bfd)
+{
+ if (bfd->user) {
+ /* only here free userdef themes... */
+ BKE_blender_userdef_data_set_and_free(bfd->user);
+ bfd->user = NULL;
+
+ /* Security issue: any blend file could include a USER block.
+ *
+ * Currently we load prefs from BLENDER_STARTUP_FILE and later on load BLENDER_USERPREF_FILE,
+ * to load the preferences defined in the users home dir.
+ *
+ * This means we will never accidentally (or maliciously)
+ * enable scripts auto-execution by loading a '.blend' file.
+ */
+ U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
+ }
+}
+
/**
* Context matching, handle no-ui case
*
@@ -235,26 +254,10 @@ static void setup_app_data(bContext *C,
RNA_property_update_cache_free();
bmain = G_MAIN = bfd->main;
+ bfd->main = NULL;
CTX_data_main_set(C, bmain);
- if (bfd->user) {
-
- /* only here free userdef themes... */
- BKE_blender_userdef_data_set_and_free(bfd->user);
- bfd->user = NULL;
-
- /* Security issue: any blend file could include a USER block.
- *
- * Currently we load prefs from BLENDER_STARTUP_FILE and later on load BLENDER_USERPREF_FILE,
- * to load the preferences defined in the users home dir.
- *
- * This means we will never accidentally (or maliciously)
- * enable scripts auto-execution by loading a '.blend' file.
- */
- U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
- }
-
/* case G_FILE_NO_UI or no screens in file */
if (mode != LOAD_UI) {
/* leave entire context further unaltered? */
@@ -356,8 +359,20 @@ static void setup_app_data(bContext *C,
/* TODO(sergey): Can this be also move above? */
RE_FreeAllPersistentData();
}
+}
- MEM_freeN(bfd);
+static void setup_app_blend_file_data(bContext *C,
+ BlendFileData *bfd,
+ const char *filepath,
+ const struct BlendFileReadParams *params,
+ ReportList *reports)
+{
+ if ((params->skip_flags & BLO_READ_SKIP_USERDEF) == 0) {
+ setup_app_userdef(bfd);
+ }
+ if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
+ setup_app_data(C, bfd, filepath, params->is_startup, reports);
+ }
}
static int handle_subversion_warning(Main *main, ReportList *reports)
@@ -400,7 +415,8 @@ int BKE_blendfile_read(bContext *C,
retval = BKE_BLENDFILE_READ_FAIL;
}
else {
- setup_app_data(C, bfd, filepath, params->is_startup, reports);
+ setup_app_blend_file_data(C, bfd, filepath, params, reports);
+ BLO_blendfiledata_free(bfd);
}
}
else {
@@ -422,9 +438,13 @@ bool BKE_blendfile_read_from_memory(bContext *C,
bfd = BLO_read_from_memory(filebuf, filelength, params->skip_flags, reports);
if (bfd) {
if (update_defaults) {
- BLO_update_defaults_startup_blend(bfd->main, NULL);
+ if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
+ BLO_update_defaults_startup_blend(bfd->main, NULL);
+ }
}
- setup_app_data(C, bfd, "<memory2>", params->is_startup, reports);
+
+ setup_app_blend_file_data(C, bfd, "<memory2>", params, reports);
+ BLO_blendfiledata_free(bfd);
}
else {
BKE_reports_prepend(reports, "Loading failed: ");
@@ -453,7 +473,8 @@ bool BKE_blendfile_read_from_memfile(bContext *C,
BKE_id_free(bfd->main, bfd->main->screens.first);
}
- setup_app_data(C, bfd, "<memory1>", params->is_startup, reports);
+ setup_app_blend_file_data(C, bfd, "<memory1>", params, reports);
+ BLO_blendfiledata_free(bfd);
}
else {
BKE_reports_prepend(reports, "Loading failed: ");
@@ -566,6 +587,63 @@ bool BKE_blendfile_userdef_write_app_template(const char *filepath, ReportList *
return ok;
}
+bool BKE_blendfile_userdef_write_all(ReportList *reports)
+{
+ char filepath[FILE_MAX];
+ const char *cfgdir;
+ bool ok = true;
+ const bool use_template_userpref = BKE_appdir_app_template_has_userpref(U.app_template);
+
+ if ((cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL))) {
+ bool ok_write;
+ BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE, NULL);
+
+ printf("Writing userprefs: '%s' ", filepath);
+ if (use_template_userpref) {
+ ok_write = BKE_blendfile_userdef_write_app_template(filepath, reports);
+ }
+ else {
+ ok_write = BKE_blendfile_userdef_write(filepath, reports);
+ }
+
+ if (ok_write) {
+ printf("ok\n");
+ }
+ else {
+ printf("fail\n");
+ ok = false;
+ }
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Unable to create userpref path");
+ }
+
+ if (use_template_userpref) {
+ if ((cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, U.app_template))) {
+ /* Also save app-template prefs */
+ BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE, NULL);
+
+ printf("Writing userprefs app-template: '%s' ", filepath);
+ if (BKE_blendfile_userdef_write(filepath, reports) != 0) {
+ printf("ok\n");
+ }
+ else {
+ printf("fail\n");
+ ok = false;
+ }
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Unable to create app-template userpref path");
+ ok = false;
+ }
+ }
+
+ if (ok) {
+ U.runtime.is_dirty = false;
+ }
+ return ok;
+}
+
WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepath,
const void *filebuf,
int filelength,
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index d33d4e344b5..87f448d8d57 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -434,8 +434,8 @@ static void collection_object_cache_fill(ListBase *lb, Collection *collection, i
int object_restrict = base->object->restrictflag;
- if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
- ((object_restrict & OB_RESTRICT_VIEW) == 0)) {
+ if (((child_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0) &&
+ ((object_restrict & OB_RESTRICT_VIEWPORT) == 0)) {
base->flag |= BASE_ENABLED_VIEWPORT;
}
@@ -966,6 +966,11 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll
return false;
}
+bool BKE_collection_has_collection(Collection *parent, Collection *collection)
+{
+ return collection_find_child_recursive(parent, collection);
+}
+
static CollectionParent *collection_find_parent(Collection *child, Collection *collection)
{
return BLI_findptr(&child->parents, collection, offsetof(CollectionParent, collection));
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 0e29f165992..c680e15763d 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1882,6 +1882,7 @@ static void sizelike_new_data(void *cdata)
bSizeLikeConstraint *data = (bSizeLikeConstraint *)cdata;
data->flag = SIZELIKE_X | SIZELIKE_Y | SIZELIKE_Z | SIZELIKE_MULTIPLY;
+ data->power = 1.0f;
}
static void sizelike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
@@ -1929,6 +1930,10 @@ static void sizelike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
mat4_to_size(size, ct->matrix);
mat4_to_size(obsize, cob->matrix);
+ for (int i = 0; i < 3; i++) {
+ size[i] = powf(size[i], data->power);
+ }
+
if (data->flag & SIZELIKE_OFFSET) {
/* Scale is a multiplicative quantity, so adding it makes no sense.
* However, the additive mode has to stay for backward compatibility. */
@@ -2037,7 +2042,7 @@ static void samevolume_new_data(void *cdata)
{
bSameVolumeConstraint *data = (bSameVolumeConstraint *)cdata;
- data->flag = SAMEVOL_Y;
+ data->free_axis = SAMEVOL_Y;
data->volume = 1.0f;
}
@@ -2046,19 +2051,30 @@ static void samevolume_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *
bSameVolumeConstraint *data = con->data;
float volume = data->volume;
- float fac = 1.0f, total_scale;
+ float fac = 1.0f, total_scale = 1.0f;
float obsize[3];
mat4_to_size(obsize, cob->matrix);
/* calculate normalizing scale factor for non-essential values */
- total_scale = obsize[0] * obsize[1] * obsize[2];
+ switch (data->mode) {
+ case SAMEVOL_STRICT:
+ total_scale = obsize[0] * obsize[1] * obsize[2];
+ break;
+ case SAMEVOL_UNIFORM:
+ total_scale = pow3f(obsize[data->free_axis]);
+ break;
+ case SAMEVOL_SINGLE_AXIS:
+ total_scale = obsize[data->free_axis];
+ break;
+ }
+
if (total_scale != 0) {
fac = sqrtf(volume / total_scale);
}
/* apply scaling factor to the channels not being kept */
- switch (data->flag) {
+ switch (data->free_axis) {
case SAMEVOL_X:
mul_v3_fl(cob->matrix[1], fac);
mul_v3_fl(cob->matrix[2], fac);
@@ -2406,7 +2422,8 @@ static void armdef_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
copy_v3_v3(input_co, cob->matrix[3]);
}
- /* Process all targets. */
+ /* Process all targets. This can't use ct->matrix, as armdef_get_tarmat is not
+ * called in solve for efficiency because the constraint needs bone data anyway. */
for (bConstraintTarget *ct = targets->first; ct; ct = ct->next) {
if (ct->weight <= 0.0f) {
continue;
@@ -4224,6 +4241,7 @@ static void splineik_new_data(void *cdata)
data->bulge_min = 1.0f;
data->yScaleMode = CONSTRAINT_SPLINEIK_YS_FIT_CURVE;
+ data->flag = CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE;
}
static void splineik_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
@@ -5600,6 +5618,11 @@ void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph,
*/
cti->get_constraint_targets(con, targets);
+ /* The Armature constraint doesn't need ct->matrix for evaluate at all. */
+ if (ELEM(cti->type, CONSTRAINT_TYPE_ARMATURE)) {
+ return;
+ }
+
/* set matrices
* - calculate if possible, otherwise just initialize as identity matrix
*/
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index dc677449a4c..2775cf9691f 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1737,232 +1737,6 @@ static void forward_diff_bezier_cotangent(const float p0[3],
}
}
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-
-float *BKE_curve_surf_make_orco(Object *ob)
-{
- /* Note: this function is used in convertblender only atm, so
- * suppose nonzero curve's render resolution should always be used */
- Curve *cu = ob->data;
- Nurb *nu;
- int a, b, tot = 0;
- int sizeu, sizev;
- int resolu, resolv;
- float *fp, *coord_array;
-
- /* first calculate the size of the datablock */
- nu = cu->nurb.first;
- while (nu) {
- /* as we want to avoid the seam in a cyclic nurbs
- * texture wrapping, reserve extra orco data space to save these extra needed
- * vertex based UV coordinates for the meridian vertices.
- * Vertices on the 0/2pi boundary are not duplicated inside the displist but later in
- * the renderface/vert construction.
- *
- * See also convertblender.c: init_render_surf()
- */
-
- resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
- resolv = cu->resolv_ren ? cu->resolv_ren : nu->resolv;
-
- sizeu = nu->pntsu * resolu;
- sizev = nu->pntsv * resolv;
- if (nu->flagu & CU_NURB_CYCLIC) {
- sizeu++;
- }
- if (nu->flagv & CU_NURB_CYCLIC) {
- sizev++;
- }
- if (nu->pntsv > 1) {
- tot += sizeu * sizev;
- }
-
- nu = nu->next;
- }
- /* makeNurbfaces wants zeros */
- fp = coord_array = MEM_calloc_arrayN(tot, 3 * sizeof(float), "make_orco");
-
- nu = cu->nurb.first;
- while (nu) {
- resolu = cu->resolu_ren ? cu->resolu_ren : nu->resolu;
- resolv = cu->resolv_ren ? cu->resolv_ren : nu->resolv;
-
- if (nu->pntsv > 1) {
- sizeu = nu->pntsu * resolu;
- sizev = nu->pntsv * resolv;
-
- if (nu->flagu & CU_NURB_CYCLIC) {
- sizeu++;
- }
- if (nu->flagv & CU_NURB_CYCLIC) {
- sizev++;
- }
-
- if (cu->flag & CU_UV_ORCO) {
- for (b = 0; b < sizeu; b++) {
- for (a = 0; a < sizev; a++) {
-
- if (sizev < 2) {
- fp[0] = 0.0f;
- }
- else {
- fp[0] = -1.0f + 2.0f * ((float)a) / (sizev - 1);
- }
-
- if (sizeu < 2) {
- fp[1] = 0.0f;
- }
- else {
- fp[1] = -1.0f + 2.0f * ((float)b) / (sizeu - 1);
- }
-
- fp[2] = 0.0;
-
- fp += 3;
- }
- }
- }
- else {
- int size = (nu->pntsu * resolu) * (nu->pntsv * resolv) * 3 * sizeof(float);
- float *_tdata = MEM_mallocN(size, "temp data");
- float *tdata = _tdata;
-
- BKE_nurb_makeFaces(nu, tdata, 0, resolu, resolv);
-
- for (b = 0; b < sizeu; b++) {
- int use_b = b;
- if (b == sizeu - 1 && (nu->flagu & CU_NURB_CYCLIC)) {
- use_b = false;
- }
-
- for (a = 0; a < sizev; a++) {
- int use_a = a;
- if (a == sizev - 1 && (nu->flagv & CU_NURB_CYCLIC)) {
- use_a = false;
- }
-
- tdata = _tdata + 3 * (use_b * (nu->pntsv * resolv) + use_a);
-
- fp[0] = (tdata[0] - cu->loc[0]) / cu->size[0];
- fp[1] = (tdata[1] - cu->loc[1]) / cu->size[1];
- fp[2] = (tdata[2] - cu->loc[2]) / cu->size[2];
- fp += 3;
- }
- }
-
- MEM_freeN(_tdata);
- }
- }
- nu = nu->next;
- }
-
- return coord_array;
-}
-
-/* NOTE: This routine is tied to the order of vertex
- * built by displist and as passed to the renderer.
- */
-float *BKE_curve_make_orco(Depsgraph *depsgraph, Scene *scene, Object *ob, int *r_numVerts)
-{
- Curve *cu = ob->data;
- DispList *dl;
- int u, v, numVerts;
- float *fp, *coord_array;
- ListBase disp = {NULL, NULL};
-
- BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp, NULL);
-
- numVerts = 0;
- for (dl = disp.first; dl; dl = dl->next) {
- if (dl->type == DL_INDEX3) {
- numVerts += dl->nr;
- }
- else if (dl->type == DL_SURF) {
- /* convertblender.c uses the Surface code for creating renderfaces when cyclic U only
- * (closed circle beveling)
- */
- if (dl->flag & DL_CYCL_U) {
- if (dl->flag & DL_CYCL_V) {
- numVerts += (dl->parts + 1) * (dl->nr + 1);
- }
- else {
- numVerts += dl->parts * (dl->nr + 1);
- }
- }
- else if (dl->flag & DL_CYCL_V) {
- numVerts += (dl->parts + 1) * dl->nr;
- }
- else {
- numVerts += dl->parts * dl->nr;
- }
- }
- }
-
- if (r_numVerts) {
- *r_numVerts = numVerts;
- }
-
- fp = coord_array = MEM_malloc_arrayN(numVerts, 3 * sizeof(float), "cu_orco");
- for (dl = disp.first; dl; dl = dl->next) {
- if (dl->type == DL_INDEX3) {
- for (u = 0; u < dl->nr; u++, fp += 3) {
- if (cu->flag & CU_UV_ORCO) {
- fp[0] = 2.0f * u / (dl->nr - 1) - 1.0f;
- fp[1] = 0.0;
- fp[2] = 0.0;
- }
- else {
- copy_v3_v3(fp, &dl->verts[u * 3]);
-
- fp[0] = (fp[0] - cu->loc[0]) / cu->size[0];
- fp[1] = (fp[1] - cu->loc[1]) / cu->size[1];
- fp[2] = (fp[2] - cu->loc[2]) / cu->size[2];
- }
- }
- }
- else if (dl->type == DL_SURF) {
- int sizeu = dl->nr, sizev = dl->parts;
-
- /* exception as handled in convertblender.c too */
- if (dl->flag & DL_CYCL_U) {
- sizeu++;
- if (dl->flag & DL_CYCL_V) {
- sizev++;
- }
- }
- else if (dl->flag & DL_CYCL_V) {
- sizev++;
- }
-
- for (u = 0; u < sizev; u++) {
- for (v = 0; v < sizeu; v++, fp += 3) {
- if (cu->flag & CU_UV_ORCO) {
- fp[0] = 2.0f * u / (sizev - 1) - 1.0f;
- fp[1] = 2.0f * v / (sizeu - 1) - 1.0f;
- fp[2] = 0.0;
- }
- else {
- const float *vert;
- int realv = v % dl->nr;
- int realu = u % dl->parts;
-
- vert = dl->verts + 3 * (dl->nr * realu + realv);
- copy_v3_v3(fp, vert);
-
- fp[0] = (fp[0] - cu->loc[0]) / cu->size[0];
- fp[1] = (fp[1] - cu->loc[1]) / cu->size[1];
- fp[2] = (fp[2] - cu->loc[2]) / cu->size[2];
- }
- }
- }
- }
- }
-
- BKE_displist_free(&disp);
-
- return coord_array;
-}
-
/* ***************** BEVEL ****************** */
void BKE_curve_bevel_make(Depsgraph *depsgraph,
@@ -1970,7 +1744,6 @@ void BKE_curve_bevel_make(Depsgraph *depsgraph,
Object *ob,
ListBase *disp,
const bool for_render,
- const bool use_render_resolution,
LinkNode *ob_cyclic_list)
{
DispList *dl, *dlnew;
@@ -2003,7 +1776,6 @@ void BKE_curve_bevel_make(Depsgraph *depsgraph,
&bevdisp,
NULL,
false,
- use_render_resolution,
&(LinkNode){
.link = ob,
.next = ob_cyclic_list,
@@ -4980,7 +4752,7 @@ void BKE_curve_nurbs_keyVertexTilts_apply(ListBase *lb, float *key)
}
}
-bool BKE_nurb_check_valid_u(struct Nurb *nu)
+bool BKE_nurb_check_valid_u(const Nurb *nu)
{
if (nu->pntsu <= 1) {
return false;
@@ -5007,7 +4779,7 @@ bool BKE_nurb_check_valid_u(struct Nurb *nu)
}
return true;
}
-bool BKE_nurb_check_valid_v(struct Nurb *nu)
+bool BKE_nurb_check_valid_v(const Nurb *nu)
{
if (nu->pntsv <= 1) {
return false;
@@ -5035,7 +4807,7 @@ bool BKE_nurb_check_valid_v(struct Nurb *nu)
return true;
}
-bool BKE_nurb_check_valid_uv(struct Nurb *nu)
+bool BKE_nurb_check_valid_uv(const Nurb *nu)
{
if (!BKE_nurb_check_valid_u(nu)) {
return false;
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index c228595b6e8..cc1c73b1e68 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -315,8 +315,7 @@ bool BKE_displist_surfindex_get(DispList *dl, int a, int *b, int *p1, int *p2, i
static void curve_to_displist(Curve *cu,
ListBase *nubase,
ListBase *dispbase,
- const bool for_render,
- const bool use_render_resolution)
+ const bool for_render)
{
Nurb *nu;
DispList *dl;
@@ -329,7 +328,7 @@ static void curve_to_displist(Curve *cu,
nu = nubase->first;
while (nu) {
if (nu->hide == 0 || editmode == false) {
- if (use_render_resolution && cu->resolu_ren != 0) {
+ if (for_render && cu->resolu_ren != 0) {
resolu = cu->resolu_ren;
}
else {
@@ -801,7 +800,7 @@ void BKE_displist_make_mball_forRender(Depsgraph *depsgraph,
static ModifierData *curve_get_tessellate_point(Scene *scene,
Object *ob,
- const bool use_render_resolution,
+ const bool for_render,
const bool editmode)
{
VirtualModifierData virtualModifierData;
@@ -809,7 +808,7 @@ static ModifierData *curve_get_tessellate_point(Scene *scene,
ModifierData *pretessellatePoint;
int required_mode;
- if (use_render_resolution) {
+ if (for_render) {
required_mode = eModifierMode_Render;
}
else {
@@ -848,12 +847,8 @@ static ModifierData *curve_get_tessellate_point(Scene *scene,
return pretessellatePoint;
}
-static void curve_calc_modifiers_pre(Depsgraph *depsgraph,
- Scene *scene,
- Object *ob,
- ListBase *nurb,
- const bool for_render,
- const bool use_render_resolution)
+static void curve_calc_modifiers_pre(
+ Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *nurb, const bool for_render)
{
VirtualModifierData virtualModifierData;
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
@@ -871,7 +866,7 @@ static void curve_calc_modifiers_pre(Depsgraph *depsgraph,
if (editmode) {
app_flag |= MOD_APPLY_USECACHE;
}
- if (use_render_resolution) {
+ if (for_render) {
app_flag |= MOD_APPLY_RENDER;
required_mode = eModifierMode_Render;
}
@@ -881,7 +876,7 @@ static void curve_calc_modifiers_pre(Depsgraph *depsgraph,
const ModifierEvalContext mectx = {depsgraph, ob, app_flag};
- pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
+ pretessellatePoint = curve_get_tessellate_point(scene, ob, for_render, editmode);
if (editmode) {
required_mode |= eModifierMode_Editmode;
@@ -979,8 +974,7 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
ListBase *nurb,
ListBase *dispbase,
Mesh **r_final,
- const bool for_render,
- const bool use_render_resolution)
+ const bool for_render)
{
VirtualModifierData virtualModifierData;
ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
@@ -993,7 +987,7 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
int useCache = !for_render;
ModifierApplyFlag app_flag = 0;
- if (use_render_resolution) {
+ if (for_render) {
app_flag |= MOD_APPLY_RENDER;
required_mode = eModifierMode_Render;
}
@@ -1006,7 +1000,7 @@ static void curve_calc_modifiers_post(Depsgraph *depsgraph,
const ModifierEvalContext mectx_apply = {
depsgraph, ob, useCache ? app_flag | MOD_APPLY_USECACHE : app_flag};
- pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
+ pretessellatePoint = curve_get_tessellate_point(scene, ob, for_render, editmode);
if (editmode) {
required_mode |= eModifierMode_Editmode;
@@ -1199,144 +1193,13 @@ static void displist_surf_indices(DispList *dl)
}
}
-/* XXX2.8(Sybren): unused function; impossible to test after porting to Mesh */
-#ifdef WITH_DERIVEDMESH_DEPRECATED_FUNCS
-static DerivedMesh *create_orco_dm(Depsgraph *depsgraph, Scene *scene, Object *ob)
-{
- DerivedMesh *dm;
- ListBase disp = {NULL, NULL};
-
- /* OrcoDM should be created from underformed disp lists */
- BKE_displist_make_curveTypes_forOrco(depsgraph, scene, ob, &disp);
- dm = CDDM_from_curve_displist(ob, &disp);
-
- BKE_displist_free(&disp);
-
- return dm;
-}
-
-static void add_orco_dm(Object *ob, DerivedMesh *dm, DerivedMesh *orcodm)
-{
- float(*orco)[3], (*layerorco)[3];
- int totvert, a;
- Curve *cu = ob->data;
-
- totvert = dm->getNumVerts(dm);
-
- orco = MEM_callocN(sizeof(float) * 3 * totvert, "dm orco");
-
- if (orcodm->getNumVerts(orcodm) == totvert) {
- orcodm->getVertCos(orcodm, orco);
- }
- else {
- dm->getVertCos(dm, orco);
- }
-
- for (a = 0; a < totvert; a++) {
- float *co = orco[a];
- co[0] = (co[0] - cu->loc[0]) / cu->size[0];
- co[1] = (co[1] - cu->loc[1]) / cu->size[1];
- co[2] = (co[2] - cu->loc[2]) / cu->size[2];
- }
-
- if ((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
- memcpy(layerorco, orco, sizeof(float) * totvert);
- MEM_freeN(orco);
- }
- else {
- DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, orco);
- }
-}
-#endif
-
-/* XXX2.8(Sybren): unused function; impossible to test after porting to Mesh */
-#ifdef WITH_DERIVEDMESH_DEPRECATED_FUNCS
-static void curve_calc_orcodm(Depsgraph *depsgraph,
- Scene *scene,
- Object *ob,
- DerivedMesh *dm_final,
- const bool for_render,
- const bool use_render_resolution)
-{
- /* this function represents logic of mesh's orcodm calculation
- * for displist-based objects
- */
- VirtualModifierData virtualModifierData;
- ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData);
- ModifierData *pretessellatePoint;
- Curve *cu = ob->data;
- int required_mode;
- const bool editmode = (!for_render && (cu->editnurb || cu->editfont));
- DerivedMesh *ndm, *orcodm = NULL;
- ModifierApplyFlag app_flag = MOD_APPLY_ORCO;
-
- if (use_render_resolution) {
- app_flag |= MOD_APPLY_RENDER;
- required_mode = eModifierMode_Render;
- }
- else {
- required_mode = eModifierMode_Realtime;
- }
-
- const ModifierEvalContext mectx = {depsgraph, ob, app_flag};
-
- pretessellatePoint = curve_get_tessellate_point(scene, ob, use_render_resolution, editmode);
-
- if (editmode) {
- required_mode |= eModifierMode_Editmode;
- }
-
- if (pretessellatePoint) {
- md = pretessellatePoint->next;
- }
-
- /* If modifiers are disabled, we wouldn't be here because
- * this function is only called if there're enabled constructive
- * modifiers applied on the curve.
- *
- * This means we can create ORCO DM in advance and assume it's
- * never NULL.
- */
- orcodm = create_orco_dm(depsgraph, scene, ob);
-
- for (; md; md = md->next) {
- const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-
- md->scene = scene;
-
- if (!modifier_isEnabled(scene, md, required_mode)) {
- continue;
- }
- if (mti->type != eModifierTypeType_Constructive) {
- continue;
- }
-
- ndm = modwrap_applyModifier(md, &mectx, orcodm);
-
- if (ndm) {
- /* if the modifier returned a new dm, release the old one */
- if (orcodm && orcodm != ndm) {
- orcodm->release(orcodm);
- }
- orcodm = ndm;
- }
- }
-
- /* add an orco layer if needed */
- add_orco_dm(ob, dm_final, orcodm);
-
- orcodm->release(orcodm);
-}
-#endif
-
void BKE_displist_make_surf(Depsgraph *depsgraph,
Scene *scene,
Object *ob,
ListBase *dispbase,
Mesh **r_final,
const bool for_render,
- const bool for_orco,
- const bool use_render_resolution)
+ const bool for_orco)
{
ListBase nubase = {NULL, NULL};
Nurb *nu;
@@ -1353,14 +1216,14 @@ void BKE_displist_make_surf(Depsgraph *depsgraph,
}
if (!for_orco) {
- curve_calc_modifiers_pre(depsgraph, scene, ob, &nubase, for_render, use_render_resolution);
+ curve_calc_modifiers_pre(depsgraph, scene, ob, &nubase, for_render);
}
for (nu = nubase.first; nu; nu = nu->next) {
if ((for_render || nu->hide == 0) && BKE_nurb_check_valid_uv(nu)) {
int resolu = nu->resolu, resolv = nu->resolv;
- if (use_render_resolution) {
+ if (for_render) {
if (cu->resolu_ren) {
resolu = cu->resolu_ren;
}
@@ -1431,8 +1294,7 @@ void BKE_displist_make_surf(Depsgraph *depsgraph,
if (!for_orco) {
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
- curve_calc_modifiers_post(
- depsgraph, scene, ob, &nubase, dispbase, r_final, for_render, use_render_resolution);
+ curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_final, for_render);
}
BKE_nurbList_free(&nubase);
@@ -1665,7 +1527,6 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
ListBase *dispbase,
const bool for_render,
const bool for_orco,
- const bool use_render_resolution,
LinkNode *ob_cyclic_list,
Mesh **r_final)
{
@@ -1677,8 +1538,7 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
}
if (ob->type == OB_SURF) {
- BKE_displist_make_surf(
- depsgraph, scene, ob, dispbase, r_final, for_render, for_orco, use_render_resolution);
+ BKE_displist_make_surf(depsgraph, scene, ob, dispbase, r_final, for_render, for_orco);
}
else if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
ListBase dlbev;
@@ -1705,18 +1565,17 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
}
if (!for_orco) {
- curve_calc_modifiers_pre(depsgraph, scene, ob, &nubase, for_render, use_render_resolution);
+ curve_calc_modifiers_pre(depsgraph, scene, ob, &nubase, for_render);
}
- BKE_curve_bevelList_make(ob, &nubase, use_render_resolution);
+ BKE_curve_bevelList_make(ob, &nubase, for_render);
/* If curve has no bevel will return nothing */
- BKE_curve_bevel_make(
- depsgraph, scene, ob, &dlbev, for_render, use_render_resolution, ob_cyclic_list);
+ BKE_curve_bevel_make(depsgraph, scene, ob, &dlbev, for_render, ob_cyclic_list);
/* no bevel or extrude, and no width correction? */
if (!dlbev.first && cu->width == 1.0f) {
- curve_to_displist(cu, &nubase, dispbase, for_render, use_render_resolution);
+ curve_to_displist(cu, &nubase, dispbase, for_render);
}
else {
float widfac = cu->width - 1.0f;
@@ -1916,8 +1775,7 @@ static void do_makeDispListCurveTypes(Depsgraph *depsgraph,
if (!for_orco) {
BKE_nurbList_duplicate(&ob->runtime.curve_cache->deformed_nurbs, &nubase);
- curve_calc_modifiers_post(
- depsgraph, scene, ob, &nubase, dispbase, r_final, for_render, use_render_resolution);
+ curve_calc_modifiers_post(depsgraph, scene, ob, &nubase, dispbase, r_final, for_render);
}
if (cu->flag & CU_DEFORM_FILL && !ob->runtime.mesh_eval) {
@@ -1958,7 +1816,6 @@ void BKE_displist_make_curveTypes(Depsgraph *depsgraph,
dispbase,
for_render,
for_orco,
- false,
ob_cyclic_list,
&ob->runtime.mesh_eval);
@@ -1971,32 +1828,14 @@ void BKE_displist_make_curveTypes_forRender(Depsgraph *depsgraph,
ListBase *dispbase,
Mesh **r_final,
const bool for_orco,
- const bool use_render_resolution,
LinkNode *ob_cyclic_list)
{
if (ob->runtime.curve_cache == NULL) {
ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
}
- do_makeDispListCurveTypes(depsgraph,
- scene,
- ob,
- dispbase,
- true,
- for_orco,
- use_render_resolution,
- ob_cyclic_list,
- r_final);
-}
-
-void BKE_displist_make_curveTypes_forOrco(
- Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *dispbase, LinkNode *ob_cyclic_list)
-{
- if (ob->runtime.curve_cache == NULL) {
- ob->runtime.curve_cache = MEM_callocN(sizeof(CurveCache), "CurveCache for Curve");
- }
-
- do_makeDispListCurveTypes(depsgraph, scene, ob, dispbase, 1, 1, 1, ob_cyclic_list, NULL);
+ do_makeDispListCurveTypes(
+ depsgraph, scene, ob, dispbase, true, for_orco, ob_cyclic_list, r_final);
}
void BKE_displist_minmax(ListBase *dispbase, float min[3], float max[3])
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 93b6fd34a8f..b5242d00ee0 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2066,7 +2066,7 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *
}
if (update_normals) {
- // result->dirty |= DM_DIRTY_NORMALS;
+ result->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
}
}
/* make a copy of mesh to use as brush data */
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 8c95e4c7ff3..e2d0a479792 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1707,6 +1707,11 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar)
/* not valid channel */
return 0.0f;
}
+ else if (dtar->transChan == DTAR_TRANSCHAN_SCALE_AVG) {
+ /* Cubic root of the change in volume, equal to the geometric mean
+ * of scale over all three axes unless the matrix includes shear. */
+ return cbrtf(mat4_to_volume_scale(mat));
+ }
else if (dtar->transChan >= DTAR_TRANSCHAN_SCALEX) {
/* Extract scale, and choose the right axis,
* inline 'mat4_to_size'. */
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index f23c58befdf..18c42da0bd4 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -5087,6 +5087,7 @@ bool BKE_image_is_animated(Image *image)
return ELEM(image->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE);
}
+/* Image modifications */
bool BKE_image_is_dirty(Image *image)
{
bool is_dirty = false;
@@ -5110,6 +5111,11 @@ bool BKE_image_is_dirty(Image *image)
return is_dirty;
}
+void BKE_image_mark_dirty(Image *UNUSED(image), ImBuf *ibuf)
+{
+ ibuf->userflags |= IB_BITMAPDIRTY;
+}
+
void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *options)
{
BLI_spin_lock(&image_spin);
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index fc349e62809..99e6c99ec0c 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -693,8 +693,8 @@ static short layer_collection_sync(ViewLayer *view_layer,
lc->runtime_flag = child_runtime_flag;
}
- if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
- ((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0)) {
+ if (((child_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0) &&
+ ((child_layer_restrict & LAYER_COLLECTION_HIDE) == 0)) {
lc->runtime_flag |= LAYER_COLLECTION_VISIBLE;
}
@@ -723,9 +723,9 @@ static short layer_collection_sync(ViewLayer *view_layer,
BLI_addtail(new_object_bases, base);
}
- if ((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) {
+ if ((child_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0) {
base->flag_from_collection |= BASE_ENABLED_VIEWPORT;
- if ((child_layer_restrict & LAYER_COLLECTION_RESTRICT_VIEW) == 0) {
+ if ((child_layer_restrict & LAYER_COLLECTION_HIDE) == 0) {
base->flag_from_collection |= BASE_VISIBLE;
if (((child_restrict & COLLECTION_RESTRICT_SELECT) == 0)) {
base->flag_from_collection |= BASE_SELECTABLE;
@@ -1014,8 +1014,8 @@ bool BKE_layer_collection_isolate(Scene *scene,
bool hide_it = extend && (lc->runtime_flag & LAYER_COLLECTION_VISIBLE);
if ((!ID_IS_LINKED(lc->collection) && !hide_it)) {
- if (lc->collection->flag & COLLECTION_RESTRICT_VIEW) {
- lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ if (lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) {
+ lc->collection->flag &= ~COLLECTION_RESTRICT_VIEWPORT;
depsgraph_need_update = true;
}
}
@@ -1024,13 +1024,13 @@ bool BKE_layer_collection_isolate(Scene *scene,
/* Hide all collections . */
for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter;
lc_iter = lc_iter->next) {
- layer_collection_flag_set_recursive(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW);
+ layer_collection_flag_set_recursive(lc_iter, LAYER_COLLECTION_HIDE);
}
}
/* Make all the direct parents visible. */
if (hide_it) {
- lc->flag |= LAYER_COLLECTION_RESTRICT_VIEW;
+ lc->flag |= LAYER_COLLECTION_HIDE;
}
else {
LayerCollection *lc_parent = lc;
@@ -1044,13 +1044,13 @@ bool BKE_layer_collection_isolate(Scene *scene,
while (lc_parent != lc) {
if (!ID_IS_LINKED(lc_parent->collection)) {
- if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEW) {
- lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEWPORT) {
+ lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEWPORT;
depsgraph_need_update = true;
}
}
- lc_parent->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+ lc_parent->flag &= ~LAYER_COLLECTION_HIDE;
for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter;
lc_iter = lc_iter->next) {
@@ -1062,7 +1062,7 @@ bool BKE_layer_collection_isolate(Scene *scene,
}
/* Make all the children visible, but respect their disable state. */
- layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
+ layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_HIDE);
BKE_layer_collection_activate(view_layer, lc);
}
@@ -1109,27 +1109,27 @@ bool BKE_layer_collection_set_visible(ViewLayer *view_layer,
bool depsgraph_changed = false;
if (visible && (!ID_IS_LINKED(lc->collection)) &&
- ((lc->collection->flag & COLLECTION_RESTRICT_VIEW) != 0)) {
- lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ ((lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) != 0)) {
+ lc->collection->flag &= ~COLLECTION_RESTRICT_VIEWPORT;
depsgraph_changed = true;
}
if (hierarchy) {
if (visible) {
- layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
+ layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_HIDE);
layer_collection_bases_show_recursive(view_layer, lc);
}
else {
- layer_collection_flag_set_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
+ layer_collection_flag_set_recursive(lc, LAYER_COLLECTION_HIDE);
layer_collection_bases_hide_recursive(view_layer, lc);
}
}
else {
if (visible) {
- lc->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
+ lc->flag &= ~LAYER_COLLECTION_HIDE;
}
else {
- lc->flag |= LAYER_COLLECTION_RESTRICT_VIEW;
+ lc->flag |= LAYER_COLLECTION_HIDE;
}
}
return depsgraph_changed;
@@ -1491,7 +1491,7 @@ void BKE_base_eval_flags(Base *base)
/* Apply object restrictions. */
const int object_restrict = base->object->restrictflag;
- if (object_restrict & OB_RESTRICT_VIEW) {
+ if (object_restrict & OB_RESTRICT_VIEWPORT) {
base->flag &= ~BASE_ENABLED_VIEWPORT;
}
if (object_restrict & OB_RESTRICT_RENDER) {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index ad0c405ab28..3e6f93d1323 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1860,7 +1860,7 @@ static void library_make_local_copying_check(ID *id,
* (except group and objects ones).
*/
/* Note: Old (2.77) version was simply making (tagging) data-blocks as local,
- * without actually making any check whether * they were also indirectly used or not...
+ * without actually making any check whether they were also indirectly used or not...
*
* Current version uses regular id_make_local callback, with advanced pre-processing step to detect
* all cases of IDs currently indirectly used, but which will be used by local data only once this
diff --git a/source/blender/blenkernel/intern/light.c b/source/blender/blenkernel/intern/light.c
index 05b2eb82daf..1c3acb6a73a 100644
--- a/source/blender/blenkernel/intern/light.c
+++ b/source/blender/blenkernel/intern/light.c
@@ -80,6 +80,7 @@ void BKE_light_init(Light *la)
la->contact_thickness = 0.2f;
la->spec_fac = 1.0f;
la->att_dist = 40.0f;
+ la->sun_angle = DEG2RADF(0.526f);
curvemapping_initialize(la->curfalloff);
}
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 3f4e504867c..fe8d053c1df 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -1007,7 +1007,7 @@ Mesh *BKE_mesh_new_from_object(Depsgraph *depsgraph,
/* get updated display list, and convert to a mesh */
BKE_displist_make_curveTypes_forRender(
- depsgraph, sce, tmpobj, &dispbase, &me_eval_final, false, render, NULL);
+ depsgraph, sce, tmpobj, &dispbase, &me_eval_final, false, NULL);
copycu->editfont = NULL;
copycu->editnurb = NULL;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 38a8ad2769a..6c2bd5e6127 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -4487,3 +4487,14 @@ void BKE_object_type_set_empty_for_versioning(Object *ob)
}
ob->mode = OB_MODE_OBJECT;
}
+
+/* Updates select_id of all objects in the given bmain. */
+void BKE_object_update_select_id(struct Main *bmain)
+{
+ Object *ob = bmain->objects.first;
+ int select_id = 1;
+ while (ob) {
+ ob->runtime.select_id = select_id++;
+ ob = ob->id.next;
+ }
+} \ No newline at end of file
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 8080834a53a..0dedbb7e934 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1082,7 +1082,7 @@ static const DupliGenerator *get_dupli_generator(const DupliContext *ctx)
/* Should the dupli's be generated for this object? - Respect restrict flags */
if (DEG_get_mode(ctx->depsgraph) == DAG_EVAL_RENDER ? (restrictflag & OB_RESTRICT_RENDER) :
- (restrictflag & OB_RESTRICT_VIEW)) {
+ (restrictflag & OB_RESTRICT_VIEWPORT)) {
return NULL;
}
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 183bc968897..77941e7d607 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -202,9 +202,11 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
case OB_CURVE:
case OB_SURF:
- case OB_FONT:
- BKE_displist_make_curveTypes(depsgraph, scene, ob, false, false, NULL);
+ case OB_FONT: {
+ bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
+ BKE_displist_make_curveTypes(depsgraph, scene, ob, for_render, false, NULL);
break;
+ }
case OB_LATTICE:
BKE_lattice_modifiers_calc(depsgraph, scene, ob);
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index b594232193d..bd06e2fe7e0 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -1276,9 +1276,6 @@ void BKE_sculpt_update_mesh_elements(
}
}
}
-
- /* 2.8x - avoid full mesh update! */
- BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_SCULPT_COORDS);
}
int BKE_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 8a70db8704f..3d6b7390057 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -37,7 +37,6 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_sequence_types.h"
-#include "DNA_sound_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
@@ -309,7 +308,8 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
flag_subdata);
}
- BKE_sound_reset_scene_runtime(sce_dst);
+ /* before scene copy */
+ BKE_sound_create_scene(sce_dst);
/* Copy sequencer, this is local data! */
if (sce_src->ed) {
@@ -399,7 +399,8 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
sce_copy->r.ffcodecdata.properties = IDP_CopyProperty(sce->r.ffcodecdata.properties);
}
- BKE_sound_reset_scene_runtime(sce_copy);
+ /* before scene copy */
+ BKE_sound_create_scene(sce_copy);
/* grease pencil */
sce_copy->gpd = NULL;
@@ -779,7 +780,7 @@ void BKE_scene_init(Scene *sce)
srv = sce->r.views.last;
BLI_strncpy(srv->suffix, STEREO_RIGHT_SUFFIX, sizeof(srv->suffix));
- BKE_sound_reset_scene_runtime(sce);
+ BKE_sound_create_scene(sce);
/* color management */
colorspace_name = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_SEQUENCER);
@@ -1530,13 +1531,6 @@ static void prepare_mesh_for_viewport_render(Main *bmain, const ViewLayer *view_
}
}
-static void scene_update_sound(Depsgraph *depsgraph, Main *bmain)
-{
- Scene *scene = DEG_get_evaluated_scene(depsgraph);
- BKE_sound_ensure_scene(scene);
- BKE_sound_update_scene(bmain, scene);
-}
-
/* TODO(sergey): This actually should become view_layer_graph or so.
* Same applies to update_for_newframe.
*/
@@ -1565,9 +1559,10 @@ void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain)
* by depgraph or manual, no layer check here, gets correct flushed.
*/
DEG_evaluate_on_refresh(depsgraph);
- /* Update sound system. */
- scene_update_sound(depsgraph, bmain);
- /* Notify python about depsgraph update. */
+ /* Update sound system animation (TODO, move to depsgraph). */
+ BKE_sound_update_scene(bmain, scene);
+
+ /* Notify python about depsgraph update */
if (run_callbacks) {
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_POST);
}
@@ -1602,8 +1597,8 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain)
* by depgraph or manual, no layer check here, gets correct flushed.
*/
DEG_evaluate_on_framechange(bmain, depsgraph, ctime);
- /* Update sound system animation. */
- scene_update_sound(depsgraph, bmain);
+ /* Update sound system animation (TODO, move to depsgraph). */
+ BKE_sound_update_scene(bmain, scene);
/* Notify editors and python about recalc. */
BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_FRAME_CHANGE_POST);
/* Inform editors about possible changes. */
@@ -2415,23 +2410,3 @@ void BKE_scene_cursor_quat_to_rot(View3DCursor *cursor, const float quat[4], boo
}
/** \} */
-
-/* Dependency graph evaluation. */
-
-void BKE_scene_eval_sequencer_sequences(Depsgraph *depsgraph, Scene *scene)
-{
- DEG_debug_print_eval(depsgraph, __func__, scene->id.name, scene);
- if (scene->ed == NULL) {
- return;
- }
- BKE_sound_ensure_scene(scene);
- Sequence *seq;
- SEQ_BEGIN (scene->ed, seq) {
- if (seq->sound != NULL && seq->scene_sound == NULL) {
- seq->scene_sound = BKE_sound_add_scene_sound_defaults(scene, seq);
- }
- }
- SEQ_END;
- BKE_sequencer_update_muting(scene->ed);
- BKE_sequencer_update_sound_bounds_all(scene);
-}
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 9799f7c2943..5c41048be83 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -193,18 +193,6 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb)
Panel *pa = lb->first;
for (; newpa; newpa = newpa->next, pa = pa->next) {
newpa->activedata = NULL;
-
- Panel *newpatab = newlb->first;
- Panel *patab = lb->first;
- while (newpatab) {
- if (newpa->paneltab == patab) {
- newpa->paneltab = newpatab;
- break;
- }
- newpatab = newpatab->next;
- patab = patab->next;
- }
-
panel_list_copy(&newpa->children, &pa->children);
}
}
@@ -859,6 +847,7 @@ void BKE_screen_view3d_shading_init(View3DShading *shading)
shading->xray_alpha_wire = 0.5f;
shading->cavity_valley_factor = 1.0f;
shading->cavity_ridge_factor = 1.0f;
+ shading->cavity_type = V3D_SHADING_CAVITY_CURVATURE;
shading->curvature_ridge_factor = 1.0f;
shading->curvature_valley_factor = 1.0f;
copy_v3_fl(shading->single_color, 0.8f);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 74541c13c4f..7f738ff4e4f 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -808,7 +808,10 @@ void BKE_sequence_calc_disp(Scene *scene, Sequence *seq)
seq->handsize = (float)((seq->enddisp - seq->startdisp) / 25);
}
- if (seq->type == SEQ_TYPE_META) {
+ if (ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SCENE)) {
+ BKE_sequencer_update_sound_bounds(scene, seq);
+ }
+ else if (seq->type == SEQ_TYPE_META) {
seq_update_sound_bounds_recursive(scene, seq);
}
}
@@ -3572,9 +3575,9 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context,
re = RE_NewSceneRender(scene);
}
- RE_BlenderFrame(re, context->bmain, scene, view_layer, camera, frame, false);
+ RE_RenderFrame(re, context->bmain, scene, view_layer, camera, frame, false);
- /* restore previous state after it was toggled on & off by RE_BlenderFrame */
+ /* restore previous state after it was toggled on & off by RE_RenderFrame */
G.is_rendering = is_rendering;
}
@@ -5488,18 +5491,17 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
Strip *strip;
StripElem *se;
+ AUD_SoundInfo info;
+
sound = BKE_sound_new_file(bmain, seq_load->path); /* handles relative paths */
- /* Load the original sound, so we can access number of channels and length information.
- * We free the sound handle on the original bSound datablock before existing this function, it is
- * to be allocated on an evaluated version after this. */
- BKE_sound_load_audio(bmain, sound);
- AUD_SoundInfo info = AUD_getInfo(sound->playback_handle);
if (sound->playback_handle == NULL) {
BKE_id_free(bmain, sound);
return NULL;
}
+ info = AUD_getInfo(sound->playback_handle);
+
if (info.specs.channels == AUD_CHANNELS_INVALID) {
BKE_id_free(bmain, sound);
return NULL;
@@ -5524,7 +5526,8 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
- seq->scene_sound = NULL;
+ seq->scene_sound = BKE_sound_add_scene_sound(
+ scene, seq, seq_load->start_frame, seq_load->start_frame + seq->len, 0);
BKE_sequence_calc_disp(scene, seq);
@@ -5533,11 +5536,6 @@ Sequence *BKE_sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoad
seq_load_apply(bmain, scene, seq, seq_load);
- BKE_sound_free_audio(sound);
-
- /* TODO(sergey): Shall we tag here or in the oeprator? */
- DEG_relations_tag_update(bmain);
-
return seq;
}
#else // WITH_AUDASPACE
@@ -5749,7 +5747,10 @@ static Sequence *seq_dupli(const Scene *scene_src,
}
else if (seq->type == SEQ_TYPE_SOUND_RAM) {
seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata);
- seqn->scene_sound = NULL;
+ if (seq->scene_sound) {
+ seqn->scene_sound = BKE_sound_add_scene_sound_defaults(scene_dst, seqn);
+ }
+
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
id_us_plus((ID *)seqn->sound);
}
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 9ccb90b5cdc..c97baf8f7dd 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -38,7 +38,6 @@
#include "DNA_screen_types.h"
#include "DNA_sound_types.h"
#include "DNA_speaker_types.h"
-#include "DNA_windowmanager_types.h"
#ifdef WITH_AUDASPACE
# include <AUD_Sound.h>
@@ -56,37 +55,12 @@
#include "BKE_sequencer.h"
#include "BKE_scene.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_query.h"
-
#ifdef WITH_AUDASPACE
/* evil globals ;-) */
static int sound_cfra;
static char **audio_device_names = NULL;
#endif
-BLI_INLINE void sound_verify_evaluated_id(ID *id)
-{
- UNUSED_VARS_NDEBUG(id);
- /* This is a bit tricky and not quite reliable, but good enough check.
- *
- * We don't want audio system handles to be allocated on amn original datablocks, and only want
- * them to be allocated on a datablocks which are result of dependency graph evaluation.
- *
- * Datablocks which are covered by a copy-on-write system of dependency graph will have
- * LIB_TAG_COPIED_ON_WRITE tag set on them. But if some of datablocks during its evaluation
- * decides to re-allocate it's nested one (for example, object evaluation could re-allocate mesh
- * when evaluating modifier stack). Such datablocks will have LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT
- * tag set on them.
- *
- * Additionally, we also allow datablocks outside of main database. Those can not be "original"
- * and could be used as a temporary evaluated result during operations like baking.
- *
- * NOTE: We conder ID evaluated if ANY of those flags is set. We do NOT require ALL of them. */
- BLI_assert(id->tag &
- (LIB_TAG_COPIED_ON_WRITE | LIB_TAG_COPIED_ON_WRITE_EVAL_RESULT | LIB_TAG_NO_MAIN));
-}
-
bSound *BKE_sound_new_file(Main *bmain, const char *filepath)
{
bSound *sound;
@@ -103,10 +77,7 @@ bSound *BKE_sound_new_file(Main *bmain, const char *filepath)
BLI_strncpy(sound->name, filepath, FILE_MAX);
/* sound->type = SOUND_TYPE_FILE; */ /* XXX unused currently */
- sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock");
- BLI_spin_init(sound->spinlock);
-
- BKE_sound_reset_runtime(sound);
+ BKE_sound_load(bmain, sound);
return sound;
}
@@ -154,18 +125,6 @@ void BKE_sound_free(bSound *sound)
sound->packedfile = NULL;
}
- BKE_sound_free_audio(sound);
- BKE_sound_free_waveform(sound);
-
- if (sound->spinlock) {
- BLI_spin_end(sound->spinlock);
- MEM_freeN(sound->spinlock);
- sound->spinlock = NULL;
- }
-}
-
-void BKE_sound_free_audio(bSound *sound)
-{
#ifdef WITH_AUDASPACE
if (sound->handle) {
AUD_Sound_free(sound->handle);
@@ -177,9 +136,15 @@ void BKE_sound_free_audio(bSound *sound)
AUD_Sound_free(sound->cache);
sound->cache = NULL;
}
-#else
- UNUSED_VARS(sound);
+
+ BKE_sound_free_waveform(sound);
+
#endif /* WITH_AUDASPACE */
+ if (sound->spinlock) {
+ BLI_spin_end(sound->spinlock);
+ MEM_freeN(sound->spinlock);
+ sound->spinlock = NULL;
+ }
}
/**
@@ -192,7 +157,7 @@ void BKE_sound_free_audio(bSound *sound)
*
* \param flag: Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more).
*/
-void BKE_sound_copy_data(Main *UNUSED(bmain),
+void BKE_sound_copy_data(Main *bmain,
bSound *sound_dst,
const bSound *UNUSED(sound_src),
const int UNUSED(flag))
@@ -201,8 +166,8 @@ void BKE_sound_copy_data(Main *UNUSED(bmain),
sound_dst->cache = NULL;
sound_dst->waveform = NULL;
sound_dst->playback_handle = NULL;
- sound_dst->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock");
- BLI_spin_init(sound_dst->spinlock);
+ sound_dst->spinlock =
+ NULL; /* Think this is OK? Otherwise, easy to create new spinlock here... */
/* Just to be sure, should not have any value actually after reading time. */
sound_dst->ipo = NULL;
@@ -212,7 +177,8 @@ void BKE_sound_copy_data(Main *UNUSED(bmain),
sound_dst->packedfile = dupPackedFile(sound_dst->packedfile);
}
- BKE_sound_reset_runtime(sound_dst);
+ /* Initialize whole runtime (audaspace) stuff. */
+ BKE_sound_load(bmain, sound_dst);
}
void BKE_sound_make_local(Main *bmain, bSound *sound, const bool lib_local)
@@ -225,15 +191,31 @@ void BKE_sound_make_local(Main *bmain, bSound *sound, const bool lib_local)
static const char *force_device = NULL;
# ifdef WITH_JACK
-static SoundJackSyncCallback sound_jack_sync_callback = NULL;
-
static void sound_sync_callback(void *data, int mode, float time)
{
- if (sound_jack_sync_callback == NULL) {
+ // Ugly: Blender doesn't like it when the animation is played back during rendering
+ if (G.is_rendering) {
return;
}
+
Main *bmain = (Main *)data;
- sound_jack_sync_callback(bmain, mode, time);
+ Scene *scene;
+
+ scene = bmain->scenes.first;
+ while (scene) {
+ if (scene->audio.flag & AUDIO_SYNC) {
+ if (mode) {
+ BKE_sound_play_scene(scene);
+ }
+ else {
+ BKE_sound_stop_scene(scene);
+ }
+ if (scene->playback_handle) {
+ AUD_Handle_setPosition(scene->playback_handle, time);
+ }
+ }
+ scene = scene->id.next;
+ }
}
# endif
@@ -316,7 +298,7 @@ void BKE_sound_init_main(Main *bmain)
AUD_setSynchronizerCallback(sound_sync_callback, bmain);
}
# else
- UNUSED_VARS(bmain);
+ (void)bmain; /* unused */
# endif
}
@@ -385,8 +367,6 @@ bSound *BKE_sound_new_limiter(Main *bmain, bSound *source, float start, float en
void BKE_sound_cache(bSound *sound)
{
- sound_verify_evaluated_id(&sound->id);
-
sound->flags |= SOUND_FLAGS_CACHING;
if (sound->cache) {
AUD_Sound_free(sound->cache);
@@ -413,50 +393,44 @@ void BKE_sound_delete_cache(bSound *sound)
void BKE_sound_load(Main *bmain, bSound *sound)
{
- sound_verify_evaluated_id(&sound->id);
- BKE_sound_load_audio(bmain, sound);
-}
-
-void BKE_sound_load_audio(Main *bmain, bSound *sound)
-{
-
- if (sound->cache) {
- AUD_Sound_free(sound->cache);
- sound->cache = NULL;
- }
+ if (sound) {
+ if (sound->cache) {
+ AUD_Sound_free(sound->cache);
+ sound->cache = NULL;
+ }
- if (sound->handle) {
- AUD_Sound_free(sound->handle);
- sound->handle = NULL;
- sound->playback_handle = NULL;
- }
+ if (sound->handle) {
+ AUD_Sound_free(sound->handle);
+ sound->handle = NULL;
+ sound->playback_handle = NULL;
+ }
- BKE_sound_free_waveform(sound);
+ BKE_sound_free_waveform(sound);
/* XXX unused currently */
# if 0
switch (sound->type) {
case SOUND_TYPE_FILE:
# endif
- {
- char fullpath[FILE_MAX];
+ {
+ char fullpath[FILE_MAX];
- /* load sound */
- PackedFile *pf = sound->packedfile;
+ /* load sound */
+ PackedFile *pf = sound->packedfile;
- /* don't modify soundact->sound->name, only change a copy */
- BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
- BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
+ /* don't modify soundact->sound->name, only change a copy */
+ BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
+ BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
- /* but we need a packed file then */
- if (pf) {
- sound->handle = AUD_Sound_bufferFile((unsigned char *)pf->data, pf->size);
- }
- else {
- /* or else load it from disk */
- sound->handle = AUD_Sound_file(fullpath);
+ /* but we need a packed file then */
+ if (pf) {
+ sound->handle = AUD_Sound_bufferFile((unsigned char *)pf->data, pf->size);
+ }
+ else {
+ /* or else load it from disk */
+ sound->handle = AUD_Sound_file(fullpath);
+ }
}
- }
/* XXX unused currently */
# if 0
break;
@@ -473,34 +447,34 @@ void BKE_sound_load_audio(Main *bmain, bSound *sound)
break;
}
# endif
- if (sound->flags & SOUND_FLAGS_MONO) {
- void *handle = AUD_Sound_rechannel(sound->handle, AUD_CHANNELS_MONO);
- AUD_Sound_free(sound->handle);
- sound->handle = handle;
- }
+ if (sound->flags & SOUND_FLAGS_MONO) {
+ void *handle = AUD_Sound_rechannel(sound->handle, AUD_CHANNELS_MONO);
+ AUD_Sound_free(sound->handle);
+ sound->handle = handle;
+ }
- if (sound->flags & SOUND_FLAGS_CACHING) {
- sound->cache = AUD_Sound_cache(sound->handle);
- }
+ if (sound->flags & SOUND_FLAGS_CACHING) {
+ sound->cache = AUD_Sound_cache(sound->handle);
+ }
- if (sound->cache) {
- sound->playback_handle = sound->cache;
- }
- else {
- sound->playback_handle = sound->handle;
+ if (sound->cache) {
+ sound->playback_handle = sound->cache;
+ }
+ else {
+ sound->playback_handle = sound->handle;
+ }
+
+ BKE_sound_update_sequencer(bmain, sound);
}
}
AUD_Device *BKE_sound_mixdown(Scene *scene, AUD_DeviceSpecs specs, int start, float volume)
{
- sound_verify_evaluated_id(&scene->id);
return AUD_openMixdownDevice(specs, scene->sound_scene, volume, start / FPS);
}
void BKE_sound_create_scene(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
/* should be done in version patch, but this gets called before */
if (scene->r.frs_sec_base == 0) {
scene->r.frs_sec_base = 1;
@@ -533,21 +507,16 @@ void BKE_sound_destroy_scene(Scene *scene)
void BKE_sound_reset_scene_specs(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
+ AUD_Specs specs;
- if (scene->sound_scene) {
- AUD_Specs specs;
+ specs.channels = AUD_Device_getChannels(sound_device);
+ specs.rate = AUD_Device_getRate(sound_device);
- specs.channels = AUD_Device_getChannels(sound_device);
- specs.rate = AUD_Device_getRate(sound_device);
-
- AUD_Sequence_setSpecs(scene->sound_scene, specs);
- }
+ AUD_Sequence_setSpecs(scene->sound_scene, specs);
}
void BKE_sound_mute_scene(Scene *scene, int muted)
{
- sound_verify_evaluated_id(&scene->id);
if (scene->sound_scene) {
AUD_Sequence_setMuted(scene->sound_scene, muted);
}
@@ -555,8 +524,6 @@ void BKE_sound_mute_scene(Scene *scene, int muted)
void BKE_sound_update_fps(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
if (scene->sound_scene) {
AUD_Sequence_setFPS(scene->sound_scene, FPS);
}
@@ -566,8 +533,6 @@ void BKE_sound_update_fps(Scene *scene)
void BKE_sound_update_scene_listener(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
AUD_Sequence_setSpeedOfSound(scene->sound_scene, scene->audio.speed_of_sound);
AUD_Sequence_setDopplerFactor(scene->sound_scene, scene->audio.doppler_factor);
AUD_Sequence_setDistanceModel(scene->sound_scene, scene->audio.distance_model);
@@ -576,7 +541,6 @@ void BKE_sound_update_scene_listener(Scene *scene)
void *BKE_sound_scene_add_scene_sound(
Scene *scene, Sequence *sequence, int startframe, int endframe, int frameskip)
{
- sound_verify_evaluated_id(&scene->id);
if (sequence->scene && scene != sequence->scene) {
const double fps = FPS;
return AUD_Sequence_add(scene->sound_scene,
@@ -600,7 +564,6 @@ void *BKE_sound_scene_add_scene_sound_defaults(Scene *scene, Sequence *sequence)
void *BKE_sound_add_scene_sound(
Scene *scene, Sequence *sequence, int startframe, int endframe, int frameskip)
{
- sound_verify_evaluated_id(&scene->id);
/* Happens when sequence's sound datablock was removed. */
if (sequence->sound == NULL) {
return NULL;
@@ -640,14 +603,12 @@ void BKE_sound_mute_scene_sound(void *handle, char mute)
void BKE_sound_move_scene_sound(
Scene *scene, void *handle, int startframe, int endframe, int frameskip)
{
- sound_verify_evaluated_id(&scene->id);
const double fps = FPS;
AUD_SequenceEntry_move(handle, startframe / fps, endframe / fps, frameskip / fps);
}
void BKE_sound_move_scene_sound_defaults(Scene *scene, Sequence *sequence)
{
- sound_verify_evaluated_id(&scene->id);
if (sequence->scene_sound) {
BKE_sound_move_scene_sound(scene,
sequence->scene_sound,
@@ -669,7 +630,6 @@ void BKE_sound_set_cfra(int cfra)
void BKE_sound_set_scene_volume(Scene *scene, float volume)
{
- sound_verify_evaluated_id(&scene->id);
AUD_Sequence_setAnimationData(scene->sound_scene,
AUD_AP_VOLUME,
CFRA,
@@ -695,8 +655,6 @@ void BKE_sound_set_scene_sound_pan(void *handle, float pan, char animated)
void BKE_sound_update_sequencer(Main *main, bSound *sound)
{
- BLI_assert(!"is not supposed to be used, is weird function.");
-
Scene *scene;
for (scene = main->scenes.first; scene; scene = scene->id.next) {
@@ -706,8 +664,6 @@ void BKE_sound_update_sequencer(Main *main, bSound *sound)
static void sound_start_play_scene(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
if (scene->playback_handle) {
AUD_Handle_stop(scene->playback_handle);
}
@@ -721,8 +677,6 @@ static void sound_start_play_scene(Scene *scene)
void BKE_sound_play_scene(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
AUD_Status status;
const float cur_time = (float)((double)CFRA / FPS);
@@ -765,8 +719,6 @@ void BKE_sound_stop_scene(Scene *scene)
void BKE_sound_seek_scene(Main *bmain, Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
AUD_Status status;
bScreen *screen;
int animation_playing;
@@ -798,10 +750,9 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
}
}
- Scene *scene_orig = (Scene *)DEG_get_original_id(&scene->id);
- if (scene_orig->audio.flag & AUDIO_SCRUB && !animation_playing) {
+ if (scene->audio.flag & AUDIO_SCRUB && !animation_playing) {
AUD_Handle_setPosition(scene->playback_handle, cur_time);
- if (scene_orig->audio.flag & AUDIO_SYNC) {
+ if (scene->audio.flag & AUDIO_SYNC) {
AUD_seekSynchronizer(scene->playback_handle, cur_time);
}
AUD_Handle_resume(scene->playback_handle);
@@ -817,7 +768,7 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
}
}
else {
- if (scene_orig->audio.flag & AUDIO_SYNC) {
+ if (scene->audio.flag & AUDIO_SYNC) {
AUD_seekSynchronizer(scene->playback_handle, cur_time);
}
else {
@@ -832,8 +783,6 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
float BKE_sound_sync_scene(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
// Ugly: Blender doesn't like it when the animation is played back during rendering
if (G.is_rendering) {
return NAN_FLT;
@@ -852,8 +801,6 @@ float BKE_sound_sync_scene(Scene *scene)
int BKE_sound_scene_playing(Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
// Ugly: Blender doesn't like it when the animation is played back during rendering
if (G.is_rendering) {
return -1;
@@ -884,9 +831,6 @@ void BKE_sound_free_waveform(bSound *sound)
sound->tags &= ~SOUND_TAGS_WAVEFORM_NO_RELOAD;
}
-/* TODO(sergey): Consider mamakinging this function fully autonomous, as in, not require having
- * an existing playback handle. That would make it easy to read waveforms, which doesn't seem to
- * be affected by evaluated scene (waveworm comes from file). */
void BKE_sound_read_waveform(bSound *sound, short *stop)
{
AUD_SoundInfo info = AUD_getInfo(sound->playback_handle);
@@ -935,14 +879,11 @@ static void sound_update_base(Scene *scene, Base *base, void *new_set)
Speaker *speaker;
float quat[4];
- sound_verify_evaluated_id(&scene->id);
- sound_verify_evaluated_id(&ob->id);
+ if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
+ return;
+ }
- // TODO(sergey): Bring the test back, or make it a part of dependency graph update.
- // if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
- // return;
- // }
- // ob->id.tag &= ~LIB_TAG_DOIT;
+ ob->id.tag &= ~LIB_TAG_DOIT;
if ((ob->type != OB_SPEAKER) || !ob->adt) {
return;
@@ -1005,8 +946,6 @@ static void sound_update_base(Scene *scene, Base *base, void *new_set)
void BKE_sound_update_scene(Main *bmain, Scene *scene)
{
- sound_verify_evaluated_id(&scene->id);
-
Base *base;
Scene *sce_it;
@@ -1016,8 +955,7 @@ void BKE_sound_update_scene(Main *bmain, Scene *scene)
/* cheap test to skip looping over all objects (no speakers is a common case) */
if (!BLI_listbase_is_empty(&bmain->speakers)) {
- // TODO(sergey): Bring the test back, or make it a part of dependency graph update.
- // BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
+ BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
for (ViewLayer *view_layer = scene->view_layers.first; view_layer;
view_layer = view_layer->next) {
@@ -1054,7 +992,6 @@ void *BKE_sound_get_factory(void *sound)
/* stupid wrapper because AUD_C-API.h includes Python.h which makesrna doesn't like */
float BKE_sound_get_length(bSound *sound)
{
- sound_verify_evaluated_id(&sound->id);
AUD_SoundInfo info = AUD_getInfo(sound->playback_handle);
return info.length;
@@ -1217,94 +1154,4 @@ char **BKE_sound_get_device_names(void)
return names;
}
-void BKE_sound_free_waveform(bSound *UNUSED(sound))
-{
-}
-
-void BKE_sound_load_audio(Main *UNUSED(bmain), bSound *UNUSED(sound))
-{
-}
-
#endif /* WITH_AUDASPACE */
-
-void BKE_sound_update_and_seek(Main *bmain, Depsgraph *depsgraph)
-{
- Scene *scene_orig = DEG_get_input_scene(depsgraph);
- Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
- /* NOTE: We don't do copy-on-write or anything like that here because we need to know scene's
- * flags like "scrubbing" in the BKE_sound_seek_scene(). So we simply update frame to which
- * seek needs to happen.
- *
- * TODO(sergey): Might change API so the frame is passes explicitly. */
- scene_eval->r.cfra = scene_orig->r.cfra;
- BKE_sound_seek_scene(bmain, scene_eval);
-}
-
-void BKE_sound_reset_scene_runtime(Scene *scene)
-{
- scene->sound_scene = NULL;
- scene->playback_handle = NULL;
- scene->sound_scrub_handle = NULL;
- scene->speaker_handles = NULL;
-}
-
-void BKE_sound_ensure_scene(struct Scene *scene)
-{
- if (scene->sound_scene != NULL) {
- return;
- }
- BKE_sound_create_scene(scene);
-}
-
-void BKE_sound_reset_runtime(bSound *sound)
-{
- sound->cache = NULL;
- sound->playback_handle = NULL;
-}
-
-void BKE_sound_ensure_loaded(Main *bmain, bSound *sound)
-{
- if (sound->cache != NULL) {
- return;
- }
- BKE_sound_load(bmain, sound);
-}
-
-void BKE_sound_jack_sync_callback_set(SoundJackSyncCallback callback)
-{
-#if defined(WITH_AUDASPACE) && defined(WITH_JACK)
- sound_jack_sync_callback = callback;
-#else
- UNUSED_VARS(callback);
-#endif
-}
-
-void BKE_sound_jack_scene_update(Scene *scene, int mode, float time)
-{
- sound_verify_evaluated_id(&scene->id);
-
- /* Ugly: Blender doesn't like it when the animation is played back during rendering. */
- if (G.is_rendering) {
- return;
- }
-
- if (mode) {
- BKE_sound_play_scene(scene);
- }
- else {
- BKE_sound_stop_scene(scene);
- }
-#ifdef WITH_AUDASPACE
- if (scene->playback_handle != NULL) {
- AUD_Handle_setPosition(scene->playback_handle, time);
- }
-#else
- UNUSED_VARS(time);
-#endif
-}
-
-void BKE_sound_evaluate(Depsgraph *depsgraph, Main *bmain, bSound *sound)
-{
- DEG_debug_print_eval(depsgraph, __func__, sound->id.name, sound);
- BKE_sound_ensure_loaded(bmain, sound);
-}
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index f9584adc6e0..669eb5c42dc 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -36,6 +36,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "DEG_depsgraph.h"
@@ -43,7 +44,8 @@
#include "MEM_guardedalloc.h"
/* -------------------------------------------------------------------- */
-/* Internal utils */
+/** \name Internal Utils
+ * \{ */
static void workspace_layout_name_set(WorkSpace *workspace,
WorkSpaceLayout *layout,
@@ -134,8 +136,11 @@ static bool UNUSED_FUNCTION(workspaces_is_screen_used)
return false;
}
+/** \} */
+
/* -------------------------------------------------------------------- */
-/* Create, delete, init */
+/** \name Create, Delete, Init
+ * \{ */
WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
{
@@ -253,8 +258,11 @@ void BKE_workspace_relations_free(ListBase *relation_list)
}
}
+/** \} */
+
/* -------------------------------------------------------------------- */
-/* General Utils */
+/** \name General Utils
+ * \{ */
WorkSpaceLayout *BKE_workspace_layout_find(const WorkSpace *workspace, const bScreen *screen)
{
@@ -354,8 +362,32 @@ void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tre
MEM_freeN(tref);
}
+bool BKE_workspace_owner_id_check(const WorkSpace *workspace, const char *owner_id)
+{
+ if ((*owner_id == '\0') || ((workspace->flags & WORKSPACE_USE_FILTER_BY_ORIGIN) == 0)) {
+ return true;
+ }
+ else {
+ /* We could use hash lookup, for now this list is highly likely under < ~16 items. */
+ return BLI_findstring(&workspace->owner_ids, owner_id, offsetof(wmOwnerID, name)) != NULL;
+ }
+}
+
+void BKE_workspace_id_tag_all_visible(Main *bmain, int tag)
+{
+ BKE_main_id_tag_listbase(&bmain->workspaces, tag, false);
+ wmWindowManager *wm = bmain->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
+ workspace->id.tag |= tag;
+ }
+}
+
+/** \} */
+
/* -------------------------------------------------------------------- */
-/* Getters/Setters */
+/** \name Getters/Setters
+ * \{ */
WorkSpace *BKE_workspace_active_get(WorkSpaceInstanceHook *hook)
{
@@ -433,13 +465,4 @@ void BKE_workspace_hook_layout_for_workspace_set(WorkSpaceInstanceHook *hook,
workspace_relation_ensure_updated(&workspace->hook_layout_relations, hook, layout);
}
-bool BKE_workspace_owner_id_check(const WorkSpace *workspace, const char *owner_id)
-{
- if ((*owner_id == '\0') || ((workspace->flags & WORKSPACE_USE_FILTER_BY_ORIGIN) == 0)) {
- return true;
- }
- else {
- /* we could use hash lookup, for now this list is highly under < ~16 items. */
- return BLI_findstring(&workspace->owner_ids, owner_id, offsetof(wmOwnerID, name)) != NULL;
- }
-}
+/** \} */
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index b72b99e514d..19425a0d80b 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -118,7 +118,6 @@ bMovieHandle *BKE_movie_handle_get(const char imtype)
mh.start_movie = start_stub;
mh.append_movie = append_stub;
mh.end_movie = end_stub;
- mh.get_next_frame = NULL;
mh.get_movie_path = NULL;
mh.context_create = context_create_stub;
mh.context_free = context_free_stub;