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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-11-08 02:12:19 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-11-08 02:12:19 +0400
commita8a2782d34fd09a35598c2653a8225942c4c2ca0 (patch)
tree4715ccd75214e81662e2cfa684aaad610c8d25e5 /source/blender
parentdd633f1affc8951a0a6ba19cdffbb58ac7f54acd (diff)
parentb51908b913f318986a91c766980ed01010c5249a (diff)
Merged changes in the trunk up to revision 51985.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_global.h3
-rw-r--r--source/blender/blenkernel/BKE_node.h4
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h1
-rw-r--r--source/blender/blenkernel/BKE_utildefines.h6
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c9
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c3
-rw-r--r--source/blender/blenkernel/intern/library.c1
-rw-r--r--source/blender/blenkernel/intern/movieclip.c39
-rw-r--r--source/blender/blenkernel/intern/node.c4
-rw-r--r--source/blender/blenkernel/intern/particle_system.c13
-rw-r--r--source/blender/blenkernel/intern/scene.c10
-rw-r--r--source/blender/blenkernel/intern/sequencer.c38
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c83
-rw-r--r--source/blender/blenkernel/intern/smoke.c3
-rw-r--r--source/blender/blenkernel/intern/text.c28
-rw-r--r--source/blender/blenkernel/intern/tracking.c39
-rw-r--r--source/blender/blenlib/BLI_bpath.h5
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h3
-rw-r--r--source/blender/blenlib/BLI_quadric.h2
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c2
-rw-r--r--source/blender/blenlib/intern/bpath.c70
-rw-r--r--source/blender/blenlib/intern/math_matrix.c62
-rw-r--r--source/blender/blenlib/intern/quadric.c9
-rw-r--r--source/blender/blenlib/intern/smallhash.c18
-rw-r--r--source/blender/blenloader/intern/readfile.c119
-rw-r--r--source/blender/blenloader/intern/writefile.c22
-rw-r--r--source/blender/bmesh/intern/bmesh_decimate_collapse.c17
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c14
-rw-r--r--source/blender/bmesh/operators/bmo_mirror.c2
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c61
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_KeyingScreenOperation.cpp27
-rw-r--r--source/blender/editors/animation/keyingsets.c20
-rw-r--r--source/blender/editors/curve/editfont.c26
-rw-r--r--source/blender/editors/interface/interface.c10
-rw-r--r--source/blender/editors/interface/interface_draw.c18
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
-rw-r--r--source/blender/editors/interface/interface_intern.h20
-rw-r--r--source/blender/editors/interface/interface_layout.c6
-rw-r--r--source/blender/editors/object/object_transform.c7
-rw-r--r--source/blender/editors/physics/physics_fluid.c3
-rw-r--r--source/blender/editors/render/render_internal.c6
-rw-r--r--source/blender/editors/render/render_preview.c51
-rw-r--r--source/blender/editors/render/render_update.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c168
-rw-r--r--source/blender/editors/space_clip/clip_draw.c2
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c21
-rw-r--r--source/blender/editors/space_file/filelist.c1
-rw-r--r--source/blender/editors/space_file/filesel.c2
-rw-r--r--source/blender/editors/space_image/image_ops.c4
-rw-r--r--source/blender/editors/space_info/space_info.c8
-rw-r--r--source/blender/editors/space_node/drawnode.c108
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_node/node_edit.c2
-rw-r--r--source/blender/editors/space_node/node_group.c38
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c47
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c79
-rw-r--r--source/blender/editors/transform/transform.c48
-rw-r--r--source/blender/editors/transform/transform.h1
-rw-r--r--source/blender/editors/transform/transform_conversions.c6
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c111
-rw-r--r--source/blender/gpu/GPU_material.h1
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c9
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl32
-rw-r--r--source/blender/imbuf/IMB_imbuf.h2
-rw-r--r--source/blender/imbuf/intern/colormanagement.c2
-rw-r--r--source/blender/imbuf/intern/png.c3
-rw-r--r--source/blender/imbuf/intern/readimage.c6
-rw-r--r--source/blender/imbuf/intern/thumbs.c2
-rw-r--r--source/blender/makesdna/DNA_movieclip_types.h56
-rw-r--r--source/blender/makesdna/DNA_node_types.h33
-rw-r--r--source/blender/makesdna/DNA_scene_types.h11
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h3
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h155
-rw-r--r--source/blender/makesrna/intern/rna_action.c9
-rw-r--r--source/blender/makesrna/intern/rna_animation.c51
-rw-r--r--source/blender/makesrna/intern/rna_boid.c8
-rw-r--r--source/blender/makesrna/intern/rna_color.c37
-rw-r--r--source/blender/makesrna/intern/rna_curve.c6
-rw-r--r--source/blender/makesrna/intern/rna_mask.c3
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c3
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c3
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c103
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h6
-rw-r--r--source/blender/makesrna/intern/rna_object.c8
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c6
-rw-r--r--source/blender/makesrna/intern/rna_particle.c6
-rw-r--r--source/blender/makesrna/intern/rna_pose.c11
-rw-r--r--source/blender/makesrna/intern/rna_render.c5
-rw-r--r--source/blender/makesrna/intern/rna_scene.c19
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c12
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c38
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c2
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c4
-rw-r--r--source/blender/nodes/CMakeLists.txt28
-rw-r--r--source/blender/nodes/NOD_shader.h4
-rw-r--r--source/blender/nodes/NOD_socket.h1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keyingscreen.c27
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c3
-rw-r--r--source/blender/nodes/intern/node_socket.c34
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c63
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c5
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c68
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.c40
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal_map.c69
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_script.c15
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tangent.c60
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vectMath.c21
-rw-r--r--source/blender/python/generic/bgl.c4
-rw-r--r--source/blender/python/generic/bpy_internal_import.c18
-rw-r--r--source/blender/python/generic/idprop_py_api.c4
-rw-r--r--source/blender/python/intern/bpy.c5
-rw-r--r--source/blender/python/intern/bpy_rna.c4
-rw-r--r--source/blender/python/intern/bpy_util.h14
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c6
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c4
-rw-r--r--source/blender/quicktime/quicktime_export.h4
-rw-r--r--source/blender/render/extern/include/RE_engine.h1
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h1
-rw-r--r--source/blender/render/intern/include/render_types.h2
-rw-r--r--source/blender/render/intern/source/convertblender.c2
-rw-r--r--source/blender/render/intern/source/envmap.c3
-rw-r--r--source/blender/render/intern/source/external_engine.c12
-rw-r--r--source/blender/render/intern/source/initrender.c26
-rw-r--r--source/blender/render/intern/source/pipeline.c7
-rw-r--r--source/blender/render/intern/source/renderdatabase.c3
-rw-r--r--source/blender/render/intern/source/shadbuf.c2
-rw-r--r--source/blender/windowmanager/WM_api.h6
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c64
-rw-r--r--source/blender/windowmanager/intern/wm_files.c4
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c29
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c41
145 files changed, 2172 insertions, 797 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index fbdbf052878..e7033d8648d 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 264
-#define BLENDER_SUBVERSION 6
+#define BLENDER_SUBVERSION 8
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index f7af534c2c2..f6276a69d57 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -167,6 +167,9 @@ enum {
#define G_FILE_RELATIVE_REMAP (1 << 24)
#define G_FILE_HISTORY (1 << 25)
#define G_FILE_MESH_COMPAT (1 << 26) /* BMesh option to save as older mesh format */
+#define G_FILE_SAVE_COPY (1 << 27) /* restore paths after editing them */
+
+#define G_FILE_FLAGS_RUNTIME (G_FILE_NO_UI | G_FILE_RELATIVE_REMAP | G_FILE_MESH_COMPAT | G_FILE_SAVE_COPY)
/* G.windowstate */
#define G_WINDOWSTATE_USERDEF 0
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 29e03f66bcc..b365d93b246 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -553,6 +553,10 @@ struct ShadeResult;
#define SH_NODE_TEX_BRICK 169
#define SH_NODE_BUMP 170
#define SH_NODE_SCRIPT 171
+#define SH_NODE_AMBIENT_OCCLUSION 172
+#define SH_NODE_BSDF_REFRACTION 173
+#define SH_NODE_TANGENT 174
+#define SH_NODE_NORMAL_MAP 175
/* custom defines options for Material node */
#define SH_NODE_MAT_DIFF 1
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 1667c119790..ba611817c8f 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -356,6 +356,7 @@ typedef struct SeqLoadInfo {
typedef struct Sequence *(*SeqLoadFunc)(struct bContext *, ListBase *, struct SeqLoadInfo *);
struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine);
+void BKE_sequence_init_colorspace(struct Sequence *seq);
struct Sequence *BKE_sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
struct Sequence *BKE_sequencer_add_sound_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index 06f8b89ec05..7c1e0e97565 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -32,7 +32,11 @@
extern "C" {
#endif
-/* currently unused but we may want to add macros here for BKE later */
+#define BKE_BIT_TEST_SET(value, test, flag) \
+{ \
+ if (test) (value) |= flag; \
+ else (value) &= ~flag; \
+} (void)0
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index d3b7b3852fc..1aec4195354 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -980,9 +980,8 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam
/* allocate new KeyingSet */
ks = MEM_callocN(sizeof(KeyingSet), "KeyingSet");
- BLI_strncpy(ks->idname, idname ? idname : name ? name : "KeyingSet", sizeof(ks->idname));
-
- BLI_strncpy(ks->name, name ? name : idname ? idname : "Keying Set", sizeof(ks->name));
+ BLI_strncpy(ks->idname, (idname) ? idname : (name) ? name : "KeyingSet", sizeof(ks->idname));
+ BLI_strncpy(ks->name, (name) ? name : (idname) ? idname : "Keying Set", sizeof(ks->name));
ks->flag = flag;
ks->keyingflag = keyingflag;
@@ -990,10 +989,10 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam
/* add KeyingSet to list */
BLI_addtail(list, ks);
- /* Make sure KeyingSet has a unique idname. */
+ /* Make sure KeyingSet has a unique idname */
BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, idname), sizeof(ks->idname));
- /* Make sure KeyingSet has a unique label (this helps with identification). */
+ /* Make sure KeyingSet has a unique label (this helps with identification) */
BLI_uniquename(list, ks, "Keying Set", '.', offsetof(KeyingSet, name), sizeof(ks->name));
/* return new KeyingSet for further editing */
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 950a0ca3d60..44b3917df7f 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -400,7 +400,8 @@ static void dag_add_material_driver_relations(DagForest *dag, DagNode *node, Mat
}
}
-static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node, int skip_forcefield){
+static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Object *ob, DagNode *node, int skip_forcefield)
+{
Base *base;
DagNode *node2;
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 7a33d94b3dc..5b54154a489 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1013,7 +1013,6 @@ void free_main(Main *mainvar)
#endif
}
}
- a = set_listbasepointers(mainvar, lbarray);
MEM_freeN(mainvar);
}
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 4bd6676608e..4156b5b4367 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -520,6 +520,24 @@ static void movieclip_load_get_szie(MovieClip *clip)
}
}
+static void detect_clip_source(MovieClip *clip)
+{
+ ImBuf *ibuf;
+ char name[FILE_MAX];
+
+ BLI_strncpy(name, clip->name, sizeof(name));
+ BLI_path_abs(name, G.main->name);
+
+ ibuf = IMB_testiffname(name, IB_rect | IB_multilayer);
+ if (ibuf) {
+ clip->source = MCLIP_SRC_SEQUENCE;
+ IMB_freeImBuf(ibuf);
+ }
+ else {
+ clip->source = MCLIP_SRC_MOVIE;
+ }
+}
+
/* checks if image was already loaded, then returns same image
* otherwise creates new.
* does not load ibuf itself
@@ -565,10 +583,7 @@ MovieClip *BKE_movieclip_file_add(const char *name)
clip = movieclip_alloc(libname);
BLI_strncpy(clip->name, name, sizeof(clip->name));
- if (BLI_testextensie_array(name, imb_ext_movie))
- clip->source = MCLIP_SRC_MOVIE;
- else
- clip->source = MCLIP_SRC_SEQUENCE;
+ detect_clip_source(clip);
movieclip_load_get_szie(clip);
if (clip->lastsize[0]) {
@@ -1082,10 +1097,7 @@ void BKE_movieclip_reload(MovieClip *clip)
clip->tracking.stabilization.ok = FALSE;
/* update clip source */
- if (BLI_testextensie_array(clip->name, imb_ext_movie))
- clip->source = MCLIP_SRC_MOVIE;
- else
- clip->source = MCLIP_SRC_SEQUENCE;
+ detect_clip_source(clip);
clip->lastsize[0] = clip->lastsize[1] = 0;
movieclip_load_get_szie(clip);
@@ -1164,13 +1176,16 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
search_ibuf = BKE_tracking_get_search_imbuf(ibuf, track, &undist_marker, TRUE, TRUE);
- if (!search_ibuf->rect_float) {
- /* sampling happens in float buffer */
- IMB_float_from_rect(search_ibuf);
+ if (search_ibuf) {
+ if (!search_ibuf->rect_float) {
+ /* sampling happens in float buffer */
+ IMB_float_from_rect(search_ibuf);
+ }
+
+ scopes->track_search = search_ibuf;
}
scopes->undist_marker = undist_marker;
- scopes->track_search = search_ibuf;
scopes->frame_width = ibuf->x;
scopes->frame_height = ibuf->y;
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 153eb5271c5..2d76484b60a 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2293,17 +2293,21 @@ static void registerShaderNodes(bNodeTreeType *ttype)
register_node_type_sh_particle_info(ttype);
register_node_type_sh_bump(ttype);
register_node_type_sh_script(ttype);
+ register_node_type_sh_tangent(ttype);
+ register_node_type_sh_normal_map(ttype);
register_node_type_sh_background(ttype);
register_node_type_sh_bsdf_anisotropic(ttype);
register_node_type_sh_bsdf_diffuse(ttype);
register_node_type_sh_bsdf_glossy(ttype);
register_node_type_sh_bsdf_glass(ttype);
+ register_node_type_sh_bsdf_refraction(ttype);
register_node_type_sh_bsdf_translucent(ttype);
register_node_type_sh_bsdf_transparent(ttype);
register_node_type_sh_bsdf_velvet(ttype);
register_node_type_sh_emission(ttype);
register_node_type_sh_holdout(ttype);
+ register_node_type_sh_ambient_occlusion(ttype);
//register_node_type_sh_volume_transparent(ttype);
//register_node_type_sh_volume_isotropic(ttype);
register_node_type_sh_mix_shader(ttype);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 2b95946f571..a780a9e8684 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -367,11 +367,12 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
nodedmelem= MEM_callocN(sizeof(LinkNode)*totdmelem, "psys node elems");
nodearray= MEM_callocN(sizeof(LinkNode *)*totelem, "psys node array");
- for (i=0, node=nodedmelem; i<totdmelem; i++, origindex++, node++) {
+ for (i=0, node=nodedmelem; i<totdmelem; i++, node++) {
int origindex_final;
node->link = SET_INT_IN_POINTER(i);
- origindex_final = *origindex;
+ /* may be vertex or face origindex */
+ origindex_final = origindex ? origindex[i] : ORIGINDEX_NONE;
/* if we have a poly source, do an index lookup */
if (origindex_poly && origindex_final != ORIGINDEX_NONE) {
@@ -466,13 +467,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
mv++;
for (i=1; i<totvert; i++, mv++) {
- min[0]=MIN2(min[0],mv->co[0]);
- min[1]=MIN2(min[1],mv->co[1]);
- min[2]=MIN2(min[2],mv->co[2]);
-
- max[0]=MAX2(max[0],mv->co[0]);
- max[1]=MAX2(max[1],mv->co[1]);
- max[2]=MAX2(max[2],mv->co[2]);
+ minmax_v3v3_v3(min, max, mv->co);
}
sub_v3_v3v3(delta, max, min);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 721117d739f..49b405379eb 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -375,8 +375,8 @@ Scene *BKE_scene_add(const char *name)
sce->r.ysch = 1080;
sce->r.xasp = 1;
sce->r.yasp = 1;
- sce->r.xparts = 8;
- sce->r.yparts = 8;
+ sce->r.tilex = 256;
+ sce->r.tiley = 256;
sce->r.mblur_samples = 1;
sce->r.filtertype = R_FILTER_MITCH;
sce->r.size = 50;
@@ -1026,8 +1026,10 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
- /* always update layer, so that animating layers works */
- base->lay = ob->lay;
+ /* always update layer, so that animating layers works (joshua july 2010) */
+ /* XXX commented out, this has depsgraph issues anyway - and this breaks setting scenes
+ (on scene-set, the base-lay is copied to ob-lay (ton nov 2012) */
+ // base->lay = ob->lay;
}
/* scene drivers... */
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 80ea00fc703..af0cab98fe0 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -676,8 +676,8 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
if (seq->anim) IMB_free_anim(seq->anim);
- /* OCIO_TODO: support configurable input space for strips */
- seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex, NULL);
+ seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
+ seq->streamindex, seq->strip->colorspace_settings.name);
if (!seq->anim) {
return;
@@ -1174,8 +1174,8 @@ static void seq_open_anim_file(Sequence *seq)
seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(name, G.main->name);
- /* OCIO_TODO: support configurable input space for strips */
- seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex, NULL);
+ seq->anim = openanim(name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0),
+ seq->streamindex, seq->strip->colorspace_settings.name);
if (seq->anim == NULL) {
return;
@@ -1301,7 +1301,6 @@ static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra)
}
if (BLI_exists(name)) {
- /* OCIO_TODO: support configurable spaces for strips */
ImBuf *ibuf = IMB_loadiffname(name, IB_rect, NULL);
if (ibuf)
@@ -1346,7 +1345,6 @@ static void seq_proxy_build_frame(SeqRenderData context, Sequence *seq, int cfra
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);
@@ -2529,8 +2527,7 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo
BLI_path_abs(name, G.main->name);
}
- /* OCIO_TODO: support configurable space for image strips */
- if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect, NULL))) {
+ if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect, seq->strip->colorspace_settings.name))) {
/* we don't need both (speed reasons)! */
if (ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
@@ -3940,6 +3937,25 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine)
return seq;
}
+void BKE_sequence_init_colorspace(Sequence *seq)
+{
+ if (seq->strip && seq->strip->stripdata) {
+ char name[FILE_MAX];
+ ImBuf *ibuf;
+
+ BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name);
+ BLI_path_abs(name, G.main->name);
+
+ /* initialize input color space */
+ if (seq->type == SEQ_TYPE_IMAGE) {
+ ibuf = IMB_loadiffname(name, IB_rect, seq->strip->colorspace_settings.name);
+
+ if (ibuf)
+ IMB_freeImBuf(ibuf);
+ }
+ }
+}
+
/* NOTE: this function doesn't fill in image names */
Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
{
@@ -4046,14 +4062,14 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
Sequence *seq; /* generic strip vars */
Strip *strip;
StripElem *se;
+ char colorspace[64] = "\0"; /* MAX_COLORSPACE_NAME */
struct anim *an;
BLI_strncpy(path, seq_load->path, sizeof(path));
BLI_path_abs(path, G.main->name);
- /* OCIO_TODO: support configurable input space for strips */
- an = openanim(path, IB_rect, 0, NULL);
+ an = openanim(path, IB_rect, 0, colorspace);
if (an == NULL)
return NULL;
@@ -4072,6 +4088,8 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
strip->us = 1;
+ BLI_strncpy(seq->strip->colorspace_settings.name, colorspace, sizeof(seq->strip->colorspace_settings.name));
+
/* we only need 1 element for MOVIE strips */
strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 5586d8e4c29..96faec389df 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -159,7 +159,9 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
float *co = calc->vertexCos[i];
float tmp_co[3];
float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
- if (weight == 0.0f) continue;
+ if (weight == 0.0f) {
+ continue;
+ }
/* Convert the vertex to tree coordinates */
@@ -188,8 +190,10 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
if (nearest.index != -1) {
/* Adjusting the vertex weight,
* so that after interpolating it keeps a certain distance from the nearest position */
- float dist = sasqrt(nearest.dist);
- if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist) / dist;
+ if (nearest.dist > FLT_EPSILON) {
+ const float dist = sqrtf(nearest.dist);
+ weight *= (dist - calc->keepDist) / dist;
+ }
/* Convert the coordinates back to mesh coordinates */
copy_v3_v3(tmp_co, nearest.co);
@@ -202,6 +206,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
free_bvhtree_from_mesh(&treeData);
}
+
/*
* This function raycast a single vertex and updates the hit if the "hit" is considered valid.
* Returns TRUE if "hit" was updated.
@@ -210,8 +215,16 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
* MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE (front faces hits are ignored)
* MOD_SHRINKWRAP_CULL_TARGET_BACKFACE (back faces hits are ignored)
*/
-int normal_projection_project_vertex(char options, const float vert[3], const float dir[3], const SpaceTransform *transf, BVHTree *tree, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
+int normal_projection_project_vertex(char options, const float vert[3], const float dir[3],
+ const SpaceTransform *transf,
+ BVHTree *tree, BVHTreeRayHit *hit,
+ BVHTree_RayCastCallback callback, void *userdata)
{
+ /* don't use this because this dist value could be incompatible
+ * this value used by the callback for comparing prev/new dist values.
+ * also, at the moment there is no need to have a corrected 'dist' value */
+// #define USE_DIST_CORRECT
+
float tmp_co[3], tmp_no[3];
const float *co, *no;
BVHTreeRayHit hit_tmp;
@@ -229,7 +242,9 @@ int normal_projection_project_vertex(char options, const float vert[3], const fl
space_transform_apply_normal(transf, tmp_no);
no = tmp_no;
+#ifdef USE_DIST_CORRECT
hit_tmp.dist *= mat4_to_scale(((SpaceTransform *)transf)->local2target);
+#endif
}
else {
co = vert;
@@ -250,7 +265,7 @@ int normal_projection_project_vertex(char options, const float vert[3], const fl
/* apply backface */
const float dot = dot_v3v3(dir, hit_tmp.no);
if (((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
- ((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE) && dot >= 0.0f))
+ ((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE) && dot >= 0.0f))
{
return FALSE; /* Ignore hit */
}
@@ -259,9 +274,13 @@ int normal_projection_project_vertex(char options, const float vert[3], const fl
if (transf) {
/* Inverting space transform (TODO make coeherent with the initial dist readjust) */
space_transform_invert(transf, hit_tmp.co);
- hit_tmp.dist = len_v3v3((float *)vert, hit_tmp.co);
+#ifdef USE_DIST_CORRECT
+ hit_tmp.dist = len_v3v3(vert, hit_tmp.co);
+#endif
}
+ BLI_assert(hit_tmp.dist <= hit->dist);
+
memcpy(hit, &hit_tmp, sizeof(hit_tmp));
return TRUE;
}
@@ -278,6 +297,10 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
float proj_axis[3] = {0.0f, 0.0f, 0.0f};
/* Raycast and tree stuff */
+
+ /** \note 'hit.dist' is kept in the targets space, this is only used
+ * for finding the best hit, to get the real dist,
+ * measure the len_v3v3() from the input coord to hit.co */
BVHTreeRayHit hit;
BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
@@ -306,8 +329,9 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
normalize_v3(proj_axis);
/* Invalid projection direction */
- if (dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON)
- return;
+ if (len_squared_v3(proj_axis) < FLT_EPSILON) {
+ return;
+ }
}
if (calc->smd->auxTarget) {
@@ -328,9 +352,11 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
for (i = 0; i < calc->numVerts; ++i) {
float *co = calc->vertexCos[i];
float tmp_co[3], tmp_no[3];
- float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
+ const float weight = defvert_array_find_weight_safe(calc->dvert, i, calc->vgroup);
- if (weight == 0.0f) continue;
+ if (weight == 0.0f) {
+ continue;
+ }
if (calc->vert) {
/* calc->vert contains verts from derivedMesh */
@@ -357,21 +383,31 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
/* Project over positive direction of axis */
if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR) {
- if (auxData.tree)
- normal_projection_project_vertex(0, tmp_co, tmp_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
+ if (auxData.tree) {
+ normal_projection_project_vertex(0, tmp_co, tmp_no,
+ &local2aux, auxData.tree, &hit,
+ auxData.raycast_callback, &auxData);
+ }
- normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
+ normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, tmp_no,
+ &calc->local2target, treeData.tree, &hit,
+ treeData.raycast_callback, &treeData);
}
/* Project over negative direction of axis */
- if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1) {
+ if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR) {
float inv_no[3];
negate_v3_v3(inv_no, tmp_no);
- if (auxData.tree)
- normal_projection_project_vertex(0, tmp_co, inv_no, &local2aux, auxData.tree, &hit, auxData.raycast_callback, &auxData);
+ if (auxData.tree) {
+ normal_projection_project_vertex(0, tmp_co, inv_no,
+ &local2aux, auxData.tree, &hit,
+ auxData.raycast_callback, &auxData);
+ }
- normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no, &calc->local2target, treeData.tree, &hit, treeData.raycast_callback, &treeData);
+ normal_projection_project_vertex(calc->smd->shrinkOpts, tmp_co, inv_no,
+ &calc->local2target, treeData.tree, &hit,
+ treeData.raycast_callback, &treeData);
}
@@ -453,10 +489,13 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
/* Adjusting the vertex weight,
* so that after interpolating it keeps a certain distance from the nearest position */
float dist = sasqrt(nearest.dist);
- if (dist > FLT_EPSILON)
- interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist) / dist); /* linear interpolation */
- else
+ if (dist > FLT_EPSILON) {
+ /* linear interpolation */
+ interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist) / dist);
+ }
+ else {
copy_v3_v3(tmp_co, nearest.co);
+ }
}
/* Convert the coordinates back to mesh coordinates */
@@ -469,7 +508,8 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
}
/* Main shrinkwrap function */
-void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
+void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedMesh *dm,
+ float (*vertexCos)[3], int numVerts)
{
DerivedMesh *ss_mesh = NULL;
@@ -561,4 +601,3 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
if (ss_mesh)
ss_mesh->release(ss_mesh);
}
-
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 443aed1fc41..f9925a41177 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -2267,7 +2267,8 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *
}
}
-struct DerivedMesh *smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm){
+struct DerivedMesh *smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
+{
smokeModifier_process(smd, scene, ob, dm);
/* return generated geometry for adaptive domain */
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index b3497b9932f..d230cf8f1fe 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -2862,7 +2862,7 @@ int txt_replace_char(Text *text, unsigned int add)
void txt_indent(Text *text)
{
- int len, num;
+ int len, num, curc_old;
char *tmp;
const char *add = "\t";
@@ -2885,6 +2885,8 @@ void txt_indent(Text *text)
indentlen = spaceslen;
}
+ curc_old = text->curc;
+
num = 0;
while (TRUE) {
tmp = MEM_mallocN(text->curl->len + indentlen + 1, "textline_string");
@@ -2905,7 +2907,7 @@ void txt_indent(Text *text)
txt_clean_text(text);
if (text->curl == text->sell) {
- text->selc = text->sell->len;
+ text->selc += indentlen;
break;
}
else {
@@ -2913,7 +2915,9 @@ void txt_indent(Text *text)
num++;
}
}
- text->curc = 0;
+ if (!curc_old) text->curc = 0;
+ else text->curc = curc_old + indentlen;
+
while (num > 0) {
text->curl = text->curl->prev;
num--;
@@ -2928,7 +2932,8 @@ void txt_unindent(Text *text)
{
int num = 0;
const char *remove = "\t";
- int indent = 1;
+ int indentlen = 1;
+ int unindented_first = FALSE;
/* hardcoded: TXT_TABSIZE = 4 spaces: */
int spaceslen = TXT_TABSIZE;
@@ -2940,25 +2945,26 @@ void txt_unindent(Text *text)
/* insert spaces rather than tabs */
if (text->flags & TXT_TABSTOSPACES) {
remove = tab_to_spaces;
- indent = spaceslen;
+ indentlen = spaceslen;
}
while (TRUE) {
int i = 0;
- if (BLI_strncasecmp(text->curl->line, remove, indent) == 0) {
+ if (BLI_strncasecmp(text->curl->line, remove, indentlen) == 0) {
+ if (num == 0) unindented_first = TRUE;
while (i < text->curl->len) {
- text->curl->line[i] = text->curl->line[i + indent];
+ text->curl->line[i] = text->curl->line[i + indentlen];
i++;
}
- text->curl->len -= indent;
+ text->curl->len -= indentlen;
}
txt_make_dirty(text);
txt_clean_text(text);
if (text->curl == text->sell) {
- text->selc = text->sell->len;
+ if (i > 0) text->selc = MAX2(text->selc - indentlen, 0);
break;
}
else {
@@ -2967,7 +2973,9 @@ void txt_unindent(Text *text)
}
}
- text->curc = 0;
+
+ if (unindented_first) text->curc = MAX2(text->curc - indentlen, 0);
+
while (num > 0) {
text->curl = text->curl->prev;
num--;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 26775eaac8c..b174f27b7e1 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -173,6 +173,7 @@ void BKE_tracking_settings_init(MovieTracking *tracking)
tracking->settings.default_search_size = 61;
tracking->settings.dist = 1;
tracking->settings.object_distance = 1;
+ tracking->settings.reconstruction_success_threshold = 1e-3;
tracking->stabilization.scaleinf = 1.0f;
tracking->stabilization.locinf = 1.0f;
@@ -1623,6 +1624,9 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea
double warped_position_x, warped_position_y;
float *mask = NULL;
+ if (num_samples_x <= 0 || num_samples_y <= 0)
+ return NULL;
+
pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, 32, IB_rectfloat);
if (!search_ibuf->rect_float) {
@@ -1689,10 +1693,15 @@ ImBuf *BKE_tracking_get_pattern_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mo
search_ibuf = BKE_tracking_get_search_imbuf(ibuf, track, marker, anchored, disable_channels);
- pattern_ibuf = BKE_tracking_sample_pattern(ibuf->x, ibuf->y, search_ibuf, track, marker,
- FALSE, num_samples_x, num_samples_y, NULL);
+ if (search_ibuf) {
+ pattern_ibuf = BKE_tracking_sample_pattern(ibuf->x, ibuf->y, search_ibuf, track, marker,
+ FALSE, num_samples_x, num_samples_y, NULL);
- IMB_freeImBuf(search_ibuf);
+ IMB_freeImBuf(search_ibuf);
+ }
+ else {
+ pattern_ibuf = NULL;
+ }
return pattern_ibuf;
}
@@ -1717,6 +1726,9 @@ ImBuf *BKE_tracking_get_search_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, Mov
w = (marker->search_max[0] - marker->search_min[0]) * ibuf->x;
h = (marker->search_max[1] - marker->search_min[1]) * ibuf->y;
+ if (w <= 0 || h <= 0)
+ return NULL;
+
searchibuf = IMB_allocImBuf(w, h, 32, ibuf->rect_float ? IB_rectfloat : IB_rect);
IMB_rectcpy(searchibuf, ibuf, 0, 0, x, y, w, h);
@@ -2186,6 +2198,12 @@ static float *track_get_search_floatbuf(ImBuf *ibuf, MovieTrackingTrack *track,
searchibuf = BKE_tracking_get_search_imbuf(ibuf, track, marker, FALSE, TRUE);
+ if (!searchibuf) {
+ *width_r = 0;
+ *height_r = 0;
+ return NULL;
+ }
+
width = searchibuf->x;
height = searchibuf->y;
@@ -2505,6 +2523,9 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
get_marker_coords_for_tracking(frame_width, frame_height, &track_context->marker, src_pixel_x, src_pixel_y);
get_marker_coords_for_tracking(frame_width, frame_height, marker, dst_pixel_x, dst_pixel_y);
+ if (!patch_new || !track_context->search_area)
+ continue;
+
/* run the tracker! */
tracked = libmv_trackRegion(&options,
track_context->search_area,
@@ -2561,6 +2582,9 @@ typedef struct MovieReconstructContext {
TracksMap *tracks_map;
+ float success_threshold;
+ int use_fallback_reconstruction;
+
int sfra, efra;
} MovieReconstructContext;
@@ -2830,6 +2854,9 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
context->k2 = camera->k2;
context->k3 = camera->k3;
+ context->success_threshold = tracking->settings.reconstruction_success_threshold;
+ context->use_fallback_reconstruction = tracking->settings.reconstruction_flag & TRACKING_USE_FALLBACK_RECONSTRUCTION;
+
context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
track = tracksbase->first;
@@ -2929,12 +2956,18 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *
reconstruct_update_solve_cb, &progressdata);
}
else {
+ struct libmv_reconstructionOptions options;
+
+ options.success_threshold = context->success_threshold;
+ options.use_fallback_reconstruction = context->use_fallback_reconstruction;
+
context->reconstruction = libmv_solveReconstruction(context->tracks,
context->keyframe1, context->keyframe2,
context->refine_flags,
context->focal_length,
context->principal_point[0], context->principal_point[1],
context->k1, context->k2, context->k3,
+ &options,
reconstruct_update_solve_cb, &progressdata);
}
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index a86b362c271..438bffb2fc5 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -48,6 +48,11 @@ void BLI_bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVi
void BLI_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata);
int BLI_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src);
+/* Functions for temp backup/restore of paths, path count must NOT change */
+void *BLI_bpath_list_backup(struct Main *bmain, const int flag);
+void BLI_bpath_list_restore(struct Main *bmain, const int flag, void *ls_handle);
+void BLI_bpath_list_free(void *ls_handle);
+
#define BLI_BPATH_TRAVERSE_ABS (1 << 0) /* convert paths to absolute */
#define BLI_BPATH_TRAVERSE_SKIP_LIBRARY (1 << 2) /* skip library paths */
#define BLI_BPATH_TRAVERSE_SKIP_PACKED (1 << 3) /* skip packed data */
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 9e34631d460..0783a7981ea 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -98,6 +98,9 @@ void mul_m3_fl(float R[3][3], float f);
void mul_m4_fl(float R[4][4], float f);
void mul_mat3_m4_fl(float R[4][4], float f);
+int invert_m3_ex(float m[3][3], const float epsilon);
+int invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon);
+
int invert_m3(float R[3][3]);
int invert_m3_m3(float R[3][3], float A[3][3]);
int invert_m4(float R[4][4]);
diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h
index aec11ec2b44..e71a6473852 100644
--- a/source/blender/blenlib/BLI_quadric.h
+++ b/source/blender/blenlib/BLI_quadric.h
@@ -51,6 +51,6 @@ void BLI_quadric_mul(Quadric *a, const float scalar);
/* solve */
float BLI_quadric_evaluate(const Quadric *q, const float v[3]);
-int BLI_quadric_optimize(const Quadric *q, float v[3]);
+int BLI_quadric_optimize(const Quadric *q, float v[3], const float epsilon);
#endif /* __BLI_QUADRIC_H__ */
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 70617453eff..7968fcabda6 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1117,7 +1117,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
data[j]->overlap = (BVHTreeOverlap *)malloc(sizeof(BVHTreeOverlap) * max_ii(tree1->totleaf, tree2->totleaf));
data[j]->tree1 = tree1;
data[j]->tree2 = tree2;
- data[j]->max_overlap = MAX2(tree1->totleaf, tree2->totleaf);
+ data[j]->max_overlap = max_ii(tree1->totleaf, tree2->totleaf);
data[j]->i = 0;
data[j]->start_axis = min_axis(tree1->start_axis, tree2->start_axis);
data[j]->stop_axis = min_axis(tree1->stop_axis, tree2->stop_axis);
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index 2f335b557fe..d725a0a9417 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -626,3 +626,73 @@ int BLI_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pat
return FALSE;
}
}
+
+
+/* -------------------------------------------------------------------- */
+/**
+ * Backup/Restore/Free functions,
+ * \note These functions assume the data won't chane order.
+ */
+
+struct PathStore {
+ struct PathStore *next, *prev;
+} PathStore;
+
+static int bpath_list_append(void *userdata, char *UNUSED(path_dst), const char *path_src)
+{
+ /* store the path and string in a single alloc */
+ ListBase *ls = userdata;
+ size_t path_size = strlen(path_src) + 1;
+ struct PathStore *path_store = MEM_mallocN(sizeof(PathStore) + path_size, __func__);
+ char *filepath = (char *)(path_store + 1);
+
+ memcpy(filepath, path_src, path_size);
+ BLI_addtail(ls, path_store);
+ return FALSE;
+}
+
+static int bpath_list_restore(void *userdata, char *path_dst, const char *path_src)
+{
+ /* assume ls->first wont be NULL because the number of paths can't change!
+ * (if they do caller is wrong) */
+ ListBase *ls = userdata;
+ struct PathStore *path_store = ls->first;
+ const char *filepath = (char *)(path_store + 1);
+ int ret;
+
+ if (strcmp(path_src, filepath) == 0) {
+ ret = FALSE;
+ }
+ else {
+ BLI_strncpy(path_dst, filepath, FILE_MAX);
+ ret = TRUE;
+ }
+
+ BLI_freelinkN(ls, path_store);
+ return ret;
+}
+
+/* return ls_handle */
+void *BLI_bpath_list_backup(Main *bmain, const int flag)
+{
+ ListBase *ls = MEM_callocN(sizeof(ListBase), __func__);
+
+ BLI_bpath_traverse_main(bmain, bpath_list_append, flag, ls);
+
+ return ls;
+}
+
+void BLI_bpath_list_restore(Main *bmain, const int flag, void *ls_handle)
+{
+ ListBase *ls = ls_handle;
+
+ BLI_bpath_traverse_main(bmain, bpath_list_restore, flag, ls);
+}
+
+void BLI_bpath_list_free(void *ls_handle)
+{
+ ListBase *ls = ls_handle;
+ BLI_assert(ls->first == NULL); /* assumes we were used */
+ BLI_freelistN(ls);
+ MEM_freeN(ls);
+}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index f622a5ace35..38214f9c6b0 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -504,6 +504,51 @@ void sub_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
m1[i][j] = m2[i][j] - m3[i][j];
}
+/* why not make this a standard part of the API? */
+static float determinant_m3_local(float m[3][3])
+{
+ return (m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]) -
+ m[1][0] * (m[0][1] * m[2][2] - m[0][2] * m[2][1]) +
+ m[2][0] * (m[0][1] * m[1][2] - m[0][2] * m[1][1]));
+}
+
+int invert_m3_ex(float m[3][3], const float epsilon)
+{
+ float tmp[3][3];
+ int success;
+
+ success = invert_m3_m3_ex(tmp, m, epsilon);
+ copy_m3_m3(m, tmp);
+
+ return success;
+}
+
+int invert_m3_m3_ex(float m1[3][3], float m2[3][3], const float epsilon)
+{
+ float det;
+ int a, b, success;
+
+ BLI_assert(epsilon >= 0.0f);
+
+ /* calc adjoint */
+ adjoint_m3_m3(m1, m2);
+
+ /* then determinant old matrix! */
+ det = determinant_m3_local(m2);
+
+ success = (fabsf(det) > epsilon);
+
+ if (LIKELY(det != 0.0f)) {
+ det = 1.0f / det;
+ for (a = 0; a < 3; a++) {
+ for (b = 0; b < 3; b++) {
+ m1[a][b] *= det;
+ }
+ }
+ }
+ return success;
+}
+
int invert_m3(float m[3][3])
{
float tmp[3][3];
@@ -524,17 +569,16 @@ int invert_m3_m3(float m1[3][3], float m2[3][3])
adjoint_m3_m3(m1, m2);
/* then determinant old matrix! */
- det = (m2[0][0] * (m2[1][1] * m2[2][2] - m2[1][2] * m2[2][1]) -
- m2[1][0] * (m2[0][1] * m2[2][2] - m2[0][2] * m2[2][1]) +
- m2[2][0] * (m2[0][1] * m2[1][2] - m2[0][2] * m2[1][1]));
+ det = determinant_m3_local(m2);
- success = (det != 0);
+ success = (det != 0.0f);
- if (det == 0) det = 1;
- det = 1 / det;
- for (a = 0; a < 3; a++) {
- for (b = 0; b < 3; b++) {
- m1[a][b] *= det;
+ if (LIKELY(det != 0.0f)) {
+ det = 1.0f / det;
+ for (a = 0; a < 3; a++) {
+ for (b = 0; b < 3; b++) {
+ m1[a][b] *= det;
+ }
}
}
diff --git a/source/blender/blenlib/intern/quadric.c b/source/blender/blenlib/intern/quadric.c
index bb39cb61e78..b06534d282a 100644
--- a/source/blender/blenlib/intern/quadric.c
+++ b/source/blender/blenlib/intern/quadric.c
@@ -107,18 +107,13 @@ float BLI_quadric_evaluate(const Quadric *q, const float v[3])
q->d2);
}
-int BLI_quadric_optimize(const Quadric *q, float v[3])
+int BLI_quadric_optimize(const Quadric *q, float v[3], const float epsilon)
{
float m[3][3];
- float det;
BLI_quadric_to_tensor_m3(q, m);
- det = determinant_m3(m[0][0], m[0][1], m[0][2],
- m[1][0], m[1][1], m[1][2],
- m[2][0], m[2][1], m[2][2]);
- if (fabsf(det) > FLT_EPSILON) {
- invert_m3(m);
+ if (invert_m3_ex(m, epsilon)) {
BLI_quadric_to_vector_v3(q, v);
mul_m3_v3(m, v);
negate_v3(v);
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
index 92125c6e988..64bb503fa3c 100644
--- a/source/blender/blenlib/intern/smallhash.c
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -43,8 +43,22 @@
#define SMHASH_CELL_UNUSED ((void *)0x7FFFFFFF)
#define SMHASH_CELL_FREE ((void *)0x7FFFFFFD)
-#define SMHASH_NONZERO(n) ((n) + !(n))
-#define SMHASH_NEXT(h, hoff) ABS(((h) + ((hoff = SMHASH_NONZERO(hoff * 2) + 1), hoff)))
+BLI_INLINE int smhash_nonzero(const int n)
+{
+ return n + !n;
+}
+
+BLI_INLINE int smhash_abs_i(const int n)
+{
+ return (n > 0) ? n : -n;
+}
+
+/* typically this re-assigns 'h' */
+#define SMHASH_NEXT(h, hoff) ( \
+ CHECK_TYPE_INLINE(&(h), int), \
+ CHECK_TYPE_INLINE(&(hoff), int), \
+ smhash_abs_i((h) + (((hoff) = smhash_nonzero((hoff) * 2) + 1), (hoff))) \
+ )
extern unsigned int hashsizes[];
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0b9421d2b12..bef97a4ab6a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7357,7 +7357,36 @@ static void do_version_logic_264(ListBase *regionbase)
}
-
+
+static void do_versions_affine_tracker_track(MovieTrackingTrack *track)
+{
+ int i;
+
+ for (i = 0; i < track->markersnr; i++) {
+ MovieTrackingMarker *marker = &track->markers[i];
+
+ if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
+ is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3]))
+ {
+ marker->pattern_corners[0][0] = track->pat_min[0];
+ marker->pattern_corners[0][1] = track->pat_min[1];
+
+ marker->pattern_corners[1][0] = track->pat_max[0];
+ marker->pattern_corners[1][1] = track->pat_min[1];
+
+ marker->pattern_corners[2][0] = track->pat_max[0];
+ marker->pattern_corners[2][1] = track->pat_max[1];
+
+ marker->pattern_corners[3][0] = track->pat_min[0];
+ marker->pattern_corners[3][1] = track->pat_max[1];
+ }
+
+ if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
+ copy_v2_v2(marker->search_min, track->search_min);
+ copy_v2_v2(marker->search_max, track->search_max);
+ }
+ }
+}
static void do_versions(FileData *fd, Library *lib, Main *main)
@@ -8128,32 +8157,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
track = clip->tracking.tracks.first;
while (track) {
- int i;
-
- for (i = 0; i < track->markersnr; i++) {
- MovieTrackingMarker *marker = &track->markers[i];
-
- if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
- is_zero_v2(marker->pattern_corners[2]) && is_zero_v2(marker->pattern_corners[3]))
- {
- marker->pattern_corners[0][0] = track->pat_min[0];
- marker->pattern_corners[0][1] = track->pat_min[1];
-
- marker->pattern_corners[1][0] = track->pat_max[0];
- marker->pattern_corners[1][1] = track->pat_min[1];
-
- marker->pattern_corners[2][0] = track->pat_max[0];
- marker->pattern_corners[2][1] = track->pat_max[1];
-
- marker->pattern_corners[3][0] = track->pat_min[0];
- marker->pattern_corners[3][1] = track->pat_max[1];
- }
-
- if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
- copy_v2_v2(marker->search_min, track->search_min);
- copy_v2_v2(marker->search_max, track->search_max);
- }
- }
+ do_versions_affine_tracker_track(track);
track = track->next;
}
@@ -8486,15 +8490,62 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
+ }
+
+ if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 7)) {
+ /* convert tiles size from resolution and number of tiles */
+ {
+ Scene *scene;
+
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->r.tilex == 0 || scene->r.tiley == 1) {
+ /* scene could be set for panoramic rendering, so clamp with the
+ * lowest possible tile size value
+ */
+ scene->r.tilex = max_ii(scene->r.xsch * scene->r.size / scene->r.xparts / 100, 8);
+ scene->r.tiley = max_ii(scene->r.ysch * scene->r.size / scene->r.yparts / 100, 8);
+ }
+ }
+ }
+
+ /* collision masks */
+ {
+ Object *ob;
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ if (ob->col_group == 0) {
+ ob->col_group = 0x01;
+ ob->col_mask = 0xff;
+ }
+ }
+ }
+
+ /* fallbck resection method settings */
+ {
+ MovieClip *clip;
+ for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+ if (clip->tracking.settings.reconstruction_success_threshold == 0.0f) {
+ clip->tracking.settings.reconstruction_success_threshold = 1e-3;
+ }
+ }
+ }
}
-
- {
- Object *ob;
- for (ob = main->object.first; ob; ob = ob->id.next) {
- if (ob->col_group == 0) {
- ob->col_group = 0x01;
- ob->col_mask = 0xff;
+
+ if (main->versionfile < 264 || (main->versionfile == 264 && main->subversionfile < 7)) {
+ MovieClip *clip;
+
+ for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+ MovieTrackingTrack *track;
+ MovieTrackingObject *object;
+
+ for (track = clip->tracking.tracks.first; track; track = track->next) {
+ do_versions_affine_tracker_track(track);
+ }
+
+ for (object = clip->tracking.objects.first; object; object = object->next) {
+ for (track = object->tracks.first; track; track = track->next) {
+ do_versions_affine_tracker_track(track);
+ }
}
}
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index d67f45cde10..7c022c6f45a 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1831,13 +1831,13 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
mesh->totloop = 0;
/* -- */
backup_mesh.fdata = mesh->fdata;
- memset(&mesh->fdata, 0, sizeof(CustomData));
+ CustomData_reset(&mesh->fdata);
/* -- */
backup_mesh.pdata = mesh->pdata;
- memset(&mesh->pdata, 0, sizeof(CustomData));
+ CustomData_reset(&mesh->pdata);
/* -- */
backup_mesh.ldata = mesh->ldata;
- memset(&mesh->ldata, 0, sizeof(CustomData));
+ CustomData_reset(&mesh->ldata);
/* -- */
backup_mesh.edit_btmesh = mesh->edit_btmesh;
mesh->edit_btmesh = NULL;
@@ -3102,7 +3102,7 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
fg.winpos= G.winpos;
/* prevent to save this, is not good convention, and feature with concerns... */
- fg.fileflags= (fileflags & ~(G_FILE_NO_UI|G_FILE_RELATIVE_REMAP|G_FILE_MESH_COMPAT));
+ fg.fileflags= (fileflags & ~G_FILE_FLAGS_RUNTIME);
fg.globalf= G.f;
BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename));
@@ -3252,6 +3252,10 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
char tempname[FILE_MAX+1];
int file, err, write_user_block;
+ /* path backup/restore */
+ void *path_list_backup = NULL;
+ const int path_list_flag = (BLI_BPATH_TRAVERSE_SKIP_LIBRARY | BLI_BPATH_TRAVERSE_SKIP_MULTIFILE);
+
/* open temporary file, so we preserve the original in case we crash */
BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
@@ -3261,6 +3265,11 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
return 0;
}
+ /* check if we need to backup and restore paths */
+ if (UNLIKELY((write_flags & G_FILE_RELATIVE_REMAP) && (G_FILE_SAVE_COPY & write_flags))) {
+ path_list_backup = BLI_bpath_list_backup(mainvar, path_list_flag);
+ }
+
/* remapping of relative paths to new file location */
if (write_flags & G_FILE_RELATIVE_REMAP) {
char dir1[FILE_MAX];
@@ -3296,6 +3305,11 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
err= write_file_handle(mainvar, file, NULL, NULL, write_user_block, write_flags, thumb);
close(file);
+ if (UNLIKELY(path_list_backup)) {
+ BLI_bpath_list_restore(mainvar, path_list_flag, path_list_backup);
+ BLI_bpath_list_free(path_list_backup);
+ }
+
if (err) {
BKE_report(reports, RPT_ERROR, strerror(errno));
remove(tempname);
diff --git a/source/blender/bmesh/intern/bmesh_decimate_collapse.c b/source/blender/bmesh/intern/bmesh_decimate_collapse.c
index feeb2a926f3..1f92a8f9227 100644
--- a/source/blender/bmesh/intern/bmesh_decimate_collapse.c
+++ b/source/blender/bmesh/intern/bmesh_decimate_collapse.c
@@ -45,11 +45,13 @@
/* defines for testing */
#define USE_CUSTOMDATA
#define USE_TRIANGULATE
+#define USE_VERT_NORMAL_INTERP /* has the advantage that flipped faces don't mess up vertex normals */
/* these checks are for rare cases that we can't avoid since they are valid meshes still */
#define USE_SAFETY_CHECKS
#define BOUNDARY_PRESERVE_WEIGHT 100.0f
+#define OPTIMIZE_EPS 0.01f /* FLT_EPSILON is too small, see [#33106] */
typedef enum CD_UseFlag {
CD_DO_VERT = (1 << 0),
@@ -96,7 +98,7 @@ static void bm_decim_build_quadrics(BMesh *bm, Quadric *vquadrics)
f = e->l->f;
cross_v3_v3v3(edge_cross, edge_vector, f->no);
- if (fabsf(normalize_v3(edge_cross)) > FLT_EPSILON) {
+ if (normalize_v3(edge_cross) > FLT_EPSILON) {
Quadric q;
BLI_quadric_from_v3_dist(&q, edge_cross, -dot_v3v3(edge_cross, e->v1->co));
BLI_quadric_mul(&q, BOUNDARY_PRESERVE_WEIGHT);
@@ -122,7 +124,7 @@ static void bm_decim_calc_target_co(BMEdge *e, float optimize_co[3],
&vquadrics[BM_elem_index_get(e->v2)]);
- if (BLI_quadric_optimize(&q, optimize_co)) {
+ if (BLI_quadric_optimize(&q, optimize_co, OPTIMIZE_EPS)) {
return; /* all is good */
}
else {
@@ -774,6 +776,11 @@ static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
float optimize_co[3];
float customdata_fac;
+#ifdef USE_VERT_NORMAL_INTERP
+ float v_clear_no[3];
+ copy_v3_v3(v_clear_no, e->v2->no);
+#endif
+
bm_decim_calc_target_co(e, optimize_co, vquadrics);
/* use for customdata merging */
@@ -822,7 +829,13 @@ static void bm_decim_edge_collapse(BMesh *bm, BMEdge *e,
/* in fact face normals are not used for progressive updates, no need to update them */
// BM_vert_normal_update_all(v);
+#ifdef USE_VERT_NORMAL_INTERP
+ interp_v3_v3v3(v_other->no, v_other->no, v_clear_no, customdata_fac);
+ normalize_v3(v_other->no);
+#else
BM_vert_normal_update(v_other);
+#endif
+
/* update error costs and the eheap */
if (LIKELY(v_other->e)) {
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index a2f4cdc8c6a..671cfbbc55e 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -285,6 +285,8 @@ void BMO_slot_int_set(BMOperator *op, const char *slot_name, const int i);
int BMO_slot_int_get(BMOperator *op, const char *slot_name);
void BMO_slot_bool_set(BMOperator *op, const char *slot_name, const int i);
int BMO_slot_bool_get(BMOperator *op, const char *slot_name);
+void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len);
+
/* don't pass in arrays that are supposed to map to elements this way.
*
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 2413f3a7be0..4cc946a3a40 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -429,6 +429,20 @@ int BMO_slot_bool_get(BMOperator *op, const char *slot_name)
return slot->data.i;
}
+/* if you want a copy of the elem buffer */
+void *BMO_slot_as_arrayN(BMOperator *op, const char *slot_name, int *len)
+{
+ BMOpSlot *slot = BMO_slot_get(op, slot_name);
+ void *ret;
+
+ /* could add support for mapping type */
+ BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
+
+ ret = MEM_mallocN(sizeof(void *) * slot->len, __func__);
+ memcpy(ret, slot->data.buf, sizeof(void *) * slot->len);
+ *len = slot->len;
+ return ret;
+}
void *BMO_slot_ptr_get(BMOperator *op, const char *slot_name)
{
diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c
index c6b228b988e..937601712b0 100644
--- a/source/blender/bmesh/operators/bmo_mirror.c
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -88,7 +88,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
for (i = 0; i < ototvert; i++) {
- if (ABS(v->co[axis]) <= dist) {
+ if (fabsf(v->co[axis]) <= dist) {
BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", vmap[i], v);
}
v = BM_iter_step(&iter);
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index cd792f911a9..ea6cd747037 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -488,72 +488,71 @@ void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op)
static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, const char *targetmapname)
{
- BMOIter oiter;
- BMVert *v, *v2;
- BMVert **verts = NULL;
- BLI_array_declare(verts);
- float dist, dist3;
- int i, j, len, keepvert = 0;
-
- dist = BMO_slot_float_get(op, "dist");
- dist3 = dist * 3.0f;
-
- i = 0;
- BMO_ITER (v, &oiter, bm, op, "verts", BM_VERT) {
- BLI_array_grow_one(verts);
- verts[i++] = v;
- }
+ BMVert **verts;
+ int verts_len;
+
+ int i, j, keepvert = 0;
+
+ const float dist = BMO_slot_float_get(op, "dist");
+ const float dist3 = dist * 3.0f;
/* Test whether keep_verts arg exists and is non-empty */
if (BMO_slot_exists(op, "keep_verts")) {
+ BMOIter oiter;
keepvert = BMO_iter_new(&oiter, bm, op, "keep_verts", BM_VERT) != NULL;
}
+ /* get the verts as an array we can sort */
+ verts = BMO_slot_as_arrayN(op, "verts", &verts_len);
+
/* sort by vertex coordinates added together */
- qsort(verts, BLI_array_count(verts), sizeof(void *), vergaverco);
+ qsort(verts, verts_len, sizeof(BMVert *), vergaverco);
/* Flag keep_verts */
if (keepvert) {
BMO_slot_buffer_flag_enable(bm, op, "keep_verts", BM_VERT, VERT_KEEP);
}
- len = BLI_array_count(verts);
- for (i = 0; i < len; i++) {
- v = verts[i];
- if (BMO_elem_flag_test(bm, v, VERT_DOUBLE)) {
+ for (i = 0; i < verts_len; i++) {
+ BMVert *v_check = verts[i];
+
+ if (BMO_elem_flag_test(bm, v_check, VERT_DOUBLE)) {
continue;
}
- for (j = i + 1; j < len; j++) {
- v2 = verts[j];
+ for (j = i + 1; j < verts_len; j++) {
+ BMVert *v_other = verts[j];
/* Compare sort values of the verts using 3x tolerance (allowing for the tolerance
* on each of the three axes). This avoids the more expensive length comparison
* for most vertex pairs. */
- if ((v2->co[0] + v2->co[1] + v2->co[2]) - (v->co[0] + v->co[1] + v->co[2]) > dist3)
+ if ((v_other->co[0] + v_other->co[1] + v_other->co[2]) -
+ (v_check->co[0] + v_check->co[1] + v_check->co[2]) > dist3)
+ {
break;
+ }
if (keepvert) {
- if (BMO_elem_flag_test(bm, v2, VERT_KEEP) == BMO_elem_flag_test(bm, v, VERT_KEEP))
+ if (BMO_elem_flag_test(bm, v_other, VERT_KEEP) == BMO_elem_flag_test(bm, v_check, VERT_KEEP))
continue;
}
- if (compare_len_v3v3(v->co, v2->co, dist)) {
+ if (compare_len_v3v3(v_check->co, v_other->co, dist)) {
/* If one vert is marked as keep, make sure it will be the target */
- if (BMO_elem_flag_test(bm, v2, VERT_KEEP)) {
- SWAP(BMVert *, v, v2);
+ if (BMO_elem_flag_test(bm, v_other, VERT_KEEP)) {
+ SWAP(BMVert *, v_check, v_other);
}
- BMO_elem_flag_enable(bm, v2, VERT_DOUBLE);
- BMO_elem_flag_enable(bm, v, VERT_TARGET);
+ BMO_elem_flag_enable(bm, v_other, VERT_DOUBLE);
+ BMO_elem_flag_enable(bm, v_check, VERT_TARGET);
- BMO_slot_map_ptr_insert(bm, optarget, targetmapname, v2, v);
+ BMO_slot_map_ptr_insert(bm, optarget, targetmapname, v_other, v_check);
}
}
}
- BLI_array_free(verts);
+ MEM_freeN(verts);
}
void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op)
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index 1ad888e5989..0efead77cd4 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -102,12 +102,12 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo
int bufferstarty = inputBuffer->getRect()->ymin;
int miny = y;
- int maxy = y;
+ // int maxy = y; // UNUSED
int minx = x - this->m_rad;
- int maxx = x + this->m_rad;
+ int maxx = x + this->m_rad; // UNUSED
miny = max(miny, inputBuffer->getRect()->ymin);
minx = max(minx, inputBuffer->getRect()->xmin);
- maxy = min(maxy, inputBuffer->getRect()->ymax);
+ // maxy = min(maxy, inputBuffer->getRect()->ymax);
maxx = min(maxx, inputBuffer->getRect()->xmax);
/* *** this is the main part which is different to 'GaussianXBlurOperation' *** */
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index 60a325c5f38..1f9cc8e461a 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -104,11 +104,11 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo
int miny = y - this->m_rad;
int maxy = y + this->m_rad;
int minx = x;
- int maxx = x;
+ // int maxx = x; // UNUSED
miny = max(miny, inputBuffer->getRect()->ymin);
minx = max(minx, inputBuffer->getRect()->xmin);
- maxy = min(maxy, inputBuffer->getRect()->ymax);
- maxx = min(maxx, inputBuffer->getRect()->xmax);
+ maxy = min(maxy, inputBuffer->getRect()->ymax - 1);
+ // maxx = min(maxx, inputBuffer->getRect()->xmax);
/* *** this is the main part which is different to 'GaussianYBlurOperation' *** */
int step = getStep();
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index f6c30f7097c..573a19466e8 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -85,13 +85,13 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d
int bufferstarty = inputBuffer->getRect()->ymin;
int miny = y;
- int maxy = y;
+ // int maxy = y; // UNUSED
int minx = x - this->m_rad;
int maxx = x + this->m_rad;
miny = max(miny, inputBuffer->getRect()->ymin);
minx = max(minx, inputBuffer->getRect()->xmin);
- maxy = min(maxy, inputBuffer->getRect()->ymax);
- maxx = min(maxx, inputBuffer->getRect()->xmax);
+ // maxy = min(maxy, inputBuffer->getRect()->ymax);
+ maxx = min(maxx, inputBuffer->getRect()->xmax - 1);
int step = getStep();
int offsetadd = getOffsetAdd();
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 433771d2c0c..0c0a4d8aa4f 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -87,11 +87,11 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d
int miny = y - this->m_rad;
int maxy = y + this->m_rad;
int minx = x;
- int maxx = x;
+ // int maxx = x; // UNUSED
miny = max(miny, inputBuffer->getRect()->ymin);
minx = max(minx, inputBuffer->getRect()->xmin);
- maxy = min(maxy, inputBuffer->getRect()->ymax);
- maxx = min(maxx, inputBuffer->getRect()->xmax);
+ maxy = min(maxy, inputBuffer->getRect()->ymax - 1);
+ // maxx = min(maxx, inputBuffer->getRect()->xmax);
int index;
int step = getStep();
diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
index c9b129d8dcf..0874e2f59be 100644
--- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp
@@ -151,21 +151,24 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
zero_v3(site->color);
- for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
- if (pattern_ibuf->rect_float) {
- add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
- }
- else {
- unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
- site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
- site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
- site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+ if (pattern_ibuf) {
+ for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
+ if (pattern_ibuf->rect_float) {
+ add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
+ }
+ else {
+ unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
+
+ site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
+ site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
+ site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+ }
}
- }
- mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
- IMB_freeImBuf(pattern_ibuf);
+ mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
+ IMB_freeImBuf(pattern_ibuf);
+ }
site->co[0] = pos[0] * width;
site->co[1] = pos[1] * height;
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index ae7abd82600..28db7bf572d 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -325,8 +325,9 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Cannot add property to built in keying set");
return OPERATOR_CANCELLED;
}
- else
+ else {
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
+ }
/* try to add to keyingset using property retrieved from UI */
uiContextActiveProperty(C, &ptr, &prop, &index);
@@ -360,9 +361,10 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op)
if (success) {
/* send updates */
DAG_ids_flush_update(bmain, 0);
-
- /* for now, only send ND_KEYS for KeyingSets */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
+
+ /* show notification/report header, so that users notice that something changed */
+ BKE_reportf(op->reports, RPT_INFO, "Property added to Keying Set: '%s'", ks->name);
}
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
@@ -411,8 +413,9 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Cannot remove property from built in keying set");
return OPERATOR_CANCELLED;
}
- else
+ else {
ks = BLI_findlink(&scene->keyingsets, scene->active_keyingset - 1);
+ }
/* try to add to keyingset using property retrieved from UI */
uiContextActiveProperty(C, &ptr, &prop, &index);
@@ -425,7 +428,7 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
/* try to find a path matching this description */
ksp = BKE_keyingset_find_path(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
-
+
if (ksp) {
BKE_keyingset_free_path(ks, ksp);
success = 1;
@@ -440,9 +443,10 @@ static int remove_keyingset_button_exec(bContext *C, wmOperator *op)
if (success) {
/* send updates */
DAG_ids_flush_update(bmain, 0);
-
- /* for now, only send ND_KEYS for KeyingSets */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
+
+ /* show warning */
+ BKE_report(op->reports, RPT_INFO, "Property removed from Keying Set");
}
return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
@@ -891,11 +895,13 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
ksi->iter(ksi, C, ks);
/* if we don't have any paths now, then this still qualifies as invalid context */
+ // FIXME: we need some error conditions (to be retrieved from the iterator why this failed!)
if (ks->paths.first == NULL)
return MODIFYKEY_INVALID_CONTEXT;
}
else {
/* poll callback tells us that KeyingSet is useless in current context */
+ // FIXME: the poll callback needs to give us more info why
return MODIFYKEY_INVALID_CONTEXT;
}
}
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index d92c20a1265..fd87e6752f2 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1289,32 +1289,6 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
insert_into_textbuf(obedit, ascii);
accentcode = 0;
}
- else if (cu->len < MAXTEXT - 1) {
- if (alt) {
- /* might become obsolete, apple has default values for this, other OS's too? */
- if (ascii == 't') ascii = 137;
- else if (ascii == 'c') ascii = 169;
- else if (ascii == 'f') ascii = 164;
- else if (ascii == 'g') ascii = 176;
- else if (ascii == 'l') ascii = 163;
- else if (ascii == 'r') ascii = 174;
- else if (ascii == 's') ascii = 223;
- else if (ascii == 'y') ascii = 165;
- else if (ascii == '.') ascii = 138;
- else if (ascii == '1') ascii = 185;
- else if (ascii == '2') ascii = 178;
- else if (ascii == '3') ascii = 179;
- else if (ascii == '%') ascii = 139;
- else if (ascii == '?') ascii = 191;
- else if (ascii == '!') ascii = 161;
- else if (ascii == 'x') ascii = 215;
- else if (ascii == '>') ascii = 187;
- else if (ascii == '<') ascii = 171;
- }
-
- inserted_text[0] = ascii;
- insert_into_textbuf(obedit, ascii);
- }
kill_selection(obedit, 1);
text_update_edited(C, scene, obedit, 1, FO_EDIT);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index b8e4fec1259..c6e25ab9a34 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1902,8 +1902,9 @@ void ui_set_but_default(bContext *C, short all)
static double soft_range_round_up(double value, double max)
{
- /* round up to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
- double newmax = pow(10.0, ceil(log(value) / M_LN10));
+ /* round up to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, ..
+ * checking for 0.0 prevents floating point exceptions */
+ double newmax = (value != 0.0) ? pow(10.0, ceil(log(value) / M_LN10)) : 0.0;
if (newmax * 0.2 >= max && newmax * 0.2 >= value)
return newmax * 0.2;
@@ -1915,8 +1916,9 @@ static double soft_range_round_up(double value, double max)
static double soft_range_round_down(double value, double max)
{
- /* round down to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, .. */
- double newmax = pow(10.0, floor(log(value) / M_LN10));
+ /* round down to .., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, ..
+ * checking for 0.0 prevents floating point exceptions */
+ double newmax = (value != 0.0) ? pow(10.0, floor(log(value) / M_LN10)) : 0.0;
if (newmax * 5.0 <= max && newmax * 5.0 <= value)
return newmax * 5.0;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 469bd11215e..4d96ad810d4 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1597,17 +1597,15 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
&scopes->undist_marker, scopes->use_track_mask,
width, height, scopes->track_pos);
- if (tmpibuf->rect_float)
- IMB_rect_from_float(tmpibuf);
+ if (tmpibuf) {
+ if (tmpibuf->rect_float)
+ IMB_rect_from_float(tmpibuf);
- /* XXX: for debug only
- * tmpibuf->ftype = PNG;
- * IMB_saveiff(tmpibuf, "sample.png", IB_rect); */
-
- if (tmpibuf->rect)
- scopes->track_preview = tmpibuf;
- else
- IMB_freeImBuf(tmpibuf);
+ if (tmpibuf->rect)
+ scopes->track_preview = tmpibuf;
+ else
+ IMB_freeImBuf(tmpibuf);
+ }
}
if (!ok && scopes->track_preview) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 6d262daab12..ecb161714ee 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3306,7 +3306,7 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
ui_get_but_vectorf(but, rgb);
- if (color_profile && (int)but->a1)
+ if (color_profile && (int)but->a1 != UI_GRAD_SV)
ui_block_to_display_space_v3(but->block, rgb);
rgb_to_hsv_compat_v(rgb, hsv);
@@ -3352,7 +3352,7 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
hsv_to_rgb_v(hsv, rgb);
- if (color_profile && (int)but->a1)
+ if (color_profile && ((int)but->a1 != UI_GRAD_SV))
ui_block_to_scene_linear_v3(but->block, rgb);
copy_v3_v3(data->vec, rgb);
@@ -3378,7 +3378,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
ui_get_but_vectorf(but, rgb);
- if (color_profile && (int)but->a1)
+ if (color_profile && (int)but->a1 != UI_GRAD_SV)
ui_block_to_display_space_v3(but->block, rgb);
rgb_to_hsv_compat_v(rgb, hsv);
@@ -3418,7 +3418,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
hsv_to_rgb_v(hsv, rgb);
- if (color_profile && (int)but->a1)
+ if (color_profile && (int)but->a1 != UI_GRAD_SV)
ui_block_to_scene_linear_v3(but->block, rgb);
copy_v3_v3(data->vec, rgb);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 16159e0f73a..540a9cc752b 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -176,7 +176,25 @@ struct uiBut {
char *poin;
float hardmin, hardmax, softmin, softmax;
- float a1, a2;
+
+ /* both these values use depends on the button type
+ * (polymorphic struct or union would be nicer for this stuff) */
+
+ /* (type == COLOR), Use UI_GRAD_* values.
+ * (type == NUM), Use to store RNA 'step' value, for dragging and click-step.
+ * (type == LABEL), Use (a1 == 1.0f) to use a2 as a blending factor (wow, this is imaginative!).
+ * (type == SCROLL) Use as scroll size.
+ * (type == SEARCH_MENU) Use as number or rows.
+ */
+ float a1;
+
+ /* (type == HSVCIRCLE ), Use to store the luminosity.
+ * (type == NUM), Use to store RNA 'precision' value, for dragging and click-step.
+ * (type == LABEL), If (a1 == 1.0f) use a2 as a blending factor.
+ * (type == SEARCH_MENU) Use as number or columns.
+ */
+ float a2;
+
float aspect;
unsigned char col[4];
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 5170fc7d51b..52d909a34c0 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1780,7 +1780,7 @@ static void ui_litem_layout_row(uiLayout *litem)
if (item->flag) {
/* fixed minimum size items */
- itemw = ui_item_fit(minw, fixedx, fixedw, MIN2(w, fixedw), !item->next, litem->alignment, NULL);
+ itemw = ui_item_fit(minw, fixedx, fixedw, min_ii(w, fixedw), !item->next, litem->alignment, NULL);
fixedx += itemw;
}
else {
@@ -1959,9 +1959,9 @@ static void ui_litem_estimate_column_flow(uiLayout *litem)
ui_item_size(item, &itemw, &itemh);
y -= itemh + style->buttonspacey;
- miny = MIN2(miny, y);
+ miny = min_ii(miny, y);
emy -= itemh;
- maxw = MAX2(itemw, maxw);
+ maxw = max_ii(itemw, maxw);
/* decide to go to next one */
if (col < flow->totcol - 1 && emy <= -emh) {
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 4476296866e..900bf57b509 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -903,11 +903,16 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
/* offset other selected objects */
if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
CollectionPointerLink *ctx_link_other;
+ float obmat[4][4];
/* was the object data modified
* note: the functions above must set 'cent' */
+
+ /* convert the offset to parent space */
+ BKE_object_to_mat4(ob, obmat);
copy_v3_v3(centn, cent);
- mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */
+ mul_mat3_m4_v3(obmat, centn); /* omit translation part */
+
add_v3_v3(ob->loc, centn);
BKE_object_where_is_calc(scene, ob);
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 218af8f0f33..7cd153d9564 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -574,7 +574,8 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
fsmesh.channelScale = NULL;
/* Override user settings, only noslip is supported here! */
- fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
+ if (fsmesh.type != OB_FLUIDSIM_CONTROL)
+ fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
}
elbeemAddMesh(&fsmesh);
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index fe802abc3a9..4b177629f72 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -295,7 +295,11 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
if (rs->tothalo) spos += sprintf(spos, "Ha:%d ", rs->tothalo);
if (rs->totstrand) spos += sprintf(spos, "St:%d ", rs->totstrand);
if (rs->totlamp) spos += sprintf(spos, "La:%d ", rs->totlamp);
- spos += sprintf(spos, "Mem:%.2fM (%.2fM, peak %.2fM) ", megs_used_memory, mmap_used_memory, megs_peak_memory);
+
+ if (rs->mem_peak == 0.0f)
+ spos += sprintf(spos, "Mem:%.2fM (%.2fM, peak %.2fM) ", megs_used_memory, mmap_used_memory, megs_peak_memory);
+ else
+ spos += sprintf(spos, "Mem:%.2fM, Peak: %.2fM ", rs->mem_used, rs->mem_peak);
if (rs->curfield)
spos += sprintf(spos, "Field %d ", rs->curfield);
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index a2f31b35246..b119165fbd0 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -237,6 +237,14 @@ static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
return 0;
}
+static Scene *preview_get_scene(void)
+{
+ if (pr_main == NULL) return NULL;
+
+ return pr_main->scene.first;
+}
+
+
/* call this with a pointer to initialize preview scene */
/* call this with NULL to restore assigned ID pointers in preview scene */
static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPreview *sp)
@@ -244,9 +252,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
Scene *sce;
Base *base;
- if (pr_main == NULL) return NULL;
-
- sce = pr_main->scene.first;
+ sce = preview_get_scene();
if (sce) {
/* this flag tells render to not execute depsgraph or ipos etc */
@@ -266,10 +272,13 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
BKE_color_managed_view_settings_copy(&sce->view_settings, &scene->view_settings);
/* prevent overhead for small renders and icons (32) */
- if (id && sp->sizex < 40)
- sce->r.xparts = sce->r.yparts = 1;
- else
- sce->r.xparts = sce->r.yparts = 4;
+ if (id && sp->sizex < 40) {
+ sce->r.tilex = sce->r.tiley = 64;
+ }
+ else {
+ sce->r.tilex = sce->r.xsch / 4;
+ sce->r.tiley = sce->r.ysch / 4;
+ }
/* exception: don't apply render part of display transform for texture previews or icons */
if ((id && sp->pr_method == PR_ICON_RENDER) || id_type == ID_TE) {
@@ -662,8 +671,23 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
char name[32];
int sizex;
+ /* in case of split preview, use border render */
+ if (split) {
+ if (first) sizex = sp->sizex / 2;
+ else sizex = sp->sizex - sp->sizex / 2;
+ }
+ else sizex = sp->sizex;
+
+ /* we have to set preview variables first */
+ sce = preview_get_scene();
+ if (sce) {
+ sce->r.xsch = sizex;
+ sce->r.ysch = sp->sizey;
+ sce->r.size = 100;
+ }
+
/* get the stuff from the builtin preview dbase */
- sce = preview_prepare_scene(sp->scene, id, idtype, sp); // XXX sizex
+ sce = preview_prepare_scene(sp->scene, id, idtype, sp);
if (sce == NULL) return;
if (!split || first) sprintf(name, "Preview %p", sp->owner);
@@ -691,17 +715,6 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
sce->r.mode |= R_OSA;
}
- /* in case of split preview, use border render */
- if (split) {
- if (first) sizex = sp->sizex / 2;
- else sizex = sp->sizex - sp->sizex / 2;
- }
- else sizex = sp->sizex;
-
- /* allocates or re-uses render result */
- sce->r.xsch = sizex;
- sce->r.ysch = sp->sizey;
- sce->r.size = 100;
/* callbacs are cleared on GetRender() */
if (ELEM(sp->pr_method, PR_BUTS_RENDER, PR_NODE_RENDER)) {
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index c5320fde0ff..0a2ca379518 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -378,6 +378,12 @@ static void scene_changed(Main *bmain, Scene *UNUSED(scene))
void ED_render_id_flush_update(Main *bmain, ID *id)
{
+ /* this can be called from render or baking thread when a python script makes
+ * changes, in that case we don't want to do any editor updates, and making
+ * GPU changes is not possible because OpenGL only works in the main thread */
+ if (!BLI_thread_is_main())
+ return;
+
switch (GS(id->name)) {
case ID_MA:
material_changed(bmain, (Material *)id);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index e00a8776bea..bd6852c4344 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -288,9 +288,11 @@ typedef struct ProjPaintState {
char *vertFlags; /* store options per vert, now only store if the vert is pointing away from the view */
int buckets_x; /* The size of the bucket grid, the grid span's screenMin/screenMax so you can paint outsize the screen or with 2 brushes at once */
int buckets_y;
-
+
ProjPaintImage *projImages;
+ int pixel_sizeof; /* result of project_paint_pixel_sizeof(), constant per stroke */
+
int image_tot; /* size of projectImages array */
float (*screenCoords)[4]; /* verts projected into floating point screen space */
@@ -379,6 +381,18 @@ typedef struct ProjPixelClone {
PixelStore clonepx;
} ProjPixelClone;
+/* blur, store surrounding colors */
+#define PROJ_PIXEL_SOFTEN_TOT 4
+/* blur picking offset (in screenspace) */
+#define PROJ_PIXEL_SOFTEN_OFS_PX 1.0f
+
+static const float proj_pixel_soften_v2[PROJ_PIXEL_SOFTEN_TOT][2] = {
+ {-PROJ_PIXEL_SOFTEN_OFS_PX, 0.0f},
+ { 0.0f, -PROJ_PIXEL_SOFTEN_OFS_PX},
+ { 0.0f, PROJ_PIXEL_SOFTEN_OFS_PX},
+ { PROJ_PIXEL_SOFTEN_OFS_PX, 0.0f},
+};
+
/* Finish projection painting structs */
typedef struct UndoImageTile {
@@ -1491,6 +1505,16 @@ static float project_paint_uvpixel_mask(
return mask;
}
+static int project_paint_pixel_sizeof(const short tool)
+{
+ if ((tool == PAINT_TOOL_CLONE) || (tool == PAINT_TOOL_SMEAR)) {
+ return sizeof(ProjPixelClone);
+ }
+ else {
+ return sizeof(ProjPixel);
+ }
+}
+
/* run this function when we know a bucket's, face's pixel can be initialized,
* return the ProjPixel which is added to 'ps->bucketRect[bucket_index]' */
static ProjPixel *project_paint_uvpixel_init(
@@ -1506,33 +1530,23 @@ static ProjPixel *project_paint_uvpixel_init(
const float w[3])
{
ProjPixel *projPixel;
- short size;
-
+
/* wrap pixel location */
x_px = x_px % ibuf->x;
if (x_px < 0) x_px += ibuf->x;
y_px = y_px % ibuf->y;
if (y_px < 0) y_px += ibuf->y;
-
- if (ps->tool == PAINT_TOOL_CLONE) {
- size = sizeof(ProjPixelClone);
- }
- else if (ps->tool == PAINT_TOOL_SMEAR) {
- size = sizeof(ProjPixelClone);
- }
- else {
- size = sizeof(ProjPixel);
- }
-
- projPixel = (ProjPixel *)BLI_memarena_alloc(arena, size);
+
+ BLI_assert(ps->pixel_sizeof == project_paint_pixel_sizeof(ps->tool));
+ projPixel = (ProjPixel *)BLI_memarena_alloc(arena, ps->pixel_sizeof);
//memset(projPixel, 0, size);
if (ibuf->rect_float) {
projPixel->pixel.f_pt = ibuf->rect_float + ((x_px + y_px * ibuf->x) * 4);
- projPixel->origColor.f[0] = projPixel->newColor.f[0] = projPixel->pixel.f_pt[0];
- projPixel->origColor.f[1] = projPixel->newColor.f[1] = projPixel->pixel.f_pt[1];
- projPixel->origColor.f[2] = projPixel->newColor.f[2] = projPixel->pixel.f_pt[2];
- projPixel->origColor.f[3] = projPixel->newColor.f[3] = projPixel->pixel.f_pt[3];
+ projPixel->origColor.f[0] = projPixel->newColor.f[0] = projPixel->pixel.f_pt[0];
+ projPixel->origColor.f[1] = projPixel->newColor.f[1] = projPixel->pixel.f_pt[1];
+ projPixel->origColor.f[2] = projPixel->newColor.f[2] = projPixel->pixel.f_pt[2];
+ projPixel->origColor.f[3] = projPixel->newColor.f[3] = projPixel->pixel.f_pt[3];
}
else {
projPixel->pixel.ch_pt = ((unsigned char *)ibuf->rect + ((x_px + y_px * ibuf->x) * 4));
@@ -3814,6 +3828,84 @@ static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, fl
BLI_linklist_prepend_arena(smearPixels_f, (void *)projPixel, smearArena);
}
+/* do_projectpaint_soften for float & byte
+ */
+static float inv_pow2(float f)
+{
+ f = 1.0f - f;
+ f = f * f;
+ return 1.0f - f;
+}
+
+static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *softenArena, LinkNode **softenPixels)
+{
+ unsigned int accum_tot = 0;
+ unsigned int i;
+
+ float *rgba = projPixel->newColor.f;
+
+ /* sigh, alpha values tend to need to be a _lot_ stronger with blur */
+ mask = inv_pow2(mask);
+ alpha = inv_pow2(alpha);
+
+ /* rather then painting, accumulate surrounding colors */
+ zero_v4(rgba);
+
+ for (i = 0; i < PROJ_PIXEL_SOFTEN_TOT; i++) {
+ float co_ofs[2];
+ float rgba_tmp[4];
+ sub_v2_v2v2(co_ofs, projPixel->projCoSS, proj_pixel_soften_v2[i]);
+ if (project_paint_PickColor(ps, co_ofs, rgba_tmp, NULL, TRUE)) {
+ add_v4_v4(rgba, rgba_tmp);
+ accum_tot++;
+ }
+ }
+
+ if (LIKELY(accum_tot != 0)) {
+ mul_v4_fl(rgba, 1.0f / (float)accum_tot);
+ blend_color_mix_float(rgba, projPixel->pixel.f_pt, rgba, alpha);
+ if (mask < 1.0f) blend_color_mix_float(rgba, projPixel->origColor.f, rgba, mask);
+ BLI_linklist_prepend_arena(softenPixels, (void *)projPixel, softenArena);
+ }
+}
+
+static void do_projectpaint_soften(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask, MemArena *softenArena, LinkNode **softenPixels)
+{
+ unsigned int accum_tot = 0;
+ unsigned int i;
+
+ float rgba[4]; /* convert to byte after */
+
+ /* sigh, alpha values tend to need to be a _lot_ stronger with blur */
+ mask = inv_pow2(mask);
+ alpha = inv_pow2(alpha);
+
+ /* rather then painting, accumulate surrounding colors */
+ zero_v4(rgba);
+
+ for (i = 0; i < PROJ_PIXEL_SOFTEN_TOT; i++) {
+ float co_ofs[2];
+ float rgba_tmp[4];
+ sub_v2_v2v2(co_ofs, projPixel->projCoSS, proj_pixel_soften_v2[i]);
+ if (project_paint_PickColor(ps, co_ofs, rgba_tmp, NULL, TRUE)) {
+ add_v4_v4(rgba, rgba_tmp);
+ accum_tot++;
+ }
+ }
+
+ if (LIKELY(accum_tot != 0)) {
+ unsigned char *rgba_ub = projPixel->newColor.ch;
+
+ mul_v4_fl(rgba, 1.0f / (float)accum_tot);
+ IMAPAINT_FLOAT_RGBA_TO_CHAR(rgba_ub, rgba);
+
+ blend_color_mix(rgba_ub, projPixel->pixel.ch_pt, rgba_ub, (int)(alpha * 255));
+ if (mask != 1.0f) blend_color_mix(rgba_ub, projPixel->origColor.ch, rgba_ub, (int)(mask * 255));
+ BLI_linklist_prepend_arena(softenPixels, (void *)projPixel, softenArena);
+ }
+}
+
+
static void do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, const float rgba[4], float alpha, float mask)
{
unsigned char rgba_ub[4];
@@ -3912,6 +4004,10 @@ static void *do_projectpaint_thread(void *ph_v)
LinkNode *smearPixels = NULL;
LinkNode *smearPixels_f = NULL;
MemArena *smearArena = NULL; /* mem arena for this brush projection only */
+
+ LinkNode *softenPixels = NULL;
+ LinkNode *softenPixels_f = NULL;
+ MemArena *softenArena = NULL; /* mem arena for this brush projection only */
if (tool == PAINT_TOOL_SMEAR) {
pos_ofs[0] = pos[0] - lastpos[0];
@@ -3919,6 +4015,9 @@ static void *do_projectpaint_thread(void *ph_v)
smearArena = BLI_memarena_new(1 << 16, "paint smear arena");
}
+ else if (tool == PAINT_TOOL_SOFTEN) {
+ softenArena = BLI_memarena_new(1 << 16, "paint soften arena");
+ }
/* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
@@ -4058,6 +4157,10 @@ static void *do_projectpaint_thread(void *ph_v)
if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, alpha, mask, smearArena, &smearPixels_f, co);
else do_projectpaint_smear(ps, projPixel, alpha, mask, smearArena, &smearPixels, co);
break;
+ case PAINT_TOOL_SOFTEN:
+ if (is_floatbuf) do_projectpaint_soften_f(ps, projPixel, alpha, mask, softenArena, &softenPixels_f);
+ else do_projectpaint_soften(ps, projPixel, alpha, mask, softenArena, &softenPixels);
+ break;
default:
if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, rgba, alpha, mask, use_color_correction);
else do_projectpaint_draw(ps, projPixel, rgba, alpha, mask);
@@ -4092,7 +4195,21 @@ static void *do_projectpaint_thread(void *ph_v)
BLI_memarena_free(smearArena);
}
-
+ else if (tool == PAINT_TOOL_SOFTEN) {
+
+ for (node = softenPixels; node; node = node->next) { /* this wont run for a float image */
+ projPixel = node->link;
+ *projPixel->pixel.uint_pt = projPixel->newColor.uint;
+ }
+
+ for (node = softenPixels_f; node; node = node->next) {
+ projPixel = node->link;
+ copy_v4_v4(projPixel->pixel.f_pt, projPixel->newColor.f);
+ }
+
+ BLI_memarena_free(softenArena);
+ }
+
return NULL;
}
@@ -4842,6 +4959,10 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
ps->tool = brush->imagepaint_tool;
ps->blend = brush->blend;
+ /* sizeof ProjPixel, since we alloc this a _lot_ */
+ ps->pixel_sizeof = project_paint_pixel_sizeof(ps->tool);
+ BLI_assert(ps->pixel_sizeof >= sizeof(ProjPixel));
+
ps->is_airbrush = (brush->flag & BRUSH_AIRBRUSH) ? 1 : 0;
ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
@@ -4907,13 +5028,6 @@ static int texture_paint_init(bContext *C, wmOperator *op)
pop->first = 1;
op->customdata = pop;
-
- /* XXX: Soften tool does not support projection painting atm, so just disable
- * projection for this brush */
- if (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) {
- settings->imapaint.flag |= IMAGEPAINT_PROJECT_DISABLE;
- pop->restore_projection = 1;
- }
/* initialize from context */
if (CTX_wm_region_view3d(C)) {
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index fc9c040852f..a2e4da719e9 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -213,7 +213,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
UI_ThemeColor(TH_CFRAME);
- glRecti(x, 0, x + framelen, 8);
+ glRecti(x, 0, x + ceilf(framelen), 8);
clip_draw_curfra_label(sc->user.framenr, x, 8.0f);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index dd939d57cbe..d97b112e95d 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -2944,6 +2944,19 @@ void CLIP_OT_track_copy_color(wmOperatorType *ot)
/********************** add 2d stabilization tracks operator *********************/
+static int stabilize_2d_poll(bContext *C)
+{
+ if (ED_space_clip_tracking_poll(C)) {
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+ MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(&clip->tracking);
+
+ return tracking_object->flag & TRACKING_OBJECT_CAMERA;
+ }
+
+ return FALSE;
+}
+
static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -2985,7 +2998,7 @@ void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_add_exec;
- ot->poll = ED_space_clip_tracking_poll;
+ ot->poll = stabilize_2d_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3045,7 +3058,7 @@ void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_remove_exec;
- ot->poll = ED_space_clip_tracking_poll;
+ ot->poll = stabilize_2d_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3088,7 +3101,7 @@ void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_select_exec;
- ot->poll = ED_space_clip_tracking_poll;
+ ot->poll = stabilize_2d_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -3125,7 +3138,7 @@ void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
/* api callbacks */
ot->exec = stabilize_2d_set_rotation_exec;
- ot->poll = ED_space_clip_tracking_poll;
+ ot->poll = stabilize_2d_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index c24447f16c3..2fc312b6205 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -744,6 +744,7 @@ void filelist_setfilter_types(struct FileList *filelist, const char *filter_glob
BLI_strncpy(filelist->filter_glob, filter_glob, sizeof(filelist->filter_glob));
}
+/* would recognize .blend as well */
static int file_is_blend_backup(const char *str)
{
short a, b;
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 49562958f82..778a3f4df3e 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -164,6 +164,8 @@ short ED_fileselect_set_params(SpaceFile *sfile)
params->filter = 0;
if (RNA_struct_find_property(op->ptr, "filter_blender"))
params->filter |= RNA_boolean_get(op->ptr, "filter_blender") ? BLENDERFILE : 0;
+ if (RNA_struct_find_property(op->ptr, "filter_backup"))
+ params->filter |= RNA_boolean_get(op->ptr, "filter_backup") ? BLENDERFILE_BACKUP : 0;
if (RNA_struct_find_property(op->ptr, "filter_image"))
params->filter |= RNA_boolean_get(op->ptr, "filter_image") ? IMAGEFILE : 0;
if (RNA_struct_find_property(op->ptr, "filter_movie"))
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index c7f9bd87a1b..ce3c6e1fd26 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -618,7 +618,7 @@ void IMAGE_OT_view_all(wmOperatorType *ot)
/* identifiers */
ot->name = "View All";
ot->idname = "IMAGE_OT_view_all";
- ot->description = "View the whole picture";
+ ot->description = "View the entire image";
/* api callbacks */
ot->exec = image_view_all_exec;
@@ -805,7 +805,7 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom Ratio";
ot->idname = "IMAGE_OT_view_zoom_ratio";
- ot->description = "Set zoom ration of the view";
+ ot->description = "Set zoom ratio of the view";
/* api callbacks */
ot->exec = image_view_zoom_ratio_exec;
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index f108881091a..cba0a808d63 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -58,6 +58,7 @@
#include "UI_view2d.h"
#include "info_intern.h" /* own include */
+#include "BLO_readfile.h"
/* ******************** default callbacks for info space ***************** */
@@ -271,11 +272,16 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
{
struct RecentFile *recent;
+ char file [FILE_MAX];
uiLayout *layout = menu->layout;
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
if (G.recent_files.first) {
for (recent = G.recent_files.first; (recent); recent = recent->next) {
- uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ BLI_split_file_part(recent->filepath, file, sizeof(file));
+ if (BLO_has_bfile_extension(file))
+ uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ else
+ uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BACKUP, "WM_OT_open_mainfile", "filepath", recent->filepath);
}
}
else {
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 0938562857b..aafd4abb25e 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -108,6 +108,43 @@ static void node_socket_button_default(const bContext *C, uiBlock *block,
}
}
+static void node_socket_button_string(const bContext *C, uiBlock *block,
+ bNodeTree *ntree, bNode *node, bNodeSocket *sock,
+ const char *name, int x, int y, int width)
+{
+ if (sock->link || (sock->flag & SOCK_HIDE_VALUE))
+ node_socket_button_label(C, block, ntree, node, sock, name, x, y, width);
+ else {
+ PointerRNA ptr;
+ uiBut *bt;
+
+ SpaceNode *snode = CTX_wm_space_node(C);
+ const char *ui_name = IFACE_(name);
+ float slen;
+
+ UI_ThemeColor(TH_TEXT);
+ slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt;
+ while (slen > (width * 0.5f) && *ui_name) {
+ ui_name = BLI_str_find_next_char_utf8(ui_name, NULL);
+ slen = (UI_GetStringWidth(ui_name) + NODE_MARGIN_X) * snode->aspect_sqrt;
+ }
+
+ RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
+
+ if (name[0] == '\0')
+ slen = 0.0;
+
+ bt = uiDefButR(block, TEX, B_NODE_EXEC, "",
+ x, y + 1, width - slen, NODE_DY - 2,
+ &ptr, "default_value", 0, 0, 0, -1, -1, "");
+ if (node)
+ uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
+
+ if (slen > 0.0f)
+ uiDefBut(block, LABEL, 0, IFACE_(name), x + (width - slen), y + 2, slen, NODE_DY - 2, NULL, 0, 0, 0, 0, "");
+ }
+}
+
typedef struct SocketComponentMenuArgs {
PointerRNA ptr;
int x, y, width;
@@ -209,9 +246,9 @@ static void node_draw_output_default(const bContext *C, uiBlock *block,
if (*ui_name) {
uiDefBut(block, LABEL, 0, ui_name,
- (int)(sock->locx - slen), (int)(sock->locy - 9.0f),
- (short)slen, (short)NODE_DY,
- NULL, 0, 0, 0, 0, "");
+ (int)(sock->locx - slen), (int)(sock->locy - 9.0f),
+ (short)slen, (short)NODE_DY,
+ NULL, 0, 0, 0, 0, "");
}
}
@@ -486,8 +523,9 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
bNodeSocket *sock, *gsock;
float locx, locy;
rctf *rect = &gnode->totr;
- float node_group_frame = U.dpi * NODE_GROUP_FRAME / 72;
- float group_header = 26 * U.dpi / 72;
+ const float dpi_fac = UI_DPI_ICON_FAC;
+ const float node_group_frame = NODE_GROUP_FRAME * dpi_fac;
+ const float group_header = 26 * dpi_fac;
int counter;
int dy;
@@ -664,7 +702,7 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *
static void draw_group_socket(const bContext *C, SpaceNode *snode, bNodeTree *ntree, bNode *gnode,
bNodeSocket *sock, bNodeSocket *gsock, int index, int in_out)
{
- const float dpi_fac = U.dpi / 72.0f;
+ const float dpi_fac = UI_DPI_ICON_FAC;
bNodeTree *ngroup = (bNodeTree *)gnode->id;
bNodeSocketType *stype = ntreeGetSocketType(gsock ? gsock->type : sock->type);
uiBut *bt;
@@ -776,9 +814,9 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiLayout *layout;
PointerRNA ptr;
rctf rect = gnode->totr;
- const float dpi_fac = U.dpi / 72.0f;
- float node_group_frame = NODE_GROUP_FRAME * dpi_fac;
- float group_header = 26 * dpi_fac;
+ const float dpi_fac = UI_DPI_ICON_FAC;
+ const float node_group_frame = NODE_GROUP_FRAME * dpi_fac;
+ const float group_header = 26 * dpi_fac;
int index;
@@ -1379,6 +1417,46 @@ static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), Po
uiItemR(layout, ptr, "from_dupli", 0, NULL, 0);
}
+static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "space", 0, "", 0);
+
+ if (RNA_enum_get(ptr, "space") == SHD_NORMAL_MAP_TANGENT) {
+ PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+
+ if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+ uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_textures", "", ICON_NONE);
+ }
+ else
+ uiItemR(layout, ptr, "uv_map", 0, "", 0);
+ }
+}
+
+static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiLayout *split, *row;
+
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
+
+ uiItemR(split, ptr, "direction_type", 0, "", 0);
+
+ row = uiLayoutRow(split, FALSE);
+
+ if (RNA_enum_get(ptr, "direction_type") == SHD_TANGENT_UVMAP) {
+ PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
+
+ if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+ PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
+ uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_textures", "", ICON_NONE);
+ }
+ else
+ uiItemR(row, ptr, "uv_map", 0, "", 0);
+ }
+ else
+ uiItemR(row, ptr, "axis", UI_ITEM_R_EXPAND, NULL, 0);
+}
+
static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "distribution", 0, "", ICON_NONE);
@@ -1408,7 +1486,7 @@ static void node_shader_buts_script_details(uiLayout *layout, bContext *C, Point
node_shader_buts_script(layout, C, ptr);
/* not implemented yet
- if(RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL)
+ if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL)
uiItemR(layout, ptr, "use_auto_update", 0, NULL, ICON_NONE);*/
}
@@ -1491,8 +1569,15 @@ static void node_shader_set_butfunc(bNodeType *ntype)
case SH_NODE_TEX_COORD:
ntype->uifunc = node_shader_buts_tex_coord;
break;
+ case SH_NODE_NORMAL_MAP:
+ ntype->uifunc = node_shader_buts_normal_map;
+ break;
+ case SH_NODE_TANGENT:
+ ntype->uifunc = node_shader_buts_tangent;
+ break;
case SH_NODE_BSDF_GLOSSY:
case SH_NODE_BSDF_GLASS:
+ case SH_NODE_BSDF_REFRACTION:
ntype->uifunc = node_shader_buts_glossy;
break;
case SH_NODE_SCRIPT:
@@ -3089,6 +3174,9 @@ void ED_node_init_butfuncs(void)
case SOCK_BOOLEAN:
stype->buttonfunc = node_socket_button_default;
break;
+ case SOCK_STRING:
+ stype->buttonfunc = node_socket_button_string;
+ break;
case SOCK_VECTOR:
stype->buttonfunc = node_socket_button_components;
break;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 1d3b21fe2d6..72461cfb2a8 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -843,7 +843,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
rctf *rct = &node->totr;
float dx, centy = BLI_rctf_cent_y(rct);
float hiddenrad = BLI_rctf_size_y(rct) / 2.0f;
- float socket_size = NODE_SOCKSIZE * U.dpi / 72;
+ float socket_size = NODE_SOCKSIZE * UI_DPI_ICON_FAC;
int color_id = node_get_colorid(node);
char showname[128]; /* 128 is used below */
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 6bf0e9f73e3..5dd005e9ddf 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2232,7 +2232,7 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op)
ntreetype->foreach_nodetree(bmain, &data, node_shader_script_update_text);
if (!data.found)
- BKE_report(op->reports, RPT_INFO, "Text not used by any node, no update done.");
+ BKE_report(op->reports, RPT_INFO, "Text not used by any node, no update done");
}
}
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 19a678a9c6e..5f8b5db7766 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -875,7 +875,7 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
bNodeTree *ngroup = (bNodeTree *)gnode->id;
bNodeLink *link, *linkn;
bNode *node, *nextn;
- bNodeSocket *gsock;
+ bNodeSocket *gsock, *sock;
ListBase anim_basepaths = {NULL, NULL};
float min[2], max[2];
@@ -982,8 +982,42 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
}
}
+ /* auto-add interface for "solo" nodes */
+ node = ((bNodeTree *)gnode->id)->nodes.first;
+ if (node && !node->next) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
+ int skip = FALSE;
+
+ for (link = ((bNodeTree *)gnode->id)->links.first; link; link = link->next)
+ if (link->tosock == sock)
+ skip = TRUE;
+
+ if (skip == TRUE)
+ continue;
+
+ gsock = node_group_expose_socket(ngroup, sock, SOCK_IN);
+ node_group_add_extern_socket(ntree, &gnode->inputs, SOCK_IN, gsock);
+ nodeAddLink(ngroup, NULL, gsock, node, sock);
+ }
+
+ for (sock = node->outputs.first; sock; sock = sock->next) {
+ int skip = FALSE;
+
+ for (link = ((bNodeTree *)gnode->id)->links.first; link; link = link->next)
+ if (link->fromsock == sock)
+ skip = TRUE;
+
+ if (skip == TRUE)
+ continue;
+
+ gsock = node_group_expose_socket(ngroup, sock, SOCK_OUT);
+ node_group_add_extern_socket(ntree, &gnode->outputs, SOCK_OUT, gsock);
+ nodeAddLink(ngroup, NULL, gsock, node, sock);
+ }
+ }
+
/* update of the group tree */
- ngroup->update |= NTREE_UPDATE;
+ ngroup->update |= NTREE_UPDATE | NTREE_UPDATE_LINKS;
/* update of the tree containing the group instance node */
ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS;
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index fd46f69da83..8155f9d645e 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -719,7 +719,9 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
seq->endstill = seq_load.end_frame - seq_load.start_frame;
}
}
-
+
+ BKE_sequence_init_colorspace(seq);
+
BKE_sequence_calc_disp(scene, seq);
BKE_sequencer_sort(scene);
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 29babd355ad..a8103fe2630 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -285,8 +285,8 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
drawmeta_stipple(1);
for (seq = seqm->seqbase.first; seq; seq = seq->next) {
- chan_min = MIN2(chan_min, seq->machine);
- chan_max = MAX2(chan_max, seq->machine);
+ chan_min = min_ii(chan_min, seq->machine);
+ chan_max = max_ii(chan_max, seq->machine);
}
chan_range = (chan_max - chan_min) + 1;
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 0a282a17f74..4d4fad47698 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2857,14 +2857,8 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
engine = RE_engine_create(type);
- engine->tile_x = ceil(ar->winx / (float)scene->r.xparts);
- engine->tile_y = ceil(ar->winy / (float)scene->r.yparts);
-
- /* clamp small tile sizes to prevent inefficient threading utilization
- * the same happens for final renders as well
- */
- engine->tile_x = max_ii(engine->tile_x, 64);
- engine->tile_y = max_ii(engine->tile_x, 64);
+ engine->tile_x = scene->r.tilex;
+ engine->tile_y = scene->r.tiley;
type->view_update(engine, C);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 36d7341f2f2..c7ba3378073 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -992,8 +992,10 @@ void ndof_to_quat(struct wmNDOFMotionData *ndof, float q[4])
* -- zooming
* -- panning in rotationally-locked views
*/
-static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
+ ViewOpsData *vod = op->customdata;
+
if (event->type != NDOF_MOTION)
return OPERATOR_CANCELLED;
else {
@@ -1074,6 +1076,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
rot[1] = rot[2] = 0.0;
rot[3] = sin(angle);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+
}
else {
float rot[4];
@@ -1088,6 +1091,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
axis[1] = -axis[1];
+
/* transform rotation axis from view to world coordinates */
mul_qt_v3(view_inv, axis);
@@ -1100,7 +1104,22 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
/* apply rotation */
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
-
+
+ }
+
+ /* rotate around custom center */
+ if (vod && vod->use_dyn_ofs) {
+ float q1[4];
+
+ /* compute the post multiplication quat, to rotate the offset correctly */
+ conjugate_qt_qt(q1, vod->oldquat);
+ mul_qt_qtqt(q1, q1, rv3d->viewquat);
+
+ conjugate_qt(q1); /* conj == inv for unit quat */
+ copy_v3_v3(rv3d->ofs, vod->ofs);
+ sub_v3_v3(rv3d->ofs, vod->dyn_ofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3(rv3d->ofs, vod->dyn_ofs);
}
}
}
@@ -1267,6 +1286,9 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
float axis[3];
#endif
+ /* inverse view */
+ invert_qt_qt(view_inv, rv3d->viewquat);
+
if (U.ndof_flag & NDOF_PANX_INVERT_AXIS)
pan_vec[0] = -lateral_sensitivity * ndof->tvec[0];
else
@@ -1285,12 +1307,11 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
mul_v3_fl(pan_vec, speed * dt);
/* transform motion from view to world coordinates */
- invert_qt_qt(view_inv, rv3d->viewquat);
mul_qt_v3(view_inv, pan_vec);
/* move center of view opposite of hand motion (this is camera mode, not object mode) */
sub_v3_v3(rv3d->ofs, pan_vec);
-
+
if (U.ndof_flag & NDOF_TURNTABLE) {
/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
float angle, rot[4];
@@ -1350,8 +1371,24 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* apply rotation */
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
-
+
+ }
+
+ /* rotate around custom center */
+ if (vod && vod->use_dyn_ofs) {
+ float q1[4];
+
+ /* compute the post multiplication quat, to rotate the offset correctly */
+ conjugate_qt_qt(q1, vod->oldquat);
+ mul_qt_qtqt(q1, q1, rv3d->viewquat);
+
+ conjugate_qt(q1); /* conj == inv for unit quat */
+ copy_v3_v3(rv3d->ofs, vod->ofs);
+ sub_v3_v3(rv3d->ofs, vod->dyn_ofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3(rv3d->ofs, vod->dyn_ofs);
}
+
}
ED_view3d_camera_lock_sync(v3d, rv3d);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 9517bc87721..7f1bbb22f24 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -82,10 +82,9 @@ extern float originmat[3][3]; /* XXX object.c */
typedef struct TransVert {
float *loc;
- float oldloc[3], maploc[3], fac;
+ float oldloc[3], maploc[3];
float *val, oldval;
int flag;
- float *nor;
} TransVert;
/* SELECT == (1 << 0) */
@@ -193,6 +192,20 @@ static void special_transvert_update(Object *obedit)
}
}
+/* currently only used for bmesh index values */
+enum {
+ TM_INDEX_ON = 1, /* tag to make trans verts */
+ TM_INDEX_OFF = 0, /* don't make verts */
+ TM_INDEX_SKIP = -1 /* dont make verts (when the index values point to trans-verts) */
+};
+
+/* copied from editobject.c, needs to be replaced with new transform code still */
+/* mode flags: */
+enum {
+ TM_ALL_JOINTS = 1, /* all joints (for bones only) */
+ TM_SKIP_HANDLES = 2 /* skip handles when control point is selected (for curves only) */
+};
+
static void set_mapped_co(void *vuserdata, int index, const float co[3],
const float UNUSED(no[3]), const short UNUSED(no_s[3]))
{
@@ -201,16 +214,25 @@ static void set_mapped_co(void *vuserdata, int index, const float co[3],
TransVert *tv = userdata[1];
BMVert *eve = EDBM_vert_at_index(em, index);
- if (BM_elem_index_get(eve) != -1 && !(tv[BM_elem_index_get(eve)].flag & TX_VERT_USE_MAPLOC)) {
- copy_v3_v3(tv[BM_elem_index_get(eve)].maploc, co);
- tv[BM_elem_index_get(eve)].flag |= TX_VERT_USE_MAPLOC;
+ if (BM_elem_index_get(eve) != TM_INDEX_SKIP) {
+ tv = &tv[BM_elem_index_get(eve)];
+
+ /* be clever, get the closest vertex to the original,
+ * behaves most logically when the mirror modifier is used for eg [#33051]*/
+ if ((tv->flag & TX_VERT_USE_MAPLOC) == 0) {
+ /* first time */
+ copy_v3_v3(tv->maploc, co);
+ tv->flag |= TX_VERT_USE_MAPLOC;
+ }
+ else {
+ /* find best location to use */
+ if (len_squared_v3v3(eve->co, co) < len_squared_v3v3(eve->co, tv->maploc)) {
+ copy_v3_v3(tv->maploc, co);
+ }
+ }
}
}
-/* copied from editobject.c, needs to be replaced with new transform code still */
-/* mode flags: */
-#define TM_ALL_JOINTS 1 /* all joints (for bones only) */
-#define TM_SKIP_HANDLES 2 /* skip handles when control point is selected (for curves only) */
static void make_trans_verts(Object *obedit, float min[3], float max[3], int mode)
{
Nurb *nu;
@@ -243,35 +265,37 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
if (em->selectmode & SCE_SELECT_VERTEX) {
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
- BM_elem_index_set(eve, 1); /* set_dirty! */
+ BM_elem_index_set(eve, TM_INDEX_ON); /* set_dirty! */
tottrans++;
}
- else BM_elem_index_set(eve, 0); /* set_dirty! */
+ else {
+ BM_elem_index_set(eve, TM_INDEX_OFF); /* set_dirty! */
+ }
}
}
else if (em->selectmode & SCE_SELECT_EDGE) {
BMEdge *eed;
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
- BM_elem_index_set(eve, 0); /* set_dirty! */
+ BM_elem_index_set(eve, TM_INDEX_OFF); /* set_dirty! */
}
BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
- BM_elem_index_set(eed->v1, 1); /* set_dirty! */
- BM_elem_index_set(eed->v2, 1); /* set_dirty! */
+ BM_elem_index_set(eed->v1, TM_INDEX_ON); /* set_dirty! */
+ BM_elem_index_set(eed->v2, TM_INDEX_ON); /* set_dirty! */
}
}
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
- if (BM_elem_index_get(eve)) tottrans++;
+ if (BM_elem_index_get(eve) == TM_INDEX_ON) tottrans++;
}
}
else {
BMFace *efa;
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
- BM_elem_index_set(eve, 0); /* set_dirty! */
+ BM_elem_index_set(eve, TM_INDEX_OFF); /* set_dirty! */
}
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
@@ -280,13 +304,13 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
BMLoop *l;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- BM_elem_index_set(l->v, 1); /* set_dirty! */
+ BM_elem_index_set(l->v, TM_INDEX_ON); /* set_dirty! */
}
}
}
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
- if (BM_elem_index_get(eve)) tottrans++;
+ if (BM_elem_index_get(eve) == TM_INDEX_ON) tottrans++;
}
}
/* for any of the 3 loops above which all dirty the indices */
@@ -299,17 +323,15 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
a = 0;
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
if (BM_elem_index_get(eve)) {
- BM_elem_index_set(eve, a); /* set_dirty! */
+ BM_elem_index_set(eve, a); /* set_dirty! */
copy_v3_v3(tv->oldloc, eve->co);
tv->loc = eve->co;
- if (eve->no[0] != 0.0f || eve->no[1] != 0.0f || eve->no[2] != 0.0f)
- tv->nor = eve->no; /* note this is a hackish signal (ton) */
- tv->flag = BM_elem_index_get(eve) & SELECT;
+ tv->flag = (BM_elem_index_get(eve) == TM_INDEX_ON) ? SELECT : 0;
tv++;
a++;
}
else {
- BM_elem_index_set(eve, -1); /* set_dirty! */
+ BM_elem_index_set(eve, TM_INDEX_SKIP); /* set_dirty! */
}
}
/* set dirty already, above */
@@ -345,8 +367,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
if (rootok) {
copy_v3_v3(tv->oldloc, ebo->head);
tv->loc = ebo->head;
- tv->nor = NULL;
- tv->flag = 1;
+ tv->flag = SELECT;
tv++;
tottrans++;
}
@@ -354,8 +375,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
if ((mode & TM_ALL_JOINTS) && (tipsel)) {
copy_v3_v3(tv->oldloc, ebo->tail);
tv->loc = ebo->tail;
- tv->nor = NULL;
- tv->flag = 1;
+ tv->flag = SELECT;
tv++;
tottrans++;
}
@@ -363,8 +383,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
else if (tipsel) {
copy_v3_v3(tv->oldloc, ebo->tail);
tv->loc = ebo->tail;
- tv->nor = NULL;
- tv->flag = 1;
+ tv->flag = SELECT;
tv++;
tottrans++;
}
@@ -456,7 +475,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod
copy_v3_v3(tv->oldloc, tv->loc);
tv->val = &(ml->rad);
tv->oldval = ml->rad;
- tv->flag = 1;
+ tv->flag = SELECT;
tv++;
tottrans++;
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index c90913a6ace..3b9fe22d6a1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1218,6 +1218,12 @@ int transformEvent(TransInfo *t, wmEvent *event)
else view_editmove(event->type);
t->redraw = 1;
break;
+ case LEFTALTKEY:
+ case RIGHTALTKEY:
+ if (t->spacetype == SPACE_SEQ)
+ t->flag |= T_ALT_TRANSFORM;
+
+ break;
default:
handled = 0;
break;
@@ -1251,6 +1257,12 @@ int transformEvent(TransInfo *t, wmEvent *event)
//// if (t->options & CTX_TWEAK)
// t->state = TRANS_CONFIRM;
// break;
+ case LEFTALTKEY:
+ case RIGHTALTKEY:
+ if (t->spacetype == SPACE_SEQ)
+ t->flag &= ~T_ALT_TRANSFORM;
+
+ break;
default:
handled = 0;
break;
@@ -4835,14 +4847,9 @@ static void calcNonProportionalEdgeSlide(TransInfo *t, SlideData *sld, const flo
float dist = 0;
float min_dist = FLT_MAX;
- float up_p[3];
- float dw_p[3];
-
for (i = 0; i < sld->totsv; i++, sv++) {
/* Set length */
- add_v3_v3v3(up_p, sv->origvert.co, sv->upvec);
- add_v3_v3v3(dw_p, sv->origvert.co, sv->downvec);
- sv->edge_len = len_v3v3(dw_p, up_p);
+ sv->edge_len = len_v3v3(sv->upvec, sv->downvec);
mul_v3_m4v3(v_proj, t->obedit->obmat, sv->v->co);
if (ED_view3d_project_float_global(t->ar, v_proj, v_proj, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) {
@@ -5583,7 +5590,6 @@ static int doEdgeSlide(TransInfo *t, float perc)
{
SlideData *sld = t->customData;
TransDataSlideVert *svlist = sld->sv, *sv;
- float vec[3];
int i;
sld->perc = perc;
@@ -5591,6 +5597,7 @@ static int doEdgeSlide(TransInfo *t, float perc)
if (sld->is_proportional == TRUE) {
for (i = 0; i < sld->totsv; i++, sv++) {
+ float vec[3];
if (perc > 0.0f) {
copy_v3_v3(vec, sv->upvec);
mul_v3_fl(vec, perc);
@@ -5608,20 +5615,29 @@ static int doEdgeSlide(TransInfo *t, float perc)
* Implementation note, non proportional mode ignores the starting positions and uses only the
* up/down verts, this could be changed/improved so the distance is still met but the verts are moved along
* their original path (which may not be straight), however how it works now is OK and matches 2.4x - Campbell
+ *
+ * \note len_v3v3(curr_sv->upvec, curr_sv->downvec)
+ * is the same as the distance between the original vert locations, same goes for the lines below.
*/
TransDataSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
- const float curr_length_perc = len_v3v3(curr_sv->up->co, curr_sv->down->co) *
- (((sld->flipped_vtx ? perc : -perc) + 1.0f) / 2.0f);
+ const float curr_length_perc = curr_sv->edge_len * (((sld->flipped_vtx ? perc : -perc) + 1.0f) / 2.0f);
+
+ float down_co[3];
+ float up_co[3];
for (i = 0; i < sld->totsv; i++, sv++) {
- const float sv_length = len_v3v3(sv->up->co, sv->down->co);
- const float fac = min_ff(sv_length, curr_length_perc) / sv_length;
+ if (sv->edge_len > FLT_EPSILON) {
+ const float fac = min_ff(sv->edge_len, curr_length_perc) / sv->edge_len;
- if (sld->flipped_vtx) {
- interp_v3_v3v3(sv->v->co, sv->down->co, sv->up->co, fac);
- }
- else {
- interp_v3_v3v3(sv->v->co, sv->up->co, sv->down->co, fac);
+ add_v3_v3v3(up_co, sv->origvert.co, sv->upvec);
+ add_v3_v3v3(down_co, sv->origvert.co, sv->downvec);
+
+ if (sld->flipped_vtx) {
+ interp_v3_v3v3(sv->v->co, down_co, up_co, fac);
+ }
+ else {
+ interp_v3_v3v3(sv->v->co, up_co, down_co, fac);
+ }
}
}
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 1f9775821d1..bc959a772d6 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -197,6 +197,7 @@ typedef struct TransDataSlideVert {
float edge_len;
+ /* add origvert.co to get the original locations */
float upvec[3], downvec[3];
int loop_nr;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 2a01b03ec14..f6b888d4881 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -4275,8 +4275,7 @@ static void freeSeqData(TransInfo *t)
}
}
-#if 1 /* (mango hack! - for Ian) this is truely bad - should _never_ be in a release :| */
- if (CTX_wm_window(t->context)->eventstate->alt) {
+ if (t->flag & T_ALT_TRANSFORM) {
int minframe = MAXFRAME;
td = t->data;
seq_prev = NULL;
@@ -4313,9 +4312,6 @@ static void freeSeqData(TransInfo *t)
else {
BKE_sequence_base_shuffle_time(seqbasep, t->scene);
}
-#else
- BKE_sequence_base_shuffle_time(seqbasep, t->scene);
-#endif
if (has_effect) {
/* update effects strips based on strips just moved in time */
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 393c119b347..f615902eedf 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -60,6 +60,7 @@
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_report.h"
+#include "BKE_scene.h"
#include "BKE_tessmesh.h"
#include "BLI_math.h"
@@ -177,7 +178,33 @@ static int uvedit_have_selection(Scene *scene, BMEditMesh *em, short implicit)
return 0;
}
-static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
+static void ED_uvedit_get_aspect(Scene *scene, Object *ob, BMEditMesh *em, float *aspx, float *aspy)
+{
+ int sloppy = TRUE;
+ int selected = FALSE;
+ BMFace *efa;
+ Image *ima;
+
+ efa = BM_active_face_get(em->bm, sloppy, selected);
+
+ if (efa) {
+ if (BKE_scene_use_new_shading_nodes(scene)) {
+ ED_object_get_active_image(ob, efa->mat_nr + 1, &ima, NULL, NULL);
+ }
+ else {
+ MTexPoly *tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+ ima = tf->tpage;
+ }
+
+ ED_image_get_uv_aspect(ima, NULL, aspx, aspy);
+ }
+ else {
+ *aspx = 1.0f;
+ *aspy = 1.0f;
+ }
+}
+
+static ParamHandle *construct_param_handle(Scene *scene, Object *ob, BMEditMesh *em,
short implicit, short fill, short sel,
short correct_aspect)
{
@@ -187,27 +214,16 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
BMLoop *l;
BMEdge *eed;
BMIter iter, liter;
- MTexPoly *tf;
handle = param_construct_begin();
if (correct_aspect) {
- int sloppy = TRUE;
- int selected = FALSE;
+ float aspx, aspy;
- efa = BM_active_face_get(em->bm, sloppy, selected);
+ ED_uvedit_get_aspect(scene, ob, em, &aspx, &aspy);
- if (efa) {
- float aspx, aspy;
- tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
-
- ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
-
- if (aspx != aspy)
- param_aspect_ratio(handle, aspx, aspy);
- else
- param_aspect_ratio(handle, 1.0, 1.0);
- }
+ if (aspx != aspy)
+ param_aspect_ratio(handle, aspx, aspy);
}
/* we need the vert indices */
@@ -355,13 +371,12 @@ static void texface_from_original_index(BMFace *efa, int index, float **uv, Para
/* unwrap handle initialization for subsurf aware-unwrapper. The many modifications required to make the original function(see above)
* work justified the existence of a new function. */
-static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *em, short fill, short sel, short correct_aspect)
+static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, BMEditMesh *em, short fill, short sel, short correct_aspect)
{
ParamHandle *handle;
/* index pointers */
MFace *face;
MEdge *edge;
- BMFace *editFace;
int i;
/* modifier initialization data, will control what type of subdivision will happen*/
@@ -385,23 +400,12 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e
handle = param_construct_begin();
if (correct_aspect) {
- int sloppy = TRUE;
- int selected = FALSE;
-
- editFace = BM_active_face_get(em->bm, sloppy, selected);
+ float aspx, aspy;
- if (editFace) {
- MTexPoly *tf;
- float aspx, aspy;
- tf = CustomData_bmesh_get(&em->bm->pdata, editFace->head.data, CD_MTEXPOLY);
+ ED_uvedit_get_aspect(scene, ob, em, &aspx, &aspy);
- ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
-
- if (aspx != aspy)
- param_aspect_ratio(handle, aspx, aspy);
- else
- param_aspect_ratio(handle, 1.0, 1.0);
- }
+ if (aspx != aspy)
+ param_aspect_ratio(handle, aspx, aspy);
}
/* number of subdivisions to perform */
@@ -541,7 +545,7 @@ static int minimize_stretch_init(bContext *C, wmOperator *op)
ms->blend = RNA_float_get(op->ptr, "blend");
ms->iterations = RNA_int_get(op->ptr, "iterations");
ms->i = 0;
- ms->handle = construct_param_handle(scene, em, implicit, fill_holes, 1, 1);
+ ms->handle = construct_param_handle(scene, obedit, em, implicit, fill_holes, 1, 1);
ms->lasttime = PIL_check_seconds_timer();
param_stretch_begin(ms->handle);
@@ -735,7 +739,7 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
else
RNA_float_set(op->ptr, "margin", scene->toolsettings->uvcalc_margin);
- handle = construct_param_handle(scene, em, implicit, 0, 1, 1);
+ handle = construct_param_handle(scene, obedit, em, implicit, 0, 1, 1);
param_pack(handle, scene->toolsettings->uvcalc_margin);
param_flush(handle);
param_delete(handle);
@@ -777,7 +781,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
- handle = construct_param_handle(scene, em, implicit, 0, 1, 1);
+ handle = construct_param_handle(scene, obedit, em, implicit, 0, 1, 1);
param_average(handle);
param_flush(handle);
param_delete(handle);
@@ -818,9 +822,9 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
}
if (use_subsurf)
- liveHandle = construct_param_handle_subsurfed(scene, em, fillholes, 0, 1);
+ liveHandle = construct_param_handle_subsurfed(scene, obedit, em, fillholes, 0, 1);
else
- liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1);
+ liveHandle = construct_param_handle(scene, obedit, em, 0, fillholes, 0, 1);
param_lscm_begin(liveHandle, PARAM_TRUE, abf);
}
@@ -1008,22 +1012,15 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
"Radius of the sphere or cylinder", 0.0001f, 100.0f);
}
-static void correct_uv_aspect(BMEditMesh *em)
+static void correct_uv_aspect(Scene *scene, Object *ob, BMEditMesh *em)
{
- int sloppy = TRUE;
- int selected = FALSE;
- BMFace *efa = BM_active_face_get(em->bm, sloppy, selected);
BMLoop *l;
BMIter iter, liter;
MLoopUV *luv;
- float scale, aspx = 1.0f, aspy = 1.0f;
+ BMFace *efa;
+ float scale, aspx, aspy;
- if (efa) {
- MTexPoly *tf;
-
- tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- ED_image_get_uv_aspect(tf->tpage, NULL, &aspx, &aspy);
- }
+ ED_uvedit_get_aspect(scene, ob, em, &aspx, &aspy);
if (aspx == aspy)
return;
@@ -1068,7 +1065,7 @@ static void uv_map_clip_correct_properties(wmOperatorType *ot)
"Scale UV coordinates to bounds after unwrapping");
}
-static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
+static void uv_map_clip_correct(Scene *scene, Object *ob, BMEditMesh *em, wmOperator *op)
{
BMFace *efa;
BMLoop *l;
@@ -1081,7 +1078,7 @@ static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
/* correct for image aspect ratio */
if (correct_aspect)
- correct_uv_aspect(em);
+ correct_uv_aspect(scene, ob, em);
if (scale_to_bounds) {
INIT_MINMAX2(min, max);
@@ -1145,9 +1142,9 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
const short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
if (use_subsurf)
- handle = construct_param_handle_subsurfed(scene, em, fill_holes, sel, correct_aspect);
+ handle = construct_param_handle_subsurfed(scene, obedit, em, fill_holes, sel, correct_aspect);
else
- handle = construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
+ handle = construct_param_handle(scene, obedit, em, 0, fill_holes, sel, correct_aspect);
param_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0);
param_lscm_solve(handle);
@@ -1322,7 +1319,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
}
}
- uv_map_clip_correct(em, op);
+ uv_map_clip_correct(scene, obedit, em, op);
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -1476,7 +1473,7 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
uv_map_mirror(em, efa, tf);
}
- uv_map_clip_correct(em, op);
+ uv_map_clip_correct(scene, obedit, em, op);
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -1551,7 +1548,7 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
uv_map_mirror(em, efa, tf);
}
- uv_map_clip_correct(em, op);
+ uv_map_clip_correct(scene, obedit, em, op);
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
@@ -1631,7 +1628,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
}
}
- uv_map_clip_correct(em, op);
+ uv_map_clip_correct(scene, obedit, em, op);
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index 97e8b756d08..c46230de8bf 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -110,7 +110,6 @@ GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data);
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, int isdata);
GPUNodeLink *GPU_texture(int size, float *pixels);
GPUNodeLink *GPU_dynamic_texture(struct GPUTexture *tex, int dynamictype, void *data);
-GPUNodeLink *GPU_socket(GPUNodeStack *sock);
GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
int GPU_link(GPUMaterial *mat, const char *name, ...);
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index b4490e656f3..4432627ee7e 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1148,15 +1148,6 @@ GPUNodeLink *GPU_dynamic_texture(GPUTexture *tex, int dynamictype, void *data)
return link;
}
-GPUNodeLink *GPU_socket(GPUNodeStack *sock)
-{
- GPUNodeLink *link = GPU_node_link_create(0);
-
- link->socket= sock;
-
- return link;
-}
-
GPUNodeLink *GPU_builtin(GPUBuiltin builtin)
{
GPUNodeLink *link = GPU_node_link_create(0);
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 5713c5e88a2..9a238e979fa 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -4,6 +4,21 @@ float exp_blender(float f)
return pow(2.71828182846, f);
}
+float compatible_pow(float x, float y)
+{
+ /* glsl pow doesn't accept negative x */
+ if(x < 0.0) {
+ if(mod(-y, 2.0) == 0.0)
+ return pow(-x, y);
+ else
+ return -pow(-x, y);
+ }
+ else if(x == 0.0)
+ return 0.0;
+
+ return pow(x, y);
+}
+
void rgb_to_hsv(vec4 rgb, out vec4 outcol)
{
float cmax, cmin, h, s, v, cdelta;
@@ -212,10 +227,17 @@ void math_atan(float val, out float outval)
void math_pow(float val1, float val2, out float outval)
{
- if (val1 >= 0.0)
- outval = pow(val1, val2);
- else
- outval = 0.0;
+ if (val1 >= 0.0) {
+ outval = compatible_pow(val1, val2);
+ }
+ else {
+ float val2_mod_1 = mod(abs(val2), 1.0);
+
+ if (val2_mod_1 > 0.999 || val2_mod_1 < 0.001)
+ outval = compatible_pow(val1, floor(val2 + 0.5));
+ else
+ outval = 0.0;
+ }
}
void math_log(float val1, float val2, out float outval)
@@ -2013,7 +2035,7 @@ void node_bsdf_glossy(vec4 color, float roughness, vec3 N, out vec4 result)
result = vec4(L*color.rgb, 1.0);
}
-void node_bsdf_anisotropic(vec4 color, float roughnessU, float roughnessV, vec3 N, vec3 T, out vec4 result)
+void node_bsdf_anisotropic(vec4 color, float roughness, float anisotropy, float rotation, vec3 N, vec3 T, out vec4 result)
{
node_bsdf_diffuse(color, 0.0, N, result);
}
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index e297ebe3980..d0ac71a7131 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -103,7 +103,7 @@ struct ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags,
*
* \attention Defined in readimage.c
*/
-struct ImBuf *IMB_testiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE]);
+struct ImBuf *IMB_testiffname(const char *filepath, int flags);
/**
*
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 6581987aed7..aadf547260d 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2385,7 +2385,7 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer,
const ColorManagedDisplaySettings *display_settings,
int xmin, int ymin, int xmax, int ymax, int update_orig_byte_buffer)
{
- if ((ibuf->rect && ibuf->rect_float) || update_orig_byte_buffer) {
+ if ((ibuf->rect && ibuf->rect_float) || update_orig_byte_buffer) {
/* update byte buffer created by legacy color management */
unsigned char *rect = (unsigned char *) ibuf->rect;
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 6310d8e105f..dcfebb95b87 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -558,7 +558,8 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[I
MEM_freeN(pixels);
if (pixels16)
MEM_freeN(pixels16);
- MEM_freeN(row_pointers);
+ if (row_pointers)
+ MEM_freeN(row_pointers);
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
return(ibuf);
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index a1fa05d1098..be20c80bdec 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -100,7 +100,8 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co
}
}
- fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);
+ if ((flags & IB_test) == 0)
+ fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);
return NULL;
}
@@ -170,11 +171,12 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_S
return ibuf;
}
-ImBuf *IMB_testiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
+ImBuf *IMB_testiffname(const char *filepath, int flags)
{
ImBuf *ibuf;
int file;
char filepath_tx[IB_FILENAME_SIZE];
+ char colorspace[IM_MAX_SPACE] = "\0";
imb_cache_filename(filepath_tx, filepath, flags);
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index a3ce332b609..94bb85b49ea 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -436,7 +436,7 @@ ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source)
struct stat st;
ImBuf *img = NULL;
- if (stat(path, &st)) {
+ if (BLI_stat(path, &st)) {
return NULL;
}
if (!uri_from_filename(path, uri)) {
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index cda51779528..499f1c50155 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -118,38 +118,50 @@ typedef struct MovieClipScopes {
} MovieClipScopes;
/* MovieClipProxy->build_size_flag */
-#define MCLIP_PROXY_SIZE_25 (1 << 0)
-#define MCLIP_PROXY_SIZE_50 (1 << 1)
-#define MCLIP_PROXY_SIZE_75 (1 << 2)
-#define MCLIP_PROXY_SIZE_100 (1 << 3)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_25 (1 << 4)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_50 (1 << 5)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_75 (1 << 6)
-#define MCLIP_PROXY_UNDISTORTED_SIZE_100 (1 << 7)
+enum {
+ MCLIP_PROXY_SIZE_25 = (1 << 0),
+ MCLIP_PROXY_SIZE_50 = (1 << 1),
+ MCLIP_PROXY_SIZE_75 = (1 << 2),
+ MCLIP_PROXY_SIZE_100 = (1 << 3),
+ MCLIP_PROXY_UNDISTORTED_SIZE_25 = (1 << 4),
+ MCLIP_PROXY_UNDISTORTED_SIZE_50 = (1 << 5),
+ MCLIP_PROXY_UNDISTORTED_SIZE_75 = (1 << 6),
+ MCLIP_PROXY_UNDISTORTED_SIZE_100 = (1 << 7)
+};
/* MovieClip->source */
-#define MCLIP_SRC_SEQUENCE 1
-#define MCLIP_SRC_MOVIE 2
+enum {
+ MCLIP_SRC_SEQUENCE = 1,
+ MCLIP_SRC_MOVIE = 2
+};
/* MovieClip->selection types */
-#define MCLIP_SEL_NONE 0
-#define MCLIP_SEL_TRACK 1
+enum {
+ MCLIP_SEL_NONE = 0,
+ MCLIP_SEL_TRACK = 1
+};
/* MovieClip->flag */
-#define MCLIP_USE_PROXY (1 << 0)
-#define MCLIP_USE_PROXY_CUSTOM_DIR (1 << 1)
-/*#define MCLIP_CUSTOM_START_FRAME (1<<2)*/ /* UNUSED */
+enum {
+ MCLIP_USE_PROXY = (1 << 0),
+ MCLIP_USE_PROXY_CUSTOM_DIR = (1 << 1),
+ /* MCLIP_CUSTOM_START_FRAME = (1<<2), */ /* UNUSED */
-#define MCLIP_TIMECODE_FLAGS (MCLIP_USE_PROXY | MCLIP_USE_PROXY_CUSTOM_DIR)
+ MCLIP_TIMECODE_FLAGS = (MCLIP_USE_PROXY | MCLIP_USE_PROXY_CUSTOM_DIR)
+};
/* MovieClip->render_size */
-#define MCLIP_PROXY_RENDER_SIZE_FULL 0
-#define MCLIP_PROXY_RENDER_SIZE_25 1
-#define MCLIP_PROXY_RENDER_SIZE_50 2
-#define MCLIP_PROXY_RENDER_SIZE_75 3
-#define MCLIP_PROXY_RENDER_SIZE_100 4
+enum {
+ MCLIP_PROXY_RENDER_SIZE_FULL = 0,
+ MCLIP_PROXY_RENDER_SIZE_25 = 1,
+ MCLIP_PROXY_RENDER_SIZE_50 = 2,
+ MCLIP_PROXY_RENDER_SIZE_75 = 3,
+ MCLIP_PROXY_RENDER_SIZE_100 = 4
+};
/* MovieClip->render_flag */
-#define MCLIP_PROXY_RENDER_UNDISTORT 1
+enum {
+ MCLIP_PROXY_RENDER_UNDISTORT = 1
+};
#endif
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index c73ba87754f..1684cf28b3c 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -118,7 +118,8 @@ typedef struct bNodeSocket {
#define SOCK_BOOLEAN 4
#define SOCK_MESH 5
#define SOCK_INT 6
-#define NUM_SOCKET_TYPES 7 /* must be last! */
+#define SOCK_STRING 7
+#define NUM_SOCKET_TYPES 8 /* must be last! */
/* socket side (input/output) */
#define SOCK_IN 1
@@ -353,6 +354,11 @@ typedef struct bNodeSocketValueRGBA {
float value[4];
} bNodeSocketValueRGBA;
+typedef struct bNodeSocketValueString {
+ int subtype;
+ int pad;
+ char value[1024]; /* 1024 = FILEMAX */
+} bNodeSocketValueString;
/* data structs, for node->storage */
enum {
@@ -716,6 +722,17 @@ typedef struct NodeShaderScript {
IDProperty *prop;
} NodeShaderScript;
+typedef struct NodeShaderTangent {
+ int direction_type;
+ int axis;
+ char uv_map[64];
+} NodeShaderTangent;
+
+typedef struct NodeShaderNormalMap {
+ int space;
+ char uv_map[64];
+} NodeShaderNormalMap;
+
/* script node mode */
#define NODE_SCRIPT_INTERNAL 0
#define NODE_SCRIPT_EXTERNAL 1
@@ -800,6 +817,20 @@ typedef struct NodeShaderScript {
#define SHD_PROJ_FLAT 0
#define SHD_PROJ_BOX 1
+/* tangent */
+#define SHD_TANGENT_RADIAL 0
+#define SHD_TANGENT_UVMAP 1
+
+/* tangent */
+#define SHD_TANGENT_AXIS_X 0
+#define SHD_TANGENT_AXIS_Y 1
+#define SHD_TANGENT_AXIS_Z 2
+
+/* normal map space */
+#define SHD_NORMAL_MAP_TANGENT 0
+#define SHD_NORMAL_MAP_OBJECT 1
+#define SHD_NORMAL_MAP_WORLD 2
+
/* blur node */
#define CMP_NODE_BLUR_ASPECT_NONE 0
#define CMP_NODE_BLUR_ASPECT_Y 1
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 9bfa0e7fdf7..facddd8c718 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -401,11 +401,16 @@ typedef struct RenderData {
/**
* The number of part to use in the x direction
*/
- short xparts;
+ short xparts DNA_DEPRECATED;
/**
* The number of part to use in the y direction
*/
- short yparts;
+ short yparts DNA_DEPRECATED;
+
+ /**
+ * render tile dimensions
+ */
+ short tilex, tiley;
short planes DNA_DEPRECATED, imtype DNA_DEPRECATED, subimtype DNA_DEPRECATED, quality DNA_DEPRECATED; /*deprecated!*/
@@ -453,6 +458,8 @@ typedef struct RenderData {
short frs_sec, edgeint;
+ int pad;
+
/* safety, border and display rect */
rctf safety, border;
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 4d259fad246..f106c8f918a 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -100,6 +100,9 @@ typedef struct Strip {
StripCrop *crop;
StripTransform *transform;
StripColorBalance *color_balance DNA_DEPRECATED;
+
+ /* color management */
+ ColorManagedColorspaceSettings colorspace_settings;
} Strip;
/**
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index c6cefce2994..9c80d30bca4 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -167,6 +167,9 @@ typedef struct MovieTrackingSettings {
* were moved to per-tracking object settings
*/
+ float reconstruction_success_threshold;
+ int reconstruction_flag;
+
/* which camera intrinsics to refine. uses on the REFINE_* flags */
short refine_camera_intrinsics, pad2;
@@ -224,6 +227,7 @@ typedef struct MovieTrackingObject {
ListBase tracks; /* list of tracks use to tracking this object */
MovieTrackingReconstruction reconstruction; /* reconstruction data for this object */
+ /* reconstruction options */
int keyframe1, keyframe2; /* two keyframes for reconstrution initialization */
} MovieTrackingObject;
@@ -280,92 +284,129 @@ enum {
};
/* MovieTrackingMarker->flag */
-#define MARKER_DISABLED (1 << 0)
-#define MARKER_TRACKED (1 << 1)
-#define MARKER_GRAPH_SEL_X (1 << 2)
-#define MARKER_GRAPH_SEL_Y (1 << 3)
-#define MARKER_GRAPH_SEL (MARKER_GRAPH_SEL_X | MARKER_GRAPH_SEL_Y)
+enum {
+ MARKER_DISABLED = (1 << 0),
+ MARKER_TRACKED = (1 << 1),
+ MARKER_GRAPH_SEL_X = (1 << 2),
+ MARKER_GRAPH_SEL_Y = (1 << 3),
+ MARKER_GRAPH_SEL = (MARKER_GRAPH_SEL_X | MARKER_GRAPH_SEL_Y)
+};
/* MovieTrackingTrack->flag */
-#define TRACK_HAS_BUNDLE (1 << 1)
-#define TRACK_DISABLE_RED (1 << 2)
-#define TRACK_DISABLE_GREEN (1 << 3)
-#define TRACK_DISABLE_BLUE (1 << 4)
-#define TRACK_HIDDEN (1 << 5)
-#define TRACK_LOCKED (1 << 6)
-#define TRACK_CUSTOMCOLOR (1 << 7)
-#define TRACK_USE_2D_STAB (1 << 8)
-#define TRACK_PREVIEW_GRAYSCALE (1 << 9)
-#define TRACK_DOPE_SEL (1 << 10)
-#define TRACK_PREVIEW_ALPHA (1 << 11)
+enum {
+ TRACK_HAS_BUNDLE = (1 << 1),
+ TRACK_DISABLE_RED = (1 << 2),
+ TRACK_DISABLE_GREEN = (1 << 3),
+ TRACK_DISABLE_BLUE = (1 << 4),
+ TRACK_HIDDEN = (1 << 5),
+ TRACK_LOCKED = (1 << 6),
+ TRACK_CUSTOMCOLOR = (1 << 7),
+ TRACK_USE_2D_STAB = (1 << 8),
+ TRACK_PREVIEW_GRAYSCALE = (1 << 9),
+ TRACK_DOPE_SEL = (1 << 10),
+ TRACK_PREVIEW_ALPHA = (1 << 11)
+};
/* MovieTrackingTrack->motion_model */
-#define TRACK_MOTION_MODEL_TRANSLATION 0
-#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION 1
-#define TRACK_MOTION_MODEL_TRANSLATION_SCALE 2
-#define TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE 3
-#define TRACK_MOTION_MODEL_AFFINE 4
-#define TRACK_MOTION_MODEL_HOMOGRAPHY 5
+enum {
+ TRACK_MOTION_MODEL_TRANSLATION = 0,
+ TRACK_MOTION_MODEL_TRANSLATION_ROTATION = 1,
+ TRACK_MOTION_MODEL_TRANSLATION_SCALE = 2,
+ TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE = 3,
+ TRACK_MOTION_MODEL_AFFINE = 4,
+ TRACK_MOTION_MODEL_HOMOGRAPHY = 5
+};
/* MovieTrackingTrack->algorithm_flag */
-#define TRACK_ALGORITHM_FLAG_USE_BRUTE (1 << 0)
-#define TRACK_ALGORITHM_FLAG_USE_NORMALIZATION (1 << 2)
-#define TRACK_ALGORITHM_FLAG_USE_MASK (1 << 3)
+enum {
+ TRACK_ALGORITHM_FLAG_USE_BRUTE = (1 << 0),
+ TRACK_ALGORITHM_FLAG_USE_NORMALIZATION = (1 << 2),
+ TRACK_ALGORITHM_FLAG_USE_MASK = (1 << 3)
+};
/* MovieTrackingTrack->adjframes */
-#define TRACK_MATCH_KEYFRAME 0
-#define TRACK_MATCH_PREVFRAME 1
+enum {
+ TRACK_MATCH_KEYFRAME = 0,
+ TRACK_MATCH_PREVFRAME = 1
+};
/* MovieTrackingSettings->flag */
-#define TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED (1 << 0)
+enum {
+ TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED = (1 << 0)
+};
/* MovieTrackingSettings->motion_flag */
-#define TRACKING_MOTION_TRIPOD (1 << 0)
+enum {
+ TRACKING_MOTION_TRIPOD = (1 << 0),
-#define TRACKING_MOTION_MODAL (TRACKING_MOTION_TRIPOD)
+ TRACKING_MOTION_MODAL = (TRACKING_MOTION_TRIPOD)
+};
/* MovieTrackingSettings->speed */
-#define TRACKING_SPEED_FASTEST 0
-#define TRACKING_SPEED_REALTIME 1
-#define TRACKING_SPEED_HALF 2
-#define TRACKING_SPEED_QUARTER 4
-#define TRACKING_SPEED_DOUBLE 5
+enum {
+ TRACKING_SPEED_FASTEST = 0,
+ TRACKING_SPEED_REALTIME = 1,
+ TRACKING_SPEED_HALF = 2,
+ TRACKING_SPEED_QUARTER = 4,
+ TRACKING_SPEED_DOUBLE = 5
+};
+
+/* MovieTrackingObject->reconstruction_flag */
+enum {
+ TRACKING_USE_FALLBACK_RECONSTRUCTION = (1 << 0)
+};
/* MovieTrackingSettings->refine_camera_intrinsics */
-#define REFINE_FOCAL_LENGTH (1 << 0)
-#define REFINE_PRINCIPAL_POINT (1 << 1)
-#define REFINE_RADIAL_DISTORTION_K1 (1 << 2)
-#define REFINE_RADIAL_DISTORTION_K2 (1 << 4)
+enum {
+ REFINE_FOCAL_LENGTH = (1 << 0),
+ REFINE_PRINCIPAL_POINT = (1 << 1),
+ REFINE_RADIAL_DISTORTION_K1 = (1 << 2),
+ REFINE_RADIAL_DISTORTION_K2 = (1 << 4)
+};
/* MovieTrackingStrabilization->flag */
-#define TRACKING_2D_STABILIZATION (1 << 0)
-#define TRACKING_AUTOSCALE (1 << 1)
-#define TRACKING_STABILIZE_ROTATION (1 << 2)
+enum {
+ TRACKING_2D_STABILIZATION = (1 << 0),
+ TRACKING_AUTOSCALE = (1 << 1),
+ TRACKING_STABILIZE_ROTATION = (1 << 2)
+};
/* MovieTrackingStrabilization->filter */
-#define TRACKING_FILTER_NEAREAST 0
-#define TRACKING_FILTER_BILINEAR 1
-#define TRACKING_FILTER_BICUBIC 2
+enum {
+ TRACKING_FILTER_NEAREAST = 0,
+ TRACKING_FILTER_BILINEAR = 1,
+ TRACKING_FILTER_BICUBIC = 2
+};
/* MovieTrackingReconstruction->flag */
-#define TRACKING_RECONSTRUCTED (1 << 0)
+enum {
+ TRACKING_RECONSTRUCTED = (1 << 0)
+};
/* MovieTrackingObject->flag */
-#define TRACKING_OBJECT_CAMERA (1 << 0)
+enum {
+ TRACKING_OBJECT_CAMERA = (1 << 0)
+};
-#define TRACKING_CLEAN_SELECT 0
-#define TRACKING_CLEAN_DELETE_TRACK 1
-#define TRACKING_CLEAN_DELETE_SEGMENT 2
+enum {
+ TRACKING_CLEAN_SELECT = 0,
+ TRACKING_CLEAN_DELETE_TRACK = 1,
+ TRACKING_CLEAN_DELETE_SEGMENT = 2
+};
/* MovieTrackingDopesheet->sort_method */
-#define TRACKING_DOPE_SORT_NAME 0
-#define TRACKING_DOPE_SORT_LONGEST 1
-#define TRACKING_DOPE_SORT_TOTAL 2
-#define TRACKING_DOPE_SORT_AVERAGE_ERROR 3
+enum {
+ TRACKING_DOPE_SORT_NAME = 0,
+ TRACKING_DOPE_SORT_LONGEST = 1,
+ TRACKING_DOPE_SORT_TOTAL = 2,
+ TRACKING_DOPE_SORT_AVERAGE_ERROR = 3
+};
/* MovieTrackingDopesheet->flag */
-#define TRACKING_DOPE_SORT_INVERSE (1 << 0)
-#define TRACKING_DOPE_SELECTED_ONLY (1 << 1)
-#define TRACKING_DOPE_SHOW_HIDDEN (1 << 2)
+enum {
+ TRACKING_DOPE_SORT_INVERSE = (1 << 0),
+ TRACKING_DOPE_SELECTED_ONLY = (1 << 1),
+ TRACKING_DOPE_SHOW_HIDDEN = (1 << 2)
+};
#endif
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 07b8072076e..247e024f8a3 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -46,9 +46,13 @@
#ifdef RNA_RUNTIME
-#include "ED_keyframing.h"
+#include "BLI_math_base.h"
+
#include "BKE_fcurve.h"
+#include "ED_keyframing.h"
+
+
static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
{
ListBaseIterator *internal = iter->internal;
@@ -191,8 +195,7 @@ static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min,
bAction *act = (bAction *)ptr->data;
*min = 0;
- *max = BLI_countlist(&act->markers) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&act->markers) - 1);
}
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index ce884fa4ecc..7229dddf6d6 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -54,6 +54,8 @@ EnumPropertyItem keyingset_path_grouping_items[] = {
#ifdef RNA_RUNTIME
+#include "BLI_math_base.h"
+
#include "BKE_animsys.h"
#include "BKE_fcurve.h"
#include "BKE_nla.h"
@@ -296,6 +298,43 @@ static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value)
/* ****************************** */
+static void rna_KeyingSet_name_set(PointerRNA *ptr, const char *value)
+{
+ KeyingSet *ks = (KeyingSet *)ptr->data;
+
+ /* update names of corresponding groups if name changes */
+ if (strcmp(ks->name, value)) {
+ KS_Path *ksp;
+
+ for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
+ if ((ksp->groupmode == KSP_GROUP_KSNAME) && (ksp->id)) {
+ AnimData *adt = BKE_animdata_from_id(ksp->id);
+
+ /* TODO: NLA strips? */
+ if (adt && adt->action) {
+ bActionGroup *agrp;
+
+ /* lazy check - should really find the F-Curve for the affected path and check its group
+ * but this way should be faster and work well for most cases, as long as there are no
+ * conflicts
+ */
+ for (agrp = adt->action->groups.first; agrp; agrp = agrp->next) {
+ if (strcmp(ks->name, agrp->name) == 0) {
+ /* there should only be one of these in the action, so can stop... */
+ BLI_strncpy(agrp->name, value, sizeof(agrp->name));
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* finally, update name to new value */
+ BLI_strncpy(ks->name, value, sizeof(ks->name));
+}
+
+
static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr)
{
KeyingSet *ks = (KeyingSet *)ptr->data;
@@ -334,8 +373,7 @@ static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, i
KeyingSet *ks = (KeyingSet *)ptr->data;
*min = 0;
- *max = BLI_countlist(&ks->paths) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&ks->paths) - 1);
}
static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr)
@@ -430,7 +468,7 @@ static void rna_NlaTrack_remove(AnimData *adt, bContext *C, ReportList *reports,
NlaTrack *track = track_ptr->data;
if (BLI_findindex(&adt->nla_tracks, track) == -1) {
- BKE_reportf(reports, RPT_ERROR, "NlaTrack '%s' can't be removed", track->name);
+ BKE_reportf(reports, RPT_ERROR, "NlaTrack '%s' cannot be removed", track->name);
return;
}
@@ -721,19 +759,20 @@ static void rna_def_keyingset(BlenderRNA *brna)
srna = RNA_def_struct(brna, "KeyingSet", NULL);
RNA_def_struct_ui_text(srna, "Keying Set", "Settings that should be keyframed together");
- /* Id/Label. */
+ /* Id/Label */
prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "idname");
RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP);
RNA_def_property_ui_text(prop, "ID Name", KEYINGSET_IDNAME_DOC);
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL);
+/* RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL); */ /* NOTE: disabled, as ID name shouldn't be editable */
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_KeyingSet_name_set");
RNA_def_property_ui_text(prop, "UI Name", "");
RNA_def_struct_ui_icon(srna, ICON_KEYINGSET);
RNA_def_struct_name_property(srna, prop);
-/* RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_RENAME, NULL);*/
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL);
prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
RNA_def_property_string_sdna(prop, NULL, "description");
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index 8e45da50e9b..3da718afd1c 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -80,6 +80,8 @@ EnumPropertyItem boidruleset_type_items[] = {
#ifdef RNA_RUNTIME
+#include "BLI_math_base.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_particle.h"
@@ -157,8 +159,7 @@ static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min
{
BoidState *state = (BoidState *)ptr->data;
*min = 0;
- *max = BLI_countlist(&state->rules) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&state->rules) - 1);
}
static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr)
@@ -224,8 +225,7 @@ static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int
{
BoidSettings *boids = (BoidSettings *)ptr->data;
*min = 0;
- *max = BLI_countlist(&boids->states) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&boids->states) - 1);
}
static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index f3a3b5c43f8..fdb6c0afa4e 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -45,6 +45,7 @@
#include "DNA_material_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_node_types.h"
+#include "DNA_sequence_types.h"
#include "MEM_guardedalloc.h"
@@ -53,6 +54,7 @@
#include "BKE_image.h"
#include "BKE_movieclip.h"
#include "BKE_node.h"
+#include "BKE_sequencer.h"
#include "BKE_texture.h"
#include "BKE_linestyle.h"
@@ -531,9 +533,44 @@ static void rna_ColorManagedColorspaceSettings_reload_update(Main *UNUSED(bmain)
BKE_movieclip_reload(clip);
+ /* all sequencers for now, we don't know which scenes are using this clip as a strip */
+ BKE_sequencer_cache_cleanup();
+ BKE_sequencer_preprocessed_cache_cleanup();
+
WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, &clip->id);
WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, &clip->id);
}
+ else if (GS(id->name) == ID_SCE) {
+ Scene *scene = (Scene *) id;
+
+ if (scene->ed) {
+ ColorManagedColorspaceSettings *colorspace_settings = (ColorManagedColorspaceSettings *) ptr->data;
+ Sequence *seq;
+ int seq_found = FALSE;
+
+ if (&scene->sequencer_colorspace_settings != colorspace_settings) {
+ SEQ_BEGIN(scene->ed, seq);
+ {
+ if (seq->strip && &seq->strip->colorspace_settings == colorspace_settings) {
+ seq_found = TRUE;
+ break;
+ }
+ }
+ SEQ_END;
+ }
+
+ if (seq_found) {
+ BKE_sequence_invalidate_cache(scene, seq);
+ BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
+ }
+ else {
+ BKE_sequencer_cache_cleanup();
+ BKE_sequencer_preprocessed_cache_cleanup();
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ }
+ }
}
static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 35699c6ef3f..a3cff99ddc8 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -242,16 +242,14 @@ static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max,
{
Curve *cu = (Curve *)ptr->id.data;
*min = 0;
- *max = cu->totcol - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, cu->totcol - 1);
}
static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
Curve *cu = (Curve *)ptr->id.data;
*min = 0;
- *max = cu->totbox - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, cu->totbox - 1);
}
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 56caa254a59..3f23a376ea3 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -158,8 +158,7 @@ static void rna_Mask_layer_active_index_range(PointerRNA *ptr, int *min, int *ma
Mask *mask = (Mask *)ptr->id.data;
*min = 0;
- *max = mask->masklay_tot - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, mask->masklay_tot - 1);
*softmin = *min;
*softmax = *max;
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index ec7f92374a7..a6f4a88e6c3 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1010,8 +1010,7 @@ static void rna_MeshPoly_material_index_range(PointerRNA *ptr, int *min, int *ma
{
Mesh *me = rna_mesh(ptr);
*min = 0;
- *max = me->totcol - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, me->totcol - 1);
}
static int rna_MeshVertex_index_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 8eca7162d39..d421eb697a3 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -481,8 +481,7 @@ static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max
MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
*min = 0;
- *max = mmd->totlvl; /* intentionally _not_ -1 */
- *max = MAX2(0, *max);
+ *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */
}
static int rna_MultiresModifier_external_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index ece5c82f747..d241f697be0 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -92,6 +92,7 @@ EnumPropertyItem node_socket_type_items[] = {
{SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
{SOCK_MESH, "MESH", 0, "Mesh", ""},
{SOCK_INT, "INT", 0, "Int", ""},
+ {SOCK_STRING, "STRING", 0, "String", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -192,6 +193,10 @@ EnumPropertyItem prop_wave_items[] = {
SUBTYPE(FLOAT, Float, TIME, Time) \
SUBTYPE(FLOAT, Float, DISTANCE, Distance)
+#define NODE_DEFINE_SUBTYPES_STRING \
+ SUBTYPE(STRING, String, NONE, None) \
+ SUBTYPE(STRING, String, FILEPATH, Filepath)
+
#define NODE_DEFINE_SUBTYPES_VECTOR \
SUBTYPE(VECTOR, Vector, NONE, None) \
SUBTYPE(VECTOR, Vector, TRANSLATION, Translation) \
@@ -204,7 +209,8 @@ EnumPropertyItem prop_wave_items[] = {
#define NODE_DEFINE_SUBTYPES \
NODE_DEFINE_SUBTYPES_INT \
NODE_DEFINE_SUBTYPES_FLOAT \
- NODE_DEFINE_SUBTYPES_VECTOR
+ NODE_DEFINE_SUBTYPES_STRING \
+ NODE_DEFINE_SUBTYPES_VECTOR \
#ifdef RNA_RUNTIME
@@ -292,6 +298,9 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
case SOCK_VECTOR:
NODE_DEFINE_SUBTYPES_VECTOR
break;
+ case SOCK_STRING:
+ NODE_DEFINE_SUBTYPES_STRING
+ break;
case SOCK_RGBA:
return &RNA_NodeSocketRGBA;
case SOCK_SHADER:
@@ -1166,7 +1175,7 @@ static EnumPropertyItem node_glossy_items[] = {
static EnumPropertyItem node_script_mode_items[] = {
{NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text datablock"},
- {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or oso file"},
+ {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
{0, NULL, 0, NULL, NULL}
};
@@ -1275,6 +1284,14 @@ static void alloc_node_type_items(EnumPropertyItem *items, int category)
item++;
+ item->value = NODE_FRAME;
+ item->identifier = "FRAME";
+ item->icon = 0;
+ item->name = "Frame";
+ item->description = "";
+
+ item++;
+
/* NOTE!, increase 'count' when adding items here */
memset(item, 0, sizeof(EnumPropertyItem));
@@ -1842,6 +1859,67 @@ static void def_glossy(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_sh_normal_map(StructRNA *srna)
+{
+ static EnumPropertyItem prop_space_items[] = {
+ {SHD_NORMAL_MAP_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
+ {SHD_NORMAL_MAP_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
+ {SHD_NORMAL_MAP_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_space_items);
+ RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
+}
+
+static void def_sh_tangent(StructRNA *srna)
+{
+ static EnumPropertyItem prop_direction_type_items[] = {
+ {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
+ {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_axis_items[] = {
+ {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
+ {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
+ {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
+
+ prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_direction_type_items);
+ RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_axis_items);
+ RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
+}
+
static void def_sh_script(StructRNA *srna)
{
FunctionRNA *func;
@@ -1869,11 +1947,12 @@ static void def_sh_script(StructRNA *srna)
prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_SCRIPT_AUTO_UPDATE);
- RNA_def_property_ui_text(prop, "Auto Update", "Automatically updates the shader when the .osl file changes - external scripts only");
+ RNA_def_property_ui_text(prop, "Auto Update",
+ "Automatically update the shader when the .osl file changes (external scripts only)");
prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ShaderNodeScript_bytecode_get",
- "rna_ShaderNodeScript_bytecode_length", "rna_ShaderNodeScript_bytecode_set");
+ RNA_def_property_string_funcs(prop, "rna_ShaderNodeScript_bytecode_get", "rna_ShaderNodeScript_bytecode_length",
+ "rna_ShaderNodeScript_bytecode_set");
RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
@@ -4464,6 +4543,20 @@ static void rna_def_node_socket_subtype(BlenderRNA *brna, int type, int subtype,
RNA_def_property_ui_text(prop, "Default Value", "");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
break;
+ case SOCK_STRING:
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
+
+ prop = RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "subtype");
+ RNA_def_property_enum_items(prop, subtype_items);
+ RNA_def_property_ui_text(prop, "Subtype", "Subtype defining the socket value details");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
+
+ prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "value");
+ RNA_def_property_ui_text(prop, "Default Value", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
+ break;
}
/* XXX need to reset the from-type here, so subtype subclasses cast correctly! (RNA bug) */
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index c45c9b71442..fbbcbae6c12 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -65,12 +65,14 @@ DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LA
DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" )
DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" )
DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" )
+DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, 0, "AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "" )
DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" )
DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" )
DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, 0, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass Bsdf", "" )
+DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_glossy, "BSDF_REFRACTION", BsdfRefraction, "Refraction Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent Bsdf", "" )
DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet Bsdf", "" )
@@ -82,7 +84,9 @@ DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LI
DefNode( ShaderNode, SH_NODE_LIGHT_FALLOFF, 0, "LIGHT_FALLOFF", LightFalloff, "Light Falloff", "" )
DefNode( ShaderNode, SH_NODE_OBJECT_INFO, 0, "OBJECT_INFO", ObjectInfo, "Object Info", "" )
DefNode( ShaderNode, SH_NODE_PARTICLE_INFO, 0, "PARTICLE_INFO", ParticleInfo, "Particle Info", "" )
-DefNode( ShaderNode, SH_NODE_BUMP, 0, "BUMP", BumpNode, "Bump", "" )
+DefNode( ShaderNode, SH_NODE_BUMP, 0, "BUMP", Bump, "Bump", "" )
+DefNode( ShaderNode, SH_NODE_NORMAL_MAP, def_sh_normal_map, "NORMAL_MAP", NormalMap, "Normal Map", "" )
+DefNode( ShaderNode, SH_NODE_TANGENT, def_sh_tangent, "TANGENT", Tangent, "Tangent", "" )
DefNode( ShaderNode, SH_NODE_SCRIPT, def_sh_script, "SCRIPT", Script, "Script", "" )
DefNode( ShaderNode, SH_NODE_TEX_IMAGE, def_sh_tex_image, "TEX_IMAGE", TexImage, "Image Texture", "" )
DefNode( ShaderNode, SH_NODE_TEX_ENVIRONMENT, def_sh_tex_environment, "TEX_ENVIRONMENT", TexEnvironment, "Environment Texture","" )
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 10f361ef1bd..82f27b953cf 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -547,8 +547,7 @@ static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min
Object *ob = (Object *)ptr->id.data;
*min = 0;
- *max = BLI_countlist(&ob->defbase) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&ob->defbase) - 1);
}
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
@@ -658,7 +657,7 @@ static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, in
{
Object *ob = (Object *)ptr->id.data;
*min = 0;
- *max = MAX2(ob->totcol - 1, 0);
+ *max = max_ii(ob->totcol - 1, 0);
}
/* returns active base material */
@@ -684,8 +683,7 @@ static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *
{
Object *ob = (Object *)ptr->id.data;
*min = 0;
- *max = BLI_countlist(&ob->particlesystem) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&ob->particlesystem) - 1);
}
static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index f47b864d25a..6d7187da7d9 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -51,6 +51,9 @@ static EnumPropertyItem effector_shape_items[] = {
#ifdef RNA_RUNTIME
+#include "BLI_math_base.h"
+
+
/* type specific return values only used from functions */
static EnumPropertyItem curve_shape_items[] = {
{PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
@@ -239,8 +242,7 @@ static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min,
for (pid = pidlist.first; pid; pid = pid->next) {
if (pid->cache == cache) {
- *max = BLI_countlist(pid->ptcaches) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(pid->ptcaches) - 1);
break;
}
}
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 9ba2a062791..6825d3d781d 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -530,8 +530,7 @@ static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *pt
{
ParticleSystem *psys = (ParticleSystem *)ptr->data;
*min = 0;
- *max = BLI_countlist(&psys->targets) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&psys->targets) - 1);
}
static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
@@ -670,8 +669,7 @@ static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min
{
ParticleSettings *part = (ParticleSettings *)ptr->id.data;
*min = 0;
- *max = BLI_countlist(&part->dupliweights) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&part->dupliweights) - 1);
}
static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index c29537378dd..412aad20a41 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -381,13 +381,7 @@ static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, in
bPose *pose = (ob) ? ob->pose : NULL;
*min = 0;
-
- if (pose) {
- *max = BLI_countlist(&pose->agroups) - 1;
- *max = MAX2(0, *max);
- }
- else
- *max = 0;
+ *max = pose ? max_ii(0, BLI_countlist(&pose->agroups) - 1) : 0;
}
static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
@@ -419,8 +413,7 @@ static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, in
bPose *pose = (bPose *)ptr->data;
*min = 0;
- *max = BLI_countlist(&pose->agroups) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&pose->agroups) - 1);
}
#if 0
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 56497e96c67..46b22cd0963 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -370,6 +370,11 @@ static void rna_def_render_engine(BlenderRNA *brna)
prop = RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f);
RNA_def_property_flag(prop, PROP_REQUIRED);
+ func = RNA_def_function(srna, "update_memory_stats", "RE_engine_update_memory_stats");
+ RNA_def_float(func, "memory_used", 0, 0.0f, FLT_MAX, "", "Current memory usage in megabytes", 0.0f, FLT_MAX);
+ RNA_def_float(func, "memory_peak", 0, 0.0f, FLT_MAX, "", "Peak memory usage in megabytes", 0.0f, FLT_MAX);
+ RNA_def_property_flag(prop, PROP_REQUIRED);
+
func = RNA_def_function(srna, "report", "RE_engine_report");
prop = RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
RNA_def_property_flag(prop, PROP_REQUIRED);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 42fb712786c..516f619d910 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1005,8 +1005,7 @@ static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *mi
RenderData *rd = (RenderData *)ptr->data;
*min = 0;
- *max = BLI_countlist(&rd->layers) - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, BLI_countlist(&rd->layers) - 1);
}
static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
@@ -3837,16 +3836,16 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- prop = RNA_def_property(srna, "parts_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "xparts");
- RNA_def_property_range(prop, 1, 512);
- RNA_def_property_ui_text(prop, "Parts X", "Number of horizontal tiles to use while rendering");
+ prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tilex");
+ RNA_def_property_range(prop, 8, 10000);
+ RNA_def_property_ui_text(prop, "Tile X", "Horizontal tile size to use while rendering");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- prop = RNA_def_property(srna, "parts_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "yparts");
- RNA_def_property_range(prop, 1, 512);
- RNA_def_property_ui_text(prop, "Parts Y", "Number of vertical tiles to use while rendering");
+ prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tiley");
+ RNA_def_property_range(prop, 8, 10000);
+ RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 054d0cc82c6..c2fa64698e4 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1688,6 +1688,16 @@ static void rna_def_effect_inputs(StructRNA *srna, int count)
#endif
}
+static void rna_def_color_management(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "strip->colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedColorspaceSettings");
+ RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
+}
+
static void rna_def_image(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1714,6 +1724,7 @@ static void rna_def_image(BlenderRNA *brna)
rna_def_filter_video(srna);
rna_def_proxy(srna);
rna_def_input(srna);
+ rna_def_color_management(srna);
}
static void rna_def_meta(BlenderRNA *brna)
@@ -1799,6 +1810,7 @@ static void rna_def_movie(BlenderRNA *brna)
rna_def_filter_video(srna);
rna_def_proxy(srna);
rna_def_input(srna);
+ rna_def_color_management(srna);
}
static void rna_def_movieclip(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index 8ddb9d0a7e7..7602ec99c2b 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -89,6 +89,8 @@ static Sequence *alloc_generic_sequence(Editing *ed, const char *name, int start
if (file) {
strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
BLI_split_dirfile(file, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
+
+ BKE_sequence_init_colorspace(seq);
}
else {
strip->stripdata = NULL;
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 365b80b6d7c..4aefaf991d2 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -120,8 +120,7 @@ static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, in
MovieClip *clip = (MovieClip *)ptr->id.data;
*min = 0;
- *max = clip->tracking.tot_object - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, clip->tracking.tot_object - 1);
}
static PointerRNA rna_tracking_active_track_get(PointerRNA *ptr)
@@ -263,8 +262,7 @@ static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min
MovieClip *clip = (MovieClip *)ptr->id.data;
*min = 0;
- *max = clip->tracking.stabilization.tot_track - 1;
- *max = MAX2(0, *max);
+ *max = max_ii(0, clip->tracking.stabilization.tot_track - 1);
}
static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
@@ -452,7 +450,7 @@ static void rna_trackingObject_remove(MovieTracking *tracking, ReportList *repor
{
MovieTrackingObject *object = object_ptr->data;
if (BKE_tracking_object_delete(tracking, object) == FALSE) {
- BKE_reportf(reports, RPT_ERROR, "MovieTracking '%s' can't be removed", object->name);
+ BKE_reportf(reports, RPT_ERROR, "MovieTracking '%s' cannot be removed", object->name);
return;
}
@@ -574,6 +572,22 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
"Limit speed of tracking to make visual feedback easier "
"(this does not affect the tracking quality)");
+ /* reconstruction success_threshold */
+ prop = RNA_def_property(srna, "reconstruction_success_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_default(prop, 0.001f);
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Success Threshold",
+ "Threshold value of reconstruction error which is still considered successful");
+
+ /* use fallback reconstruction */
+ prop = RNA_def_property(srna, "use_fallback_reconstruction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "reconstruction_flag", TRACKING_USE_FALLBACK_RECONSTRUCTION);
+ RNA_def_property_ui_text(prop, "Use Fallback",
+ "Use fallback reconstruction algorithm in cases main reconstruction algorithm failed "
+ "(could give better solution with bad tracks)");
+
/* intrinsics refinement during bundle adjustment */
prop = RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics");
@@ -623,7 +637,8 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_tripod_solver", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_boolean_sdna(prop, NULL, "motion_flag", TRACKING_MOTION_TRIPOD);
- RNA_def_property_ui_text(prop, "Tripod Motion", "Use special solver to track a stable camera position, such as a tripod");
+ RNA_def_property_ui_text(prop, "Tripod Motion",
+ "Use special solver to track a stable camera position, such as a tripod");
/* default_limit_frames */
prop = RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
@@ -663,7 +678,9 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
/* default_use_brute */
prop = RNA_def_property(srna, "use_default_mask", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
- RNA_def_property_ui_text(prop, "Use Mask", "Use a grease pencil datablock as a mask to use only specified areas of pattern when tracking");
+ RNA_def_property_ui_text(prop, "Use Mask",
+ "Use a grease pencil datablock as a mask to use only specified areas of pattern "
+ "when tracking");
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
/* default_use_normalization */
@@ -1000,7 +1017,9 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
/* use_brute */
prop = RNA_def_property(srna, "use_mask", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
- RNA_def_property_ui_text(prop, "Use Mask", "Use a grease pencil datablock as a mask to use only specified areas of pattern when tracking");
+ RNA_def_property_ui_text(prop, "Use Mask",
+ "Use a grease pencil datablock as a mask to use only specified areas of pattern "
+ "when tracking");
RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
/* use_normalization */
@@ -1447,7 +1466,8 @@ static void rna_def_trackingDopesheet(BlenderRNA *brna)
{TRACKING_DOPE_SORT_NAME, "NAME", 0, "Name", "Sort channels by their names"},
{TRACKING_DOPE_SORT_LONGEST, "LONGEST", 0, "Longest", "Sort channels by longest tracked segment"},
{TRACKING_DOPE_SORT_TOTAL, "TOTAL", 0, "Total", "Sort channels by overall amount of tracked segments"},
- {TRACKING_DOPE_SORT_AVERAGE_ERROR, "AVERAGE_ERROR", 0, "Average Error", "Sort channels by average reprojection error of tracks after solve"},
+ {TRACKING_DOPE_SORT_AVERAGE_ERROR, "AVERAGE_ERROR", 0, "Average Error",
+ "Sort channels by average reprojection error of tracks after solve"},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index c49f67d49fe..52953144261 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3434,7 +3434,7 @@ static void rna_def_userdef_input(BlenderRNA *brna)
/* 3D view */
prop = RNA_def_property(srna, "ndof_view_rotate_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
RNA_def_property_enum_items(prop, ndof_view_rotation_items);
RNA_def_property_ui_text(prop, "NDOF View Rotation", "Rotation style in the viewport");
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 116e07073cd..b7895cc0e2d 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -158,7 +158,7 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA
wmKeyMapItem *kmi = kmi_ptr->data;
if (WM_keymap_remove_item(km, kmi) == FALSE) {
- BKE_reportf(reports, RPT_ERROR, "KeyMapItem '%s' can't be removed from '%s'", kmi->idname, km->idname);
+ BKE_reportf(reports, RPT_ERROR, "KeyMapItem '%s' cannot be removed from '%s'", kmi->idname, km->idname);
return;
}
@@ -195,7 +195,7 @@ static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, Point
wmKeyConfig *keyconf = keyconf_ptr->data;
if (WM_keyconfig_remove(wm, keyconf) == FALSE) {
- BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' can't be removed", keyconf->idname);
+ BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
return;
}
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 323a534c989..7dca4d07b24 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -145,36 +145,40 @@ set(SRC
shader/nodes/node_shader_valToRgb.c
shader/nodes/node_shader_value.c
shader/nodes/node_shader_vectMath.c
+ shader/nodes/node_shader_add_shader.c
+ shader/nodes/node_shader_ambient_occlusion.c
shader/nodes/node_shader_attribute.c
shader/nodes/node_shader_background.c
shader/nodes/node_shader_bsdf_anisotropic.c
shader/nodes/node_shader_bsdf_diffuse.c
- shader/nodes/node_shader_bsdf_glossy.c
shader/nodes/node_shader_bsdf_glass.c
+ shader/nodes/node_shader_bsdf_glossy.c
+ shader/nodes/node_shader_bsdf_refraction.c
shader/nodes/node_shader_bsdf_translucent.c
shader/nodes/node_shader_bsdf_transparent.c
shader/nodes/node_shader_bsdf_velvet.c
shader/nodes/node_shader_bump.c
shader/nodes/node_shader_emission.c
shader/nodes/node_shader_fresnel.c
- shader/nodes/node_shader_layer_weight.c
shader/nodes/node_shader_geometry.c
shader/nodes/node_shader_holdout.c
- shader/nodes/node_shader_volume_transparent.c
- shader/nodes/node_shader_volume_isotropic.c
- shader/nodes/node_shader_light_path.c
+ shader/nodes/node_shader_layer_weight.c
shader/nodes/node_shader_light_falloff.c
- shader/nodes/node_shader_object_info.c
- shader/nodes/node_shader_script.c
- shader/nodes/node_shader_particle_info.c
+ shader/nodes/node_shader_light_path.c
shader/nodes/node_shader_mix_shader.c
- shader/nodes/node_shader_add_shader.c
+ shader/nodes/node_shader_normal_map.c
+ shader/nodes/node_shader_object_info.c
shader/nodes/node_shader_output_lamp.c
shader/nodes/node_shader_output_material.c
shader/nodes/node_shader_output_world.c
- shader/nodes/node_shader_tex_gradient.c
+ shader/nodes/node_shader_particle_info.c
+ shader/nodes/node_shader_script.c
+ shader/nodes/node_shader_tangent.c
+ shader/nodes/node_shader_tex_brick.c
+ shader/nodes/node_shader_tex_checker.c
shader/nodes/node_shader_tex_coord.c
shader/nodes/node_shader_tex_environment.c
+ shader/nodes/node_shader_tex_gradient.c
shader/nodes/node_shader_tex_image.c
shader/nodes/node_shader_tex_magic.c
shader/nodes/node_shader_tex_musgrave.c
@@ -182,8 +186,8 @@ set(SRC
shader/nodes/node_shader_tex_sky.c
shader/nodes/node_shader_tex_voronoi.c
shader/nodes/node_shader_tex_wave.c
- shader/nodes/node_shader_tex_checker.c
- shader/nodes/node_shader_tex_brick.c
+ shader/nodes/node_shader_volume_isotropic.c
+ shader/nodes/node_shader_volume_transparent.c
shader/node_shader_tree.c
shader/node_shader_util.c
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index 66ab15ce29f..e402924c04f 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -81,11 +81,15 @@ void register_node_type_sh_layer_weight(struct bNodeTreeType *ttype);
void register_node_type_sh_tex_coord(struct bNodeTreeType *ttype);
void register_node_type_sh_particle_info(struct bNodeTreeType *ttype);
void register_node_type_sh_script(struct bNodeTreeType *ttype);
+void register_node_type_sh_normal_map(struct bNodeTreeType *ttype);
+void register_node_type_sh_tangent(struct bNodeTreeType *ttype);
+void register_node_type_sh_ambient_occlusion(struct bNodeTreeType *ttype);
void register_node_type_sh_background(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_diffuse(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_glossy(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_glass(struct bNodeTreeType *ttype);
+void register_node_type_sh_bsdf_refraction(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_translucent(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_transparent(struct bNodeTreeType *ttype);
void register_node_type_sh_bsdf_velvet(struct bNodeTreeType *ttype);
diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h
index f41be2bb7d9..b14f7c4e884 100644
--- a/source/blender/nodes/NOD_socket.h
+++ b/source/blender/nodes/NOD_socket.h
@@ -60,6 +60,7 @@ void node_socket_set_default_value_vector(void *default_value, PropertySubType s
void node_socket_set_default_value_rgba(void *default_value, float r, float g, float b, float a);
void node_socket_set_default_value_shader(void *default_value);
void node_socket_set_default_value_mesh(void *default_value);
+void node_socket_set_default_value_string(void *default_value, PropertySubType subtype, const char *value);
struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp);
struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp);
diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
index e16b7e5d885..96e905827cb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
@@ -96,21 +96,24 @@ static void compute_gradient_screen(RenderData *rd, NodeKeyingScreenData *keying
int j;
zero_v3(site->color);
- for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
- if (pattern_ibuf->rect_float) {
- add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
- }
- else {
- unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
- site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
- site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
- site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+ if (pattern_ibuf) {
+ for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
+ if (pattern_ibuf->rect_float) {
+ add_v3_v3(site->color, &pattern_ibuf->rect_float[4 * j]);
+ }
+ else {
+ unsigned char *rrgb = (unsigned char *)pattern_ibuf->rect;
+
+ site->color[0] += srgb_to_linearrgb((float)rrgb[4 * j + 0] / 255.0f);
+ site->color[1] += srgb_to_linearrgb((float)rrgb[4 * j + 1] / 255.0f);
+ site->color[2] += srgb_to_linearrgb((float)rrgb[4 * j + 2] / 255.0f);
+ }
}
- }
- mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
- IMB_freeImBuf(pattern_ibuf);
+ mul_v3_fl(site->color, 1.0f / (pattern_ibuf->x * pattern_ibuf->y));
+ IMB_freeImBuf(pattern_ibuf);
+ }
site->co[0] = marker->pos[0] * screenbuf->x;
site->co[1] = marker->pos[1] * screenbuf->y;
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index c99e12a95b9..5bc67adf5fb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -103,7 +103,8 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
out[0] = pow(in[0], in2[0]);
}
else {
- float y_mod_1 = fmod(in2[0], 1);
+ float y_mod_1 = fabsf(fmodf(in2[0], 1.0f));
+
/* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
out[0] = powf(in[0], floorf(in2[0] + 0.5f));
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
index 8e49484d1eb..0335d295fba 100644
--- a/source/blender/nodes/intern/node_socket.c
+++ b/source/blender/nodes/intern/node_socket.c
@@ -41,6 +41,7 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_string.h"
#include "BKE_DerivedMesh.h"
#include "BKE_node.h"
@@ -157,6 +158,20 @@ static bNodeSocketType node_socket_type_mesh = {
/* buttonfunc */ NULL,
};
+/****************** STRING ******************/
+
+static bNodeSocketType node_socket_type_string = {
+ /* type */ SOCK_STRING,
+ /* ui_name */ "String",
+ /* ui_description */ "String",
+ /* ui_icon */ 0,
+ /* ui_color */ {255, 255, 255, 255},
+
+ /* value_structname */ "bNodeSocketValueString",
+ /* value_structsize */ sizeof(bNodeSocketValueString),
+
+ /* buttonfunc */ NULL,
+};
void node_socket_type_init(bNodeSocketType *types[])
{
@@ -169,6 +184,7 @@ void node_socket_type_init(bNodeSocketType *types[])
INIT_TYPE(boolean);
INIT_TYPE(shader);
INIT_TYPE(mesh);
+ INIT_TYPE(string);
#undef INIT_TYPE
}
@@ -218,6 +234,9 @@ void node_socket_init_default_value(int type, void *default_value)
case SOCK_MESH:
node_socket_set_default_value_mesh(default_value);
break;
+ case SOCK_STRING:
+ node_socket_set_default_value_string(default_value, PROP_NONE, (char *)"");
+ break;
}
}
@@ -265,6 +284,13 @@ void node_socket_set_default_value_rgba(void *default_value, float r, float g, f
val->value[3] = a;
}
+void node_socket_set_default_value_string(void *default_value, PropertySubType subtype, const char *value)
+{
+ bNodeSocketValueString *val = default_value;
+ val->subtype = subtype;
+ BLI_strncpy(val->value, value, 1024);//FILE_MAX
+}
+
void node_socket_set_default_value_shader(void *UNUSED(default_value))
{
}
@@ -282,12 +308,14 @@ void node_socket_copy_default_value(int type, void *to_default_value, void *from
bNodeSocketValueBoolean *frombool= (bNodeSocketValueBoolean*)from_default_value;
bNodeSocketValueVector *fromvector= (bNodeSocketValueVector*)from_default_value;
bNodeSocketValueRGBA *fromrgba= (bNodeSocketValueRGBA*)from_default_value;
+ bNodeSocketValueString *fromstring= (bNodeSocketValueString*)from_default_value;
bNodeSocketValueFloat *tofloat= (bNodeSocketValueFloat*)to_default_value;
bNodeSocketValueInt *toint= (bNodeSocketValueInt*)to_default_value;
bNodeSocketValueBoolean *tobool= (bNodeSocketValueBoolean*)to_default_value;
bNodeSocketValueVector *tovector= (bNodeSocketValueVector*)to_default_value;
bNodeSocketValueRGBA *torgba= (bNodeSocketValueRGBA*)to_default_value;
+ bNodeSocketValueString *tostring= (bNodeSocketValueString*)to_default_value;
switch (type) {
case SOCK_FLOAT:
@@ -305,6 +333,9 @@ void node_socket_copy_default_value(int type, void *to_default_value, void *from
case SOCK_RGBA:
*torgba = *fromrgba;
break;
+ case SOCK_STRING:
+ *tostring = *fromstring;
+ break;
}
}
@@ -470,6 +501,9 @@ struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct
case SOCK_MESH:
node_socket_set_default_value_mesh(sock->default_value);
break;
+ case SOCK_STRING:
+ node_socket_set_default_value_string(sock->default_value, stemp->subtype, (char *)"");
+ break;
}
return sock;
diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
new file mode 100644
index 00000000000..7dfefc9ece0
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
@@ -0,0 +1,63 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_ambient_occlusion_in[] = {
+ { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate sh_node_ambient_occlusion_out[] = {
+ { SOCK_SHADER, 0, N_("AO")},
+ { -1, 0, "" }
+};
+
+static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+ return GPU_stack_link(mat, "node_ambient_occlusion", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+}
+
+/* node type definition */
+void register_node_type_sh_ambient_occlusion(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_SHADER, 0);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, sh_node_ambient_occlusion_in, sh_node_ambient_occlusion_out);
+ node_type_size(&ntype, 150, 60, 200);
+ node_type_init(&ntype, NULL);
+ node_type_storage(&ntype, "", NULL, NULL);
+ node_type_exec(&ntype, NULL);
+ node_type_gpu(&ntype, node_shader_gpu_ambient_occlusion);
+
+ nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
index 7e023ff8547..71780e9316e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
@@ -31,8 +31,9 @@
static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- { SOCK_FLOAT, 1, N_("Roughness U"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
- { SOCK_FLOAT, 1, N_("Roughness V"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, N_("Roughness"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, N_("Anisotropy"), 0.5f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f},
+ { SOCK_FLOAT, 1, N_("Rotation"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ SOCK_VECTOR, 1, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ -1, 0, "" }
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c
new file mode 100644
index 00000000000..99e66e39002
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.c
@@ -0,0 +1,68 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = {
+ { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { SOCK_FLOAT, 1, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 1.0f, 1000.0f},
+ { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate sh_node_bsdf_refraction_out[] = {
+ { SOCK_SHADER, 0, N_("BSDF")},
+ { -1, 0, "" }
+};
+
+static int node_shader_gpu_bsdf_refraction(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+ if (!in[3].link)
+ in[3].link = GPU_builtin(GPU_VIEW_NORMAL);
+
+ return GPU_stack_link(mat, "node_bsdf_refraction", in, out);
+}
+
+/* node type definition */
+void register_node_type_sh_bsdf_refraction(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER, NODE_OPTIONS);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, sh_node_bsdf_refraction_in, sh_node_bsdf_refraction_out);
+ node_type_size(&ntype, 150, 60, 200);
+ node_type_init(&ntype, NULL);
+ node_type_storage(&ntype, "", NULL, NULL);
+ node_type_exec(&ntype, NULL);
+ node_type_gpu(&ntype, node_shader_gpu_bsdf_refraction);
+
+ nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index a70134b2325..0b71a3f13b4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -137,11 +137,22 @@ bNodeStack **out)
break;
case 10: /* Power */
{
- /* Don't want any imaginary numbers... */
- if ( in[0]->vec[0] >= 0 )
+ /* Only raise negative numbers by full integers */
+ if ( in[0]->vec[0] >= 0 ) {
out[0]->vec[0] = pow(in[0]->vec[0], in[1]->vec[0]);
- else
- out[0]->vec[0] = 0.0;
+ }
+ else {
+ float y_mod_1 = fabsf(fmodf(in[1]->vec[0], 1.0f));
+
+ /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */
+ if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
+ out[0]->vec[0] = powf(in[0]->vec[0], floorf(in[1]->vec[0] + 0.5f));
+ }
+ else {
+ out[0]->vec[0] = 0.0f;
+ }
+ }
+
}
break;
case 11: /* Logarithm */
@@ -214,8 +225,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
case 13:
case 15:
case 16:
- GPU_stack_link(mat, names[node->custom1], NULL, out,
- GPU_socket(&in[0]), GPU_socket(&in[1]));
+ GPU_stack_link(mat, names[node->custom1], in, out);
break;
case 4:
case 5:
@@ -224,10 +234,20 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUN
case 8:
case 9:
case 14:
- if (in[0].hasinput || !in[1].hasinput)
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
- else
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
+ if (in[0].hasinput || !in[1].hasinput) {
+ /* use only first item and terminator */
+ GPUNodeStack tmp_in[2];
+ memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack));
+ memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
+ else {
+ /* use only second item and terminator */
+ GPUNodeStack tmp_in[2];
+ memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack));
+ memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
break;
default:
return 0;
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.c b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
new file mode 100644
index 00000000000..39fd8a5decc
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.c
@@ -0,0 +1,69 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_normal_map_in[] = {
+ { SOCK_RGBA, 0, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static bNodeSocketTemplate sh_node_normal_map_out[] = {
+ { SOCK_VECTOR, 0, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeShaderNormalMap *attr = MEM_callocN(sizeof(NodeShaderNormalMap), "NodeShaderNormalMap");
+ node->storage = attr;
+}
+
+static int gpu_shader_normal_map(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+ return GPU_stack_link(mat, "node_normal_map", in, out, GPU_builtin(GPU_VIEW_NORMAL));
+}
+
+/* node type definition */
+void register_node_type_sh_normal_map(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, sh_node_normal_map_in, sh_node_normal_map_out);
+ node_type_size(&ntype, 250, 60, 250);
+ node_type_init(&ntype, node_shader_init_normal_map);
+ node_type_storage(&ntype, "NodeShaderNormalMap", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, NULL);
+ node_type_gpu(&ntype, gpu_shader_normal_map);
+
+ nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/shader/nodes/node_shader_script.c b/source/blender/nodes/shader/nodes/node_shader_script.c
index 52d39363de6..b5563658a64 100644
--- a/source/blender/nodes/shader/nodes/node_shader_script.c
+++ b/source/blender/nodes/shader/nodes/node_shader_script.c
@@ -46,15 +46,16 @@ static void node_free_script(bNode *node)
NodeShaderScript *nss = node->storage;
if (nss) {
- if (nss->bytecode)
+ if (nss->bytecode) {
MEM_freeN(nss->bytecode);
+ }
- MEM_freeN(nss);
- }
+ if (nss->prop) {
+ IDP_FreeProperty(nss->prop);
+ MEM_freeN(nss->prop);
+ }
- if (nss->prop) {
- IDP_FreeProperty(nss->prop);
- MEM_freeN(nss->prop);
+ MEM_freeN(nss);
}
}
@@ -63,7 +64,7 @@ static void node_copy_script(bNode *orig_node, bNode *new_node)
NodeShaderScript *orig_nss = orig_node->storage;
NodeShaderScript *new_nss = MEM_dupallocN(orig_nss);
- if(orig_nss->bytecode)
+ if (orig_nss->bytecode)
new_nss->bytecode = MEM_dupallocN(orig_nss->bytecode);
if (orig_nss->prop)
diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.c b/source/blender/nodes/shader/nodes/node_shader_tangent.c
new file mode 100644
index 00000000000..6c0d6d7cd9f
--- /dev/null
+++ b/source/blender/nodes/shader/nodes/node_shader_tangent.c
@@ -0,0 +1,60 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "../node_shader_util.h"
+
+/* **************** OUTPUT ******************** */
+
+static bNodeSocketTemplate sh_node_tangent_out[] = {
+ { SOCK_VECTOR, 0, N_("Tangent"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ NodeShaderTangent *attr = MEM_callocN(sizeof(NodeShaderTangent), "NodeShaderTangent");
+ attr->axis = SHD_TANGENT_AXIS_Z;
+ node->storage = attr;
+}
+
+/* node type definition */
+void register_node_type_sh_tangent(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT, NODE_OPTIONS);
+ node_type_compatibility(&ntype, NODE_NEW_SHADING);
+ node_type_socket_templates(&ntype, NULL, sh_node_tangent_out);
+ node_type_size(&ntype, 150, 60, 200);
+ node_type_init(&ntype, node_shader_init_tangent);
+ node_type_storage(&ntype, "NodeShaderTangent", node_free_standard_storage, node_copy_standard_storage);
+ node_type_exec(&ntype, NULL);
+ node_type_gpu(&ntype, NULL);
+
+ nodeRegisterType(ttype, &ntype);
+}
+
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 2d9f1903c5b..3e00421ddf0 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -114,14 +114,23 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
case 2:
case 3:
case 4:
- GPU_stack_link(mat, names[node->custom1], NULL, out,
- GPU_socket(&in[0]), GPU_socket(&in[1]));
+ GPU_stack_link(mat, names[node->custom1], in, out);
break;
case 5:
- if (in[0].hasinput || !in[1].hasinput)
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[0]));
- else
- GPU_stack_link(mat, names[node->custom1], NULL, out, GPU_socket(&in[1]));
+ if (in[0].hasinput || !in[1].hasinput) {
+ /* use only first item and terminator */
+ GPUNodeStack tmp_in[2];
+ memcpy(&tmp_in[0], &in[0], sizeof(GPUNodeStack));
+ memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
+ else {
+ /* use only second item and terminator */
+ GPUNodeStack tmp_in[2];
+ memcpy(&tmp_in[0], &in[1], sizeof(GPUNodeStack));
+ memcpy(&tmp_in[1], &in[2], sizeof(GPUNodeStack));
+ GPU_stack_link(mat, names[node->custom1], tmp_in, out);
+ }
break;
default:
return 0;
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 45b767c6eda..a10bfef2a8d 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -520,7 +520,7 @@ static PyObject *Buffer_subscript(Buffer *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -556,7 +556,7 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->dimensions[0], &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index b9ef4b056ad..ad97ceb68d4 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -1,4 +1,4 @@
-/*
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -56,6 +56,7 @@ static ListBase bpy_import_main_list;
static PyMethodDef bpy_import_meth;
static PyMethodDef bpy_reload_meth;
+static PyObject *imp_reload_orig = NULL;
/* 'builtins' is most likely PyEval_GetBuiltins() */
void bpy_import_init(PyObject *builtins)
@@ -69,7 +70,13 @@ void bpy_import_init(PyObject *builtins)
* XXX, use import hooks */
mod = PyImport_ImportModuleLevel((char *)"imp", NULL, NULL, NULL, 0);
if (mod) {
- PyDict_SetItemString(PyModule_GetDict(mod), "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
+ PyObject *mod_dict = PyModule_GetDict(mod);
+
+ /* blender owns the function */
+ imp_reload_orig = PyDict_GetItemString(mod_dict, "reload");
+ Py_INCREF(imp_reload_orig);
+
+ PyDict_SetItemString(mod_dict, "reload", item = PyCFunction_New(&bpy_reload_meth, NULL)); Py_DECREF(item);
Py_DECREF(mod);
}
else {
@@ -309,7 +316,12 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
int found = 0;
/* try reimporting from file */
- newmodule = PyImport_ReloadModule(module);
+
+ /* in Py3.3 this just calls imp.reload() which we overwrite, causing recursive calls */
+ //newmodule = PyImport_ReloadModule(module);
+
+ newmodule = PyObject_CallFunctionObjArgs(imp_reload_orig, module, NULL);
+
if (newmodule)
return newmodule;
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index d2890bc046e..529b2e708ad 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -1187,7 +1187,7 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -1222,7 +1222,7 @@ static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->prop->len, &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 333da6cb017..c57caf0683b 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -32,6 +32,9 @@
#include <Python.h>
+#include "RNA_types.h"
+#include "RNA_access.h"
+
#include "bpy.h"
#include "bpy_util.h"
#include "bpy_rna.h"
@@ -49,8 +52,6 @@
#include "BKE_global.h" /* XXX, G.main only */
#include "BKE_blender.h"
-#include "RNA_access.h"
-
#include "MEM_guardedalloc.h"
/* external util modules */
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 68b6baadd71..eaaced416fe 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -2612,7 +2612,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
int len = pyrna_prop_array_length(self);
Py_ssize_t start, stop, slicelength;
- if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -2780,7 +2780,7 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
int len = RNA_property_array_length(&self->ptr, self->prop);
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)key, len, &start, &stop, &step, &slicelength) < 0) {
+ if (PySlice_GetIndicesEx(key, len, &start, &stop, &step, &slicelength) < 0) {
ret = -1;
}
else if (slicelength <= 0) {
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index 63660b06813..6aa50cf88de 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -24,15 +24,20 @@
* \ingroup pythonintern
*/
-
#ifndef __BPY_UTIL_H__
#define __BPY_UTIL_H__
#if PY_VERSION_HEX < 0x03020000
-#error "Python 3.2 or greater is required, you'll need to update your python."
+# error "Python 3.2 or greater is required, you'll need to update your python."
#endif
-#include "RNA_types.h" /* for EnumPropertyItem only */
+#if PY_VERSION_HEX < 0x03030000
+# ifdef _MSC_VER
+# pragma message("Python 3.2 will be deprecated soon, upgrade to Python 3.3.")
+# else
+# warning "Python 3.2 will be deprecated soon, upgrade to Python 3.3."
+# endif
+#endif
struct EnumPropertyItem;
struct ReportList;
@@ -51,4 +56,5 @@ void BPy_SetContext(struct bContext *C);
extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
-#endif
+
+#endif /* __BPY_UTIL_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 747a23a719d..f16b488f9d0 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -306,7 +306,7 @@ static PyObject *Color_subscript(ColorObject *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -342,7 +342,7 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, COLOR_SIZE, &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 3592e1084fb..829d3ee27e1 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -497,7 +497,7 @@ static PyObject *Euler_subscript(EulerObject *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -534,7 +534,7 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, EULER_SIZE, &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index b9f0ce9ad96..64112024dd1 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -2087,7 +2087,7 @@ static PyObject *Matrix_subscript(MatrixObject *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -2123,7 +2123,7 @@ static int Matrix_ass_subscript(MatrixObject *self, PyObject *item, PyObject *va
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->num_row, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->num_row, &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
@@ -2626,7 +2626,7 @@ static PyObject *MatrixAccess_subscript(MatrixAccessObject *self, PyObject *item
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, MatrixAccess_len(self), &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index b9aba995973..cda39932610 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -670,7 +670,7 @@ static PyObject *Quaternion_subscript(QuaternionObject *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -707,7 +707,7 @@ static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyOb
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 06d7f3fec51..19be2b6a62e 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1976,7 +1976,7 @@ static PyObject *Vector_subscript(VectorObject *self, PyObject *item)
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->size, &start, &stop, &step, &slicelength) < 0)
return NULL;
if (slicelength <= 0) {
@@ -2012,7 +2012,7 @@ static int Vector_ass_subscript(VectorObject *self, PyObject *item, PyObject *va
else if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
- if (PySlice_GetIndicesEx((void *)item, self->size, &start, &stop, &step, &slicelength) < 0)
+ if (PySlice_GetIndicesEx(item, self->size, &start, &stop, &step, &slicelength) < 0)
return -1;
if (step == 1)
diff --git a/source/blender/quicktime/quicktime_export.h b/source/blender/quicktime/quicktime_export.h
index cef4cb8c2a6..a3469ddafde 100644
--- a/source/blender/quicktime/quicktime_export.h
+++ b/source/blender/quicktime/quicktime_export.h
@@ -87,8 +87,8 @@ void makeqtstring(struct RenderData *rd, char *string); //for playanim.c
-#if (defined(USE_QTKIT) && defined(MAC_OS_X_VERSION_10_6) && __LP64__)
-//Include the quicktime codec types constants that are missing in QTKitDefines.h in 10.6 / 64bit
+#if (defined(USE_QTKIT) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 && __LP64__)
+//Include the quicktime codec types constants that are missing in QTKitDefines.h
enum {
kRawCodecType = 'raw ',
kCinepakCodecType = 'cvid',
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 20024eab633..1331c287d7c 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -115,6 +115,7 @@ void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, int
int RE_engine_test_break(RenderEngine *engine);
void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info);
void RE_engine_update_progress(RenderEngine *engine, float progress);
+void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float mem_peak);
void RE_engine_report(RenderEngine *engine, int type, const char *msg);
int RE_engine_render(struct Render *re, int do_all);
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 9525d1dd8f1..f5c77d49c21 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -148,6 +148,7 @@ typedef struct RenderStats {
double starttime, lastframetime;
const char *infostr, *statstr;
char scene_name[MAX_ID_NAME - 2];
+ float mem_used, mem_peak;
} RenderStats;
/* *********************** API ******************** */
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index 5e4417a3bc6..7f785eb3d8b 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -145,8 +145,6 @@ struct Render
/* final picture width and height (within disprect) */
int rectx, recty;
- /* real maximum amount of xparts/yparts after correction for minimum */
- int xparts, yparts;
/* real maximum size of parts after correction for minimum
* partx*xparts can be larger than rectx, in that case last part is smaller */
int partx, party;
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 6d092f75663..bb7c1bdf94b 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -4356,7 +4356,7 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset)
/* compute average bounding box of strandpoint itself (width) */
if (obr->strandbuf->flag & R_STRAND_B_UNITS)
- obr->strandbuf->maxwidth= MAX2(obr->strandbuf->ma->strand_sta, obr->strandbuf->ma->strand_end);
+ obr->strandbuf->maxwidth = max_ff(obr->strandbuf->ma->strand_sta, obr->strandbuf->ma->strand_end);
else
obr->strandbuf->maxwidth= 0.0f;
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 558ba8fe062..28f70211a9c 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -148,7 +148,8 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR);
envre->r.layers.first = envre->r.layers.last = NULL;
envre->r.filtertype = 0;
- envre->r.xparts = envre->r.yparts = 2;
+ envre->r.tilex = envre->r.xsch / 2;
+ envre->r.tiley = envre->r.ysch / 2;
envre->r.size = 100;
envre->r.yasp = envre->r.xasp = 1;
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 076cad05c84..e2f347c05f1 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -290,13 +290,23 @@ void RE_engine_update_progress(RenderEngine *engine, float progress)
}
}
+void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float mem_peak)
+{
+ Render *re = engine->re;
+
+ if (re) {
+ re->i.mem_used = mem_used;
+ re->i.mem_peak = mem_peak;
+ }
+}
+
void RE_engine_report(RenderEngine *engine, int type, const char *msg)
{
Render *re = engine->re;
if (re)
BKE_report(engine->re->reports, type, msg);
- else if(engine->reports)
+ else if (engine->reports)
BKE_report(engine->reports, type, msg);
}
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 2b564a09024..b2cf8db7995 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -555,31 +555,17 @@ void initparts(Render *re, int do_crop)
xmaxb = re->disprect.xmax;
ymaxb = re->disprect.ymax;
- xparts = re->r.xparts;
- yparts = re->r.yparts;
-
- /* minimum part size */
- if (re->r.mode & R_PANORAMA) {
- if (ceil(re->rectx / (float)xparts) < 8)
- xparts = 1 + re->rectx / 8;
- }
- else {
- if (ceil(re->rectx / (float)xparts) < 64)
- xparts = 1 + re->rectx / 64;
- }
-
- if (ceil(re->recty / (float)yparts) < 64)
- yparts = 1 + re->recty / 64;
-
/* part size */
- partx = ceil(re->rectx / (float)xparts);
- party = ceil(re->recty / (float)yparts);
+ partx = min_ii(re->r.tilex, re->rectx);
+ party = min_ii(re->r.tiley, re->recty);
- re->xparts = xparts;
- re->yparts = yparts;
re->partx = partx;
re->party = party;
+ /* part count */
+ xparts = (re->rectx + partx - 1) / partx;
+ yparts = (re->recty + party - 1) / party;
+
/* calculate rotation factor of 1 pixel */
if (re->r.mode & R_PANORAMA)
re->panophi = panorama_pixel_rot(re);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 8f1037ec051..9dab18b3c2c 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -680,6 +680,7 @@ float panorama_pixel_rot(Render *re)
{
float psize, phi, xfac;
float borderfac = (float)BLI_rcti_size_x(&re->disprect) / (float)re->winx;
+ int xparts = (re->rectx + re->partx - 1) / re->partx;
/* size of 1 pixel mapped to viewplane coords */
psize = BLI_rctf_size_x(&re->viewplane) / (float)re->winx;
@@ -687,7 +688,7 @@ float panorama_pixel_rot(Render *re)
phi = atan(psize / re->clipsta);
/* correction factor for viewplane shifting, first calculate how much the viewplane angle is */
- xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)re->xparts;
+ xfac = borderfac * BLI_rctf_size_x(&re->viewplane) / (float)xparts;
xfac = atan(0.5f * xfac / re->clipsta);
/* and how much the same viewplane angle is wrapped */
psize = 0.5f * phi * ((float)re->partx);
@@ -2596,8 +2597,8 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
if (env->type == ENV_CUBE) {
for (i = 0; i < 12; i += 2) {
- maxX = MAX2(maxX, layout[i] + 1);
- maxY = MAX2(maxY, layout[i + 1] + 1);
+ maxX = max_ii(maxX, (int)layout[i] + 1);
+ maxY = max_ii(maxY, (int)layout[i + 1] + 1);
}
ibuf = IMB_allocImBuf(maxX * dx, maxY * dx, 24, IB_rectfloat);
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 886f266b22f..7a7602dcce2 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -1184,6 +1184,7 @@ static int panotestclip(Render *re, int do_pano, float *v)
/* to be used for halos en infos */
float abs4;
short c=0;
+ int xparts = (re->rectx + re->partx - 1) / re->partx;
if (do_pano == FALSE) {
return testclip(v);
@@ -1197,7 +1198,7 @@ static int panotestclip(Render *re, int do_pano, float *v)
if ( v[1]>abs4) c+=4;
else if ( v[1]< -abs4) c+=8;
- abs4*= re->xparts;
+ abs4*= xparts;
if ( v[0]>abs4) c+=2;
else if ( v[0]< -abs4) c+=1;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index c37f48bc329..a7f6b40981d 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -637,7 +637,7 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
maxtotvert= 0;
for (obr=re->objecttable.first; obr; obr=obr->next)
- maxtotvert= MAX2(obr->totvert, maxtotvert);
+ maxtotvert = max_ii(obr->totvert, maxtotvert);
clipflag= MEM_callocN(sizeof(char)*maxtotvert, "autoclipflag");
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b9a4e720230..c53c4dca74c 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -106,7 +106,7 @@ int WM_homefile_read_exec(struct bContext *C, struct wmOperator *op);
int WM_homefile_read(struct bContext *C, struct ReportList *reports, short from_memory);
int WM_homefile_write_exec(struct bContext *C, struct wmOperator *op);
void WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports);
-int WM_file_write(struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy);
+int WM_file_write(struct bContext *C, const char *target, int fileflags, struct ReportList *reports);
void WM_autosave_init(struct wmWindowManager *wm);
/* mouse cursors */
@@ -320,9 +320,9 @@ enum {
WM_JOB_SUSPEND = (1 << 3)
};
-/* identifying jobs by owner alone is unreliable, this isnt saved, order can change */
+/* identifying jobs by owner alone is unreliable, this isnt saved, order can change (keep 0 for 'any') */
enum {
- WM_JOB_TYPE_ANY = -1,
+ WM_JOB_TYPE_ANY = 0,
WM_JOB_TYPE_COMPOSITE,
WM_JOB_TYPE_RENDER,
WM_JOB_TYPE_RENDER_PREVIEW, /* UI preview */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 66bb321e832..d7285ec4380 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -84,7 +84,7 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
bScreen *screen = win->screen;
wmPaintCursor *pc;
- if (screen->subwinactive == ar->swinid) {
+ if (ar->swinid && screen->subwinactive == ar->swinid) {
for (pc = wm->paintcursors.first; pc; pc = pc->next) {
if (pc->poll == NULL || pc->poll(C)) {
ARegion *ar_other = CTX_wm_region(C);
@@ -631,7 +631,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
if (paintcursor && wm->paintcursors.first) {
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid == screen->subwinactive) {
+ if (ar->swinid && ar->swinid == screen->subwinactive) {
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index fee94b95a6a..7cfa3ce9396 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2731,47 +2731,45 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event = *evt;
switch (type) {
- /* mouse move */
+ /* mouse move, also to inactive window (X11 does this) */
case GHOST_kEventCursorMove:
{
- if (win->active) {
- GHOST_TEventCursorData *cd = customdata;
- wmEvent *lastevent = win->queue.last;
- int cx, cy;
-
- GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
- evt->x = cx;
- evt->y = (win->sizey - 1) - cy;
-
- event.x = evt->x;
- event.y = evt->y;
+ GHOST_TEventCursorData *cd = customdata;
+ wmEvent *lastevent = win->queue.last;
+ int cx, cy;
+
+ GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
+ evt->x = cx;
+ evt->y = (win->sizey - 1) - cy;
+
+ event.x = evt->x;
+ event.y = evt->y;
- event.type = MOUSEMOVE;
+ event.type = MOUSEMOVE;
- /* some painting operators want accurate mouse events, they can
- * handle in between mouse move moves, others can happily ignore
- * them for better performance */
- if (lastevent && lastevent->type == MOUSEMOVE)
- lastevent->type = INBETWEEN_MOUSEMOVE;
+ /* some painting operators want accurate mouse events, they can
+ * handle in between mouse move moves, others can happily ignore
+ * them for better performance */
+ if (lastevent && lastevent->type == MOUSEMOVE)
+ lastevent->type = INBETWEEN_MOUSEMOVE;
- update_tablet_data(win, &event);
- wm_event_add(win, &event);
+ update_tablet_data(win, &event);
+ wm_event_add(win, &event);
+
+ /* also add to other window if event is there, this makes overdraws disappear nicely */
+ /* it remaps mousecoord to other window in event */
+ owin = wm_event_cursor_other_windows(wm, win, &event);
+ if (owin) {
+ wmEvent oevent = *(owin->eventstate);
- /* also add to other window if event is there, this makes overdraws disappear nicely */
- /* it remaps mousecoord to other window in event */
- owin = wm_event_cursor_other_windows(wm, win, &event);
- if (owin) {
- wmEvent oevent = *(owin->eventstate);
-
- oevent.x = owin->eventstate->x = event.x;
- oevent.y = owin->eventstate->y = event.y;
- oevent.type = MOUSEMOVE;
-
- update_tablet_data(owin, &oevent);
- wm_event_add(owin, &oevent);
- }
+ oevent.x = owin->eventstate->x = event.x;
+ oevent.y = owin->eventstate->y = event.y;
+ oevent.type = MOUSEMOVE;
+ update_tablet_data(owin, &oevent);
+ wm_event_add(owin, &oevent);
}
+
break;
}
case GHOST_kEventTrackpad:
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 780117c73aa..1c168bc5ac5 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -765,7 +765,7 @@ int write_crash_blend(void)
}
}
-int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports, int copy)
+int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports)
{
Library *li;
int len;
@@ -821,7 +821,7 @@ int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *re
fileflags |= G_FILE_HISTORY; /* write file history */
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
- if (!copy) {
+ if (!(fileflags & G_FILE_SAVE_COPY)) {
G.relbase_valid = 1;
BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 42d721327b6..f5c83d48cb9 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -131,31 +131,34 @@ struct wmJob {
};
/* finds:
- * 1st priority: job with same owner and name
- * 2nd priority: job with same owner
+ * if type, compare for it, otherwise any matching job
*/
-static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
+static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
{
- wmJob *wm_job, *found = NULL;
+ wmJob *wm_job;
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
if (wm_job->owner == owner) {
- found = wm_job;
- if (name && strcmp(wm_job->name, name) == 0)
+
+ if (job_type) {
+ if ( wm_job->job_type == job_type)
+ return wm_job;
+ }
+ else
return wm_job;
}
- return found;
+ return NULL;
}
/* ******************* public API ***************** */
/* returns current or adds new job, but doesnt run it */
-/* every owner only gets a single job, adding a new one will stop running stop and
+/* every owner only gets a single job, adding a new one will stop running job and
* when stopped it starts the new one */
wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
{
- wmJob *wm_job = wm_job_find(wm, owner, name);
+ wmJob *wm_job = wm_job_find(wm, owner, job_type);
if (wm_job == NULL) {
wm_job = MEM_callocN(sizeof(wmJob), "new job");
@@ -167,7 +170,11 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
wm_job->job_type = job_type;
BLI_strncpy(wm_job->name, name, sizeof(wm_job->name));
}
+ /* else: a running job, be careful */
+ /* prevent creating a job with an invalid type */
+ BLI_assert(wm_job->job_type != WM_JOB_TYPE_ANY);
+
return wm_job;
}
@@ -192,7 +199,7 @@ int WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
float WM_jobs_progress(wmWindowManager *wm, void *owner)
{
- wmJob *wm_job = wm_job_find(wm, owner, NULL);
+ wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
return wm_job->progress;
@@ -202,7 +209,7 @@ float WM_jobs_progress(wmWindowManager *wm, void *owner)
char *WM_jobs_name(wmWindowManager *wm, void *owner)
{
- wmJob *wm_job = wm_job_find(wm, owner, NULL);
+ wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
if (wm_job)
return wm_job->name;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 2ef33aa5964..054e48f0bfb 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -72,6 +72,7 @@
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h" /* BKE_ST_MAXNAME */
+#include "BKE_utildefines.h"
#include "BKE_idcode.h"
@@ -903,6 +904,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
prop = RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), "Filter .blend files", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "filter_backup", (filter & BLENDERFILE_BACKUP), "Filter .blend files", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), "Filter image files", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), "Filter movie files", "");
@@ -1332,6 +1335,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
int i;
MenuType *mt = WM_menutype_find("USERPREF_MT_splash", TRUE);
char url[96];
+ char file [FILE_MAX];
#ifndef WITH_HEADLESS
extern char datatoc_splash_png[];
@@ -1419,7 +1423,11 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemL(col, IFACE_("Recent"), ICON_NONE);
for (recent = G.recent_files.first, i = 0; (i < 5) && (recent); recent = recent->next, i++) {
- uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ BLI_split_file_part(recent->filepath, file, sizeof(file));
+ if (BLO_has_bfile_extension(file))
+ uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ else
+ uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BACKUP, "WM_OT_open_mainfile", "filepath", recent->filepath);
}
uiItemS(col);
@@ -2070,7 +2078,6 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
{
char path[FILE_MAX];
int fileflags;
- int copy = 0;
save_set_compress(op);
@@ -2080,29 +2087,27 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
BLI_strncpy(path, G.main->name, FILE_MAX);
untitled(path);
}
-
- if (RNA_struct_property_is_set(op->ptr, "copy"))
- copy = RNA_boolean_get(op->ptr, "copy");
fileflags = G.fileflags;
/* set compression flag */
- if (RNA_boolean_get(op->ptr, "compress")) fileflags |= G_FILE_COMPRESS;
- else fileflags &= ~G_FILE_COMPRESS;
- if (RNA_boolean_get(op->ptr, "relative_remap")) fileflags |= G_FILE_RELATIVE_REMAP;
- else fileflags &= ~G_FILE_RELATIVE_REMAP;
+ BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "compress"),
+ G_FILE_COMPRESS);
+ BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "relative_remap"),
+ G_FILE_RELATIVE_REMAP);
+ BKE_BIT_TEST_SET(fileflags,
+ (RNA_struct_property_is_set(op->ptr, "copy") &&
+ RNA_boolean_get(op->ptr, "copy")),
+ G_FILE_SAVE_COPY);
+
#ifdef USE_BMESH_SAVE_AS_COMPAT
- /* property only exists for 'Save As' */
- if (RNA_struct_find_property(op->ptr, "use_mesh_compat")) {
- if (RNA_boolean_get(op->ptr, "use_mesh_compat")) fileflags |= G_FILE_MESH_COMPAT;
- else fileflags &= ~G_FILE_MESH_COMPAT;
- }
- else {
- fileflags &= ~G_FILE_MESH_COMPAT;
- }
+ BKE_BIT_TEST_SET(fileflags,
+ (RNA_struct_find_property(op->ptr, "use_mesh_compat") &&
+ RNA_boolean_get(op->ptr, "use_mesh_compat")),
+ G_FILE_MESH_COMPAT);
#endif
- if (WM_file_write(C, path, fileflags, op->reports, copy) != 0)
+ if (WM_file_write(C, path, fileflags, op->reports) != 0)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_WM | ND_FILESAVE, NULL);