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:
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_blender.h4
-rw-r--r--source/blender/blenkernel/BKE_colortools.h27
-rw-r--r--source/blender/blenkernel/BKE_curve.h2
-rw-r--r--source/blender/blenkernel/BKE_customdata.h2
-rw-r--r--source/blender/blenkernel/BKE_group.h4
-rw-r--r--source/blender/blenkernel/BKE_image.h5
-rw-r--r--source/blender/blenkernel/BKE_key.h50
-rw-r--r--source/blender/blenkernel/BKE_mask.h7
-rw-r--r--source/blender/blenkernel/BKE_node.h5
-rw-r--r--source/blender/blenkernel/BKE_object.h1
-rw-r--r--source/blender/blenkernel/BKE_property.h27
-rw-r--r--source/blender/blenkernel/BKE_sca.h2
-rw-r--r--source/blender/blenkernel/BKE_scene.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h12
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/SConscript7
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c4
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c8
-rw-r--r--source/blender/blenkernel/intern/action.c472
-rw-r--r--source/blender/blenkernel/intern/blender.c14
-rw-r--r--source/blender/blenkernel/intern/cloth.c35
-rw-r--r--source/blender/blenkernel/intern/collision.c2
-rw-r--r--source/blender/blenkernel/intern/colortools.c98
-rw-r--r--source/blender/blenkernel/intern/constraint.c55
-rw-r--r--source/blender/blenkernel/intern/curve.c27
-rw-r--r--source/blender/blenkernel/intern/customdata.c28
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c4
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c21
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c4
-rw-r--r--source/blender/blenkernel/intern/group.c64
-rw-r--r--source/blender/blenkernel/intern/icons.c4
-rw-r--r--source/blender/blenkernel/intern/idprop.c4
-rw-r--r--source/blender/blenkernel/intern/image.c115
-rw-r--r--source/blender/blenkernel/intern/image_gen.c6
-rw-r--r--source/blender/blenkernel/intern/implicit.c22
-rw-r--r--source/blender/blenkernel/intern/key.c95
-rw-r--r--source/blender/blenkernel/intern/mask.c5
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c10
-rw-r--r--source/blender/blenkernel/intern/material.c2
-rw-r--r--source/blender/blenkernel/intern/mball.c18
-rw-r--r--source/blender/blenkernel/intern/mesh.c7
-rw-r--r--source/blender/blenkernel/intern/modifier.c2
-rw-r--r--source/blender/blenkernel/intern/movieclip.c21
-rw-r--r--source/blender/blenkernel/intern/object.c189
-rw-r--r--source/blender/blenkernel/intern/ocean.c9
-rw-r--r--source/blender/blenkernel/intern/particle.c4
-rw-r--r--source/blender/blenkernel/intern/particle_system.c5
-rw-r--r--source/blender/blenkernel/intern/property.c65
-rw-r--r--source/blender/blenkernel/intern/sca.c25
-rw-r--r--source/blender/blenkernel/intern/scene.c36
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c9
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c41
-rw-r--r--source/blender/blenkernel/intern/sequencer.c135
-rw-r--r--source/blender/blenkernel/intern/smoke.c6
-rw-r--r--source/blender/blenkernel/intern/softbody.c4
-rw-r--r--source/blender/blenkernel/intern/sound.c1
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c12
-rw-r--r--source/blender/blenkernel/intern/text.c27
-rw-r--r--source/blender/blenkernel/intern/texture.c2
-rw-r--r--source/blender/blenkernel/intern/tracking.c41
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c2
62 files changed, 841 insertions, 1082 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 1e67027ae8c..db1139c9c7b 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 18
+#define BLENDER_SUBVERSION 21
/* 262 was the last editmesh release but its has compatibility code for bmesh data,
* so set the minversion to 2.61 */
@@ -53,7 +53,7 @@ extern "C" {
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR a
/* alpha/beta/rc/release, docs use this */
-#define BLENDER_VERSION_CYCLE beta
+#define BLENDER_VERSION_CYCLE rc
extern char versionstr[]; /* from blender.c */
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index 9ce2de79dbf..728f88b3c16 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -31,6 +31,9 @@
* \ingroup bke
*/
+struct ColorManagedColorspaceSettings;
+struct ColorManagedDisplaySettings;
+struct ColorManagedViewSettings;
struct CurveMapping;
struct CurveMap;
struct CurveMapPoint;
@@ -39,7 +42,7 @@ struct Histogram;
struct ImBuf;
struct rctf;
-#if defined _WIN32
+#if defined _MSC_VER
# define DO_INLINE __inline
#elif defined(__sun) || defined(__sun__)
# define DO_INLINE
@@ -58,7 +61,7 @@ void curvemapping_set_black_white(struct CurveMapping *cumap, con
#define CURVEMAP_SLOPE_NEGATIVE 0
#define CURVEMAP_SLOPE_POSITIVE 1
-void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset, int slope);
+void curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope);
void curvemap_remove(struct CurveMap *cuma, const short flag);
void curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp);
struct CurveMapPoint *curvemap_insert(struct CurveMap *cuma, float x, float y);
@@ -89,9 +92,25 @@ void curvemapping_do_ibuf(struct CurveMapping *cumap, struct ImBu
void curvemapping_premultiply(struct CurveMapping *cumap, int restore);
-void BKE_histogram_update_sample_line(struct Histogram *hist, struct ImBuf *ibuf, const short use_color_management);
-void scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, int use_color_management);
+void BKE_histogram_update_sample_line(struct Histogram *hist, struct ImBuf *ibuf,
+ const struct ColorManagedViewSettings *view_settings,
+ const struct ColorManagedDisplaySettings *display_settings);
+void scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings,
+ const struct ColorManagedDisplaySettings *display_settings);
void scopes_free(struct Scopes *scopes);
void scopes_new(struct Scopes *scopes);
+void BKE_color_managed_display_settings_init(struct ColorManagedDisplaySettings *settings);
+void BKE_color_managed_display_settings_copy(struct ColorManagedDisplaySettings *new_settings,
+ const struct ColorManagedDisplaySettings *settings);
+
+void BKE_color_managed_view_settings_init(struct ColorManagedViewSettings *settings);
+void BKE_color_managed_view_settings_copy(struct ColorManagedViewSettings *new_settings,
+ const struct ColorManagedViewSettings *settings);
+void BKE_color_managed_view_settings_free(struct ColorManagedViewSettings *settings);
+
+void BKE_color_managed_colorspace_settings_init(struct ColorManagedColorspaceSettings *colorspace_settings);
+void BKE_color_managed_colorspace_settings_copy(struct ColorManagedColorspaceSettings *colorspace_settings,
+ const struct ColorManagedColorspaceSettings *settings);
+
#endif
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index a845ac10c9d..e6161cebf54 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -93,6 +93,8 @@ void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float
/* ** Nurbs ** */
+int BKE_nurbList_index_get_co(struct ListBase *editnurb, const int index, float r_co[3]);
+
int BKE_nurbList_verts_count(struct ListBase *nurb);
int BKE_nurbList_verts_count_without_handles(struct ListBase *nurb);
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 19dd67b88f8..33361b9921c 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -73,6 +73,8 @@ extern const CustomDataMask CD_MASK_FACECORNERS;
#define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type))
+void customData_mask_layers__print(CustomDataMask mask);
+
/**
* Checks if the layer at physical offset \a layer_n (in data->layers) support math
* the below operations.
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h
index 67cdee9fa07..3e9803a908b 100644
--- a/source/blender/blenkernel/BKE_group.h
+++ b/source/blender/blenkernel/BKE_group.h
@@ -52,10 +52,6 @@ int group_is_animated(struct Object *parent, struct Group *group);
void group_tag_recalc(struct Group *group);
void group_handle_recalc_and_update(struct Scene *scene, struct Object *parent, struct Group *group);
-#if 0 /* UNUSED */
-struct Object *group_get_member_with_action(struct Group *group, struct bAction *act);
-void group_relink_nla_objects(struct Object *ob);
-#endif
#endif
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 67461281674..ac324b2af00 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -46,6 +46,8 @@ struct Object;
struct ImageFormatData;
struct Main;
+#define IMA_MAX_SPACE 64
+
/* call from library */
void BKE_image_free(struct Image *me);
@@ -64,6 +66,7 @@ int BKE_imtype_is_movie(const char imtype);
int BKE_imtype_supports_zbuf(const char imtype);
int BKE_imtype_supports_compress(const char imtype);
int BKE_imtype_supports_quality(const char imtype);
+int BKE_imtype_supports_float(const char imtype);
char BKE_imtype_valid_channels(const char imtype);
char BKE_imtype_valid_depths(const char imtype);
@@ -72,7 +75,7 @@ char BKE_imtype_from_arg(const char *arg);
void BKE_imformat_defaults(struct ImageFormatData *im_format);
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const struct ImBuf *imbuf);
-struct anim *openanim(const char *name, int flags, int streamindex);
+struct anim *openanim(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE]);
void BKE_image_de_interlace(struct Image *ima, int odd);
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index 1ad451b0937..01baf8feb2a 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -47,13 +47,13 @@ struct Mesh;
extern "C" {
#endif
-void BKE_key_free(struct Key *sc);
-void free_key_nolib(struct Key *key);
-struct Key *add_key(struct ID *id);
+void BKE_key_free(struct Key *sc);
+void BKE_key_free_nolib(struct Key *key);
+struct Key *BKE_key_add(struct ID *id);
struct Key *BKE_key_copy(struct Key *key);
-struct Key *copy_key_nolib(struct Key *key);
-void BKE_key_make_local(struct Key *key);
-void sort_keys(struct Key *key);
+struct Key *BKE_key_copy_nolib(struct Key *key);
+void BKE_key_make_local(struct Key *key);
+void BKE_key_sort(struct Key *key);
void key_curve_position_weights(float t, float data[4], int type);
void key_curve_tangent_weights(float t, float data[4], int type);
@@ -61,27 +61,29 @@ void key_curve_normal_weights(float t, float data[4], int type);
float *do_ob_key(struct Scene *scene, struct Object *ob);
-struct Key *ob_get_key(struct Object *ob);
-struct KeyBlock *add_keyblock(struct Key *key, const char *name);
-struct KeyBlock *add_keyblock_ctime(struct Key *key, const char *name, const short do_force);
-struct KeyBlock *ob_get_keyblock(struct Object *ob);
-struct KeyBlock *ob_get_reference_keyblock(struct Object *ob);
-struct KeyBlock *key_get_keyblock(struct Key *key, int index);
-struct KeyBlock *key_get_named_keyblock(struct Key *key, const char name[]);
-char *key_get_curValue_rnaPath(struct Key *key, struct KeyBlock *kb);
+struct Key *BKE_key_from_object(struct Object *ob);
+struct KeyBlock *BKE_keyblock_from_object(struct Object *ob);
+struct KeyBlock *BKE_keyblock_from_object_reference(struct Object *ob);
+
+struct KeyBlock *BKE_keyblock_add(struct Key *key, const char *name);
+struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, const short do_force);
+struct KeyBlock *BKE_keyblock_from_key(struct Key *key, int index);
+struct KeyBlock *BKE_keyblock_find_name(struct Key *key, const char name[]);
+void BKE_keyblock_copy_settings(struct KeyBlock *kb_dst, const struct KeyBlock *kb_src);
+char *BKE_keyblock_curval_rnapath_get(struct Key *key, struct KeyBlock *kb);
// needed for the GE
-void do_rel_key(const int start, int end, const int tot, char *basispoin, struct Key *key, struct KeyBlock *actkb, const int mode);
+void BKE_key_evaluate_relative(const int start, int end, const int tot, char *basispoin, struct Key *key, struct KeyBlock *actkb, const int mode);
/* conversion functions */
-void key_to_mesh(struct KeyBlock *kb, struct Mesh *me);
-void mesh_to_key(struct Mesh *me, struct KeyBlock *kb);
-void key_to_latt(struct KeyBlock *kb, struct Lattice *lt);
-void latt_to_key(struct Lattice *lt, struct KeyBlock *kb);
-void key_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
-void curve_to_key(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
-float (*key_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
-void vertcos_to_key(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
-void offset_to_key(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]);
+void BKE_key_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me);
+void BKE_key_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb);
+void BKE_key_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
+void BKE_key_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
+void BKE_key_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
+void BKE_key_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
+float (*BKE_key_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
+void BKE_key_convert_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
+void BKE_key_convert_from_offset(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]);
/* key.c */
extern int slurph_opt;
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 51e301fec80..cc15ceecbac 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -131,6 +131,7 @@ void BKE_mask_get_handle_point_adjacent(struct MaskSpline *spline, struct MaskSp
void BKE_mask_layer_calc_handles(struct MaskLayer *masklay);
void BKE_mask_layer_calc_handles_deform(struct MaskLayer *masklay);
void BKE_mask_calc_handles(struct Mask *mask);
+void BKE_mask_update_deform(struct Mask *mask);
void BKE_mask_spline_ensure_deform(struct MaskSpline *spline);
/* animation */
@@ -163,10 +164,10 @@ void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, i
int BKE_mask_get_duration(struct Mask *mask);
-#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT)
+#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f3) & SELECT)
#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT)
-#define MASKPOINT_ISSEL_HANDLE_ONLY(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) )
-#define MASKPOINT_ISSEL_HANDLE(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) )
+#define MASKPOINT_ISSEL_HANDLE_ONLY(p) ( (((p)->bezt.f1 | (p)->bezt.f3) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) )
+#define MASKPOINT_ISSEL_HANDLE(p) ( (((p)->bezt.f1 | (p)->bezt.f3) & SELECT) )
#define MASKPOINT_SEL_ALL(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f2 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0
#define MASKPOINT_DESEL_ALL(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f2 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 438d5110666..6ad2ad924e2 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -64,6 +64,8 @@ struct Tex;
struct SpaceNode;
struct ARegion;
struct Object;
+struct ColorManagedViewSettings;
+struct ColorManagedDisplaySettings;
/* ************** NODE TYPE DEFINITIONS ***** */
@@ -725,7 +727,8 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria
struct CompBuf;
struct bNodeTreeExec *ntreeCompositBeginExecTree(struct bNodeTree *ntree, int use_tree_data);
void ntreeCompositEndExecTree(struct bNodeTreeExec *exec, int use_tree_data);
-void ntreeCompositExecTree(struct bNodeTree *ntree, struct RenderData *rd, int rendering, int do_previews);
+void ntreeCompositExecTree(struct bNodeTree *ntree, struct RenderData *rd, int rendering, int do_previews,
+ const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings);
void ntreeCompositTagRender(struct Scene *sce);
int ntreeCompositTagAnimated(struct bNodeTree *ntree);
void ntreeCompositTagGenerators(struct bNodeTree *ntree);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 31642dad60d..269d96d5c38 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -93,6 +93,7 @@ void BKE_object_to_mat3(struct Object *ob, float mat[][3]);
void BKE_object_to_mat4(struct Object *ob, float mat[][4]);
void BKE_object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
+int BKE_object_pose_context_check(struct Object *ob);
struct Object *BKE_object_pose_armature_get(struct Object *ob);
void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h
index a29dc0e7be4..e0eb8c04b60 100644
--- a/source/blender/blenkernel/BKE_property.h
+++ b/source/blender/blenkernel/BKE_property.h
@@ -35,19 +35,18 @@ struct bProperty;
struct ListBase;
struct Object;
-void free_property(struct bProperty *prop);
-void free_properties(struct ListBase *lb);
-struct bProperty *copy_property(struct bProperty *prop);
-void copy_properties(struct ListBase *lbn, struct ListBase *lbo);
-void init_property(struct bProperty *prop);
-struct bProperty *new_property(int type);
-void unique_property(struct bProperty *first, struct bProperty *prop, int force);
-struct bProperty *get_ob_property(struct Object *ob, const char *name);
-void set_ob_property(struct Object *ob, struct bProperty *propc);
-int compare_property(struct bProperty *prop, const char *str);
-void set_property(struct bProperty *prop, const char *str);
-void add_property(struct bProperty *prop, const char *str);
-void set_property_valstr(struct bProperty *prop, char *str);
-void cp_property(struct bProperty *prop1, struct bProperty *prop2);
+void BKE_bproperty_free(struct bProperty *prop);
+void BKE_bproperty_free_list(struct ListBase *lb);
+struct bProperty *BKE_bproperty_copy(struct bProperty *prop);
+void BKE_bproperty_copy_list(struct ListBase *lbn, struct ListBase *lbo);
+void BKE_bproperty_init(struct bProperty *prop);
+struct bProperty *BKE_bproperty_new(int type);
+void BKE_bproperty_unique(struct bProperty *first, struct bProperty *prop, int force);
+struct bProperty *BKE_bproperty_object_get(struct Object *ob, const char *name);
+void BKE_bproperty_object_set(struct Object *ob, struct bProperty *propc);
+// int BKE_bproperty_cmp(struct bProperty *prop, const char *str);
+void BKE_bproperty_set(struct bProperty *prop, const char *str);
+void BKE_bproperty_add(struct bProperty *prop, const char *str);
+void BKE_bproperty_set_valstr(struct bProperty *prop, char *str);
#endif
diff --git a/source/blender/blenkernel/BKE_sca.h b/source/blender/blenkernel/BKE_sca.h
index 22b44511195..d598a26fdf9 100644
--- a/source/blender/blenkernel/BKE_sca.h
+++ b/source/blender/blenkernel/BKE_sca.h
@@ -74,5 +74,7 @@ void sca_move_sensor(struct bSensor *sens_to_move, struct Object *ob, int move_u
void sca_move_controller(struct bController *cont_to_move, struct Object *ob, int move_up);
void sca_move_actuator(struct bActuator *act_to_move, struct Object *ob, int move_up);
+const char *sca_state_name_get(Object *ob, short bit);
+
#endif
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index bce4243190a..023b7e85c40 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -108,6 +108,8 @@ float get_render_aosss_error(struct RenderData *r, float error);
int BKE_scene_use_new_shading_nodes(struct Scene *scene);
+void BKE_scene_disable_color_management(struct Scene *scene);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 51a64c97ca6..0c571f62f0e 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -177,6 +177,16 @@ struct ImBuf *BKE_sequencer_give_ibuf_seqbase(SeqRenderData context, float cfra,
void BKE_sequencer_give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chan_shown);
/* **********************************************************************
+ * sequencer.c
+ *
+ * sequencer color space functions
+ * ********************************************************************** */
+
+void BKE_sequencer_imbuf_to_sequencer_space(struct Scene *scene, struct ImBuf *ibuf, int make_float);
+void BKE_sequencer_imbuf_from_sequencer_space(struct Scene *scene, struct ImBuf *ibuf);
+void BKE_sequencer_pixel_from_sequencer_space_v4(struct Scene *scene, float pixel[4]);
+
+/* **********************************************************************
* sequencer scene functions
* ********************************************************************** */
struct Editing *BKE_sequencer_editing_get(struct Scene *scene, int alloc);
@@ -350,7 +360,7 @@ struct Sequence *BKE_sequencer_add_sound_strip(struct bContext *C, ListBase *seq
struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
/* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, int, char[256]);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, int, int, char[256]);
extern SequencerDrawView sequencer_view3d_cb;
/* copy/paste */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index c89d0ecb142..9a24a3ca4e0 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -45,6 +45,7 @@ set(INC
../../../intern/mikktspace
../../../intern/opennl/extern
../../../intern/raskter
+ ../../../intern/smoke/extern
# XXX - BAD LEVEL CALL WM_api.h
../windowmanager
@@ -344,9 +345,6 @@ if(WITH_MOD_FLUID)
endif()
if(WITH_MOD_SMOKE)
- list(APPEND INC
- ../../../intern/smoke/extern
- )
add_definitions(-DWITH_SMOKE)
endif()
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 58827e326a3..8a656c735f6 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -3,6 +3,10 @@ Import ('env')
import os
sources = env.Glob('intern/*.c')
+sources.remove('intern' + os.sep + 'mask_rasterize.c')
+sources.remove('intern' + os.sep + 'mask.c')
+
+sources_mask = env.Glob('intern/mask*.c')
incs = '. #/intern/guardedalloc #/intern/memutil'
incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
@@ -118,7 +122,10 @@ if env['WITH_BF_INTERNATIONAL']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
incs += ' ' + env['BF_PTHREADS_INC']
+
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [166,25]) #, cc_compileflags = env['CCFLAGS'].append('/WX') )
else:
env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player', 'player2'], priority = [166,25,0] )
+
+env.BlenderLib ( libname = 'bf_blenkernel_mask', sources = sources_mask, includes = Split(incs), defines = defs, libtype=['core','player', 'player2'], priority = [200,25,0] )
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 387d4775ad4..82ac0736b07 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1397,7 +1397,7 @@ CCGError ccgSubSurf_processSync(CCGSubSurf *ss)
return eCCGError_None;
}
-#define VERT_getNo(e, lvl) _vert_getNo(e, lvl, vertDataSize, normalDataOffset)
+#define VERT_getNo(e, lvl) _vert_getNo(v, lvl, vertDataSize, normalDataOffset)
#define EDGE_getNo(e, lvl, x) _edge_getNo(e, lvl, x, vertDataSize, normalDataOffset)
#define FACE_getIFNo(f, lvl, S, x, y) _face_getIFNo(f, lvl, S, x, y, subdivLevels, vertDataSize, normalDataOffset)
#define FACE_calcIFNo(f, lvl, S, x, y, no) _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
@@ -1491,7 +1491,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
/* XXX can I reduce the number of normalisations here? */
for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
CCGVert *v = (CCGVert *) effectedV[ptrIdx];
- float length, *no = _vert_getNo(v, lvl, vertDataSize, normalDataOffset);
+ float length, *no = VERT_getNo(v, lvl);
NormZero(no);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8c0aea5723f..5e13fe78a43 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -384,7 +384,7 @@ void DM_ensure_tessface(DerivedMesh *dm)
}
}
- else if (dm->dirty && DM_DIRTY_TESS_CDLAYERS) {
+ else if (dm->dirty & DM_DIRTY_TESS_CDLAYERS) {
BLI_assert(CustomData_has_layer(&dm->faceData, CD_POLYINDEX));
DM_update_tessface_data(dm);
}
@@ -808,7 +808,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
if (mti->isDisabled && mti->isDisabled(md, 0)) return NULL;
if (build_shapekey_layers && me->key && (kb = BLI_findlink(&me->key->block, ob->shapenr - 1))) {
- key_to_mesh(kb, me);
+ BKE_key_convert_to_mesh(kb, me);
}
if (mti->type == eModifierTypeType_OnlyDeform) {
@@ -878,7 +878,7 @@ static void *get_orco_coords_dm(Object *ob, BMEditMesh *em, int layer, int *free
* by a more flexible customdata system, but not simple */
if (!em) {
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
- KeyBlock *kb = key_get_keyblock(ob_get_key(ob), clmd->sim_parms->shapekey_rest);
+ KeyBlock *kb = BKE_keyblock_from_key(BKE_key_from_object(ob), clmd->sim_parms->shapekey_rest);
if (kb->data)
return kb->data;
@@ -1276,7 +1276,7 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
}
if (!kb) {
- kb = add_keyblock(me->key, layer->name);
+ kb = BKE_keyblock_add(me->key, layer->name);
kb->uid = layer->uid;
}
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 06bf5211abb..925658b84f4 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1214,475 +1214,3 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
}
}
-/* ********** NLA with non-poses works with ipo channels ********** */
-
-#if 0 // XXX OLD ANIMATION SYSTEM (TO BE REMOVED)
-
-/* ************************ Blending with NLA *************** */
-
-static void blend_pose_strides(bPose *dst, bPose *src, float srcweight, short mode)
-{
- float dstweight;
-
- switch (mode) {
- case ACTSTRIPMODE_BLEND:
- dstweight = 1.0F - srcweight;
- break;
- case ACTSTRIPMODE_ADD:
- dstweight = 1.0F;
- break;
- default:
- dstweight = 1.0F;
- }
-
- interp_v3_v3v3(dst->stride_offset, dst->stride_offset, src->stride_offset, srcweight);
-}
-
-
-/*
- * bone matching diagram, strips A and B
- *
- * .------------------------.
- * | A |
- * '------------------------'
- * . . b2
- * . .-------------v----------.
- * . | B . |
- * . '------------------------'
- * . . .
- * . . .
- * offset: . 0 . A-B . A-b2+B
- * . . .
- *
- * */
-
-
-static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src, float srcweight, short mode)
-{
- /* matching offset bones */
- /* take dst offset, and put src on on that location */
-
- if (strip->offs_bone[0] == 0)
- return;
-
- /* are we also blending with matching bones? */
- if (strip->prev && strip->start >= strip->prev->start) {
- bPoseChannel *dpchan = BKE_pose_channel_find_name(dst, strip->offs_bone);
- if (dpchan) {
- bPoseChannel *spchan = BKE_pose_channel_find_name(src, strip->offs_bone);
- if (spchan) {
- float vec[3];
-
- /* dst->ctime has the internal strip->prev action time */
- /* map this time to nla time */
-
- float ctime = get_actionstrip_frame(strip, src->ctime, 1);
-
- if (ctime > strip->prev->end) {
- bActionChannel *achan;
-
- /* add src to dest, minus the position of src on strip->prev->end */
-
- ctime = get_actionstrip_frame(strip, strip->prev->end, 0);
-
- achan = get_action_channel(strip->act, strip->offs_bone);
- if (achan && achan->ipo) {
- bPoseChannel pchan;
- /* Evaluates and sets the internal ipo value */
- calc_ipo(achan->ipo, ctime);
- /* This call also sets the pchan flags */
- execute_action_ipo(achan, &pchan);
-
- /* store offset that moves src to location of pchan */
- sub_v3_v3v3(vec, dpchan->loc, pchan.loc);
-
- mul_mat3_m4_v3(dpchan->bone->arm_mat, vec);
- }
- }
- else {
- /* store offset that moves src to location of dst */
-
- sub_v3_v3v3(vec, dpchan->loc, spchan->loc);
- mul_mat3_m4_v3(dpchan->bone->arm_mat, vec);
- }
-
- /* if blending, we only add with factor scrweight */
- mul_v3_fl(vec, srcweight);
-
- add_v3_v3(dst->cyclic_offset, vec);
- }
- }
- }
-
- add_v3_v3(dst->cyclic_offset, src->cyclic_offset);
-}
-
-/* added "sizecorr" here, to allow armatures to be scaled and still have striding.
- * Only works for uniform scaling. In general I'd advise against scaling armatures ever though! (ton)
- */
-static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip, Path *path, float pathdist, float *stride_offset)
-{
- bAction *act = strip->act;
- const char *name = strip->stridechannel;
- bActionChannel *achan = get_action_channel(act, name);
- int stride_axis = strip->stride_axis;
-
- if (achan && achan->ipo) {
- IpoCurve *icu = NULL;
- float minx = 0.0f, maxx = 0.0f, miny = 0.0f, maxy = 0.0f;
- int foundvert = 0;
-
- if (stride_axis == 0) stride_axis = AC_LOC_X;
- else if (stride_axis == 1) stride_axis = AC_LOC_Y;
- else stride_axis = AC_LOC_Z;
-
- /* calculate the min/max */
- for (icu = achan->ipo->curve.first; icu; icu = icu->next) {
- if (icu->adrcode == stride_axis) {
- if (icu->totvert > 1) {
- foundvert = 1;
- minx = icu->bezt[0].vec[1][0];
- maxx = icu->bezt[icu->totvert - 1].vec[1][0];
-
- miny = icu->bezt[0].vec[1][1];
- maxy = icu->bezt[icu->totvert - 1].vec[1][1];
- }
- break;
- }
- }
-
- if (foundvert && miny != maxy) {
- float stridelen = sizecorr * fabs(maxy - miny), striptime;
- float actiondist, pdist, pdistNewNormalized, offs;
- float vec1[4], vec2[4], dir[3];
-
- /* internal cycling, actoffs is in frames */
- offs = stridelen * strip->actoffs / (maxx - minx);
-
- /* amount path moves object */
- pdist = (float)fmod(pathdist + offs, stridelen);
- striptime = pdist / stridelen;
-
- /* amount stride bone moves */
- actiondist = sizecorr * eval_icu(icu, minx + striptime * (maxx - minx)) - miny;
-
- pdist = fabs(actiondist) - pdist;
- pdistNewNormalized = (pathdist + pdist) / path->totdist;
-
- /* now we need to go pdist further (or less) on cu path */
- where_on_path(ob, (pathdist) / path->totdist, vec1, dir); /* vec needs size 4 */
- if (pdistNewNormalized <= 1) {
- /* search for correction in positive path-direction */
- where_on_path(ob, pdistNewNormalized, vec2, dir); /* vec needs size 4 */
- sub_v3_v3v3(stride_offset, vec2, vec1);
- }
- else {
- /* we reached the end of the path, search backwards instead */
- where_on_path(ob, (pathdist - pdist) / path->totdist, vec2, dir); /* vec needs size 4 */
- sub_v3_v3v3(stride_offset, vec1, vec2);
- }
- mul_mat3_m4_v3(ob->obmat, stride_offset);
- return striptime;
- }
- }
- return 0.0f;
-}
-
-static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float time)
-{
- /* only called when strip has cyclic, so >= 1.0f works... */
- if (time >= 1.0f) {
- bActionChannel *achan = get_action_channel(strip->act, strip->offs_bone);
-
- if (achan && achan->ipo) {
- IpoCurve *icu = NULL;
- Bone *bone;
- float min[3] = {0.0f, 0.0f, 0.0f}, max[3] = {0.0f, 0.0f, 0.0f};
- int index = 0, foundvert = 0;
-
- /* calculate the min/max */
- for (icu = achan->ipo->curve.first; icu; icu = icu->next) {
- if (icu->totvert > 1) {
-
- if (icu->adrcode == AC_LOC_X)
- index = 0;
- else if (icu->adrcode == AC_LOC_Y)
- index = 1;
- else if (icu->adrcode == AC_LOC_Z)
- index = 2;
- else
- continue;
-
- foundvert = 1;
- min[index] = icu->bezt[0].vec[1][1];
- max[index] = icu->bezt[icu->totvert - 1].vec[1][1];
- }
- }
- if (foundvert) {
- /* bring it into armature space */
- sub_v3_v3v3(min, max, min);
- bone = BKE_armature_find_bone_name(ob->data, strip->offs_bone); /* weak */
- if (bone) {
- mul_mat3_m4_v3(bone->arm_mat, min);
-
- /* dominant motion, cyclic_offset was cleared in BKE_pose_rest */
- if (strip->flag & (ACTSTRIP_CYCLIC_USEX | ACTSTRIP_CYCLIC_USEY | ACTSTRIP_CYCLIC_USEZ)) {
- if (strip->flag & ACTSTRIP_CYCLIC_USEX) pose->cyclic_offset[0] = time * min[0];
- if (strip->flag & ACTSTRIP_CYCLIC_USEY) pose->cyclic_offset[1] = time * min[1];
- if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2] = time * min[2];
- }
- else {
- if (fabsf(min[0]) >= fabsf(min[1]) && fabsf(min[0]) >= fabsf(min[2]))
- pose->cyclic_offset[0] = time * min[0];
- else if (fabsf(min[1]) >= fabsf(min[0]) && fabsf(min[1]) >= fabsf(min[2]))
- pose->cyclic_offset[1] = time * min[1];
- else
- pose->cyclic_offset[2] = time * min[2];
- }
- }
- }
- }
- }
-}
-
-/* simple case for now; only the curve path with constraint value > 0.5 */
-/* blending we might do later... */
-static Object *get_parent_path(Object *ob)
-{
- bConstraint *con;
-
- if (ob->parent && ob->parent->type == OB_CURVE)
- return ob->parent;
-
- for (con = ob->constraints.first; con; con = con->next) {
- if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) {
- if (con->enforce > 0.5f) {
- bFollowPathConstraint *data = con->data;
- return data->tar;
- }
- }
- }
- return NULL;
-}
-
-/* ************** do the action ************ */
-
-/* ----- nla, etc. --------- */
-
-static void do_nla(Scene *scene, Object *ob, int blocktype)
-{
- bPose *tpose = NULL;
- Key *key = NULL;
- ListBase tchanbase = {NULL, NULL}, chanbase = {NULL, NULL};
- bActionStrip *strip, *striplast = NULL, *stripfirst = NULL;
- float striptime, frametime, length, actlength;
- float blendfac, stripframe;
- float scene_cfra = BKE_scene_frame_get(scene);
- int doit, dostride;
-
- if (blocktype == ID_AR) {
- BKE_pose_copy_data(&tpose, ob->pose, 1);
- BKE_pose_rest(ob->pose); // potentially destroying current not-keyed pose
- }
- else {
- key = ob_get_key(ob);
- }
-
- /* check on extend to left or right, when no strip is hit by 'cfra' */
- for (strip = ob->nlastrips.first; strip; strip = strip->next) {
- /* escape loop on a hit */
- if (scene_cfra >= strip->start && scene_cfra <= strip->end + 0.1f) /* note 0.1 comes back below */
- break;
- if (scene_cfra < strip->start) {
- if (stripfirst == NULL)
- stripfirst = strip;
- else if (stripfirst->start > strip->start)
- stripfirst = strip;
- }
- else if (scene_cfra > strip->end) {
- if (striplast == NULL)
- striplast = strip;
- else if (striplast->end < strip->end)
- striplast = strip;
- }
- }
- if (strip == NULL) { /* extend */
- if (striplast)
- scene_cfra = striplast->end;
- else if (stripfirst)
- scene_cfra = stripfirst->start;
- }
-
- /* and now go over all strips */
- for (strip = ob->nlastrips.first; strip; strip = strip->next) {
- doit = dostride = 0;
-
- if (strip->act && !(strip->flag & ACTSTRIP_MUTE)) { /* so theres an action */
-
- /* Determine if the current frame is within the strip's range */
- length = strip->end - strip->start;
- actlength = strip->actend - strip->actstart;
- striptime = (scene_cfra - strip->start) / length;
- stripframe = (scene_cfra - strip->start);
-
- if (striptime >= 0.0) {
-
- if (blocktype == ID_AR)
- BKE_pose_rest(tpose);
-
- /* To handle repeat, we add 0.1 frame extra to make sure the last frame is included */
- if (striptime < 1.0f + 0.1f / length) {
-
- /* Handle path */
- if ((strip->flag & ACTSTRIP_USESTRIDE) && (blocktype == ID_AR) && (ob->ipoflag & OB_DISABLE_PATH) == 0) {
- Object *parent = get_parent_path(ob);
-
- if (parent) {
- Curve *cu = parent->data;
- float ctime, pdist;
-
- if (cu->flag & CU_PATH) {
- /* Ensure we have a valid path */
- if (cu->path == NULL || cu->path->data == NULL) makeDispListCurveTypes(scene, parent, 0);
- if (cu->path) {
-
- /* Find the position on the path */
- ctime = bsystem_time(scene, ob, scene_cfra, 0.0);
-
- if (calc_ipo_spec(cu->ipo, CU_SPEED, &ctime) == 0) {
- /* correct for actions not starting on zero */
- ctime = (ctime - strip->actstart) / cu->pathlen;
- CLAMP(ctime, 0.0, 1.0);
- }
- pdist = ctime * cu->path->totdist;
-
- if (tpose && strip->stridechannel[0]) {
- striptime = stridechannel_frame(parent, ob->size[0], strip, cu->path, pdist, tpose->stride_offset);
- }
- else {
- if (strip->stridelen) {
- striptime = pdist / strip->stridelen;
- striptime = (float)fmod(striptime + strip->actoffs, 1.0);
- }
- else
- striptime = 0;
- }
-
- frametime = (striptime * actlength) + strip->actstart;
- frametime = bsystem_time(scene, ob, frametime, 0.0);
-
- if (blocktype == ID_AR) {
- extract_pose_from_action(tpose, strip->act, frametime);
- }
- else if (blocktype == ID_OB) {
- extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
- if (key)
- extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
- }
- doit = dostride = 1;
- }
- }
- }
- }
- /* To handle repeat, we add 0.1 frame extra to make sure the last frame is included */
- else {
-
- /* Mod to repeat */
- if (strip->repeat != 1.0f) {
- float cycle = striptime * strip->repeat;
-
- striptime = (float)fmod(cycle, 1.0f + 0.1f / length);
- cycle -= striptime;
-
- if (blocktype == ID_AR)
- cyclic_offs_bone(ob, tpose, strip, cycle);
- }
-
- frametime = (striptime * actlength) + strip->actstart;
- frametime = nla_time(scene, frametime, (float)strip->repeat);
-
- if (blocktype == ID_AR) {
- extract_pose_from_action(tpose, strip->act, frametime);
- }
- else if (blocktype == ID_OB) {
- extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
- if (key)
- extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
- }
-
- doit = 1;
- }
- }
- /* Handle extend */
- else {
- if (strip->flag & ACTSTRIP_HOLDLASTFRAME) {
- /* we want the strip to hold on the exact fraction of the repeat value */
-
- frametime = actlength * (strip->repeat - (int)strip->repeat);
- if (frametime <= 0.000001f) frametime = actlength; /* rounding errors... */
- frametime = bsystem_time(scene, ob, frametime + strip->actstart, 0.0);
-
- if (blocktype == ID_AR)
- extract_pose_from_action(tpose, strip->act, frametime);
- else if (blocktype == ID_OB) {
- extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
- if (key)
- extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
- }
-
- /* handle cycle hold */
- if (strip->repeat != 1.0f) {
- if (blocktype == ID_AR)
- cyclic_offs_bone(ob, tpose, strip, strip->repeat - 1.0f);
- }
-
- doit = 1;
- }
- }
-
- /* Handle blendin & blendout */
- if (doit) {
- /* Handle blendin */
-
- if (strip->blendin > 0.0 && stripframe <= strip->blendin && scene_cfra >= strip->start) {
- blendfac = stripframe / strip->blendin;
- }
- else if (strip->blendout > 0.0 && stripframe >= (length - strip->blendout) && scene_cfra <= strip->end) {
- blendfac = (length - stripframe) / (strip->blendout);
- }
- else
- blendfac = 1;
-
- if (blocktype == ID_AR) { /* Blend this pose with the accumulated pose */
- /* offset bone, for matching cycles */
- blend_pose_offset_bone(strip, ob->pose, tpose, blendfac, strip->mode);
-
- blend_poses(ob->pose, tpose, blendfac, strip->mode);
- if (dostride)
- blend_pose_strides(ob->pose, tpose, blendfac, strip->mode);
- }
- else {
- blend_ipochannels(&chanbase, &tchanbase, blendfac, strip->mode);
- BLI_freelistN(&tchanbase);
- }
- }
- }
- }
- }
-
- if (blocktype == ID_OB) {
- execute_ipochannels(&chanbase);
- }
- else if (blocktype == ID_AR) {
- /* apply stride offset to object */
- add_v3_v3(ob->obmat[3], ob->pose->stride_offset);
- }
-
- /* free */
- if (tpose)
- BKE_pose_free(tpose);
- if (chanbase.first)
- BLI_freelistN(&chanbase);
-}
-
-#endif // XXX OLD ANIMATION SYSTEM (TO BE REMOVED)
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 09519f68415..99b788e80ce 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -89,8 +89,10 @@
#include "WM_api.h" // XXXXX BAD, very BAD dependency (bad level call) - remove asap, elubie
+#include "IMB_colormanagement.h"
+
#ifdef WITH_PYTHON
-#include "BPY_extern.h"
+# include "BPY_extern.h"
#endif
Global G;
@@ -217,8 +219,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
/* no load screens? */
if (mode) {
/* comes from readfile.c */
- extern void lib_link_screen_restore(Main *, bScreen *, Scene *);
-
SWAP(ListBase, G.main->wm, bfd->main->wm);
SWAP(ListBase, G.main->screen, bfd->main->screen);
SWAP(ListBase, G.main->script, bfd->main->script);
@@ -232,7 +232,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
if (curscreen) curscreen->scene = curscene; /* can run in bgmode */
/* clear_global will free G.main, here we can still restore pointers */
- lib_link_screen_restore(bfd->main, curscreen, curscene);
+ blo_lib_link_screen_restore(bfd->main, curscreen, curscene);
}
/* free G.main Main database */
@@ -322,7 +322,11 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
/* baseflags, groups, make depsgraph, etc */
BKE_scene_set_background(G.main, CTX_data_scene(C));
-
+
+ if (mode != 'u') {
+ IMB_colormanagement_check_file_config(G.main);
+ }
+
MEM_freeN(bfd);
(void)curscene; /* quiet warning */
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index b0de7a5ea6c..4241756a109 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -50,36 +50,7 @@
#include "BKE_modifier.h"
#include "BKE_pointcache.h"
-#ifdef _WIN32
-void tstart( void )
-{}
-void tend( void )
-{
-}
-double tval( void )
-{
- return 0;
-}
-#else
-#include <sys/time.h>
-static struct timeval _tstart, _tend;
-static struct timezone tz;
-void tstart( void )
-{
- gettimeofday(&_tstart, &tz);
-}
-void tend(void)
-{
- gettimeofday(&_tend, &tz);
-}
-double tval(void)
-{
- double t1, t2;
- t1 = ( double ) _tstart.tv_sec + ( double ) _tstart.tv_usec/ ( 1000*1000 );
- t2 = ( double ) _tend.tv_sec + ( double ) _tend.tv_usec/ ( 1000*1000 );
- return t2-t1;
-}
-#endif
+// #include "PIL_time.h" /* timing for debug prints */
/* Our available solvers. */
// 255 is the magic reserved number, so NEVER try to put 255 solvers in here!
@@ -410,13 +381,13 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
cloth_apply_vgroup ( clmd, result );
cloth_update_springs( clmd );
- tstart();
+ // TIMEIT_START(cloth_step)
/* call the solver. */
if (solvers [clmd->sim_parms->solver_type].solver)
ret = solvers[clmd->sim_parms->solver_type].solver(ob, framenr, clmd, effectors);
- tend();
+ // TIMEIT_END(cloth_step)
pdEndEffectors(&effectors);
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index af9bb971d05..6631afcddaf 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -161,8 +161,6 @@ void bvhtree_update_from_mvert(BVHTree * bvhtree, MFace *faces, int numfaces, MV
/***********************************
Collision modifier code end
***********************************/
-#define mySWAP(a, b) do { double tmp = b ; b = a ; a = tmp ; } while (0)
-
// w3 is not perfect
static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3 )
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index d65c81b4f9b..b66bd1fd32b 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -49,6 +49,7 @@
#include "BKE_fcurve.h"
+#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -174,6 +175,7 @@ void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], con
}
curvemapping_set_black_white_ex(cumap->black, cumap->white, cumap->bwmul);
+ cumap->changed_timestamp++;
}
/* ***************** operations on single curve ************* */
@@ -260,7 +262,7 @@ CurveMapPoint *curvemap_insert(CurveMap *cuma, float x, float y)
return newcmp;
}
-void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
+void curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope)
{
if (cuma->curve)
MEM_freeN(cuma->curve);
@@ -479,7 +481,7 @@ static float curvemap_calc_extend(const CurveMap *cuma, float x, const float fir
}
/* only creates a table for a single channel in CurveMapping */
-static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
+static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
{
CurveMapPoint *cmp = cuma->curve;
BezTriple *bezt;
@@ -677,7 +679,7 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
CurveMap *cuma = cumap->cm + cumap->cur;
CurveMapPoint *cmp = cuma->curve;
rctf *clipr = &cumap->clipr;
- float thresh = 0.01f * BLI_RCT_SIZE_X(clipr);
+ float thresh = 0.01f * BLI_rctf_size_x(clipr);
float dx = 0.0f, dy = 0.0f;
int a;
@@ -996,7 +998,8 @@ static void save_sample_line(Scopes *scopes, const int idx, const float fx, cons
}
}
-void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const short use_color_management)
+void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorManagedViewSettings *view_settings,
+ const ColorManagedDisplaySettings *display_settings)
{
int i, x, y;
float *fp;
@@ -1008,6 +1011,8 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const short
int y1 = 0.5f + hist->co[0][1] * ibuf->y;
int y2 = 0.5f + hist->co[1][1] * ibuf->y;
+ struct ColormanageProcessor *cm_processor = NULL;
+
hist->channels = 3;
hist->x_resolution = 256;
hist->xmax = 1.0f;
@@ -1015,6 +1020,9 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const short
if (ibuf->rect == NULL && ibuf->rect_float == NULL) return;
+ if (ibuf->rect_float)
+ cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
+
/* persistent draw */
hist->flag |= HISTO_FLAG_SAMPLELINE; /* keep drawing the flag after */
@@ -1029,10 +1037,8 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const short
if (ibuf->rect_float) {
fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
- if (use_color_management)
- linearrgb_to_srgb_v3_v3(rgb, fp);
- else
- copy_v3_v3(rgb, fp);
+ copy_v3_v3(rgb, fp);
+ IMB_colormanagement_processor_apply_v3(cm_processor, rgb);
hist->data_luma[i] = rgb_to_luma(rgb);
hist->data_r[i] = rgb[0];
@@ -1050,9 +1056,13 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const short
}
}
}
+
+ if (cm_processor)
+ IMB_colormanagement_processor_free(cm_processor);
}
-void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
+void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings *view_settings,
+ const ColorManagedDisplaySettings *display_settings)
{
int x, y, c;
unsigned int n, nl;
@@ -1065,6 +1075,8 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
int ycc_mode = -1;
const short is_float = (ibuf->rect_float != NULL);
+ struct ColormanageProcessor *cm_processor = NULL;
+
if (ibuf->rect == NULL && ibuf->rect_float == NULL) return;
if (scopes->ok == 1) return;
@@ -1134,6 +1146,9 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
else
rc = (unsigned char *)ibuf->rect;
+ if (ibuf->rect_float)
+ cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
+
for (y = 0; y < ibuf->y; y++) {
if (savedlines < scopes->sample_lines && y >= ((savedlines) * ibuf->y) / (scopes->sample_lines + 1)) {
saveline = 1;
@@ -1144,11 +1159,8 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
for (x = 0; x < ibuf->x; x++) {
if (is_float) {
- if (use_color_management)
- linearrgb_to_srgb_v3_v3(rgba, rf);
- else
- copy_v3_v3(rgba, rf);
- rgba[3] = rf[3];
+ copy_v4_v4(rgba, rf);
+ IMB_colormanagement_processor_apply_v4(cm_processor, rgba);
}
else {
for (c = 0; c < 4; c++)
@@ -1219,6 +1231,9 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
MEM_freeN(bin_b);
MEM_freeN(bin_a);
+ if (cm_processor)
+ IMB_colormanagement_processor_free(cm_processor);
+
scopes->ok = 1;
}
@@ -1257,3 +1272,58 @@ void scopes_new(Scopes *scopes)
scopes->waveform_3 = NULL;
scopes->vecscope = NULL;
}
+
+void BKE_color_managed_display_settings_init(ColorManagedDisplaySettings *settings)
+{
+ const char *display_name = IMB_colormanagement_display_get_default_name();
+
+ BLI_strncpy(settings->display_device, display_name, sizeof(settings->display_device));
+}
+
+void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_settings,
+ const ColorManagedDisplaySettings *settings)
+{
+ BLI_strncpy(new_settings->display_device, settings->display_device, sizeof(new_settings->display_device));
+}
+
+void BKE_color_managed_view_settings_init(ColorManagedViewSettings *settings)
+{
+ /* OCIO_TODO: use default view transform here when OCIO is completely integrated
+ * and proper versioning stuff is added.
+ * for now use NONE to be compatible with all current files
+ */
+ BLI_strncpy(settings->view_transform, "Default", sizeof(settings->view_transform));
+
+ settings->gamma = 1.0f;
+ settings->exposure = 0.0f;
+}
+
+void BKE_color_managed_view_settings_copy(ColorManagedViewSettings *new_settings,
+ const ColorManagedViewSettings *settings)
+{
+ BLI_strncpy(new_settings->view_transform, settings->view_transform, sizeof(new_settings->view_transform));
+
+ new_settings->flag = settings->flag;
+ new_settings->exposure = settings->exposure;
+ new_settings->gamma = settings->gamma;
+
+ if (settings->curve_mapping)
+ new_settings->curve_mapping = curvemapping_copy(settings->curve_mapping);
+}
+
+void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings)
+{
+ if (settings->curve_mapping)
+ curvemapping_free(settings->curve_mapping);
+}
+
+void BKE_color_managed_colorspace_settings_init(ColorManagedColorspaceSettings *colorspace_settings)
+{
+ BLI_strncpy(colorspace_settings->name, "", sizeof(colorspace_settings->name));
+}
+
+void BKE_color_managed_colorspace_settings_copy(ColorManagedColorspaceSettings *colorspace_settings,
+ const ColorManagedColorspaceSettings *settings)
+{
+ BLI_strncpy(colorspace_settings->name, settings->name, sizeof(colorspace_settings->name));
+}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 6b9e0921c3b..e3f7ae1b1c7 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1030,7 +1030,6 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
if (VALID_CONS_TARGET(ct)) {
float size[3], vec[3];
float totmat[3][3];
- float tmat[4][4];
/* Get size property, since ob->size is only the object's own relative size, not its global one */
mat4_to_size(size, cob->matrix);
@@ -1053,9 +1052,8 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
vectomat(vec, ct->matrix[2],
(short)data->reserved1, (short)data->reserved2,
data->flags, totmat);
-
- copy_m4_m4(tmat, cob->matrix);
- mul_m4_m3m4(cob->matrix, totmat, tmat);
+
+ mul_m4_m3m4(cob->matrix, totmat, cob->matrix);
}
}
@@ -2281,7 +2279,6 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
float totmat[3][3];
float tmpmat[3][3];
float invmat[3][3];
- float tmat[4][4];
float mdet;
/* Vector object -> target */
@@ -2509,8 +2506,6 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
totmat[1][0] = tmpmat[1][0]; totmat[1][1] = tmpmat[1][1]; totmat[1][2] = tmpmat[1][2];
totmat[2][0] = tmpmat[2][0]; totmat[2][1] = tmpmat[2][1]; totmat[2][2] = tmpmat[2][2];
- copy_m4_m4(tmat, cob->matrix);
-
mdet = determinant_m3(totmat[0][0], totmat[0][1], totmat[0][2],
totmat[1][0], totmat[1][1], totmat[1][2],
totmat[2][0], totmat[2][1], totmat[2][2]);
@@ -2519,7 +2514,7 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
}
/* apply out transformaton to the object */
- mul_m4_m3m4(cob->matrix, totmat, tmat);
+ mul_m4_m3m4(cob->matrix, totmat, cob->matrix);
}
}
@@ -2717,7 +2712,6 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
if (VALID_CONS_TARGET(ct)) {
float size[3], scale[3], vec[3], xx[3], zz[3], orth[3];
float totmat[3][3];
- float tmat[4][4];
float dist;
/* store scaling before destroying obmat */
@@ -2815,9 +2809,8 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t
normalize_v3_v3(totmat[2], zz);
break;
} /* switch (data->plane) */
-
- copy_m4_m4(tmat, cob->matrix);
- mul_m4_m3m4(cob->matrix, totmat, tmat);
+
+ mul_m4_m3m4(cob->matrix, totmat, cob->matrix);
}
}
@@ -4061,32 +4054,36 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
copy_v3_v3(cob->matrix[3], disp);
}
- if (data->depth_ob && data->depth_ob->derivedFinal) {
+ if (data->depth_ob) {
Object *depth_ob = data->depth_ob;
- BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
- BVHTreeRayHit hit;
- float ray_start[3], ray_end[3], ray_nor[3], imat[4][4];
- int result;
+ DerivedMesh *target = object_get_derived_final(depth_ob);
+ if (target) {
+ BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
+ BVHTreeRayHit hit;
+ float ray_start[3], ray_end[3], ray_nor[3], imat[4][4];
+ int result;
- invert_m4_m4(imat, depth_ob->obmat);
+ invert_m4_m4(imat, depth_ob->obmat);
- mul_v3_m4v3(ray_start, imat, camob->obmat[3]);
- mul_v3_m4v3(ray_end, imat, cob->matrix[3]);
+ mul_v3_m4v3(ray_start, imat, camob->obmat[3]);
+ mul_v3_m4v3(ray_end, imat, cob->matrix[3]);
- sub_v3_v3v3(ray_nor, ray_end, ray_start);
+ sub_v3_v3v3(ray_nor, ray_end, ray_start);
- bvhtree_from_mesh_faces(&treeData, depth_ob->derivedFinal, 0.0f, 4, 6);
+ bvhtree_from_mesh_faces(&treeData, target, 0.0f, 4, 6);
- hit.dist = FLT_MAX;
- hit.index = -1;
+ hit.dist = FLT_MAX;
+ hit.index = -1;
- result = BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData);
+ result = BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData);
- if (result != -1) {
- mul_v3_m4v3(cob->matrix[3], depth_ob->obmat, hit.co);
- }
+ if (result != -1) {
+ mul_v3_m4v3(cob->matrix[3], depth_ob->obmat, hit.co);
+ }
- free_bvhtree_from_mesh(&treeData);
+ free_bvhtree_from_mesh(&treeData);
+ target->release(target);
+ }
}
}
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index a2f88781cbb..09ca0df0680 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -429,6 +429,33 @@ void BKE_curve_texspace_calc(Curve *cu)
}
}
+int BKE_nurbList_index_get_co(ListBase *nurb, const int index, float r_co[3])
+{
+ Nurb *nu;
+ int tot = 0;
+
+ for (nu = nurb->first; nu; nu = nu->next) {
+ int tot_nu;
+ if (nu->type == CU_BEZIER) {
+ tot_nu = nu->pntsu;
+ if (index - tot < tot_nu) {
+ copy_v3_v3(r_co, nu->bezt[index - tot].vec[1]);
+ return TRUE;
+ }
+ }
+ else {
+ tot_nu = nu->pntsu * nu->pntsv;
+ if (index - tot < tot_nu) {
+ copy_v3_v3(r_co, nu->bp[index - tot].vec);
+ return TRUE;
+ }
+ }
+ tot += tot_nu;
+ }
+
+ return FALSE;
+}
+
int BKE_nurbList_verts_count(ListBase *nurb)
{
Nurb *nu;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 342ee5bba41..ba859cadf92 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -271,28 +271,6 @@ static void layerInterp_mdeformvert(void **sources, const float *weights,
BLI_linklist_free(dest_dw, linklist_free_simple);
}
-
-static void layerInterp_msticky(void **sources, const float *weights,
- const float *UNUSED(sub_weights), int count, void *dest)
-{
- float co[2], w;
- MSticky *mst;
- int i;
-
- co[0] = co[1] = 0.0f;
- for (i = 0; i < count; i++) {
- w = weights ? weights[i] : 1.0f;
- mst = (MSticky *)sources[i];
-
- madd_v2_v2fl(co, mst->co, w);
- }
-
- /* delay writing to the destination incase dest is in sources */
- mst = (MSticky *)dest;
- copy_v2_v2(mst->co, co);
-}
-
-
static void layerCopy_tface(const void *source, void *dest, int count)
{
const MTFace *source_tf = (const MTFace *)source;
@@ -1055,8 +1033,8 @@ static void layerInterp_mvert_skin(void **sources, const float *weights,
static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 0: CD_MVERT */
{sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL},
- /* 1: CD_MSTICKY */
- {sizeof(MSticky), "MSticky", 1, NULL, NULL, NULL, layerInterp_msticky, NULL,
+ /* 1: CD_MSTICKY */ /* DEPRECATED */
+ {sizeof(float) * 2, "", 1, NULL, NULL, NULL, NULL, NULL,
NULL},
/* 2: CD_MDEFORMVERT */
{sizeof(MDeformVert), "MDeformVert", 1, NULL, layerCopy_mdeformvert,
@@ -1155,7 +1133,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
{sizeof(GridPaintMask), "GridPaintMask", 1, NULL, layerCopy_grid_paint_mask,
layerFree_grid_paint_mask, NULL, NULL, NULL},
/* 36: CD_SKIN_NODE */
- {sizeof(MVertSkin), "MVertSkin", 1, "Skin", NULL, NULL,
+ {sizeof(MVertSkin), "MVertSkin", 1, NULL, NULL, NULL,
layerInterp_mvert_skin, NULL, layerDefault_mvert_skin}
};
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index b8d5294eabc..31a6f768f89 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -501,7 +501,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
if (ob->adt)
dag_add_driver_relation(ob->adt, dag, node, (ob->type == OB_ARMATURE)); // XXX isdata arg here doesn't give an accurate picture of situation
- key = ob_get_key(ob);
+ key = BKE_key_from_object(ob);
if (key && key->adt)
dag_add_driver_relation(key->adt, dag, node, 1);
@@ -2650,7 +2650,7 @@ static void dag_id_flush_update(Scene *sce, ID *id)
/* set flags based on ShapeKey */
if (idtype == ID_KE) {
for (obt = bmain->object.first; obt; obt = obt->id.next) {
- Key *key = ob_get_key(obt);
+ Key *key = BKE_key_from_object(obt);
if (!(ob && obt == ob) && ((ID *)key == id)) {
obt->flag |= (OB_RECALC_OB | OB_RECALC_DATA);
lib_id_recalc_tag(bmain, &obt->id);
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index f47ac641cf9..1cb29b90133 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -669,7 +669,7 @@ static void boundInsert(Bounds3D *b, float point[3])
}
}
-float getSurfaceDimension(PaintSurfaceData *sData)
+static float getSurfaceDimension(PaintSurfaceData *sData)
{
Bounds3D *mb = &sData->bData->mesh_bounds;
return MAX3((mb->max[0] - mb->min[0]), (mb->max[1] - mb->min[1]), (mb->max[2] - mb->min[2]));
@@ -910,7 +910,7 @@ static void free_bakeData(PaintSurfaceData *data)
}
/* free surface data if it's not used anymore */
-void surface_freeUnusedData(DynamicPaintSurface *surface)
+static void surface_freeUnusedData(DynamicPaintSurface *surface)
{
if (!surface->data) return;
@@ -1368,7 +1368,7 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
MEM_freeN(temp_data);
}
-void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
+static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
{
PaintSurfaceData *sData = surface->data;
PaintPoint *pPoint = (PaintPoint *)sData->type_data;
@@ -1605,7 +1605,7 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Deri
/*
* Apply canvas data to the object derived mesh
*/
-struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd,
+static DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd,
Object *ob,
DerivedMesh *dm)
{
@@ -1830,9 +1830,12 @@ void dynamicPaint_cacheUpdateFrames(DynamicPaintSurface *surface)
}
}
-void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMesh *dm)
+static void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMesh *dm)
{
- if (canvas->dm) canvas->dm->release(canvas->dm);
+ if (canvas->dm) {
+ canvas->dm->release(canvas->dm);
+ }
+
canvas->dm = CDDM_copy(dm);
}
@@ -2748,7 +2751,7 @@ static void dynamicPaint_freeBrushMaterials(BrushMaterials *bMats)
/*
* Get material diffuse color and alpha (including linked textures) in given coordinates
*/
-void dynamicPaint_doMaterialTex(BrushMaterials *bMats, float color[3], float *alpha, Object *brushOb, const float volume_co[3], const float surface_co[3], int faceIndex, short isQuad, DerivedMesh *orcoDm)
+static void dynamicPaint_doMaterialTex(BrushMaterials *bMats, float color[3], float *alpha, Object *brushOb, const float volume_co[3], const float surface_co[3], int faceIndex, short isQuad, DerivedMesh *orcoDm)
{
Material *mat = bMats->mat;
MFace *mface = orcoDm->getTessFaceArray(orcoDm);
@@ -3953,7 +3956,7 @@ static void dynamicPaint_prepareAdjacencyData(DynamicPaintSurface *surface, int
}
/* find two adjacency points (closest_id) and influence (closest_d) to move paint towards when affected by a force */
-void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, float force[3], float closest_d[2], int closest_id[2])
+static void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, float force[3], float closest_d[2], int closest_id[2])
{
BakeAdjPoint *bNeighs = sData->bData->bNeighs;
int numOfNeighs = sData->adj_data->n_num[index];
@@ -4342,7 +4345,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
}
}
-void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
+static void dynamicPaint_doWaveStep(DynamicPaintSurface *surface, float timescale)
{
PaintSurfaceData *sData = surface->data;
BakeAdjPoint *bNeighs = sData->bData->bNeighs;
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index befec1907da..8d430eb58b5 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -152,7 +152,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
/* don't consider two-edged faces */
- if (efa->len < 3) {
+ if (UNLIKELY(efa->len < 3)) {
/* do nothing */
}
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 538d2469a93..68321076398 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -48,10 +48,6 @@
#include "BKE_fcurve.h"
#include "BKE_idprop.h"
-
-#define SMALL -1.0e-10
-#define SELECT 1
-
/* ******************************** F-Modifiers ********************************* */
/* Info ------------------------------- */
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 0d9a69008ee..3392f6f109b 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -116,16 +116,6 @@ void BKE_group_unlink(Group *group)
if (ob->dup_group == group) {
ob->dup_group = NULL;
-#if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
- {
- bActionStrip *strip;
- /* duplicator strips use a group object, we remove it */
- for (strip = ob->nlastrips.first; strip; strip = strip->next) {
- if (strip->object)
- strip->object = NULL;
- }
- }
-#endif
}
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
@@ -389,57 +379,3 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group
}
}
}
-
-#if 0
-Object *group_get_member_with_action(Group *group, bAction *act)
-{
- GroupObject *go;
-
- if (group == NULL || act == NULL) return NULL;
-
- for (go = group->gobject.first; go; go = go->next) {
- if (go->ob) {
- if (go->ob->action == act)
- return go->ob;
- if (go->ob->nlastrips.first) {
- bActionStrip *strip;
-
- for (strip = go->ob->nlastrips.first; strip; strip = strip->next) {
- if (strip->act == act)
- return go->ob;
- }
- }
- }
- }
- return NULL;
-}
-
-/* if group has NLA, we try to map the used objects in NLA to group members */
-/* this assuming that object has received a new group link */
-void group_relink_nla_objects(Object *ob)
-{
- Group *group;
- GroupObject *go;
- bActionStrip *strip;
-
- if (ob == NULL || ob->dup_group == NULL) return;
- group = ob->dup_group;
-
- for (strip = ob->nlastrips.first; strip; strip = strip->next) {
- if (strip->object) {
- for (go = group->gobject.first; go; go = go->next) {
- if (go->ob) {
- if (strcmp(go->ob->id.name, strip->object->id.name) == 0)
- break;
- }
- }
- if (go)
- strip->object = go->ob;
- else
- strip->object = NULL;
- }
-
- }
-}
-
-#endif
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 8a49cba7649..d8c3e260399 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -65,7 +65,7 @@ static void icon_free(void *val)
Icon *icon = val;
if (icon) {
- if (icon->drawinfo_free) {
+ if (icon->drawinfo_free) {
icon->drawinfo_free(icon->drawinfo);
}
else if (icon->drawinfo) {
@@ -255,7 +255,7 @@ void BKE_icon_changed(int id)
prv->changed_timestamp[i]++;
}
}
- }
+ }
}
int BKE_icon_getid(struct ID *id)
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 8229df28ab8..8ceaab56f83 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -484,7 +484,7 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
BLI_remlink(&group->data.group, loop);
IDP_FreeProperty(loop);
- MEM_freeN(loop);
+ MEM_freeN(loop);
}
else {
group->len++;
@@ -679,7 +679,7 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
case IDP_DOUBLE:
prop = MEM_callocN(sizeof(IDProperty), "IDProperty float");
*(double *)&prop->data.val = val->d;
- break;
+ break;
case IDP_ARRAY:
{
/* for now, we only support float and int and double arrays */
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 3f756e74b26..d620fc50e86 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -47,6 +47,7 @@
#include "MEM_guardedalloc.h"
+#include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -70,6 +71,7 @@
#include "BLI_bpath.h"
#include "BKE_bmfont.h"
+#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_image.h"
@@ -243,6 +245,11 @@ static Image *image_alloc(const char *name, short source, short type)
ima->source = source;
ima->type = type;
+
+ if (source == IMA_SRC_VIEWER)
+ ima->flag |= IMA_VIEW_AS_RENDER;
+
+ BKE_color_managed_colorspace_settings_init(&ima->colorspace_settings);
}
return ima;
}
@@ -325,6 +332,8 @@ Image *BKE_image_copy(Image *ima)
nima->aspx = ima->aspx;
nima->aspy = ima->aspy;
+ BKE_color_managed_colorspace_settings_copy(&nima->colorspace_settings, &ima->colorspace_settings);
+
return nima;
}
@@ -594,7 +603,8 @@ Image *BKE_image_load_exists(const char *filepath)
return BKE_image_load(filepath);
}
-static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, float color[4])
+static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type,
+ float color[4], ColorManagedColorspaceSettings *colorspace_settings)
{
ImBuf *ibuf;
unsigned char *rect = NULL;
@@ -603,12 +613,24 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char
if (floatbuf) {
ibuf = IMB_allocImBuf(width, height, depth, IB_rectfloat);
rect_float = ibuf->rect_float;
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
+
+ if (colorspace_settings->name[0] == '\0') {
+ const char *colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_FLOAT);
+
+ BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name));
+ }
}
else {
ibuf = IMB_allocImBuf(width, height, depth, IB_rect);
rect = (unsigned char *)ibuf->rect;
- ibuf->profile = IB_PROFILE_SRGB;
+
+ if (colorspace_settings->name[0] == '\0') {
+ const char *colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
+
+ BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name));
+ }
+
+ IMB_colormanagement_assign_rect_colorspace(ibuf, colorspace_settings->name);
}
BLI_strncpy(ibuf->name, name, sizeof(ibuf->name));
@@ -643,7 +665,7 @@ Image *BKE_image_add_generated(unsigned int width, unsigned int height, const ch
ima->gen_type = gen_type;
ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
- ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color);
+ ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color, &ima->colorspace_settings);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok = IMA_OK_LOADED;
@@ -1009,6 +1031,19 @@ int BKE_imtype_supports_quality(const char imtype)
return 0;
}
+int BKE_imtype_supports_float(const char imtype)
+{
+ switch (imtype) {
+ case R_IMF_IMTYPE_CINEON:
+ case R_IMF_IMTYPE_DPX:
+ case R_IMF_IMTYPE_RADHDR:
+ case R_IMF_IMTYPE_OPENEXR:
+ case R_IMF_IMTYPE_MULTILAYER:
+ return TRUE;
+ }
+ return 0;
+}
+
char BKE_imtype_valid_channels(const char imtype)
{
char chan_flag = IMA_CHAN_FLAG_RGB; /* assume all support rgb */
@@ -1207,6 +1242,9 @@ void BKE_imformat_defaults(ImageFormatData *im_format)
im_format->imtype = R_IMF_IMTYPE_PNG;
im_format->quality = 90;
im_format->compress = 90;
+
+ BKE_color_managed_display_settings_init(&im_format->display_settings);
+ BKE_color_managed_view_settings_init(&im_format->view_settings);
}
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *imbuf)
@@ -1477,10 +1515,11 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
int x, y, y_ofs;
float h_fixed;
const int mono = blf_mono_font_render; // XXX
+ struct ColorManagedDisplay *display;
+ const char *display_device;
/* this could be an argument if we want to operate on non linear float imbuf's
* for now though this is only used for renders which use scene settings */
- const int do_color_management = (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) != 0;
#define BUFF_MARGIN_X 2
#define BUFF_MARGIN_Y 1
@@ -1488,6 +1527,9 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
if (!rect && !rectf)
return;
+ display_device = scene->display_settings.display_device;
+ display = IMB_colormanagement_display_get_named(display_device);
+
stampdata(scene, camera, &stamp_data, 1);
/* TODO, do_versions */
@@ -1497,7 +1539,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
/* set before return */
BLF_size(mono, scene->r.stamp_font_id, 72);
- BLF_buffer(mono, rectf, rect, width, height, channels, do_color_management);
+ BLF_buffer(mono, rectf, rect, width, height, channels, display);
BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
pad = BLF_width_max(mono);
@@ -1514,7 +1556,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
y -= h;
/* also a little of space to the background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
/* and draw the text. */
@@ -1531,7 +1573,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
y -= h;
/* and space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1547,7 +1589,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
y -= h;
/* and space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1563,7 +1605,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
y -= h;
/* and space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
0, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1578,7 +1620,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
BLF_width_and_height(mono, stamp_data.marker, &w, &h); h = h_fixed;
/* extra space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
/* and pad the text. */
@@ -1594,7 +1636,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
BLF_width_and_height(mono, stamp_data.time, &w, &h); h = h_fixed;
/* extra space for background */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
/* and pad the text. */
@@ -1609,7 +1651,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
BLF_width_and_height(mono, stamp_data.frame, &w, &h); h = h_fixed;
/* extra space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
/* and pad the text. */
@@ -1624,7 +1666,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
BLF_width_and_height(mono, stamp_data.camera, &w, &h); h = h_fixed;
/* extra space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.camera);
@@ -1637,7 +1679,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
BLF_width_and_height(mono, stamp_data.cameralens, &w, &h); h = h_fixed;
/* extra space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.cameralens);
@@ -1650,7 +1692,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
x = width - w - 2;
/* extra space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
/* and pad the text. */
@@ -1666,7 +1708,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
y = height - h;
/* extra space for background. */
- buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, do_color_management,
+ buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, display,
x - BUFF_MARGIN_X, y - BUFF_MARGIN_Y, x + w + BUFF_MARGIN_X, y + h + BUFF_MARGIN_Y);
BLF_position(mono, x, y + y_ofs, 0.0);
@@ -1878,12 +1920,12 @@ void BKE_makepicstring(char *string, const char *base, const char *relbase, int
}
/* used by sequencer too */
-struct anim *openanim(const char *name, int flags, int streamindex)
+struct anim *openanim(const char *name, int flags, int streamindex, char colorspace[IMA_MAX_SPACE])
{
struct anim *anim;
struct ImBuf *ibuf;
- anim = IMB_open_anim(name, flags, streamindex);
+ anim = IMB_open_anim(name, flags, streamindex, colorspace);
if (anim == NULL) return NULL;
ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
@@ -2177,8 +2219,10 @@ void BKE_image_backup_render(Scene *scene, Image *ima)
/* in that case we have to build a render-result */
static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
{
+ const char *colorspace = ima->colorspace_settings.name;
+ int predivide = ima->flag & IMA_CM_PREDIVIDE;
- ima->rr = RE_MultilayerConvert(ibuf->userdata, ibuf->x, ibuf->y);
+ ima->rr = RE_MultilayerConvert(ibuf->userdata, colorspace, predivide, ibuf->x, ibuf->y);
#ifdef WITH_OPENEXR
IMB_exr_close(ibuf->userdata);
@@ -2226,7 +2270,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
flag |= IB_premul;
/* read ibuf */
- ibuf = IMB_loadiffname(name, flag);
+ ibuf = IMB_loadiffname(name, flag, ima->colorspace_settings.name);
#if 0
if (ibuf) {
@@ -2304,7 +2348,6 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
ibuf->flags |= IB_rectfloat;
ibuf->mall = IB_rectfloat;
ibuf->channels = rpass->channels;
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
image_initialize_after_load(ima, ibuf);
image_assign_ibuf(ima, ibuf, iuser ? iuser->multi_index : 0, frame);
@@ -2334,7 +2377,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
BKE_image_user_file_path(iuser, ima, str);
/* FIXME: make several stream accessible in image editor, too*/
- ima->anim = openanim(str, IB_rect, 0);
+ ima->anim = openanim(str, IB_rect, 0, ima->colorspace_settings.name);
/* let's initialize this user */
if (ima->anim && iuser && iuser->frames == 0)
@@ -2385,8 +2428,8 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
flag = IB_rect | IB_multilayer;
if (ima->flag & IMA_DO_PREMUL) flag |= IB_premul;
- ibuf = IMB_ibImageFromMemory((unsigned char *)ima->packedfile->data,
- ima->packedfile->size, flag, "<packed data>");
+ ibuf = IMB_ibImageFromMemory((unsigned char *)ima->packedfile->data, ima->packedfile->size, flag,
+ ima->colorspace_settings.name, "<packed data>");
}
else {
flag = IB_rect | IB_multilayer | IB_metadata;
@@ -2398,7 +2441,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
BKE_image_user_file_path(iuser, ima, str);
/* read ibuf */
- ibuf = IMB_loadiffname(str, flag);
+ ibuf = IMB_loadiffname(str, flag, ima->colorspace_settings.name);
}
if (ibuf) {
@@ -2455,7 +2498,6 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
ibuf->rect_float = rpass->rect;
ibuf->flags |= IB_rectfloat;
ibuf->channels = rpass->channels;
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
image_assign_ibuf(ima, ibuf, iuser ? iuser->multi_index : IMA_NO_INDEX, 0);
}
@@ -2561,6 +2603,13 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
}
+ /* invalidate color managed buffers if render result changed */
+ BLI_lock_thread(LOCK_COLORMANAGE);
+ if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf)
+ {
+ ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+ }
+
ibuf->x = rres.rectx;
ibuf->y = rres.recty;
@@ -2592,8 +2641,8 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
ibuf->flags &= ~IB_zbuffloat;
}
- /* since its possible to access the buffer from the image directly, set the profile [#25073] */
- ibuf->profile = (iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) ? IB_PROFILE_LINEAR_RGB : IB_PROFILE_NONE;
+ BLI_unlock_thread(LOCK_COLORMANAGE);
+
ibuf->dither = dither;
if (iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE) {
@@ -2750,7 +2799,8 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
/* UV testgrid or black or solid etc */
if (ima->gen_x == 0) ima->gen_x = 1024;
if (ima->gen_y == 0) ima->gen_y = 1024;
- ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type, color);
+ ibuf = add_ibuf_size(ima->gen_x, ima->gen_y, ima->name, 24, (ima->gen_flag & IMA_GEN_FLOAT) != 0, ima->gen_type,
+ color, &ima->colorspace_settings);
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
ima->ok = IMA_OK_LOADED;
}
@@ -2966,5 +3016,8 @@ void BKE_image_get_aspect(Image *image, float *aspx, float *aspy)
*aspx = 1.0;
/* x is always 1 */
- *aspy = image->aspy / image->aspx;
+ if (image)
+ *aspy = image->aspy / image->aspx;
+ else
+ *aspy = 1.0f;
}
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 4d7013b9f73..37572eebed6 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -289,7 +289,11 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
BLF_size(mono, 54, 72); /* hard coded size! */
- BLF_buffer(mono, rect_float, rect, width, height, 4, TRUE);
+ /* OCIO_TODO: using NULL as display will assume using sRGB display
+ * this is correct since currently generated images are assumed to be in sRGB space,
+ * but this would probably needed to be fixed in some way
+ */
+ BLF_buffer(mono, rect_float, rect, width, height, 4, NULL);
for (y = 0; y < height; y += step) {
text[1] = '1';
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 1c6974b2615..ebb95a6561e 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -48,8 +48,11 @@
#include "BKE_global.h"
-#define CLOTH_OPENMP_LIMIT 512
+#ifdef _OPENMP
+# define CLOTH_OPENMP_LIMIT 512
+#endif
+#if 0 /* debug timing */
#ifdef _WIN32
#include <windows.h>
static LARGE_INTEGER _itstart, _itend;
@@ -81,7 +84,7 @@ double itval(void)
static struct timeval _itstart, _itend;
static struct timezone itz;
-void itstart(void)
+static void itstart(void)
{
gettimeofday(&_itstart, &itz);
}
@@ -89,7 +92,7 @@ static void itend(void)
{
gettimeofday(&_itend, &itz);
}
-double itval(void)
+static double itval(void)
{
double t1, t2;
t1 = (double)_itstart.tv_sec + (double)_itstart.tv_usec/(1000*1000);
@@ -97,6 +100,7 @@ double itval(void)
return t2-t1;
}
#endif
+#endif /* debug timing */
static float I[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
static float ZERO[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
@@ -1691,13 +1695,13 @@ static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVect
mul_bfmatrix_lfvector(dFdXmV, dFdX, lV);
add_lfvectorS_lfvectorS(B, lF, dt, dFdXmV, (dt*dt), numverts);
-
- itstart();
-
+
+ // itstart();
+
cg_filtered(dV, A, B, z, S); /* conjugate gradient algorithm to solve Ax=b */
// cg_filtered_pre(dV, A, B, z, S, P, Pinv, bigI);
-
- itend();
+
+ // itend();
// printf("cg_filtered calc time: %f\n", (float)itval());
cp_lfvector(olddV, dV, numverts);
@@ -1713,7 +1717,7 @@ static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVect
* (edge distance constraints) in a lagrangian solver. then add forces to help
* guide the implicit solver to that state. this function is called after
* collisions*/
-int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float (*initial_cos)[3], float UNUSED(step), float dt)
+static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothModifierData * clmd, float (*initial_cos)[3], float UNUSED(step), float dt)
{
Cloth *cloth= clmd->clothObject;
float (*cos)[3] = MEM_callocN(sizeof(float)*3*cloth->numverts, "cos cloth_calc_helper_forces");
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index b79608342dd..5b05ce02104 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -94,7 +94,7 @@ void BKE_key_free(Key *key)
}
-void free_key_nolib(Key *key)
+void BKE_key_free_nolib(Key *key)
{
KeyBlock *kb;
@@ -121,7 +121,7 @@ void free_key_nolib(Key *key)
/* from misc_util: flip the bytes from x */
/* #define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1]) */
-Key *add_key(ID *id) /* common function */
+Key *BKE_key_add(ID *id) /* common function */
{
Key *key;
char *el;
@@ -196,7 +196,7 @@ Key *BKE_key_copy(Key *key)
}
-Key *copy_key_nolib(Key *key)
+Key *BKE_key_copy_nolib(Key *key)
{
Key *keyn;
KeyBlock *kbn, *kb;
@@ -241,7 +241,7 @@ void BKE_key_make_local(Key *key)
* currently being called.
*/
-void sort_keys(Key *key)
+void BKE_key_sort(Key *key)
{
KeyBlock *kb;
KeyBlock *kb2;
@@ -711,7 +711,7 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
}
}
-void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *key, KeyBlock *actkb, const int mode)
+void BKE_key_evaluate_relative(const int start, int end, const int tot, char *basispoin, Key *key, KeyBlock *actkb, const int mode)
{
KeyBlock *kb;
int *ofsp, ofs[3], elemsize, b;
@@ -1071,7 +1071,7 @@ static float *get_weights_array(Object *ob, char *vgroup)
static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
{
- KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
+ KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
float t[4];
int flag = 0;
@@ -1106,7 +1106,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
kb->weights = get_weights_array(ob, kb->vgroup);
}
- do_rel_key(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY);
+ BKE_key_evaluate_relative(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY);
for (kb = key->block.first; kb; kb = kb->next) {
if (kb->weights) MEM_freeN(kb->weights);
@@ -1154,11 +1154,11 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const
for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) {
if (nu->bp) {
step = nu->pntsu * nu->pntsv;
- do_rel_key(a, a + step, tot, out, key, actkb, KEY_MODE_BPOINT);
+ BKE_key_evaluate_relative(a, a + step, tot, out, key, actkb, KEY_MODE_BPOINT);
}
else if (nu->bezt) {
step = 3 * nu->pntsu;
- do_rel_key(a, a + step, tot, out, key, actkb, KEY_MODE_BEZTRIPLE);
+ BKE_key_evaluate_relative(a, a + step, tot, out, key, actkb, KEY_MODE_BEZTRIPLE);
}
else {
step = 0;
@@ -1169,7 +1169,7 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const
static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
{
Curve *cu = ob->data;
- KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
+ KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
float t[4];
int flag = 0;
@@ -1251,7 +1251,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
{
Lattice *lt = ob->data;
- KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
+ KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
float t[4];
int flag;
@@ -1277,7 +1277,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
for (kb = key->block.first; kb; kb = kb->next)
kb->weights = get_weights_array(ob, kb->vgroup);
- do_rel_key(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY);
+ BKE_key_evaluate_relative(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY);
for (kb = key->block.first; kb; kb = kb->next) {
if (kb->weights) MEM_freeN(kb->weights);
@@ -1302,8 +1302,8 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
/* returns key coordinates (+ tilt) when key applied, NULL otherwise */
float *do_ob_key(Scene *scene, Object *ob)
{
- Key *key = ob_get_key(ob);
- KeyBlock *actkb = ob_get_keyblock(ob);
+ Key *key = BKE_key_from_object(ob);
+ KeyBlock *actkb = BKE_keyblock_from_object(ob);
char *out;
int tot = 0, size = 0;
@@ -1386,7 +1386,7 @@ float *do_ob_key(Scene *scene, Object *ob)
return (float *)out;
}
-Key *ob_get_key(Object *ob)
+Key *BKE_key_from_object(Object *ob)
{
if (ob == NULL) return NULL;
@@ -1405,7 +1405,7 @@ Key *ob_get_key(Object *ob)
return NULL;
}
-KeyBlock *add_keyblock(Key *key, const char *name)
+KeyBlock *BKE_keyblock_add(Key *key, const char *name)
{
KeyBlock *kb;
float curpos = -0.1;
@@ -1439,7 +1439,7 @@ KeyBlock *add_keyblock(Key *key, const char *name)
/**
* \note caller may want to set this to current time, but don't do it here since we need to sort
- * which could cause problems in some cases, see #add_keyblock_ctime */
+ * which could cause problems in some cases, see #BKE_keyblock_add_ctime */
kb->pos = curpos + 0.1f; /* only used for absolute shape keys */
return kb;
@@ -1453,22 +1453,22 @@ KeyBlock *add_keyblock(Key *key, const char *name)
* \param name Optional name for the new keyblock.
* \param do_force always use ctime even for relative keys.
*/
-KeyBlock *add_keyblock_ctime(Key *key, const char *name, const short do_force)
+KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const short do_force)
{
- KeyBlock *kb = add_keyblock(key, name);
+ KeyBlock *kb = BKE_keyblock_add(key, name);
if (do_force || (key->type != KEY_RELATIVE)) {
kb->pos = key->ctime / 100.0f;
- sort_keys(key);
+ BKE_key_sort(key);
}
return kb;
}
/* only the active keyblock */
-KeyBlock *ob_get_keyblock(Object *ob)
+KeyBlock *BKE_keyblock_from_object(Object *ob)
{
- Key *key = ob_get_key(ob);
+ Key *key = BKE_key_from_object(ob);
if (key) {
KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
@@ -1478,9 +1478,9 @@ KeyBlock *ob_get_keyblock(Object *ob)
return NULL;
}
-KeyBlock *ob_get_reference_keyblock(Object *ob)
+KeyBlock *BKE_keyblock_from_object_reference(Object *ob)
{
- Key *key = ob_get_key(ob);
+ Key *key = BKE_key_from_object(ob);
if (key)
return key->refkey;
@@ -1489,7 +1489,7 @@ KeyBlock *ob_get_reference_keyblock(Object *ob)
}
/* get the appropriate KeyBlock given an index */
-KeyBlock *key_get_keyblock(Key *key, int index)
+KeyBlock *BKE_keyblock_from_key(Key *key, int index)
{
KeyBlock *kb;
int i;
@@ -1509,18 +1509,29 @@ KeyBlock *key_get_keyblock(Key *key, int index)
}
/* get the appropriate KeyBlock given a name to search for */
-KeyBlock *key_get_named_keyblock(Key *key, const char name[])
+KeyBlock *BKE_keyblock_find_name(Key *key, const char name[])
{
- if (key && name)
- return BLI_findstring(&key->block, name, offsetof(KeyBlock, name));
-
- return NULL;
+ return BLI_findstring(&key->block, name, offsetof(KeyBlock, name));
+}
+
+/**
+ * \brief copy shape-key attributes, but not key data.or name/uid
+ */
+void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src)
+{
+ kb_dst->pos = kb_src->pos;
+ kb_dst->curval = kb_src->curval;
+ kb_dst->type = kb_src->type;
+ kb_dst->relative = kb_src->relative;
+ BLI_strncpy(kb_dst->vgroup, kb_src->vgroup, sizeof(kb_dst->vgroup));
+ kb_dst->slidermin = kb_src->slidermin;
+ kb_dst->slidermax = kb_src->slidermax;
}
/* Get RNA-Path for 'value' setting of the given ShapeKey
* NOTE: the user needs to free the returned string once they're finish with it
*/
-char *key_get_curValue_rnaPath(Key *key, KeyBlock *kb)
+char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb)
{
PointerRNA ptr;
PropertyRNA *prop;
@@ -1542,7 +1553,7 @@ char *key_get_curValue_rnaPath(Key *key, KeyBlock *kb)
/* conversion functions */
/************************* Lattice ************************/
-void latt_to_key(Lattice *lt, KeyBlock *kb)
+void BKE_key_convert_from_lattice(Lattice *lt, KeyBlock *kb)
{
BPoint *bp;
float *fp;
@@ -1563,7 +1574,7 @@ void latt_to_key(Lattice *lt, KeyBlock *kb)
}
}
-void key_to_latt(KeyBlock *kb, Lattice *lt)
+void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt)
{
BPoint *bp;
float *fp;
@@ -1581,7 +1592,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
}
/************************* Curve ************************/
-void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
+void BKE_key_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb)
{
Nurb *nu;
BezTriple *bezt;
@@ -1632,7 +1643,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
}
}
-void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
+void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
{
Nurb *nu;
BezTriple *bezt;
@@ -1683,7 +1694,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
}
/************************* Mesh ************************/
-void mesh_to_key(Mesh *me, KeyBlock *kb)
+void BKE_key_convert_from_mesh(Mesh *me, KeyBlock *kb)
{
MVert *mvert;
float *fp;
@@ -1704,7 +1715,7 @@ void mesh_to_key(Mesh *me, KeyBlock *kb)
}
}
-void key_to_mesh(KeyBlock *kb, Mesh *me)
+void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
{
MVert *mvert;
float *fp;
@@ -1721,7 +1732,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
}
/************************* vert coords ************************/
-float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
+float (*BKE_key_convert_to_vertcos(Object * ob, KeyBlock * kb))[3]
{
float (*vertCos)[3], *co;
float *fp = kb->data;
@@ -1743,7 +1754,7 @@ float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
if (tot == 0) return NULL;
- vertCos = MEM_callocN(tot * sizeof(*vertCos), "key_to_vertcos vertCos");
+ vertCos = MEM_callocN(tot * sizeof(*vertCos), "BKE_key_convert_to_vertcos vertCos");
/* Copy coords to array */
co = (float *)vertCos;
@@ -1797,7 +1808,7 @@ float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
return vertCos;
}
-void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
+void BKE_key_convert_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
{
float *co = (float *)vertCos, *fp;
int tot = 0, a, elemsize;
@@ -1826,7 +1837,7 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
return;
}
- fp = kb->data = MEM_callocN(tot * elemsize, "key_to_vertcos vertCos");
+ fp = kb->data = MEM_callocN(tot * elemsize, "BKE_key_convert_to_vertcos vertCos");
/* Copy coords to keyblock */
@@ -1877,7 +1888,7 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
}
}
-void offset_to_key(Object *ob, KeyBlock *kb, float (*ofs)[3])
+void BKE_key_convert_from_offset(Object *ob, KeyBlock *kb, float (*ofs)[3])
{
int a;
float *co = (float *)ofs, *fp = kb->data;
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 97b46d4829d..3564071334c 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1112,7 +1112,8 @@ static int BKE_mask_evaluate_parent(MaskParent *parent, float ctime, float r_co[
return FALSE;
}
-int BKE_mask_evaluate_parent_delta(MaskParent *parent, float ctime, float r_delta[2])
+/* could make external but for now its only used internally */
+static int mask_evaluate_parent_delta(MaskParent *parent, float ctime, float r_delta[2])
{
float parent_co[2];
@@ -1452,7 +1453,7 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const int do
*point_deform = *point;
point_deform->uw = point->uw ? MEM_dupallocN(point->uw) : NULL;
- if (BKE_mask_evaluate_parent_delta(&point->parent, ctime, delta)) {
+ if (mask_evaluate_parent_delta(&point->parent, ctime, delta)) {
add_v2_v2(point_deform->bezt.vec[0], delta);
add_v2_v2(point_deform->bezt.vec[1], delta);
add_v2_v2(point_deform->bezt.vec[2], delta);
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 18617f0ef2e..1a9ac9dc0af 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -253,9 +253,9 @@ void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
}
-void maskrasterize_spline_differentiate_point_outset(float (*diff_feather_points)[2], float (*diff_points)[2],
- const unsigned int tot_diff_point, const float ofs,
- const short do_test)
+static void maskrasterize_spline_differentiate_point_outset(float (*diff_feather_points)[2], float (*diff_points)[2],
+ const unsigned int tot_diff_point, const float ofs,
+ const short do_test)
{
unsigned int k_prev = tot_diff_point - 2;
unsigned int k_curr = tot_diff_point - 1;
@@ -410,8 +410,8 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
{
MemArena *arena = BLI_memarena_new(1 << 16, __func__);
- const float bucket_dim_x = BLI_RCT_SIZE_X(&layer->bounds);
- const float bucket_dim_y = BLI_RCT_SIZE_Y(&layer->bounds);
+ const float bucket_dim_x = BLI_rctf_size_x(&layer->bounds);
+ const float bucket_dim_y = BLI_rctf_size_y(&layer->bounds);
layer->buckets_x = (bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
layer->buckets_y = (bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index fc1c5e43cbf..3408e2393c9 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -942,7 +942,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
if (ma->texco & (TEXCO_ORCO | TEXCO_REFL | TEXCO_NORM | TEXCO_STRAND | TEXCO_STRESS)) needuv = 1;
else if (ma->texco & (TEXCO_GLOB | TEXCO_UV | TEXCO_OBJECT | TEXCO_SPEED)) needuv = 1;
- else if (ma->texco & (TEXCO_LAVECTOR | TEXCO_VIEW | TEXCO_STICKY)) needuv = 1;
+ else if (ma->texco & (TEXCO_LAVECTOR | TEXCO_VIEW)) needuv = 1;
if ((ma->mapto & MAP_NORM) && (mtex->normapspace == MTEX_NSPACE_TANGENT))
needtang = 1;
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 3925c3cc858..2030ab0f552 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -186,7 +186,7 @@ void BKE_mball_unlink(MetaBall *mb)
/* do not free mball itself */
void BKE_mball_free(MetaBall *mb)
{
- BKE_mball_unlink(mb);
+ BKE_mball_unlink(mb);
if (mb->adt) {
BKE_free_animdata((ID *)mb);
@@ -562,7 +562,7 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis)
basis = ob;
basisnr = obnr;
}
- }
+ }
}
}
@@ -691,7 +691,7 @@ static float densfunc(MetaElem *ball, float x, float y, float z)
/* *** end deprecated *** */
}
- dist2 = 1.0f - (len_v3(dvec) / ball->rad2);
+ dist2 = 1.0f - (len_squared_v3(dvec) / ball->rad2);
if ((ball->flag & MB_NEGATIVE) == 0) {
return (dist2 < 0.0f) ? -0.5f : (ball->s * dist2 * dist2 * dist2) - 0.5f;
@@ -732,7 +732,7 @@ static octal_node *find_metaball_octal_node(octal_node *node, float x, float y,
return find_metaball_octal_node(node->nodes[2], x, y, z, depth--);
else
return node;
- }
+ }
}
}
else {
@@ -762,7 +762,7 @@ static octal_node *find_metaball_octal_node(octal_node *node, float x, float y,
return find_metaball_octal_node(node->nodes[6], x, y, z, depth--);
else
return node;
- }
+ }
}
}
@@ -861,7 +861,7 @@ static void *new_pgn_element(int size)
}
BLI_freelistN(&lb);
- return NULL;
+ return NULL;
}
size = 4 * ( (size + 3) / 4);
@@ -1628,7 +1628,7 @@ static void polygonize(PROCESS *mbproc, MetaBall *mb)
for (a = 0; a < G_mb.totelem; a++) {
/* try to find 8 points on the surface for each MetaElem */
- find_first_points(mbproc, mb, a);
+ find_first_points(mbproc, mb, a);
}
/* polygonize all MetaElems of current MetaBall */
@@ -2038,7 +2038,7 @@ static void subdivide_metaball_octal_node(octal_node *node, float size_x, float
}
- /* ml belongs to the (4)5th node too */
+ /* ml belongs to the (4)5th node too */
if (ml->bb->vec[6][2] >= z) {
fill_metaball_octal_node(node, ml, 4);
}
@@ -2226,7 +2226,7 @@ static void init_metaball_octal_tree(int depth)
}
}
- /* size of first node */
+ /* size of first node */
size[0] = node->x_max - node->x_min;
size[1] = node->y_max - node->y_min;
size[2] = node->z_max - node->z_min;
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 8c3ec7e2e40..206d80a6ff0 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -367,7 +367,6 @@ void mesh_update_customdata_pointers(Mesh *me, const short do_ensure_tess_cd)
me->mvert = CustomData_get_layer(&me->vdata, CD_MVERT);
me->dvert = CustomData_get_layer(&me->vdata, CD_MDEFORMVERT);
- me->msticky = CustomData_get_layer(&me->vdata, CD_MSTICKY);
me->medge = CustomData_get_layer(&me->edata, CD_MEDGE);
@@ -1944,8 +1943,9 @@ void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpo
MVert *mv = &mverts[i];
float *no = tnorms[i];
- if (normalize_v3(no) == 0.0f)
+ if (UNLIKELY(normalize_v3(no) == 0.0f)) {
normalize_v3_v3(no, mv->co);
+ }
normal_float_to_short_v3(mv->no, no);
}
@@ -1981,8 +1981,9 @@ void BKE_mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces,
MVert *mv = &mverts[i];
float *no = tnorms[i];
- if (normalize_v3(no) == 0.0f)
+ if (UNLIKELY(normalize_v3(no) == 0.0f)) {
normalize_v3_v3(no, mv->co);
+ }
normal_float_to_short_v3(mv->no, no);
}
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 65538e5bea2..28de80a7157 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -482,7 +482,7 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
}
/* shape key modifier, not yet for curves */
- if (ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
+ if (ELEM(ob->type, OB_MESH, OB_LATTICE) && BKE_key_from_object(ob)) {
if (ob->type == OB_MESH && (ob->shapeflag & OB_SHAPE_EDIT_MODE))
smd.modifier.mode |= eModifierMode_Editmode | eModifierMode_OnCage;
else
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 268234c7e73..97d4c150b84 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -66,6 +66,7 @@
#include "BKE_animsys.h"
#include "BKE_constraint.h"
+#include "BKE_colortools.h"
#include "BKE_library.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -73,6 +74,7 @@
#include "BKE_image.h" /* openanim */
#include "BKE_tracking.h"
+#include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_moviecache.h"
@@ -197,19 +199,25 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
struct ImBuf *ibuf;
char name[FILE_MAX];
int loadflag, use_proxy = FALSE;
+ char *colorspace;
use_proxy = (flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
if (use_proxy) {
int undistort = user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT;
get_proxy_fname(clip, user->render_size, undistort, framenr, name);
+
+ /* proxies were built using default color space settings */
+ colorspace = NULL;
}
- else
+ else {
get_sequence_fname(clip, framenr, name);
+ colorspace = clip->colorspace_settings.name;
+ }
loadflag = IB_rect | IB_multilayer;
/* read ibuf */
- ibuf = IMB_loadiffname(name, loadflag);
+ ibuf = IMB_loadiffname(name, loadflag, colorspace);
return ibuf;
}
@@ -223,7 +231,7 @@ static void movieclip_open_anim_file(MovieClip *clip)
BLI_path_abs(str, ID_BLEND_PATH(G.main, &clip->id));
/* FIXME: make several stream accessible in image editor, too */
- clip->anim = openanim(str, IB_rect, 0);
+ clip->anim = openanim(str, IB_rect, 0, clip->colorspace_settings.name);
if (clip->anim) {
if (clip->flag & MCLIP_USE_PROXY_CUSTOM_DIR) {
@@ -383,7 +391,7 @@ static int moviecache_hashcmp(const void *av, const void *bv)
return 0;
}
-void *moviecache_getprioritydata(void *key_v)
+static void *moviecache_getprioritydata(void *key_v)
{
MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *) key_v;
MovieClipCachePriorityData *priority_data;
@@ -394,7 +402,7 @@ void *moviecache_getprioritydata(void *key_v)
return priority_data;
}
-int moviecache_getitempriority(void *last_userkey_v, void *priority_data_v)
+static int moviecache_getitempriority(void *last_userkey_v, void *priority_data_v)
{
MovieClipImBufCacheKey *last_userkey = (MovieClipImBufCacheKey *) last_userkey_v;
MovieClipCachePriorityData *priority_data = (MovieClipCachePriorityData *) priority_data_v;
@@ -402,7 +410,7 @@ int moviecache_getitempriority(void *last_userkey_v, void *priority_data_v)
return -abs(last_userkey->framenr - priority_data->framenr);
}
-void moviecache_prioritydeleter(void *priority_data_v)
+static void moviecache_prioritydeleter(void *priority_data_v)
{
MovieClipCachePriorityData *priority_data = (MovieClipCachePriorityData *) priority_data_v;
@@ -478,6 +486,7 @@ static MovieClip *movieclip_alloc(const char *name)
clip->aspx = clip->aspy = 1.0f;
BKE_tracking_settings_init(&clip->tracking);
+ BKE_color_managed_colorspace_settings_init(&clip->colorspace_settings);
clip->proxy.build_size_flag = IMB_PROXY_25;
clip->proxy.build_tc_flag = IMB_TC_RECORD_RUN |
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index f8f2ae86f1d..6fd7a55dd0a 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -307,17 +307,27 @@ void BKE_object_free(Object *ob)
ID *id = ob->data;
id->us--;
if (id->us == 0) {
- if (ob->type == OB_MESH) BKE_mesh_unlink(ob->data);
- else if (ob->type == OB_CURVE) BKE_curve_unlink(ob->data);
- else if (ob->type == OB_MBALL) BKE_mball_unlink(ob->data);
+ switch (ob->type) {
+ case OB_MESH:
+ BKE_mesh_unlink((Mesh *)id);
+ break;
+ case OB_CURVE:
+ BKE_curve_unlink((Curve *)id);
+ break;
+ case OB_MBALL:
+ BKE_mball_unlink((MetaBall *)id);
+ break;
+ }
}
ob->data = NULL;
}
-
- for (a = 0; a < ob->totcol; a++) {
- if (ob->mat[a]) ob->mat[a]->id.us--;
+
+ if (ob->mat) {
+ for (a = 0; a < ob->totcol; a++) {
+ if (ob->mat[a]) ob->mat[a]->id.us--;
+ }
+ MEM_freeN(ob->mat);
}
- if (ob->mat) MEM_freeN(ob->mat);
if (ob->matbits) MEM_freeN(ob->matbits);
ob->mat = NULL;
ob->matbits = NULL;
@@ -332,7 +342,7 @@ void BKE_object_free(Object *ob)
BKE_pose_free(ob->pose);
if (ob->mpath)
animviz_free_motionpath(ob->mpath);
- free_properties(&ob->prop);
+ BKE_bproperty_free_list(&ob->prop);
BKE_object_free_modifiers(ob);
free_sensors(&ob->sensors);
@@ -1079,12 +1089,12 @@ static void copy_object_pose(Object *obn, Object *ob)
}
}
-static int object_pose_context(Object *ob)
+int BKE_object_pose_context_check(Object *ob)
{
- if ( (ob) &&
- (ob->type == OB_ARMATURE) &&
- (ob->pose) &&
- (ob->mode & OB_MODE_POSE))
+ if ((ob) &&
+ (ob->type == OB_ARMATURE) &&
+ (ob->pose) &&
+ (ob->mode & OB_MODE_POSE))
{
return 1;
}
@@ -1098,12 +1108,12 @@ Object *BKE_object_pose_armature_get(Object *ob)
if (ob == NULL)
return NULL;
- if (object_pose_context(ob))
+ if (BKE_object_pose_context_check(ob))
return ob;
ob = modifiers_isDeformedByArmature(ob);
- if (object_pose_context(ob))
+ if (BKE_object_pose_context_check(ob))
return ob;
return NULL;
@@ -1147,7 +1157,7 @@ Object *BKE_object_copy(Object *ob)
}
obn->prop.first = obn->prop.last = NULL;
- copy_properties(&obn->prop, &ob->prop);
+ BKE_bproperty_copy_list(&obn->prop, &ob->prop);
copy_sensors(&obn->sensors, &ob->sensors);
copy_controllers(&obn->controllers, &ob->controllers);
@@ -1766,9 +1776,8 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4])
static void give_parvert(Object *par, int nr, float vec[3])
{
BMEditMesh *em;
- int a, count;
-
- vec[0] = vec[1] = vec[2] = 0.0f;
+
+ zero_v3(vec);
if (par->type == OB_MESH) {
Mesh *me = par->data;
@@ -1795,18 +1804,28 @@ static void give_parvert(Object *par, int nr, float vec[3])
dm = (em) ? em->derivedFinal : par->derivedFinal;
if (dm) {
- MVert *mvert = dm->getVertArray(dm);
- int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
- int i, vindex, numVerts = dm->getNumVerts(dm);
-
- /* get the average of all verts with (original index == nr) */
- count = 0;
- for (i = 0; i < numVerts; i++) {
- vindex = (index) ? index[i] : i;
-
- if (vindex == nr) {
- add_v3_v3(vec, mvert[i].co);
- count++;
+ int count = 0;
+ int numVerts = dm->getNumVerts(dm);
+
+ if (nr < numVerts) {
+ MVert *mvert = dm->getVertArray(dm);
+ int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
+ int i;
+
+ /* get the average of all verts with (original index == nr) */
+ if (index) {
+ for (i = 0; i < numVerts; i++) {
+ if (index[i] == nr) {
+ add_v3_v3(vec, mvert[i].co);
+ count++;
+ }
+ }
+ }
+ else {
+ if (nr < numVerts) {
+ add_v3_v3(vec, mvert[nr].co);
+ count++;
+ }
}
}
@@ -1828,71 +1847,31 @@ static void give_parvert(Object *par, int nr, float vec[3])
}
}
else if (ELEM(par->type, OB_CURVE, OB_SURF)) {
- Nurb *nu;
- Curve *cu;
- BPoint *bp;
- BezTriple *bezt;
- int found = 0;
- ListBase *nurbs;
-
- cu = par->data;
- nurbs = BKE_curve_nurbs_get(cu);
- nu = nurbs->first;
-
- count = 0;
- while (nu && !found) {
- if (nu->type == CU_BEZIER) {
- bezt = nu->bezt;
- a = nu->pntsu;
- while (a--) {
- if (count == nr) {
- found = 1;
- copy_v3_v3(vec, bezt->vec[1]);
- break;
- }
- count++;
- bezt++;
- }
- }
- else {
- bp = nu->bp;
- a = nu->pntsu * nu->pntsv;
- while (a--) {
- if (count == nr) {
- found = 1;
- memcpy(vec, bp->vec, sizeof(float) * 3);
- break;
- }
- count++;
- bp++;
- }
- }
- nu = nu->next;
- }
+ Curve *cu = par->data;
+ ListBase *nurb = BKE_curve_nurbs_get(cu);;
+ BKE_nurbList_index_get_co(nurb, nr, vec);
}
else if (par->type == OB_LATTICE) {
- Lattice *latt = par->data;
- BPoint *bp;
- DispList *dl = BKE_displist_find(&par->disp, DL_VERTS);
- float *co = dl ? dl->verts : NULL;
-
+ Lattice *latt = par->data;
+ DispList *dl = BKE_displist_find(&par->disp, DL_VERTS);
+ float (*co)[3] = dl ? (float (*)[3])dl->verts : NULL;
+ int tot;
+
if (latt->editlatt) latt = latt->editlatt->latt;
-
- a = latt->pntsu * latt->pntsv * latt->pntsw;
- count = 0;
- bp = latt->def;
- while (a--) {
- if (count == nr) {
- if (co)
- memcpy(vec, co, 3 * sizeof(float));
- else
- memcpy(vec, bp->vec, 3 * sizeof(float));
- break;
+
+ tot = latt->pntsu * latt->pntsv * latt->pntsw;
+
+ /* ensure dl is correct size */
+ BLI_assert(dl == NULL || dl->nr == tot);
+
+ if (nr < tot) {
+ if (co) {
+ copy_v3_v3(vec, co[nr]);
+ }
+ else {
+ copy_v3_v3(vec, latt->def[nr].vec);
}
- count++;
- if (co) co += 3;
- else bp++;
}
}
}
@@ -2899,22 +2878,22 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int
int newkey = 0;
if (key == NULL) {
- key = me->key = add_key((ID *)me);
+ key = me->key = BKE_key_add((ID *)me);
key->type = KEY_RELATIVE;
newkey = 1;
}
if (newkey || from_mix == FALSE) {
/* create from mesh */
- kb = add_keyblock_ctime(key, name, FALSE);
- mesh_to_key(me, kb);
+ kb = BKE_keyblock_add_ctime(key, name, FALSE);
+ BKE_key_convert_from_mesh(me, kb);
}
else {
/* copy from current values */
float *data = do_ob_key(scene, ob);
/* create new block with prepared data */
- kb = add_keyblock_ctime(key, name, FALSE);
+ kb = BKE_keyblock_add_ctime(key, name, FALSE);
kb->data = data;
kb->totelem = me->totvert;
}
@@ -2930,20 +2909,20 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
int newkey = 0;
if (key == NULL) {
- key = lt->key = add_key((ID *)lt);
+ key = lt->key = BKE_key_add((ID *)lt);
key->type = KEY_RELATIVE;
newkey = 1;
}
if (newkey || from_mix == FALSE) {
- kb = add_keyblock_ctime(key, name, FALSE);
+ kb = BKE_keyblock_add_ctime(key, name, FALSE);
if (!newkey) {
KeyBlock *basekb = (KeyBlock *)key->block.first;
kb->data = MEM_dupallocN(basekb->data);
kb->totelem = basekb->totelem;
}
else {
- latt_to_key(lt, kb);
+ BKE_key_convert_from_lattice(lt, kb);
}
}
else {
@@ -2951,7 +2930,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
float *data = do_ob_key(scene, ob);
/* create new block with prepared data */
- kb = add_keyblock_ctime(key, name, FALSE);
+ kb = BKE_keyblock_add_ctime(key, name, FALSE);
kb->totelem = lt->pntsu * lt->pntsv * lt->pntsw;
kb->data = data;
}
@@ -2968,21 +2947,21 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
int newkey = 0;
if (key == NULL) {
- key = cu->key = add_key((ID *)cu);
+ key = cu->key = BKE_key_add((ID *)cu);
key->type = KEY_RELATIVE;
newkey = 1;
}
if (newkey || from_mix == FALSE) {
/* create from curve */
- kb = add_keyblock_ctime(key, name, FALSE);
+ kb = BKE_keyblock_add_ctime(key, name, FALSE);
if (!newkey) {
KeyBlock *basekb = (KeyBlock *)key->block.first;
kb->data = MEM_dupallocN(basekb->data);
kb->totelem = basekb->totelem;
}
else {
- curve_to_key(cu, kb, lb);
+ BKE_key_convert_from_curve(cu, kb, lb);
}
}
else {
@@ -2990,7 +2969,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
float *data = do_ob_key(scene, ob);
/* create new block with prepared data */
- kb = add_keyblock_ctime(key, name, FALSE);
+ kb = BKE_keyblock_add_ctime(key, name, FALSE);
kb->totelem = BKE_nurbList_verts_count(lb);
kb->data = data;
}
@@ -3020,7 +2999,7 @@ int BKE_object_is_modified(Scene *scene, Object *ob)
{
int flag = 0;
- if (ob_get_key(ob)) {
+ if (BKE_key_from_object(ob)) {
flag |= eModifierMode_Render;
}
else {
@@ -3288,7 +3267,7 @@ void BKE_object_groups_clear(Scene *scene, Base *base, Object *object)
{
Group *group = NULL;
- BLI_assert(base->object == object);
+ BLI_assert((base == NULL) || (base->object == object));
if (scene && base == NULL) {
base = BKE_scene_base_find(scene, object);
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index b862a824d50..4f3921936e8 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -1117,19 +1117,20 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame)
/* if image is already loaded in mem, return */
if (och->ibufs_disp[f] != NULL) return;
+ /* use default color spaces since we know for sure cache files were saved with default settings too */
cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE);
- och->ibufs_disp[f] = IMB_loadiffname(string, 0);
+ och->ibufs_disp[f] = IMB_loadiffname(string, 0, NULL);
//if (och->ibufs_disp[f] == NULL) printf("error loading %s\n", string);
//else printf("loaded cache %s\n", string);
cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_FOAM);
- och->ibufs_foam[f] = IMB_loadiffname(string, 0);
+ och->ibufs_foam[f] = IMB_loadiffname(string, 0, NULL);
//if (och->ibufs_foam[f] == NULL) printf("error loading %s\n", string);
//else printf("loaded cache %s\n", string);
cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_NORMAL);
- och->ibufs_norm[f] = IMB_loadiffname(string, 0);
+ och->ibufs_norm[f] = IMB_loadiffname(string, 0, NULL);
//if (och->ibufs_norm[f] == NULL) printf("error loading %s\n", string);
//else printf("loaded cache %s\n", string);
}
@@ -1172,8 +1173,6 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
ibuf_disp = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat);
ibuf_normal = IMB_allocImBuf(res_x, res_y, 32, IB_rectfloat);
- ibuf_disp->profile = ibuf_foam->profile = ibuf_normal->profile = IB_PROFILE_LINEAR_RGB;
-
BKE_simulate_ocean(o, och->time[i], och->wave_scale, och->chop_amount);
/* add new foam */
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 26952db8fba..ef03db7ed8f 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -4539,8 +4539,8 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
/* can happen with bad pointcache or physics calculation
* since this becomes geometry, nan's and inf's crash raytrace code.
* better not allow this. */
- if (!finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) ||
- !finite(bb->vel[0]) || !finite(bb->vel[1]) || !finite(bb->vel[2]) )
+ if ((!finite(bb->vec[0])) || (!finite(bb->vec[1])) || (!finite(bb->vec[2])) ||
+ (!finite(bb->vel[0])) || (!finite(bb->vel[1])) || (!finite(bb->vel[2])) )
{
zero_v3(bb->vec);
zero_v3(bb->vel);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index bae8efa758e..2c0452bc2d1 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3776,7 +3776,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
* simulation. This should be called once per particle during a simulation
* step, after the velocity has been updated. element_size defines the scale of
* the simulation, and is typically the distance to neighbourning particles. */
-void update_courant_num(ParticleSimulationData *sim, ParticleData *pa,
+static void update_courant_num(ParticleSimulationData *sim, ParticleData *pa,
float dtime, SPHData *sphdata)
{
float relative_vel[3];
@@ -3788,8 +3788,7 @@ void update_courant_num(ParticleSimulationData *sim, ParticleData *pa,
sim->courant_num = speed * dtime / sphdata->element_size;
}
/* Update time step size to suit current conditions. */
-float update_timestep(ParticleSystem *psys, ParticleSimulationData *sim,
- float t_frac)
+static float update_timestep(ParticleSystem *psys, ParticleSimulationData *sim, float t_frac)
{
if (sim->courant_num == 0.0f)
psys->dt_frac = 1.0f;
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index 46ddce4b51b..8da4f11fed3 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -27,9 +27,12 @@
/** \file blender/blenkernel/intern/property.c
* \ingroup bke
+ *
+ * This module deals with bProperty only,
+ * they are used on blender objects in the game engine
+ * (where they get converted into C++ classes - CValue and subclasses)
*/
-
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -45,7 +48,7 @@
#include "BKE_property.h"
-void free_property(bProperty *prop)
+void BKE_bproperty_free(bProperty *prop)
{
if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
@@ -53,17 +56,17 @@ void free_property(bProperty *prop)
}
-void free_properties(ListBase *lb)
+void BKE_bproperty_free_list(ListBase *lb)
{
bProperty *prop;
while ( (prop = lb->first) ) {
BLI_remlink(lb, prop);
- free_property(prop);
+ BKE_bproperty_free(prop);
}
}
-bProperty *copy_property(bProperty *prop)
+bProperty *BKE_bproperty_copy(bProperty *prop)
{
bProperty *propn;
@@ -76,13 +79,13 @@ bProperty *copy_property(bProperty *prop)
return propn;
}
-void copy_properties(ListBase *lbn, ListBase *lbo)
+void BKE_bproperty_copy_list(ListBase *lbn, ListBase *lbo)
{
bProperty *prop, *propn;
- free_properties(lbn); /* in case we are copying to an object with props */
+ BKE_bproperty_free_list(lbn); /* in case we are copying to an object with props */
prop = lbo->first;
while (prop) {
- propn = copy_property(prop);
+ propn = BKE_bproperty_copy(prop);
BLI_addtail(lbn, propn);
prop = prop->next;
}
@@ -90,7 +93,7 @@ void copy_properties(ListBase *lbn, ListBase *lbo)
}
-void init_property(bProperty *prop)
+void BKE_bproperty_init(bProperty *prop)
{
/* also use when property changes type */
@@ -113,22 +116,22 @@ void init_property(bProperty *prop)
}
-bProperty *new_property(int type)
+bProperty *BKE_bproperty_new(int type)
{
bProperty *prop;
prop = MEM_callocN(sizeof(bProperty), "property");
prop->type = type;
- init_property(prop);
+ BKE_bproperty_init(prop);
strcpy(prop->name, "prop");
return prop;
}
-/* used by unique_property() only */
-static bProperty *get_property__internal(bProperty *first, bProperty *self, const char *name)
+/* used by BKE_bproperty_unique() only */
+static bProperty *bproperty_get(bProperty *first, bProperty *self, const char *name)
{
bProperty *p;
for (p = first; p; p = p->next) {
@@ -137,7 +140,7 @@ static bProperty *get_property__internal(bProperty *first, bProperty *self, cons
}
return NULL;
}
-void unique_property(bProperty *first, bProperty *prop, int force)
+void BKE_bproperty_unique(bProperty *first, bProperty *prop, int force)
{
bProperty *p;
@@ -151,13 +154,13 @@ void unique_property(bProperty *first, bProperty *prop, int force)
if (force) {
/* change other names to make them unique */
- while ((p = get_property__internal(first, prop, prop->name))) {
- unique_property(first, p, 0);
+ while ((p = bproperty_get(first, prop, prop->name))) {
+ BKE_bproperty_unique(first, p, 0);
}
}
else {
/* change our own name until its unique */
- if (get_property__internal(first, prop, prop->name)) {
+ if (bproperty_get(first, prop, prop->name)) {
/* there is a collision */
char new_name[sizeof(prop->name)];
char base_name[sizeof(prop->name)];
@@ -175,33 +178,34 @@ void unique_property(bProperty *first, bProperty *prop, int force)
BLI_snprintf(num, sizeof(num), "%d", i++);
BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num));
strcat(new_name, num);
- } while (get_property__internal(first, prop, new_name));
+ } while (bproperty_get(first, prop, new_name));
BLI_strncpy(prop->name, new_name, sizeof(prop->name));
}
}
}
-bProperty *get_ob_property(Object *ob, const char *name)
+bProperty *BKE_bproperty_object_get(Object *ob, const char *name)
{
return BLI_findstring(&ob->prop, name, offsetof(bProperty, name));
}
-void set_ob_property(Object *ob, bProperty *propc)
+void BKE_bproperty_object_set(Object *ob, bProperty *propc)
{
bProperty *prop;
- prop = get_ob_property(ob, propc->name);
+ prop = BKE_bproperty_object_get(ob, propc->name);
if (prop) {
- free_property(prop);
+ BKE_bproperty_free(prop);
BLI_remlink(&ob->prop, prop);
}
- BLI_addtail(&ob->prop, copy_property(propc));
+ BLI_addtail(&ob->prop, BKE_bproperty_copy(propc));
}
/* negative: prop is smaller
* positive: prop is larger
*/
-int compare_property(bProperty *prop, const char *str)
+#if 0 /* UNUSED */
+int BKE_bproperty_cmp(bProperty *prop, const char *str)
{
// extern int Gdfra; /* sector.c */
float fvalue, ftest;
@@ -237,8 +241,9 @@ int compare_property(bProperty *prop, const char *str)
return 0;
}
+#endif
-void set_property(bProperty *prop, const char *str)
+void BKE_bproperty_set(bProperty *prop, const char *str)
{
// extern int Gdfra; /* sector.c */
@@ -262,7 +267,7 @@ void set_property(bProperty *prop, const char *str)
}
-void add_property(bProperty *prop, const char *str)
+void BKE_bproperty_add(bProperty *prop, const char *str)
{
// extern int Gdfra; /* sector.c */
@@ -282,7 +287,7 @@ void add_property(bProperty *prop, const char *str)
}
/* reads value of property, sets it in chars in str */
-void set_property_valstr(bProperty *prop, char *str)
+void BKE_bproperty_set_valstr(bProperty *prop, char *str)
{
// extern int Gdfra; /* sector.c */
@@ -303,11 +308,13 @@ void set_property_valstr(bProperty *prop, char *str)
}
}
+#if 0 /* UNUSED */
void cp_property(bProperty *prop1, bProperty *prop2)
{
char str[128];
- set_property_valstr(prop2, str);
+ BKE_bproperty_set_valstr(prop2, str);
- set_property(prop1, str);
+ BKE_bproperty_set(prop1, str);
}
+#endif
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 7d9d2f02c06..6c1fbbfa9a0 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -210,7 +210,7 @@ void unlink_controllers(ListBase *lb)
bController *cont;
for (cont= lb->first; cont; cont= cont->next)
- unlink_controller(cont);
+ unlink_controller(cont);
}
void free_controller(bController *cont)
@@ -536,7 +536,7 @@ void clear_sca_new_poins(void)
ob= G.main->object.first;
while (ob) {
clear_sca_new_poins_ob(ob);
- ob= ob->id.next;
+ ob= ob->id.next;
}
}
@@ -624,7 +624,7 @@ void set_sca_new_poins(void)
ob= G.main->object.first;
while (ob) {
set_sca_new_poins_ob(ob);
- ob= ob->id.next;
+ ob= ob->id.next;
}
}
@@ -696,7 +696,7 @@ void sca_remove_ob_poin(Object *obt, Object *ob)
if (sta->target == ob) sta->target = NULL;
}
act= act->next;
- }
+ }
}
/* ******************** INTERFACE ******************* */
@@ -875,3 +875,20 @@ void unlink_logicbricks(void **poin, void ***ppoin, short *tot)
return;
}
}
+
+const char *sca_state_name_get(Object *ob, short bit)
+{
+ bController *cont;
+ unsigned int mask;
+
+ mask = (1<<bit);
+ cont = ob->controllers.first;
+ while (cont) {
+ if (cont->state_mask & mask) {
+ return cont->name;
+ }
+ cont = cont->next;
+ }
+ return NULL;
+}
+
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 66647a994bc..0c0396ea758 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -57,6 +57,7 @@
#include "BKE_anim.h"
#include "BKE_animsys.h"
+#include "BKE_colortools.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
#include "BKE_group.h"
@@ -76,6 +77,8 @@
#include "RE_engine.h"
+#include "IMB_colormanagement.h"
+
//XXX #include "BIF_previewrender.h"
//XXX #include "BIF_editseq.h"
@@ -169,6 +172,11 @@ Scene *BKE_scene_copy(Scene *sce, int type)
obase = obase->next;
base = base->next;
}
+
+ /* copy color management settings */
+ BKE_color_managed_display_settings_copy(&scen->display_settings, &sce->display_settings);
+ BKE_color_managed_view_settings_copy(&scen->view_settings, &sce->view_settings);
+ BKE_color_managed_view_settings_copy(&scen->r.im_format.view_settings, &sce->r.im_format.view_settings);
}
/* tool settings */
@@ -339,6 +347,8 @@ void BKE_scene_free(Scene *sce)
MEM_freeN(sce->fps_info);
sound_destroy_scene(sce);
+
+ BKE_color_managed_view_settings_free(&sce->view_settings);
}
Scene *BKE_scene_add(const char *name)
@@ -379,7 +389,14 @@ Scene *BKE_scene_add(const char *name)
sce->r.frs_sec_base = 1;
sce->r.edgeint = 10;
sce->r.ocres = 128;
+
+ /* OCIO_TODO: for forwards compatibiliy only, so if no tonecurve are used,
+ * images would look in the same way as in current blender
+ *
+ * perhaps at some point should be completely deprecated?
+ */
sce->r.color_mgt_flag |= R_COLOR_MANAGEMENT;
+
sce->r.gauss = 1.0;
/* deprecated but keep for upwards compat */
@@ -553,6 +570,9 @@ Scene *BKE_scene_add(const char *name)
sound_create_scene(sce);
+ BKE_color_managed_display_settings_init(&sce->display_settings);
+ BKE_color_managed_view_settings_init(&sce->view_settings);
+
return sce;
}
@@ -1248,3 +1268,19 @@ void BKE_scene_base_flag_from_objects(struct Scene *scene)
base = base->next;
}
}
+
+void BKE_scene_disable_color_management(Scene *scene)
+{
+ ColorManagedDisplaySettings *display_settings = &scene->display_settings;
+ ColorManagedViewSettings *view_settings = &scene->view_settings;
+ const char *view;
+
+ /* NOTE: None display with Default view should always exist in OCIO configuration, otherwise it wouldn't work as expected */
+ BLI_strncpy(display_settings->display_device, "None", sizeof(display_settings->display_device));
+
+ view = IMB_colormanagement_view_get_default_name(display_settings->display_device);
+
+ if (view) {
+ BLI_strncpy(view_settings->view_transform, view, sizeof(view_settings->view_transform));
+ }
+}
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 4dbe0b6290c..eaf3ec384c8 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -52,6 +52,7 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
+#include "IMB_colormanagement.h"
#include "RNA_access.h"
@@ -119,13 +120,13 @@ static ImBuf *prepare_effect_imbufs(SeqRenderData context, ImBuf *ibuf1, ImBuf *
}
if (ibuf1 && !ibuf1->rect_float && out->rect_float) {
- IMB_float_from_rect_simple(ibuf1);
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf1, TRUE);
}
if (ibuf2 && !ibuf2->rect_float && out->rect_float) {
- IMB_float_from_rect_simple(ibuf2);
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf2, TRUE);
}
if (ibuf3 && !ibuf3->rect_float && out->rect_float) {
- IMB_float_from_rect_simple(ibuf3);
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf3, TRUE);
}
if (ibuf1 && !ibuf1->rect && !out->rect_float) {
@@ -137,7 +138,7 @@ static ImBuf *prepare_effect_imbufs(SeqRenderData context, ImBuf *ibuf1, ImBuf *
if (ibuf3 && !ibuf3->rect && !out->rect_float) {
IMB_rect_from_float(ibuf3);
}
-
+
return out;
}
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index 6028b40756d..b0dcad64722 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -140,7 +140,7 @@ static void modifier_apply_threaded(ImBuf *ibuf, ImBuf *mask, modifier_apply_thr
/* **** Color Balance Modifier **** */
-void colorBalance_init_data(SequenceModifierData *smd)
+static void colorBalance_init_data(SequenceModifierData *smd)
{
ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
int c;
@@ -154,7 +154,7 @@ void colorBalance_init_data(SequenceModifierData *smd)
}
}
-void colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+static void colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
@@ -173,21 +173,21 @@ static SequenceModifierTypeInfo seqModifier_ColorBalance = {
/* **** Curves Modifier **** */
-void curves_init_data(SequenceModifierData *smd)
+static void curves_init_data(SequenceModifierData *smd)
{
CurvesModifierData *cmd = (CurvesModifierData *) smd;
curvemapping_set_defaults(&cmd->curve_mapping, 4, 0.0f, 0.0f, 1.0f, 1.0f);
}
-void curves_free_data(SequenceModifierData *smd)
+static void curves_free_data(SequenceModifierData *smd)
{
CurvesModifierData *cmd = (CurvesModifierData *) smd;
curvemapping_free_data(&cmd->curve_mapping);
}
-void curves_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
+static void curves_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
{
CurvesModifierData *cmd = (CurvesModifierData *) smd;
CurvesModifierData *cmd_target = (CurvesModifierData *) target;
@@ -195,8 +195,8 @@ void curves_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
curvemapping_copy_data(&cmd_target->curve_mapping, &cmd->curve_mapping);
}
-void curves_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
- unsigned char *mask_rect, float *mask_rect_float, void *data_v)
+static void curves_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
+ unsigned char *mask_rect, float *mask_rect_float, void *data_v)
{
CurveMapping *curve_mapping = (CurveMapping *) data_v;
int x, y;
@@ -249,7 +249,7 @@ void curves_apply_threaded(int width, int height, unsigned char *rect, float *re
}
}
-void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+static void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
CurvesModifierData *cmd = (CurvesModifierData *) smd;
@@ -278,7 +278,7 @@ static SequenceModifierTypeInfo seqModifier_Curves = {
/* **** Hue Correct Modifier **** */
-void hue_correct_init_data(SequenceModifierData *smd)
+static void hue_correct_init_data(SequenceModifierData *smd)
{
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
int c;
@@ -296,14 +296,14 @@ void hue_correct_init_data(SequenceModifierData *smd)
hcmd->curve_mapping.cur = 1;
}
-void hue_correct_free_data(SequenceModifierData *smd)
+static void hue_correct_free_data(SequenceModifierData *smd)
{
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
curvemapping_free_data(&hcmd->curve_mapping);
}
-void hue_correct_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
+static void hue_correct_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
{
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
HueCorrectModifierData *hcmd_target = (HueCorrectModifierData *) target;
@@ -311,7 +311,7 @@ void hue_correct_copy_data(SequenceModifierData *target, SequenceModifierData *s
curvemapping_copy_data(&hcmd_target->curve_mapping, &hcmd->curve_mapping);
}
-void hue_correct_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
+static void hue_correct_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
unsigned char *mask_rect, float *mask_rect_float, void *data_v)
{
CurveMapping *curve_mapping = (CurveMapping *) data_v;
@@ -365,7 +365,7 @@ void hue_correct_apply_threaded(int width, int height, unsigned char *rect, floa
}
}
-void hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+static void hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
@@ -391,8 +391,8 @@ typedef struct BrightContrastThreadData {
float contrast;
} BrightContrastThreadData;
-void brightcontrast_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
- unsigned char *mask_rect, float *mask_rect_float, void *data_v)
+static void brightcontrast_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
+ unsigned char *mask_rect, float *mask_rect_float, void *data_v)
{
BrightContrastThreadData *data = (BrightContrastThreadData *) data_v;
int x, y;
@@ -460,7 +460,7 @@ void brightcontrast_apply_threaded(int width, int height, unsigned char *rect, f
}
}
-void brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+static void brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
{
BrightContrastModifierData *bcmd = (BrightContrastModifierData *) smd;
BrightContrastThreadData data;
@@ -581,6 +581,11 @@ ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, I
SequenceModifierData *smd;
ImBuf *processed_ibuf = ibuf;
+ if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
+ processed_ibuf = IMB_dupImBuf(ibuf);
+ BKE_sequencer_imbuf_from_sequencer_space(context.scene, processed_ibuf);
+ }
+
for (smd = seq->modifiers.first; smd; smd = smd->next) {
SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
@@ -605,6 +610,10 @@ ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, I
}
}
+ if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, processed_ibuf, FALSE);
+ }
+
return processed_ibuf;
}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 2596bf57f05..8d7ca94ed48 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -71,6 +71,7 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+#include "IMB_colormanagement.h"
#include "BKE_context.h"
#include "BKE_sound.h"
@@ -308,6 +309,81 @@ void BKE_sequencer_editing_free(Scene *scene)
scene->ed = NULL;
}
+/*********************** Sequencer color space functions *************************/
+
+static void sequencer_imbuf_assign_spaces(Scene *scene, ImBuf *ibuf)
+{
+ IMB_colormanagement_imbuf_assign_float_space(ibuf, &scene->sequencer_colorspace_settings);
+}
+
+void BKE_sequencer_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, int make_float)
+{
+ const char *from_colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
+ const char *to_colorspace = scene->sequencer_colorspace_settings.name;
+ int predivide = ibuf->flags & IB_cm_predivide;
+
+ if (!ibuf->rect_float) {
+ if (make_float && ibuf->rect) {
+ /* when converting byte buffer to float in sequencer we need to make float
+ * buffer be in sequencer's working space, which is currently only doable
+ * from linear space.
+ *
+ */
+
+ /*
+ * OCIO_TODO: would be nice to support direct single transform from byte to sequencer's
+ */
+
+ IMB_float_from_rect(ibuf);
+ }
+ else {
+ /* if there's only byte buffer in image it's already in compositor's working space,
+ * nothing to do here
+ */
+
+ return;
+ }
+ }
+
+ if (from_colorspace && from_colorspace[0] != '\0') {
+ if (ibuf->rect)
+ imb_freerectImBuf(ibuf);
+
+ IMB_colormanagement_transform_threaded(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels,
+ from_colorspace, to_colorspace, predivide);
+ }
+}
+
+void BKE_sequencer_imbuf_from_sequencer_space(Scene *scene, ImBuf *ibuf)
+{
+ const char *from_colorspace = scene->sequencer_colorspace_settings.name;
+ const char *to_colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
+
+ if (!ibuf->rect_float)
+ return;
+
+ if (to_colorspace && to_colorspace[0] != '\0') {
+ int predivide = ibuf->flags & IB_cm_predivide;
+
+ IMB_colormanagement_transform_threaded(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels,
+ from_colorspace, to_colorspace, predivide);
+ }
+}
+
+void BKE_sequencer_pixel_from_sequencer_space_v4(struct Scene *scene, float pixel[4])
+{
+ const char *from_colorspace = scene->sequencer_colorspace_settings.name;
+ const char *to_colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_SCENE_LINEAR);
+
+ if (to_colorspace && to_colorspace[0] != '\0') {
+ IMB_colormanagement_transform_v4(pixel, from_colorspace, to_colorspace);
+ }
+ else {
+ /* if no color management enables fallback to legacy conversion */
+ srgb_to_linearrgb_v4(pixel, pixel);
+ }
+}
+
/*********************** sequencer pipeline functions *************************/
SeqRenderData BKE_sequencer_new_render_data(Main *bmain, Scene *scene, int rectx, int recty, int preview_render_size)
@@ -597,7 +673,9 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
BLI_path_abs(str, G.main->name);
if (seq->anim) IMB_free_anim(seq->anim);
- seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
+
+ /* OCIO_TODO: support configurable input space for strips */
+ seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex, NULL);
if (!seq->anim) {
return;
@@ -1094,7 +1172,8 @@ static void seq_open_anim_file(Sequence *seq)
seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(name, G.main->name);
- seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
+ /* OCIO_TODO: support configurable input space for strips */
+ seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex, NULL);
if (seq->anim == NULL) {
return;
@@ -1200,8 +1279,9 @@ static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra)
if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) {
return NULL;
}
-
- seq->strip->proxy->anim = openanim(name, IB_rect, 0);
+
+ /* proxies are generated in default color space */
+ seq->strip->proxy->anim = openanim(name, IB_rect, 0, NULL);
}
if (seq->strip->proxy->anim == NULL) {
return NULL;
@@ -1219,7 +1299,13 @@ static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra)
}
if (BLI_exists(name)) {
- return IMB_loadiffname(name, IB_rect);
+ /* OCIO_TODO: support configurable spaces for strips */
+ ImBuf *ibuf = IMB_loadiffname(name, IB_rect, NULL);
+
+ if (ibuf)
+ sequencer_imbuf_assign_spaces(context.scene, ibuf);
+
+ return ibuf;
}
else {
return NULL;
@@ -1257,7 +1343,8 @@ static void seq_proxy_build_frame(SeqRenderData context, Sequence *seq, int cfra
ibuf->planes = 24;
BLI_make_existing_file(name);
-
+
+ /* OCIO_TODO: support per-strip color space settings */
ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat);
if (ok == 0) {
perror(name);
@@ -1706,7 +1793,7 @@ int BKE_sequencer_input_have_to_preprocess(SeqRenderData UNUSED(context), Sequen
{
float mul;
- if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_PREMUL)) {
+ if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX | SEQ_FLIPY | SEQ_MAKE_PREMUL | SEQ_MAKE_FLOAT)) {
return TRUE;
}
@@ -1826,8 +1913,9 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
}
if (seq->flag & SEQ_MAKE_FLOAT) {
- if (!ibuf->rect_float)
- IMB_float_from_rect_simple(ibuf);
+ if (!ibuf->rect_float) {
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf, TRUE);
+ }
if (ibuf->rect) {
imb_freerectImBuf(ibuf);
@@ -1893,6 +1981,8 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence *seq, float nr, I
* changing the cached image... */
ibuf = IMB_dupImBuf(ibuf);
+ sequencer_imbuf_assign_spaces(context.scene, ibuf);
+
if (nr == 0) {
BKE_sequencer_cache_put(context, seq, seq->start, SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
}
@@ -2307,7 +2397,7 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
/* opengl offscreen render */
BKE_scene_update_for_newframe(context.bmain, scene, scene->lay);
ibuf = sequencer_view3d_cb(scene, camera, context.rectx, context.recty,
- IB_rect, context.scene->r.seq_prev_type, TRUE, err_out);
+ IB_rect, context.scene->r.seq_prev_type, TRUE, FALSE, err_out);
if (ibuf == NULL) {
fprintf(stderr, "seq_render_scene_strip failed to get opengl buffer: %s\n", err_out);
}
@@ -2338,11 +2428,7 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
}
/* float buffers in the sequencer are not linear */
- if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
- ibuf->profile = IB_PROFILE_LINEAR_RGB;
- else
- ibuf->profile = IB_PROFILE_NONE;
- IMB_convert_profile(ibuf, IB_PROFILE_SRGB);
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf, FALSE);
}
else if (rres.rect32) {
ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
@@ -2442,14 +2528,14 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo
BLI_path_abs(name, G.main->name);
}
- if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) {
+ /* OCIO_TODO: support configurable space for image strips */
+ if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect, NULL))) {
/* we don't need both (speed reasons)! */
if (ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
/* all sequencer color is done in SRGB space, linear gives odd crossfades */
- if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
- IMB_convert_profile(ibuf, IB_PROFILE_NONE);
+ BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf, FALSE);
copy_to_ibuf_still(context, seq, nr, ibuf);
@@ -2497,6 +2583,7 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo
case SEQ_TYPE_MOVIECLIP:
{
ibuf = seq_render_movieclip_strip(context, seq, nr);
+ sequencer_imbuf_assign_spaces(context.scene, ibuf);
if (ibuf && use_preprocess) {
ImBuf *i = IMB_dupImBuf(ibuf);
@@ -2520,6 +2607,9 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo
}
}
+ if (ibuf)
+ sequencer_imbuf_assign_spaces(context.scene, ibuf);
+
return ibuf;
}
@@ -2561,8 +2651,10 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
}
}
- if (ibuf == NULL)
+ if (ibuf == NULL) {
ibuf = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
+ sequencer_imbuf_assign_spaces(context.scene, ibuf);
+ }
if (ibuf->x != context.rectx || ibuf->y != context.recty)
use_preprocess = TRUE;
@@ -2641,12 +2733,12 @@ static ImBuf *seq_render_strip_stack(SeqRenderData context, ListBase *seqbasep,
if (count == 1) {
out = seq_render_strip(context, seq_arr[0], cfra);
+
BKE_sequencer_cache_put(context, seq_arr[0], cfra, SEQ_STRIPELEM_IBUF_COMP, out);
return out;
}
-
for (i = count - 1; i >= 0; i--) {
int early_out;
Sequence *seq = seq_arr[i];
@@ -3946,7 +4038,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
BLI_strncpy(path, seq_load->path, sizeof(path));
BLI_path_abs(path, G.main->name);
- an = openanim(path, IB_rect, 0);
+ /* OCIO_TODO: support configurable input space for strips */
+ an = openanim(path, IB_rect, 0, NULL);
if (an == NULL)
return NULL;
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index ddcba509301..5e67e094e43 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -80,10 +80,10 @@
/* UNUSED so far, may be enabled later */
/* #define USE_SMOKE_COLLISION_DM */
-#ifdef WITH_SMOKE
-
#include "smoke_API.h"
+#ifdef WITH_SMOKE
+
#ifdef _WIN32
#include <time.h>
#include <stdio.h>
@@ -148,7 +148,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
/* Stubs to use when smoke is disabled */
struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype)) { return NULL; }
-struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; }
+// struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; }
void smoke_free(struct FLUID_3D *UNUSED(fluid)) {}
float *smoke_get_density(struct FLUID_3D *UNUSED(fluid)) { return NULL; }
void smoke_turbulence_free(struct WTURBULENCE *UNUSED(wt)) {}
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 4a88bfbfdad..4c28fe01895 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -143,7 +143,9 @@ typedef struct SB_thread_context {
} SB_thread_context;
#define NLF_BUILD 1
-#define NLF_SOLVE 2
+#if 0
+# define NLF_SOLVE 2
+#endif
#define MID_PRESERVE 1
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index f340bcb5b1e..385d1bb6fc5 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -792,7 +792,6 @@ void sound_stop_scene(struct Scene *UNUSED(scene)) {}
void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {}
float sound_sync_scene(struct Scene *UNUSED(scene)) { return NAN_FLT; }
int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
-int sound_read_sound_buffer(struct bSound *UNUSED(sound), float *UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
void sound_read_waveform(struct bSound *sound) { (void)sound; }
void sound_init_main(struct Main *bmain) { (void)bmain; }
void sound_set_cfra(int cfra) { (void)cfra; }
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 5c8192b2a62..facf0793f87 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -513,10 +513,14 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen)
w2 = (1.0f - fx + fac2 * fx * -fac) * (fy);
w4 = (fx) * (1.0f - fy + -fac2 * fy * fac);
- fac2 = 1.0f - (w1 + w2 + w4);
- fac2 = fac2 / (float)(faceLen - 3);
- for (j = 0; j < faceLen; j++)
- w[j] = fac2;
+ /* these values aren't used for tri's and cause divide by zero */
+ if (faceLen > 3) {
+ fac2 = 1.0f - (w1 + w2 + w4);
+ fac2 = fac2 / (float)(faceLen - 3);
+ for (j = 0; j < faceLen; j++) {
+ w[j] = fac2;
+ }
+ }
w[i] = w1;
w[(i - 1 + faceLen) % faceLen] = w2;
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 787def5c20b..1f1d609ae42 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -1919,6 +1919,7 @@ static unsigned int txt_undo_read_unicode(const char *undo_buf, int *undo_pos, s
break;
case 4: /* 32-bit unicode symbol */
unicode = txt_undo_read_uint32(undo_buf, undo_pos);
+ break;
default:
/* should never happen */
BLI_assert(0);
@@ -1970,6 +1971,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s
break;
case 4: /* 32-bit unicode symbol */
unicode = txt_undo_read_uint32(undo_buf, undo_pos);
+ break;
default:
/* should never happen */
BLI_assert(0);
@@ -3031,30 +3033,6 @@ void txt_uncomment(Text *text)
}
}
-
-void txt_move_lines_up(struct Text *text)
-{
- TextLine *prev_line;
-
- if (!text || !text->curl || !text->sell) return;
-
- txt_order_cursors(text);
-
- prev_line = text->curl->prev;
-
- if (!prev_line) return;
-
- BLI_remlink(&text->lines, prev_line);
- BLI_insertlinkafter(&text->lines, text->sell, prev_line);
-
- txt_make_dirty(text);
- txt_clean_text(text);
-
- if (!undoing) {
- txt_undo_add_op(text, UNDO_MOVE_LINES_UP);
- }
-}
-
void txt_move_lines(struct Text *text, const int direction)
{
TextLine *line_other;
@@ -3094,7 +3072,6 @@ int setcurr_tab_spaces(Text *text, int space)
const char *comm = "#";
const char indent = (text->flags & TXT_TABSTOSPACES) ? ' ' : '\t';
static const char *back_words[] = {"return", "break", "continue", "pass", "yield", NULL};
- if (!text) return 0;
if (!text->curl) return 0;
while (text->curl->line[i] == indent) {
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index ee904de4af6..bdd9b424f3b 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -338,7 +338,7 @@ void colorband_table_RGBA(ColorBand *coba, float **array, int *size)
do_colorband(coba, (float)a / (float)CM_TABLE, &(*array)[a * 4]);
}
-int vergcband(const void *a1, const void *a2)
+static int vergcband(const void *a1, const void *a2)
{
const CBData *x1 = a1, *x2 = a2;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 2ed9d992c3f..337f1b5d248 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -856,7 +856,7 @@ static void track_mask_gpencil_layer_rasterize(int frame_width, int frame_height
}
/* TODO: add an option to control whether AA is enabled or not */
- PLX_raskterize((float (*)[2])mask_points, stroke->totpoints, mask, mask_width, mask_height, FALSE);
+ PLX_raskterize((float (*)[2])mask_points, stroke->totpoints, mask, mask_width, mask_height);
MEM_freeN(mask_points);
}
@@ -1043,14 +1043,6 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event)
}
}
}
- else if (event == CLAMP_SEARCH_DIM) {
- float dim[2];
- sub_v2_v2v2(dim, pat_max, pat_min);
- for (a = 0; a < 2; a++) {
- marker->search_min[a] = pat_min[a];
- marker->search_max[a] = pat_max[a];
- }
- }
}
MovieTrackingMarker *BKE_tracking_marker_get(MovieTrackingTrack *track, int framenr)
@@ -1627,7 +1619,6 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea
float *mask = NULL;
pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, 32, IB_rectfloat);
- pattern_ibuf->profile = IB_PROFILE_LINEAR_RGB;
if (!search_ibuf->rect_float) {
IMB_float_from_rect(search_ibuf);
@@ -1722,7 +1713,6 @@ ImBuf *BKE_tracking_get_search_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mov
h = (marker->search_max[1] - marker->search_min[1]) * ibuf->y;
searchibuf = IMB_allocImBuf(w, h, 32, ibuf->rect_float ? IB_rectfloat : IB_rect);
- searchibuf->profile = ibuf->profile;
IMB_rectcpy(searchibuf, ibuf, 0, 0, x, y, w, h);
@@ -2031,7 +2021,7 @@ static void track_context_free(void *customdata)
{
TrackContext *track_context = (TrackContext *)customdata;
-#if WITH_LIBMV
+#ifdef WITH_LIBMV
if (track_context->search_area)
MEM_freeN(track_context->search_area);
@@ -2225,8 +2215,8 @@ static ImBuf *tracking_context_get_frame_ibuf(MovieTrackingContext *context, int
return ibuf;
}
-MovieTrackingMarker *tracking_context_get_keyframed_marker(MovieTrackingContext *context, MovieTrackingTrack *track,
- MovieTrackingMarker *marker)
+static MovieTrackingMarker *tracking_context_get_keyframed_marker(MovieTrackingContext *context, MovieTrackingTrack *track,
+ MovieTrackingMarker *marker)
{
int a = marker - track->markers;
MovieTrackingMarker *marker_keyed = marker;
@@ -2291,9 +2281,9 @@ static ImBuf *tracking_context_get_reference_ibuf(MovieTrackingContext *context,
return ibuf;
}
-static void track_context_update_reference(MovieTrackingContext *context, TrackContext *track_context,
- MovieTrackingTrack *track, MovieTrackingMarker *marker, int curfra,
- int frame_width, int frame_height)
+static int track_context_update_reference(MovieTrackingContext *context, TrackContext *track_context,
+ MovieTrackingTrack *track, MovieTrackingMarker *marker, int curfra,
+ int frame_width, int frame_height)
{
MovieTrackingMarker *marker_keyed = NULL;
ImBuf *reference_ibuf = NULL;
@@ -2301,6 +2291,10 @@ static void track_context_update_reference(MovieTrackingContext *context, TrackC
/* calculate patch for keyframed position */
reference_ibuf = tracking_context_get_reference_ibuf(context, track, marker, curfra, &marker_keyed);
+
+ if (!reference_ibuf)
+ return FALSE;
+
track_context->marker = *marker_keyed;
if (track_context->search_area) {
@@ -2319,6 +2313,8 @@ static void track_context_update_reference(MovieTrackingContext *context, TrackC
}
IMB_freeImBuf(reference_ibuf);
+
+ return TRUE;
}
static void tracking_configure_tracker(TrackContext *track_context, MovieTrackingTrack *track,
@@ -2483,8 +2479,12 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
float *patch_new;
if (need_readjust) {
- track_context_update_reference(context, track_context, track, marker,
- curfra, frame_width, frame_height);
+ if (track_context_update_reference(context, track_context, track, marker,
+ curfra, frame_width, frame_height) == FALSE)
+ {
+ /* happens when reference frame fails to be loaded */
+ continue;
+ }
}
/* for now track to the same search area dimension as marker has got for current frame
@@ -2778,7 +2778,7 @@ static int reconstruct_count_tracks_on_both_keyframes(MovieTracking *tracking, L
int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObject *object, char *error_msg, int error_size)
{
-#if WITH_LIBMV
+#ifdef WITH_LIBMV
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) {
@@ -3317,7 +3317,6 @@ static ImBuf *stabilization_allocate_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int
}
else {
cacheibuf = IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->planes, flags);
- cacheibuf->profile = srcibuf->profile;
}
return cacheibuf;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index bd25ff8c6e6..4019eba5177 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -847,7 +847,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
* parameter.
* </p>
*/
-void flush_ffmpeg(void)
+static void flush_ffmpeg(void)
{
int outsize = 0;
int ret = 0;