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-02-14 02:47:30 +0300
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-02-14 02:47:30 +0300
commit3789c398ff2b2fd7f0eadba45686b0e235186f4a (patch)
treeafe1f241f03d17de7df10a414516f03c277518a1 /source/blender/editors
parent5ed1597e2672cc0e59f8a1ca7c54ae3ad9206b8c (diff)
parent4ca2905ead92f23b1aca7bdbcc23c605dd830a87 (diff)
Merged changes in the trunk up to revision 34828.
Conflicts resolved: source/blender/makesrna/RNA_enum_types.h
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c14
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c414
-rw-r--r--source/blender/editors/animation/anim_draw.c4
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/animation/anim_ipo_utils.c4
-rw-r--r--source/blender/editors/animation/anim_markers.c54
-rw-r--r--source/blender/editors/animation/anim_ops.c9
-rw-r--r--source/blender/editors/animation/drivers.c15
-rw-r--r--source/blender/editors/animation/keyframing.c50
-rw-r--r--source/blender/editors/animation/keyingsets.c4
-rw-r--r--source/blender/editors/armature/editarmature.c35
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c10
-rw-r--r--source/blender/editors/armature/poselib.c184
-rw-r--r--source/blender/editors/armature/reeb.c2
-rw-r--r--source/blender/editors/curve/editcurve.c36
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c2
-rw-r--r--source/blender/editors/include/ED_mesh.h5
-rw-r--r--source/blender/editors/include/ED_types.h4
-rw-r--r--source/blender/editors/include/ED_util.h12
-rw-r--r--source/blender/editors/include/UI_interface.h4
-rw-r--r--source/blender/editors/interface/interface.c26
-rw-r--r--source/blender/editors/interface/interface_draw.c15
-rw-r--r--source/blender/editors/interface/interface_handlers.c50
-rw-r--r--source/blender/editors/interface/interface_icons.c4
-rw-r--r--source/blender/editors/interface/interface_intern.h4
-rw-r--r--source/blender/editors/interface/interface_layout.c5
-rw-r--r--source/blender/editors/interface/interface_ops.c12
-rw-r--r--source/blender/editors/interface/interface_panel.c12
-rw-r--r--source/blender/editors/interface/interface_regions.c13
-rw-r--r--source/blender/editors/interface/interface_templates.c4
-rw-r--r--source/blender/editors/interface/interface_widgets.c6
-rw-r--r--source/blender/editors/interface/resources.c6
-rw-r--r--source/blender/editors/interface/view2d_ops.c22
-rw-r--r--source/blender/editors/mesh/editmesh.c20
-rw-r--r--source/blender/editors/mesh/editmesh_loop.c5
-rw-r--r--source/blender/editors/mesh/editmesh_mods.c1
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c22
-rw-r--r--source/blender/editors/mesh/mesh_data.c69
-rw-r--r--source/blender/editors/object/object_add.c11
-rw-r--r--source/blender/editors/object/object_constraint.c33
-rw-r--r--source/blender/editors/object/object_edit.c12
-rw-r--r--source/blender/editors/object/object_relations.c5
-rw-r--r--source/blender/editors/object/object_transform.c18
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/physics_fluid.c39
-rw-r--r--source/blender/editors/render/render_internal.c17
-rw-r--r--source/blender/editors/render/render_shading.c11
-rw-r--r--source/blender/editors/screen/area.c32
-rw-r--r--source/blender/editors/screen/glutil.c2
-rw-r--r--source/blender/editors/screen/screen_intern.h2
-rw-r--r--source/blender/editors/screen/screen_ops.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c70
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c4
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c28
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c30
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c1
-rw-r--r--source/blender/editors/space_console/console_draw.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c12
-rw-r--r--source/blender/editors/space_file/filelist.c6
-rw-r--r--source/blender/editors/space_file/filesel.c4
-rw-r--r--source/blender/editors/space_graph/graph_draw.c38
-rw-r--r--source/blender/editors/space_image/image_draw.c22
-rw-r--r--source/blender/editors/space_info/info_report.c3
-rw-r--r--source/blender/editors/space_info/info_stats.c4
-rw-r--r--source/blender/editors/space_logic/logic_window.c31
-rw-r--r--source/blender/editors/space_node/drawnode.c15
-rw-r--r--source/blender/editors/space_node/node_draw.c51
-rw-r--r--source/blender/editors/space_node/node_edit.c85
-rw-r--r--source/blender/editors/space_node/node_intern.h5
-rw-r--r--source/blender/editors/space_node/node_ops.c3
-rw-r--r--source/blender/editors/space_node/space_node.c26
-rw-r--r--source/blender/editors/space_outliner/outliner.c14
-rw-r--r--source/blender/editors/space_script/script_header.c6
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c3
-rw-r--r--source/blender/editors/space_text/text_draw.c8
-rw-r--r--source/blender/editors/space_text/text_intern.h8
-rw-r--r--source/blender/editors/space_text/text_ops.c35
-rw-r--r--source/blender/editors/space_text/text_python.c2
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c19
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/editors/transform/transform.c42
-rw-r--r--source/blender/editors/transform/transform_conversions.c152
-rw-r--r--source/blender/editors/transform/transform_snap.c6
-rw-r--r--source/blender/editors/util/CMakeLists.txt1
-rw-r--r--source/blender/editors/util/crazyspace.c394
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c2
97 files changed, 1517 insertions, 1021 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 14babe7ce00..e59acacdcf0 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -465,7 +465,7 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *typ
else {
/* can't return anything useful - unsupported */
*type= 0;
- return 0;
+ return NULL;
}
}
@@ -566,7 +566,7 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type)
return NULL;
default: /* unsupported */
- return 0;
+ return NULL;
}
}
@@ -710,7 +710,7 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type
return NULL;
default: /* unsupported */
- return 0;
+ return NULL;
}
}
@@ -991,13 +991,13 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty
GET_ACF_FLAG_PTR(adt->flag);
}
else
- return 0;
+ return NULL;
case ACHANNEL_SETTING_EXPAND: /* expanded */
GET_ACF_FLAG_PTR(act->flag);
default: /* unsupported */
- return 0;
+ return NULL;
}
}
@@ -1075,7 +1075,7 @@ static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short
GET_ACF_FLAG_PTR(adt->flag);
default: /* unsupported */
- return 0;
+ return NULL;
}
}
@@ -2641,7 +2641,7 @@ static bAnimChannelType *animchannelTypeInfo[ANIMTYPE_NUM_TYPES];
static short ACF_INIT= 1; /* when non-zero, the list needs to be updated */
/* Initialise type info definitions */
-void ANIM_init_channel_typeinfo_data (void)
+static void ANIM_init_channel_typeinfo_data (void)
{
int type= 0;
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index a4de5923715..338873c2a80 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -529,7 +529,7 @@ void ANIM_fcurve_delete_from_animdata (bAnimContext *ac, AnimData *adt, FCurve *
/* ****************** Operator Utilities ********************************** */
/* poll callback for being in an Animation Editor channels list region */
-int animedit_poll_channels_active (bContext *C)
+static int animedit_poll_channels_active (bContext *C)
{
ScrArea *sa= CTX_wm_area(C);
@@ -545,7 +545,7 @@ int animedit_poll_channels_active (bContext *C)
}
/* poll callback for Animation Editor channels list region + not in NLA-tweakmode for NLA */
-int animedit_poll_channels_nla_tweakmode_off (bContext *C)
+static int animedit_poll_channels_nla_tweakmode_off (bContext *C)
{
ScrArea *sa= CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
@@ -579,7 +579,7 @@ enum {
};
/* defines for rearranging channels */
-EnumPropertyItem prop_animchannel_rearrange_types[] = {
+static EnumPropertyItem prop_animchannel_rearrange_types[] = {
{REARRANGE_ANIMCHAN_TOP, "TOP", 0, "To Top", ""},
{REARRANGE_ANIMCHAN_UP, "UP", 0, "Up", ""},
{REARRANGE_ANIMCHAN_DOWN, "DOWN", 0, "Down", ""},
@@ -587,57 +587,46 @@ EnumPropertyItem prop_animchannel_rearrange_types[] = {
{0, NULL, 0, NULL, NULL}
};
-/* Rearrange Utilities --------------------------------------------- */
+/* Reordering "Islands" Defines ----------------------------------- */
-/* checks if a channel should be considered for moving */
-static short rearrange_animchannel_is_ok (Link *channel, short type)
-{
- if (type == ANIMTYPE_GROUP) {
- bActionGroup *agrp= (bActionGroup *)channel;
-
- if (SEL_AGRP(agrp) && !(agrp->flag & AGRP_MOVED))
- return 1;
- }
- else if (type == ANIMTYPE_FCURVE) {
- FCurve *fcu= (FCurve *)channel;
-
- // FIXME: F-Curve visibility is difficult... needs special filtering tests these days...
- if (SEL_FCU(fcu) && !(fcu->flag & FCURVE_TAGGED))
- return 1;
- }
- else if (type == ANIMTYPE_NLATRACK) {
- NlaTrack *nlt = (NlaTrack *)channel;
-
- if (SEL_NLT(nlt) && !(nlt->flag & NLASTRIP_FLAG_EDIT_TOUCHED))
- return 1;
- }
+/* Island definition - just a listbase container */
+typedef struct tReorderChannelIsland {
+ struct tReorderChannelIsland *next, *prev;
- return 0;
-}
+ ListBase channels; /* channels within this region with the same state */
+ int flag; /* eReorderIslandFlag */
+} tReorderChannelIsland;
+
+/* flags for channel reordering islands */
+typedef enum eReorderIslandFlag {
+ REORDER_ISLAND_SELECTED = (1<<0), /* island is selected */
+ REORDER_ISLAND_UNTOUCHABLE = (1<<1), /* island should be ignored */
+ REORDER_ISLAND_MOVED = (1<<2) /* island has already been moved */
+} eReorderIslandFlag;
+
-/* checks if another channel can be placed after the given one */
-static short rearrange_animchannel_after_ok (Link *channel, short type)
+/* Rearrange Methods --------------------------------------------- */
+
+static short rearrange_island_ok (tReorderChannelIsland *island)
{
- if (type == ANIMTYPE_GROUP) {
- bActionGroup *agrp= (bActionGroup *)channel;
-
- if (agrp->flag & AGRP_TEMP)
- return 0;
- }
+ /* island must not be untouchable */
+ if (island->flag & REORDER_ISLAND_UNTOUCHABLE)
+ return 0;
- return 1;
+ /* island should be selected to be moved */
+ return (island->flag & REORDER_ISLAND_SELECTED) && !(island->flag & REORDER_ISLAND_MOVED);
}
-/* Rearrange Methods --------------------------------------------- */
+/* ............................. */
-static short rearrange_animchannel_top (ListBase *list, Link *channel, short type)
+static short rearrange_island_top (ListBase *list, tReorderChannelIsland *island)
{
- if (rearrange_animchannel_is_ok(channel, type)) {
- /* take it out off the chain keep data */
- BLI_remlink(list, channel);
+ if (rearrange_island_ok(island)) {
+ /* remove from current position */
+ BLI_remlink(list, island);
/* make it first element */
- BLI_insertlinkbefore(list, list->first, channel);
+ BLI_insertlinkbefore(list, list->first, island);
return 1;
}
@@ -645,17 +634,18 @@ static short rearrange_animchannel_top (ListBase *list, Link *channel, short typ
return 0;
}
-static short rearrange_animchannel_up (ListBase *list, Link *channel, short type)
+static short rearrange_island_up (ListBase *list, tReorderChannelIsland *island)
{
- if (rearrange_animchannel_is_ok(channel, type)) {
- Link *prev= channel->prev;
+ if (rearrange_island_ok(island)) {
+ /* moving up = moving before the previous island, otherwise we're in the same place */
+ tReorderChannelIsland *prev= island->prev;
if (prev) {
- /* take it out off the chain keep data */
- BLI_remlink(list, channel);
+ /* remove from current position */
+ BLI_remlink(list, island);
/* push it up */
- BLI_insertlinkbefore(list, prev, channel);
+ BLI_insertlinkbefore(list, prev, island);
return 1;
}
@@ -664,110 +654,200 @@ static short rearrange_animchannel_up (ListBase *list, Link *channel, short type
return 0;
}
-static short rearrange_animchannel_down (ListBase *list, Link *channel, short type)
+static short rearrange_island_down (ListBase *list, tReorderChannelIsland *island)
{
- if (rearrange_animchannel_is_ok(channel, type)) {
- Link *next = (channel->next) ? channel->next->next : NULL;
+ if (rearrange_island_ok(island)) {
+ /* moving down = moving after the next island, otherwise we're in the same place */
+ tReorderChannelIsland *next = island->next;
if (next) {
- /* take it out off the chain keep data */
- BLI_remlink(list, channel);
-
- /* move it down */
- BLI_insertlinkbefore(list, next, channel);
-
- return 1;
- }
- else if (rearrange_animchannel_after_ok(list->last, type)) {
- /* take it out off the chain keep data */
- BLI_remlink(list, channel);
-
- /* add at end */
- BLI_addtail(list, channel);
-
- return 1;
- }
- else {
- /* take it out off the chain keep data */
- BLI_remlink(list, channel);
-
- /* add just before end */
- BLI_insertlinkbefore(list, list->last, channel);
-
- return 1;
+ /* can only move past if next is not untouchable (i.e. nothing can go after it) */
+ if ((next->flag & REORDER_ISLAND_UNTOUCHABLE)==0) {
+ /* remove from current position */
+ BLI_remlink(list, island);
+
+ /* push it down */
+ BLI_insertlinkafter(list, next, island);
+
+ return 1;
+ }
}
+ /* else: no next channel, so we're at the bottom already, so can't move */
}
return 0;
}
-static short rearrange_animchannel_bottom (ListBase *list, Link *channel, short type)
+static short rearrange_island_bottom (ListBase *list, tReorderChannelIsland *island)
{
- if (rearrange_animchannel_is_ok(channel, type)) {
- if (rearrange_animchannel_after_ok(list->last, type)) {
- /* take it out off the chain keep data */
- BLI_remlink(list, channel);
-
- /* add at end */
- BLI_addtail(list, channel);
+ if (rearrange_island_ok(island)) {
+ tReorderChannelIsland *last = list->last;
+
+ /* remove island from current position */
+ BLI_remlink(list, island);
+
+ /* add before or after the last channel? */
+ if ((last->flag & REORDER_ISLAND_UNTOUCHABLE)==0) {
+ /* can add after it */
+ BLI_addtail(list, island);
+ }
+ else {
+ /* can at most go just before it, since last cannot be moved */
+ BLI_insertlinkbefore(list, last, island);
- return 1;
}
+
+ return 1;
}
return 0;
}
-/* Generic Stuff ---------------------------------------------------------- */
+/* ............................. */
/* typedef for channel rearranging function
* < list: list that channels belong to
- * < channel: channel to be moved
- * < type: type of channel (eAnim_ChannelType)
+ * < island: island to be moved
* > return[0]: whether operation was a success
*/
-typedef short (*AnimChanRearrangeFp)(ListBase *list, Link *channel, short type);
+typedef short (*AnimChanRearrangeFp)(ListBase *list, tReorderChannelIsland *island);
/* get rearranging function, given 'rearrange' mode */
static AnimChanRearrangeFp rearrange_get_mode_func (short mode)
{
switch (mode) {
case REARRANGE_ANIMCHAN_TOP:
- return rearrange_animchannel_top;
+ return rearrange_island_top;
case REARRANGE_ANIMCHAN_UP:
- return rearrange_animchannel_up;
+ return rearrange_island_up;
case REARRANGE_ANIMCHAN_DOWN:
- return rearrange_animchannel_down;
+ return rearrange_island_down;
case REARRANGE_ANIMCHAN_BOTTOM:
- return rearrange_animchannel_bottom;
+ return rearrange_island_bottom;
default:
return NULL;
}
}
-/* ........ */
-
-/* These iteration helpers (ideally should be inlined, but probably not necessary) */
+/* Rearrange Islands Generics ------------------------------------- */
-static Link *rearrange_iter_first (ListBase *list, short mode)
+/* add channel into list of islands */
+static void rearrange_animchannel_add_to_islands (ListBase *islands, ListBase *srcList, Link *channel, short type)
{
- return (mode > 0) ? list->first : list->last;
+ tReorderChannelIsland *island = islands->last; /* always try to add to last island if possible */
+ short is_sel=0, is_untouchable=0;
+
+ /* get flags - selected and untouchable from the channel */
+ switch (type) {
+ case ANIMTYPE_GROUP:
+ {
+ bActionGroup *agrp= (bActionGroup *)channel;
+
+ is_sel= SEL_AGRP(agrp);
+ is_untouchable= (agrp->flag & AGRP_TEMP) != 0;
+ }
+ break;
+ case ANIMTYPE_FCURVE:
+ {
+ FCurve *fcu= (FCurve *)channel;
+
+ is_sel= SEL_FCU(fcu);
+ }
+ break;
+ case ANIMTYPE_NLATRACK:
+ {
+ NlaTrack *nlt= (NlaTrack *)channel;
+
+ is_sel= SEL_NLT(nlt);
+ }
+ break;
+
+ default:
+ printf("rearrange_animchannel_add_to_islands(): don't know how to handle channels of type %d\n", type);
+ return;
+ }
+
+ /* do we need to add to a new island? */
+ if ((island == NULL) || /* 1) no islands yet */
+ ((island->flag & REORDER_ISLAND_SELECTED) == 0) || /* 2) unselected islands have single channels only - to allow up/down movement */
+ (is_sel == 0)) /* 3) if channel is unselected, stop existing island (it was either wrong sel status, or full already) */
+ {
+ /* create a new island now */
+ island = MEM_callocN(sizeof(tReorderChannelIsland), "tReorderChannelIsland");
+ BLI_addtail(islands, island);
+
+ if (is_sel)
+ island->flag |= REORDER_ISLAND_SELECTED;
+ if (is_untouchable)
+ island->flag |= REORDER_ISLAND_UNTOUCHABLE;
+ }
+
+ /* add channel to island - need to remove it from its existing list first though */
+ BLI_remlink(srcList, channel);
+ BLI_addtail(&island->channels, channel);
}
-static Link *rearrange_iter_next (Link *item, short mode)
+/* flatten islands out into a single list again */
+static void rearrange_animchannel_flatten_islands (ListBase *islands, ListBase *srcList)
{
- return (mode > 0) ? item->next : item->prev;
+ tReorderChannelIsland *island, *isn=NULL;
+
+ /* make sure srcList is empty now */
+ BLI_assert(srcList->first == NULL);
+
+ /* go through merging islands */
+ for (island = islands->first; island; island = isn) {
+ isn = island->next;
+
+ /* merge island channels back to main list, then delete the island */
+ BLI_movelisttolist(srcList, &island->channels);
+ BLI_freelinkN(islands, island);
+ }
}
-/* ........ */
+/* ............................. */
-/* Clear 'tag' on all F-Curves */
-static void rearrange_clear_fcurve_tags (ListBase *list)
+/* performing rearranging of channels using islands */
+static short rearrange_animchannel_islands (ListBase *list, AnimChanRearrangeFp rearrange_func, short mode, short type)
{
- FCurve *fcu;
+ ListBase islands = {NULL, NULL};
+ Link *channel, *chanNext=NULL;
+ short done = 0;
- for (fcu = list->first; fcu; fcu = fcu->next)
- fcu->flag &= ~FCURVE_TAGGED;
+ /* don't waste effort on an empty list */
+ if (list->first == NULL)
+ return 0;
+
+ /* group channels into islands */
+ for (channel = list->first; channel; channel = chanNext) {
+ chanNext = channel->next;
+ rearrange_animchannel_add_to_islands(&islands, list, channel, type);
+ }
+
+ /* perform moving of selected islands now, but only if there is more than one of 'em so that something will happen
+ * - scanning of the list is performed in the opposite direction to the direction we're moving things, so that we
+ * shouldn't need to encounter items we've moved already
+ */
+ if (islands.first != islands.last) {
+ tReorderChannelIsland *first = (mode > 0) ? islands.last : islands.first;
+ tReorderChannelIsland *island, *isn=NULL;
+
+ for (island = first; island; island = isn) {
+ isn = (mode > 0) ? island->prev : island->next;
+
+ /* perform rearranging */
+ if (rearrange_func(&islands, island)) {
+ island->flag |= REORDER_ISLAND_MOVED;
+ done = 1;
+ }
+ }
+ }
+
+ /* ungroup islands */
+ rearrange_animchannel_flatten_islands(&islands, list);
+
+ /* did we do anything? */
+ return done;
}
/* NLA Specific Stuff ----------------------------------------------------- */
@@ -778,8 +858,6 @@ static void rearrange_clear_fcurve_tags (ListBase *list)
*/
static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode)
{
- NlaTrack *nlt, *track;
-
AnimChanRearrangeFp rearrange_func;
/* hack: invert mode so that functions will work in right order */
@@ -794,23 +872,8 @@ static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, sho
//if (EXPANDED_DRVD(adt) == 0)
// return;
- /* clear "moved" flag from all tracks */
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next)
- nlt->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED;
-
- /* reorder all selected tracks */
- for (nlt= (NlaTrack *)rearrange_iter_first(&adt->nla_tracks, mode); nlt; nlt= track) {
- /* Get next channel to consider */
- track= (NlaTrack *)rearrange_iter_next((Link *)nlt, mode);
-
- /* Try to do channel */
- if (rearrange_func(&adt->nla_tracks, (Link *)nlt, ANIMTYPE_NLATRACK))
- nlt->flag |= NLASTRIP_FLAG_EDIT_TOUCHED;
- }
-
- /* clear "moved" flag from all tracks */
- for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next)
- nlt->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED;
+ /* perform rearranging on tracks list */
+ rearrange_animchannel_islands(&adt->nla_tracks, rearrange_func, mode, ANIMTYPE_NLATRACK);
}
/* Drivers Specific Stuff ------------------------------------------------- */
@@ -820,8 +883,6 @@ static void rearrange_nla_channels (bAnimContext *UNUSED(ac), AnimData *adt, sho
*/
static void rearrange_driver_channels (bAnimContext *UNUSED(ac), AnimData *adt, short mode)
{
- FCurve *fcu, *fcun;
-
/* get rearranging function */
AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
@@ -832,19 +893,8 @@ static void rearrange_driver_channels (bAnimContext *UNUSED(ac), AnimData *adt,
if (EXPANDED_DRVD(adt) == 0)
return;
- rearrange_clear_fcurve_tags(&adt->drivers);
-
- /* reorder all selected driver F-Curves */
- for (fcu= (FCurve *)rearrange_iter_first(&adt->drivers, mode); fcu; fcu= fcun) {
- /* Get next channel to consider */
- fcun= (FCurve *)rearrange_iter_next((Link *)fcu, mode);
-
- /* Try to do channel */
- if (rearrange_func(&adt->drivers, (Link *)fcu, ANIMTYPE_FCURVE))
- fcu->flag |= FCURVE_TAGGED;
- }
-
- rearrange_clear_fcurve_tags(&adt->drivers);
+ /* perform rearranging on drivers list (drivers are really just F-Curves) */
+ rearrange_animchannel_islands(&adt->drivers, rearrange_func, mode, ANIMTYPE_FCURVE);
}
/* Action Specific Stuff ------------------------------------------------- */
@@ -858,9 +908,6 @@ static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
if (act == NULL)
return;
- /* clear "moved" flag from all FCurves */
- rearrange_clear_fcurve_tags(&act->curves);
-
/* Separate F-Curves into lists per group */
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
if (agrp->channels.first) {
@@ -921,9 +968,6 @@ static void join_groups_action_temp (bAction *act)
break;
}
}
-
- /* clear "moved" flag from all fcurve's */
- rearrange_clear_fcurve_tags(&act->curves);
}
/* Change the order of anim-channels within action
@@ -931,10 +975,8 @@ static void join_groups_action_temp (bAction *act)
*/
static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mode)
{
- bActionGroup *agrp, *grp;
bActionGroup tgrp;
- FCurve *fcu, *fcun;
- short do_channels = 1;
+ short do_channels;
/* get rearranging function */
AnimChanRearrangeFp rearrange_func = rearrange_get_mode_func(mode);
@@ -942,36 +984,22 @@ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mod
if (rearrange_func == NULL)
return;
- /* make sure we're only operating with groups */
+ /* make sure we're only operating with groups (vs a mixture of groups+curves) */
split_groups_action_temp(act, &tgrp);
- /* rearrange groups first (and then, only consider channels if the groups weren't moved) */
- for (agrp= (bActionGroup *)rearrange_iter_first(&act->groups, mode); agrp; agrp= grp) {
- /* Get next group to consider */
- grp= (bActionGroup *)rearrange_iter_next((Link *)agrp, mode);
-
- /* try to do group first */
- if (rearrange_func(&act->groups, (Link *)agrp, ANIMTYPE_GROUP)) {
- do_channels= 0;
- agrp->flag |= AGRP_MOVED;
- }
- }
+ /* rearrange groups first
+ * - the group's channels will only get considered if nothing happened when rearranging the groups
+ * i.e. the rearrange function returned 0
+ */
+ do_channels = rearrange_animchannel_islands(&act->groups, rearrange_func, mode, ANIMTYPE_GROUP) == 0;
if (do_channels) {
- for (agrp= (bActionGroup *)rearrange_iter_first(&act->groups, mode); agrp; agrp= grp) {
- /* Get next group to consider */
- grp= (bActionGroup *)rearrange_iter_next((Link *)agrp, mode);
-
+ bActionGroup *agrp;
+
+ for (agrp= act->groups.first; agrp; agrp= agrp->next) {
/* only consider F-Curves if they're visible (group expanded) */
if (EXPANDED_AGRP(agrp)) {
- for (fcu= (FCurve *)rearrange_iter_first(&agrp->channels, mode); fcu; fcu= fcun) {
- /* Get next channel to consider */
- fcun= (FCurve *)rearrange_iter_next((Link *)fcu, mode);
-
- /* Try to do channel */
- if (rearrange_func(&agrp->channels, (Link *)fcu, ANIMTYPE_FCURVE))
- fcu->flag |= FCURVE_TAGGED;
- }
+ rearrange_animchannel_islands(&agrp->channels, rearrange_func, mode, ANIMTYPE_FCURVE);
}
}
}
@@ -1026,7 +1054,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
// FIXME: actions should only be considered once!
if (adt->action)
rearrange_action_channels(&ac, adt->action, mode);
- else
+ else if (G.f & G_DEBUG)
printf("animdata has no action\n");
break;
}
@@ -1041,7 +1069,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_move (wmOperatorType *ot)
+static void ANIM_OT_channels_move (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Move Channels";
@@ -1056,7 +1084,7 @@ void ANIM_OT_channels_move (wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
- RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
+ ot->prop= RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
}
/* ******************** Delete Channel Operator *********************** */
@@ -1144,7 +1172,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_delete (wmOperatorType *ot)
+static void ANIM_OT_channels_delete (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Delete Channels";
@@ -1221,7 +1249,7 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_visibility_set (wmOperatorType *ot)
+static void ANIM_OT_channels_visibility_set (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Set Visibility";
@@ -1294,7 +1322,7 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot)
+static void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Toggle Visibility";
@@ -1312,7 +1340,7 @@ void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot)
/* ********************** Set Flags Operator *********************** */
/* defines for setting animation-channel flags */
-EnumPropertyItem prop_animchannel_setflag_types[] = {
+static EnumPropertyItem prop_animchannel_setflag_types[] = {
{ACHANNEL_SETFLAG_TOGGLE, "TOGGLE", 0, "Toggle", ""},
{ACHANNEL_SETFLAG_CLEAR, "DISABLE", 0, "Disable", ""},
{ACHANNEL_SETFLAG_ADD, "ENABLE", 0, "Enable", ""},
@@ -1322,7 +1350,7 @@ EnumPropertyItem prop_animchannel_setflag_types[] = {
/* defines for set animation-channel settings */
// TODO: could add some more types, but those are really quite dependent on the mode...
-EnumPropertyItem prop_animchannel_settings_types[] = {
+static EnumPropertyItem prop_animchannel_settings_types[] = {
{ACHANNEL_SETTING_PROTECT, "PROTECT", 0, "Protect", ""},
{ACHANNEL_SETTING_MUTE, "MUTE", 0, "Mute", ""},
{0, NULL, 0, NULL, NULL}
@@ -1426,7 +1454,7 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
}
-void ANIM_OT_channels_setting_enable (wmOperatorType *ot)
+static void ANIM_OT_channels_setting_enable (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Enable Channel Setting";
@@ -1448,7 +1476,7 @@ void ANIM_OT_channels_setting_enable (wmOperatorType *ot)
ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
-void ANIM_OT_channels_setting_disable (wmOperatorType *ot)
+static void ANIM_OT_channels_setting_disable (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Disable Channel Setting";
@@ -1470,7 +1498,7 @@ void ANIM_OT_channels_setting_disable (wmOperatorType *ot)
ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
-void ANIM_OT_channels_setting_invert (wmOperatorType *ot)
+static void ANIM_OT_channels_setting_invert (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Invert Channel Setting";
@@ -1492,7 +1520,7 @@ void ANIM_OT_channels_setting_invert (wmOperatorType *ot)
ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
-void ANIM_OT_channels_setting_toggle (wmOperatorType *ot)
+static void ANIM_OT_channels_setting_toggle (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Toggle Channel Setting";
@@ -1514,7 +1542,7 @@ void ANIM_OT_channels_setting_toggle (wmOperatorType *ot)
ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
}
-void ANIM_OT_channels_editable_toggle (wmOperatorType *ot)
+static void ANIM_OT_channels_editable_toggle (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Toggle Channel Editability";
@@ -1559,7 +1587,7 @@ static int animchannels_expand_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_expand (wmOperatorType *ot)
+static void ANIM_OT_channels_expand (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Expand Channels";
@@ -1601,7 +1629,7 @@ static int animchannels_collapse_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_collapse (wmOperatorType *ot)
+static void ANIM_OT_channels_collapse (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Collapse Channels";
@@ -1668,7 +1696,7 @@ static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot)
+static void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Revive Disabled F-Curves";
@@ -1705,7 +1733,7 @@ static int animchannels_deselectall_exec (bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
+static void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select All";
@@ -1830,7 +1858,7 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_select_border(wmOperatorType *ot)
+static void ANIM_OT_channels_select_border(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Border Select";
@@ -2152,7 +2180,7 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
return OPERATOR_FINISHED;
}
-void ANIM_OT_channels_click (wmOperatorType *ot)
+static void ANIM_OT_channels_click (wmOperatorType *ot)
{
/* identifiers */
ot->name= "Mouse Click on Channels";
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index dd27de883b3..8a165b9c71b 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -232,7 +232,7 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag)
/* Draw dark green line if slow-parenting/time-offset is enabled */
if (flag & DRAWCFRA_SHOW_TIMEOFS) {
- Object *ob= (scene->basact) ? (scene->basact->object) : 0;
+ Object *ob= OBACT;
if(ob) {
float timeoffset= give_timeoffset(ob);
// XXX ob->ipoflag is depreceated!
@@ -352,7 +352,7 @@ static short bezt_nlamapping_apply(KeyframeEditData *ked, BezTriple *bezt)
*/
void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, short only_keys)
{
- KeyframeEditData ked= {{0}};
+ KeyframeEditData ked= {{NULL}};
KeyframeEditFunc map_cb;
/* init edit data
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index c63b2ea8a20..8ab677f0f42 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -428,7 +428,7 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
/* this function allocates memory for a new bAnimListElem struct for the
* provided animation channel-data.
*/
-bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, short ownertype, ID *owner_id)
+static bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, short ownertype, ID *owner_id)
{
bAnimListElem *ale= NULL;
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 3e2212c15bb..023fd7e4efe 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -41,10 +41,10 @@
#include "DNA_anim_types.h"
-
-
#include "RNA_access.h"
+#include "ED_anim_api.h"
+
/* ----------------------- Getter functions ----------------------- */
/* Write into "name" buffer, the name of the property (retrieved using RNA from the curve's settings),
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 58dc5008959..5708c584964 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -205,7 +205,7 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
/* --------------------------------- */
/* Adds a marker to list of cfra elems */
-void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
+static void add_marker_to_cfra_elem(ListBase *lb, TimeMarker *marker, short only_sel)
{
CfraElem *ce, *cen;
@@ -264,6 +264,29 @@ TimeMarker *ED_markers_get_first_selected(ListBase *markers)
return NULL;
}
+/* --------------------------------- */
+
+/* Print debugging prints of list of markers
+ * BSI's: do NOT make static or put in if-defs as "unused code". That's too much trouble when we need to use for quick debuggging!
+ */
+static void debug_markers_print_list(ListBase *markers)
+{
+ TimeMarker *marker;
+
+ if (markers == NULL) {
+ printf("No markers list to print debug for\n");
+ return;
+ }
+
+ printf("List of markers follows: -----\n");
+
+ for (marker = markers->first; marker; marker = marker->next) {
+ printf("\t'%s' on %d at %p with %d\n", marker->name, marker->frame, marker, marker->flag);
+ }
+
+ printf("End of list ------------------\n");
+}
+
/* ************* Marker Drawing ************ */
/* function to draw markers */
@@ -496,7 +519,7 @@ static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
marker->flag= SELECT;
marker->frame= frame;
- sprintf(marker->name, "F_%02d", frame); // XXX - temp code only
+ BLI_snprintf(marker->name, sizeof(marker->name), "F_%02d", frame); // XXX - temp code only
BLI_addtail(markers, marker);
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
@@ -724,19 +747,19 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
SpaceTime *stime= (SpaceTime *)mm->slink;
if (stime->flag & TIME_DRAWFRAMES)
- sprintf(str, "Marker %d offset %d", selmarker->frame, offs);
+ BLI_snprintf(str, sizeof(str), "Marker %d offset %d", selmarker->frame, offs);
else
- sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
+ BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
}
else if (mm->slink->spacetype == SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)mm->slink;
if (saction->flag & SACTION_DRAWTIME)
- sprintf(str, "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
+ BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", FRA2TIME(selmarker->frame), FRA2TIME(offs));
else
- sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
+ BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
}
else {
- sprintf(str, "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
+ BLI_snprintf(str, sizeof(str), "Marker %.2f offset %.2f", (double)(selmarker->frame), (double)(offs));
}
}
else {
@@ -744,19 +767,19 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
SpaceTime *stime= (SpaceTime *)mm->slink;
if (stime->flag & TIME_DRAWFRAMES)
- sprintf(str, "Marker offset %d ", offs);
+ BLI_snprintf(str, sizeof(str), "Marker offset %d ", offs);
else
- sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
+ BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", FRA2TIME(offs));
}
else if (mm->slink->spacetype == SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)mm->slink;
if (saction->flag & SACTION_DRAWTIME)
- sprintf(str, "Marker offset %.2f ", FRA2TIME(offs));
+ BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", FRA2TIME(offs));
else
- sprintf(str, "Marker offset %.2f ", (double)(offs));
+ BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", (double)(offs));
}
else {
- sprintf(str, "Marker offset %.2f ", (double)(offs));
+ BLI_snprintf(str, sizeof(str), "Marker offset %.2f ", (double)(offs));
}
}
@@ -779,7 +802,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
ed_marker_move_apply(op);
// ed_marker_header_update(C, op, str, (int)vec[0]);
// strcat(str, str_tx);
- sprintf(str, "Marker offset %s", str_tx);
+ BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx);
ED_area_headerprint(CTX_wm_area(C), str);
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
@@ -868,6 +891,7 @@ static void ed_marker_duplicate_apply(bContext *C)
#endif
/* new marker is added to the begining of list */
+ // FIXME: bad ordering!
BLI_addhead(markers, newmarker);
}
}
@@ -996,8 +1020,8 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL);
- /* allowing tweaks */
- return OPERATOR_PASS_THROUGH;
+ /* allowing tweaks, but needs OPERATOR_FINISHED, otherwise renaming fails... [#25987] */
+ return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
}
static int ed_marker_select_invoke(bContext *C, wmOperator *op, wmEvent *evt)
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 6b0fa30b096..a641b3d1db4 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -47,6 +47,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "ED_anim_api.h"
#include "ED_screen.h"
#include "anim_intern.h"
@@ -153,7 +154,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-void ANIM_OT_change_frame(wmOperatorType *ot)
+static void ANIM_OT_change_frame(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Change frame";
@@ -208,7 +209,7 @@ static int previewrange_define_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void ANIM_OT_previewrange_set(wmOperatorType *ot)
+static void ANIM_OT_previewrange_set(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Set Preview Range";
@@ -255,7 +256,7 @@ static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ANIM_OT_previewrange_clear(wmOperatorType *ot)
+static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Clear Preview Range";
@@ -323,7 +324,7 @@ static int toggle_time_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void ANIM_OT_time_toggle(wmOperatorType *ot)
+static void ANIM_OT_time_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Toggle Frames/Seconds";
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 8d74e7b1b59..ede2e243e4a 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -60,6 +60,11 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "anim_intern.h"
+
+/* called by WM */
+void free_anim_drivers_copybuf (void);
+
/* ************************************************** */
/* Animation Data Validation */
@@ -70,7 +75,7 @@
* 1 - add new Driver FCurve,
* -1 - add new Driver FCurve without driver stuff (for pasting)
*/
-FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_index, short add)
+static FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_index, short add)
{
AnimData *adt;
FCurve *fcu;
@@ -475,7 +480,7 @@ static char *get_driver_path_hack (bContext *C, PointerRNA *ptr, PropertyRNA *pr
static int add_driver_button_exec (bContext *C, wmOperator *op)
{
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
PropertyRNA *prop= NULL;
short success= 0;
int index, all= RNA_boolean_get(op->ptr, "all");
@@ -531,7 +536,7 @@ void ANIM_OT_driver_button_add (wmOperatorType *ot)
static int remove_driver_button_exec (bContext *C, wmOperator *op)
{
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
PropertyRNA *prop= NULL;
short success= 0;
int index, all= RNA_boolean_get(op->ptr, "all");
@@ -583,7 +588,7 @@ void ANIM_OT_driver_button_remove (wmOperatorType *ot)
static int copy_driver_button_exec (bContext *C, wmOperator *op)
{
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
PropertyRNA *prop= NULL;
short success= 0;
int index;
@@ -627,7 +632,7 @@ void ANIM_OT_copy_driver_button (wmOperatorType *ot)
static int paste_driver_button_exec (bContext *C, wmOperator *op)
{
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
PropertyRNA *prop= NULL;
short success= 0;
int index;
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index d535481d154..67be382e600 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -50,6 +50,7 @@
#include "BKE_animsys.h"
#include "BKE_action.h"
+#include "BKE_armature.h"
#include "BKE_constraint.h"
#include "BKE_depsgraph.h"
#include "BKE_fcurve.h"
@@ -642,51 +643,48 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
if (strstr(identifier, "location")) {
return ob->obmat[3][array_index];
}
- else if (strstr(identifier, "rotation")) {
+ else if (strstr(identifier, "rotation_euler")) {
float eul[3];
- mat4_to_eul( eul,ob->obmat);
+ mat4_to_eulO(eul, ob->rotmode, ob->obmat);
return eul[array_index];
}
+ // FIXME: other types of rotation don't work
}
}
else if (ptr->type == &RNA_PoseBone) {
- Object *ob= (Object *)ptr->id.data; /* we assume that this is always set, and is an object */
bPoseChannel *pchan= (bPoseChannel *)ptr->data;
- float tmat[4][4];
+ bPoseChannel tchan;
- /* Although it is not strictly required for this particular space conversion,
- * arg1 must not be null, as there is a null check for the other conversions to
- * be safe. Therefore, the active object is passed here, and in many cases, this
- * will be what owns the pose-channel that is getting this anyway.
+ /* make a copy of pchan so that we can apply and decompose its chan_mat, thus getting the
+ * rest-pose to pose-mode transform that got stored there at the end of posing calculations
+ * for B-Bone deforms to use
+ * - it should be safe to just make a local copy like this, since we're not doing anything with the copied pointers
*/
- copy_m4_m4(tmat, pchan->pose_mat);
- constraint_mat_convertspace(ob, pchan, tmat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
+ memcpy(&tchan, pchan, sizeof(bPoseChannel));
+ pchan_apply_mat4(&tchan, pchan->chan_mat, TRUE);
/* Loc, Rot/Quat keyframes are supported... */
if (strstr(identifier, "location")) {
/* only use for non-connected bones */
if ((pchan->bone->parent) && !(pchan->bone->flag & BONE_CONNECTED))
- return tmat[3][array_index];
+ return tchan.loc[array_index];
else if (pchan->bone->parent == NULL)
- return tmat[3][array_index];
+ return tchan.loc[array_index];
}
else if (strstr(identifier, "rotation_euler")) {
- float eul[3];
-
- /* euler-rotation test before standard rotation, as standard rotation does quats */
- mat4_to_eulO( eul, pchan->rotmode,tmat);
- return eul[array_index];
+ return tchan.eul[array_index];
}
else if (strstr(identifier, "rotation_quaternion")) {
- float trimat[3][3], quat[4];
-
- copy_m3_m4(trimat, tmat);
- mat3_to_quat_is_ok( quat,trimat);
-
- return quat[array_index];
+ return tchan.quat[array_index];
+ }
+ else if (strstr(identifier, "rotation_axisangle")) {
+ /* w = 0, x,y,z = 1,2,3 */
+ if (array_index == 0)
+ return tchan.rotAngle;
+ else
+ return tchan.rotAxis[array_index - 1];
}
- // TODO: axis-angle...
}
/* as the function hasn't returned yet, read value from system in the default way */
@@ -1369,7 +1367,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
PropertyRNA *prop= NULL;
char *path;
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
@@ -1458,7 +1456,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
PropertyRNA *prop= NULL;
char *path;
float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 2df7d21e907..40c2f3c3797 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -288,7 +288,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
KeyingSet *ks = NULL;
PropertyRNA *prop= NULL;
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
char *path = NULL;
short success= 0;
int index=0, pflag=0;
@@ -388,7 +388,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
KeyingSet *ks = NULL;
PropertyRNA *prop= NULL;
- PointerRNA ptr= {{0}};
+ PointerRNA ptr= {{NULL}};
char *path = NULL;
short success= 0;
int index=0;
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 4fc5064cef0..94c1edd90d5 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -716,7 +716,6 @@ void POSE_OT_armature_apply (wmOperatorType *ot)
/* set the current pose as the restpose */
static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op))
{
- Scene *scene= CTX_data_scene(C);
Object *ob= ED_object_pose_armature(CTX_data_active_object(C)); // must be active object, not edit-object
/* don't check if editmode (should be done by caller) */
@@ -729,24 +728,18 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
* at once are to be predictable*/
CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pose_bones)
{
- float delta_mat[4][4], imat[4][4], mat[4][4];
-
- where_is_pose_bone(scene, ob, pchan, CFRA, 1);
-
- copy_m4_m4(mat, pchan->pose_mat);
-
- /* calculate pchan->pose_mat without loc/size/rot & constraints applied */
- where_is_pose_bone(scene, ob, pchan, CFRA, 0);
- invert_m4_m4(imat, pchan->pose_mat);
- mul_m4_m4m4(delta_mat, mat, imat);
-
+ float delta_mat[4][4];
+
+ /* chan_mat already contains the delta transform from rest pose to pose-mode pose
+ * as that is baked into there so that B-Bones will work. Once we've set this as the
+ * new raw-transform components, don't recalc the poses yet, otherwise IK result will
+ * change, thus changing the result we may be trying to record.
+ */
+ copy_m4_m4(delta_mat, pchan->chan_mat);
pchan_apply_mat4(pchan, delta_mat, TRUE);
-
- where_is_pose_bone(scene, ob, pchan, CFRA, 1);
}
CTX_DATA_END;
-
- // ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
+
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
/* note, notifier might evolve */
@@ -2205,10 +2198,8 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
mul_m3_v3(imat, vec);
}
else if (type==5) {
- bArmature *arm= ob->data;
- EditBone *ebone= (EditBone *)arm->act_edbone;
float mat[3][3], nor[3];
-
+ ebone= (EditBone *)arm->act_edbone;
if(ebone==NULL) {
BKE_report(op->reports, RPT_ERROR, "No active bone set");
return OPERATOR_CANCELLED;
@@ -4721,7 +4712,7 @@ static void envelope_bone_weighting(Object *ob, Mesh *mesh, float (*verts)[3], i
}
}
-void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror)
+static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, Object *par, int heat, int mirror)
{
/* This functions implements the automatic computation of vertex group
* weights, either through envelopes or using a heat equilibrium.
@@ -5441,13 +5432,11 @@ static int bone_unique_check(void *arg, const char *name)
return get_named_bone((bArmature *)arg, name) != NULL;
}
-void unique_bone_name(bArmature *arm, char *name)
+static void unique_bone_name(bArmature *arm, char *name)
{
BLI_uniquename_cb(bone_unique_check, (void *)arm, "Bone", '.', name, sizeof(((Bone *)NULL)->name));
}
-
-#define MAXBONENAME 32
/* helper call for armature_bone_rename */
static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldname, char *newname)
{
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index cabf81ea85e..ee0ed8252c3 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -112,7 +112,7 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4]);
/*********************************** EDITBONE UTILS ****************************************************/
-int countEditBoneChildren(ListBase *list, EditBone *parent)
+static int countEditBoneChildren(ListBase *list, EditBone *parent)
{
EditBone *ebone;
int count = 0;
@@ -128,7 +128,7 @@ int countEditBoneChildren(ListBase *list, EditBone *parent)
return count;
}
-EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n)
+static EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n)
{
EditBone *ebone;
@@ -147,7 +147,7 @@ EditBone* nextEditBoneChild(ListBase *list, EditBone *parent, int n)
return NULL;
}
-void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3])
+static void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3])
{
float mat[3][3], nor[3];
@@ -195,7 +195,7 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4],
}
}
-float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3])
+static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3])
{
if (previous == NULL)
{
@@ -257,7 +257,7 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4])
/************************************ DESTRUCTORS ******************************************************/
-void RIG_freeRigArc(BArc *arc)
+static void RIG_freeRigArc(BArc *arc)
{
BLI_freelistN(&((RigArc*)arc)->edges);
}
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index d5994e24cd6..9c7911715b4 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -882,91 +882,90 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
*/
static void poselib_preview_get_next (tPoseLib_PreviewData *pld, int step)
{
- /* check if we no longer have search-string, but don't have any marker */
- if (pld->marker == NULL) {
- if ((step) && (pld->searchstr[0] == 0))
- pld->marker= pld->act->markers.first;
- }
-
- /* the following operations assume that there is a starting point and direction */
- if ((pld->marker) && (step)) {
- /* search-string dictates a special approach */
- if (pld->searchstr[0]) {
- TimeMarker *marker;
- LinkData *ld, *ldn, *ldc;
+ /* stop if not going anywhere, as we assume that there is a direction to move in */
+ if (step == 0)
+ return;
+
+ /* search-string dictates a special approach */
+ if (pld->searchstr[0]) {
+ TimeMarker *marker;
+ LinkData *ld, *ldn, *ldc;
+
+ /* free and rebuild if needed (i.e. if search-str changed) */
+ if (strcmp(pld->searchstr, pld->searchold)) {
+ /* free list of temporary search matches */
+ BLI_freelistN(&pld->searchp);
- /* free and rebuild if needed (i.e. if search-str changed) */
- if (strcmp(pld->searchstr, pld->searchold)) {
- /* free list of temporary search matches */
- BLI_freelistN(&pld->searchp);
-
- /* generate a new list of search matches */
- for (marker= pld->act->markers.first; marker; marker= marker->next) {
- /* does the name partially match?
- * - don't worry about case, to make it easier for users to quickly input a name (or
- * part of one), which is the whole point of this feature
- */
- if (BLI_strcasestr(marker->name, pld->searchstr)) {
- /* make link-data to store reference to it */
- ld= MEM_callocN(sizeof(LinkData), "PoseMatch");
- ld->data= marker;
- BLI_addtail(&pld->searchp, ld);
- }
+ /* generate a new list of search matches */
+ for (marker= pld->act->markers.first; marker; marker= marker->next) {
+ /* does the name partially match?
+ * - don't worry about case, to make it easier for users to quickly input a name (or
+ * part of one), which is the whole point of this feature
+ */
+ if (BLI_strcasestr(marker->name, pld->searchstr)) {
+ /* make link-data to store reference to it */
+ ld= MEM_callocN(sizeof(LinkData), "PoseMatch");
+ ld->data= marker;
+ BLI_addtail(&pld->searchp, ld);
}
-
- /* set current marker to NULL (so that we start from first) */
- pld->marker= NULL;
- }
-
- /* check if any matches */
- if (pld->searchp.first == NULL) {
- pld->marker= NULL;
- return;
}
- /* find first match */
- for (ldc= pld->searchp.first; ldc; ldc= ldc->next) {
- if (ldc->data == pld->marker)
- break;
- }
- if (ldc == NULL)
- ldc= pld->searchp.first;
-
- /* Loop through the matches in a cyclic fashion, incrementing/decrementing step as appropriate
- * until step == 0. At this point, marker should be the correct marker.
- */
- if (step > 0) {
- for (ld=ldc; ld && step; ld=ldn, step--)
- ldn= (ld->next) ? ld->next : pld->searchp.first;
- }
- else {
- for (ld=ldc; ld && step; ld=ldn, step++)
- ldn= (ld->prev) ? ld->prev : pld->searchp.last;
- }
+ /* set current marker to NULL (so that we start from first) */
+ pld->marker= NULL;
+ }
+
+ /* check if any matches */
+ if (pld->searchp.first == NULL) {
+ pld->marker= NULL;
+ return;
+ }
+
+ /* find first match */
+ for (ldc= pld->searchp.first; ldc; ldc= ldc->next) {
+ if (ldc->data == pld->marker)
+ break;
+ }
+ if (ldc == NULL)
+ ldc= pld->searchp.first;
- /* set marker */
- if (ld)
- pld->marker= ld->data;
+ /* Loop through the matches in a cyclic fashion, incrementing/decrementing step as appropriate
+ * until step == 0. At this point, marker should be the correct marker.
+ */
+ if (step > 0) {
+ for (ld=ldc; ld && step; ld=ldn, step--)
+ ldn= (ld->next) ? ld->next : pld->searchp.first;
}
else {
- TimeMarker *marker, *next;
-
- /* Loop through the markers in a cyclic fashion, incrementing/decrementing step as appropriate
- * until step == 0. At this point, marker should be the correct marker.
- */
- if (step > 0) {
- for (marker=pld->marker; marker && step; marker=next, step--)
- next= (marker->next) ? marker->next : pld->act->markers.first;
- }
- else {
- for (marker=pld->marker; marker && step; marker=next, step++)
- next= (marker->prev) ? marker->prev : pld->act->markers.last;
- }
-
- /* it should be fairly impossible for marker to be NULL */
- if (marker)
- pld->marker= marker;
+ for (ld=ldc; ld && step; ld=ldn, step++)
+ ldn= (ld->prev) ? ld->prev : pld->searchp.last;
}
+
+ /* set marker */
+ if (ld)
+ pld->marker= ld->data;
+ }
+ else {
+ TimeMarker *marker, *next;
+
+ /* if no marker, because we just ended searching, then set that to the start of the list */
+ if (pld->marker == NULL)
+ pld->marker= pld->act->markers.first;
+
+ /* Loop through the markers in a cyclic fashion, incrementing/decrementing step as appropriate
+ * until step == 0. At this point, marker should be the correct marker.
+ */
+ if (step > 0) {
+ for (marker=pld->marker; marker && step; marker=next, step--)
+ next= (marker->next) ? marker->next : pld->act->markers.first;
+ }
+ else {
+ for (marker=pld->marker; marker && step; marker=next, step++)
+ next= (marker->prev) ? marker->prev : pld->act->markers.last;
+ }
+
+ /* it should be fairly impossible for marker to be NULL */
+ if (marker)
+ pld->marker= marker;
}
}
@@ -1037,6 +1036,12 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm
tPoseLib_PreviewData *pld= op->customdata;
int ret = OPERATOR_RUNNING_MODAL;
+ /* only accept 'press' event, and ignore 'release', so that we don't get double actions */
+ if (ELEM(event->val, KM_PRESS, KM_NOTHING) == 0) {
+ //printf("PoseLib: skipping event with type '%s' and val %d\n", WM_key_event_string(event->type), event->val);
+ return ret;
+ }
+
/* backup stuff that needs to occur before every operation
* - make a copy of searchstr, so that we know if cache needs to be rebuilt
*/
@@ -1065,18 +1070,16 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm
*/
case PAD0: case PAD1: case PAD2: case PAD3: case PAD4:
case PAD5: case PAD6: case PAD7: case PAD8: case PAD9:
- case PADPLUSKEY: case PADMINUS: case MIDDLEMOUSE:
+ case PADPLUSKEY: case PADMINUS:
+ case MIDDLEMOUSE: case MOUSEMOVE:
//pld->redraw= PL_PREVIEW_REDRAWHEADER;
- ret |= OPERATOR_PASS_THROUGH;
+ ret = OPERATOR_PASS_THROUGH;
break;
/* quicky compare to original */
case TABKEY:
- /* only respond to one event */
- if (event->val == 0) {
- pld->flag &= ~PL_PREVIEW_SHOWORIGINAL;
- pld->redraw= PL_PREVIEW_REDRAWALL;
- }
+ pld->flag &= ~PL_PREVIEW_SHOWORIGINAL;
+ pld->redraw= PL_PREVIEW_REDRAWALL;
break;
}
@@ -1103,11 +1106,8 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm
/* toggle between original pose and poselib pose*/
case TABKEY:
- /* only respond to one event */
- if (event->val == 0) {
- pld->flag |= PL_PREVIEW_SHOWORIGINAL;
- pld->redraw= PL_PREVIEW_REDRAWALL;
- }
+ pld->flag |= PL_PREVIEW_SHOWORIGINAL;
+ pld->redraw= PL_PREVIEW_REDRAWALL;
break;
/* change to previous pose (cyclic) */
@@ -1200,9 +1200,9 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm
/* we add pass through here, so that the operators responsible for these can still run,
* even though we still maintain control (as RUNNING_MODAL flag is still set too)
*/
- case MIDDLEMOUSE:
+ case MIDDLEMOUSE: case MOUSEMOVE:
//pld->redraw= PL_PREVIEW_REDRAWHEADER;
- ret |= OPERATOR_PASS_THROUGH;
+ ret = OPERATOR_PASS_THROUGH;
break;
/* view manipulation, or searching */
@@ -1216,7 +1216,7 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm
else {
/* view manipulation (see above) */
//pld->redraw= PL_PREVIEW_REDRAWHEADER;
- ret |= OPERATOR_PASS_THROUGH;
+ ret = OPERATOR_PASS_THROUGH;
}
break;
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index 29ba72ce604..38e23a3d456 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -205,7 +205,7 @@ void REEB_freeGraph(ReebGraph *rg)
MEM_freeN(rg);
}
-ReebGraph * newReebGraph()
+ReebGraph * newReebGraph(void)
{
ReebGraph *rg;
rg = MEM_callocN(sizeof(ReebGraph), "reeb graph");
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 0949e3d6214..0f6b88554e1 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1122,14 +1122,13 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
/* remove pathes for removed control points
need this to make further step with copying non-cv related curves copying
not touching cv's f-cruves */
- fcu= orig_curves->first;
for(fcu= orig_curves->first; fcu; fcu= next) {
next= fcu->next;
if(!strncmp(fcu->rna_path, "splines", 7)) {
char *ch= strchr(fcu->rna_path, '.');
- if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 8)))
+ if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7)))
fcurve_remove(ad, orig_curves, fcu);
}
}
@@ -4404,8 +4403,20 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
findselectedNurbvert(&editnurb->nurbs, &nu, &bezt, &bp);
if ((nu == NULL) || (nu->type==CU_BEZIER && bezt==NULL) || (nu->type!=CU_BEZIER && bp==NULL)) {
- if(cu->actnu >= 0 && mode!='e') {
- nu= BLI_findlink(&editnurb->nurbs, cu->actnu);
+ if(mode!='e') {
+ if(cu->actnu >= 0) nu= BLI_findlink(&editnurb->nurbs, cu->actnu);
+ else {
+ /* no selected sement -- create new one which is BEZIER tpye
+ type couldn't be determined from Curve bt could be changed
+ in the future, so shouldn't make much headache */
+
+ nu= MEM_callocN(sizeof(Nurb), "addvert_Nurb nu");
+ nu->type= CU_BEZIER;
+ nu->resolu= cu->resolu;
+ nu->flag |= CU_SMOOTH;
+
+ BLI_addtail(&editnurb->nurbs, nu);
+ }
if(nu->type==CU_BEZIER) {
newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb");
@@ -5616,6 +5627,7 @@ static int delete_exec(bContext *C, wmOperator *op)
BezTriple *bezt, *bezt1, *bezt2;
BPoint *bp, *bp1, *bp2;
int a, cut= 0, type= RNA_enum_get(op->ptr, "type");
+ int nuindex= 0;
if(obedit->type==OB_SURF) {
if(type==0) {
@@ -5650,6 +5662,9 @@ static int delete_exec(bContext *C, wmOperator *op)
bezt++;
}
if(a==0) {
+ if(cu->actnu == nuindex)
+ cu->actnu= -1;
+
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
freeNurb(nu); nu= NULL;
@@ -5667,6 +5682,9 @@ static int delete_exec(bContext *C, wmOperator *op)
bp++;
}
if(a==0) {
+ if(cu->actnu == nuindex)
+ cu->actnu= -1;
+
BLI_remlink(nubase, nu);
keyIndex_delNurb(editnurb, nu);
freeNurb(nu); nu= NULL;
@@ -5682,6 +5700,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
*/
nu= next;
+ nuindex++;
}
/* 2nd loop, delete small pieces: just for curves */
nu= nubase->first;
@@ -5755,6 +5774,7 @@ static int delete_exec(bContext *C, wmOperator *op)
bezt1= bezt2= NULL;
bp1= bp2= NULL;
nu1= NULL;
+ nuindex= 0;
for(nu= nubase->first; nu; nu= nu->next) {
next= nu->next;
if(nu->type == CU_BEZIER) {
@@ -5811,10 +5831,14 @@ static int delete_exec(bContext *C, wmOperator *op)
}
}
if(nu1) break;
+ nuindex++;
}
if(nu1) {
if(bezt1) {
if(nu1->pntsu==2) { /* remove completely */
+ if(cu->actnu == nuindex)
+ cu->actnu= -1;
+
BLI_remlink(nubase, nu);
freeNurb(nu); nu = NULL;
}
@@ -5858,6 +5882,9 @@ static int delete_exec(bContext *C, wmOperator *op)
}
else if(bp1) {
if(nu1->pntsu==2) { /* remove completely */
+ if(cu->actnu == nuindex)
+ cu->actnu= -1;
+
BLI_remlink(nubase, nu);
freeNurb(nu); nu= NULL;
}
@@ -5892,6 +5919,7 @@ static int delete_exec(bContext *C, wmOperator *op)
}
}
else if(type==2) {
+ cu->actnu= -1;
keyIndex_delNurbList(editnurb, nubase);
freeNurblist(nubase);
}
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 96bc4259661..7590b2558f0 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -141,7 +141,7 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl)
uiItemL(subrow, name, ICON_NULL);
/* delete button (only if hidden but not locked!) */
- if ((gpl->flag & GP_LAYER_HIDE) & !(gpl->flag & GP_LAYER_LOCKED)) {
+ if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) {
/* right-align ............................... */
subrow= uiLayoutRow(row, 1);
uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 386bbc0a236..057e5d3bf88 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -51,6 +51,9 @@ struct MDeformWeight;
struct MDeformVert;
struct Scene;
struct Mesh;
+struct MFace;
+struct MEdge;
+struct MVert;
struct MCol;
struct UvVertMap;
struct UvMapVert;
@@ -194,7 +197,7 @@ 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_select_by_name(struct Object *ob, const 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);
diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h
index 1887a97e635..a0d1e0d65ec 100644
--- a/source/blender/editors/include/ED_types.h
+++ b/source/blender/editors/include/ED_types.h
@@ -40,8 +40,8 @@
#define YIC 20
/* proposal = put scene pointers on function calls? */
-#define BASACT (scene->basact)
-#define OBACT (BASACT? BASACT->object: 0)
+// #define BASACT (scene->basact)
+// #define OBACT (BASACT? BASACT->object: NULL)
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 1cbf1d0e998..473d889c731 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -28,12 +28,15 @@
#ifndef ED_UTIL_H
#define ED_UTIL_H
+struct Scene;
struct Object;
struct bContext;
struct ARegion;
struct uiBlock;
struct wmOperator;
struct wmOperatorType;
+struct EditMesh;
+struct Mesh;
/* ed_util.c */
@@ -73,6 +76,15 @@ void undo_editmode_menu (struct bContext *C);
void undo_editmode_clear (void);
void undo_editmode_step (struct bContext *C, int step);
+/* crazyspace.c */
+float *crazyspace_get_mapped_editverts(struct Scene *scene, struct Object *obedit);
+void crazyspace_set_quats_editmesh(struct EditMesh *em, float *origcos, float *mappedcos, float *quats);
+void crazyspace_set_quats_mesh(struct Mesh *me, float *origcos, float *mappedcos, float *quats);
+int editmesh_get_first_deform_matrices(struct Scene *scene, struct Object *ob, struct EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3]);
+int sculpt_get_first_deform_matrices(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]);
+void crazyspace_build_sculpt(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]);
+
+
/* ************** XXX OLD CRUFT WARNING ************* */
void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert);
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index b9ded28b613..76c9e765188 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -760,6 +760,10 @@ void uiStyleFontDrawRotated(struct uiFontStyle *fs, struct rcti *rect, const cha
int UI_GetStringWidth(const char *str); // XXX temp
void UI_DrawString(float x, float y, const char *str); // XXX temp
+void UI_DrawTriIcon(float x, float y, char dir);
+
+/* linker workaround ack! */
+void UI_template_fix_linking(void);
#endif /* UI_INTERFACE_H */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 52e9ae6894e..cb7c8c34f1c 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -80,17 +80,17 @@ static void ui_free_but(const bContext *C, uiBut *but);
/* ************* translation ************** */
-int ui_translate_buttons()
+int ui_translate_buttons(void)
{
return (U.transopts & USER_TR_BUTTONS);
}
-int ui_translate_menus()
+int ui_translate_menus(void)
{
return (U.transopts & USER_TR_MENUS);
}
-int ui_translate_tooltips()
+int ui_translate_tooltips(void)
{
return (U.transopts & USER_TR_TOOLTIPS);
}
@@ -660,11 +660,11 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
}
-void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
+static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
{
uiBut *but;
IDProperty *prop;
- char buf[512], *butstr;
+ char buf[512];
/* only do it before bounding */
if(block->minx != block->maxx)
@@ -675,15 +675,10 @@ void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
prop= (but->opptr)? but->opptr->data: NULL;
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
- butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps");
- strcpy(butstr, but->str);
- strcat(butstr, "|");
- strcat(butstr, buf);
-
+ char *butstr_orig= BLI_strdup(but->str);
+ BLI_snprintf(but->strdata, sizeof(but->strdata), "%s|%s", butstr_orig, buf);
+ MEM_freeN(butstr_orig);
but->str= but->strdata;
- BLI_strncpy(but->str, butstr, sizeof(but->strdata));
- MEM_freeN(butstr);
-
ui_check_but(but);
}
}
@@ -924,7 +919,7 @@ static int uibut_contains_pt(uiBut *UNUSED(but), short *UNUSED(mval))
}
-uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval)
+static uiBut *ui_get_valid_link_button(uiBlock *block, uiBut *but, short *mval)
{
uiBut *bt;
@@ -2162,8 +2157,7 @@ void ui_check_but(uiBut *but)
ui_get_but_string(but, str, UI_MAX_DRAW_STR-strlen(but->str));
- strcpy(but->drawstr, but->str);
- strcat(but->drawstr, str);
+ BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str);
}
break;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 4ea0c01d15c..f16d633de6f 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -381,7 +381,7 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
}
/* plain fake antialiased unfilled round rectangle */
-void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp)
+static void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp)
{
float color[4], alpha;
float raddiff;
@@ -553,8 +553,6 @@ static void ui_draw_but_CHARTAB(uiBut *but)
/* Set the font, in case it is not FO_BUILTIN_NAME font */
if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME))
{
- char tmpStr[256];
-
// Is the font file packed, if so then use the packed file
if(G.selfont->packedfile)
{
@@ -563,9 +561,10 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
else
{
+ char tmpStr[256];
int err;
- strcpy(tmpStr, G.selfont->name);
+ BLI_strncpy(tmpStr, G.selfont->name, sizeof(tmpStr));
BLI_path_abs(tmpStr, G.main->name);
err = FTF_SetFont((unsigned char *)tmpStr, 0, 14.0);
}
@@ -716,7 +715,7 @@ static void draw_scope_end(rctf *rect, GLint *scissor)
uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f);
}
-void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res)
+static void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res)
{
int i;
@@ -962,17 +961,17 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
draw_scope_end(&rect, scissor);
}
-float polar_to_x(float center, float diam, float ampli, float angle)
+static float polar_to_x(float center, float diam, float ampli, float angle)
{
return center + diam * ampli * cosf(angle);
}
-float polar_to_y(float center, float diam, float ampli, float angle)
+static float polar_to_y(float center, float diam, float ampli, float angle)
{
return center + diam * ampli * sinf(angle);
}
-void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b)
+static void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b)
{
float y,u,v;
float tangle=0.f, tampli;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index b802098ff10..92b4e622d7e 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3968,35 +3968,31 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
uiBut *but = (uiBut *)arg1;
if (but->optype) {
- char buf[512], *butstr, *cpoin;
+ char buf[512], *cpoin;
IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
/* complex code to change name of button */
if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) {
wmKeyMap *km= NULL;
+ char *butstr_orig;
- butstr= MEM_mallocN(strlen(but->str)+strlen(buf)+2, "menu_block_set_keymaps");
-
// XXX but->str changed... should not, remove the hotkey from it
cpoin= strchr(but->str, '|');
if(cpoin) *cpoin= 0;
-
- strcpy(butstr, but->str);
- strcat(butstr, "|");
- strcat(butstr, buf);
-
+
+ butstr_orig= BLI_strdup(but->str);
+ BLI_snprintf(but->strdata, sizeof(but->strdata), "%s|%s", butstr_orig, buf);
+ MEM_freeN(butstr_orig);
but->str= but->strdata;
- BLI_strncpy(but->str, butstr, sizeof(but->strdata));
- MEM_freeN(butstr);
-
+
ui_check_but(but);
-
+
/* set the keymap editable else the key wont save */
WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
WM_keymap_copy_to_user(km);
-
- } else {
+ }
+ else {
/* shortcut was removed */
cpoin= strchr(but->str, '|');
if(cpoin) *cpoin= 0;
@@ -4684,19 +4680,21 @@ static void button_timers_tooltip_remove(bContext *C, uiBut *but)
uiHandleButtonData *data;
data= but->active;
+ if(data) {
- if(data->tooltiptimer) {
- WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
- data->tooltiptimer= NULL;
- }
- if(data->tooltip) {
- ui_tooltip_free(C, data->tooltip);
- data->tooltip= NULL;
- }
+ if(data->tooltiptimer) {
+ WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
+ data->tooltiptimer= NULL;
+ }
+ if(data->tooltip) {
+ ui_tooltip_free(C, data->tooltip);
+ data->tooltip= NULL;
+ }
- if(data->autoopentimer) {
- WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
- data->autoopentimer= NULL;
+ if(data->autoopentimer) {
+ WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
+ data->autoopentimer= NULL;
+ }
}
}
@@ -5469,7 +5467,7 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
return menu->dotowards;
}
-int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu))
+static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle *menu, int UNUSED(topmenu))
{
ARegion *ar;
uiBlock *block;
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 788de41202d..5ea74cbf40a 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -614,7 +614,7 @@ static void init_iconfile_list(struct ListBase *list)
/* since BLI_getdir changes the current working directory, restore it
back to old value afterwards */
- if(!BLI_getwdN(olddir))
+ if(!BLI_getwdN(olddir, sizeof(olddir)))
restoredir = 0;
totfile = BLI_getdir(icondirstr, &dir);
if (restoredir && !chdir(olddir)) {} /* fix warning about checking return value */
@@ -705,7 +705,7 @@ ListBase *UI_iconfile_list(void)
}
-void UI_icons_free()
+void UI_icons_free(void)
{
if(icongltex.id) {
glDeleteTextures(1, &icongltex.id);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 7dde0a73d56..154a263cd7b 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -472,8 +472,8 @@ extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *s
struct ThemeUI;
void ui_widget_color_init(struct ThemeUI *tui);
-void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state);
-void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state);
+void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
+void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
/* interface_style.c */
void uiStyleInit(void);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 18bee084f40..330c81fbcb2 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1114,7 +1114,7 @@ typedef struct CollItemSearch {
int iconid;
} CollItemSearch;
-int sort_search_items_list(void *a, void *b)
+static int sort_search_items_list(void *a, void *b)
{
CollItemSearch *cis1 = (CollItemSearch *)a;
CollItemSearch *cis2 = (CollItemSearch *)b;
@@ -2576,8 +2576,7 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y)
/* XXX silly trick, interface_templates.c doesn't get linked
* because it's not used by other files in this module? */
{
- void ui_template_fix_linking(void);
- ui_template_fix_linking();
+ UI_template_fix_linking();
}
}
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 95c52d20c37..9734150ab5c 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -177,7 +177,7 @@ static int eyedropper_poll(bContext *C)
else return 1;
}
-void UI_OT_eyedropper(wmOperatorType *ot)
+static void UI_OT_eyedropper(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Eyedropper";
@@ -207,7 +207,7 @@ static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void UI_OT_reset_default_theme(wmOperatorType *ot)
+static void UI_OT_reset_default_theme(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Reset to Default Theme";
@@ -247,7 +247,7 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void UI_OT_copy_data_path_button(wmOperatorType *ot)
+static void UI_OT_copy_data_path_button(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Copy Data Path";
@@ -297,7 +297,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void UI_OT_reset_default_button(wmOperatorType *ot)
+static void UI_OT_reset_default_button(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Reset to Default Value";
@@ -389,7 +389,7 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op)
return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
}
-void UI_OT_copy_to_selected_button(wmOperatorType *ot)
+static void UI_OT_copy_to_selected_button(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Copy To Selected";
@@ -439,7 +439,7 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void UI_OT_reports_to_textblock(wmOperatorType *ot)
+static void UI_OT_reports_to_textblock(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Reports to Text Block";
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index db4af4c11e5..93b5305fd12 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -309,7 +309,7 @@ static void ui_offset_panel_block(uiBlock *block)
/**************************** drawing *******************************/
/* extern used by previewrender */
-void uiPanelPush(uiBlock *block)
+static void uiPanelPush(uiBlock *block)
{
glPushMatrix();
@@ -317,14 +317,14 @@ void uiPanelPush(uiBlock *block)
glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
}
-void uiPanelPop(uiBlock *UNUSED(block))
+static void uiPanelPop(uiBlock *UNUSED(block))
{
glPopMatrix();
}
/* triangle 'icon' for panel header */
/* NOTE - this seems to be only used for hiding nodes now */
-void ui_draw_tria_icon(float x, float y, char dir)
+void UI_DrawTriIcon(float x, float y, char dir)
{
if(dir=='h') {
ui_draw_anti_tria( x-3,y-5, x-3,y+5, x+7,y );
@@ -335,7 +335,7 @@ void ui_draw_tria_icon(float x, float y, char dir)
}
/* triangle 'icon' inside rect */
-void ui_draw_tria_rect(rctf *rect, char dir)
+static void ui_draw_tria_rect(rctf *rect, char dir)
{
if(dir=='h') {
float half= 0.5f*(rect->ymax - rect->ymin);
@@ -347,7 +347,7 @@ void ui_draw_tria_rect(rctf *rect, char dir)
}
}
-void ui_draw_anti_x(float x1, float y1, float x2, float y2)
+static void ui_draw_anti_x(float x1, float y1, float x2, float y2)
{
/* set antialias line */
@@ -655,7 +655,7 @@ static int compare_panel(const void *a1, const void *a2)
/* this doesnt draw */
/* returns 1 when it did something */
-int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
+static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
{
uiStyle *style= U.uistyles.first;
Panel *pa;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index e8a383dbe15..31523685527 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -130,7 +130,7 @@ static void menudata_add_item(MenuData *md, const char *str, int retval, int ico
md->nitems++;
}
-void menudata_free(MenuData *md)
+static void menudata_free(MenuData *md)
{
MEM_freeN(md->instr);
if (md->items)
@@ -151,7 +151,7 @@ void menudata_free(MenuData *md)
* @param str String to be parsed.
* @retval new menudata structure, free with menudata_free()
*/
-MenuData *decompose_menu_string(char *str)
+static MenuData *decompose_menu_string(char *str)
{
char *instr= BLI_strdup(str);
MenuData *md= menudata_new(instr);
@@ -272,7 +272,7 @@ int ui_step_name_menu(uiBut *but, int step)
/******************** Creating Temporary regions ******************/
-ARegion *ui_add_temporary_region(bScreen *sc)
+static ARegion *ui_add_temporary_region(bScreen *sc)
{
ARegion *ar;
@@ -285,7 +285,7 @@ ARegion *ui_add_temporary_region(bScreen *sc)
return ar;
}
-void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar)
+static void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar)
{
if(CTX_wm_window(C))
wm_draw_region_clear(CTX_wm_window(C), ar);
@@ -1620,7 +1620,7 @@ void ui_set_but_hsv(uiBut *but)
}
/* also used by small picker, be careful with name checks below... */
-void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
+static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
{
uiBut *bt;
float *hsv= ui_block_hsv_get(block);
@@ -2295,7 +2295,8 @@ static void vconfirm_opname(bContext *C, const char *opname, const char *title,
s= buf;
if (title) s+= sprintf(s, "%s%%t|", title);
- vsprintf(s, itemfmt, ap);
+ vsnprintf(s, sizeof(buf) - (s - buf), itemfmt, ap);
+ buf[sizeof(buf) - 1]= '\0';
handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 5e6847cf00d..b27f041ef30 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -59,7 +59,7 @@
#include "BLF_api.h"
-void ui_template_fix_linking(void)
+void UI_template_fix_linking(void)
{
}
@@ -876,7 +876,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
#define REMAKEIPO 8
#define B_DIFF 9
-void do_constraint_panels(bContext *C, void *ob_pt, int event)
+static void do_constraint_panels(bContext *C, void *ob_pt, int event)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index b62108136be..e3c465dd4c8 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1698,7 +1698,7 @@ void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float
*valrad= atan2(mx, my)/(2.0f*M_PI) + 0.5f;
}
-void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
+static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
{
/* gouraud triangle fan */
float radstep, ang= 0.0f;
@@ -3080,7 +3080,7 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
/* helper call to draw a menu item without button */
/* state: UI_ACTIVE or 0 */
-void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state)
+void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
{
uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
rcti _rect= *rect;
@@ -3126,7 +3126,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid,
}
}
-void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, char *name, int iconid, int state)
+void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
{
rcti trect = *rect;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 52e9a395c4e..9ab45ae648b 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1004,10 +1004,8 @@ void init_userdef_do_versions(void)
U.tb_rightmouse= 5;
}
if(U.mixbufsize==0) U.mixbufsize= 2048;
- if (BLI_streq(U.tempdir, "/")) {
- char *tmp= getenv("TEMP");
-
- strcpy(U.tempdir, tmp?tmp:"/tmp/");
+ if (strcmp(U.tempdir, "/") == 0) {
+ BLI_where_is_temp(U.tempdir, sizeof(U.tempdir), FALSE);
}
if (U.autokey_mode == 0) {
/* 'add/replace' but not on */
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index fcc72cba321..92e0d0011f4 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -280,7 +280,7 @@ static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
return OPERATOR_CANCELLED;
}
-void VIEW2D_OT_pan(wmOperatorType *ot)
+static void VIEW2D_OT_pan(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Pan View";
@@ -330,7 +330,7 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void VIEW2D_OT_scroll_right(wmOperatorType *ot)
+static void VIEW2D_OT_scroll_right(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Scroll Right";
@@ -374,7 +374,7 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void VIEW2D_OT_scroll_left(wmOperatorType *ot)
+static void VIEW2D_OT_scroll_left(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Scroll Left";
@@ -422,7 +422,7 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void VIEW2D_OT_scroll_down(wmOperatorType *ot)
+static void VIEW2D_OT_scroll_down(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Scroll Down";
@@ -472,7 +472,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void VIEW2D_OT_scroll_up(wmOperatorType *ot)
+static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Scroll Up";
@@ -699,7 +699,7 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event)
return view_zoomin_exec(C, op);
}
-void VIEW2D_OT_zoom_in(wmOperatorType *ot)
+static void VIEW2D_OT_zoom_in(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Zoom In";
@@ -756,7 +756,7 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
return view_zoomout_exec(C, op);
}
-void VIEW2D_OT_zoom_out(wmOperatorType *ot)
+static void VIEW2D_OT_zoom_out(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Zoom Out";
@@ -1040,7 +1040,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-void VIEW2D_OT_zoom(wmOperatorType *ot)
+static void VIEW2D_OT_zoom(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Zoom View";
@@ -1140,7 +1140,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void VIEW2D_OT_zoom_border(wmOperatorType *ot)
+static void VIEW2D_OT_zoom_border(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Zoom to Border";
@@ -1537,7 +1537,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
/* LMB-Drag in Scrollers - not repeatable operator! */
-void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
+static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Scroller Activate";
@@ -1603,7 +1603,7 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void VIEW2D_OT_reset(wmOperatorType *ot)
+static void VIEW2D_OT_reset(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Reset View";
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
index d1efb60b618..9376a21b23d 100644
--- a/source/blender/editors/mesh/editmesh.c
+++ b/source/blender/editors/mesh/editmesh.c
@@ -989,8 +989,6 @@ void load_editMesh(Scene *scene, Object *obedit)
while(eve) {
VECCOPY(mvert->co, eve->co);
- mvert->mat_nr= 32767; /* what was this for, halos? */
-
/* vertex normal */
VECCOPY(nor, eve->no);
mul_v3_fl(nor, 32767.0);
@@ -1063,20 +1061,6 @@ void load_editMesh(Scene *scene, Object *obedit)
if(efa->f & 1) mface->flag |= ME_FACE_SEL;
else mface->flag &= ~ME_FACE_SEL;
}
-
- /* mat_nr in vertex */
- if(me->totcol>1) {
- mvert= me->mvert+mface->v1;
- if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr;
- mvert= me->mvert+mface->v2;
- if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr;
- mvert= me->mvert+mface->v3;
- if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr;
- if(mface->v4) {
- mvert= me->mvert+mface->v4;
- if(mvert->mat_nr == (char)32767) mvert->mat_nr= mface->mat_nr;
- }
- }
/* watch: efa->e1->f2==0 means loose edge */
@@ -1197,7 +1181,9 @@ void load_editMesh(Scene *scene, Object *obedit)
eve= em->verts.first;
mvert = me->mvert;
while(eve) {
- VECSUB(ofs[i], mvert->co, oldverts[eve->keyindex].co);
+ if(eve->keyindex>=0)
+ VECSUB(ofs[i], mvert->co, oldverts[eve->keyindex].co);
+
eve= eve->next;
i++;
mvert++;
diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c
index 4ffd458d66c..451c341817b 100644
--- a/source/blender/editors/mesh/editmesh_loop.c
+++ b/source/blender/editors/mesh/editmesh_loop.c
@@ -220,9 +220,8 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts)
dist= 50;
nearest = findnearestedge(&vc, &dist); // returns actual distance in dist
// scrarea_do_windraw(curarea); // after findnearestedge, backbuf!
-
- sprintf(msg,"Number of Cuts: %d (S)mooth: ",numcuts);
- strcat(msg, smooth ? "on":"off");
+
+ BLI_snprintf(msg, sizeof(msg),"Number of Cuts: %d (S)mooth: %s", numcuts, smooth ? "on":"off");
// headerprint(msg);
/* Need to figure preview */
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
index 6488dc17fb4..64bd9695ac9 100644
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ b/source/blender/editors/mesh/editmesh_mods.c
@@ -4435,6 +4435,7 @@ static int mesh_noise_exec(bContext *C, wmOperator *op)
ma= give_current_material(obedit, obedit->actcol);
if(ma==0 || ma->mtex[0]==0 || ma->mtex[0]->tex==0) {
+ BKE_report(op->reports, RPT_WARNING, "Mesh has no material or texture assigned.");
return OPERATOR_FINISHED;
}
tex= give_current_material_texture(ma);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9e6f8f7f078..090a9aa358f 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -5984,7 +5984,6 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditVert *eve, *s, *t;
EditEdge *eed;
- EditSelection *ese;
PathEdge *newpe, *currpe;
PathNode *currpn;
PathNode *Q;
@@ -5995,17 +5994,24 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/
s = t = NULL;
+ for(eve=em->verts.first; eve; eve=eve->next) {
+ if(eve->f&SELECT) {
+ if(s == NULL) s= eve;
+ else if(t == NULL) t= eve;
+ else {
+ /* more than two vertices are selected,
+ show warning message and cancel operator */
+ s = t = NULL;
+ break;
+ }
- ese = ((EditSelection*)em->selected.last);
- if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT) {
- t = (EditVert*)ese->data;
- s = (EditVert*)ese->prev->data;
+ }
/*need to find out if t is actually reachable by s....*/
- for(eve=em->verts.first; eve; eve=eve->next){
- eve->f1 = 0;
- }
+ eve->f1 = 0;
+ }
+ if(s != NULL && t != NULL) {
s->f1 = 1;
unbalanced = 1;
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 5f03edb38a2..cfd1b006ece 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -546,77 +546,10 @@ void MESH_OT_sticky_remove(wmOperatorType *ot)
/************************** Add Geometry Layers *************************/
-static void mesh_calc_edges(Mesh *mesh, int update)
-{
- CustomData edata;
- EdgeHashIterator *ehi;
- MFace *mf = mesh->mface;
- MEdge *med, *med_orig;
- EdgeHash *eh = BLI_edgehash_new();
- int i, totedge, totface = mesh->totface;
-
- if(mesh->totedge==0)
- update= 0;
-
- if(update) {
- /* assume existing edges are valid
- * useful when adding more faces and generating edges from them */
- med= mesh->medge;
- for(i= 0; i<mesh->totedge; i++, med++)
- BLI_edgehash_insert(eh, med->v1, med->v2, med);
- }
-
- for (i = 0; i < totface; i++, mf++) {
- if (!BLI_edgehash_haskey(eh, mf->v1, mf->v2))
- BLI_edgehash_insert(eh, mf->v1, mf->v2, NULL);
- if (!BLI_edgehash_haskey(eh, mf->v2, mf->v3))
- BLI_edgehash_insert(eh, mf->v2, mf->v3, NULL);
-
- if (mf->v4) {
- if (!BLI_edgehash_haskey(eh, mf->v3, mf->v4))
- BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
- if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
- BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
- } else {
- if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
- BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
- }
- }
-
- totedge = BLI_edgehash_size(eh);
-
- /* write new edges into a temporary CustomData */
- memset(&edata, 0, sizeof(edata));
- CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
-
- ehi = BLI_edgehashIterator_new(eh);
- med = CustomData_get_layer(&edata, CD_MEDGE);
- for(i = 0; !BLI_edgehashIterator_isDone(ehi);
- BLI_edgehashIterator_step(ehi), ++i, ++med) {
-
- if(update && (med_orig=BLI_edgehashIterator_getValue(ehi))) {
- *med= *med_orig; /* copy from the original */
- } else {
- BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, (int*)&med->v2);
- med->flag = ME_EDGEDRAW|ME_EDGERENDER|SELECT; /* select for newly created meshes which are selected [#25595] */
- }
- }
- BLI_edgehashIterator_free(ehi);
-
- /* free old CustomData and assign new one */
- CustomData_free(&mesh->edata, mesh->totedge);
- mesh->edata = edata;
- mesh->totedge = totedge;
-
- mesh->medge = CustomData_get_layer(&mesh->edata, CD_MEDGE);
-
- BLI_edgehash_free(eh, NULL);
-}
-
void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges)
{
if(calc_edges || (mesh->totface && mesh->totedge == 0))
- mesh_calc_edges(mesh, calc_edges);
+ BKE_mesh_calc_edges(mesh, calc_edges);
mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL);
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index eee17bc78ef..08a31923cda 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -404,6 +404,8 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
ob->pd= object_add_collision_fields(type);
+ DAG_scene_sort(CTX_data_main(C), CTX_data_scene(C));
+
return ob;
}
@@ -1114,6 +1116,15 @@ static int convert_exec(bContext *C, wmOperator *op)
base->flag &= ~SELECT;
ob->flag &= ~SELECT;
}
+
+ /* obdata already modified */
+ if(!IS_TAGGED(ob->data)) {
+ /* When 2 objects with linked data are selected, converting both
+ * would keep modifiers on all but the converted object [#26003] */
+ if(ob->type == OB_MESH) {
+ object_free_modifiers(ob); /* after derivedmesh calls! */
+ }
+ }
}
else if (ob->type==OB_MESH && target == OB_CURVE) {
ob->flag |= OB_DONE;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index f695f112bc0..f3346bf200c 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -405,11 +405,26 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
for (ct= targets.first; ct; ct= ct->next) {
/* general validity checks (for those constraints that need this) */
if (exist_object(ct->tar) == 0) {
+ /* object doesn't exist, but constraint requires target */
ct->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
else if (ct->tar == owner) {
- if (!get_named_bone(get_armature(owner), ct->subtarget)) {
+ if (type == CONSTRAINT_OBTYPE_BONE) {
+ if (!get_named_bone(get_armature(owner), ct->subtarget)) {
+ /* bone must exist in armature... */
+ // TODO: clear subtarget?
+ curcon->flag |= CONSTRAINT_DISABLE;
+ }
+ else if (strcmp(pchan->name, ct->subtarget) == 0) {
+ /* cannot target self */
+ ct->subtarget[0] = '\0';
+ curcon->flag |= CONSTRAINT_DISABLE;
+ }
+ }
+ else {
+ /* cannot use self as target */
+ ct->tar = NULL;
curcon->flag |= CONSTRAINT_DISABLE;
}
}
@@ -1257,12 +1272,12 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
bPoseChannel *pchan;
bConstraint *con;
- if(list == &ob->constraints) {
+ if (list == &ob->constraints) {
pchan= NULL;
}
else {
pchan= get_active_posechannel(ob);
-
+
/* ensure not to confuse object/pose adding */
if (pchan == NULL) {
BKE_report(op->reports, RPT_ERROR, "No active pose bone to add a constraint to.");
@@ -1312,19 +1327,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
}
/* do type-specific tweaking to the constraint settings */
- // TODO: does action constraint need anything here - i.e. spaceonce?
switch (type) {
- case CONSTRAINT_TYPE_CHILDOF:
- {
- /* if this constraint is being added to a posechannel, make sure
- * the constraint gets evaluated in pose-space */
- if (pchan) {
- con->ownspace = CONSTRAINT_SPACE_POSE;
- con->flag |= CONSTRAINT_SPACEONCE;
- }
- }
- break;
-
case CONSTRAINT_TYPE_PYTHON: // FIXME: this code is not really valid anymore
{
#ifdef WITH_PYTHON
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0acdc8b61fe..bb83827b2cb 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -587,7 +587,7 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot)
ot->poll= ED_operator_object_active_editable;
/* flag */
- ot->flag= OPTYPE_REGISTER;
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
/* *********************** */
@@ -744,9 +744,9 @@ void special_editmenu(Scene *scene, View3D *v3d)
MTFace *tface;
MFace *mface;
int a;
-
- if(me==0 || me->mtface==0) return;
-
+
+ if(me==NULL || me->mtface==NULL) return;
+
nr= pupmenu("Specials%t|Set Tex%x1| Shared%x2| Light%x3| Invisible%x4| Collision%x5| TwoSide%x6|Clr Tex%x7| Shared%x8| Light%x9| Invisible%x10| Collision%x11| TwoSide%x12");
tface= me->mtface;
@@ -768,7 +768,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
tface->mode |= TF_TWOSIDE; break;
case 7:
tface->mode &= ~TF_TEX;
- tface->tpage= 0;
+ tface->tpage= NULL;
break;
case 8:
tface->mode &= ~TF_SHAREDCOL; break;
@@ -788,7 +788,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
else if(ob->mode & OB_MODE_VERTEX_PAINT) {
Mesh *me= get_mesh(ob);
- if(me==0 || (me->mcol==NULL && me->mtface==NULL) ) return;
+ if(me==NULL || (me->mcol==NULL && me->mtface==NULL) ) return;
nr= pupmenu("Specials%t|Shared VertexCol%x1");
if(nr==1) {
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index b2edd786d50..0f8e5cec21b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1377,6 +1377,11 @@ void single_object_users(Scene *scene, View3D *v3d, int flag)
for(base= FIRSTBASE; base; base= base->next) {
ob= base->object;
+ /* newid may still have some trash from Outliner tree building,
+ * so clear that first to avoid errors [#26002]
+ */
+ ob->id.newid = NULL;
+
if( (base->flag & flag)==flag ) {
if(ob->id.lib==NULL && ob->id.us>1) {
/* base gets copy of object */
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 024e3e8a020..355f1c153cf 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -744,7 +744,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
total++;
add_v3_v3(cent, eve->co);
}
- mul_v3_fl(cent, 1.0f/(float)total);
+ if(total) {
+ mul_v3_fl(cent, 1.0f/(float)total);
+ }
}
else {
for(eve= em->verts.first; eve; eve= eve->next) {
@@ -753,13 +755,15 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
mid_v3_v3v3(cent, min, max);
}
- for(eve= em->verts.first; eve; eve= eve->next) {
- sub_v3_v3(eve->co, cent);
- }
+ if(!is_zero_v3(cent)) {
+ for(eve= em->verts.first; eve; eve= eve->next) {
+ sub_v3_v3(eve->co, cent);
+ }
- recalc_editnormals(em);
- tot_change++;
- DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+ recalc_editnormals(em);
+ tot_change++;
+ DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+ }
BKE_mesh_end_editmesh(me, em);
}
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index bd7983004eb..c673ea0fd2d 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -550,7 +550,7 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
return get_vert_def_nr(ob, def_nr, vertnum);
}
-void ED_vgroup_select_by_name(Object *ob, char *name)
+void ED_vgroup_select_by_name(Object *ob, const char *name)
{ /* note: ob->actdef==0 signals on painting to create a new one, if a bone in posemode is selected */
ob->actdef= defgroup_name_index(ob, name) + 1;
}
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 4e08dd49703..608c0f70c3e 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -641,10 +641,10 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
-
- strcpy(targetFile, targetDir);
- strcat(targetFile, suffixConfig);
- strcat(targetFile,".tmp"); // dont overwrite/delete original file
+
+ // .tmp: dont overwrite/delete original file
+ BLI_snprintf(targetFile, sizeof(targetFile), "%s%s.tmp", targetDir, suffixConfig);
+
// make sure all directories exist
// as the bobjs use the same dir, this only needs to be checked
// for the cfg output
@@ -664,19 +664,13 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
char blendFile[FILE_MAXDIR+FILE_MAXFILE];
// invalid dir, reset to current/previous
- strcpy(blendDir, G.main->name);
+ BLI_strncpy(blendDir, G.main->name, sizeof(blendDir));
BLI_splitdirstring(blendDir, blendFile);
- if(BLI_strnlen(blendFile, 7) > 6){
- int len = strlen(blendFile);
- if( (blendFile[len-6]=='.')&& (blendFile[len-5]=='b')&& (blendFile[len-4]=='l')&&
- (blendFile[len-3]=='e')&& (blendFile[len-2]=='n')&& (blendFile[len-1]=='d') ){
- blendFile[len-6] = '\0';
- }
- }
- // todo... strip .blend ?
- snprintf(newSurfdataPath,FILE_MAXFILE+FILE_MAXDIR,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
+ BLI_replace_extension(blendFile, sizeof(blendFile), ""); /* strip .blend */
+
+ BLI_snprintf(newSurfdataPath, sizeof(newSurfdataPath) ,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
- snprintf(debugStrBuffer,256,"fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
+ BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer), "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
elbeemDebugOut(debugStrBuffer);
outStringsChanged=1;
}
@@ -686,14 +680,14 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
if(outStringsChanged) {
char dispmsg[FILE_MAXDIR+FILE_MAXFILE+256];
int selection=0;
- strcpy(dispmsg,"Output settings set to: '");
+ BLI_strncpy(dispmsg,"Output settings set to: '", sizeof(dispmsg));
strcat(dispmsg, newSurfdataPath);
strcat(dispmsg, "'%t|Continue with changed settings%x1|Discard and abort%x0");
// ask user if thats what he/she wants...
selection = pupmenu(dispmsg);
if(selection<1) return 0; // 0 from menu, or -1 aborted
- strcpy(targetDir, newSurfdataPath);
+ BLI_strncpy(targetDir, newSurfdataPath, sizeof(targetDir));
strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
}
@@ -957,9 +951,8 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
}
/* ******** start writing / exporting ******** */
- strcpy(targetFile, targetDir);
- strcat(targetFile, suffixConfig);
- strcat(targetFile,".tmp"); // dont overwrite/delete original file
+ // use .tmp, dont overwrite/delete original file
+ BLI_snprintf(targetFile, sizeof(targetFile), "%s%s.tmp", targetDir, suffixConfig);
// make sure these directories exist as well
if(outStringsChanged) {
@@ -987,8 +980,8 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
fsset->aniFrameTime = channels->aniFrameTime;
fsset->noOfFrames = noFrames; // is otherwise subtracted in parser
- strcpy(targetFile, targetDir);
- strcat(targetFile, suffixSurface);
+ BLI_snprintf(targetFile, sizeof(targetFile), "%s%s", targetDir, suffixSurface);
+
// defaults for compressibility and adaptive grids
fsset->gstar = domainSettings->gstar;
fsset->maxRefine = domainSettings->maxRefine; // check <-> gridlevels
@@ -997,7 +990,7 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain)
fsset->surfaceSmoothing = domainSettings->surfaceSmoothing;
fsset->surfaceSubdivs = domainSettings->surfaceSubdivs;
fsset->farFieldSize = domainSettings->farFieldSize;
- strcpy( fsset->outputPath, targetFile);
+ BLI_strncpy(fsset->outputPath, targetFile, sizeof(fsset->outputPath));
// domain channels
fsset->channelSizeFrameTime =
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 96994ab1df4..341f56667fa 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -594,7 +594,14 @@ static void render_endjob(void *rjv)
free_main(rj->main);
/* else the frame will not update for the original value */
- ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1);
+ if(!(rj->scene->r.scemode & R_NO_FRAME_UPDATE))
+ ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1);
+
+ /* XXX above function sets all tags in nodes */
+ ntreeClearTags(rj->scene->nodetree);
+
+ /* potentially set by caller */
+ rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE;
if(rj->srl) {
NodeTagIDChanged(rj->scene->nodetree, &rj->scene->id);
@@ -648,6 +655,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
wmJob *steve;
RenderJob *rj;
Image *ima;
+ int jobflag;
const short is_animation= RNA_boolean_get(op->ptr, "animation");
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
@@ -701,6 +709,8 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* ensure at least 1 area shows result */
screen_set_image_output(C, event->x, event->y);
+ jobflag= WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS;
+
/* single layer re-render */
if(RNA_property_is_set(op->ptr, "layer")) {
SceneRenderLayer *rl;
@@ -712,11 +722,12 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
rl = (SceneRenderLayer *)BLI_findstring(&scene->r.layers, rl_name, offsetof(SceneRenderLayer, name));
-
+
if (scn && rl) {
scene = scn;
srl = rl;
}
+ jobflag |= WM_JOB_SUSPEND;
}
/* job custom data */
@@ -733,7 +744,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj->reports= op->reports;
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Render", WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS);
+ steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Render", jobflag);
WM_jobs_customdata(steve, rj, render_freejob);
WM_jobs_timer(steve, 0.2, NC_SCENE|ND_RENDER_RESULT, 0);
WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 5126ba27de8..852f006aa9a 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -34,6 +34,7 @@
#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_world_types.h"
@@ -1254,6 +1255,7 @@ static int texture_slot_move(bContext *C, wmOperator *op)
}
}
+ DAG_id_tag_update(id, 0);
WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
}
@@ -1572,6 +1574,9 @@ void copy_mtex_copybuf(ID *id)
mtex= &(((World *)id)->mtex[(int)((World *)id)->texact]);
// mtex= wrld->mtex[(int)wrld->texact]; // TODO
break;
+ case ID_PA:
+ mtex= &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
+ break;
}
if(mtex && *mtex) {
@@ -1602,6 +1607,9 @@ void paste_mtex_copybuf(ID *id)
mtex= &(((World *)id)->mtex[(int)((World *)id)->texact]);
// mtex= wrld->mtex[(int)wrld->texact]; // TODO
break;
+ case ID_PA:
+ mtex= &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
+ break;
}
if(mtex) {
@@ -1666,6 +1674,7 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
Lamp *la= CTX_data_pointer_get_type(C, "lamp", &RNA_Lamp).data;
World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
+ ParticleSystem *psys= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
if (ma)
id = &ma->id;
@@ -1673,6 +1682,8 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
id = &la->id;
else if (wo)
id = &wo->id;
+ else if (psys)
+ id = &psys->part->id;
if (id==NULL)
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 5ea5fe06c46..4784f19012e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -164,27 +164,22 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
static void area_draw_azone(short x1, short y1, short x2, short y2)
{
- float xmin = x1;
- float xmax = x2-2;
- float ymin = y1-1;
- float ymax = y2-3;
-
- float dx= 0.3f*(xmax-xmin);
- float dy= 0.3f*(ymax-ymin);
+ int dx= floor(0.3f*(x2-x1));
+ int dy= floor(0.3f*(y2-y1));
glColor4ub(255, 255, 255, 180);
- fdrawline(xmin, ymax, xmax, ymin);
+ fdrawline(x1, y2, x2, y1);
glColor4ub(255, 255, 255, 130);
- fdrawline(xmin, ymax-dy, xmax-dx, ymin);
+ fdrawline(x1, y2-dy, x2-dx, y1);
glColor4ub(255, 255, 255, 80);
- fdrawline(xmin, ymax-2*dy, xmax-2*dx, ymin);
+ fdrawline(x1, y2-2*dy, x2-2*dx, y1);
glColor4ub(0, 0, 0, 210);
- fdrawline(xmin, ymax+1, xmax+1, ymin);
+ fdrawline(x1, y2+1, x2+1, y1);
glColor4ub(0, 0, 0, 180);
- fdrawline(xmin, ymax-dy+1, xmax-dx+1, ymin);
+ fdrawline(x1, y2-dy+1, x2-dx+1, y1);
glColor4ub(0, 0, 0, 150);
- fdrawline(xmin, ymax-2*dy+1, xmax-2*dx+1, ymin);
+ fdrawline(x1, y2-2*dy+1, x2-2*dx+1, y1);
}
@@ -451,7 +446,6 @@ void ED_area_headerprint(ScrArea *sa, const char *str)
/* ************************************************************ */
-#define AZONESPOT 12
static void area_azone_initialize(ScrArea *sa)
{
AZone *az;
@@ -465,8 +459,8 @@ static void area_azone_initialize(ScrArea *sa)
az->type= AZONE_AREA;
az->x1= sa->totrct.xmin;
az->y1= sa->totrct.ymin;
- az->x2= sa->totrct.xmin + AZONESPOT-1;
- az->y2= sa->totrct.ymin + AZONESPOT-1;
+ az->x2= sa->totrct.xmin + AZONESPOT;
+ az->y2= sa->totrct.ymin + AZONESPOT;
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
az= (AZone *)MEM_callocN(sizeof(AZone), "actionzone");
@@ -474,13 +468,13 @@ static void area_azone_initialize(ScrArea *sa)
az->type= AZONE_AREA;
az->x1= sa->totrct.xmax+1;
az->y1= sa->totrct.ymax+1;
- az->x2= sa->totrct.xmax-AZONESPOT+1;
- az->y2= sa->totrct.ymax-AZONESPOT+1;
+ az->x2= sa->totrct.xmax-AZONESPOT;
+ az->y2= sa->totrct.ymax-AZONESPOT;
BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
}
#define AZONEPAD_EDGE 4
-#define AZONEPAD_ICON 8
+#define AZONEPAD_ICON 9
static void region_azone_edge(AZone *az, ARegion *ar)
{
switch(az->edge) {
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 9b3a51805e9..a39039b254f 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -765,7 +765,7 @@ void bglBegin(int mode)
}
}
-int bglPointHack() {
+int bglPointHack(void) {
float value[4];
int pointhack_px;
glGetFloatv(GL_POINT_SIZE_RANGE, value);
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 87b397382a3..ee448e70779 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -32,6 +32,8 @@
struct wmWindow;
struct Scene;
+#define AZONESPOT 12
+
/* area.c */
void area_copy_data (ScrArea *sa1, ScrArea *sa2, int swap_space);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index b6c92982560..9267f4d4e80 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -474,7 +474,10 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
for(az= sa->actionzones.first; az; az= az->next) {
if(BLI_in_rcti(&az->rect, x, y)) {
if(az->type == AZONE_AREA) {
- if(isect_point_tri_v2_int(az->x1, az->y1, az->x2, az->y2, x, y))
+ /* no triangle intersect but a hotspot circle based on corner */
+ int radius= (x-az->x1)*(x-az->x1) + (y-az->y1)*(y-az->y1);
+
+ if(radius <= AZONESPOT*AZONESPOT)
break;
}
else if(az->type == AZONE_REGION) {
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index ba73c488c46..6a8d5043c43 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5452,10 +5452,10 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
idgroup= IDP_GetProperties(&image->id, 0);
if(idgroup) {
- view_data= IDP_GetPropertyFromGroup(idgroup, PROJ_VIEW_DATA_ID);
+ view_data= IDP_GetPropertyTypeFromGroup(idgroup, PROJ_VIEW_DATA_ID, IDP_ARRAY);
/* type check to make sure its ok */
- if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->type != IDP_ARRAY || view_data->subtype != IDP_FLOAT) {
+ if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) {
BKE_report(op->reports, RPT_ERROR, "Image project data invalid.");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 0fb3bc34d5b..69e42d87148 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -64,8 +64,11 @@
#include "WM_api.h"
#include "WM_types.h"
+
+#include "ED_sculpt.h"
#include "ED_screen.h"
#include "ED_view3d.h"
+#include "ED_util.h" /* for crazyspace correction */
#include "paint_intern.h"
#include "sculpt_intern.h"
@@ -169,7 +172,7 @@ int sculpt_modifiers_active(Scene *scene, Object *ob)
if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
if(md->type==eModifierType_ShapeKey) continue;
- if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatrices)
+ if(mti->type==eModifierTypeType_OnlyDeform)
return 1;
}
@@ -1256,7 +1259,7 @@ static void do_pinch_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int
if(vd.mvert)
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
- }
+ }
}
BLI_pbvh_vertex_iter_end;
}
@@ -2353,17 +2356,36 @@ static void do_brush_action(Sculpt *sd, SculptSession *ss, Brush *brush)
}
}
+/* flush displacement from deformed PBVH vertex to original mesh */
+static void sculpt_flush_pbvhvert_deform(SculptSession *ss, PBVHVertexIter *vd)
+{
+ Object *ob= ss->ob;
+ Mesh *me= ob->data;
+ float disp[3], newco[3];
+ int index= vd->vert_indices[vd->i];
+
+ sub_v3_v3v3(disp, vd->co, ss->deform_cos[index]);
+ mul_m3_v3(ss->deform_imats[index], disp);
+ add_v3_v3v3(newco, disp, ss->orig_cos[index]);
+
+ copy_v3_v3(ss->deform_cos[index], vd->co);
+ copy_v3_v3(ss->orig_cos[index], newco);
+
+ if(!ss->kb)
+ copy_v3_v3(me->mvert[index].co, newco);
+}
+
static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss)
{
Brush *brush= paint_brush(&sd->paint);
PBVHNode** nodes;
- int use_orco, totnode, n;
+ int totnode, n;
BLI_pbvh_gather_proxies(ss->pbvh, &nodes, &totnode);
if(!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
/* these brushes start from original coordinates */
- use_orco = (ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB,
+ const int use_orco = (ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB,
SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB));
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
@@ -2391,6 +2413,9 @@ static void sculpt_combine_proxies(Sculpt *sd, SculptSession *ss)
add_v3_v3(val, proxies[p].co[vd.i]);
sculpt_clip(sd, ss, vd.co, val);
+
+ if(ss->modifiers_active)
+ sculpt_flush_pbvhvert_deform(ss, &vd);
}
BLI_pbvh_vertex_iter_end;
@@ -2421,38 +2446,17 @@ static void sculpt_update_keyblock(SculptSession *ss)
}
/* flush displacement from deformed PBVH to original layer */
-static void sculpt_flush_deformation(SculptSession *ss)
+static void sculpt_flush_stroke_deform(SculptSession *ss)
{
- float (*vertCos)[3];
-
- vertCos= BLI_pbvh_get_vertCos(ss->pbvh);
-
- if (vertCos) {
+ if(!ss->kb) {
Object *ob= ss->ob;
Mesh *me= (Mesh*)ob->data;
- MVert *mvert= me->mvert;
- int a;
-
- for(a = 0; a < me->totvert; ++a, ++mvert) {
- float disp[3], newco[3];
- sub_v3_v3v3(disp, vertCos[a], ss->deform_cos[a]);
- mul_m3_v3(ss->deform_imats[a], disp);
- add_v3_v3v3(newco, disp, ss->orig_cos[a]);
-
- copy_v3_v3(ss->deform_cos[a], vertCos[a]);
- copy_v3_v3(ss->orig_cos[a], newco);
-
- if(!ss->kb)
- copy_v3_v3(mvert->co, newco);
- }
-
- if(ss->kb)
- sculpt_update_keyblock(ss);
+ /* Modifiers could depend on mesh normals, so we should update them/
+ Note, then if sculpting happens on locked key, normals should be re-calculated
+ after applying coords from keyblock on base mesh */
mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-
- MEM_freeN(vertCos);
- }
+ } else sculpt_update_keyblock(ss);
}
//static int max_overlap_count(Sculpt *sd)
@@ -2564,7 +2568,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd, SculptSession *ss)
sculpt_fix_noise_tear(sd, ss);
if (ss->modifiers_active)
- sculpt_flush_deformation(ss);
+ sculpt_flush_stroke_deform(ss);
cache->first_time= 0;
}
@@ -2641,7 +2645,7 @@ void sculpt_update_mesh_elements(Scene *scene, Object *ob, int need_fmap)
if(ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb);
else ss->orig_cos = mesh_getVertexCos(ob->data, NULL);
- sculpt_get_deform_matrices(scene, ob, &ss->deform_imats, &ss->deform_cos);
+ crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
BLI_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
for(a = 0; a < ((Mesh*)ob->data)->totvert; ++a)
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index d136fdaf6e0..d88d7a5ac49 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -49,6 +49,7 @@
#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_key.h"
+#include "BKE_mesh.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -184,6 +185,9 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
tag_update= ((Mesh*)ob->data)->id.us > 1;
if(ss->modifiers_active) {
+ Mesh *me= ob->data;
+ mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+
sculpt_free_deformMats(ss);
tag_update|= 1;
}
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 004fb33f0dd..30edc659fcb 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -209,7 +209,7 @@ void SOUND_OT_pack(wmOperatorType *ot)
static int sound_unpack_exec(bContext *C, wmOperator *op)
{
int method= RNA_enum_get(op->ptr, "method");
- bSound* sound;
+ bSound* sound= NULL;
/* find the suppplied image by name */
if (RNA_property_is_set(op->ptr, "id")) {
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index b0b1c23cbc0..ee8b67a146a 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -66,6 +66,7 @@ typedef struct ButsContextPath {
PointerRNA ptr[8];
int len;
int flag;
+ int tex_ctx;
} ButsContextPath;
static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type)
@@ -359,6 +360,7 @@ static int buttons_context_path_texture(ButsContextPath *path)
Lamp *la;
Brush *br;
World *wo;
+ ParticleSystem *psys;
Tex *tex;
PointerRNA *ptr= &path->ptr[path->len-1];
int orig_len = path->len;
@@ -368,7 +370,7 @@ static int buttons_context_path_texture(ButsContextPath *path)
return 1;
}
/* try brush */
- if((path->flag & SB_BRUSH_TEX) && buttons_context_path_brush(path)) {
+ if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) {
br= path->ptr[path->len-1].data;
if(br) {
@@ -380,7 +382,7 @@ static int buttons_context_path_texture(ButsContextPath *path)
}
}
/* try world */
- if((path->flag & SB_WORLD_TEX) && buttons_context_path_world(path)) {
+ if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
wo= path->ptr[path->len-1].data;
if(wo && GS(wo->id.name)==ID_WO) {
@@ -391,6 +393,18 @@ static int buttons_context_path_texture(ButsContextPath *path)
return 1;
}
}
+ /* try particles */
+ if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) {
+ psys= path->ptr[path->len-1].data;
+
+ if(psys && psys->part && GS(psys->part->id.name)==ID_PA) {
+ tex= give_current_particle_texture(psys->part);
+
+ RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+ }
/* try material */
if(buttons_context_path_material(path)) {
ma= path->ptr[path->len-1].data;
@@ -442,6 +456,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
memset(path, 0, sizeof(*path));
path->flag= flag;
+ path->tex_ctx = sbuts->texture_context;
/* if some ID datablock is pinned, set the root pointer */
if(sbuts->pinid) {
@@ -534,13 +549,12 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
{
ButsContextPath *path;
PointerRNA *ptr;
- int a, pflag, flag= 0;
+ int a, pflag= 0, flag= 0;
if(!sbuts->path)
sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
path= sbuts->path;
- pflag= (sbuts->flag & (SB_WORLD_TEX|SB_BRUSH_TEX));
/* for each context, see if we can compute a valid path to it, if
* this is the case, we know we have to display the button */
@@ -732,6 +746,12 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
if(br)
CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex);
}
+ else if((ptr=get_pointer_type(path, &RNA_ParticleSystem))) {
+ ParticleSettings *part= ((ParticleSystem *)ptr->data)->part;
+
+ if(part)
+ CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]);
+ }
return 1;
}
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index bd1674aa307..bfc5a27883d 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -38,7 +38,7 @@
#include "ED_screen.h"
#include "ED_types.h"
-
+#include "DNA_object_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -50,6 +50,28 @@
#define B_CONTEXT_SWITCH 101
#define B_BUTSPREVIEW 102
+static void set_texture_context(bContext *C, SpaceButs *sbuts)
+{
+ switch(sbuts->mainb) {
+ case BCONTEXT_MATERIAL:
+ sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
+ break;
+ case BCONTEXT_DATA:
+ {
+ Object *ob = CTX_data_active_object(C);
+ if(ob && ob->type==OB_LAMP)
+ sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
+ break;
+ }
+ case BCONTEXT_WORLD:
+ sbuts->texture_context = SB_TEXC_WORLD;
+ break;
+ case BCONTEXT_PARTICLE:
+ sbuts->texture_context = SB_TEXC_PARTICLES;
+ break;
+ }
+}
+
static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
{
SpaceButs *sbuts= CTX_wm_space_buts(C);
@@ -62,11 +84,7 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
case B_BUTSPREVIEW:
ED_area_tag_redraw(CTX_wm_area(C));
- /* silly exception */
- if(sbuts->mainb == BCONTEXT_WORLD)
- sbuts->flag |= SB_WORLD_TEX;
- else if(sbuts->mainb != BCONTEXT_TEXTURE)
- sbuts->flag &= ~SB_WORLD_TEX;
+ set_texture_context(C, sbuts);
sbuts->preview= 1;
break;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index b33231f190c..61485987cc9 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -281,6 +281,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
case ND_PARTICLE:
if (wmn->action == NA_EDITED)
buttons_area_redraw(sa, BCONTEXT_PARTICLE);
+ sbuts->preview= 1;
break;
case ND_DRAW:
buttons_area_redraw(sa, BCONTEXT_OBJECT);
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 2d4501e6005..ba9993cfe60 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -188,7 +188,7 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegion *ar, int draw, int mval[2], void **mouse_pick, int *pos_pick)
{
- ConsoleLine cl_dummy= {0};
+ ConsoleLine cl_dummy= {NULL};
int ret= 0;
View2D *v2d= &ar->v2d;
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 55dc19d9bb9..fea50f1f2aa 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -541,7 +541,7 @@ void FILE_OT_cancel(struct wmOperatorType *ot)
void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
{
- BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file);
+ BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
if(RNA_struct_find_property(op->ptr, "relative_path")) {
if(RNA_boolean_get(op->ptr, "relative_path")) {
BLI_path_rel(filepath, G.main->name);
@@ -639,7 +639,7 @@ int file_draw_check_exists(SpaceFile *sfile)
if(RNA_struct_find_property(sfile->op->ptr, "check_existing")) {
if(RNA_boolean_get(sfile->op->ptr, "check_existing")) {
char filepath[FILE_MAX];
- BLI_join_dirfile(filepath, sfile->params->dir, sfile->params->file);
+ BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file);
if(BLI_exists(filepath) && !BLI_is_dir(filepath)) {
return TRUE;
}
@@ -929,13 +929,13 @@ static int new_folder_path(const char* parent, char *folder, char *name)
int len = 0;
BLI_strncpy(name, "New Folder", FILE_MAXFILE);
- BLI_join_dirfile(folder, parent, name);
+ BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */
/* check whether folder with the name already exists, in this case
add number to the name. Check length of generated name to avoid
crazy case of huge number of folders each named 'New Folder (x)' */
while (BLI_exists(folder) && (len<FILE_MAXFILE)) {
len = BLI_snprintf(name, FILE_MAXFILE, "New Folder(%d)", i);
- BLI_join_dirfile(folder, parent, name);
+ BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */
i++;
}
@@ -1017,8 +1017,8 @@ static void file_expand_directory(bContext *C)
if(sfile->params) {
if ( sfile->params->dir[0] == '~' ) {
char tmpstr[sizeof(sfile->params->dir)-1];
- strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr));
- BLI_join_dirfile(sfile->params->dir, BLI_getDefaultDocumentFolder(), tmpstr);
+ BLI_strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr));
+ BLI_join_dirfile(sfile->params->dir, sizeof(sfile->params->dir), BLI_getDefaultDocumentFolder(), tmpstr);
}
#ifdef WIN32
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index ec4733c171c..b92b95e2efd 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -395,7 +395,7 @@ void filelist_free_icons(void)
}
//-----------------FOLDERLIST (previous/next) --------------//
-struct ListBase* folderlist_new()
+struct ListBase* folderlist_new(void)
{
ListBase* p = MEM_callocN( sizeof(ListBase), "folderlist" );
return p;
@@ -833,13 +833,13 @@ void filelist_setfiletypes(struct FileList* filelist)
static void filelist_read_dir(struct FileList* filelist)
{
- char wdir[FILE_MAX];
+ char wdir[FILE_MAX]= "";
if (!filelist) return;
filelist->fidx = 0;
filelist->filelist = 0;
- BLI_getwdN(wdir);
+ BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */
BLI_cleanup_dir(G.main->name, filelist->dir);
filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist));
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 939a8450cb6..9092e639542 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -347,7 +347,7 @@ float file_string_width(const char* str)
return BLF_width(style->widget.uifont_id, str);
}
-float file_font_pointsize()
+float file_font_pointsize(void)
{
#if 0
float s;
@@ -555,7 +555,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
char path[FILE_MAX];
struct stat status;
- BLI_join_dirfile(path, dirname, de->d_name);
+ BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
if (stat(path, &status) == 0) {
if (S_ISDIR(status.st_mode)) { /* is subdir */
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index b2e9f93685e..901ede9fff7 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -138,7 +138,7 @@ static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
/* Points ---------------- */
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_vertices_keyframes (FCurve *fcu, View2D *v2d, short edit, short sel)
+static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
{
BezTriple *bezt= fcu->bezt;
const float fac= 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
@@ -210,7 +210,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys
}
/* helper func - draw handle vertices only for an F-Curve (if it is not protected) */
-static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, short sel_handle_only)
+static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v2d, short sel, short sel_handle_only)
{
BezTriple *bezt= fcu->bezt;
BezTriple *prevbezt = NULL;
@@ -226,7 +226,7 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, s
else UI_ThemeColor(TH_HANDLE_VERTEX);
/* anti-aliased lines for more consistent appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
for (i=0; i < fcu->totvert; i++, prevbezt=bezt, bezt++) {
@@ -251,7 +251,7 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, View2D *v2d, short sel, s
}
}
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -275,7 +275,7 @@ static void set_fcurve_vertex_color (FCurve *fcu, short sel)
}
-static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
+static void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short do_handles, short sel_handle_only)
{
View2D *v2d= &ar->v2d;
@@ -292,18 +292,18 @@ static void draw_fcurve_vertices (ARegion *ar, FCurve *fcu, short do_handles, sh
if (do_handles)
{
set_fcurve_vertex_color(fcu, 0);
- draw_fcurve_vertices_handles(fcu, v2d, 0, sel_handle_only);
+ draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only);
set_fcurve_vertex_color(fcu, 1);
- draw_fcurve_vertices_handles(fcu, v2d, 1, sel_handle_only);
+ draw_fcurve_vertices_handles(fcu, sipo, v2d, 1, sel_handle_only);
}
/* draw keyframes over the handles */
set_fcurve_vertex_color(fcu, 0);
- draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
+ draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 0);
set_fcurve_vertex_color(fcu, 1);
- draw_fcurve_vertices_keyframes(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
+ draw_fcurve_vertices_keyframes(fcu, sipo, v2d, !(fcu->flag & FCURVE_PROTECTED), 1);
glPointSize(1.0f);
}
@@ -407,7 +407,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
UI_GetThemeColor3ubv(basecol + bezt->h2, col);
col[3]= drawFCurveFade(fcu) * 255;
glColor4ubv((GLubyte *)col);
-
+
glVertex2fv(fp); glVertex2fv(fp+3);
}
}
@@ -456,7 +456,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys
}
/* helper func - draw keyframe vertices only for an F-Curve */
-static void draw_fcurve_samples (ARegion *ar, FCurve *fcu)
+static void draw_fcurve_samples (SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@@ -476,14 +476,14 @@ static void draw_fcurve_samples (ARegion *ar, FCurve *fcu)
/* draw */
if (first && last) {
/* anti-aliased lines for more consistent appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
draw_fcurve_sample_control(first->vec[0], first->vec[1], xscale, yscale, hsize);
draw_fcurve_sample_control(last->vec[0], last->vec[1], xscale, yscale, hsize);
glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
}
}
@@ -794,7 +794,7 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
glLineWidth(3.0f);
/* anti-aliased lines for less jagged appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
/* the ghost curves are simply sampled F-Curves stored in sipo->ghostCurves */
@@ -813,7 +813,7 @@ void graph_draw_ghost_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
setlinestyle(0);
glLineWidth(1.0f);
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -871,7 +871,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
}
/* anti-aliased lines for less jagged appearance */
- glEnable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
/* draw F-Curve */
@@ -892,7 +892,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
/* restore settings */
setlinestyle(0);
- glDisable(GL_LINE_SMOOTH);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF)==0) glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
@@ -924,11 +924,11 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
glDisable(GL_BLEND);
}
- draw_fcurve_vertices(ar, fcu, do_handles, sipo->flag&SIPO_SELVHANDLESONLY);
+ draw_fcurve_vertices(sipo, ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
}
else {
/* samples: only draw two indicators at either end as indicators */
- draw_fcurve_samples(ar, fcu);
+ draw_fcurve_samples(sipo, ar, fcu);
}
/* unapply unit mapping */
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 3932caeeba6..0dcfa9e3bcc 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -41,6 +41,7 @@
#include "PIL_time.h"
#include "BLI_threads.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "IMB_imbuf.h"
@@ -129,26 +130,27 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar)
void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf)
{
char str[256];
- int ofs;
-
- ofs= sprintf(str, "X: %4d Y: %4d ", x, y);
+ int ofs= 0;
+
+ ofs += BLI_snprintf(str, sizeof(str)-ofs, "X: %4d Y: %4d ", x, y);
if(cp)
- ofs+= sprintf(str+ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %3d G: %3d B: %3d A: %3d ", cp[0], cp[1], cp[2], cp[3]);
if(fp) {
if(channels==4)
- ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f A: %.3f ", fp[0], fp[1], fp[2], fp[3]);
else if(channels==1)
- ofs+= sprintf(str+ofs, "| Val: %.3f ", fp[0]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Val: %.3f ", fp[0]);
else if(channels==3)
- ofs+= sprintf(str+ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]);
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| R: %.3f G: %.3f B: %.3f ", fp[0], fp[1], fp[2]);
}
if(zp)
- ofs+= sprintf(str+ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff));
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.4f ", 0.5+0.5*(((float)*zp)/(float)0x7fffffff));
if(zpf)
- ofs+= sprintf(str+ofs, "| Z: %.3f ", *zpf);
-
+ ofs+= BLI_snprintf(str, sizeof(str)-ofs, "| Z: %.3f ", *zpf);
+ (void)ofs;
+
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 46c4c8c2dfe..ce0bc6864c8 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -128,6 +128,9 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
ReportList *reports= CTX_wm_reports(C);
Report *report;
+ /* uses opengl */
+ wmSubWindowSet(CTX_wm_window(C), ar->swinid);
+
report= info_text_pick(sinfo, ar, reports, event->mval[1]);
RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index cf3607e8fba..aa5a00e1642 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -368,9 +368,9 @@ static void stats_string(Scene *scene)
mmap_in_use= MEM_get_mapped_memory_in_use();
/* get memory statistics */
- s= memstr + sprintf(memstr, " | Mem:%.2fM", ((mem_in_use-mmap_in_use)>>10)/1024.0);
+ s= memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use-mmap_in_use)>>10)/1024.0);
if(mmap_in_use)
- sprintf(s, " (%.2fM)", ((mmap_in_use)>>10)/1024.0);
+ sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0);
s= stats->infostr;
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 93ae75d9928..ae533e80610 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -47,6 +47,7 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "BKE_action.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_library.h"
@@ -1079,6 +1080,20 @@ static void draw_default_sensor_header(bSensor *sens,
"Invert the level (output) of this sensor");
}
+static void get_armature_bone_constraint(Object *ob, const char *posechannel, const char *constraint_name, bConstraint **constraint)
+{
+ /* check that bone exist in the active object */
+ if (ob->type == OB_ARMATURE && ob->pose) {
+ bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel);
+ if(pchan) {
+ bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name));
+ if(con) {
+ *constraint= con;
+ }
+ }
+ }
+ /* didn't find any */
+}
static void check_armature_bone_constraint(Object *ob, char *posechannel, char *constraint)
{
/* check that bone exist in the active object */
@@ -2015,8 +2030,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
}
else
{
- uiDefButI(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
- uiDefButI(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
+ uiDefButF(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
+ uiDefButF(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
}
uiDefButS(block, NUM, 0, "Blendin: ", xco+10, yco-64, (width-20)/2, 19, &aa->blendin, 0.0, 32767, 0.0, 0.0, "Number of frames of motion blending");
@@ -2077,11 +2092,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
"Use this property to define the Ipo position");
}
else {
- uiDefButI(block, NUM, 0,
+ uiDefButF(block, NUM, 0,
"Sta", xco+10, yco-44, (width-80)/2, 19,
&ia->sta, 1.0, MAXFRAMEF, 0, 0,
"Start frame");
- uiDefButI(block, NUM, 0,
+ uiDefButF(block, NUM, 0,
"End", xco+10+(width-80)/2, yco-44, (width-80)/2, 19,
&ia->end, 1.0, MAXFRAMEF, 0, 0,
"End frame");
@@ -3692,6 +3707,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
bActuator *act = (bActuator*)ptr->data;
bArmatureActuator *aa = (bArmatureActuator *) act->data;
Object *ob = (Object *)ptr->id.data;
+ bConstraint *constraint = NULL;
PointerRNA pose_ptr, pchan_ptr;
PropertyRNA *bones_prop = NULL;
@@ -3729,7 +3745,12 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
}
uiItemR(layout, ptr, "target", 0, NULL, ICON_NULL);
- uiItemR(layout, ptr, "secondary_target", 0, NULL, ICON_NULL);
+
+ /* show second target only if the constraint supports it */
+ get_armature_bone_constraint(ob, aa->posechannel, aa->constraint, &constraint);
+ if (constraint && constraint->type == CONSTRAINT_TYPE_KINEMATIC) {
+ uiItemR(layout, ptr, "secondary_target", 0, NULL, ICON_NULL);
+ }
break;
case ACT_ARM_SETWEIGHT:
if (ob->pose) {
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index aea35e193b8..e1577309afa 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -78,11 +78,6 @@
/* ****************** BUTTON CALLBACKS FOR ALL TREES ***************** */
-void node_buts_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
-{
- uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, "");
-}
-
static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
PointerRNA sockptr;
@@ -543,7 +538,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
- uiLayout *col;
+ uiLayout *col, *row;
col= uiLayoutColumn(layout, 0);
@@ -554,12 +549,18 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point
}
uiItemR(col, ptr, "use_relative", 0, NULL, ICON_NULL);
- col= uiLayoutColumn(layout, 1);
+
if (RNA_boolean_get(ptr, "use_relative")) {
+ uiItemL(col, "Aspect Correction", 0);
+ row= uiLayoutRow(layout, 1);
+ uiItemR(row, ptr, "aspect_correction", UI_ITEM_R_EXPAND, NULL, 0);
+
+ col= uiLayoutColumn(layout, 1);
uiItemR(col, ptr, "factor_x", 0, "X", ICON_NULL);
uiItemR(col, ptr, "factor_y", 0, "Y", ICON_NULL);
}
else {
+ col= uiLayoutColumn(layout, 1);
uiItemR(col, ptr, "size_x", 0, "X", ICON_NULL);
uiItemR(col, ptr, "size_y", 0, "Y", ICON_NULL);
}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index de0616f791e..b8a205d6eb1 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -45,6 +45,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_main.h"
+#include "BKE_node.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -68,7 +69,6 @@
// XXX interface.h
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
-extern void ui_draw_tria_icon(float x, float y, char dir);
void ED_node_changed_update(ID *id, bNode *node)
{
@@ -264,10 +264,6 @@ static void node_update(const bContext *C, bNodeTree *ntree, bNode *node)
BLI_unlock_thread(LOCK_PREVIEW);
}
- /* XXX ugly hack, typeinfo for group is generated */
- if(node->type == NODE_GROUP)
- node->typeinfo->uifunc= node_buts_group;
-
/* buttons rect? */
if((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
dy-= NODE_DYS/2;
@@ -713,7 +709,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
/* open/close entirely? */
- ui_draw_tria_icon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v');
+ UI_DrawTriIcon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v');
/* this isn't doing anything for the label, so commenting out
if(node->flag & SELECT)
@@ -721,11 +717,10 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
else
UI_ThemeColor(TH_TEXT); */
- if(node->flag & NODE_CUSTOM_NAME)
- BLI_strncpy(showname, node->name, sizeof(showname));
+ if (node->typeinfo->labelfunc)
+ BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname));
else
- /* todo: auto name display for node types */
- BLI_strncpy(showname, node->name, sizeof(showname));
+ BLI_strncpy(showname, node->typeinfo->name, sizeof(showname));
//if(node->flag & NODE_MUTED)
// sprintf(showname, "[%s]", showname);
@@ -882,7 +877,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
/* open entirely icon */
- ui_draw_tria_icon(rct->xmin+10.0f, centy, 'h');
+ UI_DrawTriIcon(rct->xmin+10.0f, centy, 'h');
/* disable lines */
if(node->flag & NODE_MUTED)
@@ -894,14 +889,11 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
UI_ThemeColor(TH_TEXT);
if(node->miniwidth>0.0f) {
-
-
- if(node->flag & NODE_CUSTOM_NAME)
- BLI_strncpy(showname, node->name, sizeof(showname));
+ if (node->typeinfo->labelfunc)
+ BLI_strncpy(showname, node->typeinfo->labelfunc(node), sizeof(showname));
else
- /* todo: auto name display */
- BLI_strncpy(showname, node->name, sizeof(showname));
-
+ BLI_strncpy(showname, node->typeinfo->name, sizeof(showname));
+
//if(node->flag & NODE_MUTED)
// sprintf(showname, "[%s]", showname);
@@ -1012,18 +1004,19 @@ static void node_draw_group_links(View2D *v2d, SpaceNode *snode, bNode *gnode)
}
/* groups are, on creation, centered around 0,0 */
-static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *gnode)
+static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *gnode)
{
bNodeTree *ngroup= (bNodeTree *)gnode->id;
bNodeSocket *sock;
rctf rect= gnode->totr;
- char showname[128];
+ uiLayout *layout;
+ PointerRNA ptr;
/* backdrop header */
glEnable(GL_BLEND);
uiSetRoundBox(3);
UI_ThemeColorShadeAlpha(TH_NODE_GROUP, 0, -70);
- uiDrawBox(GL_POLYGON, rect.xmin, rect.ymax, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD);
+ uiDrawBox(GL_POLYGON, rect.xmin, rect.ymax, rect.xmax, rect.ymax+26, BASIS_RAD);
/* backdrop body */
UI_ThemeColorShadeAlpha(TH_BACK, -8, -70);
@@ -1034,21 +1027,19 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
uiSetRoundBox(15);
glColor4ub(200, 200, 200, 140);
glEnable( GL_LINE_SMOOTH );
- uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax+NODE_DY, BASIS_RAD);
+ uiDrawBox(GL_LINE_LOOP, rect.xmin, rect.ymin, rect.xmax, rect.ymax+26, BASIS_RAD);
glDisable( GL_LINE_SMOOTH );
glDisable(GL_BLEND);
/* backdrop title */
UI_ThemeColor(TH_TEXT_HI);
- if (gnode->flag & NODE_CUSTOM_NAME)
- BLI_strncpy(showname, gnode->name, sizeof(showname));
- else
- BLI_strncpy(showname, ngroup->id.name+2, sizeof(showname));
-
+ layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (short)(rect.xmin+15), (short)(rect.ymax+23),
+ MIN2((int)(rect.xmax - rect.xmin-18.0f), 140), 20, U.uistyles.first);
+ RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
+ uiTemplateIDBrowse(layout, (bContext*)C, &ptr, "node_tree", NULL, NULL, NULL);
+ uiBlockLayoutResolve(gnode->block, NULL, NULL);
- uiDefBut(gnode->block, LABEL, 0, showname, (short)(rect.xmin+15), (short)(rect.ymax),
- (int)(rect.xmax - rect.xmin-18.0f), NODE_DY, NULL, 0, 0, 0, 0, "");
uiEndBlock(C, gnode->block);
uiDrawBlock(C, gnode->block);
gnode->block= NULL;
@@ -1128,7 +1119,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
/* active group */
for(node= snode->nodetree->nodes.first; node; node= node->next) {
if(node->flag & NODE_GROUP_EDIT)
- node_draw_group(C, ar, snode, node);
+ node_draw_group(C, ar, snode, snode->nodetree, node);
}
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 834f3483871..624630b9846 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1693,27 +1693,36 @@ bNode *node_add_node(SpaceNode *snode, Scene *scene, int type, float locx, float
static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceNode *snode= CTX_wm_space_node(C);
- bNode *node;
+ bNodeTree *ntree= snode->edittree;
+ bNode *node, *newnode, *last;
ED_preview_kill_jobs(C);
-
- /* simple id user adjustment, node internal functions dont touch this
- * but operators and readfile.c do. */
- for(node= snode->edittree->nodes.first; node; node= node->next) {
+
+ last = ntree->nodes.last;
+ for(node= ntree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
- id_us_plus(node->id);
+ newnode = nodeCopyNode(ntree, node, 1);
+
+ /* deselect old node, select the copy instead */
+ node->flag &= ~(NODE_SELECT|NODE_ACTIVE);
+ newnode->flag |= NODE_SELECT;
+
+ if(newnode->id) {
+ /* simple id user adjustment, node internal functions dont touch this
+ * but operators and readfile.c do. */
+ id_us_plus(newnode->id);
+ /* to ensure redraws or rerenders happen */
+ ED_node_changed_update(snode->id, newnode);
+ }
}
+
+ /* make sure we don't copy new nodes again! */
+ if (node==last)
+ break;
}
-
- 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(ntree);
- ntreeSolveOrder(snode->edittree);
node_tree_verify_groups(snode->nodetree);
snode_notify(C, snode);
@@ -2158,6 +2167,54 @@ void NODE_OT_read_fullsamplelayers(wmOperatorType *ot)
ot->flag= 0;
}
+int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *sce= CTX_data_scene(C);
+ bNode *node;
+
+ for(node= sce->nodetree->nodes.first; node; node= node->next) {
+ if(node->id==(ID *)sce && node->need_exec) {
+ break;
+ }
+ }
+ if(node) {
+ SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
+
+ if(srl) {
+ PointerRNA op_ptr;
+
+ WM_operator_properties_create(&op_ptr, "RENDER_OT_render");
+ RNA_string_set(&op_ptr, "layer", srl->name);
+ RNA_string_set(&op_ptr, "scene", sce->id.name+2);
+
+ /* to keep keypositions */
+ sce->r.scemode |= R_NO_FRAME_UPDATE;
+
+ WM_operator_name_call(C, "RENDER_OT_render", WM_OP_INVOKE_DEFAULT, &op_ptr);
+
+ WM_operator_properties_free(&op_ptr);
+
+ return OPERATOR_FINISHED;
+ }
+
+ }
+ return OPERATOR_CANCELLED;
+}
+
+void NODE_OT_render_changed(wmOperatorType *ot)
+{
+
+ ot->name= "Render Changed Layer";
+ ot->idname= "NODE_OT_render_changed";
+
+ ot->exec= node_render_changed_exec;
+
+ ot->poll= composite_node_active;
+
+ /* flags */
+ ot->flag= 0;
+}
+
/* ****************** Make Group operator ******************* */
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 66bf9310db8..831e157deef 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -73,8 +73,6 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage);
void draw_nodespace_color_info(ARegion *ar, int channels, int x, int y, char *cp, float *fp);
-void node_buts_group(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
-
/* node_edit.c */
void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype);
void snode_notify(bContext *C, SpaceNode *snode);
@@ -92,7 +90,7 @@ void node_tree_verify_groups(bNodeTree *nodetree);
void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace);
int node_has_hidden_sockets(bNode *node);
void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set);
-
+int node_render_changed_exec(bContext *, wmOperator *);
void NODE_OT_duplicate(struct wmOperatorType *ot);
void NODE_OT_delete(struct wmOperatorType *ot);
@@ -115,6 +113,7 @@ void NODE_OT_show_cyclic_dependencies(struct wmOperatorType *ot);
void NODE_OT_link_viewer(struct wmOperatorType *ot);
void NODE_OT_read_fullsamplelayers(struct wmOperatorType *ot);
void NODE_OT_read_renderlayers(struct wmOperatorType *ot);
+void NODE_OT_render_changed(struct wmOperatorType *ot);
void NODE_OT_backimage_move(struct wmOperatorType *ot);
void NODE_OT_backimage_zoom(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 781682c9185..db5c493dcd9 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -78,6 +78,7 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_read_renderlayers);
WM_operatortype_append(NODE_OT_read_fullsamplelayers);
+ WM_operatortype_append(NODE_OT_render_changed);
WM_operatortype_append(NODE_OT_backimage_move);
WM_operatortype_append(NODE_OT_backimage_zoom);
@@ -170,6 +171,8 @@ void node_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "NODE_OT_read_renderlayers", RKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "NODE_OT_read_fullsamplelayers", RKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "NODE_OT_render_changed", ZKEY, KM_PRESS, 0, 0);
+
transform_keymap_for_space(keyconf, keymap, SPACE_NODE);
}
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index eb8c34fe8bd..1ac745b8c0e 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -98,6 +98,9 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
snode= MEM_callocN(sizeof(SpaceNode), "initnode");
snode->spacetype= SPACE_NODE;
+ /* backdrop */
+ snode->zoom = 1.0f;
+
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for node");
@@ -172,13 +175,21 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
case ND_FRAME:
ED_area_tag_refresh(sa);
break;
+ case ND_TRANSFORM_DONE:
+ if(type==NTREE_COMPOSIT) {
+ if(snode->flag & SNODE_AUTO_RENDER) {
+ snode->recalc= 1;
+ ED_area_tag_refresh(sa);
+ }
+ }
+ break;
}
break;
case NC_WM:
if(wmn->data==ND_FILEREAD)
ED_area_tag_refresh(sa);
break;
-
+
/* future: add ID checks? */
case NC_MATERIAL:
if(type==NTREE_SHADER) {
@@ -212,7 +223,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
case NC_IMAGE:
if (wmn->action == NA_EDITED) {
- if(snode->treetype==NTREE_COMPOSIT) {
+ if(type==NTREE_COMPOSIT) {
Scene *scene= wmn->window->screen->scene;
/* note that NodeTagIDChanged is alredy called by BKE_image_signal() on all
@@ -241,8 +252,15 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
}
else if(snode->treetype==NTREE_COMPOSIT) {
Scene *scene= (Scene *)snode->id;
- if(scene->use_nodes)
- snode_composite_job(C, sa);
+ if(scene->use_nodes) {
+ /* recalc is set on 3d view changes for auto compo */
+ if(snode->recalc) {
+ snode->recalc= 0;
+ node_render_changed_exec((struct bContext*)C, NULL);
+ }
+ else
+ snode_composite_job(C, sa);
+ }
}
else if(snode->treetype==NTREE_TEXTURE) {
Tex *tex= (Tex *)snode->id;
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index b0fe529a4c6..53aea610d42 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1244,7 +1244,7 @@ void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
}
}
-static int outliner_filter_has_name(TreeElement *te, char *name, int flags)
+static int outliner_filter_has_name(TreeElement *te, const char *name, int flags)
{
#if 0
int found= 0;
@@ -2109,6 +2109,16 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops
return 0;
}
+static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOops *soops, TreeElement *te, int set)
+{
+ Object *ob= (Object *)outliner_search_back(soops, te, ID_OB);
+
+ if(set)
+ return 0;
+
+ return scene->camera == ob;
+}
+
static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops, TreeElement *te, int set)
{
TreeElement *tep;
@@ -2343,6 +2353,8 @@ static int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, Tree
return tree_element_active_texture(C, scene, soops, te, set);
case ID_TXT:
return tree_element_active_text(C, scene, soops, te, set);
+ case ID_CA:
+ return tree_element_active_camera(C, scene, soops, te, set);
}
return 0;
}
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
index 545be69af54..35f3ad0596f 100644
--- a/source/blender/editors/space_script/script_header.c
+++ b/source/blender/editors/space_script/script_header.c
@@ -78,10 +78,10 @@ static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
return block;
}
-static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
+static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
{
- switch(event) {
- }
+ //switch(event) {
+ //}
}
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index c1e01e2ac53..24142e0b898 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -315,7 +315,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
RNA_BEGIN(op->ptr, itemptr, "files") {
RNA_string_get(&itemptr, "name", file_only);
- BLI_join_dirfile(seq_load.path, dir_only, file_only);
+ BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
seq= seq_load_func(C, ed->seqbasep, &seq_load);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 47dff6face4..505b38147f7 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1060,8 +1060,7 @@ void seq_remap_paths(Scene *scene)
BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX);
/* new path */
- BLI_strncpy(seq->strip->dir, to, FILE_MAX);
- strcat(seq->strip->dir, stripped);
+ BLI_snprintf(seq->strip->dir, sizeof(seq->strip->dir), "%s%s", to, stripped);
printf("new %s\n", seq->strip->dir);
}
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index eb69374b5b7..6f9ad138bac 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -89,7 +89,7 @@ static int text_font_draw_character(SpaceText *st, int x, int y, char c)
return st->cwidth;
}
-int text_font_width(SpaceText *UNUSED(st), char *str)
+int text_font_width(SpaceText *UNUSED(st), const char *str)
{
return BLF_width(mono, str);
}
@@ -124,7 +124,7 @@ static void flatten_string_append(FlattenString *fs, char c, int accum)
fs->pos++;
}
-int flatten_string(SpaceText *st, FlattenString *fs, char *in)
+int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
{
int r = 0, i = 0;
@@ -645,7 +645,7 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
}
}
-int text_get_char_pos(SpaceText *st, char *line, int cur)
+int text_get_char_pos(SpaceText *st, const char *line, int cur)
{
int a=0, i;
@@ -961,7 +961,7 @@ int text_get_visible_lines_no(SpaceText *st, int lineno)
return drawcache->line_height[lineno];
}
-int text_get_visible_lines(SpaceText *st, ARegion *ar, char *str)
+int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str)
{
int i, j, start, end, max, lines, chars;
char ch;
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index cc957141ed2..5f6b2e05ba7 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -45,7 +45,7 @@ struct wmWindowManager;
void draw_text_main(struct SpaceText *st, struct ARegion *ar);
int text_font_width_character(struct SpaceText *st);
-int text_font_width(struct SpaceText *st, char *str);
+int text_font_width(struct SpaceText *st, const char *str);
void text_update_line_edited(struct TextLine *line);
void text_update_edited(struct Text *text);
@@ -79,13 +79,13 @@ typedef struct FlattenString {
int pos, len;
} FlattenString;
-int flatten_string(struct SpaceText *st, FlattenString *fs, char *in);
+int flatten_string(struct SpaceText *st, FlattenString *fs, const char *in);
void flatten_string_free(FlattenString *fs);
int wrap_width(struct SpaceText *st, struct ARegion *ar);
void wrap_offset(struct SpaceText *st, struct ARegion *ar, struct TextLine *linein, int cursin, int *offl, int *offc);
void wrap_offset_in_line(struct SpaceText *st, struct ARegion *ar, struct TextLine *linep, int cursin, int *offl, int *offc);
-int text_get_char_pos(struct SpaceText *st, char *line, int cur);
+int text_get_char_pos(struct SpaceText *st, const char *line, int cur);
void text_drawcache_tag_update(struct SpaceText *st, int full);
void text_free_caches(struct SpaceText *st);
@@ -95,7 +95,7 @@ int text_file_modified(struct Text *text);
int text_do_suggest_select(struct SpaceText *st, struct ARegion *ar);
void text_pop_suggest_list(void);
-int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, char *str);
+int text_get_visible_lines(struct SpaceText *st, struct ARegion *ar, const char *str);
int text_get_span_wrap(struct SpaceText *st, struct ARegion *ar, struct TextLine *from, struct TextLine *to);
int text_get_total_lines(struct SpaceText *st, struct ARegion *ar);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index efb0b173559..bfec734dad6 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -124,7 +124,6 @@ static int text_region_edit_poll(bContext *C)
return 1;
}
-
/********************** updates *********************/
void text_update_line_edited(TextLine *line)
@@ -342,6 +341,12 @@ void TEXT_OT_reload(wmOperatorType *ot)
/******************* delete operator *********************/
+static int text_unlink_poll(bContext *C)
+{
+ /* it should be possible to unlink texts if they're lib-linked in... */
+ return CTX_data_edit_text(C) != NULL;
+}
+
static int unlink_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
@@ -381,7 +386,7 @@ void TEXT_OT_unlink(wmOperatorType *ot)
/* api callbacks */
ot->exec= unlink_exec;
ot->invoke= WM_operator_confirm;
- ot->poll= text_edit_poll;
+ ot->poll= text_unlink_poll;
/* flags */
ot->flag= OPTYPE_UNDO;
@@ -2019,6 +2024,12 @@ typedef struct TextScroll {
int zone;
} TextScroll;
+static int text_scroll_poll(bContext *C)
+{
+ /* it should be possible to still scroll linked texts to read them, even if they can't be edited... */
+ return CTX_data_edit_text(C) != NULL;
+}
+
static int scroll_exec(bContext *C, wmOperator *op)
{
SpaceText *st= CTX_wm_space_text(C);
@@ -2183,7 +2194,7 @@ void TEXT_OT_scroll(wmOperatorType *ot)
ot->invoke= scroll_invoke;
ot->modal= scroll_modal;
ot->cancel= scroll_cancel;
- ot->poll= text_space_edit_poll;
+ ot->poll= text_scroll_poll;
/* flags */
ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -2194,6 +2205,22 @@ void TEXT_OT_scroll(wmOperatorType *ot)
/******************** scroll bar operator *******************/
+static int text_region_scroll_poll(bContext *C)
+{
+ /* same as text_region_edit_poll except it works on libdata too */
+ SpaceText *st= CTX_wm_space_text(C);
+ Text *text= CTX_data_edit_text(C);
+ ARegion *ar= CTX_wm_region(C);
+
+ if(!st || !text)
+ return 0;
+
+ if(!ar || ar->regiontype != RGN_TYPE_WINDOW)
+ return 0;
+
+ return 1;
+}
+
static int scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceText *st= CTX_wm_space_text(C);
@@ -2249,7 +2276,7 @@ void TEXT_OT_scroll_bar(wmOperatorType *ot)
ot->invoke= scroll_bar_invoke;
ot->modal= scroll_modal;
ot->cancel= scroll_cancel;
- ot->poll= text_region_edit_poll;
+ ot->poll= text_region_scroll_poll;
/* flags */
ot->flag= OPTYPE_BLOCKING;
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index 1c75e6f65ca..e6f201e4147 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -98,7 +98,7 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
return 1;
}
-void text_pop_suggest_list()
+void text_pop_suggest_list(void)
{
SuggItem *item, *sel;
int *top, i;
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index caac8d1d9fe..5c2adc10d85 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -340,7 +340,7 @@ static int set_draw_settings_cached(int clearcache, int textured, MTFace *texfac
/* Icky globals, fix with userdata parameter */
-struct TextureDrawState {
+static struct TextureDrawState {
Object *ob;
int islit, istex;
int color_profile;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 8724f2f9def..c90c301b6d1 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -573,7 +573,7 @@ typedef struct ViewCachedString {
/* str is allocated past the end */
} ViewCachedString;
-void view3d_cached_text_draw_begin()
+void view3d_cached_text_draw_begin(void)
{
ListBase *strings= &CachedText[CachedTextLevel];
strings->first= strings->last= NULL;
@@ -4070,8 +4070,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
psys->lattice= NULL;
}
- if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) )
+ if(pdd) {
+ /* drop references to stack memory */
+ pdd->ma_r= pdd->ma_g= pdd->ma_b= NULL;
+ }
+
+ if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
glLoadMatrixf(rv3d->viewmat);
+ }
}
static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit)
@@ -5362,7 +5368,7 @@ static void draw_bb_quadric(BoundBox *bb, short type)
static void draw_bounding_volume(Scene *scene, Object *ob)
{
- BoundBox *bb=0;
+ BoundBox *bb= NULL;
if(ob->type==OB_MESH) {
bb= mesh_get_bb(ob);
@@ -5373,7 +5379,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob)
else if(ob->type==OB_MBALL) {
if(is_basis_mball(ob)) {
bb= ob->bb;
- if(bb==0) {
+ if(bb==NULL) {
makeDispListMBall(scene, ob);
bb= ob->bb;
}
@@ -5384,7 +5390,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob)
return;
}
- if(bb==0) return;
+ if(bb==NULL) return;
if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec);
else draw_bb_quadric(bb, ob->boundtype);
@@ -5552,8 +5558,7 @@ static void draw_hooks(Object *ob)
}
}
-//<rcruiz>
-void drawRBpivot(bRigidBodyJointConstraint *data)
+static void drawRBpivot(bRigidBodyJointConstraint *data)
{
int axis;
float mat[4][4];
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 0f6e0bdc834..1479dc950c9 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -126,7 +126,7 @@ static double tval()
struct GPUTexture;
-int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3])
+static int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3])
{
int i;
float t;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 9ec68d62364..f7ccebda6ae 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -43,6 +43,7 @@
#include "BKE_context.h"
#include "BKE_screen.h"
+#include "ED_space_api.h"
#include "ED_screen.h"
#include "ED_object.h"
@@ -910,7 +911,7 @@ static void view3d_props_area_listener(ARegion *ar, wmNotifier *wmn)
}
/*area (not region) level listener*/
-void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
+static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
{
View3D *v3d = sa->spacedata.first;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 53a4981661f..cefe0254ae4 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -709,7 +709,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
}
-int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
+static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
{
Scene *scene= CTX_data_scene(C);
Object *ob= OBACT;
@@ -925,7 +925,7 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
}
/* assumes armature editmode */
-void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev)
+static void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev)
{
EditBone *eBone= bonev;
char oldname[sizeof(eBone->name)], newname[sizeof(eBone->name)];
@@ -1199,12 +1199,12 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, ob);
}
-void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg))
+static void removeTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg))
{
BIF_removeTransformOrientation(C, (TransformOrientation *) target);
}
-void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg))
+static void selectTransformOrientation_func(bContext *C, void *target, void *UNUSED(arg))
{
BIF_selectTransformOrientation(C, (TransformOrientation *) target);
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 52f4697bad1..58adb9aad43 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -917,7 +917,7 @@ void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, Vi
}
}
-void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
+static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
{
RegionView3D *rv3d= ar->regiondata;
float size[2];
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index bc9c41f3add..76bd590bd3c 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2777,7 +2777,7 @@ int view_autodist_depth_segment(struct ARegion *ar, short mval_sta[2], short mva
// those are still not ok
-float ndof_axis_scale[6] = {
+static float ndof_axis_scale[6] = {
+0.01, // Tx
+0.01, // Tz
+0.01, // Ty
@@ -2786,7 +2786,7 @@ float ndof_axis_scale[6] = {
+0.0015 // Ry
};
-void filterNDOFvalues(float *sbval)
+static void filterNDOFvalues(float *sbval)
{
int i=0;
float max = 0.0;
@@ -2799,6 +2799,7 @@ void filterNDOFvalues(float *sbval)
sbval[i]=0.0;
}
+#if 0
// statics for controlling rv3d->dist corrections.
// viewmoveNDOF zeros and adjusts rv3d->ofs.
// viewmove restores based on dz_flag state.
@@ -3139,6 +3140,7 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int UNUSED(mode))
*/
// XXX scrarea_do_windraw(curarea);
}
+#endif // if 0, unused NDof code
/* give a 4x4 matrix from a perspective view, only needs viewquat, ofs and dist
* basically the same as...
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index a481fdb59f6..2ee4f7a9e55 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -137,7 +137,7 @@ static void handle_view3d_lock(bContext *C)
}
}
-static int layers_exec(bContext *C, wmOperator *op)
+static int view3d_layers_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
@@ -210,7 +210,7 @@ static int layers_exec(bContext *C, wmOperator *op)
/* applies shift and alt, lazy coding or ok? :) */
/* the local per-keymap-entry keymap will solve it */
-static int layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(event->ctrl || event->oskey)
return OPERATOR_PASS_THROUGH;
@@ -222,12 +222,12 @@ static int layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
int nr= RNA_int_get(op->ptr, "nr") + 10;
RNA_int_set(op->ptr, "nr", nr);
}
- layers_exec(C, op);
+ view3d_layers_exec(C, op);
return OPERATOR_FINISHED;
}
-int layers_poll(bContext *C)
+static int view3d_layers_poll(bContext *C)
{
return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd==NULL);
}
@@ -240,9 +240,9 @@ void VIEW3D_OT_layers(wmOperatorType *ot)
ot->idname= "VIEW3D_OT_layers";
/* api callbacks */
- ot->invoke= layers_invoke;
- ot->exec= layers_exec;
- ot->poll= layers_poll;
+ ot->invoke= view3d_layers_invoke;
+ ot->exec= view3d_layers_exec;
+ ot->poll= view3d_layers_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index f85bdc437f3..70d77f4e489 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -137,7 +137,7 @@ void view3d_get_transformation(ARegion *ar, RegionView3D *rv3d, Object *ob, bglM
/* local prototypes */
-void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select)
+static void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select)
{
EditVert *eve;
int index= em_wireoffs;
@@ -151,7 +151,7 @@ void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select)
}
}
-void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select)
+static void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select)
{
EditEdge *eed;
int index= em_solidoffs;
@@ -165,7 +165,7 @@ void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select)
}
}
-void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select)
+static void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select)
{
EditFace *efa;
int index= 1;
@@ -179,7 +179,7 @@ void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select)
}
}
-void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
+static void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
{
MFace *mface = me->mface;
int a;
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 7ed85cacc1e..04f9f2d11d4 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -427,7 +427,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *UNUSED(op))
}
-int view3d_setcameratoview_poll(bContext *C)
+static int view3d_setcameratoview_poll(bContext *C)
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
@@ -1734,7 +1734,7 @@ extern void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *cam_f
#endif // WITH_GAMEENGINE
-int game_engine_poll(bContext *C)
+static int game_engine_poll(bContext *C)
{
/* we need a context and area to launch BGE
it's a temporary solution to avoid crash at load time
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index ee54a892ec4..e95361c0d91 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -338,7 +338,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
}
}
-static void viewRedrawPost(TransInfo *t)
+static void viewRedrawPost(bContext *C, TransInfo *t)
{
ED_area_headerprint(t->sa, NULL);
@@ -346,6 +346,10 @@ static void viewRedrawPost(TransInfo *t)
/* if autokeying is enabled, send notifiers that keyframes were added */
if (IS_AUTOKEY_ON(t->scene))
WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+
+ /* XXX temp, first hack to get auto-render in compositor work (ton) */
+ WM_event_add_notifier(C, NC_SCENE|ND_TRANSFORM_DONE, CTX_data_scene(C));
+
}
#if 0 // TRANSFORM_FIX_ME
@@ -372,7 +376,7 @@ static void viewRedrawPost(TransInfo *t)
/* ************************** TRANSFORMATIONS **************************** */
-void BIF_selectOrientation() {
+void BIF_selectOrientation(void) {
#if 0 // TRANSFORM_FIX_ME
short val;
char *str_menu = BIF_menustringTransformOrientation("Orientation");
@@ -1366,7 +1370,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
}
}
-void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg)
+static void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg)
{
TransInfo *t = arg;
@@ -1375,7 +1379,7 @@ void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), voi
drawSnapping(C, t);
}
-void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg))
+static void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg))
{
// TransInfo *t = arg;
//
@@ -1817,7 +1821,7 @@ int transformEnd(bContext *C, TransInfo *t)
postTrans(C, t);
/* send events out for redraws */
- viewRedrawPost(t);
+ viewRedrawPost(C, t);
/* Undo as last, certainly after special_trans_update! */
@@ -2521,6 +2525,7 @@ void initResize(TransInfo *t)
static void headerResize(TransInfo *t, float vec[3], char *str) {
char tvec[60];
+ char *spos= str;
if (hasNumInput(&t->num)) {
outputNumInput(&(t->num), tvec);
}
@@ -2533,24 +2538,27 @@ static void headerResize(TransInfo *t, float vec[3], char *str) {
if (t->con.mode & CON_APPLY) {
switch(t->num.idx_max) {
case 0:
- sprintf(str, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
break;
case 1:
- sprintf(str, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
break;
case 2:
- sprintf(str, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
}
}
else {
if (t->flag & T_2D_EDIT)
- sprintf(str, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
+ spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
else
- sprintf(str, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
+ spos += sprintf(spos, "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);
+ if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
+ spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
+ }
+
+ (void)spos;
}
#define SIGN(a) (a<-FLT_EPSILON?1:a>FLT_EPSILON?2:3)
@@ -2917,7 +2925,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if(td->flag & TD_USEQUAT) {
- mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
mat3_to_quat( quat,fmat); // Actual transform
if(td->ext->quat){
@@ -2984,7 +2992,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
/* euler or quaternion/axis-angle? */
if (td->ext->rotOrder == ROT_MODE_QUAT) {
- mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
mat3_to_quat( quat,fmat); // Actual transform
@@ -2999,7 +3007,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
- mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
mat3_to_quat( quat,fmat); // Actual transform
mul_qt_qtqt(tquat, quat, iquat);
@@ -3054,7 +3062,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
/* euler or quaternion? */
if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
- mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
mat3_to_quat( quat,fmat); // Actual transform
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
@@ -3067,7 +3075,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
- mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
+ mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
mat3_to_quat( quat,fmat); // Actual transform
mul_qt_qtqt(tquat, quat, iquat);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 86da5e0a4b5..bbadce5369d 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -85,6 +85,7 @@
#include "ED_types.h"
#include "ED_uvedit.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
+#include "ED_util.h" /* for crazyspace correction */
#include "UI_view2d.h"
@@ -573,16 +574,16 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
if (constraints_list_needinv(t, &pchan->constraints)) {
copy_m3_m4(tmat, pchan->constinv);
invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, 0,0,0,0); // dang mulserie swaps args
+ mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, NULL,NULL,NULL,NULL); // dang mulserie swaps args
}
else
- mul_serie_m3(td->mtx, bmat, pmat, omat, 0,0,0,0,0); // dang mulserie swaps args
+ mul_serie_m3(td->mtx, bmat, pmat, omat, NULL,NULL,NULL,NULL,NULL); // dang mulserie swaps args
}
else {
if (constraints_list_needinv(t, &pchan->constraints)) {
copy_m3_m4(tmat, pchan->constinv);
invert_m3_m3(cmat, tmat);
- mul_serie_m3(td->mtx, bmat, omat, cmat, 0,0,0,0,0); // dang mulserie swaps args
+ mul_serie_m3(td->mtx, bmat, omat, cmat, NULL,NULL,NULL,NULL,NULL); // dang mulserie swaps args
}
else
mul_m3_m3m3(td->mtx, omat, bmat); // Mat3MulMat3 has swapped args!
@@ -1940,147 +1941,6 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert
}
}
-/* *********************** CrazySpace correction. Now without doing subsurf optimal ****************** */
-
-static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
-{
- float *vec = userData;
-
- vec+= 3*index;
- VECCOPY(vec, co);
-}
-
-static int modifiers_disable_subsurf_temporary(Object *ob)
-{
- ModifierData *md;
- int disabled = 0;
-
- for(md=ob->modifiers.first; md; md=md->next)
- if(md->type==eModifierType_Subsurf)
- if(md->mode & eModifierMode_OnCage) {
- md->mode ^= eModifierMode_DisableTemporary;
- disabled= 1;
- }
-
- return disabled;
-}
-
-/* disable subsurf temporal, get mapped cos, and enable it */
-static float *get_crazy_mapped_editverts(TransInfo *t)
-{
- Mesh *me= t->obedit->data;
- DerivedMesh *dm;
- float *vertexcos;
-
- /* disable subsurf temporal, get mapped cos, and enable it */
- if(modifiers_disable_subsurf_temporary(t->obedit)) {
- /* need to make new derivemesh */
- makeDerivedMesh(t->scene, t->obedit, me->edit_mesh, CD_MASK_BAREMESH);
- }
-
- /* now get the cage */
- dm= editmesh_get_derived_cage(t->scene, t->obedit, me->edit_mesh, CD_MASK_BAREMESH);
-
- vertexcos= MEM_mallocN(3*sizeof(float)*me->edit_mesh->totvert, "vertexcos map");
- dm->foreachMappedVert(dm, make_vertexcos__mapFunc, vertexcos);
-
- dm->release(dm);
-
- /* set back the flag, no new cage needs to be built, transform does it */
- modifiers_disable_subsurf_temporary(t->obedit);
-
- return vertexcos;
-}
-
-#define TAN_MAKE_VEC(a, b, c) a[0]= b[0] + 0.2f*(b[0]-c[0]); a[1]= b[1] + 0.2f*(b[1]-c[1]); a[2]= b[2] + 0.2f*(b[2]-c[2])
-static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3, float *def1, float *def2, float *def3)
-{
- float vecu[3], vecv[3];
- float q1[4], q2[4];
-
- TAN_MAKE_VEC(vecu, v1, v2);
- TAN_MAKE_VEC(vecv, v1, v3);
- tri_to_quat( q1,v1, vecu, vecv);
-
- TAN_MAKE_VEC(vecu, def1, def2);
- TAN_MAKE_VEC(vecv, def1, def3);
- tri_to_quat( q2,def1, vecu, vecv);
-
- sub_qt_qtqt(quat, q2, q1);
-}
-#undef TAN_MAKE_VEC
-
-static void set_crazyspace_quats(EditMesh *em, float *origcos, float *mappedcos, float *quats)
-{
- EditVert *eve, *prev;
- EditFace *efa;
- float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
- intptr_t index= 0;
-
- /* two abused locations in vertices */
- for(eve= em->verts.first; eve; eve= eve->next, index++) {
- eve->tmp.p = NULL;
- eve->prev= (EditVert *)index;
- }
-
- /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
- for(efa= em->faces.first; efa; efa= efa->next) {
-
- /* retrieve mapped coordinates */
- v1= mappedcos + 3*(intptr_t)(efa->v1->prev);
- v2= mappedcos + 3*(intptr_t)(efa->v2->prev);
- v3= mappedcos + 3*(intptr_t)(efa->v3->prev);
-
- co1= (origcos)? origcos + 3*(intptr_t)(efa->v1->prev): efa->v1->co;
- co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co;
- co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co;
-
- if(efa->v2->tmp.p==NULL && efa->v2->f1) {
- set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
- efa->v2->tmp.p= (void*)quats;
- quats+= 4;
- }
-
- if(efa->v4) {
- v4= mappedcos + 3*(intptr_t)(efa->v4->prev);
- co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co;
-
- if(efa->v1->tmp.p==NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);
- efa->v1->tmp.p= (void*)quats;
- quats+= 4;
- }
- if(efa->v3->tmp.p==NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2);
- efa->v3->tmp.p= (void*)quats;
- quats+= 4;
- }
- if(efa->v4->tmp.p==NULL && efa->v4->f1) {
- set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3);
- efa->v4->tmp.p= (void*)quats;
- quats+= 4;
- }
- }
- else {
- if(efa->v1->tmp.p==NULL && efa->v1->f1) {
- set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3);
- efa->v1->tmp.p= (void*)quats;
- quats+= 4;
- }
- if(efa->v3->tmp.p==NULL && efa->v3->f1) {
- set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2);
- efa->v3->tmp.p= (void*)quats;
- quats+= 4;
- }
- }
- }
-
- /* restore abused prev pointer */
- for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
- eve->prev= prev;
-
-}
-
void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) {
BME_Vert *v;
BME_TransData *vtd;
@@ -2200,9 +2060,9 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
correction with quats, relative to the coordinates after
the modifiers that support deform matrices (defcos) */
if(totleft > 0) {
- mappedcos= get_crazy_mapped_editverts(t);
+ mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit);
quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
- set_crazyspace_quats(em, (float*)defcos, mappedcos, quats);
+ crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats);
if(mappedcos)
MEM_freeN(mappedcos);
}
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 089f192cdc8..93403ea5817 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -106,17 +106,19 @@ float ResizeBetween(TransInfo *t, float p1[3], float p2[3]);
/****************** IMPLEMENTATIONS *********************/
+#if 0
int BIF_snappingSupported(Object *obedit)
{
int status = 0;
- if (obedit == NULL || ELEM3(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE)) /* only support object mesh, armature, curves */
+ if (obedit == NULL || ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) /* only support object mesh, armature, curves */
{
status = 1;
}
return status;
}
+#endif
int validSnap(TransInfo *t)
{
@@ -374,7 +376,7 @@ void initSnappingMode(TransInfo *t)
/* Edit mode */
if (t->tsnap.applySnap != NULL && // A snapping function actually exist
- (obedit != NULL && ELEM3(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE)) ) // Temporary limited to edit mode meshes, armature, curves
+ (obedit != NULL && ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) ) // Temporary limited to edit mode meshes, armature, curves
{
/* editmode meshes now supported */
if ((obedit->type != OB_MESH) && ((t->flag & T_PROP_EDIT) || t->tsnap.project)) /* also exclude edit for project, for now */
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index a2e0525cb0e..38c0dd7f0ba 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -34,6 +34,7 @@ set(SRC
editmode_undo.c
numinput.c
undo.c
+ crazyspace.c
util_intern.h
# general includes
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
new file mode 100644
index 00000000000..8b03f1826e4
--- /dev/null
+++ b/source/blender/editors/util/crazyspace.c
@@ -0,0 +1,394 @@
+/**
+ * $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) 2005 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_meshdata_types.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_modifier.h"
+#include "BKE_multires.h"
+#include "BKE_mesh.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_math.h"
+#include "BLI_editVert.h"
+
+#define TAN_MAKE_VEC(a, b, c) a[0]= b[0] + 0.2f*(b[0]-c[0]); a[1]= b[1] + 0.2f*(b[1]-c[1]); a[2]= b[2] + 0.2f*(b[2]-c[2])
+static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3, float *def1, float *def2, float *def3)
+{
+ float vecu[3], vecv[3];
+ float q1[4], q2[4];
+
+ TAN_MAKE_VEC(vecu, v1, v2);
+ TAN_MAKE_VEC(vecv, v1, v3);
+ tri_to_quat( q1,v1, vecu, vecv);
+
+ TAN_MAKE_VEC(vecu, def1, def2);
+ TAN_MAKE_VEC(vecv, def1, def3);
+ tri_to_quat( q2,def1, vecu, vecv);
+
+ sub_qt_qtqt(quat, q2, q1);
+}
+#undef TAN_MAKE_VEC
+
+static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+{
+ float *vec = userData;
+
+ vec+= 3*index;
+ VECCOPY(vec, co);
+}
+
+static int modifiers_disable_subsurf_temporary(Object *ob)
+{
+ ModifierData *md;
+ int disabled = 0;
+
+ for(md=ob->modifiers.first; md; md=md->next)
+ if(md->type==eModifierType_Subsurf)
+ if(md->mode & eModifierMode_OnCage) {
+ md->mode ^= eModifierMode_DisableTemporary;
+ disabled= 1;
+ }
+
+ return disabled;
+}
+
+/* disable subsurf temporal, get mapped cos, and enable it */
+float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit)
+{
+ Mesh *me= obedit->data;
+ DerivedMesh *dm;
+ float *vertexcos;
+
+ /* disable subsurf temporal, get mapped cos, and enable it */
+ if(modifiers_disable_subsurf_temporary(obedit)) {
+ /* need to make new derivemesh */
+ makeDerivedMesh(scene, obedit, me->edit_mesh, CD_MASK_BAREMESH);
+ }
+
+ /* now get the cage */
+ dm= editmesh_get_derived_cage(scene, obedit, me->edit_mesh, CD_MASK_BAREMESH);
+
+ vertexcos= MEM_mallocN(3*sizeof(float)*me->edit_mesh->totvert, "vertexcos map");
+ dm->foreachMappedVert(dm, make_vertexcos__mapFunc, vertexcos);
+
+ dm->release(dm);
+
+ /* set back the flag, no new cage needs to be built, transform does it */
+ modifiers_disable_subsurf_temporary(obedit);
+
+ return vertexcos;
+}
+
+void crazyspace_set_quats_editmesh(EditMesh *em, float *origcos, float *mappedcos, float *quats)
+{
+ EditVert *eve, *prev;
+ EditFace *efa;
+ float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
+ intptr_t index= 0;
+
+ /* two abused locations in vertices */
+ for(eve= em->verts.first; eve; eve= eve->next, index++) {
+ eve->tmp.p = NULL;
+ eve->prev= (EditVert *)index;
+ }
+
+ /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
+ for(efa= em->faces.first; efa; efa= efa->next) {
+
+ /* retrieve mapped coordinates */
+ v1= mappedcos + 3*(intptr_t)(efa->v1->prev);
+ v2= mappedcos + 3*(intptr_t)(efa->v2->prev);
+ v3= mappedcos + 3*(intptr_t)(efa->v3->prev);
+
+ co1= (origcos)? origcos + 3*(intptr_t)(efa->v1->prev): efa->v1->co;
+ co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co;
+ co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co;
+
+ if(efa->v2->tmp.p==NULL && efa->v2->f1) {
+ set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
+ efa->v2->tmp.p= (void*)quats;
+ quats+= 4;
+ }
+
+ if(efa->v4) {
+ v4= mappedcos + 3*(intptr_t)(efa->v4->prev);
+ co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co;
+
+ if(efa->v1->tmp.p==NULL && efa->v1->f1) {
+ set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);
+ efa->v1->tmp.p= (void*)quats;
+ quats+= 4;
+ }
+ if(efa->v3->tmp.p==NULL && efa->v3->f1) {
+ set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2);
+ efa->v3->tmp.p= (void*)quats;
+ quats+= 4;
+ }
+ if(efa->v4->tmp.p==NULL && efa->v4->f1) {
+ set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3);
+ efa->v4->tmp.p= (void*)quats;
+ quats+= 4;
+ }
+ }
+ else {
+ if(efa->v1->tmp.p==NULL && efa->v1->f1) {
+ set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3);
+ efa->v1->tmp.p= (void*)quats;
+ quats+= 4;
+ }
+ if(efa->v3->tmp.p==NULL && efa->v3->f1) {
+ set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2);
+ efa->v3->tmp.p= (void*)quats;
+ quats+= 4;
+ }
+ }
+ }
+
+ /* restore abused prev pointer */
+ for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
+ eve->prev= prev;
+
+}
+
+void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float *quats)
+{
+ int i;
+ MVert *mvert;
+ MFace *mface;
+ float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
+
+ mvert= me->mvert;
+ for(i=0; i<me->totvert; i++, mvert++)
+ mvert->flag&= ~ME_VERT_TMP_TAG;
+
+ /* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
+ mvert= me->mvert;
+ mface= me->mface;
+ for(i=0; i<me->totface; i++, mface++) {
+
+ /* retrieve mapped coordinates */
+ v1= mappedcos + 3*mface->v1;
+ v2= mappedcos + 3*mface->v2;
+ v3= mappedcos + 3*mface->v3;
+
+ co1= (origcos)? origcos + 3*mface->v1: mvert[mface->v1].co;
+ co2= (origcos)? origcos + 3*mface->v2: mvert[mface->v2].co;
+ co3= (origcos)? origcos + 3*mface->v3: mvert[mface->v3].co;
+
+ if((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) {
+ set_crazy_vertex_quat(&quats[mface->v2*4], co2, co3, co1, v2, v3, v1);
+ mvert[mface->v2].flag|= ME_VERT_TMP_TAG;
+ }
+
+ if(mface->v4) {
+ v4= mappedcos + 3*mface->v4;
+ co4= (origcos)? origcos + 3*mface->v4: mvert[mface->v4].co;
+
+ if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
+ set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co4, v1, v2, v4);
+ mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
+ }
+ if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
+ set_crazy_vertex_quat(&quats[mface->v3*4], co3, co4, co2, v3, v4, v2);
+ mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
+ }
+ if((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) {
+ set_crazy_vertex_quat(&quats[mface->v4*4], co4, co1, co3, v4, v1, v3);
+ mvert[mface->v4].flag|= ME_VERT_TMP_TAG;
+ }
+ }
+ else {
+ if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
+ set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co3, v1, v2, v3);
+ mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
+ }
+ if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
+ set_crazy_vertex_quat(&quats[mface->v3*4], co3, co1, co2, v3, v1, v2);
+ mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
+ }
+ }
+ }
+}
+
+int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3])
+{
+ ModifierData *md;
+ DerivedMesh *dm;
+ int i, a, numleft = 0, numVerts = 0;
+ int cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1);
+ float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL;
+
+ modifiers_clearErrors(ob);
+
+ dm = NULL;
+ md = modifiers_getVirtualModifierList(ob);
+
+ /* compute the deformation matrices and coordinates for the first
+ modifiers with on cage editing that are enabled and support computing
+ deform matrices */
+ for(i = 0; md && i <= cageIndex; i++, md = md->next) {
+ ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+
+ if(!editmesh_modifier_is_enabled(scene, md, dm))
+ continue;
+
+ if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
+ if(!defmats) {
+ dm= editmesh_get_derived(em, NULL);
+ deformedVerts= editmesh_get_vertex_cos(em, &numVerts);
+ defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
+
+ for(a=0; a<numVerts; a++)
+ unit_m3(defmats[a]);
+ }
+
+ mti->deformMatricesEM(md, ob, em, dm, deformedVerts, defmats,
+ numVerts);
+ }
+ else
+ break;
+ }
+
+ for(; md && i <= cageIndex; md = md->next, i++)
+ if(editmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md))
+ numleft++;
+
+ if(dm)
+ dm->release(dm);
+
+ *deformmats= defmats;
+ *deformcos= deformedVerts;
+
+ return numleft;
+}
+
+int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3])
+{
+ ModifierData *md;
+ DerivedMesh *dm;
+ int a, numVerts= 0;
+ float (*defmats)[3][3]= NULL, (*deformedVerts)[3]= NULL;
+ MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0);
+ int has_multires = mmd != NULL && mmd->sculptlvl > 0;
+ int numleft= 0;
+
+ if(has_multires) {
+ *deformmats= NULL;
+ *deformcos= NULL;
+ return numleft;
+ }
+
+ dm= NULL;
+ md= modifiers_getVirtualModifierList(ob);
+
+ for(; md; md= md->next) {
+ ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+
+ if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+
+ if(mti->type==eModifierTypeType_OnlyDeform) {
+ if(!defmats) {
+ Mesh *me= (Mesh*)ob->data;
+ dm= mesh_create_derived(me, ob, NULL);
+ deformedVerts= mesh_getVertexCos(me, &numVerts);
+ defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
+
+ for(a=0; a<numVerts; a++)
+ unit_m3(defmats[a]);
+ }
+
+ if(mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts);
+ else break;
+ }
+ }
+
+ for(; md; md= md->next) {
+ ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+
+ if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+
+ if(mti->type==eModifierTypeType_OnlyDeform)
+ numleft++;
+ }
+
+ if(dm)
+ dm->release(dm);
+
+ *deformmats= defmats;
+ *deformcos= deformedVerts;
+
+ return numleft;
+}
+
+void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3])
+{
+ int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos);
+
+ if(totleft) {
+ /* there are deformation modifier which doesn't support deformation matricies
+ calculation. Need additional crazyspace correction */
+
+ float (*deformedVerts)[3]= *deformcos;
+ float (*origVerts)[3]= MEM_dupallocN(deformedVerts);
+ float *quats= NULL;
+ int i;
+ ModifierData *md= modifiers_getVirtualModifierList(ob);
+ Mesh *me= (Mesh*)ob->data;
+
+ for(; md; md= md->next) {
+ ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+
+ if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+
+ if(mti->type==eModifierTypeType_OnlyDeform)
+ mti->deformVerts(md, ob, NULL, deformedVerts, me->totvert, 0, 0);
+ }
+
+ quats= MEM_mallocN(me->totvert*sizeof(float)*4, "crazy quats");
+
+ crazyspace_set_quats_mesh(me, (float*)origVerts, (float*)deformedVerts, quats);
+
+ for(i=0; i<me->totvert; i++) {
+ float qmat[3][3], tmat[3][3];
+
+ quat_to_mat3(qmat, &quats[i*4]);
+ mul_m3_m3m3(tmat, qmat, (*deformmats)[i]);
+ copy_m3_m3((*deformmats)[i], tmat);
+ }
+
+ MEM_freeN(origVerts);
+ MEM_freeN(quats);
+ }
+}
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index dc5e17b5fae..981332c8fbf 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4042,7 +4042,7 @@ static void p_smooth(PChart *chart)
/* Exported */
-ParamHandle *param_construct_begin()
+ParamHandle *param_construct_begin(void)
{
PHandle *handle = MEM_callocN(sizeof*handle, "PHandle");
handle->construction_chart = p_chart_new(handle);