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>2011-01-09 18:07:14 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-01-09 18:07:14 +0300
commit0ec378f3fea3be9235b5bc8cb976d6126ae808f5 (patch)
tree5266bf2dff77d453046265892380e441cb4643be /source/blender/editors
parentddcb91fc213cb9d9f87558f88a4831cd4c8e2791 (diff)
parent99e203dbd46237c204fa697374e21769473955f5 (diff)
Merged changes in the trunk up to revision 34193.
Conflicts resolved: source/blender/editors/animation/anim_channels_defines.c source/blender/editors/animation/anim_channels_edit.c source/blender/editors/animation/keyframes_draw.c source/blender/editors/animation/keyframes_edit.c source/blender/editors/include/ED_anim_api.h source/blender/editors/space_nla/nla_channels.c source/blender/makesrna/intern/CMakeLists.txt source/blender/makesrna/intern/rna_main_api.c source/blender/makesrna/intern/rna_scene.c API changes resolved: source/blender/freestyle/intern/system/PythonInterpreter.h
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c81
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c8
-rw-r--r--source/blender/editors/animation/anim_deps.c1
-rw-r--r--source/blender/editors/animation/anim_filter.c71
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c3
-rw-r--r--source/blender/editors/animation/anim_markers.c281
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/animation/drivers.c1
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c1
-rw-r--r--source/blender/editors/animation/keyframes_draw.c14
-rw-r--r--source/blender/editors/animation/keyframes_edit.c14
-rw-r--r--source/blender/editors/animation/keyframes_general.c1
-rw-r--r--source/blender/editors/animation/keyframing.c45
-rw-r--r--source/blender/editors/animation/keyingsets.c70
-rw-r--r--source/blender/editors/armature/editarmature.c1
-rw-r--r--source/blender/editors/armature/editarmature_generate.c3
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c1
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c1
-rw-r--r--source/blender/editors/armature/meshlaplacian.c14
-rw-r--r--source/blender/editors/armature/poseSlide.c1
-rw-r--r--source/blender/editors/armature/poseUtils.c1
-rw-r--r--source/blender/editors/armature/poselib.c1
-rw-r--r--source/blender/editors/armature/poseobject.c3
-rw-r--r--source/blender/editors/armature/reeb.c1
-rw-r--r--source/blender/editors/curve/editcurve.c102
-rw-r--r--source/blender/editors/curve/editfont.c7
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c3
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c11
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c1
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c304
-rw-r--r--source/blender/editors/include/ED_anim_api.h3
-rw-r--r--source/blender/editors/include/ED_gpencil.h4
-rw-r--r--source/blender/editors/include/ED_keyframing.h4
-rw-r--r--source/blender/editors/include/ED_markers.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h3
-rw-r--r--source/blender/editors/include/ED_retopo.h111
-rw-r--r--source/blender/editors/include/ED_transform.h1
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/interface/interface.c4
-rw-r--r--source/blender/editors/interface/interface_draw.c3
-rw-r--r--source/blender/editors/interface/interface_handlers.c18
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/interface/interface_layout.c1
-rw-r--r--source/blender/editors/interface/interface_ops.c2
-rw-r--r--source/blender/editors/interface/interface_panel.c3
-rw-r--r--source/blender/editors/interface/interface_regions.c1
-rw-r--r--source/blender/editors/interface/interface_templates.c17
-rw-r--r--source/blender/editors/interface/interface_utils.c14
-rw-r--r--source/blender/editors/interface/interface_widgets.c15
-rw-r--r--source/blender/editors/interface/resources.c9
-rw-r--r--source/blender/editors/interface/view2d.c20
-rw-r--r--source/blender/editors/interface/view2d_ops.c19
-rw-r--r--source/blender/editors/mesh/editface.c1
-rw-r--r--source/blender/editors/mesh/editmesh.c3
-rw-r--r--source/blender/editors/mesh/editmesh_add.c17
-rw-r--r--source/blender/editors/mesh/editmesh_lib.c3
-rw-r--r--source/blender/editors/mesh/editmesh_loop.c6
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c34
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c92
-rw-r--r--source/blender/editors/mesh/loopcut.c4
-rw-r--r--source/blender/editors/mesh/mesh_data.c23
-rw-r--r--source/blender/editors/mesh/meshtools.c1
-rw-r--r--source/blender/editors/metaball/mball_edit.c9
-rw-r--r--source/blender/editors/object/object_add.c16
-rw-r--r--source/blender/editors/object/object_bake.c1
-rw-r--r--source/blender/editors/object/object_constraint.c1
-rw-r--r--source/blender/editors/object/object_edit.c6
-rw-r--r--source/blender/editors/object/object_group.c2
-rw-r--r--source/blender/editors/object/object_hook.c1
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_lattice.c5
-rw-r--r--source/blender/editors/object/object_modifier.c43
-rw-r--r--source/blender/editors/object/object_ops.c3
-rw-r--r--source/blender/editors/object/object_relations.c8
-rw-r--r--source/blender/editors/object/object_select.c1
-rw-r--r--source/blender/editors/object/object_shapekey.c1
-rw-r--r--source/blender/editors/object/object_transform.c1
-rw-r--r--source/blender/editors/object/object_vgroup.c70
-rw-r--r--source/blender/editors/physics/particle_boids.c4
-rw-r--r--source/blender/editors/physics/particle_edit.c40
-rw-r--r--source/blender/editors/physics/particle_object.c3
-rw-r--r--source/blender/editors/physics/physics_fluid.c1
-rw-r--r--source/blender/editors/physics/physics_pointcache.c8
-rw-r--r--source/blender/editors/render/render_internal.c1
-rw-r--r--source/blender/editors/render/render_opengl.c1
-rw-r--r--source/blender/editors/render/render_preview.c40
-rw-r--r--source/blender/editors/render/render_shading.c11
-rw-r--r--source/blender/editors/screen/area.c8
-rw-r--r--source/blender/editors/screen/glutil.c3
-rw-r--r--source/blender/editors/screen/screen_context.c4
-rw-r--r--source/blender/editors/screen/screen_edit.c1
-rw-r--r--source/blender/editors/screen/screen_ops.c40
-rw-r--r--source/blender/editors/screen/screendump.c54
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c35
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h25
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c10
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c632
-rw-r--r--source/blender/editors/sculpt_paint/paint_undo.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c59
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c21
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c147
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h6
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c1
-rw-r--r--source/blender/editors/sound/sound_ops.c6
-rw-r--r--source/blender/editors/space_action/action_draw.c4
-rw-r--r--source/blender/editors/space_action/action_edit.c10
-rw-r--r--source/blender/editors/space_action/action_select.c1
-rw-r--r--source/blender/editors/space_action/space_action.c3
-rw-r--r--source/blender/editors/space_api/spacetypes.c4
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c7
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c5
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c1
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c9
-rw-r--r--source/blender/editors/space_console/console_draw.c5
-rw-r--r--source/blender/editors/space_console/console_ops.c10
-rw-r--r--source/blender/editors/space_console/space_console.c2
-rw-r--r--source/blender/editors/space_file/file_draw.c1
-rw-r--r--source/blender/editors/space_file/file_ops.c3
-rw-r--r--source/blender/editors/space_file/file_panels.c1
-rw-r--r--source/blender/editors/space_file/filelist.c1
-rw-r--r--source/blender/editors/space_file/filesel.c1
-rw-r--r--source/blender/editors/space_file/space_file.c1
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c1
-rw-r--r--source/blender/editors/space_graph/graph_draw.c3
-rw-r--r--source/blender/editors/space_graph/graph_edit.c10
-rw-r--r--source/blender/editors/space_graph/graph_ops.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c1
-rw-r--r--source/blender/editors/space_graph/space_graph.c37
-rw-r--r--source/blender/editors/space_image/image_buttons.c3
-rw-r--r--source/blender/editors/space_image/image_draw.c2
-rw-r--r--source/blender/editors/space_image/image_header.c6
-rw-r--r--source/blender/editors/space_image/image_ops.c7
-rw-r--r--source/blender/editors/space_image/image_render.c2
-rw-r--r--source/blender/editors/space_image/space_image.c5
-rw-r--r--source/blender/editors/space_info/info_draw.c4
-rw-r--r--source/blender/editors/space_info/info_ops.c1
-rw-r--r--source/blender/editors/space_info/info_report.c2
-rw-r--r--source/blender/editors/space_info/info_stats.c8
-rw-r--r--source/blender/editors/space_info/space_info.c2
-rw-r--r--source/blender/editors/space_info/textview.c4
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c5
-rw-r--r--source/blender/editors/space_logic/logic_ops.c1
-rw-r--r--source/blender/editors/space_logic/logic_window.c5
-rw-r--r--source/blender/editors/space_logic/space_logic.c1
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c7
-rw-r--r--source/blender/editors/space_nla/nla_channels.c3
-rw-r--r--source/blender/editors/space_nla/nla_draw.c2
-rw-r--r--source/blender/editors/space_nla/nla_edit.c1
-rw-r--r--source/blender/editors/space_nla/space_nla.c3
-rw-r--r--source/blender/editors/space_node/drawnode.c1
-rw-r--r--source/blender/editors/space_node/node_buttons.c6
-rw-r--r--source/blender/editors/space_node/node_draw.c1
-rw-r--r--source/blender/editors/space_node/node_edit.c25
-rw-r--r--source/blender/editors/space_node/node_header.c30
-rw-r--r--source/blender/editors/space_node/node_select.c8
-rw-r--r--source/blender/editors/space_node/node_state.c5
-rw-r--r--source/blender/editors/space_node/space_node.c37
-rw-r--r--source/blender/editors/space_outliner/outliner.c60
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h2
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c4
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c2
-rw-r--r--source/blender/editors/space_script/script_edit.c9
-rw-r--r--source/blender/editors/space_script/script_header.c7
-rw-r--r--source/blender/editors/space_script/space_script.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_scopes.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c3
-rw-r--r--source/blender/editors/space_sound/sound_header.c4
-rw-r--r--source/blender/editors/space_sound/space_sound.c1
-rw-r--r--source/blender/editors/space_text/space_text.c19
-rw-r--r--source/blender/editors/space_text/text_draw.c29
-rw-r--r--source/blender/editors/space_text/text_header.c1
-rw-r--r--source/blender/editors/space_text/text_ops.c25
-rw-r--r--source/blender/editors/space_time/space_time.c1
-rw-r--r--source/blender/editors/space_time/time_ops.c5
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c3
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c4
-rw-r--r--source/blender/editors/space_view3d/drawobject.c28
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c7
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c70
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c1
-rw-r--r--source/blender/editors/transform/transform.c71
-rw-r--r--source/blender/editors/transform/transform_constraints.c3
-rw-r--r--source/blender/editors/transform/transform_conversions.c2
-rw-r--r--source/blender/editors/transform/transform_generics.c12
-rw-r--r--source/blender/editors/transform/transform_input.c1
-rw-r--r--source/blender/editors/transform/transform_manipulator.c1
-rw-r--r--source/blender/editors/transform/transform_ndofinput.c5
-rw-r--r--source/blender/editors/transform/transform_ops.c20
-rw-r--r--source/blender/editors/transform/transform_orientations.c3
-rw-r--r--source/blender/editors/transform/transform_snap.c1
-rw-r--r--source/blender/editors/util/CMakeLists.txt1
-rw-r--r--source/blender/editors/util/editmode_undo.c10
-rw-r--r--source/blender/editors/util/numinput.c1
-rw-r--r--source/blender/editors/util/undo.c10
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c7
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c17
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c3
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c36
213 files changed, 2147 insertions, 1540 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 592149157aa..cc1e8bd9eb8 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -31,6 +31,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -42,6 +43,7 @@
#include "DNA_space_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
@@ -50,9 +52,11 @@
#include "DNA_world_types.h"
#include "RNA_access.h"
+
#include "BKE_curve.h"
#include "BKE_key.h"
#include "BKE_context.h"
+#include "BKE_utildefines.h" /* FILE_MAX */
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -2311,6 +2315,82 @@ static bAnimChannelType ACF_DSMESH=
acf_dsmesh_setting_ptr /* pointer for setting */
};
+/* Lattice Expander ------------------------------------------- */
+
+// TODO: just get this from RNA?
+static int acf_dslat_icon(bAnimListElem *UNUSED(ale))
+{
+ return ICON_LATTICE_DATA;
+}
+
+/* get the appropriate flag(s) for the setting when it is valid */
+static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
+{
+ /* clear extra return data first */
+ *neg= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ return LT_DS_EXPAND;
+
+ case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+ return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ return ADT_UI_SELECTED;
+
+ default: /* unsupported */
+ return 0;
+ }
+}
+
+/* get pointer to the setting */
+static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+ Lattice *lt= (Lattice *)ale->data;
+
+ /* clear extra return data first */
+ *type= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ GET_ACF_FLAG_PTR(lt->flag);
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+ if (lt->adt)
+ GET_ACF_FLAG_PTR(lt->adt->flag)
+ else
+ return NULL;
+
+ default: /* unsupported */
+ return NULL;
+ }
+}
+
+/* node tree expander type define */
+static bAnimChannelType ACF_DSLAT=
+{
+ "Lattice Expander", /* type name */
+
+ acf_generic_dataexpand_color, /* backdrop color */
+ acf_generic_dataexpand_backdrop,/* backdrop */
+ acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
+ acf_generic_basic_offset, /* offset */
+
+ acf_generic_idblock_name, /* name */
+ acf_dslat_icon, /* icon */
+
+ acf_generic_dataexpand_setting_valid, /* has setting */
+ acf_dslat_setting_flag, /* flag for setting */
+ acf_dslat_setting_ptr /* pointer for setting */
+};
+
/* ShapeKey Entry ------------------------------------------- */
/* name for ShapeKey */
@@ -2567,6 +2647,7 @@ void ANIM_init_channel_typeinfo_data (void)
animchannelTypeInfo[type++]= &ACF_DSARM; /* Armature Channel */
animchannelTypeInfo[type++]= &ACF_DSMESH; /* Mesh Channel */
animchannelTypeInfo[type++]= &ACF_DSTEX; /* Texture Channel */
+ animchannelTypeInfo[type++]= &ACF_DSLAT; /* Lattice Channel */
animchannelTypeInfo[type++]= &ACF_DSLINESTYLE; /* LineStyle Channel */
animchannelTypeInfo[type++]= &ACF_SHAPEKEY; /* ShapeKey */
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 9d6b6d80a78..f4e3602343f 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -32,6 +32,8 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
@@ -114,6 +116,8 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@@ -157,6 +161,7 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
+ case ANIMTYPE_DSLAT:
{
/* need to verify that this data is valid for now */
// XXX: ale may be null!
@@ -234,6 +239,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
case ANIMTYPE_DSLINESTYLE:
{
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
@@ -318,6 +324,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
case ANIMTYPE_DSLINESTYLE:
{
/* need to verify that this data is valid for now */
@@ -1940,6 +1947,7 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
case ANIMTYPE_DSLINESTYLE:
{
/* sanity checking... */
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 02d69fd61fa..340101612b9 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -38,6 +38,7 @@
#include "DNA_sequence_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 641183db4c4..91af5534eaa 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -70,6 +70,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BKE_animsys.h"
@@ -82,6 +83,7 @@
#include "BKE_material.h"
#include "BKE_node.h"
#include "BKE_sequencer.h"
+#include "BKE_utildefines.h"
#include "ED_anim_api.h"
@@ -106,23 +108,7 @@ static Key *actedit_get_shapekeys (bAnimContext *ac)
//if (saction->pin) return NULL;
/* shapekey data is stored with geometry data */
- switch (ob->type) {
- case OB_MESH:
- key= ((Mesh *)ob->data)->key;
- break;
-
- case OB_LATTICE:
- key= ((Lattice *)ob->data)->key;
- break;
-
- case OB_CURVE:
- case OB_SURF:
- key= ((Curve *)ob->data)->key;
- break;
-
- default:
- return NULL;
- }
+ key= ob_get_key(ob);
if (key) {
if (key->type == KEY_RELATIVE)
@@ -643,6 +629,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
ale->adt= BKE_animdata_from_id(data);
}
break;
+ case ANIMTYPE_DSLAT:
+ {
+ Lattice *lt= (Lattice *)data;
+ AnimData *adt= lt->adt;
+
+ ale->flag= FILTER_LATTICE_OBJD(lt);
+
+ ale->key_data= (adt) ? adt->action : NULL;
+ ale->datatype= ALE_ACT;
+
+ ale->adt= BKE_animdata_from_id(data);
+ }
+ break;
case ANIMTYPE_DSSKEY:
{
Key *key= (Key *)data;
@@ -1613,6 +1612,14 @@ static int animdata_filter_dopesheet_obdata (bAnimContext *ac, ListBase *anim_da
expanded= FILTER_MESH_OBJD(me);
}
break;
+ case OB_LATTICE: /* ---- Lattice ---- */
+ {
+ Lattice *lt = (Lattice *)ob->data;
+
+ type= ANIMTYPE_DSLAT;
+ expanded= FILTER_LATTICE_OBJD(lt);
+ }
+ break;
}
/* special exception for drivers instead of action */
@@ -1871,6 +1878,19 @@ static int animdata_filter_dopesheet_ob (bAnimContext *ac, ListBase *anim_data,
}
}
break;
+ case OB_LATTICE: /* ------- Lattice ---------- */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+
+ if ((ads->filterflag & ADS_FILTER_NOLAT) == 0) {
+ ANIMDATA_FILTER_CASES(lt,
+ { /* AnimData blocks - do nothing... */ },
+ obdata_ok= 1;,
+ obdata_ok= 1;,
+ obdata_ok= 1;)
+ }
+ }
+ break;
}
if (obdata_ok)
items += animdata_filter_dopesheet_obdata(ac, anim_data, ads, base, filter_mode);
@@ -2500,6 +2520,23 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
dataOk= !(ads->filterflag & ADS_FILTER_NOMESH);)
}
break;
+ case OB_LATTICE: /* ------- Lattice ---------- */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+ dataOk= 0;
+ ANIMDATA_FILTER_CASES(lt,
+ if ((ads->filterflag & ADS_FILTER_NOLAT)==0) {
+ /* for the special AnimData blocks only case, we only need to add
+ * the block if it is valid... then other cases just get skipped (hence ok=0)
+ */
+ ANIMDATA_ADD_ANIMDATA(lt);
+ dataOk=0;
+ },
+ dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);,
+ dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);,
+ dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);)
+ }
+ break;
default: /* --- other --- */
dataOk= 0;
break;
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 56161f4bfa0..3e2212c15bb 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -37,10 +37,11 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
-#include "BKE_utildefines.h"
+
#include "RNA_access.h"
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 2f5ad28c8f2..80b026ddd6e 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -38,6 +38,7 @@
#include "RNA_enum_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
@@ -82,6 +83,8 @@ static ListBase *context_get_markers(const bContext *C)
return &CTX_data_scene(C)->markers;
}
+/* --------------------------------- */
+
/* Get the marker that is closest to this point */
/* XXX for select, the min_dist should be small */
TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)
@@ -175,6 +178,8 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
*last= max;
}
+/* --------------------------------- */
+
/* Adds a marker to list of cfra elems */
void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
{
@@ -218,6 +223,23 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
add_marker_to_cfra_elem(lb, marker, only_sel);
}
+/* --------------------------------- */
+
+/* Get the first selected marker */
+TimeMarker *ED_markers_get_first_selected(ListBase *markers)
+{
+ TimeMarker *marker;
+
+ if (markers) {
+ for (marker = markers->first; marker; marker = marker->next) {
+ if (marker->flag & SELECT)
+ return marker;
+ }
+ }
+
+ return NULL;
+}
+
/* ************* Marker Drawing ************ */
/* function to draw markers */
@@ -239,10 +261,11 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
/* vertical line - dotted */
#ifdef DURIAN_CAMERA_SWITCH
- if ((marker->camera) || (flag & DRAW_MARKERS_LINES)) {
+ if ((marker->camera) || (flag & DRAW_MARKERS_LINES))
#else
- if (flag & DRAW_MARKERS_LINES) {
+ if (flag & DRAW_MARKERS_LINES)
#endif
+ {
setlinestyle(3);
if (marker->flag & SELECT)
@@ -333,6 +356,84 @@ void draw_markers_time(const bContext *C, int flag)
}
}
+/* ************************ Marker Wrappers API ********************* */
+/* These wrappers allow marker operators to function within the confines
+ * of standard animation editors, such that they can coexist with the
+ * primary operations of those editors.
+ */
+
+/* maximum y-axis value (in region screen-space) that marker events should still be accepted for */
+#define ANIMEDIT_MARKER_YAXIS_MAX 30
+
+/* ------------------------ */
+
+/* special poll() which checks if there are selected markers first */
+static int ed_markers_poll_selected_markers(bContext *C)
+{
+ ListBase *markers = context_get_markers(C);
+
+ /* first things first: markers can only exist in timeline views */
+ if (ED_operator_animview_active(C) == 0)
+ return 0;
+
+ /* check if some marker is selected */
+ return ED_markers_get_first_selected(markers) != NULL;
+}
+
+/* ------------------------ */
+
+/* Second-tier invoke() callback that performs context validation before running the
+ * "custom"/third-tier invoke() callback supplied as the last arg (which would normally
+ * be the operator's invoke() callback elsewhere)
+ *
+ * < invoke_func: (fn(bContext*, wmOperator*, wmEvent*)=int) "standard" invoke function
+ * that operator would otherwise have used. If NULL, the operator's standard
+ * exec() callback will be called instead in the appropriate places.
+ */
+static int ed_markers_opwrap_invoke_custom(bContext *C, wmOperator *op, wmEvent *evt,
+ int (*invoke_func)(bContext*,wmOperator*,wmEvent*))
+{
+ ScrArea *sa = CTX_wm_area(C);
+ int retval = OPERATOR_PASS_THROUGH;
+
+ /* only timeline view doesn't need calling-location validation as it's the only dedicated view */
+ if (sa->spacetype != SPACE_TIME) {
+ /* restrict y-values to within ANIMEDIT_MARKER_YAXIS_MAX of the view's vertical extents, including scrollbars */
+ if (evt->mval[1] > ANIMEDIT_MARKER_YAXIS_MAX) {
+ /* not ok... "pass-through" to let normal editor's operators have a chance at tackling this event... */
+ //printf("MARKER-WRAPPER-DEBUG: event mval[1] = %d, so over accepted tolerance\n", evt->mval[1]);
+ return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
+ }
+ }
+
+ /* allow operator to run now */
+ if (invoke_func)
+ retval = invoke_func(C, op, evt);
+ else if (op->type->exec)
+ retval = op->type->exec(C, op);
+ else
+ BKE_report(op->reports, RPT_ERROR, "Programming error: operator doesn't actually have code to do anything!");
+
+ /* return status modifications - for now, make this spacetype dependent as above */
+ if (sa->spacetype != SPACE_TIME) {
+ /* unless successful, must add "pass-through" to let normal operator's have a chance at tackling this event */
+ if (retval != OPERATOR_FINISHED)
+ retval |= OPERATOR_PASS_THROUGH;
+ }
+
+ return retval;
+}
+
+/* standard wrapper - first-tier invoke() callback to be directly assigned to operator typedata
+ * for operators which don't need any special invoke calls. Any operators with special invoke calls
+ * though will need to implement their own wrapper which calls the second-tier callback themselves
+ * (passing through the custom invoke function they use)
+ */
+static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, NULL);
+}
+
/* ************************** add markers *************************** */
/* add TimeMarker at curent frame */
@@ -376,6 +477,7 @@ static void MARKER_OT_add(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_add;
+ ot->invoke = ed_markers_opwrap_invoke;
ot->poll= ED_operator_animview_active;
/* flags */
@@ -396,7 +498,7 @@ functions:
exit() cleanup, send notifier
- cancel() to escpae from modal
+ cancel() to escape from modal
callbacks:
@@ -488,6 +590,11 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
return OPERATOR_CANCELLED;
}
+static int ed_marker_move_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_move_invoke);
+}
+
/* note, init has to be called succesfully */
static void ed_marker_move_apply(wmOperator *op)
{
@@ -665,9 +772,9 @@ static void MARKER_OT_move(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_move_exec;
- ot->invoke= ed_marker_move_invoke;
+ ot->invoke= ed_marker_move_invoke_wrapper;
ot->modal= ed_marker_move_modal;
- ot->poll= ED_operator_animview_active;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -744,6 +851,11 @@ static int ed_marker_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *evt)
return ed_marker_move_invoke(C, op, evt);
}
+static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_duplicate_invoke);
+}
+
static void MARKER_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
@@ -753,9 +865,9 @@ static void MARKER_OT_duplicate(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_duplicate_exec;
- ot->invoke= ed_marker_duplicate_invoke;
+ ot->invoke= ed_marker_duplicate_invoke_wrapper;
ot->modal= ed_marker_move_modal;
- ot->poll= ED_operator_animview_active;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -794,7 +906,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
float viewx;
int x, y, cfra;
- if(markers == NULL)
+ if (markers == NULL)
return OPERATOR_PASS_THROUGH;
x= evt->x - CTX_wm_region(C)->winrct.xmin;
@@ -811,27 +923,27 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
#ifdef DURIAN_CAMERA_SWITCH
- if(camera) {
+ if (camera) {
Scene *scene= CTX_data_scene(C);
Base *base;
TimeMarker *marker;
int sel= 0;
-
+
if (!extend)
scene_deselect_all(scene);
-
+
for (marker= markers->first; marker; marker= marker->next) {
if(marker->frame==cfra) {
sel= (marker->flag & SELECT);
break;
}
}
-
+
for (marker= markers->first; marker; marker= marker->next) {
- if(marker->camera) {
- if(marker->frame==cfra) {
+ if (marker->camera) {
+ if (marker->frame==cfra) {
base= object_in_scene(marker->camera, scene);
- if(base) {
+ if (base) {
ED_base_object_select(base, sel);
if(sel)
ED_base_object_activate(C, base);
@@ -839,7 +951,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
}
}
}
-
+
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
#endif
@@ -861,6 +973,11 @@ static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt)
return ed_marker_select(C, evt, extend, camera);
}
+static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, ed_marker_select_invoke);
+}
+
static void MARKER_OT_select(wmOperatorType *ot)
{
/* identifiers */
@@ -869,7 +986,7 @@ static void MARKER_OT_select(wmOperatorType *ot)
ot->idname= "MARKER_OT_select";
/* api callbacks */
- ot->invoke= ed_marker_select_invoke;
+ ot->invoke= ed_marker_select_invoke_wrapper;
ot->poll= ED_operator_animview_active;
/* flags */
@@ -917,24 +1034,18 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
UI_view2d_region_to_view(v2d, xmin, ymin, &xminf, &yminf);
UI_view2d_region_to_view(v2d, xmax, ymax, &xmaxf, &ymaxf);
- /* XXX disputable */
- if(yminf > 30.0f || ymaxf < 0.0f)
- return 0;
-
- if(markers == NULL)
+ if (markers == NULL)
return 0;
/* XXX marker context */
- for(marker= markers->first; marker; marker= marker->next) {
+ for (marker= markers->first; marker; marker= marker->next) {
if ((marker->frame > xminf) && (marker->frame <= xmaxf)) {
switch (gesture_mode) {
case GESTURE_MODAL_SELECT:
- if ((marker->flag & SELECT) == 0)
- marker->flag |= SELECT;
+ marker->flag |= SELECT;
break;
case GESTURE_MODAL_DESELECT:
- if (marker->flag & SELECT)
- marker->flag &= ~SELECT;
+ marker->flag &= ~SELECT;
break;
}
}
@@ -946,6 +1057,11 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
return 1;
}
+static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ return ed_markers_opwrap_invoke_custom(C, op, evt, WM_border_select_invoke);
+}
+
static void MARKER_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
@@ -955,7 +1071,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_border_select_exec;
- ot->invoke= WM_border_select_invoke;
+ ot->invoke= ed_marker_select_border_invoke_wrapper;
ot->modal= WM_border_select_modal;
ot->poll= ED_operator_animview_active;
@@ -975,17 +1091,11 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
TimeMarker *marker;
int action = RNA_enum_get(op->ptr, "action");
- if(markers == NULL)
+ if (markers == NULL)
return OPERATOR_CANCELLED;
if (action == SEL_TOGGLE) {
- action = SEL_SELECT;
- for(marker= markers->first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
- action = SEL_DESELECT;
- break;
- }
- }
+ action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
}
for(marker= markers->first; marker; marker= marker->next) {
@@ -997,11 +1107,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
marker->flag &= ~SELECT;
break;
case SEL_INVERT:
- if (marker->flag & SELECT) {
- marker->flag &= ~SELECT;
- } else {
- marker->flag |= SELECT;
- }
+ marker->flag ^= SELECT;
break;
}
}
@@ -1021,6 +1127,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_select_all_exec;
+ ot->invoke = ed_markers_opwrap_invoke;
ot->poll= ED_operator_animview_active;
/* flags */
@@ -1030,7 +1137,7 @@ static void MARKER_OT_select_all(wmOperatorType *ot)
WM_operator_properties_select_all(ot);
}
-/* ******************************* remove marker ***************** */
+/* ***************** remove marker *********************** */
/* remove selected TimeMarkers */
static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1039,12 +1146,12 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
TimeMarker *marker, *nmarker;
short changed= 0;
- if(markers == NULL)
+ if (markers == NULL)
return OPERATOR_CANCELLED;
- for(marker= markers->first; marker; marker= nmarker) {
+ for (marker= markers->first; marker; marker= nmarker) {
nmarker= marker->next;
- if(marker->flag & SELECT) {
+ if (marker->flag & SELECT) {
BLI_freelinkN(markers, marker);
changed= 1;
}
@@ -1058,6 +1165,11 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
+static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ // XXX: must we keep these confirmations?
+ return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_confirm);
+}
static void MARKER_OT_delete(wmOperatorType *ot)
{
@@ -1067,35 +1179,90 @@ static void MARKER_OT_delete(wmOperatorType *ot)
ot->idname= "MARKER_OT_delete";
/* api callbacks */
- ot->invoke= WM_operator_confirm;
+ ot->invoke= ed_marker_delete_invoke_wrapper;
ot->exec= ed_marker_delete_exec;
- ot->poll= ED_operator_animview_active;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+
+/* **************** rename marker ***************** */
+
+/* rename first selected TimeMarker */
+static int ed_marker_rename_exec(bContext *C, wmOperator *op)
+{
+ TimeMarker *marker= ED_markers_get_first_selected(context_get_markers(C));
+
+ if(marker) {
+ RNA_string_get(op->ptr, "name", marker->name);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
+
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
+}
+
+static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
+{
+ /* must initialise the marker name first if there is a marker selected */
+ TimeMarker *marker = ED_markers_get_first_selected(context_get_markers(C));
+ if (marker)
+ RNA_string_set(op->ptr, "name", marker->name);
+ /* now see if the operator is usable */
+ return ed_markers_opwrap_invoke_custom(C, op, evt, WM_operator_props_popup);
}
+static void MARKER_OT_rename(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Rename Marker";
+ ot->description= "Rename first selected time marker";
+ ot->idname= "MARKER_OT_rename";
+
+ /* api callbacks */
+ ot->invoke= ed_marker_rename_invoke_wrapper;
+ ot->exec= ed_marker_rename_exec;
+ ot->poll= ed_markers_poll_selected_markers;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ /* properties */
+ ot->prop = RNA_def_string(ot->srna, "name", "RenamedMarker", sizeof(((TimeMarker *)NULL)->name), "Name", "New name for marker");
+ //RNA_def_boolean(ot->srna, "ensure_unique", 0, "Ensure Unique", "Ensure that new name is unique within collection of markers");
+}
+
+/* **************** make links to scene ***************** */
+
static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op)
{
ListBase *markers= context_get_markers(C);
Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
TimeMarker *marker, *marker_new;
- if(scene_to==NULL) {
+ if (scene_to==NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
- if(scene_to == CTX_data_scene(C)) {
- BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene");
+ if (scene_to == CTX_data_scene(C)) {
+ BKE_report(op->reports, RPT_ERROR, "Can't re-link markers into the same scene");
return OPERATOR_CANCELLED;
}
/* copy markers */
for (marker= markers->first; marker; marker= marker->next) {
- if(marker->flag & SELECT) {
+ if (marker->flag & SELECT) {
marker_new= MEM_dupallocN(marker);
+ marker_new->prev= marker_new->next = NULL;
+
BLI_addtail(&scene_to->markers, marker_new);
}
}
@@ -1109,12 +1276,13 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
/* identifiers */
ot->name= "Make Links to Scene";
- ot->description= "Link markers to another scene";
+ ot->description= "Copy selected markers to another scene";
ot->idname= "MARKER_OT_make_links_scene";
/* api callbacks */
ot->exec= ed_marker_make_links_scene_exec;
- ot->poll= ED_operator_animview_active;
+ ot->invoke = ed_markers_opwrap_invoke;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1163,7 +1331,8 @@ static void MARKER_OT_camera_bind(wmOperatorType *ot)
/* api callbacks */
ot->exec= ed_marker_camera_bind_exec;
- ot->poll= ED_operator_animview_active;
+ ot->invoke = ed_markers_opwrap_invoke;
+ ot->poll= ed_markers_poll_selected_markers;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1182,6 +1351,7 @@ void ED_operatortypes_marker(void)
WM_operatortype_append(MARKER_OT_select_border);
WM_operatortype_append(MARKER_OT_select_all);
WM_operatortype_append(MARKER_OT_delete);
+ WM_operatortype_append(MARKER_OT_rename);
WM_operatortype_append(MARKER_OT_make_links_scene);
#ifdef DURIAN_CAMERA_SWITCH
WM_operatortype_append(MARKER_OT_camera_bind);
@@ -1213,6 +1383,7 @@ void ED_marker_keymap(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_delete", DELKEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "MARKER_OT_rename", MKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0);
#ifdef DURIAN_CAMERA_SWITCH
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index ba5a53e6d7a..6b0fa30b096 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -31,6 +31,8 @@
#include "BLO_sys_types.h"
+#include "BLI_utildefines.h"
+
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 902fa2f789f..c6c333755b0 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -32,6 +32,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 7642f63b531..b47fea58633 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -43,6 +43,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_fcurve.h"
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 548d06993e7..93808233288 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -39,6 +39,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -47,6 +48,7 @@
#include "DNA_scene_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
@@ -59,7 +61,7 @@
#include "BKE_key.h"
#include "BKE_material.h"
#include "BKE_global.h" // XXX remove me!
-#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
@@ -775,6 +777,8 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl
/* add material's data */
action_to_keylist(ma->adt, ma->adt->action, keys, blocks);
+
+ // TODO: textures...
}
}
@@ -830,6 +834,14 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl
action_to_keylist(me->adt, me->adt->action, keys, blocks);
}
break;
+ case OB_LATTICE: /* ------- Lattice ---------- */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+
+ if ((lt->adt) && !(filterflag & ADS_FILTER_NOLAT))
+ action_to_keylist(lt->adt, lt->adt->action, keys, blocks);
+ }
+ break;
}
/* Add Particle System Keyframes */
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index a1c02f922f2..ca056b61efa 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -33,12 +33,14 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_mesh_types.h"
#include "DNA_material_types.h"
@@ -52,7 +54,7 @@
#include "BKE_fcurve.h"
#include "BKE_key.h"
#include "BKE_material.h"
-#include "BKE_utildefines.h"
+
#include "ED_anim_api.h"
#include "ED_keyframes_edit.h"
@@ -319,6 +321,16 @@ static short ob_keyframes_loop(KeyframeEditData *ked, Object *ob, KeyframeEditFu
}
}
break;
+ case OB_LATTICE: /* ---- Lattice ------ */
+ {
+ Lattice *lt= (Lattice *)ob->data;
+
+ if ((lt->adt) && !(filterflag & ADS_FILTER_NOLAT)) {
+ if (adt_keyframes_loop(ked, lt->adt, key_ok, key_cb, fcu_cb, filterflag))
+ return 1;
+ }
+ }
+ break;
}
/* Add Particle System Keyframes */
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index e8509a1bbc2..92fce2a77e5 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -34,6 +34,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index e588a3610d8..726c898e843 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -72,6 +73,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "anim_intern.h"
@@ -1074,7 +1076,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
KeyingSet *ks= NULL;
- int type= RNA_int_get(op->ptr, "type");
+ int type= RNA_enum_get(op->ptr, "type");
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
@@ -1139,11 +1141,12 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- /* keyingset to use
- * - here the type is int not enum, since many of the indicies here are determined dynamically
- */
- prop= RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
+ /* keyingset to use (dynamic enum) */
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop= prop;
+
/* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
*/
@@ -1168,7 +1171,7 @@ static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(
}
else {
/* just call the exec() on the active keyingset */
- RNA_int_set(op->ptr, "type", 0);
+ RNA_enum_set(op->ptr, "type", 0);
RNA_boolean_set(op->ptr, "confirm_success", 1);
return op->type->exec(C, op);
@@ -1192,17 +1195,19 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- /* keyingset to use
- * - here the type is int not enum, since many of the indicies here are determined dynamically
- */
- prop= RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
+ /* keyingset to use (dynamic enum) */
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop= prop;
+
/* confirm whether a keyframe was added by showing a popup
* - by default, this is disabled so that if a menu is shown, this doesn't come up too
*/
// XXX should this just be always on?
prop= RNA_def_boolean(ot->srna, "confirm_success", 0, "Confirm Successful Insert", "Show a popup when the keyframes get successfully added");
RNA_def_property_flag(prop, PROP_HIDDEN);
+
/* whether the menu should always be shown
* - by default, the menu should only be shown when there is no active Keying Set (2.5 behaviour),
* although in some cases it might be useful to always shown (pre 2.5 behaviour)
@@ -1218,7 +1223,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
KeyingSet *ks= NULL;
- int type= RNA_int_get(op->ptr, "type");
+ int type= RNA_enum_get(op->ptr, "type");
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
short success;
@@ -1269,6 +1274,8 @@ static int delete_key_exec (bContext *C, wmOperator *op)
void ANIM_OT_keyframe_delete (wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name= "Delete Keyframe";
ot->idname= "ANIM_OT_keyframe_delete";
@@ -1281,10 +1288,12 @@ void ANIM_OT_keyframe_delete (wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- /* keyingset to use
- * - here the type is int not enum, since many of the indicies here are determined dynamically
- */
- RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
+ /* keyingset to use (dynamic enum) */
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+ RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ ot->prop= prop;
+
/* confirm whether a keyframe was added by showing a popup
* - by default, this is enabled, since this operator is assumed to be called independently
*/
@@ -1407,7 +1416,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
}
else if (G.f & G_DEBUG) {
printf("ptr.data = %p, prop = %p,", (void *)ptr.data, (void *)prop);
- if(prop)
+ if (prop)
printf("animateable = %d \n", RNA_property_animateable(&ptr, prop));
else
printf("animateable = NULL \n");
@@ -1416,7 +1425,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
if (success) {
/* send updates */
uiContextAnimUpdate(C);
-
+
DAG_ids_flush_update(bmain, 0);
/* send notifiers that keyframes have been changed */
@@ -1488,7 +1497,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
if (success) {
/* send updates */
uiContextAnimUpdate(C);
-
+
DAG_ids_flush_update(bmain, 0);
/* send notifiers that keyframes have been changed */
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index d0e7d8be769..51b00cc0086 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
@@ -59,6 +60,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "anim_intern.h"
@@ -417,12 +419,9 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
/* try to find a path matching this description */
ksp= BKE_keyingset_find_path(ks, ptr.id.data, ks->name, path, index, KSP_GROUP_KSNAME);
-
+
if (ksp) {
- /* just free it... */
- MEM_freeN(ksp->rna_path);
- BLI_freelinkN(&ks->paths, ksp);
-
+ BKE_keyingset_free_path(ks, ksp);
success= 1;
}
@@ -691,6 +690,67 @@ KeyingSet *ANIM_get_keyingset_for_autokeying(Scene *scene, const char *tranformK
/* Menu of All Keying Sets ----------------------------- */
+/* Dynamically populate an enum of Keying Sets */
+EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(ptr), int *free)
+{
+ Scene *scene = CTX_data_scene(C);
+ KeyingSet *ks;
+ EnumPropertyItem *item= NULL, item_tmp= {0};
+ int totitem= 0;
+ int i= 0;
+
+ if (C == NULL) {
+ return DummyRNA_DEFAULT_items;
+ }
+
+ /* active Keying Set
+ * - only include entry if it exists
+ */
+ if (scene->active_keyingset) {
+ /* active Keying Set */
+ item_tmp.identifier= item_tmp.name= "Active Keying Set";
+ item_tmp.value= i++;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+
+ /* separator */
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
+ else
+ i++;
+
+ /* user-defined Keying Sets
+ * - these are listed in the order in which they were defined for the active scene
+ */
+ if (scene->keyingsets.first) {
+ for (ks= scene->keyingsets.first; ks; ks= ks->next) {
+ if (ANIM_keyingset_context_ok_poll(C, ks)) {
+ item_tmp.identifier= item_tmp.name= ks->name;
+ item_tmp.value= i++;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ }
+ }
+
+ /* separator */
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
+
+ /* builtin Keying Sets */
+ i= -1;
+ for (ks= builtin_keyingsets.first; ks; ks= ks->next) {
+ /* only show KeyingSet if context is suitable */
+ if (ANIM_keyingset_context_ok_poll(C, ks)) {
+ item_tmp.identifier= item_tmp.name= ks->name;
+ item_tmp.value= i--;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *free= 1;
+
+ return item;
+}
+
/* Create (and show) a menu containing all the Keying Sets which can be used in the current context */
void ANIM_keying_sets_menu_setup (bContext *C, const char title[], const char op_name[])
{
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 6d677e2f89e..935331e3263 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -44,6 +44,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index 6abdd85bf71..527f5ba5e69 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -39,8 +39,9 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_graph.h"
+#include "BLI_utildefines.h"
-#include "BKE_utildefines.h"
+
#include "ED_armature.h"
#include "armature_intern.h"
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 3e8c5c3ebb2..e9d0645ceba 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -41,6 +41,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_graph.h"
#include "BLI_rand.h"
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 121a7d6987b..7a5c14b1dab 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -35,6 +35,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_graph.h"
#include "BLI_ghash.h"
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 3d8e87d9e79..c0600ceed1c 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -41,10 +41,11 @@
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_memarena.h"
+#include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BKE_modifier.h"
-#include "BKE_utildefines.h"
+
#ifdef RIGID_DEFORM
#include "BLI_editVert.h"
@@ -648,8 +649,8 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
MFace *mface;
float solution, weight;
int *vertsflipped = NULL, *mask= NULL;
- int a, totface, j, bbone, firstsegment, lastsegment, thrownerror = 0;
-
+ int a, totface, j, bbone, firstsegment, lastsegment;
+
*err_str= NULL;
/* count triangles and create mask */
@@ -761,9 +762,8 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
}
}
}
- else if(!thrownerror) {
+ else if(*err_str == NULL) {
*err_str= "Bone Heat Weighting: failed to find solution for one or more bones";
- thrownerror= 1;
break;
}
@@ -1264,11 +1264,9 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
{
MDefBoundIsect *isect;
float outside[3], start[3], dir[3];
- int i, counter;
+ int i;
for(i=1; i<=6; i++) {
- counter = 0;
-
outside[0] = co[0] + (mdb->max[0] - mdb->min[0] + 1.0f)*MESHDEFORM_OFFSET[i][0];
outside[1] = co[1] + (mdb->max[1] - mdb->min[1] + 1.0f)*MESHDEFORM_OFFSET[i][1];
outside[2] = co[2] + (mdb->max[2] - mdb->min[2] + 1.0f)*MESHDEFORM_OFFSET[i][2];
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index c51621080c5..47e5f734f86 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c
index 6756691c506..7b1b3b6c5c8 100644
--- a/source/blender/editors/armature/poseUtils.c
+++ b/source/blender/editors/armature/poseUtils.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 71b6be42900..d5994e24cd6 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index bea7155291b..2ce6da9b04c 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -36,6 +36,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -791,7 +792,7 @@ void pose_copy_menu(Scene *scene)
}
else { /* constraints, optional (note: max we can have is 24 constraints) */
bConstraint *con, *con_back;
- int const_toggle[24];
+ int const_toggle[24]= {0}; /* XXX, initialize as 0 to quiet errors */
ListBase const_copy = {NULL, NULL};
BLI_duplicatelist(&const_copy, &(pchanact->constraints));
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index e896cccd1b3..780dc8827c4 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_ghash.h"
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 47b9dd3733b..73db7b1a377 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -48,6 +48,7 @@
#include "BLI_math.h"
#include "BLI_dynstr.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BKE_context.h"
@@ -1972,7 +1973,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
if(ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -2020,7 +2021,7 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op)
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -2073,7 +2074,7 @@ static int set_radius_exec(bContext *C, wmOperator *op)
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -2149,7 +2150,7 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -2315,7 +2316,7 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -2644,7 +2645,7 @@ static int hide_exec(bContext *C, wmOperator *op)
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
@@ -2704,7 +2705,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
@@ -3203,7 +3204,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -3508,7 +3509,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
if(ED_curve_updateAnimPaths(obedit))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -3554,7 +3555,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op)
sethandlesNurb(editnurb, RNA_enum_get(op->ptr, "type"));
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -3916,7 +3917,7 @@ static int merge_nurb(bContext *C, wmOperator *op)
set_actNurb(obedit, NULL);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -3928,7 +3929,6 @@ static int make_segment_exec(bContext *C, wmOperator *op)
Curve *cu= obedit->data;
ListBase *nubase= curve_get_editcurve(obedit);
Nurb *nu, *nu1=0, *nu2=0;
- BezTriple *bezt = NULL;
BPoint *bp;
float *fp, offset;
int a, ok= 0;
@@ -3960,12 +3960,10 @@ static int make_segment_exec(bContext *C, wmOperator *op)
for(nu= nubase->first; nu; nu= nu->next) {
if((nu->flagu & CU_NURB_CYCLIC)==0) { /* not cyclic */
if(nu->type == CU_BEZIER) {
- bezt= nu->bezt;
if(nu1==0) {
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) nu1= nu;
+ if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1= nu;
else {
- bezt= bezt+(nu->pntsu-1);
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+ if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
nu1= nu;
switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
@@ -3973,14 +3971,13 @@ static int make_segment_exec(bContext *C, wmOperator *op)
}
}
else if(nu2==0) {
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+ if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) {
nu2= nu;
switchdirectionNurb(nu);
keyData_switchDirectionNurb(cu, nu);
}
else {
- bezt= bezt+(nu->pntsu-1);
- if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+ if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
nu2= nu;
}
}
@@ -4021,7 +4018,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
if((nu1 && nu2) && (nu1!=nu2)) {
if( nu1->type==nu2->type) {
if(nu1->type == CU_BEZIER) {
- bezt =
+ BezTriple *bezt =
(BezTriple*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BezTriple), "addsegmentN");
ED_curve_beztcpy(cu->editnurb, bezt, nu2->bezt, nu2->pntsu);
ED_curve_beztcpy(cu->editnurb, bezt+nu2->pntsu, nu1->bezt, nu1->pntsu);
@@ -4077,7 +4074,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
} else if(nu1 && !nu2 && nu1->type == CU_BEZIER) {
if(!(nu1->flagu & CU_NURB_CYCLIC)) {
if(BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt) &&
- BEZSELECTED_HIDDENHANDLES(cu, bezt+(nu1->pntsu-1))) {
+ BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt+(nu1->pntsu-1))) {
nu1->flagu|= CU_NURB_CYCLIC;
calchandlesNurb(nu1);
ok= 1;
@@ -4094,7 +4091,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -4285,7 +4282,8 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
static int spin_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- float cent[3], axis[3];
+ RegionView3D *rv3d= ED_view3d_context_rv3d(C);
+ float cent[3], axis[3], viewmat[4][4];
RNA_float_get_array(op->ptr, "center", cent);
RNA_float_get_array(op->ptr, "axis", axis);
@@ -4293,7 +4291,12 @@ static int spin_exec(bContext *C, wmOperator *op)
invert_m4_m4(obedit->imat, obedit->obmat);
mul_m4_v3(obedit->imat, cent);
- if(!spin_nurb(ED_view3d_context_rv3d(C)->viewmat, obedit, axis, cent)) {
+ if(rv3d)
+ copy_m4_m4(viewmat, rv3d->viewmat);
+ else
+ unit_m4(viewmat);
+
+ if(!spin_nurb(viewmat, obedit, axis, cent)) {
BKE_report(op->reports, RPT_ERROR, "Can't spin");
return OPERATOR_CANCELLED;
}
@@ -4302,7 +4305,7 @@ static int spin_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -4312,9 +4315,13 @@ static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
+ float axis[3]= {0.0f, 0.0f, 1.0f};
+
+ if(rv3d)
+ copy_v3_v3(axis, rv3d->viewinv[2]);
RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
- RNA_float_set_array(op->ptr, "axis", rv3d->viewinv[2]);
+ RNA_float_set_array(op->ptr, "axis", axis);
return spin_exec(C, op);
}
@@ -4570,7 +4577,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -4647,7 +4654,7 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
}
@@ -4759,7 +4766,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -5581,7 +5588,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -5704,11 +5711,10 @@ static int delete_exec(bContext *C, wmOperator *op)
}
else if(type==1) { /* erase segment */
/* find the 2 selected points */
- bezt1= bezt2= 0;
- bp1= bp2= 0;
- nu= nubase->first;
- nu1= 0;
- while(nu) {
+ bezt1= bezt2= NULL;
+ bp1= bp2= NULL;
+ nu1= NULL;
+ for(nu= nubase->first; nu; nu= nu->next) {
next= nu->next;
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
@@ -5724,7 +5730,7 @@ static int delete_exec(bContext *C, wmOperator *op)
nu->flagu &= ~CU_NURB_CYCLIC;
calchandlesNurb(nu);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
}
@@ -5750,7 +5756,7 @@ static int delete_exec(bContext *C, wmOperator *op)
if( bp2->f1 & SELECT ) {
nu->flagu &= ~CU_NURB_CYCLIC;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
}
@@ -5764,8 +5770,6 @@ static int delete_exec(bContext *C, wmOperator *op)
}
}
if(nu1) break;
-
- nu= nu->next;
}
if(nu1) {
if(bezt1) {
@@ -5855,7 +5859,7 @@ static int delete_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -5927,7 +5931,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -6090,13 +6094,17 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
BezTriple *bezt;
BPoint *bp;
Curve *cu= (Curve*)obedit->data;
- float vec[3];
+ float vec[3], zvec[3]= {0.0f, 0.0f, 1.0f};
+ float umat[4][4]= MAT4_UNITY, viewmat[4][4]= MAT4_UNITY;
float fac, grid;
int a, b, cutype, stype;
int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */
- float umat[4][4]= MAT4_UNITY;
-
+ if(rv3d) {
+ copy_m4_m4(viewmat, rv3d->viewmat);
+ VECCOPY(zvec, rv3d->viewinv[2]);
+ }
+
cutype= type & CU_TYPE; // poly, bezier, nurbs, etc
stype= type & CU_PRIMITIVE;
@@ -6380,7 +6388,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
BLI_addtail(editnurb, nu); /* temporal for spin */
if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) spin_nurb(umat, obedit, tmp_vec, tmp_cent);
- else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(rv3d->viewmat, obedit, rv3d->viewinv[2], mat[3]);
+ else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(viewmat, obedit, zvec, mat[3]);
else spin_nurb(umat, obedit, tmp_vec, mat[3]);
nurbs_knot_calc_v(nu);
@@ -6409,7 +6417,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
/* same as above */
if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) spin_nurb(umat, obedit, tmp_vec, tmp_cent);
- else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(rv3d->viewmat, obedit, rv3d->viewinv[2], mat[3]);
+ else if ((U.flag & USER_ADD_VIEWALIGNED)) spin_nurb(viewmat, obedit, zvec, mat[3]);
else spin_nurb(umat, obedit, tmp_vec, mat[3]);
@@ -6800,7 +6808,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index ab80a7a6ead..70a41ae7432 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
@@ -265,7 +266,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
BKE_text_to_curve(scene, obedit, mode);
if(recalc)
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
}
@@ -299,7 +300,7 @@ static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
insert_into_textbuf(obedit, '\n');
insert_into_textbuf(obedit, '\n');
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -626,7 +627,7 @@ static int set_style(bContext *C, int style, int clear)
ef->textbufinfo[i].flag |= style;
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 29cdfffa551..901542ea2de 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -38,6 +38,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_gpencil_types.h"
#include "DNA_scene_types.h"
@@ -48,7 +49,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
-#include "BKE_utildefines.h"
+
#include "WM_api.h"
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index d76e5fcf17c..0ee8b914205 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -668,15 +668,10 @@ static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene)
}
else {
/* try to find a marker */
- for (marker= scene->markers.first; marker; marker=marker->next) {
- if (marker->flag & SELECT) {
- initialised = 1;
- break;
- }
+ marker= ED_markers_get_first_selected(&scene->markers);
+ if(marker) {
+ initialised= 1;
}
-
- if (initialised == 0)
- marker = NULL;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index e0d257ca3bf..e7660659dfa 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -37,6 +37,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index d42e63bf354..d5cdb552439 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -35,6 +35,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_gpencil.h"
#include "BKE_context.h"
@@ -141,17 +142,21 @@ static void gp_session_validatebuffer(tGPsdata *p);
/* check if context is suitable for drawing */
static int gpencil_draw_poll (bContext *C)
{
- if(ED_operator_regionactive(C)) {
+ if (ED_operator_regionactive(C)) {
/* check if current context can support GPencil data */
- if(gpencil_data_get_pointers(C, NULL) != NULL) {
- return 1;
+ if (gpencil_data_get_pointers(C, NULL) != NULL) {
+ /* check if Grease Pencil isn't already running */
+ if ((G.f & G_GREASEPENCIL) == 0)
+ return 1;
+ else
+ CTX_wm_operator_poll_msg_set(C, "Grease Pencil operator is already active");
}
else {
- CTX_wm_operator_poll_msg_set(C, "failed to find grease pencil data to draw into");
+ CTX_wm_operator_poll_msg_set(C, "Failed to find Grease Pencil data to draw into");
}
}
else {
- CTX_wm_operator_poll_msg_set(C, "active region not set");
+ CTX_wm_operator_poll_msg_set(C, "Active region not set");
}
return 0;
@@ -161,7 +166,7 @@ static int gpencil_draw_poll (bContext *C)
static int gpencil_project_check (tGPsdata *p)
{
bGPdata *gpd= p->gpd;
- return ((gpd->sbuffer_sflag & GP_STROKE_3DSPACE) && (p->gpd->flag & (GP_DATA_DEPTH_VIEW | GP_DATA_DEPTH_STROKE))) ? 1:0;
+ return ((gpd->sbuffer_sflag & GP_STROKE_3DSPACE) && (p->gpd->flag & (GP_DATA_DEPTH_VIEW | GP_DATA_DEPTH_STROKE)));
}
/* ******************************************* */
@@ -176,7 +181,7 @@ static void gp_get_3d_reference (tGPsdata *p, float *vec)
float *fp= give_cursor(p->scene, v3d);
/* the reference point used depends on the owner... */
-#if 0 // XXX: disabled for now, since we can't draw relative ot the owner yet
+#if 0 // XXX: disabled for now, since we can't draw relative to the owner yet
if (p->ownerPtr.type == &RNA_Object)
{
Object *ob= (Object *)p->ownerPtr.data;
@@ -206,13 +211,17 @@ static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2])
if (p->gpd->sbuffer_size == 0)
return 1;
- /* check if mouse moved at least certain distance on both axes (best case) */
+ /* check if mouse moved at least certain distance on both axes (best case)
+ * - aims to eliminate some jitter-noise from input when trying to draw straight lines freehand
+ */
else if ((dx > MIN_MANHATTEN_PX) && (dy > MIN_MANHATTEN_PX))
return 1;
- /* check if the distance since the last point is significant enough */
- // future optimisation: sqrt here may be too slow?
- else if (sqrt(dx*dx + dy*dy) > MIN_EUCLIDEAN_PX)
+ /* check if the distance since the last point is significant enough
+ * - prevents points being added too densely
+ * - distance here doesn't use sqrt to prevent slowness... we should still be safe from overflows though
+ */
+ else if ((dx*dx + dy*dy) > MIN_EUCLIDEAN_PX*MIN_EUCLIDEAN_PX)
return 1;
/* mouse 'didn't move' */
@@ -228,7 +237,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[], flo
/* in 3d-space - pt->x/y/z are 3 side-by-side floats */
if (gpd->sbuffer_sflag & GP_STROKE_3DSPACE) {
- if(gpencil_project_check(p) && (view_autodist_simple(p->ar, mval, out, 0, depth))) {
+ if (gpencil_project_check(p) && (view_autodist_simple(p->ar, mval, out, 0, depth))) {
/* projecting onto 3D-Geometry
* - nothing more needs to be done here, since view_autodist_simple() has already done it
*/
@@ -286,7 +295,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[], flo
/* 2d - relative to screen (viewport area) */
else {
- if(p->subrect == NULL) { /* normal 3D view */
+ if (p->subrect == NULL) { /* normal 3D view */
out[0] = (float)(mval[0]) / (float)(p->ar->winx) * 100;
out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
}
@@ -406,12 +415,12 @@ static void gp_stroke_simplify (tGPsdata *p)
short flag= gpd->sbuffer_sflag;
short i, j;
- /* only simplify if simlification is enabled, and we're not doing a straight line */
+ /* only simplify if simplification is enabled, and we're not doing a straight line */
if (!(U.gp_settings & GP_PAINT_DOSIMPLIFY) || (p->paintmode == GP_PAINTMODE_DRAW_STRAIGHT))
return;
/* don't simplify if less than 4 points in buffer */
- if ((num_points <= 2) || (old_points == NULL))
+ if ((num_points <= 4) || (old_points == NULL))
return;
/* clear buffer (but don't free mem yet) so that we can write to it
@@ -532,60 +541,62 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
}
else {
float *depth_arr= NULL;
-
+
/* get an array of depths, far depths are blended */
- if(gpencil_project_check(p)) {
+ if (gpencil_project_check(p)) {
short mval[2];
int interp_depth = 0;
int found_depth = 0;
-
+
depth_arr= MEM_mallocN(sizeof(float) * gpd->sbuffer_size, "depth_points");
-
+
for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size; i++, ptc++, pt++) {
mval[0]= ptc->x; mval[1]= ptc->y;
- if(view_autodist_depth(p->ar, mval, depth_margin, depth_arr+i) == 0)
+ if (view_autodist_depth(p->ar, mval, depth_margin, depth_arr+i) == 0)
interp_depth= TRUE;
else
found_depth= TRUE;
}
-
- if(found_depth==FALSE) {
+
+ if (found_depth == FALSE) {
/* eeh... not much we can do.. :/, ignore depth in this case, use the 3D cursor */
for (i=gpd->sbuffer_size-1; i >= 0; i--)
depth_arr[i] = 0.9999f;
}
else {
- if(p->gpd->flag & GP_DATA_DEPTH_STROKE_ENDPOINTS) {
+ if (p->gpd->flag & GP_DATA_DEPTH_STROKE_ENDPOINTS) {
/* remove all info between the valid endpoints */
int first_valid = 0;
int last_valid = 0;
-
- for (i=0; i < gpd->sbuffer_size; i++)
- if(depth_arr[i] != FLT_MAX)
+
+ for (i=0; i < gpd->sbuffer_size; i++) {
+ if (depth_arr[i] != FLT_MAX)
break;
+ }
first_valid= i;
-
- for (i=gpd->sbuffer_size-1; i >= 0; i--)
- if(depth_arr[i] != FLT_MAX)
+
+ for (i=gpd->sbuffer_size-1; i >= 0; i--) {
+ if (depth_arr[i] != FLT_MAX)
break;
+ }
last_valid= i;
-
+
/* invalidate non-endpoints, so only blend between first and last */
for (i=first_valid+1; i < last_valid; i++)
depth_arr[i]= FLT_MAX;
-
+
interp_depth= TRUE;
}
-
- if(interp_depth) {
+
+ if (interp_depth) {
interp_sparse_array(depth_arr, gpd->sbuffer_size, FLT_MAX);
}
}
}
-
-
+
+
pt= gps->points;
-
+
/* convert all points (normal behaviour) */
for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size && ptc; i++, ptc++, pt++) {
/* convert screen-coordinates to appropriate coordinates (and store them) */
@@ -594,8 +605,8 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
/* copy pressure */
pt->pressure= ptc->pressure;
}
-
- if(depth_arr)
+
+ if (depth_arr)
MEM_freeN(depth_arr);
}
@@ -725,7 +736,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
}
#endif
else {
- if(p->subrect == NULL) { /* normal 3D view */
+ if (p->subrect == NULL) { /* normal 3D view */
x0= (int)(gps->points->x / 100 * p->ar->winx);
y0= (int)(gps->points->y / 100 * p->ar->winy);
}
@@ -1015,9 +1026,6 @@ static tGPsdata *gp_session_initpaint (bContext *C)
/* set edit flags - so that buffer will get drawn */
G.f |= G_GREASEPENCIL;
- /* set initial run flag */
- p->flags |= GP_PAINTFLAG_FIRSTRUN;
-
/* clear out buffer (stored in gp-data), in case something contaminated it */
gp_session_validatebuffer(p);
@@ -1080,6 +1088,9 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
p->paintmode= paintmode;
if (p->paintmode == GP_PAINTMODE_ERASER)
p->gpd->sbuffer_sflag |= GP_STROKE_ERASER;
+
+ /* set 'initial run' flag, which is only used to denote when a new stroke is starting */
+ p->flags |= GP_PAINTFLAG_FIRSTRUN;
/* check if points will need to be made in view-aligned space */
if (p->gpd->flag & GP_DATA_VIEWALIGN) {
@@ -1236,7 +1247,7 @@ static void gpencil_draw_exit (bContext *C, wmOperator *op)
}
/* cleanup */
- if(gpencil_project_check(p)) {
+ if (gpencil_project_check(p)) {
View3D *v3d= p->sa->spacedata.first;
/* need to restore the original projection settings before packing up */
@@ -1261,6 +1272,46 @@ static int gpencil_draw_cancel (bContext *C, wmOperator *op)
/* ------------------------------- */
+/* update UI indicators of status, including cursor and header prints */
+static void gpencil_draw_status_indicators (tGPsdata *p)
+{
+ /* header prints */
+ switch (p->status) {
+ case GP_STATUS_PAINTING:
+ /* only print this for paint-sessions, otherwise it gets annoying */
+ if (GPENCIL_SKETCH_SESSIONS_ON(p->scene))
+ ED_area_headerprint(p->sa, "Grease Pencil: Drawing/erasing stroke... Release to end stroke");
+ break;
+
+ case GP_STATUS_IDLING:
+ /* print status info */
+ switch (p->paintmode) {
+ case GP_PAINTMODE_ERASER:
+ ED_area_headerprint(p->sa, "Grease Pencil Erase Session: Hold and drag LMB or RMB to erase | ESC/Enter to end");
+ break;
+ case GP_PAINTMODE_DRAW_STRAIGHT:
+ ED_area_headerprint(p->sa, "Grease Pencil Line Session: Hold and drag LMB to draw | ESC/Enter to end");
+ break;
+ case GP_PAINTMODE_DRAW:
+ ED_area_headerprint(p->sa, "Grease Pencil Freehand Session: Hold and drag LMB to draw | ESC/Enter to end");
+ break;
+
+ default: /* unhandled future cases */
+ ED_area_headerprint(p->sa, "Grease Pencil Session: ESC/Enter to end");
+ break;
+ }
+ break;
+
+ case GP_STATUS_ERROR:
+ case GP_STATUS_DONE:
+ /* clear status string */
+ ED_area_headerprint(p->sa, NULL);
+ break;
+ }
+}
+
+/* ------------------------------- */
+
/* create a new stroke point at the point indicated by the painting context */
static void gpencil_draw_apply (wmOperator *op, tGPsdata *p)
{
@@ -1325,12 +1376,22 @@ static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event)
tablet= (wmtab->Active != EVT_TABLET_NONE);
p->pressure= wmtab->Pressure;
+
//if (wmtab->Active == EVT_TABLET_ERASER)
// TODO... this should get caught by the keymaps which call drawing in the first place
}
else
p->pressure= 1.0f;
+ /* fill in stroke data (not actually used directly by gpencil_draw_apply) */
+ RNA_collection_add(op->ptr, "stroke", &itemptr);
+
+ mousef[0]= p->mval[0];
+ mousef[1]= p->mval[1];
+ RNA_float_set_array(&itemptr, "mouse", mousef);
+ RNA_float_set(&itemptr, "pressure", p->pressure);
+ RNA_boolean_set(&itemptr, "is_start", (p->flags & GP_PAINTFLAG_FIRSTRUN));
+
/* special exception for start of strokes (i.e. maybe for just a dot) */
if (p->flags & GP_PAINTFLAG_FIRSTRUN) {
p->flags &= ~GP_PAINTFLAG_FIRSTRUN;
@@ -1346,14 +1407,6 @@ static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event)
return;
}
- /* fill in stroke data (not actually used directly by gpencil_draw_apply) */
- RNA_collection_add(op->ptr, "stroke", &itemptr);
-
- mousef[0]= p->mval[0];
- mousef[1]= p->mval[1];
- RNA_float_set_array(&itemptr, "mouse", mousef);
- RNA_float_set(&itemptr, "pressure", p->pressure);
-
/* apply the current latest drawing point */
gpencil_draw_apply(op, p);
@@ -1396,6 +1449,17 @@ static int gpencil_draw_exec (bContext *C, wmOperator *op)
p->mval[1] = (short)mousef[1];
p->pressure= RNA_float_get(&itemptr, "pressure");
+ if (RNA_boolean_get(&itemptr, "is_start")) {
+ /* if first-run flag isn't set already (i.e. not true first stroke),
+ * then we must terminate the previous one first before continuing
+ */
+ if ((p->flags & GP_PAINTFLAG_FIRSTRUN) == 0) {
+ // TODO: both of these ops can set error-status, but we probably don't need to worry
+ gp_paint_strokeend(p);
+ gp_paint_initstroke(p, p->paintmode);
+ }
+ }
+
/* if first run, set previous data too */
if (p->flags & GP_PAINTFLAG_FIRSTRUN) {
p->flags &= ~GP_PAINTFLAG_FIRSTRUN;
@@ -1447,6 +1511,8 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event)
// TODO: set any additional settings that we can take from the events?
// TODO? if tablet is erasing, force eraser to be on?
+ // TODO: move cursor setting stuff to stroke-start so that paintmode can be changed midway...
+
/* if eraser is on, draw radial aid */
if (p->paintmode == GP_PAINTMODE_ERASER) {
// TODO: this involves mucking around with radial control, so we leave this for now..
@@ -1484,67 +1550,110 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event)
static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
{
tGPsdata *p= op->customdata;
+ int estate = OPERATOR_PASS_THROUGH; /* default exit state - not handled, so let others have a share of the pie */
//printf("\tGP - handle modal event...\n");
- switch (event->type) {
- /* end of stroke -> ONLY when a mouse-button release occurs
- * otherwise, carry on to mouse-move...
- */
- case LEFTMOUSE:
- case RIGHTMOUSE:
- /* if painting, end stroke */
- if (p->status == GP_STATUS_PAINTING) {
- /* basically, this should be mouse-button up */
- //printf("\t\tGP - end of stroke \n");
- gpencil_draw_exit(C, op);
-
- /* one last flush before we're done */
- WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX need a nicer one that will work
+ /* exit painting mode (and/or end current stroke) */
+ if (ELEM3(event->type, RETKEY, PADENTER, ESCKEY)) {
+ /* exit() ends the current stroke before cleaning up */
+ //printf("\t\tGP - end of paint op + end of stroke\n");
+ gpencil_draw_exit(C, op);
+ p->status= GP_STATUS_DONE;
+ estate = OPERATOR_FINISHED;
+ }
+
+ /* toggle painting mode upon mouse-button movement */
+ if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE)) {
+ /* if painting, end stroke */
+ if (p->status == GP_STATUS_PAINTING) {
+ /* basically, this should be mouse-button up = end stroke
+ * BUT what happens next depends on whether we 'painting sessions' is enabled
+ */
+ if (GPENCIL_SKETCH_SESSIONS_ON(p->scene)) {
+ /* end stroke only, and then wait to resume painting soon */
+ //printf("\t\tGP - end stroke only\n");
+ gp_paint_strokeend(p);
+ p->status= GP_STATUS_IDLING;
- return OPERATOR_FINISHED;
+ /* we've just entered idling state, so this event was processed (but no others yet) */
+ estate = OPERATOR_RUNNING_MODAL;
+ }
+ else {
+ //printf("\t\tGP - end of stroke + op\n");
+ gpencil_draw_exit(C, op);
+ p->status= GP_STATUS_DONE;
+ estate = OPERATOR_FINISHED;
+ }
+ }
+ else {
+ /* not painting, so start stroke (this should be mouse-button down) */
+
+ /* we must check that we're still within the area that we're set up to work from
+ * otherwise we could crash (see bug #20586)
+ */
+ if (CTX_wm_area(C) != p->sa) {
+ //printf("\t\t\tGP - wrong area execution abort! \n");
+ gpencil_draw_exit(C, op);
+ p->status= GP_STATUS_ERROR;
+ estate = OPERATOR_CANCELLED;
}
else {
- /* not painting, so start stroke (this should be mouse-button down) */
-
- /* we must check that we're still within the area that we're set up to work from
- * otherwise we could crash (see bug #20586)
- */
- if (CTX_wm_area(C) != p->sa) {
- //printf("\t\t\tGP - wrong area execution abort! \n");
- gpencil_draw_exit(C, op);
- return OPERATOR_CANCELLED;
- }
-
//printf("\t\tGP - start stroke \n");
p->status= GP_STATUS_PAINTING;
- /* no break now, since we should immediately start painting */
- }
-
- /* moving mouse - assumed that mouse button is down if in painting status */
- case MOUSEMOVE:
- case INBETWEEN_MOUSEMOVE:
- /* check if we're currently painting */
- if (p->status == GP_STATUS_PAINTING) {
- /* handle drawing event */
- //printf("\t\tGP - add point\n");
- gpencil_draw_apply_event(op, event);
- /* finish painting operation if anything went wrong just now */
+ /* we may need to set up paint env again if we're resuming */
+ // XXX: watch it with the paintmode! in future, it'd be nice to allow changing paint-mode when in sketching-sessions
+ // XXX: with tablet events, we may event want to check for eraser here, for nicer tablet support
+ gp_paint_initstroke(p, p->paintmode);
+
if (p->status == GP_STATUS_ERROR) {
- //printf("\t\t\tGP - error done! \n");
gpencil_draw_exit(C, op);
- return OPERATOR_CANCELLED;
+ estate = OPERATOR_CANCELLED;
}
}
- break;
+ }
+ }
+
+ /* handle painting mouse-movements? */
+ if ((p->status == GP_STATUS_PAINTING) &&
+ (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) )
+ {
+ /* handle drawing event */
+ //printf("\t\tGP - add point\n");
+ gpencil_draw_apply_event(op, event);
- default:
- //printf("\t\tGP unknown event - %d \n", event->type);
+ /* finish painting operation if anything went wrong just now */
+ if (p->status == GP_STATUS_ERROR) {
+ //printf("\t\t\t\tGP - add error done! \n");
+ gpencil_draw_exit(C, op);
+ estate = OPERATOR_CANCELLED;
+ }
+ else {
+ /* event handled, so just tag as running modal */
+ //printf("\t\t\t\tGP - add point handled!\n");
+ estate = OPERATOR_RUNNING_MODAL;
+ }
+ }
+
+ /* update status indicators - cursor, header, etc. */
+ gpencil_draw_status_indicators(p);
+
+ /* process last operations before exiting */
+ switch (estate) {
+ case OPERATOR_FINISHED:
+ /* one last flush before we're done */
+ WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX need a nicer one that will work
+ break;
+
+ case OPERATOR_RUNNING_MODAL|OPERATOR_PASS_THROUGH:
+ /* event doesn't need to be handled */
+ //printf("unhandled event -> %d (mmb? = %d | mmv? = %d)\n", event->type, event->type == MIDDLEMOUSE, event->type==MOUSEMOVE);
break;
}
- return OPERATOR_RUNNING_MODAL;
+ /* return status code */
+ return estate;
}
/* ------------------------------- */
@@ -1558,8 +1667,6 @@ static EnumPropertyItem prop_gpencil_drawmodes[] = {
void GPENCIL_OT_draw (wmOperatorType *ot)
{
- PropertyRNA *prop;
-
/* identifiers */
ot->name= "Grease Pencil Draw";
ot->idname= "GPENCIL_OT_draw";
@@ -1576,8 +1683,7 @@ void GPENCIL_OT_draw (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* settings for drawing */
- prop= RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to intepret mouse movements.");
- RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to intepret mouse movements.");
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 4679d36e400..997250b7a2a 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -153,6 +153,7 @@ typedef enum eAnim_ChannelType {
ANIMTYPE_DSARM,
ANIMTYPE_DSMESH,
ANIMTYPE_DSTEX,
+ ANIMTYPE_DSLAT,
ANIMTYPE_DSLINESTYLE,
ANIMTYPE_SHAPEKEY,
@@ -232,6 +233,8 @@ typedef enum eAnimFilter_Flags {
#define FILTER_MBALL_OBJD(mb) ((mb->flag2 & MB_DS_EXPAND))
#define FILTER_ARM_OBJD(arm) ((arm->flag & ARM_DS_EXPAND))
#define FILTER_MESH_OBJD(me) ((me->flag & ME_DS_EXPAND))
+#define FILTER_LATTICE_OBJD(lt) ((lt->flag & LT_DS_EXPAND))
+
/* 'Sub-object/Action' channels (flags stored in Action) */
#define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED))
#define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED)==0)
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 6c5a0cc3bf3..78edcc05586 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -55,6 +55,10 @@ typedef struct tGPspoint {
float pressure; /* pressure of tablet at this point */
} tGPspoint;
+
+/* Check if 'sketching sessions' are enabled */
+#define GPENCIL_SKETCH_SESSIONS_ON(scene) ((scene)->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINTSESSIONS_ON)
+
/* ----------- Grease Pencil Tools/Context ------------- */
struct bGPdata **gpencil_data_get_pointers(struct bContext *C, struct PointerRNA *ptr);
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 6dc2fe04227..72e87e2c9bc 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -51,6 +51,7 @@ struct ReportList;
struct PointerRNA;
struct PropertyRNA;
+struct EnumPropertyItem;
#include "RNA_types.h"
@@ -204,6 +205,9 @@ struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const c
/* Create (and show) a menu containing all the Keying Sets which can be used in the current context */
void ANIM_keying_sets_menu_setup(struct bContext *C, const char title[], const char op_name[]);
+/* Dynamically populate an enum of Keying Sets */
+struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, int *free);
+
/* Check if KeyingSet can be used in the current context */
short ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks);
diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h
index e5e1f3cef10..b32fc1a48ef 100644
--- a/source/blender/editors/include/ED_markers.h
+++ b/source/blender/editors/include/ED_markers.h
@@ -51,6 +51,8 @@ void ED_markers_get_minmax(ListBase *markers, short sel, float *first, float *la
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short sel);
+struct TimeMarker *ED_markers_get_first_selected(ListBase *markers);
+
/* Operators ------------------------------ */
/* called in screen_ops.c:ED_operatortypes_screen() */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index d1bce26dd45..386bbc0a236 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -193,12 +193,15 @@ int paintface_minmax(struct Object *ob, float *min, float *max);
struct bDeformGroup *ED_vgroup_add(struct Object *ob);
struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name);
+void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup);
void ED_vgroup_select_by_name(struct Object *ob, char *name);
void ED_vgroup_data_create(struct ID *id);
int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);
void ED_vgroup_mirror(struct Object *ob, int mirror_weights, int flip_vgroups);
+int ED_vgroup_object_is_edit_mode(struct Object *ob);
+
void ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode);
void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum);
float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum);
diff --git a/source/blender/editors/include/ED_retopo.h b/source/blender/editors/include/ED_retopo.h
deleted file mode 100644
index e8d74411871..00000000000
--- a/source/blender/editors/include/ED_retopo.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * $Id$
- *
- * ***** 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) 2006 by Nicholas Bishop
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef ED_RETOPO_H
-#define ED_RETOPO_H
-
-#include "DNA_vec_types.h"
-
-/* For bglMats */
-#include "BIF_glutil.h"
-
-struct EditVert;
-struct Mesh;
-struct View3D;
-
-typedef struct RetopoViewData {
- bglMats mats;
-
- char queue_matrix_update;
-} RetopoViewData;
-
-typedef struct RetopoPaintPoint {
- struct RetopoPaintPoint *next, *prev;
- vec2s loc;
- short index;
- float co[3];
- struct EditVert *eve;
-} RetopoPaintPoint;
-
-typedef struct RetopoPaintLine {
- struct RetopoPaintLine *next, *prev;
- ListBase points;
- ListBase hitlist; /* RetopoPaintHit */
- RetopoPaintPoint *cyclic;
-} RetopoPaintLine;
-
-typedef struct RetopoPaintSel {
- struct RetopoPaintSel *next, *prev;
- RetopoPaintLine *line;
- char first;
-} RetopoPaintSel;
-
-typedef struct RetopoPaintData {
- char in_drag;
- short sloc[2];
-
- ListBase lines;
- ListBase intersections; /* RetopoPaintPoint */
-
- short seldist;
- RetopoPaintSel nearest;
-
- struct View3D *paint_v3d;
-} RetopoPaintData;
-
-RetopoPaintData *get_retopo_paint_data(void);
-
-char retopo_mesh_check(void);
-char retopo_curve_check(void);
-
-void retopo_end_okee(void);
-
-void retopo_free_paint_data(RetopoPaintData *rpd);
-void retopo_free_paint(void);
-
-char retopo_mesh_paint_check(void);
-void retopo_paint_view_update(struct View3D *v3d);
-void retopo_force_update(void);
-void retopo_paint_toggle(void*,void*);
-char retopo_paint(const unsigned short event);
-void retopo_draw_paint_lines(void);
-RetopoPaintData *retopo_paint_data_copy(RetopoPaintData *rpd);
-
-void retopo_toggle(void*,void*);
-void retopo_do_vert(struct View3D *v3d, float *v);
-void retopo_do_all(void);
-void retopo_do_all_cb(void *, void *);
-void retopo_queue_updates(struct View3D *v3d);
-
-void retopo_matrix_update(struct View3D *v3d);
-
-void retopo_free_view_data(struct View3D *v3d);
-
-#endif
-
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index c9139a503f1..5864449a490 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -142,6 +142,7 @@ void BIF_selectOrientation(void);
#define P_GEO_SNAP (P_SNAP|(1 << 4))
#define P_ALIGN_SNAP (P_GEO_SNAP|(1 << 5))
#define P_CONSTRAINT (1 << 6)
+#define P_OPTIONS (1 << 7)
void Transform_Properties(struct wmOperatorType *ot, int flags);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index e5a95f23ab6..337104e3737 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -109,7 +109,7 @@ void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob,
void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r, short do_shift);
-/* drawobject.c itterators */
+/* drawobject.c iterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts);
void mesh_foreachScreenFace(struct ViewContext *vc, void (*func)(void *userData, struct EditFace *efa, int x, int y, int index), void *userData);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4e3e9786a5a..d74a907d785 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -40,10 +40,12 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_library.h"
#include "BKE_unit.h"
+#include "BKE_utildefines.h" /* FILE_MAX */
#include "BIF_gl.h"
@@ -1734,7 +1736,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), scene->unit.system, unit_type>>16);
}
- if(BPY_eval_button(C, str_unit_convert, &value)) {
+ if(BPY_button_exec(C, str_unit_convert, &value)) {
value = ui_get_but_val(but); /* use its original value */
if(str[0])
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 65261371329..b74165801ce 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -34,10 +34,11 @@
#include "BLI_math.h"
#include "BLI_rect.h"
+#include "BLI_utildefines.h"
#include "BKE_colortools.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
+
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 2537b89d791..0f1e44aff1d 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -38,6 +38,8 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
#include "PIL_time.h"
#include "BKE_colortools.h"
@@ -646,13 +648,12 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
return BLI_in_rcti(&rect, x, y);
}
-#define UI_DRAG_THRESHOLD 3
static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
/* prevent other WM gestures to start while we try to drag */
WM_gestures_remove(C);
- if( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > UI_DRAG_THRESHOLD ) {
+ if( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold ) {
wmDrag *drag;
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -3756,13 +3757,13 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
Scopes *scopes = (Scopes *)but->poin;
rcti rect;
int changed= 1;
- float dx, dy;
+ /* float dx, dy; */
rect.xmin= but->x1; rect.xmax= but->x2;
rect.ymin= but->y1; rect.ymax= but->y2;
- dx = mx - data->draglastx;
- dy = my - data->draglasty;
+ /* dx = mx - data->draglastx; */
+ /* dy = my - data->draglasty; */
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize vectorscope widget itself */
@@ -5673,8 +5674,11 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu,
case YKEY:
case ZKEY:
{
- if(event->val == KM_PRESS) {
- count= 0;
+ if( (event->val == KM_PRESS) &&
+ (event->shift == FALSE) &&
+ (event->ctrl == FALSE) &&
+ (event->oskey == FALSE)
+ ) {
for(but= block->buttons.first; but; but= but->next) {
if(but->menu_key==event->type) {
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index b0ab90279f8..7d2f8e0d32a 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -28,7 +28,6 @@
#include <math.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#ifndef WIN32
#include <unistd.h>
@@ -44,6 +43,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_storage_types.h"
+#include "BLI_utildefines.h"
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
@@ -851,7 +851,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
/* sanity check */
if(w<=0 || h<=0 || w>2000 || h>2000) {
printf("icon_draw_rect: icons are %i x %i pixels?\n", w, h);
- assert(!"invalid icon size");
+ BKE_assert(!"invalid icon size");
return;
}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 46dfd34d2ba..f39a0204dcb 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -35,6 +35,7 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 1c2b0f9e7f3..95c52d20c37 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -29,7 +29,6 @@
#include <math.h>
#include <string.h>
-
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
@@ -38,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_math_color.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index d6cb8161916..2b6c18c5635 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_userdef_types.h"
@@ -798,7 +799,7 @@ void uiEndPanels(const bContext *C, ARegion *ar)
if(block->active && block->panel)
ui_offset_panel_block(block);
- /* consistancy; are panels not made, whilst they have tabs */
+ /* consistency; are panels not made, whilst they have tabs */
for(panot= ar->panels.first; panot; panot= panot->next) {
if((panot->runtime_flag & PNL_ACTIVE)==0) { // not made
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 1da50e0a9bb..571a48a4100 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -35,6 +35,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_dynstr.h"
#include "BLI_ghash.h"
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 14883400359..3f9c5cb6ca1 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -32,6 +32,7 @@
#include "DNA_userdef_types.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_colortools.h"
@@ -1383,7 +1384,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
hist = (Histogram *)cptr.data;
- hist->height= (hist->height<=0)?100:hist->height;
+ hist->height= (hist->height<=20)?20:hist->height;
bt= uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, hist->height, hist, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -1420,7 +1421,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
block= uiLayoutAbsoluteBlock(layout);
- scopes->wavefrm_height= (scopes->wavefrm_height<=0)?100:scopes->wavefrm_height;
+ scopes->wavefrm_height= (scopes->wavefrm_height<=20)?20:scopes->wavefrm_height;
bt= uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
@@ -1456,7 +1457,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
block= uiLayoutAbsoluteBlock(layout);
- scopes->vecscope_height= (scopes->vecscope_height<=0)?100:scopes->vecscope_height;
+ scopes->vecscope_height= (scopes->vecscope_height<=20)?20:scopes->vecscope_height;
bt= uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -1957,7 +1958,7 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
/************************* List Template **************************/
-static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon)
+static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int big)
{
ID *id= NULL;
int icon;
@@ -1978,7 +1979,7 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon)
/* get icon from ID */
if(id) {
- icon= ui_id_icon_get(C, id, 1);
+ icon= ui_id_icon_get(C, id, big);
if(icon)
return icon;
@@ -2007,7 +2008,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
sub= uiLayoutRow(overlap, 0);
/* retrieve icon and name */
- icon= list_item_icon_get(C, itemptr, rnaicon);
+ icon= list_item_icon_get(C, itemptr, rnaicon, 0);
if(icon == ICON_NULL || icon == ICON_DOT)
icon= 0;
@@ -2152,7 +2153,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if(i == 9)
row= uiLayoutRow(col, 0);
- icon= list_item_icon_get(C, &itemptr, rnaicon);
+ icon= list_item_icon_get(C, &itemptr, rnaicon, 1);
but= uiDefIconButR(block, LISTROW, 0, icon, 0,0,UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
@@ -2176,7 +2177,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if(found) {
/* create button */
name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
- icon= list_item_icon_get(C, &itemptr, rnaicon);
+ icon= list_item_icon_get(C, &itemptr, rnaicon, 0);
uiItemL(row, (name)? name: "", icon);
if(name)
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index dbe3697c76a..9a6a54bb8ef 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -30,8 +30,10 @@
#include "DNA_object_types.h"
+#include "BLI_utildefines.h"
+
#include "BKE_context.h"
-#include "BKE_utildefines.h"
+
#include "RNA_access.h"
@@ -56,19 +58,11 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
switch(RNA_property_type(prop)) {
case PROP_BOOLEAN: {
- int value, length;
if(arraylen && index == -1)
return NULL;
-
- length= RNA_property_array_length(ptr, prop);
-
- if(length)
- value= RNA_property_boolean_get_index(ptr, prop, index);
- else
- value= RNA_property_boolean_get(ptr, prop);
- if(icon && name && strcmp(name, "") == 0)
+ if(icon && name && name[0] == '\0')
but= uiDefIconButR(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
else if(icon)
but= uiDefIconTextButR(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index efdb2ef5f5e..cf29794434e 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -36,6 +36,7 @@
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_curve.h"
@@ -747,7 +748,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha), rcti *rect)
{
- int w, h, x, y, size;
+ int w, h, size;
if(icon==ICON_NULL)
return;
@@ -756,11 +757,13 @@ static void widget_draw_preview(BIFIconID icon, float aspect, float UNUSED(alpha
h = rect->ymax - rect->ymin;
size = MIN2(w, h);
size -= PREVIEW_PAD*2; /* padding */
-
- x = rect->xmin + w/2 - size/2;
- y = rect->ymin + h/2 - size/2;
-
- UI_icon_draw_preview_aspect_size(x, y, icon, aspect, size);
+
+ if(size > 0) {
+ int x = rect->xmin + w/2 - size/2;
+ int y = rect->ymin + h/2 - size/2;
+
+ UI_icon_draw_preview_aspect_size(x, y, icon, aspect, size);
+ }
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index fa36eed5911..9c5f4067204 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -36,7 +36,6 @@
#include "MEM_guardedalloc.h"
-
#include "DNA_curve_types.h"
#include "DNA_userdef_types.h"
#include "DNA_screen_types.h"
@@ -44,13 +43,13 @@
#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
-
+#include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
@@ -1527,7 +1526,7 @@ void init_userdef_do_versions(void)
U.dbl_click_time = 350;
}
if (U.anim_player_preset == 0) {
- U.anim_player_preset =1 ;
+ U.anim_player_preset = 1 ;
}
if (U.scrcastfps == 0) {
U.scrcastfps = 10;
@@ -1536,6 +1535,8 @@ void init_userdef_do_versions(void)
if (U.v2d_min_gridsize == 0) {
U.v2d_min_gridsize= 35;
}
+ if (U.dragthreshold == 0 )
+ U.dragthreshold= 5;
/* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options();
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 8faf528eb67..ae414c6e557 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -36,10 +36,11 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_utildefines.h"
+
#include "WM_api.h"
@@ -1109,7 +1110,6 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
View2DGrid *grid;
float space, pixels, seconddiv;
- int secondgrid;
/* check that there are at least some workable args */
if (ELEM(V2D_ARG_DUMMY, xunits, xclamp) && ELEM(V2D_ARG_DUMMY, yunits, yclamp))
@@ -1120,11 +1120,9 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
/* rule: gridstep is minimal GRIDSTEP pixels */
if (xunits == V2D_UNIT_SECONDS) {
- secondgrid= 1;
seconddiv= (float)(0.01 * FPS);
}
else {
- secondgrid= 0;
seconddiv= 1.0f;
}
@@ -1133,9 +1131,11 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
space= v2d->cur.xmax - v2d->cur.xmin;
pixels= (float)(v2d->mask.xmax - v2d->mask.xmin);
- grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
- step_to_grid(&grid->dx, &grid->powerx, xunits);
- grid->dx *= seconddiv;
+ if(pixels!=0.0f) {
+ grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
+ step_to_grid(&grid->dx, &grid->powerx, xunits);
+ grid->dx *= seconddiv;
+ }
if (xclamp == V2D_GRID_CLAMP) {
if (grid->dx < 0.1f) grid->dx= 0.1f;
@@ -1573,6 +1573,9 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
state |= UI_SCROLL_ARROWS;
}
+ UI_ThemeColor(TH_BACK);
+ glRecti(v2d->hor.xmin, v2d->hor.ymin, v2d->hor.xmax, v2d->hor.ymax);
+
uiWidgetScrollDraw(&wcol, &hor, &slider, state);
}
@@ -1681,6 +1684,9 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
state |= UI_SCROLL_ARROWS;
}
+ UI_ThemeColor(TH_BACK);
+ glRecti(v2d->vert.xmin, v2d->vert.ymin, v2d->vert.xmax, v2d->vert.ymax);
+
uiWidgetScrollDraw(&wcol, &vert, &slider, state);
}
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index af63b9cf37e..fcc72cba321 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -32,6 +32,7 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -409,6 +410,11 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", -40);
+ if(RNA_boolean_get(op->ptr, "page")) {
+ ARegion *ar= CTX_wm_region(C);
+ RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
+ }
+
/* apply movement, then we're done */
view_pan_apply(op);
view_pan_exit(op);
@@ -429,6 +435,7 @@ void VIEW2D_OT_scroll_down(wmOperatorType *ot)
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX);
+ RNA_def_boolean(ot->srna, "page", 0, "Page", "Scroll down one page.");
}
@@ -453,6 +460,11 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
RNA_int_set(op->ptr, "deltax", 0);
RNA_int_set(op->ptr, "deltay", 40);
+ if(RNA_boolean_get(op->ptr, "page")) {
+ ARegion *ar= CTX_wm_region(C);
+ RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymax - ar->v2d.mask.ymin);
+ }
+
/* apply movement, then we're done */
view_pan_apply(op);
view_pan_exit(op);
@@ -473,6 +485,7 @@ void VIEW2D_OT_scroll_up(wmOperatorType *ot)
/* rna - must keep these in sync with the other operators */
RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
RNA_def_int(ot->srna, "deltay", 0, INT_MIN, INT_MAX, "Delta Y", "", INT_MIN, INT_MAX);
+ RNA_def_boolean(ot->srna, "page", 0, "Page", "Scroll up one page.");
}
/* ********************************************************* */
@@ -1683,8 +1696,10 @@ void UI_view2d_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "VIEW2D_OT_pan", MOUSEPAN, 0, 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", WHEELDOWNMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", WHEELUPMOUSE, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0);
+
+ RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "page", 1);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "page", 1);
+
WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_zoom", MOUSEZOOM, 0, 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_out", PADMINUS, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 945313a71e8..2a391f7bbaf 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -36,6 +36,7 @@
#include "BLI_heap.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index 5f7ccd1441b..d010ab19048 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -43,6 +43,7 @@
#include "BLI_editVert.h"
#include "BLI_dynstr.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BKE_context.h"
@@ -58,7 +59,6 @@
#include "ED_mesh.h"
#include "ED_object.h"
-#include "ED_retopo.h"
#include "ED_screen.h"
#include "ED_util.h"
#include "ED_view3d.h"
@@ -1607,7 +1607,6 @@ typedef struct UndoMesh {
EditSelectionC *selected;
int totvert, totedge, totface, totsel;
int selectmode, shapenr;
- RetopoPaintData *retopo_paint_data;
char retopo_mode;
CustomData vdata, edata, fdata;
} UndoMesh;
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 5d6ed426152..d9db1e99bfa 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -44,6 +44,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -261,7 +262,7 @@ static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data);
- DAG_id_tag_update(vc.obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(vc.obedit->data, 0);
return OPERATOR_FINISHED;
}
@@ -388,7 +389,7 @@ static int make_fgon_exec(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
if( make_fgon(em, op, 1) ) {
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -420,7 +421,7 @@ static int clear_fgon_exec(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
if( make_fgon(em, op, 0) ) {
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -709,7 +710,7 @@ void addfaces_from_edgenet(EditMesh *em)
EM_select_flush(em);
-// XXX DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// XXX DAG_id_tag_update(obedit->data, 0);
}
static void addedgeface_mesh(EditMesh *em, wmOperator *op)
@@ -738,7 +739,7 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op)
eed= addedgelist(em, neweve[0], neweve[1], NULL);
EM_select_edge(eed, 1);
- // XXX DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ // XXX DAG_id_tag_update(obedit->data, 0);
return;
}
else if(amount > 4) {
@@ -836,7 +837,7 @@ static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
addedgeface_mesh(em, op);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1371,7 +1372,7 @@ static void make_prim_ext(bContext *C, float *loc, float *rot, int enter_editmod
make_prim(obedit, type, mat, tot, seg, subdiv, dia, depth, ext, fill);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -1733,7 +1734,7 @@ static int mesh_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
BKE_mesh_end_editmesh(ob->data, em);
- DAG_id_tag_update(ob->data, OB_RECALC_DATA);
+ DAG_id_tag_update(ob->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c
index e50f65256a7..11cf5dfa42c 100644
--- a/source/blender/editors/mesh/editmesh_lib.c
+++ b/source/blender/editors/mesh/editmesh_lib.c
@@ -48,12 +48,13 @@ editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
+#include "BLI_utildefines.h"
#include "BKE_customdata.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
+
#include "ED_mesh.h"
#include "ED_screen.h"
diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c
index 229a76f8ec8..4ffd458d66c 100644
--- a/source/blender/editors/mesh/editmesh_loop.c
+++ b/source/blender/editors/mesh/editmesh_loop.c
@@ -46,12 +46,14 @@ editmesh_loop: tools with own drawing subloops, select, knife, subdiv
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_mesh.h"
+#include "BKE_array_mallocn.h"
#include "PIL_time.h"
@@ -376,7 +378,7 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts)
EM_selectmode_set(em);
}
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
return;
}
@@ -696,7 +698,7 @@ static int knife_cut_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 661539d536b..54a3adc5da3 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -38,7 +38,6 @@ editmesh_mods.c, UI level access, no geometry changes
#include "MEM_guardedalloc.h"
-
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
@@ -49,6 +48,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_displist.h"
@@ -143,7 +143,7 @@ void EM_automerge(Scene *scene, Object *obedit, int update)
if (len) {
em->totvert -= len; /* saves doing a countall */
if (update) {
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
}
}
}
@@ -1427,7 +1427,7 @@ void EM_mesh_copy_edge(EditMesh *em, short type)
}
if (change) {
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
}
}
@@ -1555,7 +1555,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
}
if (change) {
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
}
}
@@ -1685,7 +1685,7 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type)
}
if (change) {
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
}
}
@@ -2195,7 +2195,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2])
break;
}
- DAG_id_tag_update(vc.obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(vc.obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
}
}
@@ -2739,7 +2739,7 @@ void EM_hide_mesh(EditMesh *em, int swap)
em->totedgesel= em->totfacesel= em->totvertsel= 0;
// if(EM_texFaceCheck())
- // DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ // DAG_id_tag_update(obedit->data, 0);
}
static int hide_mesh_exec(bContext *C, wmOperator *op)
@@ -2806,7 +2806,7 @@ void EM_reveal_mesh(EditMesh *em)
EM_selectmode_flush(em);
// if (EM_texFaceCheck())
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
}
static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3743,7 +3743,7 @@ static int editmesh_mark_seam(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -3795,7 +3795,7 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -4021,7 +4021,7 @@ void EM_recalc_normal_direction(EditMesh *em, int inside, int select) /* makes f
recalc_editnormals(em);
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
waitcursor(0);
}
@@ -4039,7 +4039,7 @@ static int normals_make_consistent_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); //TODO is this needed ?
return OPERATOR_FINISHED;
@@ -4379,7 +4379,7 @@ static int smooth_vertex(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -4466,7 +4466,7 @@ static int mesh_noise_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -4531,7 +4531,7 @@ static int flip_normals(bContext *C, wmOperator *UNUSED(op))
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -4571,7 +4571,7 @@ static int solidify_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -4607,7 +4607,7 @@ static int mesh_select_nth_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index d00b5ac6070..0fde8d75990 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -52,6 +52,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
#include "BLI_ghash.h"
@@ -483,11 +484,12 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op)
if(count) {
recalc_editnormals(em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
}
- BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count);
+ BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s.", count, (count==1)?"ex":"ices");
+
BKE_mesh_end_editmesh(obedit->data, em);
return OPERATOR_FINISHED;
@@ -646,7 +648,7 @@ static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short typ
* This shouldn't be necessary, derived queries should be
* automatically building this data if invalid. Or something.
*/
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
/* individual faces? */
// BIF_TransformSetUndo("Extrude");
@@ -677,7 +679,7 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -691,7 +693,7 @@ static int mesh_extrude_exec(bContext *C, wmOperator *op)
extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type"));
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -813,7 +815,7 @@ static int split_mesh(bContext *C, wmOperator *UNUSED(op))
WM_cursor_wait(0);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -873,7 +875,7 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
EM_fgon_flags(em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -977,7 +979,7 @@ static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float
EM_fgon_flags(em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
BKE_mesh_end_editmesh(obedit->data, em);
@@ -995,7 +997,7 @@ static int spin_mesh_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -1096,7 +1098,7 @@ static int screw_mesh_exec(bContext *C, wmOperator *op)
}
if(spin_mesh(C, op, dvec, turns*steps, 360.0f*turns, 0)) {
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1197,13 +1199,13 @@ static void delete_mesh(EditMesh *em, wmOperator *op, int event)
EditVert *eve,*nextve;
EditEdge *eed,*nexted;
int count;
- const char *str="Erase";
+ /* const char *str="Erase"; */
if(event<1) return;
if(event==10 ) {
- str= "Erase Vertices";
+ /* str= "Erase Vertices"; */
erase_edges(em, &em->edges);
erase_faces(em, &em->faces);
erase_vertices(em, &em->verts);
@@ -1212,10 +1214,10 @@ static void delete_mesh(EditMesh *em, wmOperator *op, int event)
if(!EdgeLoopDelete(em, op))
return;
- str= "Erase Edge Loop";
+ /* str= "Erase Edge Loop"; */
}
else if(event==4) {
- str= "Erase Edges & Faces";
+ /* str= "Erase Edges & Faces"; */
efa= em->faces.first;
while(efa) {
nextvl= efa->next;
@@ -1257,7 +1259,7 @@ static void delete_mesh(EditMesh *em, wmOperator *op, int event)
}
}
else if(event==1) {
- str= "Erase Edges";
+ /* str= "Erase Edges"; */
// faces first
efa= em->faces.first;
while(efa) {
@@ -1302,18 +1304,18 @@ static void delete_mesh(EditMesh *em, wmOperator *op, int event)
}
else if(event==2) {
- str="Erase Faces";
+ /* str="Erase Faces"; */
delfaceflag(em, SELECT);
}
else if(event==3) {
- str= "Erase All";
+ /* str= "Erase All"; */
if(em->verts.first) free_vertlist(em, &em->verts);
if(em->edges.first) free_edgelist(em, &em->edges);
if(em->faces.first) free_facelist(em, &em->faces);
if(em->selected.first) BLI_freelistN(&(em->selected));
}
else if(event==5) {
- str= "Erase Only Faces";
+ /* str= "Erase Only Faces"; */
efa= em->faces.first;
while(efa) {
nextvl= efa->next;
@@ -1351,7 +1353,7 @@ static int delete_mesh_exec(bContext *C, wmOperator *op)
delete_mesh(em, op, type);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1684,7 +1686,7 @@ static void fill_quad_double_op(EditMesh *em, EditFace *efa, struct GHash *gh, i
EditEdge *cedge[2]={NULL, NULL};
EditVert *v[4], **verts[2];
EditFace *hold;
- short start=0, end, left, right, vertsize,i;
+ short start=0, /*end,*/ left, /* right,*/ vertsize,i;
v[0] = efa->v1;
v[1] = efa->v2;
@@ -1705,9 +1707,9 @@ static void fill_quad_double_op(EditMesh *em, EditFace *efa, struct GHash *gh, i
// the array to the correct direction
if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
- end = (start+1)%4;
+ /* end = (start+1)%4; */ /* UNUSED */
left = (start+2)%4;
- right = (start+3)%4;
+ /* right = (start+3)%4; */ /* UNUSED */
if(verts[1][0] != v[left]) {flipvertarray(verts[1],numcuts+2);}
/*
We should have something like this now
@@ -2760,7 +2762,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float
}
}
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
// Now for each face in the mesh we need to figure out How many edges were cut
// and which filling method to use for that face
for(ef = em->faces.first;ef;ef = ef->next) {
@@ -3803,7 +3805,7 @@ static int edge_rotate_selected(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -4654,7 +4656,7 @@ useless:
} else {
draw = 0;
}
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
}
@@ -4674,7 +4676,7 @@ useless:
if(!immediate)
EM_automerge(0);
-// DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+// DAG_id_tag_update(obedit->data, 0);
// scrarea_queue_winredraw(curarea);
//BLI_ghash_free(edgesgh, freeGHash, NULL);
@@ -4725,7 +4727,7 @@ int EdgeLoopDelete(EditMesh *UNUSED(em), wmOperator *UNUSED(op))
EM_select_more(em);
removedoublesflag(em, 1,0, 0.001);
EM_select_flush(em);
- // DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ // DAG_id_tag_update(obedit->data, 0);
return 1;
#endif
return 0;
@@ -5034,7 +5036,7 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -5107,7 +5109,7 @@ static void shape_propagate(Object *obedit, EditMesh *em, wmOperator *op)
}
#endif
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
return;
}
@@ -5120,7 +5122,7 @@ static int shape_propagate_to_all_exec(bContext *C, wmOperator *op)
shape_propagate(obedit, em, op);
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
@@ -5182,7 +5184,7 @@ static int blend_from_shape_exec(bContext *C, wmOperator *op)
if(!blended)
return OPERATOR_CANCELLED;
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
@@ -5885,7 +5887,7 @@ static int merge_exec(bContext *C, wmOperator *op)
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -6465,7 +6467,7 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op)
if(!change)
return OPERATOR_CANCELLED;
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -6554,7 +6556,7 @@ static int mesh_mirror_uvs(bContext *C, wmOperator *op)
if(!change)
return OPERATOR_CANCELLED;
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -6610,7 +6612,7 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op)
if(!change)
return OPERATOR_CANCELLED;
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -6666,7 +6668,7 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op)
if(!change)
return OPERATOR_CANCELLED;
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -6764,7 +6766,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
esubdivideflag(obedit, em, 1, smooth, fractal, ts->editbutflag|flag, cuts, corner_cut_pattern, 0);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -7046,7 +7048,7 @@ static int fill_mesh_exec(bContext *C, wmOperator *UNUSED(op))
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -7077,7 +7079,7 @@ static int beautify_fill_exec(bContext *C, wmOperator *UNUSED(op))
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -7241,7 +7243,7 @@ static int sort_faces_exec(bContext *C, wmOperator *op)
}
MEM_freeN(index);
- DAG_id_tag_update(ob->data, OB_RECALC_DATA);
+ DAG_id_tag_update(ob->data, 0);
/* Return to editmode. */
ED_object_enter_editmode(C, 0);
@@ -7285,7 +7287,7 @@ static int quads_convert_to_tris_exec(bContext *C, wmOperator *UNUSED(op))
convert_to_triface(em,0);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -7314,7 +7316,7 @@ static int tris_convert_to_quads_exec(bContext *C, wmOperator *UNUSED(op))
join_triangles(em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -7343,7 +7345,7 @@ static int edge_flip_exec(bContext *C, wmOperator *UNUSED(op))
edge_flip(em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -7390,7 +7392,7 @@ static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
BKE_mesh_end_editmesh(obedit->data, em);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
@@ -7418,7 +7420,7 @@ static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
mesh_set_smooth_faces(em, 0);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
index 480f42f2973..42df009bb16 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/loopcut.c
@@ -46,6 +46,7 @@
#include "BLI_dynstr.h" /*for WM_operator_pystring */
#include "BLI_editVert.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_blender.h"
#include "BKE_context.h"
@@ -54,6 +55,7 @@
#include "BKE_modifier.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_array_mallocn.h"
#include "BIF_gl.h"
#include "BIF_glutil.h" /* for paint cursor */
@@ -287,7 +289,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, CTX_data_scene(C));
}
- DAG_id_tag_update(lcd->ob->data, OB_RECALC_DATA);
+ DAG_id_tag_update(lcd->ob->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, lcd->ob->data);
}
else {
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 42db085a0ca..7dd5196d32d 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -38,6 +38,11 @@
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
+#include "BLI_math.h"
+#include "BLI_editVert.h"
+#include "BLI_edgehash.h"
+#include "BLI_utildefines.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
@@ -47,10 +52,6 @@
#include "BKE_mesh.h"
#include "BKE_report.h"
-#include "BLI_math.h"
-#include "BLI_editVert.h"
-#include "BLI_edgehash.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
@@ -189,7 +190,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
mesh_update_customdata_pointers(me);
}
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return 1;
@@ -208,7 +209,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
return 0;
delete_customdata_layer(C, ob, cdl);
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return 1;
@@ -252,7 +253,7 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const cha
shadeMeshMCol(scene, ob, me);
}
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return 1;
@@ -271,7 +272,7 @@ int ED_mesh_color_remove(bContext *C, Object *ob, Mesh *me)
return 0;
delete_customdata_layer(C, ob, cdl);
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return 1;
@@ -485,7 +486,7 @@ static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
RE_make_sticky(scene, v3d);
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
@@ -517,7 +518,7 @@ static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
me->msticky= NULL;
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
@@ -614,7 +615,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges)
mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL);
- DAG_id_tag_update(&mesh->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&mesh->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mesh);
}
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 6cf0fe0874e..3e7b7604448 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -46,6 +46,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BLI_rand.h" /* for randome face sorting */
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index a9a673fdf20..b73f73820c7 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -35,6 +35,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
@@ -282,7 +283,7 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
ml= ml->prev;
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
return OPERATOR_FINISHED;
@@ -341,7 +342,7 @@ static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
ml= next;
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
return OPERATOR_FINISHED;
@@ -391,7 +392,7 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op)
}
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
return OPERATOR_FINISHED;
@@ -432,7 +433,7 @@ static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
ml= ml->next;
}
WM_event_add_notifier(C, NC_GEOM|ND_DATA, mb);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
}
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index fdf46ea19a7..2656db0ea9f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -43,6 +43,7 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
#include "BKE_anim.h"
#include "BKE_animsys.h"
@@ -1036,9 +1037,7 @@ static EnumPropertyItem convert_target_items[]= {
static void curvetomesh(Scene *scene, Object *ob)
{
- Curve *cu= ob->data;
-
- if(cu->disp.first==0)
+ if(ob->disp.first==0)
makeDispListCurveTypes(scene, ob, 0); /* force creation */
nurbs_to_mesh(ob); /* also does users */
@@ -1188,7 +1187,7 @@ static int convert_exec(bContext *C, wmOperator *op)
cu= newob->data;
- if (!cu->disp.first)
+ if (!newob->disp.first)
makeDispListCurveTypes(scene, newob, 0);
newob->type= OB_CURVE;
@@ -1225,8 +1224,12 @@ static int convert_exec(bContext *C, wmOperator *op)
for(nu=cu->nurb.first; nu; nu=nu->next)
nu->charidx= 0;
- if(target == OB_MESH)
+ if(target == OB_MESH) {
curvetomesh(scene, newob);
+
+ /* meshes doesn't use displist */
+ freedisplist(&newob->disp);
+ }
}
else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
ob->flag |= OB_DONE;
@@ -1243,6 +1246,9 @@ static int convert_exec(bContext *C, wmOperator *op)
newob->data= copy_curve(ob->data);
} else {
newob= ob;
+
+ /* meshes doesn't use displist */
+ freedisplist(&newob->disp);
}
curvetomesh(scene, newob);
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 4af2e00ef69..0b3e116d266 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -42,6 +42,7 @@
#include "BLI_blenlib.h"
#include "BLI_threads.h"
+#include "BLI_utildefines.h"
#include "BKE_blender.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 5afba182cc0..5076fec4fa3 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -35,6 +35,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 78163fa4e1d..1465c231f41 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -36,6 +36,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BLI_rand.h"
@@ -524,7 +525,10 @@ static int editmode_toggle_poll(bContext *C)
if(ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
return 0;
- return ob && (ob->type == OB_MESH || ob->type == OB_ARMATURE ||
+ if (ob->restrictflag & OB_RESTRICT_VIEW)
+ return 0;
+
+ return (ob->type == OB_MESH || ob->type == OB_ARMATURE ||
ob->type == OB_FONT || ob->type == OB_MBALL ||
ob->type == OB_LATTICE || ob->type == OB_SURF ||
ob->type == OB_CURVE);
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 3b504995e6a..c26affc24a2 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -29,8 +29,8 @@
#include <string.h>
-
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_group_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index e04ec43dace..92a53b834b0 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -34,6 +34,7 @@
#include "BLI_editVert.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_lattice_types.h"
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index ed75c4060a2..6c0a154090f 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -151,6 +151,7 @@ void OBJECT_OT_modifier_copy(struct wmOperatorType *ot);
void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot);
void OBJECT_OT_multires_reshape(struct wmOperatorType *ot);
void OBJECT_OT_multires_higher_levels_delete(struct wmOperatorType *ot);
+void OBJECT_OT_multires_base_apply(struct wmOperatorType *ot);
void OBJECT_OT_multires_external_save(struct wmOperatorType *ot);
void OBJECT_OT_multires_external_pack(struct wmOperatorType *ot);
void OBJECT_OT_meshdeform_bind(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index 2eefad06d2f..1f70dd84d94 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -31,6 +31,9 @@
#include "MEM_guardedalloc.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
@@ -46,8 +49,6 @@
#include "BKE_lattice.h"
#include "BKE_mesh.h"
-#include "BLI_listbase.h"
-
#include "ED_screen.h"
#include "ED_view3d.h"
#include "ED_util.h"
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index ef6f450f2f4..57929b49839 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -43,6 +43,7 @@
#include "BLI_string.h"
#include "BLI_path_util.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "BKE_curve.h"
#include "BKE_context.h"
@@ -1176,6 +1177,48 @@ void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/********************* multires apply base ***********************/
+static int multires_base_apply_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = ED_object_active_context(C);
+ MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
+
+ if (!mmd)
+ return OPERATOR_CANCELLED;
+
+ multiresModifier_base_apply(mmd, ob);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+static int multires_base_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+ if (edit_modifier_invoke_properties(C, op))
+ return multires_base_apply_exec(C, op);
+ else
+ return OPERATOR_CANCELLED;
+}
+
+
+void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
+{
+ ot->name= "Multires Apply Base";
+ ot->description= "Modify the base mesh to conform to the displaced mesh";
+ ot->idname= "OBJECT_OT_multires_base_apply";
+
+ ot->poll= multires_poll;
+ ot->invoke= multires_base_apply_invoke;
+ ot->exec= multires_base_apply_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ edit_modifier_properties(ot);
+}
+
+
/************************ mdef bind operator *********************/
static int meshdeform_poll(bContext *C)
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 221d1211930..903c40026f7 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -29,12 +29,12 @@
#include <stdlib.h>
#include <math.h>
-
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -134,6 +134,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_multires_subdivide);
WM_operatortype_append(OBJECT_OT_multires_reshape);
WM_operatortype_append(OBJECT_OT_multires_higher_levels_delete);
+ WM_operatortype_append(OBJECT_OT_multires_base_apply);
WM_operatortype_append(OBJECT_OT_multires_external_save);
WM_operatortype_append(OBJECT_OT_multires_external_pack);
WM_operatortype_append(OBJECT_OT_meshdeform_bind);
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 5f8996f23fe..ab53a95a156 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -47,6 +47,7 @@
#include "BLI_editVert.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_animsys.h"
@@ -279,10 +280,9 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt)
else if (ob->id.lib) {
uiPopupMenu *pup= uiPupMenuBegin(C, "OK?", ICON_QUESTION);
uiLayout *layout= uiPupMenuLayout(pup);
- PointerRNA props_ptr;
/* create operator menu item with relevant properties filled in */
- props_ptr= uiItemFullO(layout, op->idname, op->type->name, ICON_NULL, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
+ uiItemFullO(layout, op->idname, op->type->name, ICON_NULL, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
/* present the menu and be done... */
uiPupMenuEnd(C, pup);
@@ -571,7 +571,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
}
}
- /* context itterator */
+ /* context iterator */
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
if(ob!=par) {
@@ -746,7 +746,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
par->recalc |= OB_RECALC_OB;
- /* context itterator */
+ /* context iterator */
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
if (ob != par) {
if (test_parent_loop(par, ob)) {
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 265fd84d6da..3cb20ebbac0 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -42,6 +42,7 @@
#include "BLI_listbase.h"
#include "BLI_rand.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_group.h"
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 125e3c68b09..d8e54a73500 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 1792cabd5f6..60ea557d36d 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -39,6 +39,7 @@
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_curve.h"
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 6f4af03c87d..8501ee22031 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -45,6 +45,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
@@ -68,6 +69,8 @@
/************************ Exported Functions **********************/
static void vgroup_remap_update_users(Object *ob, int *map);
+static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *defgroup);
+static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg);
static Lattice *vgroup_edit_lattice(Object *ob)
{
@@ -79,6 +82,16 @@ static Lattice *vgroup_edit_lattice(Object *ob)
return NULL;
}
+int ED_vgroup_object_is_edit_mode(Object *ob)
+{
+ if(ob->type == OB_MESH)
+ return (((Mesh*)ob->data)->edit_mesh != NULL);
+ else if(ob->type == OB_LATTICE)
+ return (((Lattice*)ob->data)->editlatt != NULL);
+
+ return 0;
+}
+
bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
{
bDeformGroup *defgroup;
@@ -103,6 +116,25 @@ bDeformGroup *ED_vgroup_add(Object *ob)
return ED_vgroup_add_name(ob, "Group");
}
+void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup)
+{
+ bDeformGroup *dg = (bDeformGroup *)ob->defbase.first;
+
+ while (dg) {
+ if (dg == defgroup)
+ break;
+ dg = dg->next;
+ }
+
+ if (dg == NULL)
+ return;
+
+ if(ED_vgroup_object_is_edit_mode(ob))
+ vgroup_delete_edit_mode(ob, dg);
+ else
+ vgroup_delete_object_mode(ob, dg);
+}
+
void ED_vgroup_data_create(ID *id)
{
/* create deform verts */
@@ -508,7 +540,7 @@ static float get_vert_def_nr(Object *ob, int def_nr, int vertnum)
}
if(dvert==NULL)
- return 0.0f;
+ return -1;
dvert += vertnum;
@@ -516,17 +548,17 @@ static float get_vert_def_nr(Object *ob, int def_nr, int vertnum)
if(dvert->dw[i].def_nr == def_nr)
return dvert->dw[i].weight;
- return 0.0f;
+ return -1;
}
float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
{
int def_nr;
- if(!ob) return 0.0f;
+ if(!ob) return -1;
def_nr = defgroup_find_index(ob, dg);
- if(def_nr < 0) return 0.0f;
+ if(def_nr < 0) return -1;
return get_vert_def_nr(ob, def_nr, vertnum);
}
@@ -555,9 +587,10 @@ static void vgroup_select_verts(Object *ob, int select)
if(dvert && dvert->totweight){
for(i=0; i<dvert->totweight; i++){
if(dvert->dw[i].def_nr == (ob->actdef-1)){
- if(select) eve->f |= SELECT;
- else eve->f &= ~SELECT;
-
+ if(!eve->h) {
+ if(select) eve->f |= SELECT;
+ else eve->f &= ~SELECT;
+ }
break;
}
}
@@ -1093,16 +1126,11 @@ static void vgroup_delete_update_users(Object *ob, int id)
}
-static void vgroup_delete_object_mode(Object *ob)
+static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
{
- bDeformGroup *dg;
MDeformVert *dvert, *dvert_array=NULL;
int i, e, dvert_tot=0;
- dg = BLI_findlink(&ob->defbase, (ob->actdef-1));
- if(!dg)
- return;
-
ED_vgroup_give_array(ob->data, &dvert_array, &dvert_tot);
if(dvert_array) {
@@ -1198,18 +1226,13 @@ static void vgroup_active_remove_verts(Object *ob, int allverts)
}
}
-static void vgroup_delete_edit_mode(Object *ob)
+static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *defgroup)
{
- bDeformGroup *defgroup;
int i;
if(!ob->actdef)
return;
- defgroup = BLI_findlink(&ob->defbase, ob->actdef-1);
- if(!defgroup)
- return;
-
/* Make sure that no verts are using this group */
vgroup_active_remove_verts(ob, 1);
@@ -1285,10 +1308,14 @@ static int vgroup_object_in_edit_mode(Object *ob)
static void vgroup_delete(Object *ob)
{
+ bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef-1);
+ if(!dg)
+ return;
+
if(vgroup_object_in_edit_mode(ob))
- vgroup_delete_edit_mode(ob);
+ vgroup_delete_edit_mode(ob, dg);
else
- vgroup_delete_object_mode(ob);
+ vgroup_delete_object_mode(ob, dg);
}
static void vgroup_delete_all(Object *ob)
@@ -1339,7 +1366,6 @@ static void vgroup_assign_verts(Object *ob, float weight)
dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
if(dvert && (eve->f & SELECT)){
- done=0;
/* See if this vert already has a reference to this group */
/* If so: Change its weight */
done=0;
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index 84d9c0725bf..90e387a79c2 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -32,13 +32,15 @@
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
#include "BKE_boids.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
#include "BKE_particle.h"
-#include "BLI_listbase.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "RNA_define.h"
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 238ace11c0d..4ac4bf9fa9b 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -41,6 +41,13 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_dynstr.h"
+#include "BLI_kdtree.h"
+#include "BLI_rand.h"
+#include "BLI_utildefines.h"
+
#include "BKE_DerivedMesh.h"
#include "BKE_depsgraph.h"
@@ -52,15 +59,8 @@
#include "BKE_particle.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-#include "BKE_pointcache.h"
-
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_dynstr.h"
-#include "BLI_kdtree.h"
-#include "BLI_rand.h"
+#include "BKE_pointcache.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -3719,8 +3719,6 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
for(; pm; pm=pm->next) {
for(i=0; i<BPHYS_TOT_DATA; i++)
pm->data[i] = MEM_dupallocN(pm->data[i]);
-
- pm->index_array = MEM_dupallocN(pm->index_array);
}
}
@@ -3795,8 +3793,6 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
for(i=0; i<BPHYS_TOT_DATA; i++)
pm->data[i] = MEM_dupallocN(pm->data[i]);
- pm->index_array = MEM_dupallocN(pm->index_array);
-
BKE_ptcache_mem_pointers_init(pm);
LOOP_POINTS {
@@ -4061,25 +4057,9 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
totframe++;
for(pm=cache->mem_cache.first; pm; pm=pm->next) {
- BKE_ptcache_mem_pointers_init(pm);
-
LOOP_POINTS {
- if(psys) {
- if(pm->index_array) {
- if(pm->index_array[p])
- BKE_ptcache_mem_pointers_seek(p, pm);
- else
- continue;
- }
- else {
- pa = psys->particles + p;
- if((pm->next && pm->next->frame < pa->time)
- || (pm->prev && pm->prev->frame >= pa->dietime)) {
- BKE_ptcache_mem_pointers_incr(pm);
- continue;
- }
- }
- }
+ if(BKE_ptcache_mem_pointers_seek(p, pm) == 0)
+ continue;
if(!point->totkey) {
key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey),"ParticleEditKeys");
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 6e0ac82ebf3..6078f05ebd1 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -36,6 +36,7 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -45,7 +46,7 @@
#include "BKE_main.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
-#include "BKE_utildefines.h"
+
#include "RNA_access.h"
#include "RNA_define.h"
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index da8e7e063f4..4e08dd49703 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -53,6 +53,7 @@
#include "BLI_blenlib.h"
#include "BLI_threads.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_armature.h"
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index e0fc0d7318d..9aa879dad67 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -31,6 +31,9 @@
#include "MEM_guardedalloc.h"
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
#include "DNA_scene_types.h"
#include "BKE_context.h"
@@ -41,13 +44,10 @@
#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-
-#include "BLI_blenlib.h"
+
#include "ED_particle.h"
-
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 96e48631b09..96994ab1df4 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -34,6 +34,7 @@
#include "BLI_math.h"
#include "BLI_threads.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index df5576c778d..8a4a0433eb8 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -36,6 +36,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 2eac7c20350..d635a799ec1 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -45,6 +45,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_threads.h"
+#include "BLI_utildefines.h"
#include "DNA_world_types.h"
#include "DNA_camera_types.h"
@@ -151,6 +152,7 @@ typedef struct ShaderPreview {
/* node materials need full copy during preview render, glsl uses it too */
Material *matcopy;
+ float col[4]; /* active object color */
int sizex, sizey;
unsigned int *pr_rect;
@@ -347,6 +349,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce= pr_main->scene.first;
if(sce) {
+
/* this flag tells render to not execute depsgraph or ipos etc */
sce->r.scemode |= R_PREVIEWBUTS;
/* set world always back, is used now */
@@ -358,9 +361,17 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
}
sce->r.color_mgt_flag = scene->r.color_mgt_flag;
+
+ /* prevent overhead for small renders and icons (32) */
+ if(id && sp->sizex < 40)
+ sce->r.xparts= sce->r.yparts= 1;
+ else
+ sce->r.xparts= sce->r.yparts= 4;
+
/* exception: don't color manage texture previews or icons */
if((id && sp->pr_method==PR_ICON_RENDER) || id_type == ID_TE)
sce->r.color_mgt_flag &= ~R_COLOR_MANAGEMENT;
+
if((id && sp->pr_method==PR_ICON_RENDER) && id_type != ID_WO)
sce->r.alphamode= R_ALPHAPREMUL;
else
@@ -381,6 +392,10 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
init_render_material(mat, 0, NULL); /* call that retrieves mode_l */
end_render_material(mat);
+ /* un-useful option */
+ if(sp->pr_method==PR_ICON_RENDER)
+ mat->shade_flag &= ~MA_OBCOLOR;
+
/* turn on raytracing if needed */
if(mat->mode_l & MA_RAYMIRROR)
sce->r.mode |= R_RAYTRACE;
@@ -443,6 +458,9 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
for(base= sce->base.first; base; base= base->next) {
if(base->object->id.name[2]=='p') {
+ /* copy over object color, in case material uses it */
+ copy_v4_v4(base->object->col, sp->col);
+
if(ELEM4(base->object->type, OB_MESH, OB_CURVE, OB_SURF, OB_MBALL)) {
/* don't use assign_material, it changed mat->id.us, which shows in the UI */
Material ***matar= give_matarar(base->object);
@@ -601,7 +619,7 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
sbuts->preview= 0;
ok= 0;
}
-
+
if(ok==0) {
ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);
}
@@ -937,7 +955,7 @@ static void shader_preview_draw(void *spv, RenderResult *UNUSED(rr), volatile st
static int shader_preview_break(void *spv)
{
ShaderPreview *sp= spv;
-
+
return *(sp->stop);
}
@@ -962,7 +980,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
short idtype= GS(id->name);
char name[32];
int sizex;
-
+
/* get the stuff from the builtin preview dbase */
sce= preview_prepare_scene(sp->scene, id, idtype, sp); // XXX sizex
if(sce==NULL) return;
@@ -986,7 +1004,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
else if(sp->pr_method==PR_NODE_RENDER) {
if(idtype == ID_MA) sce->r.scemode |= R_MATNODE_PREVIEW;
else if(idtype == ID_TE) sce->r.scemode |= R_TEXNODE_PREVIEW;
- sce->r.mode |= R_OSA;
+ sce->r.mode &= ~R_OSA;
}
else { /* PR_BUTS_RENDER */
sce->r.mode |= R_OSA;
@@ -1021,6 +1039,8 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* handle results */
if(sp->pr_method==PR_ICON_RENDER) {
+ // char *rct= (char *)(sp->pr_rect + 32*16 + 16);
+
if(sp->pr_rect)
RE_ResultGet32(re, sp->pr_rect);
}
@@ -1219,8 +1239,9 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
{
wmJob *steve;
ShaderPreview *sp;
-
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview", WM_JOB_EXCL_RENDER);
+
+ /* suspended start means it starts after 1 timer step, see WM_jobs_timer below */
+ steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview", WM_JOB_EXCL_RENDER|WM_JOB_SUSPEND);
sp= MEM_callocN(sizeof(ShaderPreview), "shader preview");
/* customdata for preview thread */
@@ -1231,10 +1252,10 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
sp->pr_method= PR_ICON_RENDER;
sp->pr_rect= rect;
sp->id = id;
-
+
/* setup job */
WM_jobs_customdata(steve, sp, shader_preview_free);
- WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
+ WM_jobs_timer(steve, 0.25, NC_MATERIAL, NC_MATERIAL);
WM_jobs_callbacks(steve, common_preview_startjob, NULL, NULL, common_preview_endjob);
WM_jobs_start(CTX_wm_manager(C), steve);
@@ -1242,6 +1263,7 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, int method)
{
+ Object *ob= CTX_data_active_object(C);
wmJob *steve;
ShaderPreview *sp;
@@ -1257,6 +1279,8 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
sp->id = id;
sp->parent= parent;
sp->slot= slot;
+ if(ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
+ else sp->col[0]= sp->col[1]= sp->col[2]= sp->col[3]= 1.0f;
/* setup job */
WM_jobs_customdata(steve, sp, shader_preview_free);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 289c1a5d028..bdb38557ae2 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -38,6 +38,12 @@
#include "DNA_space_types.h"
#include "DNA_world_types.h"
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "BLI_editVert.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
#include "BKE_animsys.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -58,11 +64,6 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_editVert.h"
-#include "BLI_listbase.h"
-
#include "GPU_material.h"
#include "FRS_freestyle.h"
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index fd8afd63bb8..5ea5fe06c46 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -36,6 +36,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -959,7 +960,6 @@ void ED_region_toggle_hidden(bContext *C, ARegion *ar)
ScrArea *sa= CTX_wm_area(C);
ar->flag ^= RGN_FLAG_HIDDEN;
- ar->v2d.flag &= ~V2D_IS_INITIALISED; /* XXX should become hide/unhide api? */
if(ar->flag & RGN_FLAG_HIDDEN)
WM_event_remove_handlers(C, &ar->handlers);
@@ -1103,10 +1103,12 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
/*send space change notifyer*/
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CHANGED, sa);
-
- ED_area_tag_redraw(sa);
+
ED_area_tag_refresh(sa);
}
+
+ /* also redraw when re-used */
+ ED_area_tag_redraw(sa);
}
void ED_area_prevspace(bContext *C, ScrArea *sa)
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 6a9fc1489f1..9b3a51805e9 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -32,7 +32,8 @@
#include "DNA_vec_types.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
+
#include "BKE_colortools.h"
#include "BLI_math.h"
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 82f5f2597dd..7374b579cab 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -33,7 +33,9 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
+
+
#include "BKE_context.h"
#include "BKE_object.h"
#include "BKE_action.h"
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 7c30d113132..376e70f6ea2 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -34,6 +34,7 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 6f6b13a3309..d891b025241 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -33,6 +33,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_armature_types.h"
#include "DNA_lattice_types.h"
@@ -2094,6 +2095,44 @@ static void SCREEN_OT_area_join(wmOperatorType *ot)
RNA_def_int(ot->srna, "max_y", -100, INT_MIN, INT_MAX, "Y 2", "", INT_MIN, INT_MAX);
}
+
+static int spacedata_cleanup(bContext *C, wmOperator *op)
+{
+ Main *bmain= CTX_data_main(C);
+ bScreen *screen;
+ ScrArea *sa;
+ int tot= 0;
+
+ for(screen= bmain->screen.first; screen; screen= screen->id.next) {
+ for(sa= screen->areabase.first; sa; sa= sa->next) {
+ if(sa->spacedata.first != sa->spacedata.last) {
+ SpaceLink *sl= sa->spacedata.first;
+
+ BLI_remlink(&sa->spacedata, sl);
+ tot+= BLI_countlist(&sa->spacedata);
+ BKE_spacedata_freelist(&sa->spacedata);
+ BLI_addtail(&sa->spacedata, sl);
+ }
+ }
+ }
+ BKE_reportf(op->reports, RPT_INFO, "Removed amount of editors: %d", tot);
+
+ return OPERATOR_FINISHED;
+}
+
+static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Clean-up space-data";
+ ot->description= "Remove unused settings for invisible editors";
+ ot->idname= "SCREEN_OT_spacedata_cleanup";
+
+ /* api callbacks */
+ ot->exec= spacedata_cleanup;
+ ot->poll= WM_operator_winactive;
+
+}
+
/* ************** repeat last operator ***************************** */
static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3030,6 +3069,7 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_screen_set);
WM_operatortype_append(SCREEN_OT_screen_full_area);
WM_operatortype_append(SCREEN_OT_back_to_previous);
+ WM_operatortype_append(SCREEN_OT_spacedata_cleanup);
WM_operatortype_append(SCREEN_OT_screenshot);
WM_operatortype_append(SCREEN_OT_screencast);
WM_operatortype_append(SCREEN_OT_userpref_show);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index a536b4ea1a4..1fbcd7e61fd 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -31,6 +31,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -70,29 +71,31 @@ static int screenshot_exec(bContext *C, wmOperator *op)
{
ScreenshotData *scd= op->customdata;
- if(scd && scd->dumprect) {
- Scene *scene= CTX_data_scene(C);
- ImBuf *ibuf;
- char path[FILE_MAX];
-
- RNA_string_get(op->ptr, "filepath", path);
-
- strcpy(G.ima, path);
- BLI_path_abs(path, G.main->name);
+ if(scd) {
+ if(scd->dumprect) {
+ Scene *scene= CTX_data_scene(C);
+ ImBuf *ibuf;
+ char path[FILE_MAX];
- /* BKE_add_image_extension() checks for if extension was already set */
- if(scene->r.scemode & R_EXTENSION)
- if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5)
- BKE_add_image_extension(path, scene->r.imtype);
+ RNA_string_get(op->ptr, "filepath", path);
- ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
- ibuf->rect= scd->dumprect;
-
- BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
+ strcpy(G.ima, path);
+ BLI_path_abs(path, G.main->name);
+
+ /* BKE_add_image_extension() checks for if extension was already set */
+ if(scene->r.scemode & R_EXTENSION)
+ if(strlen(path)<FILE_MAXDIR+FILE_MAXFILE-5)
+ BKE_add_image_extension(path, scene->r.imtype);
+
+ ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
+ ibuf->rect= scd->dumprect;
+
+ BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
- IMB_freeImBuf(ibuf);
+ IMB_freeImBuf(ibuf);
- MEM_freeN(scd->dumprect);
+ MEM_freeN(scd->dumprect);
+ }
MEM_freeN(scd);
op->customdata= NULL;
}
@@ -159,6 +162,18 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
return OPERATOR_CANCELLED;
}
+static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op)
+{
+ ScreenshotData *scd= op->customdata;
+
+ if(scd) {
+ if(scd->dumprect)
+ MEM_freeN(scd->dumprect);
+ MEM_freeN(scd);
+ op->customdata= NULL;
+ }
+ return OPERATOR_CANCELLED;
+}
void SCREEN_OT_screenshot(wmOperatorType *ot)
{
@@ -168,6 +183,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
ot->invoke= screenshot_invoke;
ot->exec= screenshot_exec;
ot->poll= WM_operator_winactive;
+ ot->cancel= screenshot_cancel;
ot->flag= 0;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c4bf3a20235..82c2f614af1 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -44,8 +44,10 @@
#include "BLI_dynstr.h"
#include "BLI_linklist.h"
#include "BLI_memarena.h"
-#include "PIL_time.h"
#include "BLI_threads.h"
+#include "BLI_utildefines.h"
+
+#include "PIL_time.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -1140,6 +1142,7 @@ static void project_face_seams_init(const ProjPaintState *ps, const int face_ind
/* TODO - move to arithb.c */
/* little sister we only need to know lambda */
+#ifndef PROJ_DEBUG_NOSEAMBLEED
static float lambda_cp_line2(const float p[2], const float l1[2], const float l2[2])
{
float h[2], u[2];
@@ -1152,6 +1155,7 @@ static float lambda_cp_line2(const float p[2], const float l1[2], const float l2
return(dot_v2v2(u, h)/dot_v2v2(u, u));
}
+#endif // PROJ_DEBUG_NOSEAMBLEED
/* Converts a UV location to a 3D screenspace location
@@ -1624,6 +1628,7 @@ static int line_clip_rect2f(
/* scale the quad & tri about its center
* scaling by PROJ_FACE_SCALE_SEAM (0.99x) is used for getting fake UV pixel coords that are on the
* edge of the face but slightly inside it occlusion tests dont return hits on adjacent faces */
+#ifndef PROJ_DEBUG_NOSEAMBLEED
static void scale_quad(float insetCos[4][3], float *origCos[4], const float inset)
{
float cent[3];
@@ -1667,7 +1672,7 @@ static void scale_tri(float insetCos[4][3], float *origCos[4], const float inset
add_v3_v3(insetCos[1], cent);
add_v3_v3(insetCos[2], cent);
}
-
+#endif //PROJ_DEBUG_NOSEAMBLEED
static float Vec2Lenf_nosqrt(const float *v1, const float *v2)
{
@@ -2497,26 +2502,32 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
/* Only bother calculating the weights if we intersect */
if (ps->do_mask_normal || ps->dm_mtface_clone) {
-#if 0
- /* This is not QUITE correct since UV is not inside the UV's but good enough for seams */
+#if 1
+ /* get the UV on the line since we want to copy the pixels from there for bleeding */
+ float uv_close[2];
+ float fac= closest_to_line_v2(uv_close, uv, tf_uv_pxoffset[fidx1], tf_uv_pxoffset[fidx2]);
+ if (fac < 0.0f) copy_v2_v2(uv_close, tf_uv_pxoffset[fidx1]);
+ else if (fac > 1.0f) copy_v2_v2(uv_close, tf_uv_pxoffset[fidx2]);
+
if (side) {
- barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[2], tf_uv_pxoffset[3], uv, w);
+ barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[2], tf_uv_pxoffset[3], uv_close, w);
}
else {
- barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[1], tf_uv_pxoffset[2], uv, w);
+ barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[1], tf_uv_pxoffset[2], uv_close, w);
}
-#endif
-#if 1
+#else /* this is buggy with quads, dont use for now */
+
/* Cheat, we know where we are along the edge so work out the weights from that */
fac = fac1 + (fac * (fac2-fac1));
+
w[0]=w[1]=w[2]= 0.0;
if (side) {
- w[fidx1?fidx1-1:0] = fac;
- w[fidx2?fidx2-1:0] = 1.0f-fac;
+ w[fidx1?fidx1-1:0] = 1.0f-fac;
+ w[fidx2?fidx2-1:0] = fac;
}
else {
- w[fidx1] = fac;
- w[fidx2] = 1.0f-fac;
+ w[fidx1] = 1.0f-fac;
+ w[fidx2] = fac;
}
#endif
}
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 6232a8f2de1..821df3028e1 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -29,19 +29,21 @@
#ifndef ED_PAINT_INTERN_H
#define ED_PAINT_INTERN_H
+struct ARegion;
struct bContext;
-struct Scene;
-struct Object;
+struct bglMats;
+struct Brush;
+struct ListBase;
struct Mesh;
+struct Object;
struct PaintStroke;
struct PointerRNA;
+struct Scene;
+struct VPaint;
struct ViewContext;
struct wmEvent;
struct wmOperator;
struct wmOperatorType;
-struct ARegion;
-struct VPaint;
-struct ListBase;
/* paint_stroke.c */
typedef int (*StrokeGetLocation)(struct bContext *C, struct PaintStroke *stroke, float location[3], float mouse[2]);
@@ -98,6 +100,9 @@ void PAINT_OT_image_from_view(struct wmOperatorType *ot);
/* paint_utils.c */
+void projectf(struct bglMats *mats, const float v[3], float p[2]);
+float paint_calc_object_space_radius(struct ViewContext *vc, float center[3], float pixel_radius);
+float paint_get_tex_pixel(struct Brush* br, float u, float v);
int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, int *mval, unsigned int *index);
void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, int *xy, float *uv);
@@ -111,11 +116,11 @@ void PAINT_OT_face_select_all(struct wmOperatorType *ot);
int facemask_paint_poll(struct bContext *C);
/* stroke operator */
-typedef enum wmBrushStrokeMode {
- WM_BRUSHSTROKE_NORMAL,
- WM_BRUSHSTROKE_INVERT,
- WM_BRUSHSTROKE_SMOOTH,
-} wmBrushStrokeMode;
+typedef enum BrushStrokeMode {
+ BRUSH_STROKE_NORMAL,
+ BRUSH_STROKE_INVERT,
+ BRUSH_STROKE_SMOOTH,
+} BrushStrokeMode;
/* paint_undo.c */
typedef void (*UndoRestoreCb)(struct bContext *C, struct ListBase *lb);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 8b010b6dcdb..1ba0891751e 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -19,6 +19,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLI_utildefines.h"
+
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -315,11 +317,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_RADIALCONTROL_STRENGTH);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", WM_RADIALCONTROL_ANGLE);
- RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", WM_BRUSHSTROKE_NORMAL);
- RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", WM_BRUSHSTROKE_INVERT);
- RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", WM_BRUSHSTROKE_SMOOTH);
-
- //stroke_mode_modal_keymap(keyconf);
+ RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
+ RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
+ RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", BRUSH_STROKE_SMOOTH);
for(i=0; i<=5; i++)
RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index ea99844bfac..125e570946b 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -28,6 +28,9 @@
#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
@@ -41,9 +44,6 @@
#include "WM_api.h"
#include "WM_types.h"
-#include "BLI_math.h"
-
-
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -51,8 +51,9 @@
#include "ED_view3d.h"
#include "paint_intern.h"
-#include "sculpt_intern.h" // XXX, for expedience in getting this working, refactor later (or this just shows that this needs unification)
-
+/* still needed for sculpt_stroke_get_location, should be
+ removed eventually (TODO) */
+#include "sculpt_intern.h"
#include <float.h>
#include <math.h>
@@ -100,109 +101,6 @@ static void paint_draw_smooth_stroke(bContext *C, int x, int y, void *customdata
glDisable(GL_LINE_SMOOTH);
}
-#if 0
-
-// grid texture for testing
-
-#define GRID_WIDTH 8
-#define GRID_LENGTH 8
-
-#define W (0xFFFFFFFF)
-#define G (0x00888888)
-#define E (0xE1E1E1E1)
-#define C (0xC3C3C3C3)
-#define O (0xB4B4B4B4)
-#define Q (0xA9A9A9A9)
-
-static unsigned grid_texture0[256] =
-{
- W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,G,G,G,G,G,G,G,G,G,G,G,G,G,G,W,
- W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,W,
-};
-
-static unsigned grid_texture1[64] =
-{
- C,C,C,C,C,C,C,C,
- C,G,G,G,G,G,G,C,
- C,G,G,G,G,G,G,C,
- C,G,G,G,G,G,G,C,
- C,G,G,G,G,G,G,C,
- C,G,G,G,G,G,G,C,
- C,G,G,G,G,G,G,C,
- C,C,C,C,C,C,C,C,
-};
-
-static unsigned grid_texture2[16] =
-{
- O,O,O,O,
- O,G,G,O,
- O,G,G,O,
- O,O,O,O,
-};
-
-static unsigned grid_texture3[4] =
-{
- Q,Q,
- Q,Q,
-};
-
-static unsigned grid_texture4[1] =
-{
- Q,
-};
-
-#undef W
-#undef G
-#undef E
-#undef C
-#undef O
-#undef Q
-
-static void load_grid()
-{
- static GLuint overlay_texture;
-
- if (!overlay_texture) {
- //GLfloat largest_supported_anisotropy;
-
- glGenTextures(1, &overlay_texture);
- glBindTexture(GL_TEXTURE_2D, overlay_texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, grid_texture0);
- glTexImage2D(GL_TEXTURE_2D, 1, GL_RGB, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, grid_texture1);
- glTexImage2D(GL_TEXTURE_2D, 2, GL_RGB, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, grid_texture2);
- glTexImage2D(GL_TEXTURE_2D, 3, GL_RGB, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, grid_texture3);
- glTexImage2D(GL_TEXTURE_2D, 4, GL_RGB, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, grid_texture4);
- glEnable(GL_TEXTURE_2D);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
-
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
-
- //glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &largest_supported_anisotropy);
- //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_supported_anisotropy);
- }
-}
-
-#endif
-
-extern float get_tex_pixel(Brush* br, float u, float v);
-
typedef struct Snapshot {
float size[3];
float ofs[3];
@@ -373,7 +271,7 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
x += br->mtex.ofs[0];
y += br->mtex.ofs[1];
- avg = br->mtex.tex ? get_tex_pixel(br, x, y) : 1;
+ avg = br->mtex.tex ? paint_get_tex_pixel(br, x, y) : 1;
avg += br->texture_sample_bias;
@@ -424,18 +322,6 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
return 1;
}
-/* Convert a point in model coordinates to 2D screen coordinates. */
-// XXX duplicated from sculpt.c, deal with this later.
-static void projectf(bglMats *mats, const float v[3], float p[2])
-{
- double ux, uy, uz;
-
- gluProject(v[0],v[1],v[2], mats->modelview, mats->projection,
- (GLint *)mats->viewport, &ux, &uy, &uz);
- p[0]= ux;
- p[1]= uy;
-}
-
static int project_brush_radius(RegionView3D* rv3d, float radius, float location[3], bglMats* mats)
{
float view[3], nonortho[3], ortho[3], offset[3], p1[2], p2[2];
@@ -476,7 +362,8 @@ static int project_brush_radius(RegionView3D* rv3d, float radius, float location
return len_v2v2(p1, p2);
}
-int sculpt_get_brush_geometry(bContext* C, int x, int y, int* pixel_radius, float location[3], float modelview[16], float projection[16], int viewport[4])
+int sculpt_get_brush_geometry(bContext* C, int x, int y, int* pixel_radius,
+ float location[3])
{
struct PaintStroke *stroke;
float window[2];
@@ -487,12 +374,11 @@ int sculpt_get_brush_geometry(bContext* C, int x, int y, int* pixel_radius, floa
window[0] = x + stroke->vc.ar->winrct.xmin;
window[1] = y + stroke->vc.ar->winrct.ymin;
- memcpy(modelview, stroke->vc.rv3d->viewmat, sizeof(float[16]));
- memcpy(projection, stroke->vc.rv3d->winmat, sizeof(float[16]));
- memcpy(viewport, stroke->mats.viewport, sizeof(int[4]));
-
- if (stroke->vc.obact->sculpt && stroke->vc.obact->sculpt->pbvh && sculpt_stroke_get_location(C, stroke, location, window)) {
- *pixel_radius = project_brush_radius(stroke->vc.rv3d, brush_unprojected_radius(stroke->brush), location, &stroke->mats);
+ if(stroke->vc.obact->sculpt && stroke->vc.obact->sculpt->pbvh &&
+ sculpt_stroke_get_location(C, stroke, location, window)) {
+ *pixel_radius = project_brush_radius(stroke->vc.rv3d,
+ brush_unprojected_radius(stroke->brush),
+ location, &stroke->mats);
if (*pixel_radius == 0)
*pixel_radius = brush_size(stroke->brush);
@@ -514,58 +400,174 @@ int sculpt_get_brush_geometry(bContext* C, int x, int y, int* pixel_radius, floa
return hit;
}
-// XXX duplicated from sculpt.c
-float unproject_brush_radius(Object *ob, ViewContext *vc, float center[3], float offset)
+/* Draw an overlay that shows what effect the brush's texture will
+ have on brush strength */
+/* TODO: sculpt only for now */
+static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
+ ViewContext *vc, int x, int y)
{
- float delta[3], scale, loc[3];
+ rctf quad;
+
+ /* check for overlay mode */
+ if(!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
+ !(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_TILED)))
+ return;
+
+ /* save lots of GL state
+ TODO: check on whether all of these are needed? */
+ glPushAttrib(GL_COLOR_BUFFER_BIT|
+ GL_CURRENT_BIT|
+ GL_DEPTH_BUFFER_BIT|
+ GL_ENABLE_BIT|
+ GL_LINE_BIT|
+ GL_POLYGON_BIT|
+ GL_STENCIL_BUFFER_BIT|
+ GL_TRANSFORM_BIT|
+ GL_VIEWPORT_BIT|
+ GL_TEXTURE_BIT);
+
+ if(load_tex(sd, brush, vc)) {
+ glEnable(GL_BLEND);
- mul_v3_m4v3(loc, ob->obmat, center);
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glDepthMask(GL_FALSE);
+ glDepthFunc(GL_ALWAYS);
+
+ glMatrixMode(GL_TEXTURE);
+ glPushMatrix();
+ glLoadIdentity();
+
+ if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
+ /* brush rotation */
+ glTranslatef(0.5f, 0.5f, 0);
+ glRotatef(((brush->flag & BRUSH_RAKE) ?
+ sd->last_angle : sd->special_rotation) * (180.0f/M_PI),
+ 0, 0, 1);
+ glTranslatef(-0.5f, -0.5f, 0);
+
+ /* scale based on tablet pressure */
+ if(sd->draw_pressure && brush_use_size_pressure(brush)) {
+ glTranslatef(0.5f, 0.5f, 0);
+ glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1);
+ glTranslatef(-0.5f, -0.5f, 0);
+ }
- initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
- window_to_3d_delta(vc->ar, delta, offset, 0);
+ if(sd->draw_anchored) {
+ const float *aim = sd->anchored_initial_mouse;
+ const rcti *win = &vc->ar->winrct;
+ quad.xmin = aim[0]-sd->anchored_size - win->xmin;
+ quad.ymin = aim[1]-sd->anchored_size - win->ymin;
+ quad.xmax = aim[0]+sd->anchored_size - win->xmin;
+ quad.ymax = aim[1]+sd->anchored_size - win->ymin;
+ }
+ else {
+ const int radius= brush_size(brush);
+ quad.xmin = x - radius;
+ quad.ymin = y - radius;
+ quad.xmax = x + radius;
+ quad.ymax = y + radius;
+ }
+ }
+ else {
+ quad.xmin = 0;
+ quad.ymin = 0;
+ quad.xmax = vc->ar->winrct.xmax - vc->ar->winrct.xmin;
+ quad.ymax = vc->ar->winrct.ymax - vc->ar->winrct.ymin;
+ }
- scale= fabsf(mat4_to_scale(ob->obmat));
- scale= (scale == 0.0f)? 1.0f: scale;
+ /* set quad color */
+ glColor4f(U.sculpt_paint_overlay_col[0],
+ U.sculpt_paint_overlay_col[1],
+ U.sculpt_paint_overlay_col[2],
+ brush->texture_overlay_alpha / 100.0f);
+
+ /* draw textured quad */
+ glBegin(GL_QUADS);
+ glTexCoord2f(0, 0);
+ glVertex2f(quad.xmin, quad.ymin);
+ glTexCoord2f(1, 0);
+ glVertex2f(quad.xmax, quad.ymin);
+ glTexCoord2f(1, 1);
+ glVertex2f(quad.xmax, quad.ymax);
+ glTexCoord2f(0, 1);
+ glVertex2f(quad.xmin, quad.ymax);
+ glEnd();
+
+ glPopMatrix();
+ }
- return len_v3(delta)/scale;
+ glPopAttrib();
}
-// XXX paint cursor now does a lot of the same work that is needed during a sculpt stroke
-// problem: all this stuff was not intended to be used at this point, so things feel a
-// bit hacked. I've put lots of stuff in Brush that probably better goes in Paint
-// Functions should be refactored so that they can be used between sculpt.c and
-// paint_stroke.c clearly and optimally and the lines of communication between the
-// two modules should be more clearly defined.
-static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
+/* Special actions taken when paint cursor goes over mesh */
+/* TODO: sculpt only for now */
+static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc,
+ float location[3], float *visual_strength)
{
- ViewContext vc;
+ float unprojected_radius, projected_radius;
- (void)unused;
-
- view3d_set_viewcontext(C, &vc);
+ /* TODO: check whether this should really only be done when
+ brush is over mesh? */
+ if(sd->draw_pressure && brush_use_alpha_pressure(brush))
+ (*visual_strength) *= sd->pressure_value;
- if (vc.obact->sculpt) {
- Paint *paint = paint_get_active(CTX_data_scene(C));
- Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- Brush *brush = paint_brush(paint);
-
- int pixel_radius, viewport[4];
- float location[3], modelview[16], projection[16];
+ if(sd->draw_anchored)
+ projected_radius = sd->anchored_size;
+ else {
+ if(brush->flag & BRUSH_ANCHORED)
+ projected_radius = 8;
+ else
+ projected_radius = brush_size(brush);
+ }
+ unprojected_radius = paint_calc_object_space_radius(vc, location,
+ projected_radius);
- int hit;
+ if(sd->draw_pressure && brush_use_size_pressure(brush))
+ unprojected_radius *= sd->pressure_value;
- int flip;
- int sign;
+ if(!brush_use_locked_size(brush))
+ brush_set_unprojected_radius(brush, unprojected_radius);
+}
- float* col;
- float alpha;
+static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
+{
+ Paint *paint = paint_get_active(CTX_data_scene(C));
+ Brush *brush = paint_brush(paint);
+ ViewContext vc;
+ float final_radius;
+ float translation[2];
+ float outline_alpha, *outline_col;
+
+ /* set various defaults */
+ translation[0] = x;
+ translation[1] = y;
+ outline_alpha = 0.5;
+ outline_col = brush->add_col;
+ final_radius = brush_size(brush);
+
+ /* check that brush drawing is enabled */
+ if(!(paint->flags & PAINT_SHOW_BRUSH))
+ return;
+
+ /* can't use stroke vc here because this will be called during
+ mouse over too, not just during a stroke */
+ view3d_set_viewcontext(C, &vc);
+ /* TODO: as sculpt and other paint modes are unified, this
+ special mode of drawing will go away */
+ if(vc.obact->sculpt) {
+ Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
+ float location[3];
+ int pixel_radius, hit;
const float root_alpha = brush_alpha(brush);
float visual_strength = root_alpha*root_alpha;
-
const float min_alpha = 0.20f;
const float max_alpha = 0.80f;
+ /* this is probably here so that rake takes into
+ account the brush movements before the stroke
+ starts, but this doesn't really belong in draw code
+ (TODO) */
{
const float u = 0.5f;
const float v = 1 - u;
@@ -574,7 +576,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
const float dx = sd->last_x - x;
const float dy = sd->last_y - y;
- if (dx*dx + dy*dy >= r*r) {
+ if(dx*dx + dy*dy >= r*r) {
sd->last_angle = atan2(dx, dy);
sd->last_x = u*sd->last_x + v*x;
@@ -582,252 +584,106 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
}
}
- if(!brush_use_locked_size(brush) && !(paint->flags & PAINT_SHOW_BRUSH))
- return;
+ /* test if brush is over the mesh */
+ hit = sculpt_get_brush_geometry(C, x, y, &pixel_radius, location);
- hit = sculpt_get_brush_geometry(C, x, y, &pixel_radius, location, modelview, projection, viewport);
+ /* draw overlay */
+ paint_draw_alpha_overlay(sd, brush, &vc, x, y);
- if (brush_use_locked_size(brush))
+ if(brush_use_locked_size(brush))
brush_set_size(brush, pixel_radius);
- // XXX: no way currently to know state of pen flip or invert key modifier without starting a stroke
- flip = 1;
-
- sign = flip * ((brush->flag & BRUSH_DIR_IN)? -1 : 1);
-
- if (sign < 0 && ELEM4(brush->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_PINCH))
- col = brush->sub_col;
- else
- col = brush->add_col;
-
- alpha = (paint->flags & PAINT_SHOW_BRUSH_ON_SURFACE) ? min_alpha + (visual_strength*(max_alpha-min_alpha)) : 0.50f;
-
- if (ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_TILED) && brush->flag & BRUSH_TEXTURE_OVERLAY) {
- glPushAttrib(
- GL_COLOR_BUFFER_BIT|
- GL_CURRENT_BIT|
- GL_DEPTH_BUFFER_BIT|
- GL_ENABLE_BIT|
- GL_LINE_BIT|
- GL_POLYGON_BIT|
- GL_STENCIL_BUFFER_BIT|
- GL_TRANSFORM_BIT|
- GL_VIEWPORT_BIT|
- GL_TEXTURE_BIT);
-
- if (load_tex(sd, brush, &vc)) {
- glEnable(GL_BLEND);
-
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glDepthMask(GL_FALSE);
- glDepthFunc(GL_ALWAYS);
-
- glMatrixMode(GL_TEXTURE);
- glPushMatrix();
- glLoadIdentity();
-
- if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
- glTranslatef(0.5f, 0.5f, 0);
-
- if (brush->flag & BRUSH_RAKE) {
- glRotatef(sd->last_angle*(float)(180.0/M_PI), 0, 0, 1);
- }
- else {
- glRotatef(sd->special_rotation*(float)(180.0/M_PI), 0, 0, 1);
- }
-
- glTranslatef(-0.5f, -0.5f, 0);
-
- if (sd->draw_pressure && brush_use_size_pressure(brush)) {
- glTranslatef(0.5f, 0.5f, 0);
- glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1);
- glTranslatef(-0.5f, -0.5f, 0);
- }
- }
-
- glColor4f(
- U.sculpt_paint_overlay_col[0],
- U.sculpt_paint_overlay_col[1],
- U.sculpt_paint_overlay_col[2],
- brush->texture_overlay_alpha / 100.0f);
-
- glBegin(GL_QUADS);
- if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
- if (sd->draw_anchored) {
- glTexCoord2f(0, 0);
- glVertex2f(sd->anchored_initial_mouse[0]-sd->anchored_size - vc.ar->winrct.xmin, sd->anchored_initial_mouse[1]-sd->anchored_size - vc.ar->winrct.ymin);
-
- glTexCoord2f(1, 0);
- glVertex2f(sd->anchored_initial_mouse[0]+sd->anchored_size - vc.ar->winrct.xmin, sd->anchored_initial_mouse[1]-sd->anchored_size - vc.ar->winrct.ymin);
-
- glTexCoord2f(1, 1);
- glVertex2f(sd->anchored_initial_mouse[0]+sd->anchored_size - vc.ar->winrct.xmin, sd->anchored_initial_mouse[1]+sd->anchored_size - vc.ar->winrct.ymin);
-
- glTexCoord2f(0, 1);
- glVertex2f(sd->anchored_initial_mouse[0]-sd->anchored_size - vc.ar->winrct.xmin, sd->anchored_initial_mouse[1]+sd->anchored_size - vc.ar->winrct.ymin);
- }
- else {
- const int radius= brush_size(brush);
-
- glTexCoord2f(0, 0);
- glVertex2f((float)x-radius, (float)y-radius);
-
- glTexCoord2f(1, 0);
- glVertex2f((float)x+radius, (float)y-radius);
-
- glTexCoord2f(1, 1);
- glVertex2f((float)x+radius, (float)y+radius);
-
- glTexCoord2f(0, 1);
- glVertex2f((float)x-radius, (float)y+radius);
- }
- }
- else {
- glTexCoord2f(0, 0);
- glVertex2f(0, 0);
-
- glTexCoord2f(1, 0);
- glVertex2f(viewport[2], 0);
-
- glTexCoord2f(1, 1);
- glVertex2f(viewport[2], viewport[3]);
-
- glTexCoord2f(0, 1);
- glVertex2f(0, viewport[3]);
- }
- glEnd();
-
- glPopMatrix();
- }
-
- glPopAttrib();
+ /* check if brush is subtracting, use different color then */
+ /* TODO: no way currently to know state of pen flip or
+ invert key modifier without starting a stroke */
+ if((!(brush->flag & BRUSH_INVERTED) ^
+ !(brush->flag & BRUSH_DIR_IN)) &&
+ ELEM5(brush->sculpt_tool, SCULPT_TOOL_DRAW,
+ SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
+ SCULPT_TOOL_PINCH, SCULPT_TOOL_CREASE))
+ outline_col = brush->sub_col;
+
+ /* only do if brush is over the mesh */
+ if(hit)
+ paint_cursor_on_hit(sd, brush, &vc, location, &visual_strength);
+
+ /* don't show effect of strength past the soft limit */
+ if(visual_strength > 1)
+ visual_strength = 1;
+
+ outline_alpha = ((paint->flags & PAINT_SHOW_BRUSH_ON_SURFACE) ?
+ min_alpha + (visual_strength*(max_alpha-min_alpha)) : 0.50f);
+
+ if(sd->draw_anchored) {
+ final_radius = sd->anchored_size;
+ translation[0] = sd->anchored_initial_mouse[0] - vc.ar->winrct.xmin;
+ translation[1] = sd->anchored_initial_mouse[1] - vc.ar->winrct.ymin;
}
+ }
- if (hit) {
- float unprojected_radius;
-
- // XXX duplicated from brush_strength & paint_stroke_add_step, refactor later
- //wmEvent* event = CTX_wm_window(C)->eventstate;
-
- if (sd->draw_pressure && brush_use_alpha_pressure(brush))
- visual_strength *= sd->pressure_value;
-
- // don't show effect of strength past the soft limit
- if (visual_strength > 1) visual_strength = 1;
-
- if (sd->draw_anchored) {
- unprojected_radius = unproject_brush_radius(CTX_data_active_object(C), &vc, location, sd->anchored_size);
- }
- else {
- if (brush->flag & BRUSH_ANCHORED)
- unprojected_radius = unproject_brush_radius(CTX_data_active_object(C), &vc, location, 8);
- else
- unprojected_radius = unproject_brush_radius(CTX_data_active_object(C), &vc, location, brush_size(brush));
- }
-
- if (sd->draw_pressure && brush_use_size_pressure(brush))
- unprojected_radius *= sd->pressure_value;
-
- if (!brush_use_locked_size(brush))
- brush_set_unprojected_radius(brush, unprojected_radius);
-
- if(!(paint->flags & PAINT_SHOW_BRUSH))
- return;
-
- }
+ /* make lines pretty */
+ glEnable(GL_BLEND);
+ glEnable(GL_LINE_SMOOTH);
- glPushAttrib(
- GL_COLOR_BUFFER_BIT|
- GL_CURRENT_BIT|
- GL_DEPTH_BUFFER_BIT|
- GL_ENABLE_BIT|
- GL_LINE_BIT|
- GL_POLYGON_BIT|
- GL_STENCIL_BUFFER_BIT|
- GL_TRANSFORM_BIT|
- GL_VIEWPORT_BIT|
- GL_TEXTURE_BIT);
+ /* set brush color */
+ glColor4f(outline_col[0], outline_col[1], outline_col[2], outline_alpha);
- glColor4f(col[0], col[1], col[2], alpha);
+ /* draw brush outline */
+ glTranslatef(translation[0], translation[1], 0);
+ glutil_draw_lined_arc(0.0, M_PI*2.0, final_radius, 40);
+ glTranslatef(-translation[0], -translation[1], 0);
- glEnable(GL_BLEND);
+ /* restore GL state */
+ glDisable(GL_BLEND);
+ glDisable(GL_LINE_SMOOTH);
+}
- glEnable(GL_LINE_SMOOTH);
+/* if this is a tablet event, return tablet pressure and set *pen_flip
+ to 1 if the eraser tool is being used, 0 otherwise */
+static float event_tablet_data(wmEvent *event, int *pen_flip)
+{
+ int erasor = 0;
+ float pressure = 1;
- if (sd->draw_anchored) {
- glTranslatef(sd->anchored_initial_mouse[0] - vc.ar->winrct.xmin, sd->anchored_initial_mouse[1] - vc.ar->winrct.ymin, 0.0f);
- glutil_draw_lined_arc(0.0, M_PI*2.0, sd->anchored_size, 40);
- glTranslatef(-sd->anchored_initial_mouse[0] + vc.ar->winrct.xmin, -sd->anchored_initial_mouse[1] + vc.ar->winrct.xmin, 0.0f);
- }
- else {
- glTranslatef((float)x, (float)y, 0.0f);
- glutil_draw_lined_arc(0.0, M_PI*2.0, brush_size(brush), 40);
- glTranslatef(-(float)x, -(float)y, 0.0f);
- }
+ if(event->custom == EVT_DATA_TABLET) {
+ wmTabletData *wmtab= event->customdata;
- glPopAttrib();
+ erasor = (wmtab->Active == EVT_TABLET_ERASER);
+ pressure = (wmtab->Active != EVT_TABLET_NONE) ? wmtab->Pressure : 1;
}
- else {
- Paint *paint = paint_get_active(CTX_data_scene(C));
- Brush *brush = paint_brush(paint);
-
- if(!(paint->flags & PAINT_SHOW_BRUSH))
- return;
-
- glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], 0.5f);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glTranslatef((float)x, (float)y, 0.0f);
- glutil_draw_lined_arc(0.0, M_PI*2.0, brush_size(brush), 40); // XXX: for now use the brushes size instead of potentially using the unified size because the feature has been enabled for sculpt
- glTranslatef((float)-x, (float)-y, 0.0f);
+ if(pen_flip)
+ (*pen_flip) = erasor;
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
- }
+ return pressure;
}
/* Put the location of the next stroke dot into the stroke RNA and apply it to the mesh */
static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *event, float mouse_in[2])
{
- Paint *paint = paint_get_active(CTX_data_scene(C)); // XXX
- Brush *brush = paint_brush(paint); // XXX
-
+ Paint *paint = paint_get_active(CTX_data_scene(C));
+ Brush *brush = paint_brush(paint);
+ PaintStroke *stroke = op->customdata;
float mouse[3];
-
PointerRNA itemptr;
-
float location[3];
-
float pressure;
- int pen_flip;
-
- ViewContext vc; // XXX
-
- PaintStroke *stroke = op->customdata;
-
- view3d_set_viewcontext(C, &vc); // XXX
-
- /* Tablet */
- if(event->custom == EVT_DATA_TABLET) {
- wmTabletData *wmtab= event->customdata;
+ int pen_flip;
- pressure = (wmtab->Active != EVT_TABLET_NONE) ? wmtab->Pressure : 1;
- pen_flip = (wmtab->Active == EVT_TABLET_ERASER);
- }
- else {
- pressure = 1;
- pen_flip = 0;
- }
+ /* see if tablet affects event */
+ pressure = event_tablet_data(event, &pen_flip);
- // XXX: temporary check for sculpt mode until things are more unified
- if (vc.obact->sculpt) {
+ /* TODO: as sculpt and other paint modes are unified, this
+ separation will go away */
+ if(stroke->vc.obact->sculpt) {
float delta[3];
brush_jitter_pos(brush, mouse_in, mouse);
- // XXX: meh, this is round about because brush_jitter_pos isn't written in the best way to be reused here
- if (brush->flag & BRUSH_JITTER_PRESSURE) {
+ /* XXX: meh, this is round about because
+ brush_jitter_pos isn't written in the best way to
+ be reused here */
+ if(brush->flag & BRUSH_JITTER_PRESSURE) {
sub_v3_v3v3(delta, mouse, mouse_in);
mul_v3_fl(delta, pressure);
add_v3_v3v3(mouse, mouse_in, delta);
@@ -836,7 +692,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
else
copy_v3_v3(mouse, mouse_in);
- /* XXX: can remove the if statement once all modes have this */
+ /* TODO: can remove the if statement once all modes have this */
if(stroke->get_location)
stroke->get_location(C, stroke, location, mouse);
else
@@ -845,10 +701,10 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
/* Add to stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);
- RNA_float_set_array(&itemptr, "location", location);
- RNA_float_set_array(&itemptr, "mouse", mouse);
- RNA_boolean_set (&itemptr, "pen_flip", pen_flip);
- RNA_float_set (&itemptr, "pressure", pressure);
+ RNA_float_set_array(&itemptr, "location", location);
+ RNA_float_set_array(&itemptr, "mouse", mouse);
+ RNA_boolean_set(&itemptr, "pen_flip", pen_flip);
+ RNA_float_set(&itemptr, "pressure", pressure);
stroke->last_mouse_position[0] = mouse[0];
stroke->last_mouse_position[1] = mouse[1];
@@ -910,15 +766,9 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
if(length > FLT_EPSILON) {
int steps;
int i;
- float pressure = 1;
-
- // XXX duplicate code
- if(event->custom == EVT_DATA_TABLET) {
- wmTabletData *wmtab= event->customdata;
- if(wmtab->Active != EVT_TABLET_NONE)
- pressure = brush_use_size_pressure(stroke->brush) ? wmtab->Pressure : 1;
- }
+ float pressure;
+ pressure = event_tablet_data(event, NULL);
scale = (brush_size(stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
mul_v2_fl(vec, scale);
diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c
index 643e2cd6915..758ef2a2fc1 100644
--- a/source/blender/editors/sculpt_paint/paint_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_undo.c
@@ -27,11 +27,12 @@
#include "MEM_guardedalloc.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
#include "DNA_userdef_types.h"
-#include "BLI_listbase.h"
-#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 6e158fe2e66..da8eff6c581 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -9,18 +9,22 @@
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
-#include "RNA_access.h"
-#include "RNA_define.h"
-
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_DerivedMesh.h"
#include "BKE_paint.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
#include "BIF_gl.h"
+/* TODO: remove once projectf goes away */
+#include "BIF_glutil.h"
+
+#include "RE_shader_ext.h"
#include "ED_view3d.h"
#include "ED_screen.h"
@@ -33,6 +37,55 @@
#include "paint_intern.h"
+/* convert a point in model coordinates to 2D screen coordinates */
+/* TODO: can be deleted once all calls are replaced with
+ view3d_project_float() */
+void projectf(bglMats *mats, const float v[3], float p[2])
+{
+ double ux, uy, uz;
+
+ gluProject(v[0],v[1],v[2], mats->modelview, mats->projection,
+ (GLint *)mats->viewport, &ux, &uy, &uz);
+ p[0]= ux;
+ p[1]= uy;
+}
+
+float paint_calc_object_space_radius(ViewContext *vc, float center[3],
+ float pixel_radius)
+{
+ Object *ob = vc->obact;
+ float delta[3], scale, loc[3];
+
+ mul_v3_m4v3(loc, ob->obmat, center);
+
+ initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
+ window_to_3d_delta(vc->ar, delta, pixel_radius, 0);
+
+ scale= fabsf(mat4_to_scale(ob->obmat));
+ scale= (scale == 0.0f)? 1.0f: scale;
+
+ return len_v3(delta)/scale;
+}
+
+float paint_get_tex_pixel(Brush* br, float u, float v)
+{
+ TexResult texres;
+ float co[3];
+ int hasrgb;
+
+ co[0] = u;
+ co[1] = v;
+ co[2] = 0;
+
+ memset(&texres, 0, sizeof(TexResult));
+ hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 1, &texres);
+
+ if (hasrgb & TEX_RGB)
+ texres.tin = (0.35*texres.tr + 0.45*texres.tg + 0.2*texres.tb)*texres.ta;
+
+ return texres.tin;
+}
+
/* 3D Paint */
static void imapaint_project(Object *ob, float *model, float *proj, float *co, float *pco)
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 39768a010a8..a62f01e88f0 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "IMB_imbuf.h"
@@ -273,7 +274,7 @@ static void make_vertexcol(Object *ob) /* single ob */
memset(me->mcol, 255, 4*sizeof(MCol)*me->totface);
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
}
@@ -334,7 +335,7 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
}
}
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
}
@@ -448,7 +449,7 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
MEM_freeN(indexar);
copy_wpaint_prev(wp, NULL, 0);
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
}
/* XXX: should be re-implemented as a vertex/weight paint 'color correct' operator
@@ -925,7 +926,7 @@ void sample_wpaint(Scene *scene, ARegion *ar, View3D *UNUSED(v3d), int mode)
val= 0; // XXX pupmenu(str);
if(val>=0) {
ob->actdef= val+1;
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
}
MEM_freeN(str);
}
@@ -1080,7 +1081,7 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */
* exit (exit needs doing regardless because we
* should redeform).
*/
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
if(ob->mode & OB_MODE_WEIGHT_PAINT) {
Object *par;
@@ -1588,7 +1589,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
swap_m4m4(vc->rv3d->persmat, mat);
- DAG_id_tag_update(ob->data, OB_RECALC_DATA);
+ DAG_id_tag_update(ob->data, 0);
ED_region_tag_redraw(vc->ar);
}
@@ -1627,7 +1628,7 @@ static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
}
}
- DAG_id_tag_update(ob->data, OB_RECALC_DATA);
+ DAG_id_tag_update(ob->data, 0);
}
@@ -1729,7 +1730,7 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */
if (me)
/* update modifier stack for mapping requirements */
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_SCENE|ND_MODE, scene);
@@ -1905,7 +1906,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
ED_region_tag_redraw(vc->ar);
- DAG_id_tag_update(ob->data, OB_RECALC_DATA);
+ DAG_id_tag_update(ob->data, 0);
}
static void vpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
@@ -1975,7 +1976,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op)
create_vgroups_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+ DAG_id_tag_update(&me->id, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 55c7247650a..6429a70515b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -34,6 +34,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_dynstr.h"
#include "BLI_ghash.h"
#include "BLI_pbvh.h"
@@ -58,7 +59,6 @@
#include "BKE_paint.h"
#include "BKE_report.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "WM_api.h"
@@ -71,9 +71,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
-
#include "RE_render_ext.h"
-#include "RE_shader_ext.h"
#include "GPU_buffers.h"
@@ -85,10 +83,6 @@
#include <omp.h>
#endif
-/* ==== FORWARD DEFINITIONS =====
- *
- */
-
void ED_sculpt_force_update(bContext *C)
{
Object *ob= CTX_data_active_object(C);
@@ -152,10 +146,6 @@ int sculpt_modifiers_active(Scene *scene, Object *ob)
return 0;
}
-/* ===== STRUCTS =====
- *
- */
-
typedef enum StrokeFlags {
CLIP_X = 1,
CLIP_Y = 2,
@@ -226,32 +216,6 @@ typedef struct StrokeCache {
float plane_trim_squared;
} StrokeCache;
-/* ===== OPENGL =====
- *
- * Simple functions to get data from the GL
- */
-
-/* Convert a point in model coordinates to 2D screen coordinates. */
-static void projectf(bglMats *mats, const float v[3], float p[2])
-{
- double ux, uy, uz;
-
- gluProject(v[0],v[1],v[2], mats->modelview, mats->projection,
- (GLint *)mats->viewport, &ux, &uy, &uz);
- p[0]= ux;
- p[1]= uy;
-}
-
-/*XXX: static void project(bglMats *mats, const float v[3], short p[2])
-{
- float f[2];
- projectf(mats, v, f);
-
- p[0]= f[0];
- p[1]= f[1];
-}
-*/
-
/*** BVH Tree ***/
/* Get a screen-space rectangle of the modified area */
@@ -648,66 +612,6 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
}
}
-float get_tex_pixel(Brush* br, float u, float v)
-{
- TexResult texres;
- float co[3];
- int hasrgb;
-
- co[0] = u;
- co[1] = v;
- co[2] = 0;
-
- memset(&texres, 0, sizeof(TexResult));
- hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 1, &texres);
-
- if (hasrgb & TEX_RGB)
- texres.tin = (0.35*texres.tr + 0.45*texres.tg + 0.2*texres.tb)*texres.ta;
-
- return texres.tin;
-}
-
-#if 0
-
-/* Get a pixel from the texcache at (px, py) */
-static unsigned char get_texcache_pixel(const SculptSession *ss, int px, int py)
-{
- unsigned *p;
- p = ss->texcache + py * ss->texcache_side + px;
- return ((unsigned char*)(p))[0];
-}
-
-static float get_texcache_pixel_bilinear(const SculptSession *ss, float u, float v)
-{
- unsigned x, y, x2, y2;
- const int tc_max = ss->texcache_side - 1;
- float urat, vrat, uopp;
-
- if(u < 0) u = 0;
- else if(u >= ss->texcache_side) u = tc_max;
- if(v < 0) v = 0;
- else if(v >= ss->texcache_side) v = tc_max;
-
- x = floor(u);
- y = floor(v);
- x2 = x + 1;
- y2 = y + 1;
-
- if(x2 > ss->texcache_side) x2 = tc_max;
- if(y2 > ss->texcache_side) y2 = tc_max;
-
- urat = u - x;
- vrat = v - y;
- uopp = 1 - urat;
-
- return ((get_texcache_pixel(ss, x, y) * uopp +
- get_texcache_pixel(ss, x2, y) * urat) * (1 - vrat) +
- (get_texcache_pixel(ss, x, y2) * uopp +
- get_texcache_pixel(ss, x2, y2) * urat) * vrat) / 255.0;
-}
-
-#endif
-
/* Return a multiplier for brush strength on a particular vertex. */
static float tex_strength(SculptSession *ss, Brush *br, float *point, const float len)
{
@@ -791,7 +695,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
x += br->mtex.ofs[0];
y += br->mtex.ofs[1];
- avg = get_tex_pixel(br, x, y);
+ avg = paint_get_tex_pixel(br, x, y);
}
avg += br->texture_sample_bias;
@@ -2813,21 +2717,6 @@ static void SCULPT_OT_radial_control(wmOperatorType *ot)
/**** Operator for applying a stroke (various attributes including mouse path)
using the current brush. ****/
-static float unproject_brush_radius(Object *ob, ViewContext *vc, float center[3], float offset)
-{
- float delta[3], scale, loc[3];
-
- mul_v3_m4v3(loc, ob->obmat, center);
-
- initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
- window_to_3d_delta(vc->ar, delta, offset, 0);
-
- scale= fabsf(mat4_to_scale(ob->obmat));
- scale= (scale == 0.0f)? 1.0f: scale;
-
- return len_v3(delta)/scale;
-}
-
static void sculpt_cache_free(StrokeCache *cache)
{
if(cache->face_norms)
@@ -2901,8 +2790,13 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
}
mode = RNA_int_get(op->ptr, "mode");
- cache->invert = mode == WM_BRUSHSTROKE_INVERT;
- cache->alt_smooth = mode == WM_BRUSHSTROKE_SMOOTH;
+ cache->invert = mode == BRUSH_STROKE_INVERT;
+ cache->alt_smooth = mode == BRUSH_STROKE_SMOOTH;
+
+ /* not very nice, but with current events system implementation
+ we can't handle brush appearance inversion hotkey separately (sergey) */
+ if(cache->invert) brush->flag |= BRUSH_INVERTED;
+ else brush->flag &= ~BRUSH_INVERTED;
/* Alt-Smooth */
if (ss->cache->alt_smooth) {
@@ -3075,7 +2969,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession
if(cache->first_time) {
if (!brush_use_locked_size(brush)) {
- cache->initial_radius= unproject_brush_radius(ss->ob, cache->vc, cache->true_location, brush_size(brush));
+ cache->initial_radius= paint_calc_object_space_radius(cache->vc, cache->true_location, brush_size(brush));
brush_set_unprojected_radius(brush, cache->initial_radius);
}
else {
@@ -3137,7 +3031,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession
if (!hit)
copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
- cache->radius= unproject_brush_radius(ss->ob, paint_stroke_view_context(stroke), cache->true_location, cache->pixel_radius);
+ cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke), cache->true_location, cache->pixel_radius);
cache->radius_squared = cache->radius*cache->radius;
copy_v3_v3(sd->anchored_location, cache->true_location);
@@ -3452,14 +3346,17 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *unused)
/* Finished */
if(ss->cache) {
+ Brush *brush= paint_brush(&sd->paint);
+ brush->flag &= ~BRUSH_INVERTED;
+
sculpt_stroke_modifiers_check(C, ss);
/* Alt-Smooth */
if (ss->cache->alt_smooth) {
Paint *p= &sd->paint;
- Brush *br= (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
- if(br) {
- paint_brush_set(p, br);
+ brush= (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
+ if(brush) {
+ paint_brush_set(p, brush);
}
}
@@ -3541,10 +3438,10 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
{
static EnumPropertyItem stroke_mode_items[] = {
- { WM_BRUSHSTROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally" },
- { WM_BRUSHSTROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke" },
- { WM_BRUSHSTROKE_SMOOTH, "SMOOTH", 0, "Smooth", "Switch brush to smooth mode for duration of stroke" },
- { 0 }
+ {BRUSH_STROKE_NORMAL, "NORMAL", 0, "Normal", "Apply brush normally"},
+ {BRUSH_STROKE_INVERT, "INVERT", 0, "Invert", "Invert action of brush for duration of stroke"},
+ {BRUSH_STROKE_SMOOTH, "SMOOTH", 0, "Smooth", "Switch brush to smooth mode for duration of stroke"},
+ {0}
};
/* identifiers */
@@ -3565,7 +3462,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement,
"Stroke", "");
- RNA_def_enum(ot->srna, "mode", stroke_mode_items, WM_BRUSHSTROKE_NORMAL,
+ RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL,
"Sculpt Stroke Mode",
"Action taken when a sculpt stroke is made");
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 7c6db939a11..a48d6d8d9c9 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -55,7 +55,6 @@ void sculpt_radialcontrol_start(int mode);
struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct Object *ob);
struct Brush *sculptmode_brush(void);
-//void do_symmetrical_brush_actions(struct Sculpt *sd, struct wmOperator *wm, struct BrushAction *a, short *, short *);
void sculpt(Sculpt *sd);
@@ -70,9 +69,6 @@ void sculpt_stroke_apply(struct Sculpt *sd, struct SculptStroke *);
void sculpt_stroke_apply_all(struct Sculpt *sd, struct SculptStroke *);
int sculpt_stroke_get_location(bContext *C, struct PaintStroke *stroke, float out[3], float mouse[2]);
-/* Partial Mesh Visibility */
-void sculptmode_pmv(int mode);
-
/* Undo */
typedef struct SculptUndoNode {
@@ -110,6 +106,4 @@ void sculpt_undo_push_end(void);
int sculpt_modifiers_active(Scene *scene, Object *ob);
void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]);
-void brush_jitter_pos(struct Brush *brush, float *pos, float *jitterpos);
-
#endif
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index c9912936399..a8fee6ea39d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -33,6 +33,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_threads.h"
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 80d0b0f8815..cd6c7e4305d 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -32,6 +32,9 @@
#include "MEM_guardedalloc.h"
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
#include "DNA_packedFile_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
@@ -45,9 +48,6 @@
#include "BKE_packedFile.h"
#include "BKE_sound.h"
-#include "BLI_blenlib.h"
-
-
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index cf515a25020..4dc77e13192 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -34,9 +34,9 @@
#include <string.h>
#include <float.h>
-
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
/* Types --------------------------------------------------------------- */
@@ -45,7 +45,7 @@
#include "BKE_action.h"
#include "BKE_context.h"
-#include "BKE_utildefines.h"
+
/* Everything from source (BIF, BDR, BSE) ------------------------------ */
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index afda04d1c45..7756075b292 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -35,6 +35,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
@@ -57,6 +58,7 @@
#include "ED_keyframes_edit.h"
#include "ED_screen.h"
#include "ED_transform.h"
+#include "ED_markers.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -1298,13 +1300,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
TimeMarker *marker= NULL;
/* find first selected marker */
- if (ac->markers) {
- for (marker= ac->markers->first; marker; marker=marker->next) {
- if (marker->flag & SELECT) {
- break;
- }
- }
- }
+ marker= ED_markers_get_first_selected(ac->markers);
/* store marker's time (if available) */
if (marker)
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 2d47424dc99..26990878e46 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -34,6 +34,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 678558e6450..031743953ec 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -37,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -456,7 +457,7 @@ void ED_spacetype_action(void)
art->init= action_main_area_init;
art->draw= action_main_area_draw;
art->listener= action_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D/*|ED_KEYMAP_MARKERS*/|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+ art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 0d0d3713723..0aac167fed2 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -25,12 +25,14 @@
#include <stdlib.h>
#include "MEM_guardedalloc.h"
+
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_object_types.h"
#include "DNA_windowmanager_types.h"
-#include "BKE_utildefines.h"
+
#include "BKE_context.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 2d16bb6bc81..b0b1c23cbc0 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -30,6 +30,9 @@
#include "MEM_guardedalloc.h"
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+
#include "DNA_armature_types.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
@@ -38,8 +41,6 @@
#include "DNA_world_types.h"
#include "DNA_brush_types.h"
-#include "BLI_listbase.h"
-
#include "BKE_context.h"
#include "BKE_action.h"
#include "BKE_material.h"
@@ -48,7 +49,7 @@
#include "BKE_particle.h"
#include "BKE_screen.h"
#include "BKE_texture.h"
-#include "BKE_utildefines.h"
+
#include "RNA_access.h"
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 9071d9f27d9..bd1674aa307 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -29,11 +29,10 @@
#include <string.h>
#include <stdio.h>
-
-
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
-#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_screen.h"
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 18e906e7dc2..b7c9bdde0e8 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -36,6 +36,7 @@
#include "BLI_path_util.h"
#include "BLI_storage.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 87c50936f90..b33231f190c 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -29,12 +29,12 @@
#include <string.h>
#include <stdio.h>
-
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -69,7 +69,7 @@ static SpaceLink *buttons_new(const bContext *UNUSED(C))
BLI_addtail(&sbuts->regionbase, ar);
ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
+ ar->alignment= RGN_ALIGN_TOP;
#if 0
/* context area */
@@ -259,6 +259,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
switch(wmn->data) {
case ND_TRANSFORM:
buttons_area_redraw(sa, BCONTEXT_OBJECT);
+ buttons_area_redraw(sa, BCONTEXT_DATA); /* autotexpace flag */
break;
case ND_POSE:
case ND_BONE_ACTIVE:
@@ -347,6 +348,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
}
break;
+ case NC_NODE:
+ if(wmn->action==NA_SELECTED)
+ ED_area_tag_redraw(sa);
+ break;
/* Listener for preview render, when doing an global undo. */
case NC_WINDOW:
ED_area_tag_redraw(sa);
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 0bb0d78a497..2d4501e6005 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -28,17 +28,16 @@
#include <sys/stat.h>
#include <limits.h>
-
#include "BLF_api.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
-// #include "BKE_suggestions.h"
#include "BKE_report.h"
-#include "BKE_utildefines.h"
+
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 405c965ecce..05c3561d25e 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -33,6 +33,7 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_text.h" /* only for character utility funcs */
@@ -657,11 +658,12 @@ static int scrollback_append_exec(bContext *C, wmOperator *op)
{
SpaceConsole *sc= CTX_wm_space_console(C);
ARegion *ar= CTX_wm_region(C);
-
- ConsoleLine *ci= console_history_verify(C);
+ ConsoleLine *ci;
char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
int type= RNA_enum_get(op->ptr, "type");
+
+ console_history_verify(C);
ci= console_scrollback_add_str(sc, str, 1); /* own the string */
ci->type= type;
@@ -702,7 +704,6 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
static int copy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc= CTX_wm_space_console(C);
- int buf_len;
DynStr *buf_dyn= BLI_dynstr_new();
char *buf_str;
@@ -755,7 +756,7 @@ static int copy_exec(bContext *C, wmOperator *UNUSED(op))
}
buf_str= BLI_dynstr_get_cstring(buf_dyn);
- buf_len= BLI_dynstr_get_len(buf_dyn);
+
BLI_dynstr_free(buf_dyn);
WM_clipboard_text_set(buf_str, 0);
@@ -792,7 +793,6 @@ static int paste_exec(bContext *C, wmOperator *UNUSED(op))
if(buf_str==NULL)
return OPERATOR_CANCELLED;
- buf_next= buf_str;
buf_step= buf_str;
while((buf_next=buf_step) && buf_next[0] != '\0') {
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 4fbe96c0e54..c44d13aa058 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -33,6 +33,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -42,7 +43,6 @@
#include "BIF_gl.h"
-
#include "RNA_access.h"
#include "WM_api.h"
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index ece227494c6..84090c88abc 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -30,6 +30,7 @@
#include <string.h>
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_dynstr.h"
#include "BLI_storage_types.h"
#ifdef WIN32
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 2e8db0dc998..dc550d84e4d 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -33,6 +33,7 @@
#include "BKE_main.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_storage_types.h"
#ifdef WIN32
#include "BLI_winstuff.h"
@@ -260,7 +261,6 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
ARegion *ar= CTX_wm_region(C);
SpaceFile *sfile= CTX_wm_space_file(C);
- short val;
rcti rect;
int extend = RNA_boolean_get(op->ptr, "extend");
int fill = RNA_boolean_get(op->ptr, "fill");
@@ -270,7 +270,6 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
rect.xmin = rect.xmax = event->x - ar->winrct.xmin;
rect.ymin = rect.ymax = event->y - ar->winrct.ymin;
- val = event->val;
if(!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 4d9bd9bf54a..f9c467a039d 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -30,6 +30,7 @@
#include "BKE_screen.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index ce4b5bdd4de..e16b2f650eb 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -46,6 +46,7 @@
#include "BLI_linklist.h"
#include "BLI_storage_types.h"
#include "BLI_threads.h"
+#include "BLI_utildefines.h"
#ifdef WIN32
#include "BLI_winstuff.h"
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index d55fcd7d8ba..9e29967a792 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -62,6 +62,7 @@
#include "BLI_path_util.h"
#include "BLI_storage_types.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 12cca144d80..b8ffc73caf0 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -42,6 +42,7 @@
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_storage_types.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index d34ef74b66a..c937ebca547 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -41,6 +41,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 08e3870f8a2..b2e9f93685e 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
@@ -48,7 +49,7 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
-#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
#include "BIF_glutil.h"
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 3602977bfa3..154c955c48e 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
@@ -60,6 +61,7 @@
#include "ED_keyframes_edit.h"
#include "ED_screen.h"
#include "ED_transform.h"
+#include "ED_markers.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -1769,13 +1771,7 @@ static void mirror_graph_keys(bAnimContext *ac, short mode)
TimeMarker *marker= NULL;
/* find first selected marker */
- if (ac->markers) {
- for (marker= ac->markers->first; marker; marker=marker->next) {
- if (marker->flag & SELECT) {
- break;
- }
- }
- }
+ marker= ED_markers_get_first_selected(ac->markers);
/* store marker's time (if available) */
if (marker)
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index 1939de69e14..4f529df24dc 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -29,11 +29,11 @@
#include <stdlib.h>
#include <math.h>
-
#include "DNA_scene_types.h"
#include "DNA_anim_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_sound.h"
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 05fcb3c6bf8..58a5f4b113e 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -33,6 +33,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index ff2d233ccdb..37d58e5591b 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -37,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -538,24 +539,22 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
/* F-Curve's array index is automatically mapped to RGB values. This works best of 3-value vectors.
* TODO: find a way to module the hue so that not all curves have same color...
*/
-
- /* standard table of colors to use */
- const float _colorsets[4][3]=
- {
- {1.0f, 0.0f, 0.0f}, /* red */
- {0.0f, 1.0f, 0.0f}, /* green */
- {0.0f, 0.0f, 1.0f}, /* blue */
- {0.3f, 0.8f, 1.0f}, /* 'unknown' color - bluish so as to not conflict with handles */
- };
-
- /* simply copy the relevant color over to the F-Curve */
- if ((fcu->array_index >= 0) && (fcu->array_index < 3)) {
- /* if the index is within safe bounds, use index to access table */
- VECCOPY(fcu->color, _colorsets[fcu->array_index]);
- }
- else {
- /* use the 'unknown' color... */
- VECCOPY(fcu->color, _colorsets[3]);
+ float *col= fcu->color;
+
+ switch(fcu->array_index) {
+ case 0:
+ col[0]= 1.0f; col[1]= 0.0f; col[2]= 0.0f;
+ break;
+ case 1:
+ col[0]= 0.0f; col[1]= 1.0f; col[2]= 0.0f;
+ break;
+ case 2:
+ col[0]= 0.0f; col[1]= 0.0f; col[2]= 1.0f;
+ break;
+ default:
+ /* 'unknown' color - bluish so as to not conflict with handles */
+ col[0]= 0.3f; col[1]= 0.8f; col[2]= 1.0f;
+ break;
}
}
break;
@@ -601,7 +600,7 @@ void ED_spacetype_ipo(void)
art->init= graph_main_area_init;
art->draw= graph_main_area_draw;
art->listener= graph_region_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D/*|ED_KEYMAP_MARKERS*/|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+ art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 756be43ccc9..7509903246b 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -40,6 +40,7 @@
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
@@ -349,6 +350,8 @@ static void image_panel_curves(const bContext *C, Panel *pa)
#if 0
/* 0: disable preview
otherwise refresh preview
+
+ XXX if you put this back, also check XXX in image_main_area_draw() */
*/
void image_preview_event(int event)
{
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 6e7af2cb196..e2d58b1df5f 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -39,7 +39,9 @@
#include "DNA_brush_types.h"
#include "PIL_time.h"
+
#include "BLI_threads.h"
+#include "BLI_utildefines.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c
index 772592875c2..ceb7cda2316 100644
--- a/source/blender/editors/space_image/image_header.c
+++ b/source/blender/editors/space_image/image_header.c
@@ -33,22 +33,18 @@
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
-
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
-
#include "ED_image.h"
#include "WM_types.h"
-
#include "UI_interface.h"
-
-
#include "image_intern.h"
/********************** toolbox operator *********************/
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 2b6958e436e..69bbfb78d81 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -32,6 +32,10 @@
#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
#include "DNA_object_types.h"
#include "DNA_node_types.h"
#include "DNA_packedFile_types.h"
@@ -48,9 +52,6 @@
#include "BKE_report.h"
#include "BKE_screen.h"
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
diff --git a/source/blender/editors/space_image/image_render.c b/source/blender/editors/space_image/image_render.c
index 5fa0a2de202..d80801f8868 100644
--- a/source/blender/editors/space_image/image_render.c
+++ b/source/blender/editors/space_image/image_render.c
@@ -28,6 +28,8 @@
#include <stdlib.h>
#include <stdio.h>
+#include "BLI_utildefines.h"
+
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 8b8772c6e28..c911adb0c16 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -39,6 +39,7 @@
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
@@ -391,6 +392,7 @@ static SpaceLink *image_new(const bContext *UNUSED(C))
simage->iuser.frames= 100;
scopes_new(&simage->scopes);
+ simage->sample_line_hist.height= 100;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for image");
@@ -766,6 +768,9 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
//View2DScrollers *scrollers;
float col[3];
+ /* XXX not supported yet, disabling for now */
+ scene->r.scemode &= ~R_COMP_CROP;
+
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index cc5e02c6266..71424bb8384 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -32,17 +32,17 @@
#include <sys/stat.h>
#include <limits.h>
-
#include "BLF_api.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
// #include "BKE_suggestions.h"
#include "BKE_report.h"
-#include "BKE_utildefines.h"
+
#include "MEM_guardedalloc.h"
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 190814a4da0..a20d3b961c0 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_bpath.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 787d70805c6..46c4c8c2dfe 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -28,9 +28,9 @@
#include "MEM_guardedalloc.h"
-
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 7a6e5dad017..cf3607e8fba 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -34,13 +34,14 @@
#include "DNA_meta_types.h"
#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
+
#include "BKE_anim.h"
#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
#include "BKE_key.h"
#include "BKE_mesh.h"
#include "BKE_particle.h"
-#include "BKE_utildefines.h"
#include "ED_armature.h"
#include "ED_mesh.h"
@@ -91,13 +92,12 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
case OB_SURF:
case OB_CURVE:
case OB_FONT: {
- Curve *cu= ob->data;
int tot= 0, totf= 0;
stats->totcurve += totob;
- if(cu->disp.first)
- count_displist(&cu->disp, &tot, &totf);
+ if(ob->disp.first)
+ count_displist(&ob->disp, &tot, &totf);
tot *= totob;
totf *= totob;
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 8bfcad4bab7..80040f55a08 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -29,12 +29,12 @@
#include <string.h>
#include <stdio.h>
-
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index a8452731d68..0f11dee7d5a 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -30,7 +30,9 @@
#include "BLF_api.h"
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
+
+
#include "BIF_gl.h"
#include "BIF_glutil.h"
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index 61cb3018424..2148dd289ca 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -23,21 +23,18 @@
* ***** END GPL LICENSE BLOCK *****
*/
-
#include <string.h>
#include <stdio.h>
-
-
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "ED_screen.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index 5c498a59884..cda2aea23fa 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -33,6 +33,7 @@
#include "DNA_actuator_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_main.h"
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index d5450a1369c..b0634ff25c7 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -45,6 +45,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -5038,9 +5039,9 @@ void logic_buttons(bContext *C, ARegion *ar)
else {
set_col_actuator(act->type, 1);
glRecti((short)(xco+22), yco, (short)(xco+width-22),(short)(yco+19));
- but= uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type");
+ /* but= */ uiDefBut(block, LABEL, 0, actuator_name(act->type), (short)(xco+22), yco, 90, UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator type");
// uiButSetFunc(but, old_sca_move_actuator, act, NULL);
- but= uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name");
+ /* but= */ uiDefBut(block, LABEL, 0, act->name, (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act, 0, 0, 0, 0, "Actuator name");
// uiButSetFunc(but, old_sca_move_actuator, act, NULL);
uiBlockBeginAlign(block);
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 9a3cac02c50..a945af502a0 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -34,6 +34,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 8d5b981df1a..8069bf74bce 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -33,6 +33,8 @@
#include "DNA_anim_types.h"
+#include "BLI_utildefines.h"
+
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
@@ -211,7 +213,7 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)
static void nla_panel_animdata (const bContext *C, Panel *pa)
{
PointerRNA adt_ptr;
- AnimData *adt;
+ /* AnimData *adt; */
uiLayout *layout= pa->layout;
uiLayout *row;
uiBlock *block;
@@ -219,7 +221,8 @@ static void nla_panel_animdata (const bContext *C, Panel *pa)
/* check context and also validity of pointer */
if (!nla_panel_context(C, &adt_ptr, NULL, NULL))
return;
- adt= adt_ptr.data;
+
+ /* adt= adt_ptr.data; */
block= uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index cdc51215d85..8f6f5082877 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -35,10 +35,10 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_nla.h"
@@ -173,6 +173,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
case ANIMTYPE_DSARM:
case ANIMTYPE_DSMESH:
case ANIMTYPE_DSTEX:
+ case ANIMTYPE_DSLAT:
case ANIMTYPE_DSLINESTYLE:
{
/* sanity checking... */
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index eebca82b8d1..43a64f07de5 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -37,11 +37,11 @@
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
-
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "BKE_fcurve.h"
#include "BKE_nla.h"
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index e04ef99e6fe..d1417d69ae3 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -38,6 +38,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_fcurve.h"
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 3bff1d4159f..db9255a867b 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -37,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -514,7 +515,7 @@ void ED_spacetype_nla(void)
art->init= nla_main_area_init;
art->draw= nla_main_area_draw;
art->listener= nla_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D/*|ED_KEYMAP_MARKERS*/|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
+ art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_ANIMATION|ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 5ee2b172c7c..85b52312f56 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -33,6 +33,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_node_types.h"
#include "DNA_material_types.h"
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 954018bfd4f..69a6029e140 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -31,20 +31,20 @@
#include <math.h>
#include <float.h>
+#include "MEM_guardedalloc.h"
+
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
-#include "MEM_guardedalloc.h"
-
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_node.h"
#include "BKE_screen.h"
-
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 9019b1815a4..5028d1ca1d7 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -40,6 +40,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_threads.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 7db20966a8b..dc2396f0d15 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -40,6 +40,11 @@
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_storage_types.h"
+#include "BLI_utildefines.h"
+
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
@@ -51,11 +56,6 @@
#include "BKE_texture.h"
#include "BKE_report.h"
-
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_storage_types.h"
-
#include "RE_pipeline.h"
#include "IMB_imbuf_types.h"
@@ -211,6 +211,8 @@ bNode *editnode_get_active(bNodeTree *ntree)
void snode_notify(bContext *C, SpaceNode *snode)
{
+ WM_event_add_notifier(C, NC_NODE|NA_EDITED, NULL);
+
if(snode->treetype==NTREE_SHADER)
WM_event_add_notifier(C, NC_MATERIAL|ND_NODES, snode->id);
else if(snode->treetype==NTREE_COMPOSIT)
@@ -328,6 +330,7 @@ void ED_node_texture_default(Tex *tx)
ntreeSolveOrder(tx->nodetree); /* needed for pointers */
}
+/* id is supposed to contain a node tree */
void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype)
{
bNode *node= NULL;
@@ -345,6 +348,10 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
*ntree= ((Tex*)id)->nodetree;
if(treetype) *treetype= NTREE_TEXTURE;
}
+ else {
+ if(treetype) *treetype= 0;
+ return;
+ }
/* find editable group */
if(edittree) {
@@ -1464,7 +1471,7 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float
/* generics */
if(node) {
node->locx= locx;
- node->locy= locy + 60.0f; // arbitrary.. so its visible
+ node->locy= locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node
node->flag |= SELECT;
gnode= node_tree_get_editgroup(snode->nodetree);
@@ -1515,6 +1522,12 @@ static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */
+ /* to ensure redraws or rerenders happen */
+ for(node= snode->edittree->nodes.first; node; node= node->next)
+ if(node->flag & SELECT)
+ if(node->id)
+ ED_node_changed_update(snode->id, node);
+
ntreeSolveOrder(snode->edittree);
node_tree_verify_groups(snode->nodetree);
snode_notify(C, snode);
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 1ad5954b56e..147a0825229 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -37,13 +37,13 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "BKE_node.h"
#include "BKE_main.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -58,8 +58,22 @@
static void do_node_add(bContext *C, void *UNUSED(arg), int event)
{
SpaceNode *snode= CTX_wm_space_node(C);
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar;
bNode *node;
+ /* get location to add node at mouse */
+ for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ if(ar->regiontype == RGN_TYPE_WINDOW) {
+ wmWindow *win= CTX_wm_window(C);
+ int x= win->eventstate->x - ar->winrct.xmin;
+ int y= win->eventstate->y - ar->winrct.ymin;
+
+ if(y < 60) y+= 60;
+ UI_view2d_region_to_view(&ar->v2d, x, y, &snode->mx, &snode->my);
+ }
+ }
+
/* store selection in temp test flag */
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & NODE_SELECT) node->flag |= NODE_TEST;
@@ -152,20 +166,8 @@ static void node_auto_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclas
static void node_menu_add(const bContext *C, Menu *menu)
{
- uiLayout *layout= menu->layout;
SpaceNode *snode= CTX_wm_space_node(C);
- ScrArea *sa= CTX_wm_area(C);
- ARegion *ar;
-
- /* get location to add node at mouse */
- for(ar=sa->regionbase.first; ar; ar=ar->next) {
- if(ar->regiontype == RGN_TYPE_WINDOW) {
- wmWindow *win= CTX_wm_window(C);
- UI_view2d_region_to_view(&ar->v2d,
- win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin,
- &snode->mx, &snode->my);
- }
- }
+ uiLayout *layout= menu->layout;
if(!snode->nodetree)
uiLayoutSetActive(layout, 0);
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index e07eaa85bed..748ba847f22 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -34,6 +34,7 @@
#include "BKE_context.h"
#include "BLI_rect.h"
+#include "BLI_utildefines.h"
#include "ED_screen.h"
#include "ED_types.h"
@@ -108,13 +109,6 @@ static int node_select_exec(bContext *C, wmOperator *op)
/* perform the select */
node= node_mouse_select(snode, ar, mval, extend);
-
- /* WATCH THIS, there are a few other ways to change the active material */
- if(node) {
- if (node->id && ELEM(GS(node->id->name), ID_MA, ID_TE)) {
- WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, node->id);
- }
- }
/* send notifiers */
WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL);
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index cdb04ec373c..4f2f204fbe6 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -31,11 +31,12 @@
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
+#include "BLI_rect.h"
+#include "BLI_utildefines.h"
+
#include "BKE_context.h"
#include "BKE_node.h"
-#include "BLI_rect.h"
-
#include "ED_screen.h"
#include "RNA_access.h"
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index d38e2af734b..eb8c34fe8bd 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -39,6 +39,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -118,15 +119,15 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
BLI_addtail(&snode->regionbase, ar);
ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.tot.xmin= -10.0f;
- ar->v2d.tot.ymin= -10.0f;
- ar->v2d.tot.xmax= 512.0f;
- ar->v2d.tot.ymax= 512.0f;
+ ar->v2d.tot.xmin= -256.0f;
+ ar->v2d.tot.ymin= -256.0f;
+ ar->v2d.tot.xmax= 768.0f;
+ ar->v2d.tot.ymax= 768.0f;
- ar->v2d.cur.xmin= 0.0f;
- ar->v2d.cur.ymin= 0.0f;
- ar->v2d.cur.xmax= 512.0f;
- ar->v2d.cur.ymax= 512.0f;
+ ar->v2d.cur.xmin= -256.0f;
+ ar->v2d.cur.ymin= -256.0f;
+ ar->v2d.cur.xmax= 768.0f;
+ ar->v2d.cur.ymax= 768.0f;
ar->v2d.min[0]= 1.0f;
ar->v2d.min[1]= 1.0f;
@@ -160,9 +161,9 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
{
/* note, ED_area_tag_refresh will re-execute compositor */
- /* XXX, should edit some to check for the nodeTree type, especially NC_NODE|NA_EDITED which refreshes all types */
SpaceNode *snode= sa->spacedata.first;
-
+ int type= snode->treetype;
+
/* preview renders */
switch(wmn->category) {
case NC_SCENE:
@@ -180,14 +181,18 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
/* future: add ID checks? */
case NC_MATERIAL:
- if(wmn->data==ND_SHADING)
- ED_area_tag_refresh(sa);
- else if(wmn->data==ND_SHADING_DRAW)
- ED_area_tag_refresh(sa);
+ if(type==NTREE_SHADER) {
+ if(wmn->data==ND_SHADING)
+ ED_area_tag_refresh(sa);
+ else if(wmn->data==ND_SHADING_DRAW)
+ ED_area_tag_refresh(sa);
+ }
break;
case NC_TEXTURE:
- if(wmn->data==ND_NODES)
- ED_area_tag_refresh(sa);
+ if(type==NTREE_SHADER || type==NTREE_TEXTURE) {
+ if(wmn->data==ND_NODES)
+ ED_area_tag_refresh(sa);
+ }
break;
case NC_TEXT:
/* pynodes */
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 57d37059da8..fe587bd98d6 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -51,6 +51,7 @@
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#if defined WIN32 && !defined _LIBC
# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
@@ -187,7 +188,7 @@ static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short ty
/* case 1; no TreeStore */
if(soops->treestore==NULL) {
- ts= soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
+ soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
}
ts= soops->treestore;
@@ -1509,6 +1510,42 @@ static void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
/* **************** INTERACTIVE ************* */
+
+static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
+{
+ ARegion *ar= CTX_wm_region(C);
+ int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin;
+ int up= 0;
+
+ if(RNA_boolean_get(op->ptr, "up"))
+ up= 1;
+
+ if(up == 0) dy= -dy;
+ ar->v2d.cur.ymin+= dy;
+ ar->v2d.cur.ymax+= dy;
+
+ ED_region_tag_redraw(ar);
+
+ return OPERATOR_FINISHED;
+}
+
+
+void OUTLINER_OT_scroll_page(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Scroll Page";
+ ot->idname= "OUTLINER_OT_scroll_page";
+ ot->description= "Scroll page up or down";
+
+ /* callbacks */
+ ot->exec= outliner_scroll_page_exec;
+ ot->poll= ED_operator_outliner_active;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page.");
+}
+
+
static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
{
TreeElement *te;
@@ -2496,19 +2533,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
- Object *obedit= CTX_data_edit_object(C);
- if(obedit)
- ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
- else {
- Object *ob= CTX_data_active_object(C);
-
- /* Don't allow edit mode if the object is hide!
- * check the bug #22153 and #21609
- */
- if (ob && (!(ob->restrictflag & OB_RESTRICT_VIEW)))
- ED_object_enter_editmode(C, EM_WAITCURSOR);
- // XXX extern_set_butspace(F9KEY, 0);
- }
+ WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
} else { // rest of types
tree_element_active(C, scene, soops, te, 1);
}
@@ -4144,12 +4169,9 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
if (ksp) {
/* free path's data */
- // TODO: we probably need an API method for this
- if (ksp->rna_path) MEM_freeN(ksp->rna_path);
+ BKE_keyingset_free_path(ks, ksp);
+
ks->active_path= 0;
-
- /* remove path from set */
- BLI_freelinkN(&ks->paths, ksp);
}
}
break;
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 256bf3f936b..cf29bfb4371 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -131,6 +131,8 @@ void OUTLINER_OT_show_hierarchy(struct wmOperatorType *ot);
void OUTLINER_OT_selected_toggle(struct wmOperatorType *ot);
void OUTLINER_OT_expanded_toggle(struct wmOperatorType *ot);
+void OUTLINER_OT_scroll_page(struct wmOperatorType *ot);
+
void OUTLINER_OT_renderability_toggle(struct wmOperatorType *ot);
void OUTLINER_OT_selectability_toggle(struct wmOperatorType *ot);
void OUTLINER_OT_visibility_toggle(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 8b2c288e400..f7dd03ec545 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -56,6 +56,7 @@ void outliner_operatortypes(void)
WM_operatortype_append(OUTLINER_OT_show_one_level);
WM_operatortype_append(OUTLINER_OT_show_active);
WM_operatortype_append(OUTLINER_OT_show_hierarchy);
+ WM_operatortype_append(OUTLINER_OT_scroll_page);
WM_operatortype_append(OUTLINER_OT_selected_toggle);
WM_operatortype_append(OUTLINER_OT_expanded_toggle);
@@ -91,6 +92,9 @@ void outliner_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PERIODKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "OUTLINER_OT_show_active", PADPERIOD, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEDOWNKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_scroll_page", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "up", 1);
+
WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADPLUSKEY, KM_PRESS, 0, 0); /* open */
RNA_boolean_set(WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0)->ptr, "open", 0); /* close */
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 8bb49b85271..74c2dd5db1c 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -29,12 +29,12 @@
#include <string.h>
#include <stdio.h>
-
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 4e65c216cd3..3da5b48db8e 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -29,9 +29,8 @@
#include <string.h>
#include <stdio.h>
-
-
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -47,7 +46,7 @@
#include "script_intern.h" // own include
#ifdef WITH_PYTHON
-#include "BPY_extern.h" /* BPY_run_python_script */
+#include "BPY_extern.h" /* BPY_script_exec */
#endif
static int run_pyfile_exec(bContext *C, wmOperator *op)
@@ -55,7 +54,7 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
char path[512];
RNA_string_get(op->ptr, "filepath", path);
#ifdef WITH_PYTHON
- if(BPY_run_python_script(C, path, NULL, op->reports)) {
+ if(BPY_filepath_exec(C, path, op->reports)) {
ARegion *ar= CTX_wm_region(C);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
@@ -88,7 +87,7 @@ static int script_reload_exec(bContext *C, wmOperator *UNUSED(op))
/* TODO, this crashes on netrender and keying sets, need to look into why
* disable for now unless running in debug mode */
WM_cursor_wait(1);
- BPY_eval_string(C, "__import__('bpy').utils.load_scripts(reload_scripts=True)");
+ BPY_string_exec(C, "__import__('bpy').utils.load_scripts(reload_scripts=True)");
WM_cursor_wait(0);
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
index 1159139eff5..545be69af54 100644
--- a/source/blender/editors/space_script/script_header.c
+++ b/source/blender/editors/space_script/script_header.c
@@ -29,25 +29,22 @@
#include <string.h>
#include <stdio.h>
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
-#include "BLI_blenlib.h"
-#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_screen.h"
#include "ED_types.h"
#include "ED_util.h"
-
-
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "script_intern.h"
-
/* ************************ header area region *********************** */
static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index 57d7bba8e3b..d0631f5651a 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -29,12 +29,12 @@
#include <string.h>
#include <stdio.h>
-
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -148,12 +148,11 @@ static void script_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* data... */
- // BPY_run_python_script(C, "/root/blender-svn/blender25/test.py", NULL);
+ // BPY_script_exec(C, "/root/blender-svn/blender25/test.py", NULL);
#ifdef WITH_PYTHON
if (sscript->script) {
- //BPY_run_python_script_space(scpt->script.filename, NULL);
- BPY_run_script_space_draw(C, sscript);
+ // BPY_run_script_space_draw(C, sscript);
}
#else
(void)sscript;
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index adf1de8a125..eb7ae1d8011 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -40,7 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_storage_types.h"
-
+#include "BLI_utildefines.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index aa0686bc9bb..ee0a5d69113 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -31,14 +31,13 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
-
#include "ED_screen.h"
-
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 3cf747a0779..635e261b26e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -32,6 +32,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "IMB_imbuf_types.h"
@@ -44,7 +45,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_sequencer.h"
-#include "BKE_utildefines.h"
+
#include "BKE_sound.h"
#include "IMB_imbuf.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index eb20ce6ed3c..47dff6face4 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -41,7 +41,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_storage_types.h"
-
+#include "BLI_utildefines.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
@@ -1781,7 +1781,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, FALSE);
- Sequence *seq, *seq_new, *seq_next_iter;
+ Sequence *seq, *seq_new;
Strip *strip_new;
StripElem *se, *se_new;
int start_ofs, cfra, frame_end;
@@ -1793,7 +1793,6 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
if((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
/* remove seq so overlap tests dont conflict,
see seq_free_sequence below for the real free'ing */
- seq_next_iter = seq->next;
BLI_remlink(ed->seqbasep, seq);
/* if(seq->ipo) seq->ipo->id.us--; */
/* XXX, remove fcurve and assign to split image strips */
@@ -1818,7 +1817,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
/* new stripdata */
strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem");
- strncpy(se_new->name, se->name, FILE_MAXFILE-1);
+ BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
calc_sequence(scene, seq_new);
if(step > 1) {
diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c
index f5c8388bf67..b8b34eacdc0 100644
--- a/source/blender/editors/space_sequencer/sequencer_scopes.c
+++ b/source/blender/editors/space_sequencer/sequencer_scopes.c
@@ -26,7 +26,9 @@
#include <math.h>
#include <string.h>
-#include "BKE_utildefines.h"
+#include "BLI_utildefines.h"
+
+
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index a2eefe6ee54..a20d2d7680e 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -35,9 +35,9 @@
#endif
#include <sys/types.h>
-
#include "BLI_blenlib.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 179db47ae12..ed280d765f0 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -36,6 +36,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_path_util.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -518,7 +519,7 @@ void ED_spacetype_sequencer(void)
art->init= sequencer_main_area_init;
art->draw= sequencer_main_area_draw;
art->listener= sequencer_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
+ art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c
index c857d33bcab..60bf0775f5e 100644
--- a/source/blender/editors/space_sound/sound_header.c
+++ b/source/blender/editors/space_sound/sound_header.c
@@ -33,15 +33,15 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
-#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "ED_screen.h"
#include "ED_types.h"
#include "ED_util.h"
-
#include "BIF_gl.h"
#include "BIF_glutil.h"
diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c
index 99b24479967..200f15f6109 100644
--- a/source/blender/editors/space_sound/space_sound.c
+++ b/source/blender/editors/space_sound/space_sound.c
@@ -36,6 +36,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 0acdbfb9ccc..75001b9514c 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -37,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@@ -221,9 +222,21 @@ static void text_keymap(struct wmKeyConfig *keyconf)
#ifdef __APPLE__
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
- RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", RIGHTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", RIGHTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_END);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", PREV_WORD);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", NEXT_WORD);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", UPARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", FILE_TOP);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", DOWNARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", FILE_BOTTOM);
+
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
- RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", LINE_END);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", PREV_WORD);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", NEXT_WORD);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", UPARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", FILE_TOP);
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", DOWNARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", FILE_BOTTOM);
+
+ RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", DEL_PREV_WORD);
+
WM_keymap_add_item(keymap, "TEXT_OT_save", SKEY, KM_PRESS, KM_ALT|KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_save_as", SKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_OSKEY, 0);
WM_keymap_add_item(keymap, "TEXT_OT_cut", XKEY, KM_PRESS, KM_OSKEY, 0);
@@ -317,7 +330,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_PREV_CHAR);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD);
RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_PREV_WORD);
-
+
WM_keymap_add_item(keymap, "TEXT_OT_overwrite_toggle", INSERTKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TEXT_OT_scroll", MIDDLEMOUSE, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 4307945129b..318c64f87a7 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -36,6 +36,7 @@
#include "BLF_api.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "DNA_text_types.h"
#include "DNA_space_types.h"
@@ -45,7 +46,7 @@
#include "BKE_context.h"
#include "BKE_suggestions.h"
#include "BKE_text.h"
-#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
@@ -601,7 +602,6 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
start= 0;
end= max;
chop= 1;
- chars= 0;
*offc= 0;
for(i=0, j=0; linein->line[j]!='\0'; j++) {
@@ -1050,7 +1050,7 @@ static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top)
}
}
} else {
- for(i=st->top, pline= text->lines.first; pline->next && i>0; i--)
+ for(i=st->top; pline->next && i>0; i--)
pline= pline->next;
}
@@ -1059,7 +1059,7 @@ static TextLine *first_visible_line(SpaceText *st, ARegion *ar, int *wrap_top)
/************************ draw scrollbar *****************************/
-static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll)
+static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
{
int lhlstart, lhlend, ltexth, sell_off, curl_off;
short barheight, barstart, hlstart, hlend, blank_lines;
@@ -1072,8 +1072,11 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll)
blank_lines = st->viewlines / 2;
/* nicer code: use scroll rect for entire bar */
- //scroll->xmin= 5;
- //scroll->xmax= 17;
+ back->xmin= ar->winx -18;
+ back->xmax= ar->winx;
+ back->ymin= 0;
+ back->ymax= ar->winy;
+
scroll->xmin= ar->winx - 17;
scroll->xmax= ar->winx - 5;
scroll->ymin= 4;
@@ -1169,13 +1172,16 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll)
CLAMP(st->txtscroll.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
}
-static void draw_textscroll(SpaceText *st, rcti *scroll)
+static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
{
bTheme *btheme= U.themes.first;
uiWidgetColors wcol= btheme->tui.wcol_scroll;
unsigned char col[4];
float rad;
+ UI_ThemeColor(TH_BACK);
+ glRecti(back->xmin, back->ymin, back->xmax, back->ymax);
+
uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT)?UI_SCROLL_PRESSED:0);
uiSetRoundBox(15);
@@ -1278,7 +1284,7 @@ static void draw_documentation(SpaceText *st, ARegion *ar)
{
TextLine *tmp;
char *docs, buf[DOC_WIDTH+1], *p;
- int len, i, br, lines;
+ int i, br, lines;
int boxw, boxh, l, x, y, top;
if(!st || !st->text) return;
@@ -1303,7 +1309,6 @@ static void draw_documentation(SpaceText *st, ARegion *ar)
}
top= y= ar->winy - st->lheight*l - 2;
- len= strlen(docs);
boxw= DOC_WIDTH*st->cwidth + 20;
boxh= (DOC_HEIGHT+1)*st->lheight;
@@ -1673,7 +1678,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
{
Text *text= st->text;
TextLine *tmp;
- rcti scroll;
+ rcti scroll, back;
char linenr[12];
int i, x, y, winx, linecount= 0, lineno= 0;
int wraplinecount= 0, wrap_skip= 0;
@@ -1692,7 +1697,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
else st->viewlines= 0;
/* update rects for scroll */
- calc_text_rcts(st, ar, &scroll); /* scroll will hold the entire bar size */
+ calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */
/* update syntax formatting if needed */
tmp= text->lines.first;
@@ -1780,7 +1785,7 @@ void draw_text_main(SpaceText *st, ARegion *ar)
draw_brackets(st, ar);
draw_markers(st, ar);
glTranslatef(0.375f, 0.375f, 0.0f); /* XXX scroll requires exact pixel space */
- draw_textscroll(st, &scroll);
+ draw_textscroll(st, &scroll, &back);
draw_documentation(st, ar);
draw_suggestion_list(st, ar);
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 8ad4d6fa890..1287f68dc04 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -47,6 +47,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 8dc67ca4774..061a60440f4 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -38,6 +38,8 @@
#include "DNA_userdef_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+
#include "PIL_time.h"
#include "BKE_context.h"
@@ -314,7 +316,7 @@ static int reload_exec(bContext *C, wmOperator *op)
#ifdef WITH_PYTHON
if(text->compiled)
- BPY_free_compiled_text(text);
+ BPY_text_free_code(text);
#endif
text_update_edited(text);
@@ -569,7 +571,7 @@ static int run_script_exec(bContext *C, wmOperator *op)
Text *text= CTX_data_edit_text(C);
SpaceText *st= CTX_wm_space_text(C);
- if (BPY_run_python_script(C, NULL, text, op->reports))
+ if (BPY_text_exec(C, text, op->reports))
return OPERATOR_FINISHED;
/* Dont report error messages while live editing */
@@ -1344,16 +1346,17 @@ static EnumPropertyItem move_type_items[]= {
/* get cursor position in line by relative wrapped line and column positions */
static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int rell, int relc)
{
- int i, j, start, end, chars, max, chop, curs, loop, endj, found, selc;
+ int i, j, start, end, max, chop, curs, loop, endj, found, selc;
char ch;
max= wrap_width(st, ar);
- selc= start= chars= endj= curs= found= 0;
+ selc= start= endj= curs= found= 0;
end= max;
chop= loop= 1;
for(i=0, j=0; loop; j++) {
+ int chars;
/* Mimic replacement of tabs */
ch= linein->line[j];
if(ch=='\t') {
@@ -1509,7 +1512,7 @@ static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
Text *text= st->text;
TextLine **linep;
int *charp;
- int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop;
+ int oldl, oldc, i, j, max, start, end, endj, chop, loop;
char ch;
text_update_character_width(st);
@@ -1522,12 +1525,13 @@ static void wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
max= wrap_width(st, ar);
- start= chars= endj= 0;
+ start= endj= 0;
end= max;
chop= loop= 1;
*charp= 0;
for(i=0, j=0; loop; j++) {
+ int chars;
/* Mimic replacement of tabs */
ch= (*linep)->line[j];
if(ch=='\t') {
@@ -1576,7 +1580,7 @@ static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
Text *text= st->text;
TextLine **linep;
int *charp;
- int oldl, oldc, i, j, max, start, end, chars, endj, chop, loop;
+ int oldl, oldc, i, j, max, start, end, endj, chop, loop;
char ch;
text_update_character_width(st);
@@ -1589,12 +1593,13 @@ static void wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
max= wrap_width(st, ar);
- start= chars= endj= 0;
+ start= endj= 0;
end= max;
chop= loop= 1;
*charp= 0;
for(i=0, j=0; loop; j++) {
+ int chars;
/* Mimic replacement of tabs */
ch= (*linep)->line[j];
if(ch=='\t') {
@@ -2241,7 +2246,7 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
x = (x/st->cwidth) + st->left;
if(st->wordwrap) {
- int i, j, endj, curs, max, chop, start, end, chars, loop, found;
+ int i, j, endj, curs, max, chop, start, end, loop, found;
char ch;
/* Point to first visible line */
@@ -2267,10 +2272,10 @@ static void set_cursor_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
start= 0;
end= max;
chop= 1;
- chars= 0;
curs= 0;
endj= 0;
for(i=0, j=0; loop; j++) {
+ int chars;
/* Mimic replacement of tabs */
ch= (*linep)->line[j];
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 9a1fc201564..4a45b6b6cbb 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -36,6 +36,7 @@
#include "BLI_blenlib.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index edb3da5a06e..5bc59f06a19 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -29,21 +29,18 @@
#include <stdlib.h>
#include <math.h>
-
#include "DNA_scene_types.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
-
#include "ED_screen.h"
-
#include "WM_api.h"
#include "WM_types.h"
-
/* ****************** Start/End Frame Operators *******************************/
static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index a59c03ad17d..6f155fc3b99 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -33,13 +33,13 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_screen.h"
#include "ED_screen.h"
-
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 27cb305f78f..18a83e16ca1 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -43,6 +43,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_dlrbTree.h"
+#include "BLI_utildefines.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
@@ -50,7 +51,7 @@
#include "BKE_global.h"
#include "BKE_modifier.h"
#include "BKE_nla.h"
-#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
#include "BIF_glutil.h"
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index e38e9309611..c6cbfe44df4 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -34,7 +34,7 @@
#include "BLI_math.h"
#include "BLI_edgehash.h"
#include "BLI_editVert.h"
-
+#include "BLI_utildefines.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
@@ -50,7 +50,7 @@
#include "BKE_material.h"
#include "BKE_paint.h"
#include "BKE_property.h"
-#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
#include "BIF_glutil.h"
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 1f1acef02db..17e8b09ad68 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -47,6 +47,7 @@
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_anim.h" //for the where_on_path function
#include "BKE_constraint.h" // for the get_constraint_target function
@@ -67,7 +68,7 @@
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_unit.h"
-#include "BKE_utildefines.h"
+
#include "smoke_API.h"
#include "BIF_gl.h"
@@ -919,11 +920,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
float lampsize;
float imat[4][4], curcol[4];
unsigned char col[4];
- int drawcone= (dt>OB_WIRE && !(G.f & G_PICKSEL) && la->type == LA_SPOT && (la->mode & LA_SHOW_CONE));
-
/* cone can't be drawn for duplicated lamps, because duplilist would be freed to */
/* the moment of view3d_draw_transp() call */
- drawcone&= (base->flag & OB_FROMDUPLI)==0;
+ const short is_view= (rv3d->persp==RV3D_CAMOB && v3d->camera == base->object);
+ const short drawcone= (dt>OB_WIRE && !(G.f & G_PICKSEL) && (la->type == LA_SPOT) && (la->mode & LA_SHOW_CONE) && !(base->flag & OB_FROMDUPLI) && !is_view);
if(drawcone && !v3d->transp) {
/* in this case we need to draw delayed */
@@ -1028,7 +1028,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
glPopMatrix(); /* back in object space */
zero_v3(vec);
- if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
+ if(is_view) {
+ /* skip drawing extra info */
+ }
+ else if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
lvec[0]=lvec[1]= 0.0;
lvec[2] = 1.0;
x = rv3d->persmat[0][2];
@@ -1171,7 +1174,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
setlinestyle(0);
- if(la->type==LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
+ if((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) {
drawshadbuflimits(la, ob->obmat);
}
@@ -3144,7 +3147,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
case OB_CURVE:
cu= ob->data;
- lb= &cu->disp;
+ lb= &ob->disp;
if(solid) {
dl= lb->first;
@@ -3191,7 +3194,7 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
break;
case OB_SURF:
- lb= &((Curve *)ob->data)->disp;
+ lb= &ob->disp;
if(solid) {
dl= lb->first;
@@ -5434,7 +5437,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (dm) {
hasfaces= dm->getNumFaces(dm);
} else {
- hasfaces= displist_has_faces(&cu->disp);
+ hasfaces= displist_has_faces(&ob->disp);
}
if (hasfaces && boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
@@ -5442,7 +5445,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
if (dm) {
draw_mesh_object_outline(v3d, ob, dm);
} else {
- drawDispListwire(&cu->disp);
+ drawDispListwire(&ob->disp);
}
draw_index_wire= 1;
}
@@ -5497,7 +5500,7 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
if (ob->derivedFinal) {
drawCurveDMWired(ob);
} else {
- drawDispListwire(&cu->disp);
+ drawDispListwire(&ob->disp);
}
if (ob->type==OB_CURVE)
@@ -5818,9 +5821,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
/* bad exception, solve this! otherwise outline shows too late */
if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- cu= ob->data;
/* still needed for curves hidden in other layers. depgraph doesnt handle that yet */
- if (cu->disp.first==NULL) makeDispListCurveTypes(scene, ob, 0);
+ if (ob->disp.first==NULL) makeDispListCurveTypes(scene, ob, 0);
}
/* draw outline for selected objects, mesh does itself */
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 89bb0044eaf..0f6e0bdc834 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -31,10 +31,6 @@
#include "MEM_guardedalloc.h"
-
-
-
-
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
@@ -44,6 +40,7 @@
#include "BLI_editVert.h"
#include "BLI_edgehash.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_curve.h"
#include "BKE_constraint.h" // for the get_constraint_target function
@@ -65,7 +62,7 @@
#include "BKE_particle.h"
#include "BKE_property.h"
#include "BKE_smoke.h"
-#include "BKE_utildefines.h"
+
#include "smoke_API.h"
#include "BIF_gl.h"
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 5c54791b2a0..9ec68d62364 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -37,6 +37,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_object.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 85900435112..53a4981661f 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -45,6 +45,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_action.h"
#include "BKE_context.h"
@@ -56,7 +57,6 @@
#include "BKE_screen.h"
#include "BKE_deform.h"
-
#include "WM_api.h"
#include "WM_types.h"
@@ -282,12 +282,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
if(block) { // buttons
uiBut *but;
- int but_y;
- if((ob->parent) && (ob->partype == PARBONE)) but_y = 135;
- else but_y = 150;
-
-
-
+
memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
uiBlockBeginAlign(block);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 29629165661..6afe2791ff9 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -45,6 +45,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_anim.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 8dfbe982ede..35cddda5362 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -41,6 +41,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_image.h"
@@ -52,6 +53,7 @@
#include "BIF_gl.h"
+#include "BIF_glutil.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -60,7 +62,6 @@
#include "RNA_define.h"
#include "ED_particle.h"
-#include "ED_retopo.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_mesh.h"
@@ -324,7 +325,7 @@ static void calctrackballvec(rcti *rect, int mx, int my, float *vec)
static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
{
static float lastofs[3] = {0,0,0};
- View3D *v3d = CTX_wm_view3d(C);
+ View3D *v3d;
RegionView3D *rv3d;
ViewOpsData *vod= MEM_callocN(sizeof(ViewOpsData), "viewops data");
@@ -332,6 +333,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
op->customdata= vod;
vod->sa= CTX_wm_area(C);
vod->ar= CTX_wm_region(C);
+ v3d= vod->sa->spacedata.first;
vod->rv3d= rv3d= vod->ar->regiondata;
vod->dist0= rv3d->dist;
copy_qt_qt(vod->oldquat, rv3d->viewquat);
@@ -404,19 +406,26 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
static void viewops_data_free(bContext *C, wmOperator *op)
{
+ ARegion *ar;
Paint *p = paint_get_active(CTX_data_scene(C));
- ViewOpsData *vod= op->customdata;
- vod->rv3d->rflag &= ~RV3D_NAVIGATING;
+ if(op->customdata) {
+ ViewOpsData *vod= op->customdata;
+ ar= vod->ar;
+ vod->rv3d->rflag &= ~RV3D_NAVIGATING;
- if(p && (p->flags & PAINT_FAST_NAVIGATE))
- ED_region_tag_redraw(vod->ar);
+ if(vod->timer)
+ WM_event_remove_timer(CTX_wm_manager(C), vod->timer->win, vod->timer);
- if(vod->timer)
- WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), vod->timer);
+ MEM_freeN(vod);
+ op->customdata= NULL;
+ }
+ else {
+ ar= CTX_wm_region(C);
+ }
- MEM_freeN(vod);
- op->customdata= NULL;
+ if(p && (p->flags & PAINT_FAST_NAVIGATE))
+ ED_region_tag_redraw(ar);
}
/* ************************** viewrotate **********************************/
@@ -1194,11 +1203,30 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
static int viewzoom_exec(bContext *C, wmOperator *op)
{
- View3D *v3d = CTX_wm_view3d(C);
- RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ View3D *v3d;
+ RegionView3D *rv3d;
+ ScrArea *sa;
+ ARegion *ar;
+
int delta= RNA_int_get(op->ptr, "delta");
- int mx = RNA_int_get(op->ptr, "mx");
- int my = RNA_int_get(op->ptr, "my");
+ int mx, my;
+
+ if(op->customdata) {
+ ViewOpsData *vod= op->customdata;
+
+ sa= vod->sa;
+ ar= vod->ar;
+ }
+ else {
+ sa= CTX_wm_area(C);
+ ar= CTX_wm_region(C);
+ }
+
+ v3d= sa->spacedata.first;
+ rv3d= ar->regiondata;
+
+ mx= RNA_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") : ar->winx / 2;
+ my= RNA_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") : ar->winy / 2;
if(delta < 0) {
/* this min and max is also in viewmove() */
@@ -1207,7 +1235,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
}
else if(rv3d->dist<10.0*v3d->far) {
- view_zoom_mouseloc(CTX_wm_region(C), 1.2f, mx, my);
+ view_zoom_mouseloc(ar, 1.2f, mx, my);
}
}
else {
@@ -1216,16 +1244,16 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
}
else if(rv3d->dist> 0.001*v3d->grid) {
- view_zoom_mouseloc(CTX_wm_region(C), .83333f, mx, my);
+ view_zoom_mouseloc(ar, .83333f, mx, my);
}
}
if(rv3d->viewlock & RV3D_BOXVIEW)
- view3d_boxview_sync(CTX_wm_area(C), CTX_wm_region(C));
+ view3d_boxview_sync(sa, ar);
request_depth_update(rv3d);
- ED_region_tag_redraw(CTX_wm_region(C));
-
+ ED_region_tag_redraw(ar);
+
viewops_data_free(C, op);
return OPERATOR_FINISHED;
@@ -1233,8 +1261,6 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- int delta= RNA_int_get(op->ptr, "delta");
-
/* if one or the other zoom position aren't set, set from event */
if (!RNA_property_is_set(op->ptr, "mx") || !RNA_property_is_set(op->ptr, "my"))
{
@@ -1242,7 +1268,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_int_set(op->ptr, "my", event->y);
}
- if(delta) {
+ if(RNA_property_is_set(op->ptr, "delta")) {
/* makes op->customdata */
viewops_data_create(C, op, event);
viewzoom_exec(C, op);
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 6b600f277f0..1e856ad49f7 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -32,6 +32,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_object.h"
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 0f2f182e951..a481fdb59f6 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -37,6 +37,11 @@
#include "MEM_guardedalloc.h"
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
+
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_effect.h"
@@ -58,11 +63,6 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
-
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-
#include "UI_interface.h"
#include "UI_resources.h"
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 6043db6a02f..cb6eee26df5 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -38,7 +38,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
-
+#include "BLI_utildefines.h"
#include "RNA_access.h"
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index d26137bd115..4bb263d3ed9 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -47,6 +47,7 @@
#include "BLI_editVert.h"
#include "BLI_rand.h"
#include "BLI_linklist.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_paint.h"
@@ -54,6 +55,7 @@
#include "BIF_gl.h"
+#include "BIF_glutil.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -66,7 +68,6 @@
#include "ED_particle.h"
#include "ED_mesh.h"
#include "ED_object.h"
-#include "ED_retopo.h"
#include "ED_screen.h"
#include "ED_mball.h"
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 64aa21d6ad8..e90998da21c 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -43,6 +43,7 @@
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_linklist.h"
+#include "BLI_utildefines.h"
#include "BKE_armature.h"
#include "BKE_context.h"
@@ -87,7 +88,7 @@ static void special_transvert_update(Object *obedit)
if(obedit) {
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
if(obedit->type==OB_MESH) {
Mesh *me= obedit->data;
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index c87eecb4220..730cc553ff3 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_idprop.h"
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index c63bb7919a6..a259e29e9a0 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -36,6 +36,7 @@
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
#include "BKE_anim.h"
#include "BKE_action.h"
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index e7f02de2645..d17de267cf7 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -89,11 +89,11 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BLI_linklist.h"
-
#include "UI_resources.h"
//#include "blendef.h"
@@ -604,20 +604,22 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case TFM_MODAL_ROTATE:
/* only switch when... */
- if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
-
- resetTransRestrictions(t);
-
- if (t->mode == TFM_ROTATION) {
- restoreTransObjects(t);
- initTrackball(t);
- }
- else {
- restoreTransObjects(t);
- initRotation(t);
+ if(!(t->options & CTX_TEXTURE)) {
+ if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
+
+ resetTransRestrictions(t);
+
+ if (t->mode == TFM_ROTATION) {
+ restoreTransObjects(t);
+ initTrackball(t);
+ }
+ else {
+ restoreTransObjects(t);
+ initRotation(t);
+ }
+ initSnapping(t, NULL); // need to reinit after mode change
+ t->redraw |= TREDRAW_HARD;
}
- initSnapping(t, NULL); // need to reinit after mode change
- t->redraw |= TREDRAW_HARD;
}
break;
case TFM_MODAL_RESIZE:
@@ -736,6 +738,8 @@ int transformEvent(TransInfo *t, wmEvent *event)
case TFM_MODAL_PROPSIZE_UP:
if(t->flag & T_PROP_EDIT) {
t->prop_size*= 1.1f;
+ if(t->spacetype==SPACE_VIEW3D)
+ t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
calculatePropRatio(t);
}
t->redraw |= TREDRAW_HARD;
@@ -855,20 +859,22 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case RKEY:
/* only switch when... */
- if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
+ if(!(t->options & CTX_TEXTURE)) {
+ if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
- resetTransRestrictions(t);
+ resetTransRestrictions(t);
- if (t->mode == TFM_ROTATION) {
- restoreTransObjects(t);
- initTrackball(t);
- }
- else {
- restoreTransObjects(t);
- initRotation(t);
+ if (t->mode == TFM_ROTATION) {
+ restoreTransObjects(t);
+ initTrackball(t);
+ }
+ else {
+ restoreTransObjects(t);
+ initRotation(t);
+ }
+ initSnapping(t, NULL); // need to reinit after mode change
+ t->redraw |= TREDRAW_HARD;
}
- initSnapping(t, NULL); // need to reinit after mode change
- t->redraw |= TREDRAW_HARD;
}
break;
case CKEY:
@@ -972,6 +978,8 @@ int transformEvent(TransInfo *t, wmEvent *event)
case PADPLUSKEY:
if(event->alt && t->flag & T_PROP_EDIT) {
t->prop_size *= 1.1f;
+ if(t->spacetype==SPACE_VIEW3D)
+ t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
calculatePropRatio(t);
}
t->redraw= 1;
@@ -1496,6 +1504,10 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
t->state = TRANS_STARTING;
+ if(RNA_struct_find_property(op->ptr, "texture_space"))
+ if(RNA_boolean_get(op->ptr, "texture_space"))
+ options |= CTX_TEXTURE;
+
t->options = options;
t->mode = mode;
@@ -2536,6 +2548,9 @@ static void headerResize(TransInfo *t, float vec[3], char *str) {
else
sprintf(str, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
}
+
+ if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
+ sprintf(str, "%s Proportional size: %.2f", str, t->prop_size);
}
#define SIGN(a) (a<-FLT_EPSILON?1:a>FLT_EPSILON?2:3)
@@ -3159,6 +3174,9 @@ int Rotation(TransInfo *t, short UNUSED(mval[2]))
sprintf(str, "Rot: %.2f%s %s", 180.0*final/M_PI, t->con.text, t->proptext);
}
+ if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
+ sprintf(str, "%s Proportional size: %.2f", str, t->prop_size);
+
t->values[0] = final;
applyRotation(t, final, t->axis);
@@ -3380,6 +3398,9 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) {
else
sprintf(str, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
}
+
+ if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
+ sprintf(str, "%s Proportional size: %.2f", str, t->prop_size);
}
static void applyTranslation(TransInfo *t, float vec[3]) {
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 32792754434..d5700db8c57 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -49,12 +49,13 @@
#include "BIF_glutil.h"
#include "BKE_context.h"
-#include "BKE_utildefines.h"
+
#include "ED_image.h"
#include "ED_view3d.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
//#include "blendef.h"
//
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index df267254d8f..75458335b05 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -89,6 +89,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "RNA_access.h"
@@ -268,6 +269,7 @@ static void createTransTexspace(TransInfo *t)
invert_m3_m3(td->smtx, td->mtx);
if (give_obdata_texspace(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) {
+ ob->dtx |= OB_TEXSPACE;
*texflag &= ~AUTOSPACE;
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 83b85ce257c..11fd02b340e 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -87,7 +87,7 @@
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_rand.h"
-
+#include "BLI_utildefines.h"
#include "WM_types.h"
#include "WM_api.h"
@@ -616,7 +616,7 @@ void recalcData(TransInfo *t)
if(sima->flag & SI_LIVE_UNWRAP)
ED_uvedit_live_unwrap_re_solve();
- DAG_id_tag_update(t->obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(t->obedit->data, 0);
}
}
else if (t->spacetype == SPACE_VIEW3D) {
@@ -632,7 +632,7 @@ void recalcData(TransInfo *t)
applyProject(t);
}
- DAG_id_tag_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
if (t->state == TRANS_CANCEL) {
while(nu) {
@@ -655,7 +655,7 @@ void recalcData(TransInfo *t)
applyProject(t);
}
- DAG_id_tag_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
}
@@ -669,7 +669,7 @@ void recalcData(TransInfo *t)
if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
editmesh_apply_to_mirror(t);
- DAG_id_tag_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
recalc_editnormals(em);
}
@@ -760,7 +760,7 @@ void recalcData(TransInfo *t)
if(t->state != TRANS_CANCEL) {
applyProject(t);
}
- DAG_id_tag_update(t->obedit->data, OB_RECALC_DATA); /* sets recalc flags */
+ DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
}
}
else if( (t->flag & T_POSE) && t->poseobj) {
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index ce0888b6a30..a06e5ab21e6 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -28,6 +28,7 @@
#include "DNA_screen_types.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "WM_types.h"
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index ca106c0e88a..b4fe38b41ac 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -59,6 +59,7 @@
#include "BLI_math.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "BIF_gl.h"
diff --git a/source/blender/editors/transform/transform_ndofinput.c b/source/blender/editors/transform/transform_ndofinput.c
index 1ff16dd5f5f..ae12daa29ad 100644
--- a/source/blender/editors/transform/transform_ndofinput.c
+++ b/source/blender/editors/transform/transform_ndofinput.c
@@ -27,9 +27,10 @@
#include <math.h> /* fabs */
#include <stdio.h> /* for sprintf */
-#include "BKE_global.h" /* for G */
-#include "BKE_utildefines.h" /* ABS */
+#include "BLI_utildefines.h"
+#include "BKE_global.h" /* for G */
+ /* ABS */
#include "WM_types.h"
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 322bb7cb7db..55699a345c2 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -31,6 +31,7 @@
#include "RNA_enum_types.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -319,7 +320,10 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
TransInfo *t = op->customdata;
+ /* XXX insert keys are called here, and require context */
+ t->context= C;
exit_code = transformEvent(t, event);
+ t->context= NULL;
transformApply(C, t);
@@ -444,6 +448,11 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
}
}
}
+
+ if (flags & P_OPTIONS)
+ {
+ RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
+ }
// Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
@@ -467,7 +476,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
- Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
+ Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP|P_OPTIONS);
}
void TRANSFORM_OT_resize(struct wmOperatorType *ot)
@@ -487,7 +496,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot)
RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
- Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP);
+ Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS);
}
@@ -854,6 +863,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap");
km = WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+
+ km = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(km->ptr, "texture_space", 1);
+
+ km = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+ RNA_boolean_set(km->ptr, "texture_space", 1);
+
break;
case SPACE_ACTION:
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 5cd57147a1f..45c8a60f4e4 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -34,7 +34,7 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
-#include "BKE_utildefines.h"
+
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_report.h"
@@ -42,6 +42,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
//#include "BIF_editmesh.h"
//#include "BIF_interface.h"
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 0828ceeaa52..3eae81d52f1 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -48,6 +48,7 @@
#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
//#include "BDR_drawobject.h"
//
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 0b5c563a741..a2e0525cb0e 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -62,7 +62,6 @@ set(SRC
../include/ED_particle.h
../include/ED_physics.h
../include/ED_render.h
- ../include/ED_retopo.h
../include/ED_screen.h
../include/ED_screen_types.h
../include/ED_sculpt.h
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 6b0d5b7f172..cff30f12369 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -37,15 +37,15 @@
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
-#include "BKE_utildefines.h"
-#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_global.h"
+
#include "ED_mesh.h"
#include "UI_interface.h"
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 868aa8ac6af..ccdbe7dfd4e 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -30,6 +30,7 @@
#include <math.h> /* fabs */
#include <stdio.h> /* for sprintf */
+#include "BLI_utildefines.h"
#include "WM_types.h"
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 0165cf5a03d..60f526b940a 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -36,15 +36,15 @@
#include "DNA_object_types.h"
-#include "BKE_blender.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_screen.h"
-
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
#include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
+#include "BKE_blender.h"
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_screen.h"
#include "ED_armature.h"
#include "ED_particle.h"
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 209b1d7e066..fc217411386 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -35,12 +35,13 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "BLI_math.h"
+#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
+
#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
-#include "BKE_utildefines.h"
-#include "BLI_math.h"
-#include "BLI_editVert.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 4ae7ae85eff..033cfdc2912 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -40,6 +40,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
@@ -135,7 +136,7 @@ void ED_uvedit_assign_image(Scene *scene, Object *obedit, Image *ima, Image *pre
/* and update depdency graph */
if(update)
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
BKE_mesh_end_editmesh(obedit->data, em);
}
@@ -168,7 +169,7 @@ static int uvedit_set_tile(Object *obedit, Image *ima, int curtile)
tf->tile= curtile; /* set tile index */
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
BKE_mesh_end_editmesh(obedit->data, em);
return 1;
@@ -1018,7 +1019,7 @@ static void weld_align_uv(bContext *C, int tool)
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1241,7 +1242,7 @@ static int stitch_exec(bContext *C, wmOperator *op)
MEM_freeN(uv_average);
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1702,7 +1703,7 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1854,7 +1855,7 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
select_linked(scene, ima, em, limit, hit_p, extend);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1943,7 +1944,7 @@ static int unlink_selection_exec(bContext *C, wmOperator *op)
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -2624,7 +2625,7 @@ static int snap_selection_exec(bContext *C, wmOperator *op)
if(!change)
return OPERATOR_CANCELLED;
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 259b7a95492..f812de692e2 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -6,8 +6,9 @@
#include "BLI_rand.h"
#include "BLI_heap.h"
#include "BLI_boxpack2d.h"
+#include "BLI_utildefines.h"
+
-#include "BKE_utildefines.h"
#include "ONL_opennl.h"
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 5136c50a16b..6f123200dd3 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -38,17 +38,18 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "BLI_math.h"
+#include "BLI_edgehash.h"
+#include "BLI_editVert.h"
+#include "BLI_uvproject.h"
+#include "BLI_utildefines.h"
+
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_image.h"
#include "BKE_mesh.h"
-#include "BLI_math.h"
-#include "BLI_edgehash.h"
-#include "BLI_editVert.h"
-#include "BLI_uvproject.h"
-
#include "PIL_time.h"
#include "ED_image.h"
@@ -286,7 +287,7 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact
ms->lasttime = PIL_check_seconds_timer();
- DAG_id_tag_update(ms->obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(ms->obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ms->obedit->data);
}
}
@@ -309,7 +310,7 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, int cancel)
param_stretch_end(ms->handle);
param_delete(ms->handle);
- DAG_id_tag_update(ms->obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(ms->obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ms->obedit->data);
MEM_freeN(ms);
@@ -437,7 +438,7 @@ static int pack_islands_exec(bContext *C, wmOperator *UNUSED(op))
param_flush(handle);
param_delete(handle);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -470,7 +471,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
param_flush(handle);
param_delete(handle);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -496,7 +497,7 @@ static ParamHandle *liveHandle = NULL;
void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
{
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
- short abf = scene->toolsettings->unwrapper == 1;
+ short abf = scene->toolsettings->unwrapper == 0;
short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
if(!ED_uvedit_test(obedit)) {
@@ -822,6 +823,9 @@ static int unwrap_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ /* remember last method for live unwrap */
+ scene->toolsettings->unwrapper = method;
+
handle= construct_param_handle(scene, em, 0, fill_holes, 1, correct_aspect);
param_lscm_begin(handle, PARAM_FALSE, method == 0);
@@ -834,7 +838,7 @@ static int unwrap_exec(bContext *C, wmOperator *op)
param_delete(handle);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -940,7 +944,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(em, op);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1007,7 +1011,7 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
}
}
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1095,7 +1099,7 @@ static int sphere_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(em, op);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1167,7 +1171,7 @@ static int cylinder_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(em, op);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);
@@ -1254,7 +1258,7 @@ static int cube_project_exec(bContext *C, wmOperator *op)
uv_map_clip_correct(em, op);
- DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+ DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
BKE_mesh_end_editmesh(obedit->data, em);