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>2013-02-16 22:38:03 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-02-16 22:38:03 +0400
commit92436c94d3adbbfc285bd7b3041db36e66dae5d5 (patch)
tree2083c8ad4fa810a781e9631161aa88b12008453d /source/blender
parent90ed5ea4ea278b4aadf9187e4e2b92ef3221001b (diff)
parentfda8927d01ba719963154a56b45952ee541a869d (diff)
Merged changes in the trunk up to revision 54594.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenfont/BLF_translation.h11
-rw-r--r--source/blender/blenfont/intern/blf_translation.c6
-rw-r--r--source/blender/blenkernel/BKE_deform.h1
-rw-r--r--source/blender/blenkernel/BKE_object.h4
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h2
-rw-r--r--source/blender/blenkernel/BKE_text.h4
-rw-r--r--source/blender/blenkernel/intern/anim.c4
-rw-r--r--source/blender/blenkernel/intern/brush.c7
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c2
-rw-r--r--source/blender/blenkernel/intern/deform.c16
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c7
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c6
-rw-r--r--source/blender/blenkernel/intern/effect.c2
-rw-r--r--source/blender/blenkernel/intern/image.c8
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/mball.c61
-rw-r--r--source/blender/blenkernel/intern/mesh.c35
-rw-r--r--source/blender/blenkernel/intern/object.c38
-rw-r--r--source/blender/blenkernel/intern/particle_system.c2
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c7
-rw-r--r--source/blender/blenkernel/intern/scene.c39
-rw-r--r--source/blender/blenkernel/intern/sequencer.c32
-rw-r--r--source/blender/blenkernel/intern/smoke.c3
-rw-r--r--source/blender/blenkernel/intern/text.c14
-rw-r--r--source/blender/blenkernel/intern/unit.c8
-rw-r--r--source/blender/blenlib/BLI_math_geom.h1
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h2
-rw-r--r--source/blender/blenlib/BLI_string_cursor_utf8.h2
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c4
-rw-r--r--source/blender/blenlib/intern/fileops.c4
-rw-r--r--source/blender/blenlib/intern/math_geom.c69
-rw-r--r--source/blender/blenlib/intern/math_matrix.c16
-rw-r--r--source/blender/blenlib/intern/math_rotation.c2
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c4
-rw-r--r--source/blender/blenlib/intern/scanfill.c68
-rw-r--r--source/blender/blenlib/intern/string_cursor_utf8.c16
-rw-r--r--source/blender/blenlib/intern/string_utf8.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/bmesh/bmesh_class.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators_inline.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c2
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c2
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c50
-rw-r--r--source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c2
-rw-r--r--source/blender/collada/AnimationExporter.cpp41
-rw-r--r--source/blender/collada/ArmatureExporter.cpp2
-rw-r--r--source/blender/collada/ArmatureImporter.cpp22
-rw-r--r--source/blender/collada/ControllerExporter.cpp8
-rw-r--r--source/blender/collada/DocumentImporter.cpp91
-rw-r--r--source/blender/collada/DocumentImporter.h2
-rw-r--r--source/blender/collada/GeometryExporter.cpp10
-rw-r--r--source/blender/collada/MeshImporter.cpp11
-rw-r--r--source/blender/collada/MeshImporter.h6
-rw-r--r--source/blender/collada/SceneExporter.cpp6
-rw-r--r--source/blender/collada/TransformReader.cpp2
-rw-r--r--source/blender/collada/TransformWriter.cpp10
-rw-r--r--source/blender/collada/collada.cpp1
-rw-r--r--source/blender/collada/collada.h1
-rw-r--r--source/blender/collada/collada_internal.cpp24
-rw-r--r--source/blender/collada/collada_internal.h9
-rw-r--r--source/blender/collada/collada_utils.cpp79
-rw-r--r--source/blender/collada/collada_utils.h6
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_ViewerNode.cpp1
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.h5
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ViewerBaseOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cpp11
-rw-r--r--source/blender/editors/armature/editarmature.c4
-rw-r--r--source/blender/editors/armature/poselib.c2
-rw-r--r--source/blender/editors/include/ED_mball.h4
-rw-r--r--source/blender/editors/include/ED_object.h1
-rw-r--r--source/blender/editors/interface/interface.c26
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/interface/interface_panel.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c5
-rw-r--r--source/blender/editors/interface/interface_widgets.c10
-rw-r--r--source/blender/editors/interface/resources.c16
-rw-r--r--source/blender/editors/io/io_collada.c16
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c8
-rw-r--r--source/blender/editors/mesh/meshtools.c3
-rw-r--r--source/blender/editors/metaball/mball_edit.c24
-rw-r--r--source/blender/editors/metaball/mball_ops.c7
-rw-r--r--source/blender/editors/object/CMakeLists.txt5
-rw-r--r--source/blender/editors/object/SConscript5
-rw-r--r--source/blender/editors/object/object_constraint.c150
-rw-r--r--source/blender/editors/object/object_hook.c71
-rw-r--r--source/blender/editors/object/object_modifier.c5
-rw-r--r--source/blender/editors/object/object_relations.c24
-rw-r--r--source/blender/editors/object/object_transform.c11
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c9
-rw-r--r--source/blender/editors/physics/particle_edit.c2
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c2
-rw-r--r--source/blender/editors/physics/rigidbody_object.c19
-rw-r--r--source/blender/editors/physics/rigidbody_world.c3
-rw-r--r--source/blender/editors/render/render_preview.c11
-rw-r--r--source/blender/editors/render/render_view.c5
-rw-r--r--source/blender/editors/screen/screen_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c49
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c39
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h2
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c5
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c4
-rw-r--r--source/blender/editors/space_clip/space_clip.c9
-rw-r--r--source/blender/editors/space_console/console_draw.c6
-rw-r--r--source/blender/editors/space_console/console_ops.c42
-rw-r--r--source/blender/editors/space_file/file_draw.c39
-rw-r--r--source/blender/editors/space_file/filesel.c43
-rw-r--r--source/blender/editors/space_file/space_file.c1
-rw-r--r--source/blender/editors/space_image/image_buttons.c8
-rw-r--r--source/blender/editors/space_image/image_draw.c53
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/info_stats.c33
-rw-r--r--source/blender/editors/space_node/drawnode.c16
-rw-r--r--source/blender/editors/space_node/node_draw.c3
-rw-r--r--source/blender/editors/space_node/node_header.c2
-rw-r--r--source/blender/editors/space_node/space_node.c1
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c2
-rw-r--r--source/blender/editors/space_text/text_ops.c10
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c13
-rw-r--r--source/blender/editors/transform/transform.c93
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_input.c17
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c30
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c88
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl11
-rw-r--r--source/blender/imbuf/IMB_colormanagement.h2
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h3
-rw-r--r--source/blender/imbuf/intern/colormanagement.c27
-rw-r--r--source/blender/imbuf/intern/filter.c4
-rw-r--r--source/blender/imbuf/intern/rectop.c6
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h11
-rw-r--r--source/blender/makesdna/DNA_meta_types.h2
-rw-r--r--source/blender/makesdna/DNA_rigidbody_types.h4
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/makesrna/RNA_types.h1
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt1
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c4
-rw-r--r--source/blender/makesrna/intern/rna_define.c8
-rw-r--r--source/blender/makesrna/intern/rna_internal.h5
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c12
-rw-r--r--source/blender/makesrna/intern/rna_meta.c2
-rw-r--r--source/blender/makesrna/intern/rna_meta_api.c60
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c15
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h34
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c9
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c7
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c6
-rw-r--r--source/blender/makesrna/intern/rna_texture.c2
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c2
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c2
-rw-r--r--source/blender/nodes/shader/node_shader_util.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_brightness.c7
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_compose.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_decompose.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops_call.c5
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c54
-rw-r--r--source/blender/python/intern/bpy_app_translations.c107
-rw-r--r--source/blender/render/intern/source/imagetexture.c4
-rw-r--r--source/blender/render/intern/source/multires_bake.c9
-rw-r--r--source/blender/render/intern/source/pipeline.c1
-rw-r--r--source/blender/render/intern/source/render_result.c4
-rw-r--r--source/blender/render/intern/source/render_texture.c16
-rw-r--r--source/blender/render/intern/source/voxeldata.c2
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/WM_keymap.h3
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c23
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c12
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c33
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c20
-rw-r--r--source/blender/windowmanager/intern/wm_window.c3
186 files changed, 1798 insertions, 828 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index 5b2c4e87165..8a99f486783 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -112,9 +112,13 @@ const char *BLF_translate_do_tooltip(const char *msgctxt, const char *msgid);
/* Default, void context.
* WARNING! The "" context is not the same as no (NULL) context at mo/boost::locale level!
+ * NOTE: We translate BLF_I18NCONTEXT_DEFAULT as BLF_I18NCONTEXT_DEFAULT_BPY in Python, as we can’t use "natural"
+ * None value in rna string properties... :/
+ * For perf reason, we only use the first char to detect this context, so other contexts should never start
+ * with the same char!
*/
-#define BLF_I18NCONTEXT_DEFAULT NULL /* Translated as None in Python. */
-#define BLF_I18NCONTEXT_DEFAULT_BPY_INTERN "" /* Only used in code, never exposed to user! */
+#define BLF_I18NCONTEXT_DEFAULT NULL
+#define BLF_I18NCONTEXT_DEFAULT_BPY "*"
/* Default context for operator names/labels. */
#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
@@ -168,7 +172,8 @@ typedef struct
#define BLF_I18NCONTEXTS_ITEM(ctxt_id, py_id) {#ctxt_id, py_id, ctxt_id}
#define BLF_I18NCONTEXTS_DESC { \
- BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default"), \
+ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT, "default_real"), \
+ BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_DEFAULT_BPY, "default"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "operator_default"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ACTION, "id_action"), \
BLF_I18NCONTEXTS_ITEM(BLF_I18NCONTEXT_ID_ARMATURE, "id_armature"), \
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index a77b464822b..b5b72b68677 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -94,9 +94,9 @@ const char *BLF_pgettext(const char *msgctxt, const char *msgid)
const char *ret;
/*if (msgctxt && !strcmp(msgctxt, BLF_I18NCONTEXT_DEFAULT_BPY_INTERN)) { */
- if (msgctxt && !msgctxt[0]) {
- /* BLF_I18NCONTEXT_DEFAULT_BPY_INTERN context is reserved and considered the same as default NULL one. */
- msgctxt = NULL;
+ if (msgctxt && msgctxt[0] == BLF_I18NCONTEXT_DEFAULT_BPY[0]) {
+ /* BLF_I18NCONTEXT_DEFAULT_BPY context is reserved and considered the same as default NULL one. */
+ msgctxt = BLF_I18NCONTEXT_DEFAULT;
}
ret = bl_locale_pgettext(msgctxt, msgid);
/* We assume if the returned string is the same (memory level) as the msgid, no translation was found,
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index ab27421b383..0fa7356b64e 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -56,6 +56,7 @@ void defvert_remove_group(struct MDeformVert *dvert, struct
void defvert_clear(struct MDeformVert *dvert);
int defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
+void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert);
void BKE_defvert_array_copy(struct MDeformVert *dst, const struct MDeformVert *src, int totvert);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 54189e26c92..19c04676548 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -50,6 +50,7 @@ struct RenderData;
struct rctf;
struct MovieClip;
struct Main;
+struct RigidBodyWorld;
void BKE_object_workob_clear(struct Object *workob);
void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
@@ -100,7 +101,9 @@ int BKE_object_pose_context_check(struct Object *ob);
struct Object *BKE_object_pose_armature_get(struct Object *ob);
void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob);
+void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime);
+void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float ctime);
void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob);
void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]);
@@ -146,6 +149,7 @@ void BKE_object_tfm_protected_restore(struct Object *ob,
const short protectflag);
void BKE_object_handle_update(struct Scene *scene, struct Object *ob);
+void BKE_object_handle_update_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob);
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index 2b19f60b5e4..12779a697b6 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -89,7 +89,7 @@ void BKE_rigidbody_remove_constraint(struct Scene *scene, struct Object *ob);
/* Simulation */
void BKE_rigidbody_aftertrans_update(struct Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle);
-void BKE_rigidbody_sync_transforms(struct Scene *scene, struct Object *ob, float ctime);
+void BKE_rigidbody_sync_transforms(struct RigidBodyWorld *rbw, struct Object *ob, float ctime);
void BKE_rigidbody_cache_reset(struct RigidBodyWorld *rbw);
void BKE_rigidbody_do_simulation(struct Scene *scene, float ctime);
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index dc84bc67647..3e882a048eb 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -66,8 +66,8 @@ void txt_move_up (struct Text *text, short sel);
void txt_move_down (struct Text *text, short sel);
void txt_move_left (struct Text *text, short sel);
void txt_move_right (struct Text *text, short sel);
-void txt_jump_left (struct Text *text, short sel);
-void txt_jump_right (struct Text *text, short sel);
+void txt_jump_left (struct Text *text, bool sel, bool use_init_step);
+void txt_jump_right (struct Text *text, bool sel, bool use_init_step);
void txt_move_bof (struct Text *text, short sel);
void txt_move_eof (struct Text *text, short sel);
void txt_move_bol (struct Text *text, short sel);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index bc9c8a7ad50..a6b3008e00a 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -967,7 +967,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
}
else
- dm = mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_final(scene, par, CD_MASK_BAREMESH);
if (flag & DUPLILIST_FOR_RENDER) {
vdd.orco = (float(*)[3])BKE_mesh_orco_verts_get(par);
@@ -1094,7 +1094,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
dm = editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
}
else {
- dm = mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
+ dm = mesh_get_derived_final(scene, par, CD_MASK_BAREMESH);
}
totface = dm->getNumPolys(dm);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 2ce5053bdcc..ba69fa4336e 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -588,11 +588,16 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf
else if (texfall == 1) {
BKE_brush_sample_tex_2D(scene, brush, xy, dstf, 0);
}
- else {
+ else if (texfall == 2) {
BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
mul_v3_v3v3(dstf, rgba, brush_rgb);
dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
}
+ else {
+ BKE_brush_sample_tex_2D(scene, brush, xy, rgba, 0);
+ copy_v3_v3(dstf, brush_rgb);
+ dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
+ }
}
}
}
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 66b457ec502..7f2d9437c3d 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1431,7 +1431,7 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
*/
if (cddm->pbvh && cddm->pbvh_draw && BKE_pbvh_type(cddm->pbvh) == PBVH_BMESH) {
if (dm->numTessFaceData) {
- setMaterial(userData, 1, NULL);
+ setMaterial(userData, 1, &gattribs);
BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, FALSE);
}
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index cea92d53916..de15100de0b 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -809,7 +809,7 @@ void BKE_defvert_array_copy(MDeformVert *dst, const MDeformVert *src, int copyco
}
-void BKE_defvert_array_free(MDeformVert *dvert, int totvert)
+void BKE_defvert_array_free_elems(MDeformVert *dvert, int totvert)
{
/* Instead of freeing the verts directly,
* call this function to delete any special
@@ -823,6 +823,18 @@ void BKE_defvert_array_free(MDeformVert *dvert, int totvert)
for (i = 0; i < totvert; i++) {
if (dvert[i].dw) MEM_freeN(dvert[i].dw);
}
- MEM_freeN(dvert);
}
+void BKE_defvert_array_free(MDeformVert *dvert, int totvert)
+{
+ /* Instead of freeing the verts directly,
+ * call this function to delete any special
+ * vert data */
+ if (!dvert)
+ return;
+
+ /* Free any special data from the verts */
+ BKE_defvert_array_free_elems(dvert, totvert);
+
+ MEM_freeN(dvert);
+}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index dab4235559a..99d0c5ed964 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2353,6 +2353,7 @@ static void dag_object_time_update_flags(Scene *scene, Object *ob)
if (object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
if ((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
+ // XXX: scene here may not be the scene that contains the rigidbody world affecting this!
if (ob->rigidbody_object && BKE_scene_check_rigidbody_active(scene))
ob->recalc |= OB_RECALC_OB;
@@ -2440,7 +2441,11 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s
if (do_time) {
/* now if DagNode were part of base, the node->lay could be checked... */
/* we do all now, since the scene_flush checks layers and clears recalc flags even */
- dag_object_time_update_flags(scene, ob);
+
+ /* NOTE: "sce_iter" not "scene" so that rigidbodies in background scenes work
+ * (i.e. muting + rbw availability can be checked and tagged properly) [#33970]
+ */
+ dag_object_time_update_flags(sce_iter, ob);
}
/* handled in next loop */
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index c92c52a7651..685d66195c7 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2379,7 +2379,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
dot11 = d2[0] * d2[0] + d2[1] * d2[1];
dot12 = d2[0] * d3[0] + d2[1] * d3[1];
- invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
+ invDenom = (dot00 * dot11 - dot01 * dot01);
+ invDenom = invDenom ? 1.0f / invDenom : 1.0f;
u = (dot11 * dot02 - dot01 * dot12) * invDenom;
v = (dot00 * dot12 - dot01 * dot02) * invDenom;
@@ -2399,7 +2400,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
dot11 = d2[0] * d2[0] + d2[1] * d2[1];
dot12 = d2[0] * d3[0] + d2[1] * d3[1];
- invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
+ invDenom = (dot00 * dot11 - dot01 * dot01);
+ invDenom = invDenom ? 1.0f / invDenom : 1.0f;
u = (dot11 * dot02 - dot01 * dot12) * invDenom;
v = (dot00 * dot12 - dot01 * dot02) * invDenom;
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 1880cb42f4d..9e8693e957e 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -562,7 +562,7 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa
if (mface->v4)
add_v3_v3(surface_vel, surmd->v[mface->v4].co);
- mul_v3_fl(surface_vel, mface->v4 ? 0.25f : 0.333f);
+ mul_v3_fl(surface_vel, mface->v4 ? 0.25f : (1.0f / 3.0f));
}
return 1;
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 018cd25187a..de85cb54cfd 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2737,6 +2737,14 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
if (rres.have_combined && layer == 0) {
/* pass */
}
+ else if (rect && layer == 0) {
+ /* rect32 is set when there's a Sequence pass, this pass seems
+ * to have layer=0 (this is from image_buttons.c)
+ * in this case we ignore float buffer, because it could have
+ * hung from previous pass which was float
+ */
+ rectf = NULL;
+ }
else if (rres.layers.first) {
RenderLayer *rl = BLI_findlink(&rres.layers, layer - (rres.have_combined ? 1 : 0));
if (rl) {
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index fd57a88e279..c3e7a963c04 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -912,7 +912,7 @@ void outside_lattice(Lattice *lt)
bp->vec[1] += (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1];
bp->vec[2] += (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2];
- mul_v3_fl(bp->vec, 0.3333333f);
+ mul_v3_fl(bp->vec, 1.0f / 3.0f);
}
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index d939b9cc3c0..5cc3145213c 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1654,6 +1654,14 @@ static void polygonize(PROCESS *mbproc, MetaBall *mb)
}
}
+/* could move to math api */
+BLI_INLINE void copy_v3_fl3(float v[3], float x, float y, float z)
+{
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+}
+
static float init_meta(Scene *scene, Object *ob) /* return totsize */
{
Scene *sce_iter = scene;
@@ -1730,6 +1738,7 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
float temp1[4][4], temp2[4][4], temp3[4][4];
float (*mat)[4] = NULL, (*imat)[4] = NULL;
float max_x, max_y, max_z, min_x, min_y, min_z;
+ float expx, expy, expz;
max_x = max_y = max_z = -3.4e38;
min_x = min_y = min_z = 3.4e38;
@@ -1770,39 +1779,27 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */
G_mb.mainb[a]->mat = (float *) mat;
G_mb.mainb[a]->imat = (float *) imat;
+ if (!MB_TYPE_SIZE_SQUARED(ml->type)) {
+ expx = ml->expx;
+ expy = ml->expy;
+ expz = ml->expz;
+ }
+ else {
+ expx = ml->expx * ml->expx;
+ expy = ml->expy * ml->expy;
+ expz = ml->expz * ml->expz;
+ }
+
/* untransformed Bounding Box of MetaElem */
- /* 0 */
- G_mb.mainb[a]->bb->vec[0][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[0][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[0][2] = -ml->expz;
- /* 1 */
- G_mb.mainb[a]->bb->vec[1][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[1][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[1][2] = -ml->expz;
- /* 2 */
- G_mb.mainb[a]->bb->vec[2][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[2][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[2][2] = -ml->expz;
- /* 3 */
- G_mb.mainb[a]->bb->vec[3][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[3][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[3][2] = -ml->expz;
- /* 4 */
- G_mb.mainb[a]->bb->vec[4][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[4][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[4][2] = ml->expz;
- /* 5 */
- G_mb.mainb[a]->bb->vec[5][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[5][1] = -ml->expy;
- G_mb.mainb[a]->bb->vec[5][2] = ml->expz;
- /* 6 */
- G_mb.mainb[a]->bb->vec[6][0] = ml->expx;
- G_mb.mainb[a]->bb->vec[6][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[6][2] = ml->expz;
- /* 7 */
- G_mb.mainb[a]->bb->vec[7][0] = -ml->expx;
- G_mb.mainb[a]->bb->vec[7][1] = ml->expy;
- G_mb.mainb[a]->bb->vec[7][2] = ml->expz;
+ /* TODO, its possible the elem type has been changed and the exp* values can use a fallback */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[0], -expx, -expy, -expz); /* 0 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[1], +expx, -expy, -expz); /* 1 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[2], +expx, +expy, -expz); /* 2 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[3], -expx, +expy, -expz); /* 3 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[4], -expx, -expy, +expz); /* 4 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[5], +expx, -expy, +expz); /* 5 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[6], +expx, +expy, +expz); /* 6 */
+ copy_v3_fl3(G_mb.mainb[a]->bb->vec[7], -expx, +expy, +expz); /* 7 */
/* transformation of Metalem bb */
for (i = 0; i < 8; i++)
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 21641e77b0b..c9c86e6739f 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -2999,6 +2999,36 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart,
}
}
+/* note, results won't be correct if polygon is non-planar */
+static float mesh_calc_poly_planar_area_centroid(MPoly *mpoly, MLoop *loopstart, MVert *mvarray, float cent[3])
+{
+ int i;
+ float tri_area;
+ float total_area = 0.0f;
+ float v1[3], v2[3], v3[3], normal[3], tri_cent[3];
+
+ BKE_mesh_calc_poly_normal(mpoly, loopstart, mvarray, normal);
+ copy_v3_v3(v1, mvarray[loopstart[0].v].co);
+ copy_v3_v3(v2, mvarray[loopstart[1].v].co);
+ zero_v3(cent);
+
+ for (i = 2; i < mpoly->totloop; i++) {
+ copy_v3_v3(v3, mvarray[loopstart[i].v].co);
+
+ tri_area = area_tri_signed_v3(v1, v2, v3, normal);
+ total_area += tri_area;
+
+ cent_tri_v3(tri_cent, v1, v2, v3);
+ madd_v3_v3fl(cent, tri_cent, tri_area);
+
+ copy_v3_v3(v2, v3);
+ }
+
+ mul_v3_fl(cent, 1.0f / total_area);
+
+ return total_area;
+}
+
/**
* This function takes the difference between 2 vertex-coord-arrays
* (\a vert_cos_src, \a vert_cos_dst),
@@ -3292,9 +3322,8 @@ int BKE_mesh_center_centroid(Mesh *me, float cent[3])
/* calculate a weighted average of polygon centroids */
for (mpoly = me->mpoly; i--; mpoly++) {
- BKE_mesh_calc_poly_center(mpoly, me->mloop + mpoly->loopstart, me->mvert, poly_cent);
- poly_area = BKE_mesh_calc_poly_area(mpoly, me->mloop + mpoly->loopstart, me->mvert, NULL);
-
+ poly_area = mesh_calc_poly_planar_area_centroid(mpoly, me->mloop + mpoly->loopstart, me->mvert, poly_cent);
+
madd_v3_v3fl(cent, poly_cent, poly_area);
total_area += poly_area;
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 498b3b226f6..119dc8c7d11 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -58,6 +58,7 @@
#include "DNA_world_types.h"
#include "DNA_object_types.h"
#include "DNA_property_types.h"
+#include "DNA_rigidbody_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
@@ -2027,7 +2028,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4])
else {
add_v3_v3v3(mat[3], v1, v2);
add_v3_v3(mat[3], v3);
- mul_v3_fl(mat[3], 0.3333333f);
+ mul_v3_fl(mat[3], 1.0f / 3.0f);
}
}
}
@@ -2130,7 +2131,8 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
return 1;
}
-void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
+/* note, scene is the active scene while actual_scene is the scene the object resides in */
+void BKE_object_where_is_calc_time_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float ctime)
{
if (ob == NULL) return;
@@ -2155,8 +2157,9 @@ void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
else {
BKE_object_to_mat4(ob, ob->obmat);
}
-
- BKE_rigidbody_sync_transforms(scene, ob, ctime);
+
+ /* read values pushed into RBO from sim/cache... */
+ BKE_rigidbody_sync_transforms(rbw, ob, ctime);
/* solve constraints */
if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
@@ -2172,6 +2175,11 @@ void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
else ob->transflag &= ~OB_NEG_SCALE;
}
+void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
+{
+ BKE_object_where_is_calc_time_ex(scene, NULL, ob, ctime);
+}
+
/* get object transformation matrix without recalculating dependencies and
* constraints -- assume dependencies are already solved by depsgraph.
* no changes to object and it's parent would be done.
@@ -2193,9 +2201,13 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
}
}
-void BKE_object_where_is_calc(struct Scene *scene, Object *ob)
+void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
{
- BKE_object_where_is_calc_time(scene, ob, BKE_scene_frame_get(scene));
+ BKE_object_where_is_calc_time_ex(scene, rbw, ob, BKE_scene_frame_get(scene));
+}
+void BKE_object_where_is_calc(Scene *scene, Object *ob)
+{
+ BKE_object_where_is_calc_time_ex(scene, NULL, ob, BKE_scene_frame_get(scene));
}
void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
@@ -2631,7 +2643,8 @@ int BKE_object_parent_loop_check(const Object *par, const Object *ob)
/* the main object update call, for object matrix, constraints, keys and displist (modifiers) */
/* requires flags to be set! */
-void BKE_object_handle_update(Scene *scene, Object *ob)
+/* Ideally we shouldn't have to pass the rigid body world, but need bigger restructuring to avoid id */
+void BKE_object_handle_update_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob)
{
if (ob->recalc & OB_RECALC_ALL) {
/* speed optimization for animation lookups */
@@ -2672,7 +2685,7 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
copy_m4_m4(ob->obmat, ob->proxy_from->obmat);
}
else
- BKE_object_where_is_calc(scene, ob);
+ BKE_object_where_is_calc_ex(scene, rbw, ob);
}
if (ob->recalc & OB_RECALC_DATA) {
@@ -2826,6 +2839,15 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
}
}
+/* WARNING: "scene" here may not be the scene object actually resides in.
+ * When dealing with background-sets, "scene" is actually the active scene.
+ * e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n
+ * rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world
+ */
+void BKE_object_handle_update(Scene *scene, Object *ob)
+{
+ BKE_object_handle_update_ex(scene, NULL, ob);
+}
void BKE_object_sculpt_modifiers_changed(Object *ob)
{
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index fda5f6f2ecb..6e4937d11ec 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -802,7 +802,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
if (mface->v4)
psys_uv_to_w(0.5f, 0.5f, mface->v4, pa->fuv);
else
- psys_uv_to_w(0.33333f, 0.33333f, mface->v4, pa->fuv);
+ psys_uv_to_w(1.0f / 3.0f, 1.0f / 3.0f, mface->v4, pa->fuv);
}
else {
ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel);
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 24355149926..26f0c25617f 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1130,11 +1130,9 @@ static void rigidbody_update_simulation_post_step(RigidBodyWorld *rbw)
}
}
}
-
/* Sync rigid body and object transformations */
-void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime)
+void BKE_rigidbody_sync_transforms(RigidBodyWorld *rbw, Object *ob, float ctime)
{
- RigidBodyWorld *rbw = scene->rigidbody_world;
RigidBodyOb *rbo = ob->rigidbody_object;
/* keep original transform for kinematic and passive objects */
@@ -1165,6 +1163,7 @@ void BKE_rigidbody_sync_transforms(Scene *scene, Object *ob, float ctime)
}
}
+/* Used when cancelling transforms - return rigidbody and object to initial states */
void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], float quat[4], float rotAxis[3], float rotAngle)
{
RigidBodyOb *rbo = ob->rigidbody_object;
@@ -1216,6 +1215,8 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
cache = rbw->pointcache;
+ rbw->flag &= ~RBW_FLAG_FRAME_UPDATE;
+
/* flag cache as outdated if we don't have a world or number of objects in the simulation has changed */
if (rbw->physics_world == NULL || rbw->numbodies != BLI_countlist(&rbw->group->gobject)) {
cache->flag |= PTCACHE_OUTDATED;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 81084661368..9934d9b6e9a 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1115,11 +1115,19 @@ static void scene_depsgraph_hack(Scene *scene, Scene *scene_parent)
}
+static void scene_flag_rbw_recursive(Scene *scene)
+{
+ if (scene->set)
+ scene_flag_rbw_recursive(scene->set);
+
+ if (BKE_scene_check_rigidbody_active(scene))
+ scene->rigidbody_world->flag |= RBW_FLAG_FRAME_UPDATE;
+}
+
static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent)
{
Base *base;
-
scene->customdata_mask = scene_parent->customdata_mask;
/* sets first, we allow per definition current scene to have
@@ -1127,11 +1135,27 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
if (scene->set)
scene_update_tagged_recursive(bmain, scene->set, scene_parent);
+ /* run rigidbody sim
+ * - calculate/read values from cache into RBO's, to get flushed
+ * later when objects are evaluated (if they're tagged for eval)
+ */
+ // XXX: this position may still change, objects not being updated correctly before simulation is run
+ // NOTE: current position is so that rigidbody sim affects other objects
+ if (BKE_scene_check_rigidbody_active(scene) && scene->rigidbody_world->flag & RBW_FLAG_FRAME_UPDATE) {
+ /* we use frame time of parent (this is "scene" itself for top-level of sets recursion),
+ * as that is the active scene controlling all timing in file at the moment
+ */
+ float ctime = BKE_scene_frame_get(scene_parent);
+
+ /* however, "scene" contains the rigidbody world needed for eval... */
+ BKE_rigidbody_do_simulation(scene, ctime);
+ }
+
/* scene objects */
for (base = scene->base.first; base; base = base->next) {
Object *ob = base->object;
- BKE_object_handle_update(scene_parent, ob);
+ BKE_object_handle_update_ex(scene_parent, scene->rigidbody_world, ob);
if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
@@ -1232,13 +1256,7 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
* such as Scene->World->MTex/Texture) can still get correctly overridden.
*/
BKE_animsys_evaluate_all_animation(bmain, sce, ctime);
- /*...done with recusrive funcs */
-
- /* run rigidbody sim */
- // XXX: this position may still change, objects not being updated correctly before simulation is run
- // NOTE: current position is so that rigidbody sim affects other objects
- if (BKE_scene_check_rigidbody_active(sce))
- BKE_rigidbody_do_simulation(sce, ctime);
+ /*...done with recursive funcs */
/* clear "LIB_DOIT" flag from all materials, to prevent infinite recursion problems later
* when trying to find materials with drivers that need evaluating [#32017]
@@ -1246,6 +1264,9 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
tag_main_idcode(bmain, ID_MA, FALSE);
tag_main_idcode(bmain, ID_LA, FALSE);
+ /* flag rigid body worlds for update */
+ scene_flag_rbw_recursive(sce);
+
/* BKE_object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(bmain, sce, sce);
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index f1724bdfc6b..45393726add 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1820,8 +1820,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
StripCrop c = {0};
StripTransform t = {0};
int sx, sy, dx, dy;
- double xscale = 1.0;
- double yscale = 1.0;
if (is_proxy_image) {
double f = seq_rendersize_to_scale_factor(context.preview_render_size);
@@ -1838,21 +1836,23 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
t = *seq->strip->transform;
}
- xscale = context.scene->r.xsch ? ((double)context.rectx / (double)context.scene->r.xsch) : 1.0;
- yscale = context.scene->r.ysch ? ((double)context.recty / (double)context.scene->r.ysch) : 1.0;
-
- xscale /= (double)context.rectx / (double)ibuf->x;
- yscale /= (double)context.recty / (double)ibuf->y;
-
- c.left *= xscale; c.right *= xscale;
- c.top *= yscale; c.bottom *= yscale;
-
- t.xofs *= xscale; t.yofs *= yscale;
+ if (is_preprocessed) {
+ double xscale = context.scene->r.xsch ? ((double)context.rectx / (double)context.scene->r.xsch) : 1.0;
+ double yscale = context.scene->r.ysch ? ((double)context.recty / (double)context.scene->r.ysch) : 1.0;
+ if (seq->flag & SEQ_USE_TRANSFORM) {
+ t.xofs *= xscale;
+ t.yofs *= yscale;
+ }
+ if (seq->flag & SEQ_USE_CROP) {
+ c.left *= xscale;
+ c.right *= xscale;
+ c.top *= yscale;
+ c.bottom *= yscale;
+ }
+ }
sx = ibuf->x - c.left - c.right;
sy = ibuf->y - c.top - c.bottom;
- dx = sx;
- dy = sy;
if (seq->flag & SEQ_USE_TRANSFORM) {
if (is_preprocessed) {
@@ -1864,6 +1864,10 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
dy = context.scene->r.ysch;
}
}
+ else {
+ dx = sx;
+ dy = sy;
+ }
if (c.top + c.bottom >= ibuf->y ||
c.left + c.right >= ibuf->x ||
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index f56d03bfb57..248cd689258 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1583,7 +1583,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value
}
/* set fire reaction coordinate */
- if (fuel && fuel[index]) {
+ if (fuel && fuel[index] > FLT_EPSILON) {
/* instead of using 1.0 for all new fuel add slight falloff
* to reduce flow blockiness */
float value = 1.0f - powf(1.0f - emission_value, 2.0f);
@@ -1591,6 +1591,7 @@ BLI_INLINE void apply_inflow_fields(SmokeFlowSettings *sfs, float emission_value
if (value > react[index]) {
float f = fuel_flow / fuel[index];
react[index] = value * f + (1.0f - f) * react[index];
+ CLAMP(react[index], 0.0f, value);
}
}
}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 3be9097ce82..86e7a152a4a 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -38,12 +38,12 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_string_utf8.h"
#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
#include "BLI_fileops.h"
#include "DNA_constraint_types.h"
@@ -936,7 +936,7 @@ void txt_move_right(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_jump_left(Text *text, short sel)
+void txt_jump_left(Text *text, bool sel, bool use_init_step)
{
TextLine **linep;
int *charp;
@@ -948,12 +948,12 @@ void txt_jump_left(Text *text, short sel)
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_PREV,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, use_init_step);
if (!sel) txt_pop_sel(text);
}
-void txt_jump_right(Text *text, short sel)
+void txt_jump_right(Text *text, bool sel, bool use_init_step)
{
TextLine **linep;
int *charp;
@@ -965,7 +965,7 @@ void txt_jump_right(Text *text, short sel)
BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
charp, STRCUR_DIR_NEXT,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, use_init_step);
if (!sel) txt_pop_sel(text);
}
@@ -2402,7 +2402,7 @@ void txt_delete_char(Text *text)
void txt_delete_word(Text *text)
{
- txt_jump_right(text, 1);
+ txt_jump_right(text, true, true);
txt_delete_sel(text);
}
@@ -2451,7 +2451,7 @@ void txt_backspace_char(Text *text)
void txt_backspace_word(Text *text)
{
- txt_jump_left(text, 1);
+ txt_jump_left(text, true, true);
txt_delete_sel(text);
}
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 84e1f29f6c0..dd6ed42bd92 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -142,7 +142,7 @@ static struct bUnitCollection buImperialLenCollecton = {buImperialLenDef, 4, 0,
/* Areas */
static struct bUnitDef buMetricAreaDef[] = {
{"square kilometer", "square kilometers", "km²", "km2", "Square Kilometers", UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
- {"square hectometer", "square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE}, /* hectare */
+ {"square hectometer", "square hectometers", "hm²", "hm2", "Square Hectometers", UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS}, /* hectare */
{"square dekameter", "square dekameters", "dam²", "dam2", "Square Dekameters", UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, /* are */
{"square meter", "square meters", "m²", "m2", "Square Meters", UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"square decimeter", "square decimetees", "dm²", "dm2", "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
@@ -168,7 +168,7 @@ static struct bUnitCollection buImperialAreaCollecton = {buImperialAreaDef, 4, 0
/* Volumes */
static struct bUnitDef buMetricVolDef[] = {
{"cubic kilometer", "cubic kilometers", "km³", "km3", "Cubic Kilometers", UN_SC_KM * UN_SC_KM * UN_SC_KM, 0.0, B_UNIT_DEF_NONE},
- {"cubic hectometer", "cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_NONE},
+ {"cubic hectometer", "cubic hectometers", "hm³", "hm3", "Cubic Hectometers", UN_SC_HM * UN_SC_HM * UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS},
{"cubic dekameter", "cubic dekameters", "dam³", "dam3", "Cubic Dekameters", UN_SC_DAM * UN_SC_DAM * UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS},
{"cubic meter", "cubic meters", "m³", "m3", "Cubic Meters", UN_SC_M * UN_SC_M * UN_SC_M, 0.0, B_UNIT_DEF_NONE}, /* base unit */
{"cubic decimeter", "cubic decimeters", "dm³", "dm3", "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
@@ -194,9 +194,9 @@ static struct bUnitCollection buImperialVolCollecton = {buImperialVolDef, 4, 0,
/* Mass */
static struct bUnitDef buMetricMassDef[] = {
{"ton", "tonnes", "ton", "t", "1000 Kilograms", UN_SC_MTON, 0.0, B_UNIT_DEF_NONE},
- {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_NONE},
+ {"quintal", "quintals", "ql", "q", "100 Kilograms", UN_SC_QL, 0.0, B_UNIT_DEF_SUPPRESS},
{"kilogram", "kilograms", "kg", NULL, "Kilograms", UN_SC_KG, 0.0, B_UNIT_DEF_NONE}, /* base unit */
- {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_NONE},
+ {"hectogram", "hectograms", "hg", NULL, "Hectograms", UN_SC_HG, 0.0, B_UNIT_DEF_SUPPRESS},
{"dekagram", "dekagrams", "dag", NULL, "10 Grams", UN_SC_DAG, 0.0, B_UNIT_DEF_SUPPRESS},
{"gram", "grams", "g", NULL, "Grams", UN_SC_G, 0.0, B_UNIT_DEF_NONE},
{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index a822bdb9414..c4e17b1ed48 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -51,6 +51,7 @@ float normal_quad_v3(float r[3], const float a[3], const float b[3], const float
float area_tri_v2(const float a[2], const float b[2], const float c[2]);
float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2]);
float area_tri_v3(const float a[3], const float b[3], const float c[3]);
+float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float normal[3]);
float area_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]);
float area_poly_v3(int nr, float verts[][3], const float normal[3]);
float area_poly_v2(int nr, float verts[][2]);
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index a5ab2373b89..97cd6a60862 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -88,6 +88,7 @@ void mul_serie_m4(float R[4][4],
void mul_m4_v3(float M[4][4], float r[3]);
void mul_v3_m4v3(float r[3], float M[4][4], const float v[3]);
+void mul_v2_m2v2(float r[2], float M[2][2], const float v[2]);
void mul_mat3_m4_v3(float M[4][4], float r[3]);
void mul_m4_v4(float M[4][4], float r[4]);
void mul_v4_m4v4(float r[4], float M[4][4], const float v[4]);
@@ -170,6 +171,7 @@ void mat4_to_size(float r[3], float M[4][4]);
void translate_m4(float mat[4][4], float tx, float ty, float tz);
void rotate_m4(float mat[4][4], const char axis, const float angle);
+void rotate_m2(float mat[2][2], const float angle);
void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3]);
diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h
index 3c38c0380e0..04d9df2abda 100644
--- a/source/blender/blenlib/BLI_string_cursor_utf8.h
+++ b/source/blender/blenlib/BLI_string_cursor_utf8.h
@@ -46,6 +46,6 @@ int BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos);
void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
int *pos, strCursorJumpDirection direction,
- strCursorJumpType jump);
+ strCursorJumpType jump, bool use_init_step);
#endif /* __BLI_STRING_CURSOR_UTF8_H__ */
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index bf228f7456a..7670b057a7f 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -245,6 +245,10 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
BLI_freenode *newhead = addr;
if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
+#ifndef NDEBUG
+ /* this will detect double free's */
+ BLI_assert(newhead->freeword != FREEWORD);
+#endif
newhead->freeword = FREEWORD;
}
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 0f42fca9f12..24b3c36a329 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -111,7 +111,7 @@ int BLI_file_gzip(const char *from, const char *to)
return rval;
}
-/* gzip the file in from_file and write it to memery to_mem, at most size bytes.
+/* gzip the file in from_file and write it to memory to_mem, at most size bytes.
* return the unziped size
*/
char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r)
@@ -283,7 +283,7 @@ int BLI_move(const char *file, const char *to)
{
int err;
- /* windows doesn't support moveing to a directory
+ /* windows doesn't support moving to a directory
* it has to be 'mv filename filename' and not
* 'mv filename destdir' */
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index ac9534dac25..810c15437dc 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -39,9 +39,9 @@
void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
{
- cent[0] = 0.33333f * (v1[0] + v2[0] + v3[0]);
- cent[1] = 0.33333f * (v1[1] + v2[1] + v3[1]);
- cent[2] = 0.33333f * (v1[2] + v2[2] + v3[2]);
+ cent[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
+ cent[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
+ cent[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
}
void cent_quad_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
@@ -129,6 +129,22 @@ float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
return (len / 2.0f);
}
+float area_tri_signed_v3(const float v1[3], const float v2[3], const float v3[3], const float normal[3])
+{
+ float area, vec1[3], vec2[3], n[3];
+
+ sub_v3_v3v3(vec1, v3, v2);
+ sub_v3_v3v3(vec2, v1, v2);
+ cross_v3_v3v3(n, vec1, vec2);
+ area = len_v3(n) / 2.0f;
+
+ /* negate area for flipped triangles */
+ if (dot_v3v3(n, normal) < 0.0f)
+ area = -area;
+
+ return area;
+}
+
float area_poly_v3(int nr, float verts[][3], const float normal[3])
{
int a, px, py;
@@ -3578,25 +3594,42 @@ float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], fl
/* evaluate if entire quad is a proper convex quad */
int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
{
- float nor[3], nor1[3], nor2[3], vec[4][2];
+ float nor[3], nor_a[3], nor_b[3], vec[4][2];
float mat[3][3];
+ const bool is_ok_a = (normal_tri_v3(nor_a, v1, v2, v3) > FLT_EPSILON);
+ const bool is_ok_b = (normal_tri_v3(nor_b, v1, v3, v4) > FLT_EPSILON);
/* define projection, do both trias apart, quad is undefined! */
- normal_tri_v3(nor1, v1, v2, v3);
- normal_tri_v3(nor2, v1, v3, v4);
+ /* check normal length incase one size is zero area */
+ if (is_ok_a) {
+ if (is_ok_b) {
+ /* use both, most common outcome */
+
+ /* when the face is folded over as 2 tris we probably don't want to create
+ * a quad from it, but go ahead with the intersection test since this
+ * isn't a function for degenerate faces */
+ if (UNLIKELY(dot_v3v3(nor_a, nor_b) < 0.0f)) {
+ /* flip so adding normals in the opposite direction
+ * doesn't give a zero length vector */
+ negate_v3(nor_b);
+ }
- /* when the face is folded over as 2 tris we probably don't want to create
- * a quad from it, but go ahead with the intersection test since this
- * isn't a function for degenerate faces */
- if (UNLIKELY(dot_v3v3(nor1, nor2) < 0.0f)) {
- /* flip so adding normals in the opposite direction
- * doesnt give a zero length vector */
- negate_v3(nor2);
+ add_v3_v3v3(nor, nor_a, nor_b);
+ normalize_v3(nor);
+ }
+ else {
+ copy_v3_v3(nor, nor_a); /* only 'a' */
+ }
+ }
+ else {
+ if (is_ok_b) {
+ copy_v3_v3(nor, nor_b); /* only 'b' */
+ }
+ else {
+ return false; /* both zero, we can't do anything useful here */
+ }
}
-
- add_v3_v3v3(nor, nor1, nor2);
- normalize_v3(nor);
axis_dominant_v3_to_m3(mat, nor);
@@ -3606,12 +3639,12 @@ int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], c
mul_v2_m3v3(vec[3], mat, v4);
/* linetests, the 2 diagonals have to instersect to be convex */
- return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? TRUE : FALSE;
+ return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0);
}
int is_quad_convex_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
{
/* linetests, the 2 diagonals have to instersect to be convex */
- return (isect_line_line_v2(v1, v3, v2, v4) > 0) ? TRUE : FALSE;
+ return (isect_line_line_v2(v1, v3, v2, v4) > 0);
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 5c443b9b1f3..9d9e3e611e1 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -344,6 +344,15 @@ void mul_v3_m4v3(float in[3], float mat[4][4], const float vec[3])
in[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
}
+void mul_v2_m2v2(float r[2], float mat[2][2], const float vec[2])
+{
+ float x;
+
+ x = vec[0];
+ r[0] = mat[0][0] * x + mat[1][0] * vec[1];
+ r[1] = mat[0][1] * x + mat[1][1] * vec[1];
+}
+
/* same as mul_m4_v3() but doesnt apply translation component */
void mul_mat3_m4_v3(float mat[4][4], float vec[3])
{
@@ -1304,6 +1313,13 @@ void rotate_m4(float mat[4][4], const char axis, const float angle)
}
}
+void rotate_m2(float mat[2][2], const float angle)
+{
+ mat[0][0] = mat[1][1] = cosf(angle);
+ mat[0][1] = sinf(angle);
+ mat[1][0] = -mat[0][1];
+}
+
void blend_m3_m3m3(float out[3][3], float dst[3][3], float src[3][3], const float srcweight)
{
float srot[3][3], drot[3][3];
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index e6399ed356e..c0ea817ae4a 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1662,7 +1662,7 @@ void quat_apply_track(float quat[4], short axis, short upflag)
axis = axis - 3;
/* there are 2 possible up-axis for each axis used, the 'quat_track' applies so the first
- * up axis is used X->Y, Y->X, Z->X, if this first up axis isn used then rotate 90d
+ * up axis is used X->Y, Y->X, Z->X, if this first up axis isn't used then rotate 90d
* the strange bit shift below just find the low axis {X:Y, Y:X, Z:X} */
if (upflag != (2 - axis) >> 1) {
float q[4] = {M_SQRT1_2, 0.0, 0.0, 0.0}; /* assign 90d rotation axis */
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index c4def539c10..48e7de43a86 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -663,7 +663,7 @@ MINLINE float normalize_v3_v3(float r[3], const float a[3])
float d = dot_v3v3(a, a);
/* a larger value causes normalize errors in a
- * scaled down models with camera xtreme close */
+ * scaled down models with camera extreme close */
if (d > 1.0e-35f) {
d = sqrtf(d);
mul_v3_v3fl(r, a, 1.0f / d);
@@ -681,7 +681,7 @@ MINLINE double normalize_v3_d(double n[3])
double d = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
/* a larger value causes normalize errors in a
- * scaled down models with camera xtreme close */
+ * scaled down models with camera extreme close */
if (d > 1.0e-35) {
double mul;
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 771295b4b78..298e37137ce 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -325,7 +325,9 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
fac1 = 1.0e10f * (eed->v2->xy[0] - x);
}
- else fac1 = (x - eed->v2->xy[0]) / fac1;
+ else {
+ fac1 = (x - eed->v2->xy[0]) / fac1;
+ }
for (ed = sc->edge_first; ed; ed = ed->next) {
@@ -509,7 +511,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ScanFillVert *eve, *v1, *v2, *v3;
ScanFillEdge *eed, *nexted, *ed1, *ed2, *ed3;
int a, b, verts, maxface, totface;
- short nr, test, twoconnected = 0;
+ short nr, twoconnected = 0;
nr = pf->nr;
@@ -565,6 +567,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
verts++;
eve->f = 0; /* flag for connectedges later on */
sc->vert = eve;
+ /* if (even->tmp.v == NULL) eve->tmp.u = verts; */ /* Note, debug print only will work for curve polyfill, union is in use for mesh */
sc++;
}
}
@@ -639,7 +642,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
sc = sf_ctx->_scdata;
for (a = 0; a < verts; a++) {
- /* printf("VERTEX %d %x\n", a, sc->v1); */
+ /* printf("VERTEX %d index %d\n", a, sc->vert->tmp.u); */
ed1 = sc->edge_first;
while (ed1) { /* set connectflags */
nexted = ed1->next;
@@ -649,7 +652,9 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
if (ed1->v1->h > 1) ed1->v1->h--;
if (ed1->v2->h > 1) ed1->v2->h--;
}
- else ed1->v2->f = SF_VERT_UNKNOWN;
+ else {
+ ed1->v2->f = SF_VERT_UNKNOWN;
+ }
ed1 = nexted;
}
@@ -674,39 +679,67 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
}
else {
/* test rest of vertices */
+ ScanFillVertLink *best_sc = NULL;
+ float best_angle = 3.14f;
float miny;
+ bool firsttime = false;
+
v1 = ed1->v2;
v2 = ed1->v1;
v3 = ed2->v2;
+
/* this happens with a serial of overlapping edges */
if (v1 == v2 || v2 == v3) break;
- /* printf("test verts %x %x %x\n", v1, v2, v3); */
+
+ /* printf("test verts %d %d %d\n", v1->tmp.u, v2->tmp.u, v3->tmp.u); */
miny = min_ff(v1->xy[1], v3->xy[1]);
- /* miny = min_ff(v1->xy[1], v3->xy[1]); */
sc1 = sc + 1;
- test = 0;
- for (b = a + 1; b < verts; b++) {
+ for (b = a + 1; b < verts; b++, sc1++) {
if (sc1->vert->f == 0) {
if (sc1->vert->xy[1] <= miny) break;
if (testedgeside(v1->xy, v2->xy, sc1->vert->xy)) {
if (testedgeside(v2->xy, v3->xy, sc1->vert->xy)) {
if (testedgeside(v3->xy, v1->xy, sc1->vert->xy)) {
- /* point in triangle */
-
- test = 1;
- break;
+ /* point is in triangle */
+
+ /* because multiple points can be inside triangle (concave holes) */
+ /* we continue searching and pick the one with sharpest corner */
+
+ if (best_sc == NULL) {
+ best_sc = sc1;
+ /* only need to continue checking with holes */
+ if ((flag & BLI_SCANFILL_CALC_HOLES) == 0) {
+ break;
+ }
+ }
+ else {
+ float angle;
+
+ /* prevent angle calc for the simple cases only 1 vertex is found */
+ if (firsttime == false) {
+ best_angle = angle_v2v2v2(v2->co, v1->co, best_sc->vert->co);
+ firsttime = true;
+ }
+
+ angle = angle_v2v2v2(v2->co, v1->co, sc1->vert->co);
+ if (angle < best_angle) {
+ best_sc = sc1;
+ best_angle = angle;
+ }
+ }
+
}
}
}
}
- sc1++;
}
- if (test) {
+
+ if (best_sc) {
/* make new edge, and start over */
- /* printf("add new edge %x %x and start again\n", v2, sc1->vert); */
+ /* printf("add new edge %d %d and start again\n", v2->tmp.u, best_sc->vert->tmp.u); */
- ed3 = BLI_scanfill_edge_add(sf_ctx, v2, sc1->vert);
+ ed3 = BLI_scanfill_edge_add(sf_ctx, v2, best_sc->vert);
BLI_remlink(&sf_ctx->filledgebase, ed3);
BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed2, ed3);
ed3->v2->f = SF_VERT_UNKNOWN;
@@ -716,7 +749,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
}
else {
/* new triangle */
- /* printf("add face %x %x %x\n", v1, v2, v3); */
+ /* printf("add face %d %d %d\n", v1->tmp.u, v2->tmp.u, v3->tmp.u); */
addfillface(sf_ctx, v1, v2, v3);
totface++;
BLI_remlink((ListBase *)&(sc->edge_first), ed1);
@@ -762,7 +795,6 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag)
ed3 = ed3->next;
}
}
-
}
}
/* test for loose edges */
diff --git a/source/blender/blenlib/intern/string_cursor_utf8.c b/source/blender/blenlib/intern/string_cursor_utf8.c
index 65763f21b0f..674d5ae5c8d 100644
--- a/source/blender/blenlib/intern/string_cursor_utf8.c
+++ b/source/blender/blenlib/intern/string_cursor_utf8.c
@@ -139,12 +139,17 @@ int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *p
void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
int *pos, strCursorJumpDirection direction,
- strCursorJumpType jump)
+ strCursorJumpType jump, bool use_init_step)
{
const int pos_prev = *pos;
if (direction == STRCUR_DIR_NEXT) {
- BLI_str_cursor_step_next_utf8(str, maxlen, pos);
+ if (use_init_step) {
+ BLI_str_cursor_step_next_utf8(str, maxlen, pos);
+ }
+ else {
+ BLI_assert(jump == STRCUR_JUMP_DELIM);
+ }
if (jump != STRCUR_JUMP_NONE) {
const strCursorDelimType delim_type = (*pos) < maxlen ? cursor_delim_type(&str[*pos]) : STRCUR_DELIM_NONE;
@@ -163,7 +168,12 @@ void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
}
}
else if (direction == STRCUR_DIR_PREV) {
- BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
+ if (use_init_step) {
+ BLI_str_cursor_step_prev_utf8(str, maxlen, pos);
+ }
+ else {
+ BLI_assert(jump == STRCUR_JUMP_DELIM);
+ }
if (jump != STRCUR_JUMP_NONE) {
const strCursorDelimType delim_type = (*pos) > 1 ? cursor_delim_type(&str[(*pos) - 1]) : STRCUR_DELIM_NONE;
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index bf98f2ae77c..9e0f9197ca3 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -114,7 +114,7 @@ int BLI_utf8_invalid_byte(const char *str, int length)
/* Check for valid bytes after the 2nd, if any; all must start 10 */
while (--ab > 0) {
- if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
+ if ((*(p + 1) & 0xc0) != 0x80) goto utf8_error;
p++; /* do this after so we get usable offset - campbell */
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index abede57b3ce..7d6ea1be77d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8873,7 +8873,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (scene->world) {
World *world = blo_do_versions_newlibadr(fd, scene->id.lib, scene->world);
- if (is_zero_v3(&world->horr)) {
+ if (world && is_zero_v3(&world->horr)) {
if ((world->skytype & WO_SKYBLEND) == 0 || is_zero_v3(&world->zenr)) {
set_premul = true;
}
@@ -9004,13 +9004,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
// add storage for compositor translate nodes when not existing
if (!MAIN_VERSION_ATLEAST(main, 265, 10)) {
bNodeTreeType *ntreetype;
+ bNodeTree *ntree;
ntreetype = ntreeGetType(NTREE_COMPOSIT);
if (ntreetype && ntreetype->foreach_nodetree)
ntreetype->foreach_nodetree(main, NULL, do_version_node_fix_translate_wrapping);
- }
-
+ for (ntree = main->nodetree.first; ntree; ntree = ntree->id.next)
+ do_version_node_fix_translate_wrapping(NULL, NULL, ntree);
+ }
// if (main->versionfile < 265 || (main->versionfile == 265 && main->subversionfile < 7)) {
@@ -9132,6 +9134,10 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
bfd->user = user= read_struct(fd, bhead, "user def");
+ /* User struct has separate do-version handling */
+ user->versionfile = bfd->main->versionfile;
+ user->subversionfile = bfd->main->subversionfile;
+
/* read all data into fd->datamap */
bhead = read_data_into_oldnewmap(fd, bhead, "user def");
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
index 4461a7afdd7..3dd2e7a6131 100644
--- a/source/blender/bmesh/bmesh_class.h
+++ b/source/blender/bmesh/bmesh_class.h
@@ -45,7 +45,7 @@ struct Object;
* pointers. this is a requirement of mempool's method of
* iteration.
*
- * hrm. it doesn't but stull works ok, remove the comment above? - campbell.
+ * hrm. it doesn't but still works ok, remove the comment above? - campbell.
*/
// #pragma GCC diagnostic error "-Wpadded"
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index a2f2a9a0dba..643e73e02b4 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2103,7 +2103,7 @@ bool bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
}
/**
- * \brief Unglue Region Make Vert (URMV)
+ * \brief Un-glue Region Make Vert (URMV)
*
* Disconnects a face from its vertex fan at loop \a sl
*
diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h
index d9784ac9b2a..eef6544be89 100644
--- a/source/blender/bmesh/intern/bmesh_iterators_inline.h
+++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h
@@ -35,7 +35,7 @@
/**
* \brief Iterator Step
*
- * Calls an iterators step fucntion to return the next element.
+ * Calls an iterators step function to return the next element.
*/
BLI_INLINE void *BM_iter_step(BMIter *iter)
{
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 2284e183d97..44dc483d5a7 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -472,7 +472,7 @@ BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step)
* The function takes a vertex at the center of a fan and returns the opposite edge in the fan.
* All edges in the fan must be manifold, otherwise return NULL.
*
- * \note This could (probably) be done more effieiently.
+ * \note This could (probably) be done more efficiently.
*/
BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
{
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index c7c33aa2775..36ad8ef506b 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -165,7 +165,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
}
/* apply the new difference to the rest of the shape keys,
- * note that this dosn't take rotations into account, we _could_ support
+ * note that this doesn't take rotations into account, we _could_ support
* this by getting the normals and coords for each shape key and
* re-calculate the smooth value for each but this is quite involved.
* for now its ok to simply apply the difference IMHO - campbell */
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 3d78ff64876..1f04c7ce845 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -75,9 +75,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
stop = 1;
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
- float v1_xy[2], v2_xy[2], v3_xy[2], v4_xy[2];
- float no[3];
- float axis_mat[3][3];
+ BMVert *v1, *v2, *v3, *v4;
if (!BM_edge_is_manifold(e) || !BMO_elem_flag_test(bm, e, EDGE_MARK)) {
continue;
@@ -88,45 +86,31 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
{
continue;
}
-
- {
- float *v1, *v2, *v3, *v4;
- float no_a[3], no_b[3];
- v1 = e->l->prev->v->co;
- v2 = e->l->v->co;
- v3 = e->l->radial_next->prev->v->co;
- v4 = e->l->next->v->co;
-
- normal_tri_v3(no_a, v1, v2, v3);
- normal_tri_v3(no_b, v1, v3, v4);
- add_v3_v3v3(no, no_a, no_b);
- normalize_v3(no);
- axis_dominant_v3_to_m3(axis_mat, no);
- mul_v2_m3v3(v1_xy, axis_mat, v1);
- mul_v2_m3v3(v2_xy, axis_mat, v2);
- mul_v2_m3v3(v3_xy, axis_mat, v3);
- mul_v2_m3v3(v4_xy, axis_mat, v4);
- }
- if (is_quad_convex_v2(v1_xy, v2_xy, v3_xy, v4_xy)) {
+ v1 = e->l->prev->v;
+ v2 = e->l->v;
+ v3 = e->l->radial_next->prev->v;
+ v4 = e->l->next->v;
+
+ if (is_quad_convex_v3(v1->co, v2->co, v3->co, v4->co)) {
float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2;
/* testing rule:
* the area divided by the total edge lengths
*/
- len1 = len_v2v2(v1_xy, v2_xy);
- len2 = len_v2v2(v2_xy, v3_xy);
- len3 = len_v2v2(v3_xy, v4_xy);
- len4 = len_v2v2(v4_xy, v1_xy);
- len5 = len_v2v2(v1_xy, v3_xy);
- len6 = len_v2v2(v2_xy, v4_xy);
+ len1 = len_v3v3(v1->co, v2->co);
+ len2 = len_v3v3(v2->co, v3->co);
+ len3 = len_v3v3(v3->co, v4->co);
+ len4 = len_v3v3(v4->co, v1->co);
+ len5 = len_v3v3(v1->co, v3->co);
+ len6 = len_v3v3(v2->co, v4->co);
- opp1 = area_tri_v2(v1_xy, v2_xy, v3_xy);
- opp2 = area_tri_v2(v1_xy, v3_xy, v4_xy);
+ opp1 = area_tri_v3(v1->co, v2->co, v3->co);
+ opp2 = area_tri_v3(v1->co, v3->co, v4->co);
fac1 = opp1 / (len1 + len2 + len5) + opp2 / (len3 + len4 + len5);
- opp1 = area_tri_v2(v2_xy, v3_xy, v4_xy);
- opp2 = area_tri_v2(v2_xy, v4_xy, v1_xy);
+ opp1 = area_tri_v3(v2->co, v3->co, v4->co);
+ opp2 = area_tri_v3(v2->co, v4->co, v1->co);
fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6);
diff --git a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
index 9dc4b596568..7e9a5784552 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_unsubdivide.c
@@ -189,7 +189,7 @@ void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool
int iter_step;
- /* if tag_only is set, we assyme the caller knows what verts to tag
+ /* if tag_only is set, we assume the caller knows what verts to tag
* needed for the operator */
if (tag_only == false) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index 4a0696dc857..a69f7918e40 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -161,9 +161,9 @@ void AnimationExporter::export_morph_animation(Object *ob)
FCurve *fcu;
char *transformName;
Key *key = BKE_key_from_object(ob);
- if(!key) return;
+ if (!key) return;
- if(key->adt && key->adt->action){
+ if (key->adt && key->adt->action) {
fcu = (FCurve *)key->adt->action->curves.first;
while (fcu) {
@@ -177,17 +177,17 @@ void AnimationExporter::export_morph_animation(Object *ob)
}
-void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<float> &frames ){
-
+void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<float> &frames )
+{
ListBase *conlist = get_active_constraints(ob);
- if(conlist == NULL) return;
+ if (conlist == NULL) return;
bConstraint *con;
for (con = (bConstraint*)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL};
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
- if(!validateConstraints(con)) continue;
+ if (!validateConstraints(con)) continue;
if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct;
@@ -197,8 +197,8 @@ void AnimationExporter::make_anim_frames_from_targets(Object *ob, std::vector<fl
* - ct->matrix members have not yet been calculated here!
*/
cti->get_constraint_targets(con, &targets);
- if(cti){
- for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
+ if (cti) {
+ for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
obtar = ct->tar;
find_frames(obtar, frames);
}
@@ -901,7 +901,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
bPoseChannel *parchan = NULL;
bPoseChannel *pchan = NULL;
- if (ob->type == OB_ARMATURE ){
+ if (ob->type == OB_ARMATURE ) {
bPose *pose = ob->pose;
pchan = BKE_pose_channel_find_name(pose, bone->name);
if (!pchan)
@@ -922,15 +922,15 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
//BKE_scene_update_for_newframe(G.main,scene,scene->lay);
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
- if (bone){
- if( pchan->flag & POSE_CHAIN)
- {
+ if (bone) {
+ if (pchan->flag & POSE_CHAIN) {
enable_fcurves(ob->adt->action, NULL);
BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_ALL);
BKE_pose_where_is(scene, ob);
}
- else
- BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
+ else {
+ BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
+ }
// compute bone local mat
if (bone->parent) {
@@ -1324,9 +1324,9 @@ bool AnimationExporter::hasAnimations(Scene *sce)
}
//check shape key animation
- if(!fcu){
+ if (!fcu) {
Key *key = BKE_key_from_object(ob);
- if(key && key->adt && key->adt->action)
+ if (key && key->adt && key->adt->action)
fcu = (FCurve *)key->adt->action->curves.first;
}
if (fcu)
@@ -1497,8 +1497,8 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
enable_fcurves(ob_arm->adt->action, NULL);
}
-bool AnimationExporter::validateConstraints(bConstraint *con){
-
+bool AnimationExporter::validateConstraints(bConstraint *con)
+{
bool valid = true;
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
/* these we can skip completely (invalid constraints...) */
@@ -1512,7 +1512,8 @@ bool AnimationExporter::validateConstraints(bConstraint *con){
return valid;
}
-void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[][4]){
+void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[][4])
+{
ListBase *conlist = get_active_constraints(ob);
bConstraint *con;
for (con = (bConstraint*)conlist->first; con; con = con->next) {
@@ -1524,7 +1525,7 @@ void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[
bConstraintTarget *ct;
Object *obtar;
cti->get_constraint_targets(con, &targets);
- for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
+ for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
obtar = ct->tar;
BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(scene, obtar, ctime);
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 0929bfda6e7..a56010aeb27 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -273,7 +273,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
}
// SECOND_LIFE_COMPATIBILITY
- if (export_settings->second_life) {
+ if (export_settings->second_life) {
// Remove rotations vs armature from transform
// parent_rest_rot * mat * irest_rot
float temp[4][4];
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 86d9de64085..fefad7dd8ec 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -106,13 +106,14 @@ void ArmatureImporter::create_bone(SkinInfo* skin, COLLADAFW::Node *node, EditBo
else {
// bone-space
get_node_mat(obmat, node, NULL, NULL);
-
+
// get world-space
- if (parent){
+ if (parent) {
mult_m4_m4m4(mat, parent_mat, obmat);
}
- else
+ else {
copy_m4_m4(mat, obmat);
+ }
}
if (parent) bone->parent = parent;
@@ -645,7 +646,8 @@ bool ArmatureImporter::write_controller(const COLLADAFW::Controller *controller)
return true;
}
-void ArmatureImporter::make_shape_keys(){
+void ArmatureImporter::make_shape_keys()
+{
std::vector<COLLADAFW::MorphController *>::iterator mc;
float weight;
@@ -668,22 +670,26 @@ void ArmatureImporter::make_shape_keys(){
BKE_key_convert_from_mesh(source_me, kb);
//insert other shape keys
- for ( int i = 0 ; i < morphTargetIds.getCount() ; i++ ){
+ for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
//better to have a seperate map of morph objects,
//This'll do for now since only mesh morphing is imported
+
Mesh *me = this->mesh_importer->get_mesh_by_geom_uid(morphTargetIds[i]);
- if(me){
+ if (me) {
me->key = key;
- kb = BKE_keyblock_add_ctime(key, me->id.name, FALSE);
+ std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
+
+ kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), FALSE);
BKE_key_convert_from_mesh(me, kb);
//apply weights
weight = morphWeights.getFloatValues()->getData()[i];
kb->curval = weight;
}
- else
+ else {
fprintf(stderr, "Morph target geometry not found.\n");
+ }
}
}
}
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 57047346617..41693d4d680 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -120,9 +120,10 @@ void ControllerExporter::operator()(Object *ob)
Object *ob_arm = bc_get_assigned_armature(ob);
Key *key = BKE_key_from_object(ob);
- if (ob_arm)
+ if (ob_arm) {
export_skin_controller(ob, ob_arm);
- if(key){
+ }
+ if (key) {
export_morph_controller(ob, key);
}
}
@@ -388,7 +389,8 @@ std::string ControllerExporter::add_morph_weights(Key *key, Object *ob)
}
//Added to implemente support for animations.
-void ControllerExporter::add_weight_extras(Key *key){
+void ControllerExporter::add_weight_extras(Key *key)
+{
// can also try the base element and param alternative
COLLADASW::BaseExtraTechnique extra;
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 7437401ed09..8af4d0652d9 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -54,6 +54,7 @@ extern "C" {
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLI_fileops.h"
#include "BKE_camera.h"
#include "BKE_main.h"
@@ -100,7 +101,7 @@ extern "C" {
// #define ARMATURE_TEST
DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_settings) :
- import_settings(import_settings),
+ import_settings(import_settings),
mImportStage(General),
mContext(C),
armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)),
@@ -213,15 +214,17 @@ void DocumentImporter::finish()
fprintf(stdout, "Collada: Adjusting Blender units to Importset units: %f.\n", unit_factor);
}
- else {
- // TODO: add automatic scaling for the case when Blender units
- // and import units are set to different values.
- }
// Write nodes to scene
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
- write_node(roots[i], NULL, sce, NULL, false);
+ std::vector<Object *> *objects_done;
+ objects_done = write_node(roots[i], NULL, sce, NULL, false);
+
+ if (!this->import_settings->import_units) {
+ // Match incoming scene with current unit settings
+ bc_match_scale(objects_done, *sce, unit_converter);
+ }
}
// update scene
@@ -432,8 +435,9 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
// to create constraints off node <extra> tags. Assumes only constraint data in
// current <extra> with blender profile.
-void DocumentImporter::create_constraints(ExtraTags *et, Object *ob){
- if ( et && et->isProfile("blender")){
+void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
+{
+ if (et && et->isProfile("blender")) {
std::string name;
short* type = 0;
et->setData("type", type);
@@ -442,7 +446,7 @@ void DocumentImporter::create_constraints(ExtraTags *et, Object *ob){
}
}
-void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
+std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
{
Object *ob = NULL;
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
@@ -536,16 +540,20 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
// XXX empty node may not mean it is empty object, not sure about this
if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
//Check if Object is armature, by checking if immediate child is a JOINT node.
- if(is_armature(node))
+ if (is_armature(node)) {
ob = bc_add_object(sce, OB_ARMATURE, NULL);
- else ob = bc_add_object(sce, OB_EMPTY, NULL);
+ }
+ else {
+ ob = bc_add_object(sce, OB_EMPTY, NULL);
+ }
objects_done->push_back(ob);
}
// XXX: if there're multiple instances, only one is stored
- if (!ob) return;
+ if (!ob) return objects_done;
+
for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) {
ob = *it;
std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId();
@@ -557,6 +565,7 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
libnode_ob.push_back(ob);
}
+
//create_constraints(et,ob);
}
@@ -575,12 +584,19 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
}
// if node has child nodes write them
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
+
if (objects_done->size() > 0) {
ob = *objects_done->begin();
- for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
- write_node(child_nodes[i], node, sce, ob, is_library_node);
- }
}
+ else {
+ ob = NULL;
+ }
+
+ for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
+ write_node(child_nodes[i], node, sce, ob, is_library_node);
+ }
+
+ return objects_done;
}
/** When this method is called, the writer must write the entire visual scene.
@@ -985,17 +1001,29 @@ bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
if (mImportStage != General)
return true;
- // XXX maybe it is necessary to check if the path is absolute or relative
- const std::string& filepath = image->getImageURI().toNativePath();
- const char *filename = (const char *)filepath.c_str();
+ const std::string& imagepath = image->getImageURI().toNativePath();
+
char dir[FILE_MAX];
- char full_path[FILE_MAX];
-
- BLI_split_dir_part(filename, dir, sizeof(dir));
- BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str());
- Image *ima = BKE_image_load_exists(full_path);
+ char absolute_path[FILE_MAX];
+ const char *workpath;
+
+ BLI_split_dir_part(this->import_settings->filepath, dir, sizeof(dir));
+ BLI_join_dirfile(absolute_path, sizeof(absolute_path), dir, imagepath.c_str());
+ if (BLI_exists(absolute_path)) {
+ workpath = absolute_path;
+ }
+ else {
+ // Maybe imagepath was already absolute ?
+ if (!BLI_exists(imagepath.c_str())) {
+ fprintf(stderr, "Image not found: %s.\n", imagepath.c_str() );
+ return true;
+ }
+ workpath = imagepath.c_str();
+ }
+
+ Image *ima = BKE_image_load_exists(workpath);
if (!ima) {
- fprintf(stderr, "Cannot create image.\n");
+ fprintf(stderr, "Cannot create image: %s\n", workpath);
return true;
}
this->uid_image_map[image->getUniqueId()] = ima;
@@ -1238,15 +1266,18 @@ bool DocumentImporter::addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *e
return true;
}
-bool DocumentImporter::is_armature(COLLADAFW::Node *node){
+bool DocumentImporter::is_armature(COLLADAFW::Node *node)
+{
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
- for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
- if(child_nodes[i]->getType() == COLLADAFW::Node::JOINT) return true;
- else continue;
+ for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
+ if (child_nodes[i]->getType() == COLLADAFW::Node::JOINT) {
+ return true;
+ }
+ else {
+ continue;
+ }
}
//no child is JOINT
return false;
-
}
-
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index 76d16f38a0c..ff0cbd44043 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -77,7 +77,7 @@ public:
Object* create_lamp_object(COLLADAFW::InstanceLight*, Scene*);
Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, bool);
void create_constraints(ExtraTags *et, Object *ob);
- void write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
+ std::vector<Object *> *write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
MTex* create_texture(COLLADAFW::EffectCommon*, COLLADAFW::Texture&, Material*, int, TexIndexTextureArrayMap&);
void write_profile_COMMON(COLLADAFW::EffectCommon*, Material*);
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 0720c1f9b81..4a6c5b43ce2 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -53,7 +53,8 @@ extern "C" {
#include "collada_utils.h"
// TODO: optimize UV sets by making indexed list with duplicates removed
-GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings) {
+GeometryExporter::GeometryExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryGeometries(sw), export_settings(export_settings)
+{
}
@@ -160,7 +161,7 @@ void GeometryExporter::operator()(Object *ob)
if (this->export_settings->include_shapekeys) {
Key * key = BKE_key_from_object(ob);
- if(key) {
+ if (key) {
KeyBlock * kb = (KeyBlock*)key->block.first;
//skip the basis
kb = kb->next;
@@ -175,7 +176,8 @@ void GeometryExporter::operator()(Object *ob)
#endif
}
-void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb){
+void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
+{
std::string geom_id = get_geometry_id(ob, false) + "_morph_" + translate_id(kb->name);
std::vector<Normal> nor;
std::vector<Face> norind;
@@ -185,7 +187,7 @@ void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb){
return;
}
- std::string geom_name = id_name(ob) + "_morph_" + kb->name;
+ std::string geom_name = kb->name;
exportedGeometry.insert(geom_id);
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index bf5a39cfae8..26915f37002 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -952,6 +952,13 @@ Mesh *MeshImporter::get_mesh_by_geom_uid(const COLLADAFW::UniqueId& mesh_uid)
return NULL;
}
+std::string *MeshImporter::get_geometry_name(const std::string &mesh_name)
+{
+ if (this->mesh_geom_map.find(mesh_name) != this->mesh_geom_map.end())
+ return &this->mesh_geom_map[mesh_name];
+ return NULL;
+}
+
MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture,
Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map,
MTex *color_texture)
@@ -1300,7 +1307,9 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry *geom)
// store the Mesh pointer to link it later with an Object
this->uid_mesh_map[mesh->getUniqueId()] = me;
-
+ // needed to map mesh to its geometry name (needed for shape key naming)
+ this->mesh_geom_map[std::string(me->id.name)] = str_geom_id;
+
int new_tris = 0;
read_vertices(mesh, me);
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
index 946f9ff99e3..8b0f5cdc200 100644
--- a/source/blender/collada/MeshImporter.h
+++ b/source/blender/collada/MeshImporter.h
@@ -60,6 +60,7 @@ class MeshImporterBase
public:
virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid) = 0;
virtual Mesh *get_mesh_by_geom_uid(const COLLADAFW::UniqueId& mesh_uid) = 0;
+ virtual std::string *get_geometry_name(const std::string &mesh_name) = 0;
};
class UVDataWrapper
@@ -84,6 +85,7 @@ private:
Scene *scene;
ArmatureImporter *armature_importer;
+ std::map<std::string, std::string> mesh_geom_map; // needed for correct shape key naming
std::map<COLLADAFW::UniqueId, Mesh*> uid_mesh_map; // geometry unique id-to-mesh map
std::map<COLLADAFW::UniqueId, Object*> uid_object_map; // geom uid-to-object
std::vector<Object*> imported_objects; // list of imported objects
@@ -133,7 +135,7 @@ private:
CustomData create_edge_custom_data(EdgeHash *eh);
- void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
+ void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
// TODO: import uv set names
void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris);
@@ -175,7 +177,7 @@ public:
// create a mesh storing a pointer in a map so it can be retrieved later by geometry UID
bool write_geometry(const COLLADAFW::Geometry* geom);
-
+ std::string *get_geometry_name(const std::string &mesh_name);
};
#endif
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index 3a06ca3bc0e..dbf7d40b373 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -182,7 +182,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
colladaNode.end();
}
- if (ob->constraints.first != NULL ){
+ if (ob->constraints.first != NULL ) {
bConstraint *con = (bConstraint*) ob->constraints.first;
while (con) {
std::string con_name(id_name(con));
@@ -208,8 +208,8 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
Object *obtar;
cti->get_constraint_targets(con, &targets);
- if(cti){
- for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next){
+ if (cti) {
+ for (ct = (bConstraintTarget*)targets.first; ct; ct = ct->next) {
obtar = ct->tar;
std::string tar_id(id_name(obtar));
colladaNode.addExtraTechniqueChildParameter("blender",con_tag,"target_id",tar_id);
diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp
index 913c0710cc6..67166d819a6 100644
--- a/source/blender/collada/TransformReader.cpp
+++ b/source/blender/collada/TransformReader.cpp
@@ -46,7 +46,7 @@ void TransformReader::get_node_mat(float mat[4][4], COLLADAFW::Node *node, std::
COLLADAFW::Transformation *tm = node->getTransformations()[i];
COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();
- if (type == COLLADAFW::Transformation::MATRIX){
+ if (type == COLLADAFW::Transformation::MATRIX) {
// XXX why does this return and discard all following transformations?
dae_matrix_to_mat4(tm, mat);
return;
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index fb8ba567192..fa813e0b961 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -51,10 +51,10 @@ void TransformWriter::add_node_transform(COLLADASW::Node& node, float mat[4][4],
converter->mat4_to_dae_double(dmat, local);
TransformBase::decompose(local, loc, rot, NULL, scale);
- if (node.getType() == COLLADASW::Node::JOINT)
+ //if (node.getType() == COLLADASW::Node::JOINT)
node.addMatrix("transform", dmat);
- else
- add_transform(node, loc, rot, scale);
+ //else
+ //add_transform(node, loc, rot, scale);
}
void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
@@ -115,7 +115,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
double d_obmat[4][4];
converter.mat4_to_dae_double(d_obmat, ob->obmat);
node.addMatrix("transform",d_obmat);
- add_transform(node, ob->loc, ob->rot, ob->size);
+ //add_transform(node, ob->loc, ob->rot, ob->size);
}
void TransformWriter::add_node_transform_identity(COLLADASW::Node& node)
@@ -131,10 +131,10 @@ void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float r
node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1]));
node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));
#endif
+ node.addTranslate("location", loc[0], loc[1], loc[2]);
node.addRotateZ("rotationZ", RAD2DEGF(rot[2]));
node.addRotateY("rotationY", RAD2DEGF(rot[1]));
node.addRotateX("rotationX", RAD2DEGF(rot[0]));
node.addScale("scale", scale[0], scale[1], scale[2]);
- node.addTranslate("location", loc[0], loc[1], loc[2]);
}
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 1aff0f166ba..b3c288c8fc5 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -40,7 +40,6 @@ extern "C"
/* make dummy file */
#include "BLI_fileops.h"
-#include "BLI_path_util.h"
#include "BLI_linklist.h"
int collada_import(bContext *C,
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index 587dc37b7db..2fa5b22bb15 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -33,6 +33,7 @@ extern "C" {
#endif
#include "BLI_linklist.h"
+#include "BLI_path_util.h"
#include "RNA_types.h"
typedef enum BC_export_mesh_type {
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index 64c567384a1..85f98dad437 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -33,7 +33,14 @@
UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP)
{
- /* pass */
+ unit_m4(x_up_mat4);
+ rotate_m4(x_up_mat4, 'Y', -0.5 * M_PI);
+
+ unit_m4(y_up_mat4);
+ rotate_m4(y_up_mat4, 'X', 0.5 * M_PI);
+
+ unit_m4(z_up_mat4);
+
}
void UnitConverter::read_asset(const COLLADAFW::FileInfo *asset)
@@ -102,6 +109,21 @@ void UnitConverter::mat4_to_dae_double(double out[4][4], float in[4][4])
out[i][j] = mat[i][j];
}
+float(&UnitConverter::get_rotation())[4][4]
+{
+ switch(up_axis) {
+ case COLLADAFW::FileInfo::X_UP:
+ return x_up_mat4;
+ break;
+ case COLLADAFW::FileInfo::Y_UP:
+ return y_up_mat4;
+ break;
+ default:
+ return z_up_mat4;
+ break;
+ }
+}
+
void TransformBase::decompose(float mat[4][4], float *loc, float eul[3], float quat[4], float *size)
{
mat4_to_size(size, mat);
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index ba077628499..7d59932bac9 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -39,7 +39,6 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
-#include "BLI_math.h"
#include "BLI_linklist.h"
class UnitConverter
@@ -48,6 +47,10 @@ private:
COLLADAFW::FileInfo::Unit unit;
COLLADAFW::FileInfo::UpAxisType up_axis;
+ float x_up_mat4[4][4];
+ float y_up_mat4[4][4];
+ float z_up_mat4[4][4];
+
public:
enum UnitSystem {
@@ -74,6 +77,10 @@ public:
void mat4_to_dae(float out[4][4], float in[4][4]);
void mat4_to_dae_double(double out[4][4], float in[4][4]);
+
+ float(&get_rotation())[4][4];
+
+
};
class TransformBase
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 27af5c0aba2..45db8510cbb 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -295,11 +295,76 @@ std::string bc_url_encode(std::string data) {
}
std::string bc_replace_string(std::string data, const std::string& pattern,
- const std::string& replacement) {
- size_t pos = 0;
- while((pos = data.find(pattern, pos)) != std::string::npos) {
- data.replace(pos, pattern.length(), replacement);
- pos += replacement.length();
- }
- return data;
+ const std::string& replacement) {
+ size_t pos = 0;
+ while((pos = data.find(pattern, pos)) != std::string::npos) {
+ data.replace(pos, pattern.length(), replacement);
+ pos += replacement.length();
+ }
+ return data;
+}
+
+/**
+ Calculate a rescale factor such that the imported scene's scale
+ is preserved. I.e. 1 meter in the import will also be
+ 1 meter in the current scene.
+ XXX : I am not sure if it is correct to map 1 Blender Unit
+ to 1 Meter for unit type NONE. But it looks reasonable to me.
+*/
+void bc_match_scale(std::vector<Object *> *objects_done,
+ Scene &sce,
+ UnitConverter &bc_unit) {
+
+ Object *ob = NULL;
+
+ PointerRNA scene_ptr, unit_settings;
+ PropertyRNA *system_ptr, *scale_ptr;
+ RNA_id_pointer_create(&sce.id, &scene_ptr);
+
+ unit_settings = RNA_pointer_get(&scene_ptr, "unit_settings");
+ system_ptr = RNA_struct_find_property(&unit_settings, "system");
+ scale_ptr = RNA_struct_find_property(&unit_settings, "scale_length");
+
+ int type = RNA_property_enum_get(&unit_settings, system_ptr);
+
+ float bl_scale;
+
+ switch (type) {
+ case USER_UNIT_NONE:
+ bl_scale = 1.0; // map 1 Blender unit to 1 Meter
+ break;
+
+ case USER_UNIT_METRIC:
+ bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
+ break;
+
+ default :
+ bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
+ // it looks like the conversion to Imperial is done implicitly.
+ // So nothing to do here.
+ break;
+ }
+
+ float scale_conv = bc_unit.getLinearMeter() / bl_scale;
+
+ float rescale[3];
+ rescale[0] = rescale[1] = rescale[2] = scale_conv;
+
+ float size_mat4[4][4];
+
+ float axis_mat4[4][4];
+ unit_m4(axis_mat4);
+
+ size_to_mat4(size_mat4, rescale);
+
+ for (std::vector<Object *>::iterator it = objects_done->begin();
+ it != objects_done->end();
+ ++it)
+ {
+ ob = *it;
+ mult_m4_m4m4(ob->obmat, size_mat4, ob->obmat);
+ mult_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat);
+ BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
+ }
+
} \ No newline at end of file
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index 90282d9d28f..892b57e6a4a 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -42,15 +42,19 @@ extern "C" {
#include "DNA_texture_types.h"
#include "DNA_scene_types.h"
+#include "RNA_access.h"
+
#include "BLI_linklist.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_object.h"
#include "BKE_DerivedMesh.h"
+#include "BKE_scene.h"
}
#include "ExportSettings.h"
+#include "collada_internal.h"
typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex *> > TexIndexTextureArrayMap;
@@ -79,5 +83,5 @@ extern int bc_get_active_UVLayer(Object *ob);
extern std::string bc_replace_string(std::string data, const std::string& pattern, const std::string& replacement);
extern std::string bc_url_encode(std::string data);
-
+extern void bc_match_scale(std::vector<Object *> *objects_done, Scene &sce, UnitConverter &unit_converter);
#endif
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index e3313750e66..fc4dea8cee3 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -41,6 +41,7 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte
compositorOperation->setSceneName(editorNode->id->name);
compositorOperation->setRenderData(context->getRenderData());
compositorOperation->setbNodeTree(context->getbNodeTree());
+ compositorOperation->setIgnoreAlpha(editorNode->custom2 & 1);
imageSocket->relinkConnections(compositorOperation->getInputSocket(0), 0, graph);
alphaSocket->relinkConnections(compositorOperation->getInputSocket(1));
depthSocket->relinkConnections(compositorOperation->getInputSocket(2));
diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp
index f44470a9b9a..94f3c2ebd80 100644
--- a/source/blender/compositor/nodes/COM_ViewerNode.cpp
+++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp
@@ -47,6 +47,7 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1);
viewerOperation->setCenterX(editorNode->custom3);
viewerOperation->setCenterY(editorNode->custom4);
+ viewerOperation->setIgnoreAlpha(editorNode->custom2 & 1);
viewerOperation->setViewSettings(context->getViewSettings());
viewerOperation->setDisplaySettings(context->getDisplaySettings());
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp
index e6a49082a71..43f491ad2d9 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.cpp
+++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp
@@ -49,6 +49,8 @@ CompositorOperation::CompositorOperation() : NodeOperation()
this->m_alphaInput = NULL;
this->m_depthInput = NULL;
+ this->m_ignoreAlpha = false;
+
this->m_sceneName[0] = '\0';
}
@@ -138,9 +140,15 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2 && (!breaked); x++) {
this->m_imageInput->read(color, x, y, COM_PS_NEAREST);
- if (this->m_alphaInput != NULL) {
- this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST);
+ if (this->m_ignoreAlpha) {
+ color[3] = 1.0f;
+ }
+ else {
+ if (this->m_alphaInput != NULL) {
+ this->m_alphaInput->read(&(color[3]), x, y, COM_PS_NEAREST);
+ }
}
+
copy_v4_v4(buffer + offset4, color);
if (this->m_depthInput != NULL) {
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h
index c1d91c16a3c..27d29664610 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.h
+++ b/source/blender/compositor/operations/COM_CompositorOperation.h
@@ -65,6 +65,10 @@ private:
* @brief local reference to the depth operation
*/
SocketReader *m_depthInput;
+
+ /* Ignore any alpha input */
+ bool m_ignoreAlpha;
+
public:
CompositorOperation();
void executeRegion(rcti *rect, unsigned int tileNumber);
@@ -75,5 +79,6 @@ public:
void deinitExecution();
const CompositorPriority getRenderPriority() const { return COM_PRIORITY_MEDIUM; }
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+ void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp
index 81ca06cfff0..edcd1563e03 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cpp
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp
@@ -84,8 +84,8 @@ float *InpaintSimpleOperation::get_pixel(int x, int y)
ASSERT_XY_RANGE(x, y);
return &this->m_cached_buffer[
- y * width * COM_NUMBER_OF_CHANNELS
- + x * COM_NUMBER_OF_CHANNELS];
+ y * width * COM_NUMBER_OF_CHANNELS +
+ x * COM_NUMBER_OF_CHANNELS];
}
int InpaintSimpleOperation::mdist(int x, int y)
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
index d5f2c283c72..072246932db 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
@@ -48,6 +48,7 @@ ViewerBaseOperation::ViewerBaseOperation() : NodeOperation()
this->m_doDepthBuffer = false;
this->m_viewSettings = NULL;
this->m_displaySettings = NULL;
+ this->m_ignoreAlpha = false;
}
void ViewerBaseOperation::initExecution()
diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.h b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
index f7d479eb3b8..9f7e80ad6fc 100644
--- a/source/blender/compositor/operations/COM_ViewerBaseOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.h
@@ -39,6 +39,7 @@ protected:
OrderOfChunks m_chunkOrder;
bool m_doDepthBuffer;
ImBuf *m_ibuf;
+ bool m_ignoreAlpha;
const ColorManagedViewSettings *m_viewSettings;
const ColorManagedDisplaySettings *m_displaySettings;
@@ -59,6 +60,7 @@ public:
OrderOfChunks getChunkOrder() { return this->m_chunkOrder; }
const CompositorPriority getRenderPriority() const;
bool isViewerOperation() { return true; }
+ void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; }
void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; }
void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) { this->m_displaySettings = displaySettings; }
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp
index d1ac7d74ead..4d10e49aeeb 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cpp
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp
@@ -89,9 +89,14 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber)
for (y = y1; y < y2 && (!breaked); y++) {
for (x = x1; x < x2; x++) {
this->m_imageInput->read(&(buffer[offset4]), x, y, COM_PS_NEAREST);
- if (this->m_alphaInput != NULL) {
- this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST);
- buffer[offset4 + 3] = alpha[0];
+ if (this->m_ignoreAlpha) {
+ buffer[offset4 + 3] = 1.0f;
+ }
+ else {
+ if (this->m_alphaInput != NULL) {
+ this->m_alphaInput->read(alpha, x, y, COM_PS_NEAREST);
+ buffer[offset4 + 3] = alpha[0];
+ }
}
if (m_depthInput) {
this->m_depthInput->read(depth, x, y, COM_PS_NEAREST);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 3bcb4002ece..06e00cd02c1 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -2268,7 +2268,7 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name)
BLI_addtail(arm->edbo, bone);
- bone->flag |= BONE_TIPSEL | BONE_RELATIVE_PARENTING;
+ bone->flag |= BONE_TIPSEL;
bone->weight = 1.0f;
bone->dist = 0.25f;
bone->xwidth = 0.1f;
@@ -3422,7 +3422,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
copy_v3_v3(newbone->tail, ebone->head);
newbone->parent = ebone->parent;
- newbone->flag = BONE_TIPSEL | BONE_RELATIVE_PARENTING;
+ newbone->flag = BONE_TIPSEL;
if (newbone->parent && (ebone->flag & BONE_CONNECTED)) {
newbone->flag |= BONE_CONNECTED;
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index b2c1b7fdcd0..48c0a4a38c3 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -663,7 +663,7 @@ static int poselib_rename_exec(bContext *C, wmOperator *op)
}
/* get index (and pointer) of pose to remove */
- marker = BLI_findlink(&act->markers, RNA_int_get(op->ptr, "pose"));
+ marker = BLI_findlink(&act->markers, RNA_enum_get(op->ptr, "pose"));
if (marker == NULL) {
BKE_report(op->reports, RPT_ERROR, "Invalid index for pose");
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h
index 1321765588d..4655188a3dd 100644
--- a/source/blender/editors/include/ED_mball.h
+++ b/source/blender/editors/include/ED_mball.h
@@ -32,6 +32,7 @@
#define __ED_MBALL_H__
struct bContext;
+struct MetaBall;
struct Object;
struct wmKeyConfig;
@@ -48,5 +49,6 @@ void load_editMball(struct Object *obedit);
void undo_push_mball(struct bContext *C, const char *name);
-#endif
+void ED_mball_transform(struct MetaBall *mb, float *mat);
+#endif /* __ED_MBALL_H__ */
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 533bfe2fa20..e212f2cc17d 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -83,6 +83,7 @@ typedef enum eParentType {
PAR_ARMATURE_ENVELOPE,
PAR_ARMATURE_AUTO,
PAR_BONE,
+ PAR_BONE_RELATIVE,
PAR_CURVE,
PAR_FOLLOW,
PAR_PATH_CONST,
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4a5f3acad4f..d245349f2c4 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1800,9 +1800,9 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
#ifdef WITH_PYTHON
if (str[0] != '\0') {
- int is_unit_but = ui_is_but_unit(but);
+ bool is_unit_but = (ui_is_but_float(but) && ui_is_but_unit(but));
/* only enable verbose if we won't run again with units */
- if (BPY_button_exec(C, str, value, is_unit_but == FALSE) != -1) {
+ if (BPY_button_exec(C, str, value, is_unit_but == false) != -1) {
/* if the value parsed ok without unit conversion this button may still need a unit multiplier */
if (is_unit_but) {
char str_new[128];
@@ -2781,21 +2781,21 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
return but;
}
-/* ui_def_but_rna_propname and ui_def_but_rna
+static void ui_def_but_rna__disable(uiBut *but)
+{
+ but->flag |= UI_BUT_DISABLED;
+ but->lock = true;
+ but->lockstr = "";
+}
+
+/**
+ * ui_def_but_rna_propname and ui_def_but_rna
* both take the same args except for propname vs prop, this is done so we can
* avoid an extra lookup on 'prop' when its already available.
*
* When this kind of change won't disrupt branches, best look into making more
* of our UI functions take prop rather then propname.
*/
-
-#define UI_DEF_BUT_RNA_DISABLE(but) { \
- but->flag |= UI_BUT_DISABLED; \
- but->lock = TRUE; \
- but->lockstr = ""; \
- } (void)0
-
-
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
int x, int y, short width, short height,
PointerRNA *ptr, PropertyRNA *prop, int index,
@@ -2932,7 +2932,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
if (!RNA_property_editable(&but->rnapoin, prop)) {
- UI_DEF_BUT_RNA_DISABLE(but);
+ ui_def_but_rna__disable(but);
}
if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) {
@@ -2962,7 +2962,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons
else {
but = ui_def_but(block, type, retval, propname, x, y, width, height, NULL, min, max, a1, a2, tip);
- UI_DEF_BUT_RNA_DISABLE(but);
+ ui_def_but_rna__disable(but);
}
return but;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index edd5b901ca1..b166e532f84 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1610,7 +1610,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJump
}
else {
int pos_i = but->pos;
- BLI_str_cursor_step_utf8(str, len, &pos_i, direction, jump);
+ BLI_str_cursor_step_utf8(str, len, &pos_i, direction, jump, true);
but->pos = pos_i;
if (select) {
@@ -1679,7 +1679,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
else if (but->pos >= 0 && but->pos < len) {
int pos = but->pos;
int step;
- BLI_str_cursor_step_utf8(str, len, &pos, direction, jump);
+ BLI_str_cursor_step_utf8(str, len, &pos, direction, jump, true);
step = pos - but->pos;
memmove(&str[but->pos], &str[but->pos + step], (len + 1) - but->pos);
changed = 1;
@@ -1694,7 +1694,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
int pos = but->pos;
int step;
- BLI_str_cursor_step_utf8(str, len, &pos, direction, jump);
+ BLI_str_cursor_step_utf8(str, len, &pos, direction, jump, true);
step = but->pos - pos;
memmove(&str[but->pos - step], &str[but->pos], (len + 1) - but->pos);
but->pos -= step;
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 1b2034d6e40..e466c481151 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -447,8 +447,8 @@ static void ui_draw_panel_dragwidget(const rctf *rect)
ymin = rect->ymin;
ymax = rect->ymax;
- dx = 0.333f * (xmax - xmin);
- dy = 0.333f * (ymax - ymin);
+ dx = (xmax - xmin) / 3.0f;
+ dy = (ymax - ymin) / 3.0f;
glEnable(GL_BLEND);
glColor4ub(255, 255, 255, 50);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 0876e8f362c..5e9a70ea895 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -518,7 +518,8 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
BLF_I18NCONTEXT_ID_CAMERA,
BLF_I18NCONTEXT_ID_WORLD,
BLF_I18NCONTEXT_ID_SCREEN,
- BLF_I18NCONTEXT_ID_TEXT);
+ BLF_I18NCONTEXT_ID_TEXT,
+ );
BLF_I18N_MSGID_MULTI_CTXT("New", BLF_I18NCONTEXT_ID_SPEAKER,
BLF_I18NCONTEXT_ID_SOUND,
BLF_I18NCONTEXT_ID_ARMATURE,
@@ -1856,7 +1857,7 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- bt = uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, "Use Clipping",
+ bt = uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 142ea5128c0..6735c8b173c 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -646,8 +646,8 @@ static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert
for (a = 0; a < totvert; a++) {
quad_strip[a * 2][0] = wtb->outer_v[a][0];
quad_strip[a * 2][1] = wtb->outer_v[a][1];
- quad_strip[a * 2 + 1][0] = wtb->inner_v[a][0];
- quad_strip[a * 2 + 1][1] = wtb->inner_v[a][1];
+ quad_strip[a * 2 + 1][0] = wtb->outer_v[a][0];
+ quad_strip[a * 2 + 1][1] = wtb->outer_v[a][1] - 1.0f;
}
}
@@ -1900,12 +1900,12 @@ static void ui_hsv_cursor(float x, float y)
glTranslatef(x, y, 0.0f);
glColor3f(1.0f, 1.0f, 1.0f);
- glutil_draw_filled_arc(0.0f, M_PI * 2.0, 3.0f, 8);
+ glutil_draw_filled_arc(0.0f, M_PI * 2.0, 3.0f * U.pixelsize, 8);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glColor3f(0.0f, 0.0f, 0.0f);
- glutil_draw_lined_arc(0.0f, M_PI * 2.0, 3.0f, 12);
+ glutil_draw_lined_arc(0.0f, M_PI * 2.0, 3.0f * U.pixelsize, 12);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
@@ -1929,7 +1929,7 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec
static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
{
- const int tot = 32;
+ const int tot = 64;
const float radstep = 2.0f * (float)M_PI / (float)tot;
const float centx = BLI_rcti_cent_x_fl(rect);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 7efda2f56c3..009d52ea283 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -696,6 +696,7 @@ void ui_theme_init_default(void)
ui_widget_color_init(&btheme->tui);
btheme->tui.iconfile[0] = 0;
+ btheme->tui.panel.show_back = FALSE;
btheme->tui.panel.show_header = FALSE;
rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
@@ -713,6 +714,8 @@ void ui_theme_init_default(void)
ui_theme_init_new(btheme);
/* space view3d */
+ btheme->tv3d.panelcolors.show_back = FALSE;
+ btheme->tv3d.panelcolors.show_header = FALSE;
rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
rgba_char_args_set(btheme->tv3d.text, 0, 0, 0, 255);
rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
@@ -1332,7 +1335,6 @@ void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3]
void init_userdef_do_versions(void)
{
Main *bmain = G.main;
-// countall();
/* the UserDef struct is not corrected with do_versions() .... ugh! */
if (U.wheellinescroll == 0) U.wheellinescroll = 3;
@@ -2121,7 +2123,8 @@ void init_userdef_do_versions(void)
}
}
- if (bmain->versionfile < 266) {
+ /* NOTE!! from now on use U.versionfile and U.subversionfile */
+ if (U.versionfile < 266) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
@@ -2133,7 +2136,7 @@ void init_userdef_do_versions(void)
}
}
- if (!MAIN_VERSION_ATLEAST(bmain, 265, 4)) {
+ if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 4)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */
@@ -2142,14 +2145,14 @@ void init_userdef_do_versions(void)
}
}
- if (!MAIN_VERSION_ATLEAST(bmain, 265, 6)) {
+ if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 6)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
copy_v4_v4_char(btheme->tv3d.gradients.high_gradient, btheme->tv3d.back);
}
}
- if (!MAIN_VERSION_ATLEAST(bmain, 265, 9)) {
+ if (U.versionfile < 265 || (U.versionfile == 265 && U.subversionfile < 9)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_test_set(btheme->tnode.syntaxs, 151, 116, 116, 255); /* matte nodes */
@@ -2157,6 +2160,9 @@ void init_userdef_do_versions(void)
}
}
+ /* NOTE!! from now on use U.versionfile and U.subversionfile */
+
+
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 2004b18adf6..7703a8638c9 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -319,14 +319,12 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
import_units = RNA_boolean_get(op->ptr, "import_units");
RNA_string_get(op->ptr, "filepath", filename);
- if (collada_import( C,
- filename,
- import_units)) {
- return OPERATOR_FINISHED;
+ if (collada_import(C, filename, import_units)) {
+ return OPERATOR_FINISHED;
}
else {
- BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
- return OPERATOR_CANCELLED;
+ BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
+ return OPERATOR_CANCELLED;
}
}
@@ -368,8 +366,10 @@ void WM_OT_collada_import(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
- RNA_def_boolean(ot->srna, "import_units", 0, "Import Units",
- "If enabled use Units as defined in Collada Import, else keep Blender's current Units settings");
+ RNA_def_boolean(ot->srna,
+ "import_units", 0, "Import Units",
+ "If disabled match import to Blender's current Unit settings, "
+ "otherwise use the settings from the Imported scene");
}
#endif
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 647bb6c1d77..b58e393811d 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1744,9 +1744,9 @@ void MESH_OT_vertices_smooth_laplacian(wmOperatorType *ot)
"Lambda factor", "", 0.0000001f, 1000.0f);
RNA_def_float(ot->srna, "lambda_border", 0.00005f, 0.0000001f, 1000.0f,
"Lambda factor in border", "", 0.0000001f, 1000.0f);
- RNA_def_boolean(ot->srna, "use_x", 1, "Smooth X Axis", "Smooth object along X axis");
- RNA_def_boolean(ot->srna, "use_y", 1, "Smooth Y Axis", "Smooth object along Y axis");
- RNA_def_boolean(ot->srna, "use_z", 1, "Smooth Z Axis", "Smooth object along Z axis");
+ RNA_def_boolean(ot->srna, "use_x", 1, "Smooth X Axis", "Smooth object along X axis");
+ RNA_def_boolean(ot->srna, "use_y", 1, "Smooth Y Axis", "Smooth object along Y axis");
+ RNA_def_boolean(ot->srna, "use_z", 1, "Smooth Z Axis", "Smooth object along Z axis");
RNA_def_boolean(ot->srna, "preserve_volume", 1, "Preserve Volume", "Apply volume preservation after smooth");
}
@@ -4977,7 +4977,7 @@ static float edbm_bevel_mval_factor(wmOperator *op, wmEvent *event)
if (event->shift) {
if (opdata->shift_factor < 0.0f) {
#ifdef NEW_BEVEL
- opdata->shift_factor = RNA_float_get(op->ptr, "percent");
+ opdata->shift_factor = RNA_float_get(op->ptr, "offset");
#else
opdata->shift_factor = RNA_float_get(op->ptr, "factor");
#endif
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 96b8f1080b9..cb69faa5b51 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -502,6 +502,9 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* tessface data removed above, no need to update */
mesh_update_customdata_pointers(me, FALSE);
+
+ /* update normals in case objects with non-uniform scale are joined */
+ ED_mesh_calc_normals(me);
/* old material array */
for (a = 1; a <= ob->totcol; a++) {
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index 8633a7a9b38..6c056df5a38 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -586,3 +586,27 @@ void undo_push_mball(bContext *C, const char *name)
undo_editmode_push(C, name, get_data, free_undoMball, undoMball_to_editMball, editMball_to_undoMball, NULL);
}
+/* matrix is 4x4 */
+void ED_mball_transform(MetaBall *mb, float *mat)
+{
+ MetaElem *me;
+ float quat[4];
+ const float scale = mat4_to_scale((float (*)[4])mat);
+ const float scale_sqrt = sqrtf(scale);
+
+ mat4_to_quat(quat, (float (*)[4])mat);
+
+ for (me = mb->elems.first; me; me = me->next) {
+ mul_m4_v3((float (*)[4])mat, &me->x);
+ mul_qt_qtqt(me->quat, quat, me->quat);
+ me->rad *= scale;
+ /* hrmf, probably elems shouldn't be
+ * treating scale differently - campbell */
+ if (!MB_TYPE_SIZE_SQUARED(me->type)) {
+ mul_v3_fl(&me->expx, scale);
+ }
+ else {
+ mul_v3_fl(&me->expx, scale_sqrt);
+ }
+ }
+}
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c
index e98654f589a..f91d57424a1 100644
--- a/source/blender/editors/metaball/mball_ops.c
+++ b/source/blender/editors/metaball/mball_ops.c
@@ -28,10 +28,6 @@
* \ingroup edmeta
*/
-
-#include "WM_api.h"
-#include "WM_types.h"
-
#include "RNA_access.h"
#include "ED_mball.h"
@@ -40,6 +36,9 @@
#include "BLI_utildefines.h"
+#include "WM_api.h"
+#include "WM_types.h"
+
#include "mball_intern.h"
void ED_operatortypes_metaball(void)
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 05c042a4182..a92b25c6c85 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -20,6 +20,7 @@
set(INC
../include
+ ../../blenfont
../../blenkernel
../../blenlib
../../blenloader
@@ -66,4 +67,8 @@ if(WITH_GAMEENGINE)
add_definitions(-DWITH_GAMEENGINE)
endif()
+if(WITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
blender_add_lib(bf_editor_object "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript
index df51198df92..203d7dff768 100644
--- a/source/blender/editors/object/SConscript
+++ b/source/blender/editors/object/SConscript
@@ -29,7 +29,7 @@ Import ('env')
sources = env.Glob('*.c')
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf'
incs += ' ../../windowmanager #/intern/guardedalloc ../../blenloader'
incs += ' ../../makesrna ../../python ../../ikplugin ../../bmesh'
incs += ' ../../render/extern/include ../../gpu' # for object_bake.c
@@ -50,4 +50,7 @@ if env['WITH_BF_PYTHON']:
if env['WITH_BF_GAMEENGINE']:
defs.append('WITH_GAMEENGINE')
+if env['WITH_BF_INTERNATIONAL']:
+ defs.append('WITH_INTERNATIONAL')
+
env.BlenderLib ( 'bf_editors_object', sources, Split(incs), defs, libtype=['core'], priority=[35] )
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 6cb7cd5e326..7746329c17f 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -718,81 +718,87 @@ void CONSTRAINT_OT_limitdistance_reset(wmOperatorType *ot)
/* ------------- Child-Of Constraint ------------------ */
-static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, float invmat[4][4])
+static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, float invmat[4][4], const int owner)
{
- bConstraint *lastcon = NULL;
- bPoseChannel *pchan = NULL;
-
/* nullify inverse matrix first */
unit_m4(invmat);
- /* try to find a pose channel - assume that this is the constraint owner */
- /* TODO: get from context instead? */
- if (ob && ob->pose)
- pchan = BKE_pose_channel_active(ob);
-
- /* calculate/set inverse matrix:
- * We just calculate all transform-stack eval up to but not including this constraint.
- * This is because inverse should just inverse correct for just the constraint's influence
- * when it gets applied; that is, at the time of application, we don't know anything about
- * what follows.
- */
- if (pchan) {
- float imat[4][4], tmat[4][4];
- float pmat[4][4];
-
- /* 1. calculate posemat where inverse doesn't exist yet (inverse was cleared above),
- * to use as baseline ("pmat") to derive delta from. This extra calc saves users
- * from having pressing "Clear Inverse" first
- */
- BKE_pose_where_is(scene, ob);
- copy_m4_m4(pmat, pchan->pose_mat);
-
- /* 2. knock out constraints starting from this one */
- lastcon = pchan->constraints.last;
- pchan->constraints.last = con->prev;
-
- if (con->prev) {
- /* new end must not point to this one, else this chain cutting is useless */
- con->prev->next = NULL;
- }
- else {
- /* constraint was first */
- pchan->constraints.first = NULL;
- }
-
- /* 3. solve pose without disabled constraints */
- BKE_pose_where_is(scene, ob);
-
- /* 4. determine effect of constraint by removing the newly calculated
- * pchan->pose_mat from the original pchan->pose_mat, thus determining
- * the effect of the constraint
- */
- invert_m4_m4(imat, pchan->pose_mat);
- mult_m4_m4m4(tmat, pmat, imat);
- invert_m4_m4(invmat, tmat);
-
- /* 5. restore constraints */
- pchan->constraints.last = lastcon;
-
- if (con->prev) {
- /* hook up prev to this one again */
- con->prev->next = con;
- }
- else {
- /* set as first again */
- pchan->constraints.first = con;
+ if (owner == EDIT_CONSTRAINT_OWNER_BONE) {
+ bPoseChannel *pchan;
+ /* try to find a pose channel - assume that this is the constraint owner */
+ /* TODO: get from context instead? */
+ if (ob && ob->pose && (pchan = BKE_pose_channel_active(ob))) {
+ bConstraint *con_last;
+ /* calculate/set inverse matrix:
+ * We just calculate all transform-stack eval up to but not including this constraint.
+ * This is because inverse should just inverse correct for just the constraint's influence
+ * when it gets applied; that is, at the time of application, we don't know anything about
+ * what follows.
+ */
+ float imat[4][4], tmat[4][4];
+ float pmat[4][4];
+
+ /* make sure we passed the correct constraint */
+ BLI_assert(BLI_findindex(&pchan->constraints, con) != -1);
+
+ /* 1. calculate posemat where inverse doesn't exist yet (inverse was cleared above),
+ * to use as baseline ("pmat") to derive delta from. This extra calc saves users
+ * from having pressing "Clear Inverse" first
+ */
+ BKE_pose_where_is(scene, ob);
+ copy_m4_m4(pmat, pchan->pose_mat);
+
+ /* 2. knock out constraints starting from this one */
+ con_last = pchan->constraints.last;
+ pchan->constraints.last = con->prev;
+
+ if (con->prev) {
+ /* new end must not point to this one, else this chain cutting is useless */
+ con->prev->next = NULL;
+ }
+ else {
+ /* constraint was first */
+ pchan->constraints.first = NULL;
+ }
+
+ /* 3. solve pose without disabled constraints */
+ BKE_pose_where_is(scene, ob);
+
+ /* 4. determine effect of constraint by removing the newly calculated
+ * pchan->pose_mat from the original pchan->pose_mat, thus determining
+ * the effect of the constraint
+ */
+ invert_m4_m4(imat, pchan->pose_mat);
+ mult_m4_m4m4(tmat, pmat, imat);
+ invert_m4_m4(invmat, tmat);
+
+ /* 5. restore constraints */
+ pchan->constraints.last = con_last;
+
+ if (con->prev) {
+ /* hook up prev to this one again */
+ con->prev->next = con;
+ }
+ else {
+ /* set as first again */
+ pchan->constraints.first = con;
+ }
+
+ /* 6. recalculate pose with new inv-mat applied */
+ BKE_pose_where_is(scene, ob);
}
-
- /* 6. recalculate pose with new inv-mat applied */
- BKE_pose_where_is(scene, ob);
}
- else if (ob) {
- Object workob;
-
- /* use BKE_object_workob_calc_parent to find inverse - just like for normal parenting */
- BKE_object_workob_calc_parent(scene, ob, &workob);
- invert_m4_m4(invmat, workob.obmat);
+ if (owner == EDIT_CONSTRAINT_OWNER_OBJECT) {
+ if (ob) {
+ Object workob;
+
+ /* make sure we passed the correct constraint */
+ BLI_assert(BLI_findindex(&ob->constraints, con) != -1);
+
+ /* use BKE_object_workob_calc_parent to find inverse - just like for normal parenting */
+ BKE_object_workob_calc_parent(scene, ob, &workob);
+ invert_m4_m4(invmat, workob.obmat);
+ }
}
}
@@ -803,6 +809,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
+ const int owner = RNA_enum_get(op->ptr, "owner");
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
@@ -811,7 +818,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- child_get_inverse_matrix(scene, ob, con, data->invmat);
+ child_get_inverse_matrix(scene, ob, con, data->invmat, owner);
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
@@ -1024,6 +1031,7 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
+ const int owner = RNA_enum_get(op->ptr, "owner");
/* despite 3 layers of checks, we may still not be able to find a constraint */
if (data == NULL) {
@@ -1032,7 +1040,7 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- child_get_inverse_matrix(scene, ob, con, data->invmat);
+ child_get_inverse_matrix(scene, ob, con, data->invmat, owner);
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index caeff1e82a7..1387ef94091 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -386,6 +386,31 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
}
}
+static void object_hook_from_context(bContext *C, PointerRNA *ptr, const int num,
+ Object **r_ob, HookModifierData **r_hmd)
+{
+ Object *ob;
+ HookModifierData *hmd;
+
+ if (ptr->data) { /* if modifier context is available, use that */
+ ob = ptr->id.data;
+ hmd = ptr->data;
+ }
+ else { /* use the provided property */
+ ob = CTX_data_edit_object(C);
+ hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
+ }
+
+ if (ob && hmd && (hmd->modifier.type == eModifierType_Hook)) {
+ *r_ob = ob;
+ *r_hmd = hmd;
+ }
+ else {
+ *r_ob = NULL;
+ *r_hmd = NULL;
+ }
+}
+
static void object_hook_select(Object *ob, HookModifierData *hmd)
{
if (hmd->indexar == NULL)
@@ -663,16 +688,9 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
int num = RNA_enum_get(op->ptr, "modifier");
Object *ob = NULL;
HookModifierData *hmd = NULL;
-
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
@@ -732,15 +750,8 @@ static int object_hook_recenter_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
float bmat[3][3], imat[3][3];
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
@@ -790,15 +801,8 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
char name[MAX_NAME];
int *indexar, tot;
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
@@ -852,15 +856,8 @@ static int object_hook_select_exec(bContext *C, wmOperator *op)
Object *ob = NULL;
HookModifierData *hmd = NULL;
- if (ptr.data) { /* if modifier context is available, use that */
- ob = ptr.id.data;
- hmd = ptr.data;
- }
- else { /* use the provided property */
- ob = CTX_data_edit_object(C);
- hmd = (HookModifierData *)BLI_findlink(&ob->modifiers, num);
- }
- if (!ob || !hmd) {
+ object_hook_from_context(C, &ptr, num, &ob, &hmd);
+ if (hmd == NULL) {
BKE_report(op->reports, RPT_ERROR, "Could not find hook modifier");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 7d3d6861418..00082b03781 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1196,6 +1196,11 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
+
+ if (ob->mode & OB_MODE_SCULPT) {
+ /* ensure that grid paint mask layer is created */
+ ED_sculpt_mask_layers_ensure(ob, mmd);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 33b159f3cf2..629dba465bc 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -35,6 +35,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
+#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
#include "DNA_constraint_types.h"
#include "DNA_group_types.h"
@@ -55,6 +56,8 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_action.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
@@ -578,6 +581,7 @@ EnumPropertyItem prop_make_parent_types[] = {
{PAR_ARMATURE_AUTO, "ARMATURE_AUTO", 0, " With Automatic Weights", ""},
{PAR_ARMATURE_ENVELOPE, "ARMATURE_ENVELOPE", 0, " With Envelope Weights", ""},
{PAR_BONE, "BONE", 0, "Bone", ""},
+ {PAR_BONE_RELATIVE, "BONE_RELATIVE", 0, "Bone Relative", ""},
{PAR_CURVE, "CURVE", 0, "Curve Deform", ""},
{PAR_FOLLOW, "FOLLOW", 0, "Follow Path", ""},
{PAR_PATH_CONST, "PATH_CONST", 0, "Path Constraint", ""},
@@ -624,7 +628,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
partype = PAR_OBJECT;
}
}
- else if (partype == PAR_BONE) {
+ else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) {
pchan = BKE_pose_channel_active(par);
if (pchan == NULL) {
@@ -705,8 +709,16 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object
}
}
}
- else if (partype == PAR_BONE)
+ else if (partype == PAR_BONE) {
+ ob->partype = PARBONE; /* note, dna define, not operator property */
+ if (pchan->bone)
+ pchan->bone->flag &= ~BONE_RELATIVE_PARENTING;
+ }
+ else if (partype == PAR_BONE_RELATIVE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
+ if (pchan->bone)
+ pchan->bone->flag |= BONE_RELATIVE_PARENTING;
+ }
else
ob->partype = PAROBJECT; /* note, dna define, not operator property */
@@ -791,7 +803,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
Object *ob = ED_object_active_context(C);
- uiPopupMenu *pup = uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
+ uiPopupMenu *pup = uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE);
uiLayout *layout = uiPupMenuLayout(pup);
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", TRUE);
@@ -800,11 +812,12 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
#if 0
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_OBJECT);
#else
- opptr = uiItemFullO_ptr(layout, ot, "Object", ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ opptr = uiItemFullO_ptr(layout, ot, IFACE_("Object"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&opptr, "type", PAR_OBJECT);
RNA_boolean_set(&opptr, "keep_transform", FALSE);
- opptr = uiItemFullO_ptr(layout, ot, "Object (Keep Transform)", ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+ opptr = uiItemFullO_ptr(layout, ot, IFACE_("Object (Keep Transform)"), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT,
+ UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&opptr, "type", PAR_OBJECT);
RNA_boolean_set(&opptr, "keep_transform", TRUE);
#endif
@@ -815,6 +828,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO);
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE);
+ uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE);
}
else if (ob->type == OB_CURVE) {
uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 68075e7b6f9..9dd34623739 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -67,6 +67,7 @@
#include "ED_armature.h"
#include "ED_keyframing.h"
+#include "ED_mball.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -407,6 +408,12 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
change = 0;
}
}
+ else if (ob->type == OB_MBALL) {
+ if (ID_REAL_USERS(ob->data) > 1) {
+ BKE_report(reports, RPT_ERROR, "Cannot apply to a multi user metaball, doing nothing");
+ change = 0;
+ }
+ }
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu;
@@ -516,6 +523,10 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
bp++;
}
}
+ else if (ob->type == OB_MBALL) {
+ MetaBall *mb = ob->data;
+ ED_mball_transform(mb, (float *)mat);
+ }
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
Curve *cu = ob->data;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index a1fb0eb98d2..87ff42ef4db 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -3151,7 +3151,7 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, 1.0, "Limit", "Remove weights under this limit", 0.001f, 0.99f);
+ RNA_def_float(ot->srna, "limit", 0.0f, 0.0f, 1.0, "Limit", "Remove weights under this limit", 0.0f, 0.99f);
RNA_def_boolean(ot->srna, "all_groups", FALSE, "All Groups", "Clean all vertex groups");
RNA_def_boolean(ot->srna, "keep_single", FALSE, "Keep Single",
"Keep verts assigned to at least one group when cleaning");
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index c51b3ca4c43..ecc7ea4ae00 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -304,7 +304,9 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
if (blender_test_break()) return 0;
/* Update progress bar cursor */
- WM_cursor_time(win, (int)progress);
+ if (!G.background) {
+ WM_cursor_time(win, (int)progress);
+ }
/* calculate a frame */
scene->r.cfra = (int)frame;
@@ -346,6 +348,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
*/
static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
{
+ wmWindow *win = CTX_wm_window(C);
DynamicPaintModifierData *pmd = NULL;
DynamicPaintCanvasSettings *canvas;
Object *ob = ED_object_context(C);
@@ -379,7 +382,9 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
status = dynamicPaint_bakeImageSequence(C, surface, ob);
/* Clear bake */
canvas->flags &= ~MOD_DPAINT_BAKING;
- WM_cursor_restore(CTX_wm_window(C));
+ if (!G.background) {
+ WM_cursor_restore(win);
+ }
dynamicPaint_freeSurfaceData(surface);
/* Bake was successful:
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 78377834b9f..31079de275e 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -1112,7 +1112,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
mul_v3_fl(vec, 0.25);
}
else
- mul_v3_fl(vec, 0.3333f);
+ mul_v3_fl(vec, 1.0f / 3.0f);
normalize_v3(nor);
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index b2f53379090..a72a409f277 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -133,7 +133,6 @@ static int rigidbody_con_add_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -181,7 +180,6 @@ static int rigidbody_con_remove_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index 9ce4656d4cd..2bf962f4f4a 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -93,11 +93,6 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type)
{
RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
- /* check that object doesn't already belong to the current simulation */
- if (ob->rigidbody_object) {
- BKE_reportf(op->reports, RPT_INFO, "Object '%s' already has a Rigid Body", ob->id.name + 2);
- return;
- }
if (ob->type != OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Can't add Rigid Body to non mesh object");
return;
@@ -118,11 +113,16 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type)
}
/* make rigidbody object settings */
- ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, type);
+ if (ob->rigidbody_object == NULL) {
+ ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, type);
+ }
+ ob->rigidbody_object->type = type;
ob->rigidbody_object->flag |= RBO_FLAG_NEEDS_VALIDATE;
/* add object to rigid body group */
add_to_group(rbw->group, ob, scene, NULL);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
}
void ED_rigidbody_ob_remove(Scene *scene, Object *ob)
@@ -154,7 +154,6 @@ static int rigidbody_ob_add_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -201,7 +200,6 @@ static int rigidbody_ob_remove_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -247,7 +245,7 @@ static int rigidbody_obs_add_exec(bContext *C, wmOperator *op)
DAG_ids_flush_update(CTX_data_main(C), 0);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
return OPERATOR_FINISHED;
@@ -293,8 +291,7 @@ static int rigidbody_obs_remove_exec(bContext *C, wmOperator *UNUSED(op))
/* send updates */
DAG_ids_flush_update(CTX_data_main(C), 0);
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c
index 5ab8e7697c5..babe32c74b2 100644
--- a/source/blender/editors/physics/rigidbody_world.c
+++ b/source/blender/editors/physics/rigidbody_world.c
@@ -128,9 +128,6 @@ static int rigidbody_world_remove_exec(bContext *C, wmOperator *op)
BKE_rigidbody_free_world(rbw);
scene->rigidbody_world = NULL;
- /* send updates */
- WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
-
/* done */
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 994c7275ecd..dfc80e4cf51 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -360,7 +360,11 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
}
}
-
+ else {
+ /* use current scene world to light sphere */
+ if (mat->pr_type == MA_SPHERE_A)
+ sce->world = scene->world;
+ }
if (sp->pr_method == PR_ICON_RENDER) {
if (mat->material_type == MA_TYPE_HALO) {
@@ -926,8 +930,10 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
* already there. Very expensive for large images. Need to find a way to
* only get existing ibuf */
ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
- if (ibuf == NULL || ibuf->rect == NULL)
+ if (ibuf == NULL || ibuf->rect == NULL) {
+ BKE_image_release_ibuf(ima, ibuf, NULL);
return;
+ }
icon_copy_rect(ibuf, sp->sizex, sp->sizey, sp->pr_rect);
@@ -1019,6 +1025,7 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short
sp->pr_method = PR_ICON_RENDER;
sp->pr_rect = cur_size->rect;
sp->id = ip->id;
+ sp->pr_main = pr_main;
common_preview_startjob(sp, stop, do_update, progress);
shader_preview_free(sp);
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index f15f7b539f3..8b2ac740e47 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -289,7 +289,10 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
/* is there another window showing result? */
for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
- if (win->screen->temp || (win == winshow && winshow != wincur)) {
+ bScreen *sc = win->screen;
+ if ((sc->temp && ((ScrArea *)sc->areabase.first)->spacetype == SPACE_IMAGE) ||
+ (win == winshow && winshow != wincur))
+ {
wm_window_raise(win);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index da2facc244a..12a7a33c893 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2963,7 +2963,7 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U
uiPopupMenu *pup;
uiLayout *layout;
- pup = uiPupMenuBegin(C, N_("Header"), ICON_NONE);
+ pup = uiPupMenuBegin(C, IFACE_("Header"), ICON_NONE);
layout = uiPupMenuLayout(pup);
ED_screens_header_tools_menu_create(C, layout, NULL);
@@ -3597,7 +3597,7 @@ static void SCENE_OT_delete(wmOperatorType *ot)
/* ***************** region alpha blending ***************** */
-/* implementation note: a disapplearing region needs at least 1 last draw with 100% backbuffer
+/* implementation note: a disappearing region needs at least 1 last draw with 100% backbuffer
* texture over it- then triple buffer will clear it entirely.
* This because flag RGN_HIDDEN is set in end - region doesnt draw at all then */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 74399857a97..1f8c06f6bf7 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -140,7 +140,7 @@ BLI_INLINE unsigned char f_to_char(const float val)
#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
#define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
-static void imapaint_image_update(Scene *scene, SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint);
+static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint);
typedef struct ImagePaintState {
@@ -904,7 +904,7 @@ static int project_paint_occlude_ptv_clip(const ProjPaintState *ps, const MFace
/* Check if a screenspace location is occluded by any other faces
* check, pixelScreenCo must be in screenspace, its Z-Depth only needs to be used for comparison
- * and dosn't need to be correct in relation to X and Y coords (this is the case in perspective view) */
+ * and doesn't need to be correct in relation to X and Y coords (this is the case in perspective view) */
static int project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *bucketFace, const int orig_face, float pixelScreenCo[4])
{
MFace *mf;
@@ -3656,7 +3656,7 @@ static int project_image_refresh_tagged(ProjPaintState *ps)
pr = &(projIma->partRedrawRect[i]);
if (pr->x2 != -1) { /* TODO - use 'enabled' ? */
imapaintpartial = *pr;
- imapaint_image_update(NULL, NULL, projIma->ima, projIma->ibuf, 1); /*last 1 is for texpaint*/
+ imapaint_image_update(NULL, projIma->ima, projIma->ibuf, 1); /*last 1 is for texpaint*/
redraw = 1;
}
}
@@ -4417,16 +4417,13 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
IMB_freeImBuf(tmpibuf);
}
-static void imapaint_image_update(Scene *scene, SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
+static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
{
- if (scene) {
- IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect, ibuf->x, 0, 0,
- &scene->view_settings, &scene->display_settings,
- imapaintpartial.x1, imapaintpartial.y1,
- imapaintpartial.x2, imapaintpartial.y2, FALSE);
- }
- else {
- ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+ if (imapaintpartial.x1 != imapaintpartial.x2 &&
+ imapaintpartial.y1 != imapaintpartial.y2)
+ {
+ IMB_partial_display_buffer_update_delayed(ibuf, imapaintpartial.x1, imapaintpartial.y1,
+ imapaintpartial.x2, imapaintpartial.y2);
}
if (ibuf->mipmap[0])
@@ -4790,7 +4787,7 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter,
*/
if (BKE_brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s, is_data == FALSE)) {
if (update)
- imapaint_image_update(s->scene, s->sima, image, ibuf, texpaint);
+ imapaint_image_update(s->sima, image, ibuf, texpaint);
BKE_image_release_ibuf(image, ibuf, NULL);
return 1;
}
@@ -5019,23 +5016,29 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
{
Scene *scene = CTX_data_scene(C);
ToolSettings *settings = scene->toolsettings;
- Brush *brush = paint_brush(&settings->imapaint.paint);
/* brush */
- ps->brush = brush;
- ps->tool = brush->imagepaint_tool;
- ps->blend = brush->blend;
+ ps->brush = paint_brush(&settings->imapaint.paint);
+ if (ps->brush) {
+ Brush *brush = ps->brush;
+ ps->tool = brush->imagepaint_tool;
+ ps->blend = brush->blend;
+
+ /* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
+ ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
+ brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
+ ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
+ }
+ else {
+ /* brush may be NULL*/
+ ps->do_masking = false;
+ ps->is_texbrush = false;
+ }
/* sizeof ProjPixel, since we alloc this a _lot_ */
ps->pixel_sizeof = project_paint_pixel_sizeof(ps->tool);
BLI_assert(ps->pixel_sizeof >= sizeof(ProjPixel));
- /* disable for 3d mapping also because painting on mirrored mesh can create "stripes" */
- ps->do_masking = (brush->flag & BRUSH_AIRBRUSH || brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW ||
- brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) ? false : true;
- ps->is_texbrush = (brush->mtex.tex) ? 1 : 0;
-
-
/* these can be NULL */
ps->v3d = CTX_wm_view3d(C);
ps->rv3d = CTX_wm_region_view3d(C);
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 0b76c88df66..84250853f38 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -197,8 +197,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf,
for (x = origx; x < w; x++, bf += 4, mf += 4, tf += 4) {
if (dotexold) {
- copy_v3_v3(tf, otf);
- tf[3] = otf[3];
+ copy_v4_v4(tf, otf);
otf += 4;
}
else {
@@ -249,7 +248,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf,
}
}
-static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const float pos[2])
+static void brush_painter_tiled_tex_partial_update(BrushPainter *painter, const float pos[2])
{
const Scene *scene = painter->scene;
Brush *brush = painter->brush;
@@ -265,7 +264,6 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const
oldtexibuf = cache->texibuf;
cache->texibuf = IMB_allocImBuf(diameter, diameter, 32, imbflag);
-
if (oldtexibuf) {
srcx = srcy = 0;
destx = (int)painter->lastpaintpos[0] - (int)pos[0];
@@ -334,7 +332,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2
if (do_tiled) {
BKE_brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction);
- brush_painter_fixed_tex_partial_update(painter, pos);
+ brush_painter_tiled_tex_partial_update(painter, pos);
}
else
BKE_brush_imbuf_new(scene, brush, flt, 2, size, &cache->ibuf, use_color_correction);
@@ -348,7 +346,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2
int dy = (int)painter->lastpaintpos[1] - (int)pos[1];
if ((dx != 0) || (dy != 0))
- brush_painter_fixed_tex_partial_update(painter, pos);
+ brush_painter_tiled_tex_partial_update(painter, pos);
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 408572c7979..ba33ad22f92 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -721,8 +721,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
/* these keys are from 2.4x but could be changed */
- WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
- WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample_group", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample_group", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_LINEAR);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_RADIAL);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 956f8d2c136..8ff2a68013c 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -3182,8 +3182,11 @@ static int paint_weight_gradient_modal(bContext *C, wmOperator *op, wmEvent *eve
VPaint *wp = ts->wpaint;
Object *ob = CTX_data_active_object(C);
Mesh *me = ob->data;
- BKE_defvert_array_copy(me->dvert, wp->wpaint_prev, me->totvert);
- free_wpaint_prev(wp);
+ if (wp->wpaint_prev) {
+ BKE_defvert_array_free_elems(me->dvert, me->totvert);
+ BKE_defvert_array_copy(me->dvert, wp->wpaint_prev, me->totvert);
+ free_wpaint_prev(wp);
+ }
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
@@ -3200,6 +3203,7 @@ static int paint_weight_gradient_modal(bContext *C, wmOperator *op, wmEvent *eve
static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
{
wmGesture *gesture = op->customdata;
+ DMGradient_vertStore *vert_cache;
struct ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
@@ -3210,24 +3214,31 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
int y_end = RNA_int_get(op->ptr, "yend");
float sco_start[2] = {x_start, y_start};
float sco_end[2] = {x_end, y_end};
-
+ const bool is_interactive = (gesture != NULL);
DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
DMGradient_userData data = {0};
- if (gesture->userdata == NULL) {
- VPaint *wp = scene->toolsettings->wpaint;
+ if (is_interactive) {
+ if (gesture->userdata == NULL) {
+ VPaint *wp = scene->toolsettings->wpaint;
- gesture->userdata = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
- data.is_init = TRUE;
+ gesture->userdata = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
+ data.is_init = true;
- copy_wpaint_prev(wp, me->dvert, me->totvert);
+ copy_wpaint_prev(wp, me->dvert, me->totvert);
- /* on init only, convert face -> vert sel */
- if (me->editflag & ME_EDIT_PAINT_FACE_SEL) {
- BKE_mesh_flush_select_from_polys(me);
+ /* on init only, convert face -> vert sel */
+ if (me->editflag & ME_EDIT_PAINT_FACE_SEL) {
+ BKE_mesh_flush_select_from_polys(me);
+ }
}
+ vert_cache = gesture->userdata;
+ }
+ else {
+ data.is_init = true;
+ vert_cache = MEM_mallocN(sizeof(DMGradient_vertStore) * me->totvert, __func__);
}
data.ar = ar;
@@ -3238,7 +3249,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
data.sco_line_div = 1.0f / len_v2v2(sco_start, sco_end);
data.def_nr = ob->actdef - 1;
data.use_select = (me->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL));
- data.vert_cache = gesture->userdata;
+ data.vert_cache = vert_cache;
data.type = RNA_enum_get(op->ptr, "type");
{
@@ -3254,6 +3265,10 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ if (is_interactive == false) {
+ MEM_freeN(vert_cache);
+ }
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index e56962a3964..fa1bdd6ca82 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -73,7 +73,7 @@ void sculpt_pbvh_clear(Object *ob);
void sculpt_update_after_dynamic_topology_toggle(bContext *C);
void sculpt_dynamic_topology_enable(struct bContext *C);
void sculpt_dynamic_topology_disable(struct bContext *C,
- struct SculptUndoNode *unode);
+ struct SculptUndoNode *unode);
/* Undo */
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 3c2d9ac2eee..19bfe05e8a4 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -97,14 +97,15 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
sbuts->mainbuser = sbuts->mainb;
}
-#define BUT_UNIT_X (UI_UNIT_X + 2)
+#define BUT_UNIT_X (UI_UNIT_X + 2 * U.pixelsize)
void buttons_header_buttons(const bContext *C, ARegion *ar)
{
SpaceButs *sbuts = CTX_wm_space_buts(C);
uiBlock *block;
uiBut *but;
- int xco, yco = 2;
+ int headery = ED_area_headersize();
+ int xco, yco = 0.5f * (headery - UI_UNIT_Y);
buttons_context_compute(C, sbuts);
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 54261974993..8b6682ff1c9 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -40,6 +40,8 @@
#include "BLI_string.h"
#include "BLI_utildefines.h"
+#include "BLF_translation.h"
+
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -70,7 +72,7 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e
RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr);
- pup = uiPupMenuBegin(C, "Align", ICON_NONE);
+ pup = uiPupMenuBegin(C, IFACE_("Align"), ICON_NONE);
layout = uiPupMenuLayout(pup);
uiItemsEnumR(layout, &ptr, "align");
uiPupMenuEnd(C, pup);
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index cc1b8d444bc..09d97c36436 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -159,7 +159,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
MovieTrackingDopesheetChannel *channel;
float y, xscale, yscale;
float strip[4], selected_strip[4];
- float height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2);
+ float height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT);
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
@@ -272,7 +272,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
tracking = &clip->tracking;
dopesheet = &tracking->dopesheet;
- height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2);
+ height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT);
if (height > BLI_rcti_size_y(&v2d->mask)) {
/* don't use totrect set, as the width stays the same
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 9d0421349d7..f0c0e7b72fd 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1282,6 +1282,9 @@ static void clip_channels_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ /* ensure the 2d view sync works - main region has bottom scroller */
+ ar->v2d.scroll = V2D_SCROLL_BOTTOM;
+
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
keymap = WM_keymap_find(wm->defaultconf, "Clip Dopesheet Editor", SPACE_CLIP, 0);
@@ -1293,7 +1296,6 @@ static void clip_channels_area_draw(const bContext *C, ARegion *ar)
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
View2D *v2d = &ar->v2d;
- View2DScrollers *scrollers;
if (clip)
BKE_tracking_dopesheet_update(&clip->tracking);
@@ -1309,11 +1311,6 @@ static void clip_channels_area_draw(const bContext *C, ARegion *ar)
/* reset view matrix */
UI_view2d_view_restore(C);
-
- /* scrollers */
- scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
- UI_view2d_scrollers_draw(C, v2d, scrollers);
- UI_view2d_scrollers_free(scrollers);
}
static void clip_channels_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 22c260de1a1..c195cb39157 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -158,9 +158,9 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
if (tvc->iter_index == 0) {
const SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
const ConsoleLine *cl = (ConsoleLine *)sc->history.last;
- const int prompt_len = strlen(sc->prompt);
- const int cursor_loc = cl->cursor + prompt_len;
- const int line_len = cl->len + prompt_len;
+ const int prompt_len = BLI_strlen_utf8(sc->prompt);
+ const int cursor_loc = BLI_strnlen_utf8(cl->line, cl->cursor) + prompt_len;
+ const int line_len = BLI_strlen_utf8(cl->line) + prompt_len;
int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
int pen[2];
xy[1] += tvc->lheight / 6;
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 36716aeab95..1242d123a41 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -34,11 +34,12 @@
#include "DNA_userdef_types.h"
+#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_string_cursor_utf8.h"
+#include "BLI_string_utf8.h"
#include "BLI_string.h"
#include "BLI_dynstr.h"
-#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BKE_context.h"
@@ -283,28 +284,28 @@ static int console_move_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- STRCUR_JUMP_ALL);
+ STRCUR_JUMP_ALL, true);
done = console_line_cursor_set(ci, pos);
break;
case LINE_END:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- STRCUR_JUMP_ALL);
+ STRCUR_JUMP_ALL, true);
done = console_line_cursor_set(ci, pos);
break;
case PREV_CHAR:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- STRCUR_JUMP_NONE);
+ STRCUR_JUMP_NONE, true);
done = console_line_cursor_set(ci, pos);
break;
case NEXT_CHAR:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- STRCUR_JUMP_NONE);
+ STRCUR_JUMP_NONE, true);
done = console_line_cursor_set(ci, pos);
break;
@@ -314,14 +315,14 @@ static int console_move_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, true);
done = console_line_cursor_set(ci, pos);
break;
case NEXT_WORD:
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- STRCUR_JUMP_DELIM);
+ STRCUR_JUMP_DELIM, true);
done = console_line_cursor_set(ci, pos);
break;
}
@@ -393,15 +394,26 @@ static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
if (!RNA_string_length(op->ptr, "text")) {
- /* if alt/ctrl/super are pressed pass through */
- if (event->ctrl || event->oskey) {
+ /* if alt/ctrl/super are pressed pass through except for utf8 character event
+ * (when input method are used for utf8 inputs, the user may assign key event
+ * including alt/ctrl/super like ctrl+m to commit utf8 string. in such case,
+ * the modifiers in the utf8 character event make no sense.) */
+ if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
return OPERATOR_PASS_THROUGH;
}
else {
- char str[2];
- str[0] = event->ascii;
- str[1] = '\0';
-
+ char str[BLI_UTF8_MAX + 1];
+ size_t len;
+
+ if (event->utf8_buf[0]) {
+ len = BLI_str_utf8_size_safe(event->utf8_buf);
+ memcpy(str, event->utf8_buf, len);
+ }
+ else {
+ /* in theory, ghost can set value to extended ascii here */
+ len = BLI_str_utf8_from_unicode(event->ascii, str);
+ }
+ str[len] = '\0';
RNA_string_set(op->ptr, "text", str);
}
}
@@ -550,7 +562,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_NEXT,
- (type == DEL_NEXT_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM);
+ (type == DEL_NEXT_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM, true);
stride = pos - ci->cursor;
if (stride) {
memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1);
@@ -566,7 +578,7 @@ static int console_delete_exec(bContext *C, wmOperator *op)
pos = ci->cursor;
BLI_str_cursor_step_utf8(ci->line, ci->len,
&pos, STRCUR_DIR_PREV,
- (type == DEL_PREV_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM);
+ (type == DEL_PREV_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM, true);
stride = ci->cursor - pos;
if (stride) {
ci->cursor -= stride; /* same as above */
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 08f01b47b52..afe32ec0b85 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -335,7 +335,9 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
float scale;
int ex, ey;
- if ( (imb->x > layout->prv_w) || (imb->y > layout->prv_h) ) {
+ if ((imb->x * UI_DPI_FAC > layout->prv_w) ||
+ (imb->y * UI_DPI_FAC > layout->prv_h))
+ {
if (imb->x > imb->y) {
scaledx = (float)layout->prv_w;
scaledy = ( (float)imb->y / (float)imb->x) * layout->prv_w;
@@ -348,10 +350,11 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
}
}
else {
- scaledx = (float)imb->x;
- scaledy = (float)imb->y;
- scale = 1.0;
+ scaledx = (float)imb->x * UI_DPI_FAC;
+ scaledy = (float)imb->y * UI_DPI_FAC;
+ scale = UI_DPI_FAC;
}
+
ex = (int)scaledx;
ey = (int)scaledy;
fx = ((float)layout->prv_w - (float)ex) / 2.0f;
@@ -461,7 +464,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
int i;
short is_icon;
short align;
-
+ int column_space = 0.6f * UI_UNIT_X;
numfiles = filelist_numfiles(files);
@@ -492,7 +495,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
for (i = offset; (i < numfiles) && (i < offset + numfiles_layout); i++) {
ED_fileselect_layout_tilepos(layout, i, &sx, &sy);
- sx += (int)(v2d->tot.xmin + 2.0f);
+ sx += (int)(v2d->tot.xmin + 0.1f * UI_UNIT_X);
sy = (int)(v2d->tot.ymax - sy);
file = filelist_file(files, i);
@@ -521,13 +524,13 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
else {
file_draw_icon(block, file->path, sx, sy - (UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
- sx += ICON_DEFAULT_WIDTH_SCALE + 4;
+ sx += ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X;
}
UI_ThemeColor4(TH_TEXT);
if (file->selflag & EDITING_FILE) {
- uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 3,
+ uiBut *but = uiDefBut(block, TEX, 1, "", sx, sy - layout->tile_h - 0.15f * UI_UNIT_X,
textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit), 0, 0, "");
uiButSetRenameFunc(but, renamebutton_cb, file);
uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
@@ -543,39 +546,39 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
if (params->display == FILE_SHORTDISPLAY) {
- sx += (int)layout->column_widths[COLUMN_NAME] + 12;
+ sx += (int)layout->column_widths[COLUMN_NAME] + column_space;
if (!(file->type & S_IFDIR)) {
file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
+ sx += (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
}
else if (params->display == FILE_LONGDISPLAY) {
- sx += (int)layout->column_widths[COLUMN_NAME] + 12;
+ sx += (int)layout->column_widths[COLUMN_NAME] + column_space;
#ifndef WIN32
/* rwx rwx rwx */
file_draw_string(sx, sy, file->mode1, layout->column_widths[COLUMN_MODE1], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_MODE1] + 12;
+ sx += layout->column_widths[COLUMN_MODE1] + column_space;
file_draw_string(sx, sy, file->mode2, layout->column_widths[COLUMN_MODE2], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_MODE2] + 12;
+ sx += layout->column_widths[COLUMN_MODE2] + column_space;
file_draw_string(sx, sy, file->mode3, layout->column_widths[COLUMN_MODE3], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_MODE3] + 12;
+ sx += layout->column_widths[COLUMN_MODE3] + column_space;
file_draw_string(sx, sy, file->owner, layout->column_widths[COLUMN_OWNER], layout->tile_h, align);
- sx += layout->column_widths[COLUMN_OWNER] + 12;
+ sx += layout->column_widths[COLUMN_OWNER] + column_space;
#endif
file_draw_string(sx, sy, file->date, layout->column_widths[COLUMN_DATE], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_DATE] + 12;
+ sx += (int)layout->column_widths[COLUMN_DATE] + column_space;
file_draw_string(sx, sy, file->time, layout->column_widths[COLUMN_TIME], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_TIME] + 12;
+ sx += (int)layout->column_widths[COLUMN_TIME] + column_space;
if (!(file->type & S_IFDIR)) {
file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);
- sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
+ sx += (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
}
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 8c45b161d26..3c6f6358171 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -500,12 +500,12 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->textheight = textheight;
if (params->display == FILE_IMGDISPLAY) {
- layout->prv_w = 96;
- layout->prv_h = 96;
- layout->tile_border_x = 6;
- layout->tile_border_y = 6;
- layout->prv_border_x = 6;
- layout->prv_border_y = 6;
+ layout->prv_w = 4.8f * UI_UNIT_X;
+ layout->prv_h = 4.8f * UI_UNIT_Y;
+ layout->tile_border_x = 0.3f * UI_UNIT_X;
+ layout->tile_border_y = 0.3f * UI_UNIT_X;
+ layout->prv_border_x = 0.3f * UI_UNIT_X;
+ layout->prv_border_y = 0.3f * UI_UNIT_Y;
layout->tile_w = layout->prv_w + 2 * layout->prv_border_x;
layout->tile_h = layout->prv_h + 2 * layout->prv_border_y + textheight;
layout->width = (int)(BLI_rctf_size_x(&v2d->cur) - 2 * layout->tile_border_x);
@@ -520,10 +520,13 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
layout->flag = FILE_LAYOUT_VER;
}
else {
+ int column_space = 0.6f * UI_UNIT_X;
+ int column_icon_space = 0.2f * UI_UNIT_X;
+
layout->prv_w = 0;
layout->prv_h = 0;
- layout->tile_border_x = 8;
- layout->tile_border_y = 2;
+ layout->tile_border_x = 0.4f * UI_UNIT_X;
+ layout->tile_border_y = 0.1f * UI_UNIT_Y;
layout->prv_border_x = 0;
layout->prv_border_y = 0;
layout->tile_h = textheight * 3 / 2;
@@ -533,22 +536,22 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
column_widths(sfile->files, layout);
if (params->display == FILE_SHORTDISPLAY) {
- maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
- (int)layout->column_widths[COLUMN_NAME] + 12 +
- (int)layout->column_widths[COLUMN_SIZE] + 12;
+ maxlen = ICON_DEFAULT_WIDTH_SCALE + column_icon_space +
+ (int)layout->column_widths[COLUMN_NAME] + column_space +
+ (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
else {
- maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
- (int)layout->column_widths[COLUMN_NAME] + 12 +
+ maxlen = ICON_DEFAULT_WIDTH_SCALE + column_icon_space +
+ (int)layout->column_widths[COLUMN_NAME] + column_space +
#ifndef WIN32
- (int)layout->column_widths[COLUMN_MODE1] + 12 +
- (int)layout->column_widths[COLUMN_MODE2] + 12 +
- (int)layout->column_widths[COLUMN_MODE3] + 12 +
- (int)layout->column_widths[COLUMN_OWNER] + 12 +
+ (int)layout->column_widths[COLUMN_MODE1] + column_space +
+ (int)layout->column_widths[COLUMN_MODE2] + column_space +
+ (int)layout->column_widths[COLUMN_MODE3] + column_space +
+ (int)layout->column_widths[COLUMN_OWNER] + column_space +
#endif
- (int)layout->column_widths[COLUMN_DATE] + 12 +
- (int)layout->column_widths[COLUMN_TIME] + 12 +
- (int)layout->column_widths[COLUMN_SIZE] + 12;
+ (int)layout->column_widths[COLUMN_DATE] + column_space +
+ (int)layout->column_widths[COLUMN_TIME] + column_space +
+ (int)layout->column_widths[COLUMN_SIZE] + column_space;
}
layout->tile_w = maxlen;
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 7cc322c06bb..0a4b922bb38 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -478,6 +478,7 @@ static void file_channel_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
ED_region_panels_init(wm, ar);
/* own keymaps */
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index afae9535fee..01364fcacf0 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -498,17 +498,17 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr,
}
/* decrease, increase arrows */
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 17, 20, NULL, 0, 0, 0, 0, TIP_("Previous Layer"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Layer"));
uiButSetFunc(but, image_multi_declay_cb, rr, iuser);
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 18, 20, NULL, 0, 0, 0, 0, TIP_("Next Layer"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Layer"));
uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);
uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot);
/* decrease, increase arrows */
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 17, 20, NULL, 0, 0, 0, 0, TIP_("Previous Pass"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT, 0, 0, 0.85f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Previous Pass"));
uiButSetFunc(but, image_multi_decpass_cb, rr, iuser);
- but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 18, 20, NULL, 0, 0, 0, 0, TIP_("Next Pass"));
+ but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT, 0, 0, 0.90f * UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Next Pass"));
uiButSetFunc(but, image_multi_incpass_cb, rr, iuser);
uiBlockEndAlign(block);
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 00bc3d1d26b..cae71885b87 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -185,29 +185,28 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
/* noisy, high contrast make impossible to read if lower alpha is used. */
glColor4ub(0, 0, 0, 190);
- glRecti(0.0, 0.0, BLI_rcti_size_x(&ar->winrct) + 1, 20);
+ glRecti(0.0, 0.0, BLI_rcti_size_x(&ar->winrct) + 1, UI_UNIT_Y);
glDisable(GL_BLEND);
- BLF_size(blf_mono_font, 11, 72);
+ BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi);
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), "X:%-4d Y:%-4d |", x, y);
- // UI_DrawString(6, 6, str); // works ok but fixed width is nicer.
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_Y, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
if (zp) {
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff));
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
if (zpf) {
glColor3ub(255, 255, 255);
BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -220,7 +219,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " R:%-3d", cp[0]);
else
BLI_snprintf(str, sizeof(str), " R:-");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -231,7 +230,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " G:%-3d", cp[1]);
else
BLI_snprintf(str, sizeof(str), " G:-");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -242,7 +241,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " B:%-3d", cp[2]);
else
BLI_snprintf(str, sizeof(str), " B:-");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
@@ -254,7 +253,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
BLI_snprintf(str, sizeof(str), " A:%-3d", cp[3]);
else
BLI_snprintf(str, sizeof(str), "- ");
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -268,7 +267,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
IMB_colormanagement_pixel_to_display_space_v4(pixel, fp, &scene->view_settings, &scene->display_settings);
BLI_snprintf(str, sizeof(str), " | CM R:%-.4f G:%-.4f B:%-.4f", pixel[0], pixel[1], pixel[2]);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -326,24 +325,24 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
glDisable(GL_BLEND);
glColor3fv(finalcol);
- dx += 5;
+ dx += 0.25f * UI_UNIT_X;
glBegin(GL_QUADS);
- glVertex2f(dx, 3);
- glVertex2f(dx, 17);
- glVertex2f(dx + 30, 17);
- glVertex2f(dx + 30, 3);
+ glVertex2f(dx, 0.15f * UI_UNIT_Y);
+ glVertex2f(dx, 0.85f * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.85 * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.15f * UI_UNIT_Y);
glEnd();
/* draw outline */
glColor3ub(128, 128, 128);
glBegin(GL_LINE_LOOP);
- glVertex2f(dx, 3);
- glVertex2f(dx, 17);
- glVertex2f(dx + 30, 17);
- glVertex2f(dx + 30, 3);
+ glVertex2f(dx, 0.15f * UI_UNIT_Y);
+ glVertex2f(dx, 0.85f * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.85f * UI_UNIT_Y);
+ glVertex2f(dx + 1.5f * UI_UNIT_X, 0.15f * UI_UNIT_Y);
glEnd();
- dx += 35;
+ dx += 1.75f * UI_UNIT_X;
glColor3ub(255, 255, 255);
if (channels == 1) {
@@ -357,12 +356,12 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
}
BLI_snprintf(str, sizeof(str), "V:%-.4f", val);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
@@ -377,22 +376,22 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def
}
BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " S:%-.4f", sat);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " V:%-.4f", val);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
BLI_snprintf(str, sizeof(str), " L:%-.4f", lum);
- BLF_position(blf_mono_font, dx, 6, 0);
+ BLF_position(blf_mono_font, dx, 0.3f * UI_UNIT_X, 0);
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 35ba83a8bc6..ca8270ba0f5 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -750,6 +750,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
ED_region_panels_init(wm, ar);
keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
@@ -789,6 +790,7 @@ static void image_scope_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
+ ar->v2d.scroll = V2D_SCROLL_RIGHT | V2D_SCROLL_VERTICAL_HIDE;
ED_region_panels_init(wm, ar);
keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 3f73fc2605a..976769752f9 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -41,6 +41,8 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
+#include "BLF_translation.h"
+
#include "BKE_anim.h"
#include "BKE_blender.h"
#include "BKE_curve.h"
@@ -166,8 +168,11 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
if (ebo->flag & BONE_SELECTED) stats->totbonesel++;
/* if this is a connected child and it's parent is being moved, remove our root */
- if ((ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
+ if ((ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL) &&
+ ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
+ {
stats->totvertsel--;
+ }
stats->totvert += 2;
}
@@ -362,9 +367,9 @@ static void stats_string(Scene *scene)
mmap_in_use = MEM_get_mapped_memory_in_use();
/* get memory statistics */
- s = memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0);
+ s = memstr + sprintf(memstr, IFACE_(" | Mem:%.2fM"), (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0);
if (mmap_in_use)
- sprintf(s, " (%.2fM)", (double)((mmap_in_use) >> 10) / 1024.0);
+ sprintf(s, IFACE_(" (%.2fM)"), (double)((mmap_in_use) >> 10) / 1024.0);
s = stats->infostr;
@@ -372,31 +377,34 @@ static void stats_string(Scene *scene)
if (scene->obedit) {
if (BKE_keyblock_from_object(scene->obedit))
- s += sprintf(s, "(Key) ");
+ s += sprintf(s, IFACE_("(Key) "));
if (scene->obedit->type == OB_MESH) {
- s += sprintf(s, "Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d",
- stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface, stats->tottri);
+ s += sprintf(s, IFACE_("Verts:%d/%d | Edges:%d/%d | Faces:%d/%d | Tris:%d"),
+ stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel,
+ stats->totface, stats->tottri);
}
else if (scene->obedit->type == OB_ARMATURE) {
- s += sprintf(s, "Verts:%d/%d | Bones:%d/%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone);
+ s += sprintf(s, IFACE_("Verts:%d/%d | Bones:%d/%d"), stats->totvertsel, stats->totvert, stats->totbonesel,
+ stats->totbone);
}
else {
- s += sprintf(s, "Verts:%d/%d", stats->totvertsel, stats->totvert);
+ s += sprintf(s, IFACE_("Verts:%d/%d"), stats->totvertsel, stats->totvert);
}
strcat(s, memstr);
}
else if (ob && (ob->mode & OB_MODE_POSE)) {
- s += sprintf(s, "Bones:%d/%d %s",
+ s += sprintf(s, IFACE_("Bones:%d/%d %s"),
stats->totbonesel, stats->totbone, memstr);
}
else if (stats_is_object_dynamic_topology_sculpt(ob)) {
- s += sprintf(s, "Verts:%d | Tris:%d", stats->totvert, stats->tottri);
+ s += sprintf(s, IFACE_("Verts:%d | Tris:%d"), stats->totvert, stats->tottri);
}
else {
- s += sprintf(s, "Verts:%d | Faces:%d| Tris:%d | Objects:%d/%d | Lamps:%d/%d%s",
- stats->totvert, stats->totface, stats->tottri, stats->totobjsel, stats->totobj, stats->totlampsel, stats->totlamp, memstr);
+ s += sprintf(s, IFACE_("Verts:%d | Faces:%d | Tris:%d | Objects:%d/%d | Lamps:%d/%d%s"),
+ stats->totvert, stats->totface, stats->tottri, stats->totobjsel, stats->totobj, stats->totlampsel,
+ stats->totlamp, memstr);
}
if (ob)
@@ -419,4 +427,3 @@ const char *ED_info_stats_string(Scene *scene)
return scene->stats->infostr;
}
-
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 9b342ed8f44..f303bba9886 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -2654,10 +2654,21 @@ static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *UNUSED(C)
uiItemR(layout, ptr, "mask_type", 0, NULL, ICON_NONE);
}
+static void node_composit_buts_composite(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "use_alpha", 0, NULL, ICON_NONE);
+}
+
+static void node_composit_buts_viewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiItemR(layout, ptr, "use_alpha", 0, NULL, ICON_NONE);
+}
+
static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
+ uiItemR(layout, ptr, "use_alpha", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "tile_order", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "tile_order") == 0) {
col = uiLayoutColumn(layout, TRUE);
@@ -2965,10 +2976,13 @@ static void node_composit_set_butfunc(bNodeType *ntype)
ntype->uifunc = node_composit_buts_bokehblur;
break;
case CMP_NODE_VIEWER:
- ntype->uifunc = NULL;
+ ntype->uifunc = node_composit_buts_viewer;
ntype->uifuncbut = node_composit_buts_viewer_but;
ntype->uibackdropfunc = node_composit_backdrop_viewer;
break;
+ case CMP_NODE_COMPOSITE:
+ ntype->uifunc = node_composit_buts_composite;
+ break;
case CMP_NODE_MASK:
ntype->uifunc = node_composit_buts_mask;
break;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index d5d2ace6fa7..34f7799d47c 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -368,7 +368,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
}
/* buttons rect? */
- if ((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
+ /* TODO: NODE_OPTION shall be cleaned up */
+ if (/*(node->flag & NODE_OPTIONS) && */node->typeinfo->uifunc) {
dy -= NODE_DYS / 2;
/* set this for uifunc() that don't use layout engine yet */
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index e92d93485a1..f26b6ff0f54 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -234,7 +234,7 @@ static void node_menu_add(const bContext *C, Menu *menu)
uiLayoutSetActive(layout, FALSE);
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
- uiItemO(layout, "Search ...", 0, "NODE_OT_add_search");
+ uiItemO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Search ..."), 0, "NODE_OT_add_search");
if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, layout, node_menu_add_foreach_cb);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index a5f6ca9ded0..264bea5f871 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -498,6 +498,7 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
case NC_SCENE:
case NC_MATERIAL:
case NC_TEXTURE:
+ case NC_WORLD:
case NC_NODE:
ED_region_tag_redraw(ar);
break;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index b64019b01be..cacbc6d6268 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1677,7 +1677,7 @@ void draw_outliner(const bContext *C)
* (OL_RNA_COL_X), whichever is wider...
* - column 2 is fixed at OL_RNA_COL_SIZEX
*
- * (*) XXX max width for now is a fixed factor of UI_UNIT_X*(max_indention+100)
+ * (*) XXX max width for now is a fixed factor of (UI_UNIT_X * (max_indention + 100))
*/
/* get actual width of column 1 */
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 1f209f90007..b60528bcee8 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -1312,9 +1312,11 @@ void TEXT_OT_select_line(wmOperatorType *ot)
static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
{
Text *text = CTX_data_edit_text(C);
+ /* don't advance cursor before stepping */
+ const bool use_init_step = false;
- txt_jump_left(text, 0);
- txt_jump_right(text, 1);
+ txt_jump_left(text, false, use_init_step);
+ txt_jump_right(text, true, use_init_step);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
@@ -1816,11 +1818,11 @@ static int text_move_cursor(bContext *C, int type, int select)
break;
case PREV_WORD:
- txt_jump_left(text, select);
+ txt_jump_left(text, select, true);
break;
case NEXT_WORD:
- txt_jump_right(text, select);
+ txt_jump_right(text, select, true);
break;
case PREV_CHAR:
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 70e2e663b33..35a0111e575 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -1071,7 +1071,7 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
draw_mesh_face_select(rv3d, me, dm);
}
else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) {
- const int use_depth = (v3d->flag & V3D_ZBUF_SELECT);
+ const int use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT);
/* weight paint in solid mode, special case. focus on making the weights clear
* rather than the shading, this is also forced in wire view */
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index ff63f16d125..2b28b958248 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -871,7 +871,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect)
static void draw_selected_name(Scene *scene, Object *ob, rcti *rect)
{
char info[256], *markern;
- short offset = 30 + rect->xmin;
+ short offset = 1.5f * UI_UNIT_X + rect->xmin;
/* get name of marker on current frame (if available) */
markern = BKE_scene_find_marker_name(scene, CFRA);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 5c2e75776e4..8c0a2dc4b65 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -83,6 +83,9 @@
#include "view3d_intern.h" /* own include */
+/* for ndof prints */
+// #define DEBUG_NDOF_MOTION
+
/* ********************** view3d_edit: view manipulations ********************* */
int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
@@ -1043,11 +1046,10 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
float view_inv[4];
invert_qt_qt(view_inv, rv3d->viewquat);
- /* #define DEBUG_NDOF_MOTION */
- #ifdef DEBUG_NDOF_MOTION
+#ifdef DEBUG_NDOF_MOTION
printf("ndof: T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f delivered to 3D view\n",
ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
- #endif
+#endif
if (rv3d->viewlock == RV3D_LOCKED) {
/* rotation not allowed -- explore panning options instead */
@@ -1204,11 +1206,10 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
float view_inv[4];
invert_qt_qt(view_inv, rv3d->viewquat);
- /* #define DEBUG_NDOF_MOTION */
- #ifdef DEBUG_NDOF_MOTION
+#ifdef DEBUG_NDOF_MOTION
printf("ndof: T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f delivered to 3D view\n",
ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
- #endif
+#endif
if (ndof->tz) {
/* Zoom!
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 98d4c5e7b81..8ffa04050a2 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -894,6 +894,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw |= TREDRAW_HARD;
WM_event_add_mousemove(t->context);
}
+ else if (t->mode == TFM_SEQ_SLIDE) {
+ t->flag ^= T_ALT_TRANSFORM;
+ t->redraw |= TREDRAW_HARD;
+ }
else {
if (t->obedit && t->obedit->type == OB_MESH) {
if ((t->mode == TFM_TRANSLATION) && (t->spacetype == SPACE_VIEW3D)) {
@@ -958,6 +962,10 @@ int transformEvent(TransInfo *t, wmEvent *event)
initSnapping(t, NULL); // need to reinit after mode change
t->redraw |= TREDRAW_HARD;
}
+ else if (t->mode == TFM_SHRINKFATTEN) {
+ t->flag ^= T_ALT_TRANSFORM;
+ t->redraw |= TREDRAW_HARD;
+ }
else if (t->mode == TFM_RESIZE) {
if (t->options & CTX_MOVIECLIP) {
restoreTransObjects(t);
@@ -1920,6 +1928,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
}
+ t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
+
initSnapping(t, op); // Initialize snapping data AFTER mode flags
/* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
@@ -4054,7 +4064,8 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
{
float distance;
int i;
- char str[64];
+ char str[128];
+ char *str_p;
TransData *td = t->data;
distance = -t->values[0];
@@ -4064,17 +4075,33 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
applyNumInput(&t->num, &distance);
/* header print for NumInput */
+ str_p = str;
+ str_p += BLI_snprintf(str_p, sizeof(str), "Shrink/Fatten:");
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
-
outputNumInput(&(t->num), c);
-
- sprintf(str, "Shrink/Fatten: %s %s", c, t->proptext);
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s", c);
}
else {
/* default header print */
- sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext);
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %.4f", distance);
+ }
+
+ if (t->proptext[0]) {
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " %s", t->proptext);
+ }
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), ", (");
+
+ {
+ wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
+ if (kmi) {
+ str_p += WM_keymap_item_to_string(kmi, str_p, sizeof(str) - (str_p - str));
+ }
}
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), " or Alt) Even Thickness %s",
+ (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ /* done with header string */
+
t->values[0] = -distance;
@@ -5899,7 +5926,7 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
&c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
}
else {
- BLI_snprintf(str, sizeof(str), "Edge Slide: %.2f (E)ven: %s, (F)lipped: %s",
+ BLI_snprintf(str, sizeof(str), "Edge Slide: %.4f (E)ven: %s, (F)lipped: %s",
final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF");
}
@@ -6027,6 +6054,7 @@ static int createVertSlideVerts(TransInfo *t)
}
sld->is_proportional = true;
+ sld->is_clamp = true;
sld->curr_sv_index = 0;
sld->flipped_vtx = false;
@@ -6220,6 +6248,16 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
}
break;
}
+ case CKEY:
+ {
+ /* use like a modifier key */
+ if (event->val == KM_PRESS) {
+ sld->is_clamp = !sld->is_clamp;
+ calcVertSlideCustomPoints(t);
+ return 1;
+ }
+ break;
+ }
#if 0
case EVT_MODAL_MAP:
{
@@ -6240,7 +6278,7 @@ int handleEventVertSlide(struct TransInfo *t, struct wmEvent *event)
case MOUSEMOVE:
{
/* don't recalculat the best edge */
- if (!(t->flag & T_ALT_TRANSFORM)) {
+ if (sld->is_clamp) {
calcVertSlideMouseActiveEdges(t, event->mval);
}
calcVertSlideCustomPoints(t);
@@ -6266,7 +6304,6 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
const int alpha_shade = -30;
int i;
- bool is_constrained = !(t->flag & T_ALT_TRANSFORM);
if (v3d && v3d->zbuf)
glDisable(GL_DEPTH_TEST);
@@ -6282,7 +6319,7 @@ static void drawVertSlide(const struct bContext *C, TransInfo *t)
glLineWidth(line_size);
UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
glBegin(GL_LINES);
- if (is_constrained) {
+ if (sld->is_clamp) {
sv = sld->sv;
for (i = 0; i < sld->totsv; i++, sv++) {
glVertex3fv(sv->co_orig_3d);
@@ -6370,11 +6407,12 @@ static int doVertSlide(TransInfo *t, float perc)
int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
{
char str[128];
+ char *str_p;
float final;
VertSlideData *sld = t->customData;
const bool flipped = sld->flipped_vtx;
const bool is_proportional = sld->is_proportional;
- const bool is_constrained = !((t->flag & T_ALT_TRANSFORM) || hasNumInput(&t->num));
+ const bool is_constrained = !(sld->is_clamp == false || hasNumInput(&t->num));
final = t->values[0];
@@ -6385,20 +6423,24 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
CLAMP(final, 0.0f, 1.0f);
}
+ /* header string */
+ str_p = str;
+ str_p += BLI_snprintf(str_p, sizeof(str), "Vert Slide: ");
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
-
applyNumInput(&t->num, &final);
-
outputNumInput(&(t->num), c);
-
- BLI_snprintf(str, sizeof(str), "Vert Slide: %s (E)ven: %s, (F)lipped: %s, Alt Hold: %s",
- &c[0], !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF", (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%s", &c[0]);
}
else {
- BLI_snprintf(str, sizeof(str), "Vert Slide: %.2f (E)ven: %s, (F)lipped: %s, Alt Hold: %s",
- final, !is_proportional ? "ON" : "OFF", flipped ? "ON" : "OFF", (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "%.4f ", final);
}
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(E)ven: %s, ", !is_proportional ? "ON" : "OFF");
+ if (!is_proportional) {
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(F)lipped: %s, ", flipped ? "ON" : "OFF");
+ }
+ str_p += BLI_snprintf(str_p, sizeof(str) - (str_p - str), "(C)lamp: %s", sld->is_clamp ? "ON" : "OFF");
+ /* done with header string */
if (is_constrained) {
CLAMP(final, 0.0f, 1.0f);
@@ -6718,9 +6760,10 @@ void initSeqSlide(TransInfo *t)
t->num.increment = t->snap[1];
}
-static void headerSeqSlide(TransInfo *t, float val[2], char *str)
+static void headerSeqSlide(TransInfo *t, float val[2], char *str, size_t str_len)
{
char tvec[NUM_STR_REP_LEN * 3];
+ char *str_p;
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
@@ -6729,7 +6772,17 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str)
sprintf(&tvec[0], "%.0f, %.0f", val[0], val[1]);
}
- sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
+ str_p = str;
+ str_p += BLI_snprintf(str, str_len, "Sequence Slide: %s%s, (", &tvec[0], t->con.text);
+
+ {
+ wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
+ if (kmi) {
+ str_p += WM_keymap_item_to_string(kmi, str_p, str_len - (str_p - str));
+ }
+ }
+ str_p += BLI_snprintf(str_p, str_len - (str_p - str), " or Alt) Expand to fit %s",
+ (t->flag & T_ALT_TRANSFORM) ? "ON" : "OFF");
}
static void applySeqSlide(TransInfo *t, float val[2])
@@ -6773,7 +6826,7 @@ int SeqSlide(TransInfo *t, const int UNUSED(mval[2]))
t->values[0] = floor(t->values[0] + 0.5f);
t->values[1] = floor(t->values[1] + 0.5f);
- headerSeqSlide(t, t->values, str);
+ headerSeqSlide(t, t->values, str, sizeof(str));
applySeqSlide(t, t->values);
recalcData(t);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index a27fe91c3c3..78f346be2aa 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -239,6 +239,7 @@ typedef struct VertSlideData {
float perc;
bool is_proportional;
+ bool is_clamp;
bool flipped_vtx;
int curr_sv_index;
@@ -351,6 +352,7 @@ typedef struct TransInfo {
struct Scene *scene;
struct ToolSettings *settings;
struct wmTimer *animtimer;
+ struct wmKeyMap *keymap; /* so we can do lookups for header text */
int mval[2]; /* current mouse position */
struct Object *obedit;
void *draw_handle_apply;
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index dd1510498b0..4e9a54692a5 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -307,15 +307,8 @@ static void calcSpringFactor(MouseInput *mi)
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
{
- /* may have been allocated previously */
- /* TODO, holding R-key can cause mem leak, but this causes [#28903]
- * disable for now. */
-#if 0
- if (mi->data) {
- MEM_freeN(mi->data);
- mi->data = NULL;
- }
-#endif
+ /* incase we allocate a new value */
+ void *mi_data_prev = mi->data;
switch (mode) {
case INPUT_VECTOR:
@@ -374,6 +367,12 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
break;
}
+ /* if we've allocated new data, free the old data
+ * less hassle then checking before every alloc above */
+ if (mi_data_prev && (mi_data_prev != mi->data)) {
+ MEM_freeN(mi_data_prev);
+ }
+
/* bootstrap mouse input with initial values */
applyMouseInput(t, mi, mi->imval, t->values);
}
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 7e3302e233e..767003bdd84 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -60,6 +60,7 @@
{ /*printf("Assertion %s:%d\n", __FILE__, __LINE__); abort();*/ } (void)0
#define param_warning(message) \
{ /*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/ } (void)0
+#if 0
#define param_test_equals_ptr(str, a, b) \
if (a != b) \
{ /*printf("Equals %s => %p != %p\n", str, a, b);*/ } (void)0
@@ -67,6 +68,7 @@
if (a != b) \
{ /*printf("Equals %s => %d != %d\n", str, a, b);*/ } (void)0
#endif
+#endif
typedef enum PBool {
P_TRUE = 1,
P_FALSE = 0
@@ -3047,6 +3049,8 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
PVert *v, *pin1 = chart->u.lscm.pin1, *pin2 = chart->u.lscm.pin2;
PFace *f;
float *alpha = chart->u.lscm.abf_alpha;
+ float area_pinned_up, area_pinned_down;
+ bool flip_faces;
int row;
nlMakeCurrent(chart->u.lscm.context);
@@ -3085,6 +3089,26 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
}
}
+ /* detect up direction based on pinned vertices */
+ area_pinned_up = 0.0f;
+ area_pinned_down = 0.0f;
+
+ for (f = chart->faces; f; f = f->nextlink) {
+ PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
+ PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
+
+ if ((v1->flag & PVERT_PIN) && (v2->flag & PVERT_PIN) && (v3->flag & PVERT_PIN)) {
+ float area = p_face_uv_area_signed(f);
+
+ if (area > 0.0f)
+ area_pinned_up += area;
+ else
+ area_pinned_down -= area;
+ }
+ }
+
+ flip_faces = (area_pinned_down > area_pinned_up);
+
/* construct matrix */
nlBegin(NL_MATRIX);
@@ -3105,6 +3129,12 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
else
p_face_angles(f, &a1, &a2, &a3);
+ if (flip_faces) {
+ SWAP(float, a2, a3);
+ SWAP(PEdge *, e2, e3);
+ SWAP(PVert *, v2, v3);
+ }
+
sina1 = sin(a1);
sina2 = sin(a2);
sina3 = sin(a3);
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index 1b43d829947..5bb8105cd14 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -100,11 +100,13 @@ struct IslandStitchData;
typedef struct IslandStitchData {
/* rotation can be used only for edges, for vertices there is no such notion */
float rotation;
+ float rotation_neg;
float translation[2];
/* Used for rotation, the island will rotate around this point */
float medianPoint[2];
int numOfElements;
int num_rot_elements;
+ int num_rot_elements_neg;
/* flag to remember if island has been added for preview */
char addedForPreview;
/* flag an island to be considered for determining static island */
@@ -286,20 +288,15 @@ static int getNumOfIslandUvs(UvElementMap *elementMap, int island)
}
}
-static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2], float aspect)
+static void stitch_uv_rotate(float mat[2][2], float medianPoint[2], float uv[2], float aspect)
{
float uv_rotation_result[2];
uv[1] /= aspect;
- uv[0] -= medianPoint[0];
- uv[1] -= medianPoint[1];
-
- uv_rotation_result[0] = cosf(rotation) * uv[0] - sinf(rotation) * uv[1];
- uv_rotation_result[1] = sinf(rotation) * uv[0] + cosf(rotation) * uv[1];
-
- uv[0] = uv_rotation_result[0] + medianPoint[0];
- uv[1] = uv_rotation_result[1] + medianPoint[1];
+ sub_v2_v2(uv, medianPoint);
+ mul_v2_m2v2(uv_rotation_result, mat, uv);
+ add_v2_v2v2(uv, uv_rotation_result, medianPoint);
uv[1] *= aspect;
}
@@ -412,17 +409,40 @@ static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition
for (i = 0; i < state->element_map->totalIslands; i++) {
if (island_stitch_data[i].addedForPreview) {
int numOfIslandUVs = 0, j;
+ int totelem = island_stitch_data[i].num_rot_elements_neg + island_stitch_data[i].num_rot_elements;
+ float rotation;
+ float rotation_mat[2][2];
/* check to avoid divide by 0 */
- if (island_stitch_data[i].num_rot_elements > 0) {
+ if (island_stitch_data[i].num_rot_elements > 1)
island_stitch_data[i].rotation /= island_stitch_data[i].num_rot_elements;
+
+ if (island_stitch_data[i].num_rot_elements_neg > 1)
+ island_stitch_data[i].rotation_neg /= island_stitch_data[i].num_rot_elements_neg;
+
+ if (island_stitch_data[i].numOfElements > 1) {
island_stitch_data[i].medianPoint[0] /= island_stitch_data[i].numOfElements;
island_stitch_data[i].medianPoint[1] /= island_stitch_data[i].numOfElements;
- island_stitch_data[i].medianPoint[1] /= state->aspect;
+
+ island_stitch_data[i].translation[0] /= island_stitch_data[i].numOfElements;
+ island_stitch_data[i].translation[1] /= island_stitch_data[i].numOfElements;
+ }
+
+ island_stitch_data[i].medianPoint[1] /= state->aspect;
+ if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < (float)M_PI_2) ||
+ island_stitch_data[i].num_rot_elements == 0 || island_stitch_data[i].num_rot_elements_neg == 0)
+ {
+ rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements -
+ island_stitch_data[i].rotation_neg *
+ island_stitch_data[i].num_rot_elements_neg) / totelem;
+ }
+ else {
+ rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements +
+ (2.0f * (float)M_PI - island_stitch_data[i].rotation_neg) *
+ island_stitch_data[i].num_rot_elements_neg) / totelem;
}
- island_stitch_data[i].translation[0] /= island_stitch_data[i].numOfElements;
- island_stitch_data[i].translation[1] /= island_stitch_data[i].numOfElements;
+ rotate_m2(rotation_mat, rotation);
numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
element = &state->element_map->buf[state->element_map->islandIndices[i]];
for (j = 0; j < numOfIslandUVs; j++, element++) {
@@ -436,15 +456,16 @@ static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition
if (final) {
- stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint, luv->uv, state->aspect);
+ stitch_uv_rotate(rotation_mat, island_stitch_data[i].medianPoint, luv->uv, state->aspect);
add_v2_v2(luv->uv, island_stitch_data[i].translation);
}
else {
+
int face_preview_pos = preview_position[BM_elem_index_get(element->l->f)].data_position;
- stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint,
+ stitch_uv_rotate(rotation_mat, island_stitch_data[i].medianPoint,
preview->preview_polys + face_preview_pos + 2 * element->tfindex, state->aspect);
add_v2_v2(preview->preview_polys + face_preview_pos + 2 * element->tfindex,
@@ -500,13 +521,16 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
edgecos = dot_v2v2(uv1, uv2);
edgesin = cross_v2v2(uv1, uv2);
+ rotation = acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
- rotation = (edgesin > 0.0f) ?
- +acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))) :
- -acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
-
- island_stitch_data[element1->island].num_rot_elements++;
- island_stitch_data[element1->island].rotation += rotation;
+ if (edgesin > 0.0f) {
+ island_stitch_data[element1->island].num_rot_elements++;
+ island_stitch_data[element1->island].rotation += rotation;
+ }
+ else {
+ island_stitch_data[element1->island].num_rot_elements_neg++;
+ island_stitch_data[element1->island].rotation_neg += rotation;
+ }
}
@@ -515,7 +539,8 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
float edgecos = 1.0f, edgesin = 0.0f;
int index;
UvElement *element_iter;
- float rotation = 0;
+ float rotation = 0, rotation_neg = 0;
+ int rot_elem = 0, rot_elem_neg = 0;
BMLoop *l;
if (element->island == state->static_island && !state->midpoints)
@@ -544,16 +569,25 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
negate_v2_v2(normal, state->normals + index_tmp2 * 2);
edgecos = dot_v2v2(normal, state->normals + index_tmp1 * 2);
edgesin = cross_v2v2(normal, state->normals + index_tmp1 * 2);
- rotation += (edgesin > 0.0f) ?
- +acosf(max_ff(-1.0f, min_ff(1.0f, edgecos))) :
- -acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
+ if (edgesin > 0.0f) {
+ rotation += acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
+ rot_elem++;
+ }
+ else {
+ rotation_neg += acosf(max_ff(-1.0f, min_ff(1.0f, edgecos)));
+ rot_elem_neg++;
+ }
}
}
- if (state->midpoints)
+ if (state->midpoints) {
rotation /= 2.0f;
- island_stitch_data[element->island].num_rot_elements++;
+ rotation_neg /= 2.0f;
+ }
+ island_stitch_data[element->island].num_rot_elements += rot_elem;
island_stitch_data[element->island].rotation += rotation;
+ island_stitch_data[element->island].num_rot_elements_neg += rot_elem_neg;
+ island_stitch_data[element->island].rotation_neg += rotation_neg;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 45e7831d20d..8fc18bf8726 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -390,6 +390,17 @@ void set_rgba_zero(out vec4 outval)
outval = vec4(0.0);
}
+void brightness_contrast(vec4 col, float brightness, float contrast, out vec4 outcol)
+{
+ float a = 1.0 + contrast;
+ float b = brightness - contrast*0.5;
+
+ outcol.r = max(a*col.r + b, 0.0);
+ outcol.g = max(a*col.g + b, 0.0);
+ outcol.b = max(a*col.b + b, 0.0);
+ outcol.a = col.a;
+}
+
void mix_blend(float fac, vec4 col1, vec4 col2, out vec4 outcol)
{
fac = clamp(fac, 0.0, 1.0);
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index 1e33f8da363..a05f0d5b3e6 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -133,6 +133,8 @@ void IMB_partial_display_buffer_update(struct ImBuf *ibuf, const float *linear_b
int xmin, int ymin, int xmax, int ymax,
int update_orig_byte_buffer);
+void IMB_partial_display_buffer_update_delayed(struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax);
+
/* ** Pixel processor functions ** */
struct ColormanageProcessor *IMB_colormanagement_display_processor_new(const struct ColorManagedViewSettings *view_settings,
const struct ColorManagedDisplaySettings *display_settings);
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index e30f1618c81..dde8d4d4ab7 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -28,6 +28,8 @@
#ifndef __IMB_IMBUF_TYPES_H__
#define __IMB_IMBUF_TYPES_H__
+#include "DNA_vec_types.h" /* for rcti */
+
/**
* \file IMB_imbuf_types.h
* \ingroup imbuf
@@ -132,6 +134,7 @@ typedef struct ImBuf {
unsigned int *display_buffer_flags; /* array of per-display display buffers dirty flags */
struct ColormanageCache *colormanage_cache; /* cache used by color management */
int colormanage_flag;
+ rcti invalid_rect;
/* information for compressed textures */
struct DDSData dds_data;
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 23804291a65..ff297d70cc3 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -57,6 +57,7 @@
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_threads.h"
+#include "BLI_rect.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
@@ -1823,6 +1824,18 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet
colormanage_view_settings_to_cache(&cache_view_settings, applied_view_settings);
colormanage_display_settings_to_cache(&cache_display_settings, display_settings);
+ if (ibuf->invalid_rect.xmin != ibuf->invalid_rect.xmax) {
+ if ((ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) == 0) {
+ IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect,
+ ibuf->x, 0, 0, applied_view_settings, display_settings,
+ ibuf->invalid_rect.xmin, ibuf->invalid_rect.ymin,
+ ibuf->invalid_rect.xmax, ibuf->invalid_rect.ymax,
+ FALSE);
+ }
+
+ BLI_rcti_init(&ibuf->invalid_rect, 0, 0, 0, 0);
+ }
+
BLI_lock_thread(LOCK_COLORMANAGE);
/* ensure color management bit fields exists */
@@ -2478,7 +2491,7 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer,
cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
partial_buffer_update_rect(ibuf, display_buffer, linear_buffer, byte_buffer, buffer_width, stride,
- offset_x, offset_y, cm_processor, xmin, ymin, xmax, ymax);
+ offset_x, offset_y, cm_processor, xmin, ymin, xmax, ymax);
if (cm_processor)
IMB_colormanagement_processor_free(cm_processor);
@@ -2488,6 +2501,18 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer,
}
}
+void IMB_partial_display_buffer_update_delayed(ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax)
+{
+ if (ibuf->invalid_rect.xmin == ibuf->invalid_rect.xmax) {
+ BLI_rcti_init(&ibuf->invalid_rect, xmin, xmax, ymin, ymax);
+ }
+ else {
+ rcti rect;
+ BLI_rcti_init(&rect, xmin, xmax, ymin, ymax);
+ BLI_rcti_union(&ibuf->invalid_rect, &rect);
+ }
+}
+
/*********************** Pixel processor functions *************************/
ColormanageProcessor *IMB_colormanagement_display_processor_new(const ColorManagedViewSettings *view_settings,
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 51fee232034..9193954f1d6 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -506,6 +506,10 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
imb_freemipmapImBuf(ibuf);
+ /* no mipmap for non RGBA images */
+ if (ibuf->rect_float && ibuf->channels < 4)
+ return;
+
ibuf->miptot = 1;
while (curmap < IB_MIPMAP_LEVELS) {
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index d2b0645cf93..0b739b9fe92 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -594,11 +594,13 @@ void IMB_rectfill_area(struct ImBuf *ibuf, const float col[4], int x1, int y1, i
void IMB_rectfill_alpha(ImBuf *ibuf, const float value)
{
int i;
- if (ibuf->rect_float) {
+
+ if (ibuf->rect_float && (ibuf->channels == 4)) {
float *fbuf = ibuf->rect_float + 3;
for (i = ibuf->x * ibuf->y; i > 0; i--, fbuf += 4) { *fbuf = value; }
}
- else {
+
+ if (ibuf->rect) {
const unsigned char cvalue = value * 255;
unsigned char *cbuf = ((unsigned char *)ibuf->rect) + 3;
for (i = ibuf->x * ibuf->y; i > 0; i--, cbuf += 4) { *cbuf = cvalue; }
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index b85bdecee02..2323c95d8ba 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -118,9 +118,14 @@ typedef struct MLoopUV {
#define MLOOPUV_VERTSEL 2
#define MLOOPUV_PINNED 4
-/* at the moment alpha is abused for vertex painting
- * and not used for transparency,
- * note that red and blue are _not_ swapped, as they are with #MCol */
+/**
+ * at the moment alpha is abused for vertex painting,
+ * otherwise it should _always_ be initialized to 255
+ * Mostly its not used for transparency...
+ * (except for blender-internal rendering, see [#34096]).
+ *
+ * \note red and blue are _not_ swapped, as they are with #MCol
+ */
typedef struct MLoopCol {
char r, g, b, a;
} MLoopCol;
diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h
index 5b37ff523cb..56683bf4797 100644
--- a/source/blender/makesdna/DNA_meta_types.h
+++ b/source/blender/makesdna/DNA_meta_types.h
@@ -121,6 +121,8 @@ typedef struct MetaBall {
#define MB_ELIPSOID 6
#define MB_CUBE 7
+#define MB_TYPE_SIZE_SQUARED(type) (type == MB_ELIPSOID)
+
/* ml->flag */
#define MB_NEGATIVE 2
#define MB_HIDE 8
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index ca703130edc..1636f2f4e4b 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -80,7 +80,9 @@ typedef enum eRigidBodyWorld_Flag {
/* sim data needs to be rebuilt */
RBW_FLAG_NEEDS_REBUILD = (1 << 1),
/* usse split impulse when stepping the simulation */
- RBW_FLAG_USE_SPLIT_IMPULSE = (1 << 2)
+ RBW_FLAG_USE_SPLIT_IMPULSE = (1 << 2),
+ /* need to step simulation after frame update */
+ RBW_FLAG_FRAME_UPDATE = (1 << 3)
} eRigidBodyWorld_Flag;
/* ******************************** */
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index f4a992011a2..418f33cca8a 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -367,6 +367,9 @@ typedef struct SolidLight {
} SolidLight;
typedef struct UserDef {
+ /* UserDef has separate do-version handling, and can be read from other files */
+ int versionfile, subversionfile;
+
int flag, dupflag;
int savetime;
char tempdir[768]; /* FILE_MAXDIR length */
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index d3cf7dc8095..54d2efcf4cf 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -120,6 +120,7 @@ typedef enum PropertySubType {
PROP_FACTOR = 15,
PROP_ANGLE = 16 | PROP_UNIT_ROTATION,
PROP_TIME = 17 | PROP_UNIT_TIME,
+ /* distance in 3d space, don't use for pixel distance for eg. */
PROP_DISTANCE = 18 | PROP_UNIT_LENGTH,
/* number arrays */
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index e9a0245210f..585e08ea706 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -111,6 +111,7 @@ set(APISRC
rna_main_api.c
rna_material_api.c
rna_mesh_api.c
+ rna_meta_api.c
rna_texture_api.c
rna_object_api.c
rna_pose_api.c
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 57cd77bdf93..5c6a414718b 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3251,7 +3251,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_main.c", "rna_main_api.c", RNA_def_main},
{"rna_material.c", "rna_material_api.c", RNA_def_material},
{"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
- {"rna_meta.c", NULL, RNA_def_meta},
+ {"rna_meta.c", "rna_meta_api.c", RNA_def_meta},
{"rna_modifier.c", NULL, RNA_def_modifier},
{"rna_nla.c", NULL, RNA_def_nla},
{"rna_nodetree.c", NULL, RNA_def_nodetree},
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 4fb26f2b007..c995d3b52c7 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -618,7 +618,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Brush_update");
/* number values */
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
RNA_def_property_int_funcs(prop, NULL, "rna_Brush_set_size", NULL);
RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
@@ -645,7 +645,7 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Spacing", "Spacing between brush daubs as a percentage of brush diameter");
RNA_def_property_update(prop, 0, "rna_Brush_update");
- prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 10, 200);
RNA_def_property_ui_text(prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues");
RNA_def_property_update(prop, 0, "rna_Brush_update");
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index c32255ac645..97ef4dfd0a8 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -971,6 +971,14 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
{
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+#ifndef RNA_RUNTIME
+ if (subtype == PROP_DISTANCE) {
+ fprintf(stderr, "%s: subtype does not apply to 'PROP_INT' \"%s.%s\"\n", __func__,
+ CONTAINER_RNA_ID(cont), identifier);
+ DefRNA.error = 1;
+ }
+#endif
+
iprop->hardmin = (subtype == PROP_UNSIGNED) ? 0 : INT_MIN;
iprop->hardmax = INT_MAX;
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 204f4018d56..1c0909c946f 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -267,6 +267,7 @@ void RNA_api_keymapitems(struct StructRNA *srna);
void RNA_api_main(struct StructRNA *srna);
void RNA_api_material(StructRNA *srna);
void RNA_api_mesh(struct StructRNA *srna);
+void RNA_api_meta(struct StructRNA *srna);
void RNA_api_object(struct StructRNA *srna);
void RNA_api_object_base(struct StructRNA *srna);
void RNA_api_pose(struct StructRNA *srna);
@@ -404,7 +405,9 @@ PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *
int rna_parameter_size(struct PropertyRNA *parm);
int rna_parameter_size_alloc(struct PropertyRNA *parm);
-struct Mesh *rna_Main_meshes_new_from_object(struct Main *bmain, struct ReportList *reports, struct Scene *sce, struct Object *ob, int apply_modifiers, int settings);
+struct Mesh *rna_Main_meshes_new_from_object(
+ struct Main *bmain, struct ReportList *reports, struct Scene *sce,
+ struct Object *ob, int apply_modifiers, int settings, int calc_tessface);
/* XXX, these should not need to be defined here~! */
struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 5b3a759697f..75ad64b1f29 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -37,6 +37,7 @@
#include "DNA_modifier_types.h"
#include "BLI_path_util.h"
+#include "BLI_utildefines.h"
#include "RNA_define.h"
#include "RNA_access.h"
@@ -266,7 +267,9 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
/* copied from Mesh_getFromObject and adapted to RNA interface */
/* settings: 1 - preview, 2 - render */
-Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Scene *sce, Object *ob, int apply_modifiers, int settings)
+Mesh *rna_Main_meshes_new_from_object(
+ Main *bmain, ReportList *reports, Scene *sce,
+ Object *ob, int apply_modifiers, int settings, int calc_tessface)
{
Mesh *tmpmesh;
Curve *tmpcu = NULL, *copycu;
@@ -449,8 +452,10 @@ Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Scene *s
break;
} /* end copy materials */
- /* cycles and exporters rely on this still */
- BKE_mesh_tessface_ensure(tmpmesh);
+ if (calc_tessface) {
+ /* cycles and exporters rely on this still */
+ BKE_mesh_tessface_ensure(tmpmesh);
+ }
/* make sure materials get updated in objects */
test_object_materials(&tmpmesh->id);
@@ -1163,6 +1168,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces");
parm = RNA_def_pointer(func, "mesh", "Mesh", "",
"Mesh created from object, remove it if it is only used for export");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 08eefc082bf..4813f25dea7 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -351,6 +351,8 @@ static void rna_def_metaball(BlenderRNA *brna)
/* anim */
rna_def_animdata_common(srna);
+
+ RNA_api_meta(srna);
}
void RNA_def_meta(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_meta_api.c b/source/blender/makesrna/intern/rna_meta_api.c
new file mode 100644
index 00000000000..500e202b16f
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_meta_api.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) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_meta_api.c
+ * \ingroup RNA
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+
+#include "BLO_sys_types.h"
+
+#include "BLI_utildefines.h"
+
+#include "ED_mball.h"
+
+#include "rna_internal.h" /* own include */
+
+#ifdef RNA_RUNTIME
+/* none */
+#else
+
+void RNA_api_meta(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "transform", "ED_mball_transform");
+ RNA_def_function_ui_description(func, "Transform meta elements by a matrix");
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index fee4b429a11..397e05b6a97 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -4083,6 +4083,21 @@ static void def_cmp_viewer(StructRNA *srna)
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Y", "");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
+static void def_cmp_composite(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_keyingscreen(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index d6e0ce2f11a..b7ec9235483 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -31,6 +31,8 @@
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc)
#endif
+/* WARNING! If you edit those strings, please do the same in relevant nodes files (under blender/nodes/...)! */
+
/* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */
DefNode( ShaderNode, SH_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" )
DefNode( ShaderNode, SH_NODE_MATERIAL, def_sh_material, "MATERIAL", Material, "Material", "" )
@@ -45,12 +47,12 @@ DefNode( ShaderNode, SH_NODE_GAMMA, 0, "GAMMA
DefNode( ShaderNode, SH_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" )
DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" )
+DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curves", "" )
+DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curves", "" )
DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" )
DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" )
DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" )
-DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze", "" )
+DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze Value", "" )
DefNode( ShaderNode, SH_NODE_MATERIAL_EXT, def_sh_material, "MATERIAL_EXT", ExtendedMaterial, "Extended Material", "" )
DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" )
@@ -68,14 +70,14 @@ DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "AT
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", "" )
+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", "" )
DefNode( ShaderNode, SH_NODE_VOLUME_TRANSPARENT, 0, "VOLUME_TRANSPARENT", VolumeTransparent,"Transparent Volume","" )
DefNode( ShaderNode, SH_NODE_VOLUME_ISOTROPIC, 0, "VOLUME_ISOTROPIC", VolumeIsotropic, "Isotropic Volume", "" )
DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "" )
@@ -109,7 +111,7 @@ DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_R
DefNode( CompositorNode, CMP_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
-DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curve", "" )
+DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curves", "" )
DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" )
DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" )
DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" )
@@ -124,7 +126,7 @@ DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETAL
DefNode( CompositorNode, CMP_NODE_HUE_SAT, def_cmp_hue_saturation, "HUE_SAT", HueSat, "Hue Saturation Value","" )
DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" )
DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" )
-DefNode( CompositorNode, CMP_NODE_COMPOSITE, 0, "COMPOSITE", Composite, "Composite", "" )
+DefNode( CompositorNode, CMP_NODE_COMPOSITE, def_cmp_composite, "COMPOSITE", Composite, "Composite", "" )
DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, def_cmp_output_file, "OUTPUT_FILE", OutputFile, "File Output", "" )
DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
DefNode( CompositorNode, CMP_NODE_TRANSLATE, def_cmp_translate, "TRANSLATE", Translate, "Translate", "" )
@@ -194,7 +196,7 @@ DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_R
DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
DefNode( TextureNode, TEX_NODE_VALTORGB, def_colorramp, "VALTORGB", ValToRGB, "ColorRamp", "" )
DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" )
-DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" )
+DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curves", "" )
DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" )
@@ -203,8 +205,8 @@ DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWE
DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" )
DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" )
-DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Compose", "" )
-DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Decompose", "" )
+DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Combine RGBA", "" )
+DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Separate RGBA", "" )
DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Value to Normal", "" )
DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" )
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 51725bda7f9..2b7df1ca317 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -34,6 +34,8 @@
#include <string.h>
#include <time.h>
+#include "BLI_utildefines.h"
+
#include "RNA_define.h"
#include "DNA_constraint_types.h"
@@ -109,9 +111,11 @@ static void rna_Scene_mat_convert_space(Object *ob, ReportList *reports, bPoseCh
/* copied from Mesh_getFromObject and adapted to RNA interface */
/* settings: 0 - preview, 1 - render */
-static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings)
+static Mesh *rna_Object_to_mesh(
+ Object *ob, ReportList *reports, Scene *sce,
+ int apply_modifiers, int settings, int calc_tessface)
{
- return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings);
+ return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings, calc_tessface);
}
/* mostly a copy from convertblender.c */
@@ -442,6 +446,7 @@ void RNA_api_object(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces");
parm = RNA_def_pointer(func, "mesh", "Mesh", "",
"Mesh created from object, remove it if it is only used for export");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index b737410bbab..7270ccadb81 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -163,13 +163,6 @@ static void rna_RigidBodyOb_type_set(PointerRNA *ptr, int value)
rbo->type = value;
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
-
-#ifdef WITH_BULLET
- /* do physics sim updates */
- if (rbo->physics_object) {
- RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
- }
-#endif
}
static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index c4269e1ddff..db9250ab2fc 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1926,7 +1926,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
/* unified paint settings that override the equivalent settings
* from the active brush */
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
@@ -3279,7 +3279,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_NO_MATERIAL_CACHING);
RNA_def_property_ui_text(prop, "Use Material Caching",
"Cache materials in the converter (this is faster, but can cause problems with older "
- "Singletexture and Multitexture games");
+ "Singletexture and Multitexture games)");
/* obstacle simulation */
prop = RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index ff0c9d9dec6..e0687295c70 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -236,7 +236,7 @@ static void rna_Sculpt_ShowDiffuseColor_update(Main *UNUSED(bmain), Scene *scene
{
Object *ob = (scene->basact) ? scene->basact->object : NULL;
- if (ob) {
+ if (ob && ob->sculpt) {
Sculpt *sd = scene->toolsettings->sculpt;
ob->sculpt->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE;
@@ -378,7 +378,7 @@ static void rna_def_sculpt(BlenderRNA *brna)
"Show diffuse color of object and overlay sculpt mask on top of it");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update");
- prop = RNA_def_property(srna, "detail_size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "detail_size", PROP_INT, PROP_NONE);
RNA_def_property_ui_range(prop, 2, 100, 0, 0);
RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)");
@@ -632,7 +632,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, SHRT_MAX);
RNA_def_property_ui_range(prop, 1, 100, 10, 3);
RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index fc67ae27387..e007fe67c0b 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -1842,7 +1842,7 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "file_format");
RNA_def_property_enum_items(prop, file_format_items);
- RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render ");
+ RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render");
RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index 1298d281de8..638f8f0ae01 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -161,7 +161,7 @@ static void createFacepa(ExplodeModifierData *emd,
mul_v3_fl(center, 0.25);
}
else
- mul_v3_fl(center, 0.3333f);
+ mul_v3_fl(center, 1.0f / 3.0f);
p = BLI_kdtree_find_nearest(tree, center, NULL, NULL);
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index c0e529f1eae..77250ec4025 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -1,4 +1,4 @@
-/**
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -25,6 +25,10 @@
* ***** END GPL LICENSE BLOCK *****
*/
+/** \file blender/modifiers/intern/MOD_ocean.c
+ * \ingroup modifiers
+ */
+
#include "MEM_guardedalloc.h"
#include "DNA_customdata_types.h"
@@ -486,7 +490,8 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
mlcol = &mloopcols[mp->loopstart + j];
mlcol->r = mlcol->g = mlcol->b = (char)(foam * 255);
- /* mc->a = 255; */ /* no need to set */
+ /* This needs to be set (render engine uses) */
+ mlcol->a = 255;
} while (j--);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 2654aa94be0..3722ad179d0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -54,7 +54,7 @@ void register_node_type_cmp_alphaover(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out);
- node_type_size(&ntype, 80, 40, 120);
+ node_type_size(&ntype, 80, 40, 160);
node_type_init(&ntype, node_alphaover_init);
node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index ca12b500e5b..6cff4039767 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -43,7 +43,7 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+ node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
node_type_size(&ntype, 80, 60, 200);
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index 24affc8f374..233a0627a7a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -56,7 +56,7 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW);
+ node_type_base(ttype, &ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_OPTIONS | NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_viewer_in, NULL);
node_type_size(&ntype, 80, 60, 200);
node_type_init(&ntype, node_composit_init_viewer);
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 3eb2cdc8ab7..1123a0dc44a 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -46,7 +46,7 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
if (ns->sockettype==SOCK_FLOAT)
*in= *from;
else
- *in= 0.333333f*(from[0]+from[1]+from[2]);
+ *in= (from[0]+from[1]+from[2]) / 3.0f;
}
else if (type_in==SOCK_VECTOR) {
if (ns->sockettype==SOCK_FLOAT) {
diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.c b/source/blender/nodes/shader/nodes/node_shader_brightness.c
index 9c23a29cae9..fa77fce4c88 100644
--- a/source/blender/nodes/shader/nodes/node_shader_brightness.c
+++ b/source/blender/nodes/shader/nodes/node_shader_brightness.c
@@ -43,6 +43,11 @@ static bNodeSocketTemplate sh_node_brightcontrast_out[] = {
{ -1, 0, "" }
};
+static int gpu_shader_brightcontrast(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
+{
+ return GPU_stack_link(mat, "brightness_contrast", in, out);
+}
+
void register_node_type_sh_brightcontrast(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -54,7 +59,7 @@ void register_node_type_sh_brightcontrast(bNodeTreeType *ttype)
node_type_init(&ntype, NULL);
node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, NULL);
- node_type_gpu(&ntype, NULL);
+ node_type_gpu(&ntype, gpu_shader_brightcontrast);
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index 25da4f19e52..43a8ba1babf 100644
--- a/source/blender/nodes/texture/nodes/node_texture_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -61,7 +61,7 @@ void register_node_type_tex_compose(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, TEX_NODE_COMPOSE, "Compose RGBA", NODE_CLASS_OP_COLOR, 0);
+ node_type_base(ttype, &ntype, TEX_NODE_COMPOSE, "Combine RGBA", NODE_CLASS_OP_COLOR, 0);
node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);
diff --git a/source/blender/nodes/texture/nodes/node_texture_decompose.c b/source/blender/nodes/texture/nodes/node_texture_decompose.c
index a2875c31d9e..0866428ca6c 100644
--- a/source/blender/nodes/texture/nodes/node_texture_decompose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_decompose.c
@@ -82,7 +82,7 @@ void register_node_type_tex_decompose(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, TEX_NODE_DECOMPOSE, "Decompose RGBA", NODE_CLASS_OP_COLOR, 0);
+ node_type_base(ttype, &ntype, TEX_NODE_DECOMPOSE, "Separate RGBA", NODE_CLASS_OP_COLOR, 0);
node_type_socket_templates(&ntype, inputs, outputs);
node_type_size(&ntype, 100, 60, 150);
node_type_exec(&ntype, exec);
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index d4c8033589a..fad3e4a35cd 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -48,11 +48,13 @@
static int bpy_bm_op_as_py_error(BMesh *bm)
{
if (BMO_error_occurred(bm)) {
+ /* note: we could have multiple errors */
const char *errmsg;
if (BMO_error_get(bm, &errmsg, NULL)) {
PyErr_Format(PyExc_RuntimeError,
"bmesh operator: %.200s",
errmsg);
+ BMO_error_clear(bm);
return -1;
}
}
@@ -692,6 +694,9 @@ PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw)
{
BPY_BM_CHECK_OBJ(py_bm);
bm = py_bm->bm;
+
+ /* could complain about entering with exceptions... */
+ BMO_error_clear(bm);
}
else {
PyErr_SetString(PyExc_TypeError,
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 0abff03da46..b95db945eb1 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -50,6 +50,8 @@
#include "bmesh_py_types_customdata.h"
#include "bmesh_py_types_meshdata.h"
+static void bm_dealloc_editmode_warn(BPy_BMesh *self);
+
/* Common Flags
* ************ */
@@ -847,6 +849,8 @@ static PyObject *bpy_bmesh_free(BPy_BMesh *self)
if (self->bm) {
BMesh *bm = self->bm;
+ bm_dealloc_editmode_warn(self);
+
if ((self->flag & BPY_BMFLAG_IS_WRAPPED) == 0) {
BM_mesh_free(bm);
}
@@ -2828,6 +2832,8 @@ static void bpy_bmesh_dealloc(BPy_BMesh *self)
/* have have been freed by bmesh */
if (bm) {
+ bm_dealloc_editmode_warn(self);
+
BM_data_layer_free(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
BM_data_layer_free(bm, &bm->edata, CD_BM_ELEM_PYPTR);
BM_data_layer_free(bm, &bm->pdata, CD_BM_ELEM_PYPTR);
@@ -3638,3 +3644,51 @@ char *BPy_BMElem_StringFromHType(const char htype)
static char ret[32];
return BPy_BMElem_StringFromHType_ex(htype, ret);
}
+
+
+/* -------------------------------------------------------------------- */
+/* keep at bottom */
+/* BAD INCLUDES */
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_tessmesh.h"
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
+#include "MEM_guardedalloc.h"
+
+/* there are cases where this warning isnt needed, otherwise it could be made into an error */
+static void bm_dealloc_warn(const char *mesh_name)
+{
+ PySys_WriteStdout("Modified BMesh '%.200s' from a wrapped editmesh is freed without a call "
+ "to bmesh.update_edit_mesh(mesh, destructive=True), this is will likely cause a crash\n",
+ mesh_name);
+}
+
+/* this function is called on free, it should stay quite fast */
+static void bm_dealloc_editmode_warn(BPy_BMesh *self)
+{
+ if (self->flag & BPY_BMFLAG_IS_WRAPPED) {
+ /* likely editmesh */
+ BMesh *bm = self->bm;
+ Scene *scene;
+ for (scene = G.main->scene.first; scene; scene = scene->id.next) {
+ Base *base = scene->basact;
+ if (base && base->object->type == OB_MESH) {
+ Mesh *me = base->object->data;
+ BMEditMesh *em = me->edit_btmesh;
+ if (em && em->bm == bm) {
+ /* not foolproof, scripter may have added/removed verts */
+ if (((em->vert_index && (MEM_allocN_len(em->vert_index) / sizeof(*em->vert_index)) != bm->totvert)) ||
+ ((em->edge_index && (MEM_allocN_len(em->edge_index) / sizeof(*em->edge_index)) != bm->totedge)) ||
+ ((em->face_index && (MEM_allocN_len(em->face_index) / sizeof(*em->face_index)) != bm->totface)))
+ {
+ bm_dealloc_warn(me->id.name + 2);
+ break;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index b6d2f624229..7c89972b486 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -74,7 +74,7 @@ typedef struct GHashKey {
static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid)
{
GHashKey *key = MEM_mallocN(sizeof(GHashKey), "Py i18n GHashKey");
- key->msgctxt = BLI_strdup(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT_BPY_INTERN);
+ key->msgctxt = BLI_strdup(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT_BPY);
key->msgid = BLI_strdup(msgid);
return key;
}
@@ -195,7 +195,7 @@ static void _build_translations_cache(PyObject *py_messages, const char *locale)
else {
PyObject *tmp = PyTuple_GET_ITEM(pykey, 0);
if (tmp == Py_None) {
- msgctxt = BLF_I18NCONTEXT_DEFAULT;
+ msgctxt = BLF_I18NCONTEXT_DEFAULT_BPY;
}
else if (PyUnicode_Check(tmp)) {
msgctxt = _PyUnicode_AsString(tmp);
@@ -288,9 +288,7 @@ const char *BPY_app_translations_py_pgettext(const char *msgctxt, const char *ms
_ghashutil_keyfree((void *)key);
- if (tmp)
- return tmp;
- return msgid;
+ return tmp ? tmp : msgid;
#undef STATIC_LOCALE_SIZE
}
@@ -435,8 +433,8 @@ static PyObject *app_translations_contexts_make(void)
PyDoc_STRVAR(app_translations_contexts_doc,
"A named tuple containing all pre-defined translation contexts.\n"
- "WARNING: do not use the \"" BLF_I18NCONTEXT_DEFAULT_BPY_INTERN "\" context, it is internally assimilated as the "
- "default one!\n"
+ "WARNING: Never use a (new) context starting with \"" BLF_I18NCONTEXT_DEFAULT_BPY "\", it would be internally "
+ "assimilated as the default one!\n"
);
PyDoc_STRVAR(app_translations_contexts_C_to_py_doc,
@@ -495,6 +493,39 @@ PyGetSetDef app_translations_getseters[] = {
{NULL}
};
+/* pgettext helper. */
+static PyObject *_py_pgettext(PyObject *args, PyObject *kw, const char *(*_pgettext)(const char *, const char *))
+{
+ static const char *kwlist[] = {"msgid", "msgctxt", NULL};
+
+#ifdef WITH_INTERNATIONAL
+ char *msgid, *msgctxt = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw,
+ "s|z:bpy.app.translations.pgettext",
+ (char **)kwlist, &msgid, &msgctxt))
+ {
+ return NULL;
+ }
+
+ return PyUnicode_FromString((*_pgettext)(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT, msgid));
+#else
+ PyObject *msgid, *msgctxt;
+ (void)_pgettext;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kw,
+ "O|O:bpy.app.translations.pgettext",
+ (char **)kwlist, &msgid, &msgctxt))
+ {
+ return NULL;
+ }
+
+ Py_INCREF(msgid);
+
+ return msgid;
+#endif
+}
+
PyDoc_STRVAR(app_translations_pgettext_doc,
".. method:: pgettext(msgid, msgctxt)\n"
"\n"
@@ -502,7 +533,8 @@ PyDoc_STRVAR(app_translations_pgettext_doc,
" NOTE: The (msgid, msgctxt) parameter orders has been switched compared to gettext function, to allow\n"
" single-parameter calls (context then defaults to BLF_I18NCONTEXT_DEFAULT).\n"
" NOTE: You should really rarely need to use this function in regular addon code, as all translation should be\n"
-" handled by Blender internal code.\n"
+" handled by Blender internal code. The only exception are string containing formatting (like \"File: %r\"),\n"
+" but you should rather use pgettext_iface/_tip in those cases!\n"
" Note: Does nothing when Blender is built without internationalization support (hence always returns msgid).\n"
"\n"
" :arg msgid: The string to translate.\n"
@@ -515,26 +547,45 @@ PyDoc_STRVAR(app_translations_pgettext_doc,
);
static PyObject *app_translations_pgettext(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
{
- /* Note we could optimize this a bit when WITH_INTERNATIONAL is not defined, but don't think "code complexity" would
- * be worth it, as this func should not often be used!
- */
- /* XXX This code fails with scons when WITH_INTERNATIONAL is not defined, at link time, stating that BLF_pgettext
- * is undefined... So using #ifdef after all, rather than removing scons from blender trunk!
- */
- static const char *kwlist[] = {"msgid", "msgctxt", NULL};
- char *msgid, *msgctxt = NULL;
+ return _py_pgettext(args, kw, BLF_pgettext);
+}
- if (!PyArg_ParseTupleAndKeywords(args, kw, "s|z:bpy.app.translations.pgettext", (char **)kwlist,
- &msgid, &msgctxt))
- {
- return NULL;
- }
+PyDoc_STRVAR(app_translations_pgettext_iface_doc,
+".. method:: pgettext_iface(msgid, msgctxt)\n"
+"\n"
+" Try to translate the given msgid (with optional msgctxt), if labels' translation is enabled.\n"
+" NOTE: See pgettext notes.\n"
+"\n"
+" :arg msgid: The string to translate.\n"
+" :type msgid: string\n"
+" :arg msgctxt: The translation context.\n"
+" :type msgctxt: string or None\n"
+" :default msgctxt: BLF_I18NCONTEXT_DEFAULT value.\n"
+" :return: The translated string (or msgid if no translation was found).\n"
+"\n"
+);
+static PyObject *app_translations_pgettext_iface(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
+{
+ return _py_pgettext(args, kw, BLF_translate_do_iface);
+}
-#ifdef WITH_INTERNATIONAL
- return PyUnicode_FromString(BLF_pgettext(msgctxt ? msgctxt : BLF_I18NCONTEXT_DEFAULT, msgid));
-#else
- return PyUnicode_FromString(msgid);
-#endif
+PyDoc_STRVAR(app_translations_pgettext_tip_doc,
+".. method:: pgettext(msgid, msgctxt)\n"
+"\n"
+" Try to translate the given msgid (with optional msgctxt), if tooltips' translation is enabled.\n"
+" NOTE: See pgettext notes.\n"
+"\n"
+" :arg msgid: The string to translate.\n"
+" :type msgid: string\n"
+" :arg msgctxt: The translation context.\n"
+" :type msgctxt: string or None\n"
+" :default msgctxt: BLF_I18NCONTEXT_DEFAULT value.\n"
+" :return: The translated string (or msgid if no translation was found).\n"
+"\n"
+);
+static PyObject *app_translations_pgettext_tip(BlenderAppTranslations *UNUSED(self), PyObject *args, PyObject *kw)
+{
+ return _py_pgettext(args, kw, BLF_translate_do_tooltip);
}
PyDoc_STRVAR(app_translations_locale_explode_doc,
@@ -575,6 +626,10 @@ PyMethodDef app_translations_methods[] = {
app_translations_py_messages_unregister_doc},
{(char *)"pgettext", (PyCFunction)app_translations_pgettext, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_pgettext_doc},
+ {(char *)"pgettext_iface", (PyCFunction)app_translations_pgettext_iface, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_iface_doc},
+ {(char *)"pgettext_tip", (PyCFunction)app_translations_pgettext_tip, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
+ app_translations_pgettext_tip_doc},
{(char *)"locale_explode", (PyCFunction)app_translations_locale_explode, METH_VARARGS | METH_KEYWORDS | METH_STATIC,
app_translations_locale_explode_doc},
{NULL}
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 55dadc14989..12286fc9999 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -1042,6 +1042,10 @@ static void image_mipmap_test(Tex *tex, ImBuf *ibuf)
IMB_makemipmap(ibuf, tex->imaflag & TEX_GAUSS_MIP);
BLI_unlock_thread(LOCK_IMAGE);
}
+ /* if no mipmap could be made, fall back on non-mipmap render */
+ if (ibuf->mipmap[0] == NULL) {
+ tex->imaflag &= ~TEX_MIPMAP;
+ }
}
}
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index 89f67335c39..ea42049989b 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -938,17 +938,18 @@ static void build_permutation_table(unsigned short permutation[], unsigned short
permutation[i] = temp_permutation[entry];
/* delete entry */
- for(k = entry; k < nr_entries_left - 1; k++)
+ for (k = entry; k < nr_entries_left - 1; k++) {
temp_permutation[k] = temp_permutation[k + 1];
+ }
}
/* verify permutation table
* every entry must appear exactly once
*/
#if 0
- for(i = 0; i < number_of_rays; i++) temp_permutation[i] = 0;
- for(i = 0; i < number_of_rays; i++) ++temp_permutation[permutation[i]];
- for(i = 0; i < number_of_rays; i++) BLI_assert(temp_permutation[i] == 1);
+ for (i = 0; i < number_of_rays; i++) temp_permutation[i] = 0;
+ for (i = 0; i < number_of_rays; i++) ++temp_permutation[permutation[i]];
+ for (i = 0; i < number_of_rays; i++) BLI_assert(temp_permutation[i] == 1);
#endif
}
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 73c3b1c9366..05601a6b5e6 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1338,6 +1338,7 @@ static void render_scene(Render *re, Scene *sce, int cfra)
resc->main = re->main;
resc->scene = sce;
resc->lay = sce->lay;
+ resc->scene_color_manage = BKE_scene_check_color_management_enabled(sce);
/* ensure scene has depsgraph, base flags etc OK */
BKE_scene_set_background(re->main, sce);
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 11c6356f9c5..be1a3806e43 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -1101,6 +1101,10 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
if (BKE_imtype_valid_depths(rd->im_format.imtype) & (R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_24 | R_IMF_CHAN_DEPTH_32)) {
IMB_float_from_rect(ibuf);
}
+ else {
+ /* ensure no float buffer remained from previous frame */
+ ibuf->rect_float = NULL;
+ }
}
/* color -> grayscale */
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 3ea94981cac..15ca865643b 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -171,9 +171,9 @@ static void tex_normal_derivate(Tex *tex, TexResult *texres)
do_colorband(tex->coba, texres->nor[2], col);
fac3= (col[0]+col[1]+col[2]);
- texres->nor[0]= 0.3333f*(fac0 - fac1);
- texres->nor[1]= 0.3333f*(fac0 - fac2);
- texres->nor[2]= 0.3333f*(fac0 - fac3);
+ texres->nor[0]= (fac0 - fac1) / 3.0f;
+ texres->nor[1]= (fac0 - fac2) / 3.0f;
+ texres->nor[2]= (fac0 - fac3) / 3.0f;
return;
}
@@ -1754,7 +1754,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
/* center, main return value */
texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres, pool);
- cd = fromrgb ? (texres->tr + texres->tg + texres->tb)*0.33333333f : texres->tin;
+ cd = fromrgb ? (texres->tr + texres->tg + texres->tb) / 3.0f : texres->tin;
if (mtex->texco == TEXCO_UV) {
/* for the uv case, use the same value for both du/dv,
@@ -1768,7 +1768,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = 0.f;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
/* +v val */
tco[0] = co[0] + compat_bump->dudnv*du;
@@ -1776,7 +1776,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = 0.f;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- vd = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ vd = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
}
else {
float tu[3], tv[3];
@@ -1810,7 +1810,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = co[2] + tu[2]*du;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ ud = idu*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
/* +v val */
tco[0] = co[0] + tv[0]*dv;
@@ -1818,7 +1818,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
tco[2] = co[2] + tv[2]*dv;
texco_mapping(shi, tex, mtex, tco, dx, dy, texv, dxt, dyt);
multitex_mtex(shi, mtex, texv, dxt, dyt, &ttexr, pool);
- vd = idv*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb)*0.33333333f : ttexr.tin));
+ vd = idv*(cd - (fromrgb ? (ttexr.tr + ttexr.tg + ttexr.tb) / 3.0f : ttexr.tin));
}
/* bumped normal */
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index 77d6644479a..92099060bf5 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -185,7 +185,7 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
for (y = 0; y < ibuf->y; y++) {
for (x = 0; x < ibuf->x; x++) {
/* currently averaged to monchrome */
- vd->dataset[BLI_VOXEL_INDEX(x, y, z, vd->resol)] = (rf[0] + rf[1] + rf[2]) * 0.333f;
+ vd->dataset[BLI_VOXEL_INDEX(x, y, z, vd->resol)] = (rf[0] + rf[1] + rf[2]) / 3.0f;
rf += 4;
}
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index e91d4f388af..a1437b70090 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -171,7 +171,7 @@ int WM_modal_tweak_exit(struct wmEvent *evt, int tweak_event);
void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference);
void WM_main_add_notifier(unsigned int type, void *reference);
-void wm_event_add (struct wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
+void wm_event_add(struct wmWindow *win, const struct wmEvent *event_to_add);
/* at maximum, every timestep seconds it triggers event_type events */
struct wmTimer *WM_event_add_timer(struct wmWindowManager *wm, struct wmWindow *win, int event_type, double timestep);
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 43369154dbb..49ee759bbf2 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -64,7 +64,7 @@ wmKeyMapItem *WM_keymap_add_menu(struct wmKeyMap *keymap, const char *idname, in
int val, int modifier, int keymodifier);
int WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi);
-char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len);
+int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len);
wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid);
wmKeyMap *WM_keymap_find(struct wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid);
@@ -81,6 +81,7 @@ wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, st
wmKeyMap *WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname);
wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value);
wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value);
+wmKeyMapItem *WM_modalkeymap_find_propvalue(wmKeyMap *km, const int propvalue);
void WM_modalkeymap_assign(struct wmKeyMap *km, const char *opname);
/* Keymap Editor */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 91be03986c1..6044e3fb771 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -800,7 +800,7 @@ void wm_draw_update(bContext *C)
if (state == GHOST_kWindowStateMinimized) {
/* do not update minimized windows, it gives issues on intel drivers (see [#33223])
- * anyway, it seems logical to skip update for invisile windows
+ * anyway, it seems logical to skip update for invisible windows
*/
continue;
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 9e3722777ba..206297d2c95 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -91,9 +91,9 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
/* ************ event management ************** */
-void wm_event_add(wmWindow *win, wmEvent *event_to_add)
+void wm_event_add(wmWindow *win, const wmEvent *event_to_add)
{
- wmEvent *event = MEM_callocN(sizeof(wmEvent), "wmEvent");
+ wmEvent *event = MEM_mallocN(sizeof(wmEvent), "wmEvent");
*event = *event_to_add;
@@ -590,6 +590,9 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
}
if (wm_operator_register_check(wm, op->type)) {
+ /* take ownership of reports (in case python provided own) */
+ op->reports->flag |= RPT_FREE;
+
wm_operator_register(C, op);
WM_operator_region_active_win_set(C);
}
@@ -935,6 +938,9 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
wm_operator_finished(C, op, 0);
}
else if (retval & OPERATOR_RUNNING_MODAL) {
+ /* take ownership of reports (in case python provided own) */
+ op->reports->flag |= RPT_FREE;
+
/* grab cursor during blocking modal ops (X11)
* Also check for macro
*/
@@ -1170,13 +1176,6 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, short context,
if (!is_undo && wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--;
- /* keep the reports around if needed later */
- if ((retval & OPERATOR_RUNNING_MODAL) ||
- ((retval & OPERATOR_FINISHED) && wm_operator_register_check(CTX_wm_manager(C), ot)))
- {
- reports->flag |= RPT_FREE; /* let blender manage freeing */
- }
-
return retval;
}
@@ -1766,6 +1765,10 @@ static int wm_handlers_do_intern(bContext *C, wmEvent *event, ListBase *handlers
break;
}
else {
+ if (action & WM_HANDLER_HANDLED)
+ if (G.debug & (G_DEBUG_EVENTS | G_DEBUG_HANDLERS))
+ printf("%s: handled - and pass on! '%s'\n", __func__, kmi->idname);
+
#ifndef NDEBUG
if (do_debug_handler) {
printf("%s: un-handled '%s'...", __func__, kmi->idname);
@@ -3042,7 +3045,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.keymodifier = 0;
/* this case happened with an external numpad, it's not really clear
- * why, but it's also impossible to map a key modifier to an unknwon
+ * why, but it's also impossible to map a key modifier to an unknown
* key, so it shouldn't harm */
if (event.keymodifier == UNKNOWNKEY)
event.keymodifier = 0;
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 168c2312d9f..302bf61756a 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -309,17 +309,19 @@ static void wm_gesture_draw_lasso(wmGesture *gt)
static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
{
rcti *rect = (rcti *)gt->customdata;
-
+ int winsizex = WM_window_pixels_x(win);
+ int winsizey = WM_window_pixels_y(win);
+
glEnable(GL_LINE_STIPPLE);
glColor3ub(96, 96, 96);
glLineStipple(1, 0xCCCC);
- sdrawline(rect->xmin - win->sizex, rect->ymin, rect->xmin + win->sizex, rect->ymin);
- sdrawline(rect->xmin, rect->ymin - win->sizey, rect->xmin, rect->ymin + win->sizey);
+ sdrawline(rect->xmin - winsizex, rect->ymin, rect->xmin + winsizex, rect->ymin);
+ sdrawline(rect->xmin, rect->ymin - winsizey, rect->xmin, rect->ymin + winsizey);
glColor3ub(255, 255, 255);
glLineStipple(1, 0x3333);
- sdrawline(rect->xmin - win->sizex, rect->ymin, rect->xmin + win->sizex, rect->ymin);
- sdrawline(rect->xmin, rect->ymin - win->sizey, rect->xmin, rect->ymin + win->sizey);
+ sdrawline(rect->xmin - winsizex, rect->ymin, rect->xmin + winsizex, rect->ymin);
+ sdrawline(rect->xmin, rect->ymin - winsizey, rect->xmin, rect->ymin + winsizey);
glDisable(GL_LINE_STIPPLE);
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 3739462ac2c..92a310ac34e 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -126,10 +126,13 @@ static int wm_keymap_item_equals(wmKeyMapItem *a, wmKeyMapItem *b)
/* properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi */
void WM_keymap_properties_reset(wmKeyMapItem *kmi, struct IDProperty *properties)
{
- WM_operator_properties_free(kmi->ptr);
- MEM_freeN(kmi->ptr);
+ if (LIKELY(kmi->ptr)) {
+ WM_operator_properties_free(kmi->ptr);
+ MEM_freeN(kmi->ptr);
+
+ kmi->ptr = NULL;
+ }
- kmi->ptr = NULL;
kmi->properties = properties;
wm_keymap_item_properties_set(kmi);
@@ -734,6 +737,24 @@ wmKeyMapItem *WM_modalkeymap_add_item_str(wmKeyMap *km, int type, int val, int m
return kmi;
}
+wmKeyMapItem *WM_modalkeymap_find_propvalue(wmKeyMap *km, const int propvalue)
+{
+
+ if (km->flag & KEYMAP_MODAL) {
+ wmKeyMapItem *kmi;
+ for (kmi = km->items.first; kmi; kmi = kmi->next) {
+ if (kmi->propvalue == propvalue) {
+ return kmi;
+ }
+ }
+ }
+ else {
+ BLI_assert(!"called with non modal keymap");
+ }
+
+ return NULL;
+}
+
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
@@ -782,7 +803,7 @@ const char *WM_key_event_string(short type)
return "";
}
-char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
+int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
{
char buf[128];
@@ -815,9 +836,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
}
strcat(buf, WM_key_event_string(kmi->type));
- BLI_strncpy(str, buf, len);
-
- return str;
+ return BLI_snprintf(str, len, "%s", buf);
}
static wmKeyMapItem *wm_keymap_item_find_handlers(
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index e22694a6560..41dd618caa5 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1204,8 +1204,13 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX);
- if (cursor)
- RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX);
+ if (cursor) {
+ PropertyRNA *prop;
+
+ prop = RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX,
+ "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ }
}
@@ -1341,7 +1346,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
uiBlockClearFlag(block, UI_BLOCK_LOOP);
- /* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogs have many items
+ /* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogues have many items
* where quitting by accident is very annoying */
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
@@ -1998,7 +2003,7 @@ static int wm_link_append_poll(bContext *C)
if (WM_operator_winactive(C)) {
/* linking changes active object which is pretty useful in general,
* but which totally confuses edit mode (i.e. it becoming not so obvious
- * to leave from edit mode and inwalid tools in toolbar might be displayed)
+ * to leave from edit mode and invalid tools in toolbar might be displayed)
* so disable link/append when in edit mode (sergey) */
if (CTX_data_edit_object(C))
return 0;
@@ -3256,6 +3261,7 @@ static void radial_control_set_initial_mouse(RadialControl *rc, wmEvent *event)
rc->initial_mouse[1] = event->y;
switch (rc->subtype) {
+ case PROP_NONE:
case PROP_DISTANCE:
d[0] = rc->initial_value;
break;
@@ -3355,6 +3361,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
float zoom[2], col[3] = {1, 1, 1};
switch (rc->subtype) {
+ case PROP_NONE:
case PROP_DISTANCE:
r1 = rc->current_value;
r2 = rc->initial_value;
@@ -3593,8 +3600,8 @@ static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* get subtype of property */
rc->subtype = RNA_property_subtype(rc->prop);
- if (!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
- BKE_report(op->reports, RPT_ERROR, "Property must be a distance, a factor, or an angle");
+ if (!ELEM4(rc->subtype, PROP_NONE, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
+ BKE_report(op->reports, RPT_ERROR, "Property must be a none, distance, a factor, or an angle");
MEM_freeN(rc);
return OPERATOR_CANCELLED;
}
@@ -3678,6 +3685,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
/* calculate new value and apply snapping */
switch (rc->subtype) {
+ case PROP_NONE:
case PROP_DISTANCE:
new_value = dist;
if (snap) new_value = ((int)new_value + 5) / 10 * 10;
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index d8b987a196c..a1ab0de49cf 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -763,6 +763,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
// window_handle(win, INPUTCHANGE, win->active);
/* bad ghost support for modifier keys... so on activate we set the modifiers again */
+
+ /* TODO: This is not correct since a modifier may be held when a window is activated...
+ * better solve this at ghost level. attempted fix r54450 but it caused bug [#34255] */
kdata.ascii = '\0';
kdata.utf8_buf[0] = '\0';
if (win->eventstate->shift && !query_qual(SHIFT)) {