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:
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-07-04 19:56:42 +0400
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-07-04 19:56:42 +0400
commitd43e1fa7beb03368eaaa3c89ef95d69ebd693734 (patch)
tree2a63c1d49c735c48edb1ee036a8db4e424293078 /source/blender/editors
parenta953e4bbe33f24bef6fd018c7413e904a9628e5b (diff)
parent558721ab59bd4e6186005f5e9aca50e094c9e72c (diff)
svn merge ^/trunk/blender -r48095:48592
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_filter.c6
-rw-r--r--source/blender/editors/animation/drivers.c19
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c80
-rw-r--r--source/blender/editors/animation/keyframes_draw.c12
-rw-r--r--source/blender/editors/animation/keyframing.c4
-rw-r--r--source/blender/editors/armature/armature_intern.h2
-rw-r--r--source/blender/editors/armature/armature_ops.c2
-rw-r--r--source/blender/editors/armature/editarmature.c5
-rw-r--r--source/blender/editors/armature/meshlaplacian.c22
-rw-r--r--source/blender/editors/armature/poseSlide.c2
-rw-r--r--source/blender/editors/armature/poselib.c10
-rw-r--r--source/blender/editors/curve/editcurve.c34
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c2
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c38
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c6
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/include/ED_clip.h22
-rw-r--r--source/blender/editors/include/ED_node.h13
-rw-r--r--source/blender/editors/include/ED_object.h6
-rw-r--r--source/blender/editors/include/ED_screen_types.h8
-rw-r--r--source/blender/editors/include/ED_sequencer.h2
-rw-r--r--source/blender/editors/include/ED_transform.h2
-rw-r--r--source/blender/editors/include/UI_view2d.h1
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/interface/interface_draw.c114
-rw-r--r--source/blender/editors/interface/interface_handlers.c8
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_layout.c32
-rw-r--r--source/blender/editors/interface/interface_regions.c4
-rw-r--r--source/blender/editors/interface/interface_templates.c113
-rw-r--r--source/blender/editors/interface/interface_utils.c8
-rw-r--r--source/blender/editors/interface/interface_widgets.c15
-rw-r--r--source/blender/editors/interface/resources.c4
-rw-r--r--source/blender/editors/interface/view2d.c57
-rw-r--r--source/blender/editors/io/CMakeLists.txt4
-rw-r--r--source/blender/editors/io/io_collada.c101
-rw-r--r--source/blender/editors/io/io_ops.h2
-rw-r--r--source/blender/editors/mask/mask_draw.c21
-rw-r--r--source/blender/editors/mask/mask_edit.c15
-rw-r--r--source/blender/editors/mask/mask_intern.h1
-rw-r--r--source/blender/editors/mask/mask_relationships.c13
-rw-r--r--source/blender/editors/mask/mask_select.c6
-rw-r--r--source/blender/editors/mask/mask_shapekey.c178
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c24
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c8
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c2
-rw-r--r--source/blender/editors/mesh/editmesh_select.c69
-rw-r--r--source/blender/editors/mesh/editmesh_slide.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c84
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c4
-rw-r--r--source/blender/editors/mesh/meshtools.c20
-rw-r--r--source/blender/editors/object/object_bake.c12
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/object/object_group.c107
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_modifier.c189
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/object/object_select.c2
-rw-r--r--source/blender/editors/physics/physics_fluid.c9
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/screen/screen_edit.c4
-rw-r--r--source/blender/editors/screen/screen_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c48
-rw-r--r--source/blender/editors/space_action/action_select.c21
-rw-r--r--source/blender/editors/space_api/spacetypes.c4
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c2
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c12
-rw-r--r--source/blender/editors/space_clip/clip_draw.c24
-rw-r--r--source/blender/editors/space_clip/clip_editor.c357
-rw-r--r--source/blender/editors/space_clip/clip_intern.h4
-rw-r--r--source/blender/editors/space_clip/clip_ops.c52
-rw-r--r--source/blender/editors/space_clip/clip_utils.c7
-rw-r--r--source/blender/editors/space_clip/space_clip.c97
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c22
-rw-r--r--source/blender/editors/space_clip/tracking_select.c15
-rw-r--r--source/blender/editors/space_file/file_intern.h2
-rw-r--r--source/blender/editors/space_file/file_ops.c7
-rw-r--r--source/blender/editors/space_file/file_panels.c6
-rw-r--r--source/blender/editors/space_file/filelist.c20
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c64
-rw-r--r--source/blender/editors/space_graph/graph_draw.c4
-rw-r--r--source/blender/editors/space_graph/space_graph.c10
-rw-r--r--source/blender/editors/space_image/image_buttons.c46
-rw-r--r--source/blender/editors/space_image/image_ops.c4
-rw-r--r--source/blender/editors/space_info/info_ops.c6
-rw-r--r--source/blender/editors/space_logic/logic_window.c320
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c46
-rw-r--r--source/blender/editors/space_nla/nla_draw.c8
-rw-r--r--source/blender/editors/space_node/drawnode.c364
-rw-r--r--source/blender/editors/space_node/node_buttons.c12
-rw-r--r--source/blender/editors/space_node/node_draw.c31
-rw-r--r--source/blender/editors/space_node/node_edit.c1467
-rw-r--r--source/blender/editors/space_node/node_header.c2
-rw-r--r--source/blender/editors/space_node/node_templates.c180
-rw-r--r--source/blender/editors/space_node/space_node.c325
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c33
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c108
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c18
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c12
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c4
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c4
-rw-r--r--source/blender/editors/space_text/text_ops.c6
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c84
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c42
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c22
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/editors/transform/transform.c43
-rw-r--r--source/blender/editors/transform/transform.h1
-rw-r--r--source/blender/editors/transform/transform_constraints.c18
-rw-r--r--source/blender/editors/transform/transform_conversions.c24
-rw-r--r--source/blender/editors/transform/transform_generics.c2
-rw-r--r--source/blender/editors/transform/transform_manipulator.c2
-rw-r--r--source/blender/editors/transform/transform_snap.c278
-rw-r--r--source/blender/editors/util/undo.c5
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c3
127 files changed, 3436 insertions, 2473 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 46e1eb98dae..a6d1ac64bbe 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2397,13 +2397,15 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
case ANIMCONT_GPENCIL:
{
- items = animdata_filter_gpencil(anim_data, data, filter_mode);
+ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
+ items = animdata_filter_gpencil(anim_data, data, filter_mode);
}
break;
case ANIMCONT_MASK:
{
- items = animdata_filter_mask(anim_data, data, filter_mode);
+ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
+ items = animdata_filter_mask(anim_data, data, filter_mode);
}
break;
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 4a5966948ae..672e11ac613 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -416,6 +416,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro
char *basepath = RNA_path_from_ID_to_property(ptr, prop);
char *path = basepath; /* in case no remapping is needed */
+
/* Remapping will only be performed in the Properties Editor, as only this
* restricts the subspace of options to the 'active' data (a manageable state)
*/
@@ -426,23 +427,6 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro
if (ob && id) {
/* only id-types which can be remapped to go through objects should be considered */
switch (GS(id->name)) {
- case ID_MA: /* materials */
- {
- Material *ma = give_current_material(ob, ob->actcol);
-
- /* assumes: material will only be shown if it is active objects's active material it's ok */
- if ((ID *)ma == id) {
- /* create new path */
- // TODO: use RNA path functions to construct instead?
- path = BLI_sprintfN("material_slots[\"%s\"].material.%s",
- ma->id.name + 2, basepath);
-
- /* free old one */
- MEM_freeN(basepath);
- }
- }
- break;
-
case ID_TE: /* textures */
{
Material *ma = give_current_material(ob, ob->actcol);
@@ -452,6 +436,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro
if ((ID *)tex == id) {
/* create new path */
// TODO: use RNA path functions to construct step by step instead?
+ // FIXME: maybe this isn't even needed anymore...
path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s",
ma->id.name + 2, tex->id.name + 2, basepath);
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index ea875567705..8c1e2bedd86 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -123,7 +123,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* basic settings (backdrop + mode selector + some padding) */
- /* col= uiLayoutColumn(layout, 1); */ /* UNUSED */
+ /* col = uiLayoutColumn(layout, TRUE); */ /* UNUSED */
block = uiLayoutGetBlock(layout);
uiBlockBeginAlign(block);
but = uiDefButR(block, MENU, B_FMODIFIER_REDRAW, NULL, 0, 0, width - 30, UI_UNIT_Y, &ptr, "mode", -1, 0, 0, -1, -1, NULL);
@@ -141,7 +141,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
unsigned int i;
/* draw polynomial order selector */
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
block = uiLayoutGetBlock(row);
but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width - 30, 19,
&data->poly_order, 1, 100, 0, 0,
@@ -150,7 +150,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* draw controls for each coefficient and a + sign at end of row */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
block = uiLayoutGetBlock(row);
cp = data->coefficients;
@@ -177,7 +177,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
uiDefBut(block, LABEL, 1, "+", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
/* next coefficient on a new row */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
block = uiLayoutGetBlock(row);
}
else {
@@ -194,7 +194,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
unsigned int i;
/* draw polynomial order selector */
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
block = uiLayoutGetBlock(row);
but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width - 30, 19,
&data->poly_order, 1, 100, 0, 0,
@@ -203,7 +203,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
/* draw controls for each pair of coefficients */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
block = uiLayoutGetBlock(row);
cp = data->coefficients;
@@ -230,7 +230,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
uiDefBut(block, LABEL, 1, ") +", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
/* set up new row for the next pair of coefficients*/
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
block = uiLayoutGetBlock(row);
}
else
@@ -253,11 +253,11 @@ static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm
RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
/* add the settings */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, &ptr, "function_type", 0, "", ICON_NONE);
uiItemR(col, &ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0); // no grouping for now
+ col = uiLayoutColumn(layout, FALSE); // no grouping for now
uiItemR(col, &ptr, "amplitude", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "phase_multiplier", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "phase_offset", 0, NULL, ICON_NONE);
@@ -278,16 +278,16 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
/* split into 2 columns
* NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
*/
- split = uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, FALSE);
/* before range */
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiItemL(col, IFACE_("Before:"), ICON_NONE);
uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
/* after range */
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiItemL(col, IFACE_("After:"), ICON_NONE);
uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
@@ -308,15 +308,15 @@ static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short
uiItemR(layout, &ptr, "blend_type", 0, NULL, ICON_NONE);
/* split into 2 columns */
- split = uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, FALSE);
/* col 1 */
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiItemR(col, &ptr, "scale", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "strength", 0, NULL, ICON_NONE);
/* col 2 */
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiItemR(col, &ptr, "phase", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "depth", 0, NULL, ICON_NONE);
}
@@ -499,18 +499,18 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr);
/* general settings */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE);
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, &ptr, "default_min", 0, IFACE_("Min"), ICON_NONE);
uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE);
/* control points header */
// TODO: move this control-point control stuff to using the new special widgets for lists
// the current way is far too cramped
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
block = uiLayoutGetBlock(row);
uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
@@ -522,7 +522,7 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
/* control points list */
for (i = 0, fed = env->data; i < env->totvert; i++, fed++) {
/* get a new row to operate on */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
block = uiLayoutGetBlock(row);
uiBlockBeginAlign(block);
@@ -555,36 +555,36 @@ static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, shor
/* row 1: minimum */
{
- /* row= uiLayoutRow(layout, 0); */ /* UNUSED */
+ /* row = uiLayoutRow(layout, FALSE); */ /* UNUSED */
/* split into 2 columns */
- split = uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, FALSE);
/* x-minimum */
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiItemR(col, &ptr, "use_min_x", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "min_x", 0, NULL, ICON_NONE);
/* y-minimum*/
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiItemR(col, &ptr, "use_min_y", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "min_y", 0, NULL, ICON_NONE);
}
/* row 2: maximum */
{
- /* row= uiLayoutRow(layout, 0); */ /* UNUSED */
+ /* row = uiLayoutRow(layout, FALSE); */ /* UNUSED */
/* split into 2 columns */
- split = uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, FALSE);
/* x-minimum */
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiItemR(col, &ptr, "use_max_x", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "max_x", 0, NULL, ICON_NONE);
/* y-minimum*/
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiItemR(col, &ptr, "use_max_y", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "max_y", 0, NULL, ICON_NONE);
}
@@ -602,23 +602,23 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
RNA_pointer_create(id, &RNA_FModifierStepped, fcm, &ptr);
/* block 1: "stepping" settings */
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, &ptr, "frame_step", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "frame_offset", 0, NULL, ICON_NONE);
/* block 2: start range settings */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, &ptr, "use_frame_start", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_start"));
uiItemR(sub, &ptr, "frame_start", 0, NULL, ICON_NONE);
/* block 3: end range settings */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, &ptr, "use_frame_end", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_frame_end"));
uiItemR(sub, &ptr, "frame_end", 0, NULL, ICON_NONE);
}
@@ -642,11 +642,11 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
/* get layout-row + UI-block for this */
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
block = uiLayoutGetBlock(row); // err...
/* left-align -------------------------------------------- */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -664,7 +664,7 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
uiItemL(sub, "<Unknown Modifier>", ICON_NONE);
/* right-align ------------------------------------------- */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
@@ -726,28 +726,28 @@ void ANIM_uiTemplate_fmodifier_draw(uiLayout *layout, ID *id, ListBase *modifier
box = uiLayoutBox(layout);
/* restricted range ----------------------------------------------------- */
- col = uiLayoutColumn(box, 1);
+ col = uiLayoutColumn(box, TRUE);
/* top row: use restricted range */
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, &ptr, "use_restricted_range", 0, NULL, ICON_NONE);
if (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) {
/* second row: settings */
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
uiItemR(row, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
/* third row: blending influence */
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, &ptr, "blend_in", 0, IFACE_("In"), ICON_NONE);
uiItemR(row, &ptr, "blend_out", 0, IFACE_("Out"), ICON_NONE);
}
/* influence -------------------------------------------------------------- */
- col = uiLayoutColumn(box, 1);
+ col = uiLayoutColumn(box, TRUE);
/* top row: use influence */
uiItemR(col, &ptr, "use_influence", 0, NULL, ICON_NONE);
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index e6fc4d5a168..46a89963ad9 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -847,9 +847,17 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through each F-Curve, grabbing the keyframes */
- for (ale = anim_data.first; ale; ale = ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next) {
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
-
+
+ if (ale->datatype == ALE_MASKLAY) {
+ mask_to_keylist(ac->ads, ale->data, keys);
+ }
+ else if (ale->datatype == ALE_GPFRAME) {
+ gpl_to_keylist(ac->ads, ale->data, keys);
+ }
+ }
+
BLI_freelistN(&anim_data);
}
}
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 6250424d655..0c9a6ff6bf1 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -201,7 +201,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr,
grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
if (grp) {
agrp->customCol = grp->customCol;
- action_group_colors_sync(agrp);
+ action_group_colors_sync(agrp, grp);
}
}
}
@@ -1581,7 +1581,7 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
ot->flag = OPTYPE_UNDO;
/* properties */
- RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyfames from all elements of the array");
+ RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyframes from all elements of the array");
}
/* ******************************************* */
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 0760b384ecd..ddf66a6169b 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -183,7 +183,7 @@ LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, con
void POSELIB_OT_new(struct wmOperatorType *ot);
void POSELIB_OT_unlink(struct wmOperatorType *ot);
-void POSELIB_OT_action_sanitise(struct wmOperatorType *ot);
+void POSELIB_OT_action_sanitize(struct wmOperatorType *ot);
void POSELIB_OT_pose_add(struct wmOperatorType *ot);
void POSELIB_OT_pose_remove(struct wmOperatorType *ot);
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index f3461f71391..59ee90c553b 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -159,7 +159,7 @@ void ED_operatortypes_armature(void)
WM_operatortype_append(POSELIB_OT_new);
WM_operatortype_append(POSELIB_OT_unlink);
- WM_operatortype_append(POSELIB_OT_action_sanitise);
+ WM_operatortype_append(POSELIB_OT_action_sanitize);
/* POSE SLIDING */
WM_operatortype_append(POSE_OT_push);
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index ea3c8685525..6cef843d828 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -4563,7 +4563,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
}
}
- /* if there are some dependencies for visualising armature state
+ /* if there are some dependencies for visualizing armature state
* (e.g. Mask Modifier in 'Armature' mode), force update
*/
else if (arm->flag & ARM_HAS_VIZ_DEPS) {
@@ -4828,6 +4828,9 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
if (numbones == 0)
return;
+ if (ED_vgroup_data_create(ob->data) == FALSE)
+ return;
+
/* create an array of pointer to bones that are skinnable
* and fill it with all of the skinnable bones */
bonelist = MEM_callocN(numbones * sizeof(Bone *), "bonelist");
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index ab96656406e..6b6d2a1505f 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -667,25 +667,27 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
*err_str = NULL;
/* count triangles and create mask */
- if ( (use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
- (use_vert_sel = ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
+ if ((use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
+ (use_vert_sel = ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
{
mask = MEM_callocN(sizeof(int) * me->totvert, "heat_bone_weighting mask");
- }
- for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
if (use_vert_sel) {
- for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
- if (use_vert_sel) {
- mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
+ for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
+ for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+ if (use_vert_sel) {
+ mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
+ }
}
}
}
else if (use_face_sel) {
- if (mp->flag & ME_FACE_SEL) {
- for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
- mask[ml->v] = 1;
+ for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
+ if (mp->flag & ME_FACE_SEL) {
+ for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+ mask[ml->v] = 1;
+ }
}
}
}
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index 824a39374fd..51700793791 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -220,7 +220,7 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val)
else {
/* - these weights are derived from the relative distance of these
* poses from the current frame
- * - they then get normalised so that they only sum up to 1
+ * - they then get normalized so that they only sum up to 1
*/
float wtot;
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 18e3d967835..ee54fc2c6fe 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -288,7 +288,7 @@ void POSELIB_OT_unlink(wmOperatorType *ot)
/* This tool automagically generates/validates poselib data so that it corresponds to the data
* in the action. This is for use in making existing actions usable as poselibs.
*/
-static int poselib_sanitise_exec(bContext *C, wmOperator *op)
+static int poselib_sanitize_exec(bContext *C, wmOperator *op)
{
Object *ob = get_poselib_object(C);
bAction *act = (ob) ? ob->poselib : NULL;
@@ -353,15 +353,15 @@ static int poselib_sanitise_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-void POSELIB_OT_action_sanitise(wmOperatorType *ot)
+void POSELIB_OT_action_sanitize(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Sanitise Pose Library Action";
- ot->idname = "POSELIB_OT_action_sanitise";
+ ot->name = "Sanitize Pose Library Action";
+ ot->idname = "POSELIB_OT_action_sanitize";
ot->description = "Make action suitable for use as a Pose Library";
/* callbacks */
- ot->exec = poselib_sanitise_exec;
+ ot->exec = poselib_sanitize_exec;
ot->poll = has_poselib_pose_data_poll;
/* flags */
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 2fa7b4b2126..e8a71a35576 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1199,8 +1199,6 @@ void load_editNurb(Object *obedit)
if (obedit == NULL) return;
- set_actNurb(obedit, NULL);
-
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
Nurb *nu, *newnu;
@@ -1222,8 +1220,6 @@ void load_editNurb(Object *obedit)
BKE_nurbList_free(&oldnurb);
}
-
- set_actNurb(obedit, NULL);
}
/* make copy in cu->editnurb */
@@ -1234,7 +1230,6 @@ void make_editNurb(Object *obedit)
Nurb *nu, *newnu, *nu_act = NULL;
KeyBlock *actkey;
-
set_actNurb(obedit, NULL);
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
@@ -2373,7 +2368,7 @@ void CURVE_OT_smooth_radius(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Smooth Curve Radius";
- ot->description = "Flatten radiuses of selected points";
+ ot->description = "Flatten radii of selected points";
ot->idname = "CURVE_OT_smooth_radius";
/* api clastbacks */
@@ -3937,8 +3932,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
ListBase *nubase = object_editcurve_get(obedit);
Nurb *nu, *nu1 = NULL, *nu2 = NULL;
BPoint *bp;
- float *fp, offset;
- int a, ok = 0;
+ int ok = 0;
+ /* int a; */ /* UNUSED */
/* first decide if this is a surface merge! */
if (obedit->type == OB_SURF) nu = nubase->first;
@@ -4046,32 +4041,19 @@ static int make_segment_exec(bContext *C, wmOperator *op)
MEM_freeN(nu1->bp);
nu1->bp = bp;
- a = nu1->pntsu + nu1->orderu;
+ /* a = nu1->pntsu + nu1->orderu; */ /* UNUSED */
nu1->pntsu += nu2->pntsu;
BLI_remlink(nubase, nu2);
/* now join the knots */
if (nu1->type == CU_NURBS) {
- if (nu1->knotsu == NULL) {
- BKE_nurb_knot_calc_u(nu1);
- }
- else {
- fp = MEM_mallocN(sizeof(float) * KNOTSU(nu1), "addsegment3");
- memcpy(fp, nu1->knotsu, sizeof(float) * a);
+ if (nu1->knotsu != NULL) {
MEM_freeN(nu1->knotsu);
- nu1->knotsu = fp;
-
-
- offset = nu1->knotsu[a - 1] + 1.0f;
- fp = nu1->knotsu + a;
- for (a = 0; a < nu2->pntsu; a++, fp++) {
- if (nu2->knotsu)
- *fp = offset + nu2->knotsu[a + 1];
- else
- *fp = offset;
- }
+ nu1->knotsu = NULL;
}
+
+ BKE_nurb_knot_calc_u(nu1);
}
BKE_nurb_free(nu2); nu2 = NULL;
}
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index fa555b0ddb8..6d113cbb924 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -281,7 +281,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s,
}
/* tessellation code - draw stroke as series of connected quads with connection
- * edges rotated to minimise shrinking artifacts, and rounded endcaps
+ * edges rotated to minimize shrinking artifacts, and rounded endcaps
*/
else {
bGPDspoint *pt1, *pt2;
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index a7beaa74eb7..b69db0040b5 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -399,7 +399,7 @@ void paste_gpdata(Scene *scene)
/* this should be the right frame... as it may be a pre-existing frame,
* must make sure that only compatible stroke types get copied over
* - we cannot just add a duplicate frame, as that would cause errors
- * - need to check for compatible types to minimise memory usage (copying 'junk' over)
+ * - need to check for compatible types to minimize memory usage (copying 'junk' over)
*/
for (gps = gpfs->strokes.first; gps; gps = gps->next) {
short stroke_ok;
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 4c125ebe013..d90ec02b0c1 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -113,20 +113,20 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
/* get layout-row + UI-block for header */
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
block = uiLayoutGetBlock(row); /* err... */
uiBlockSetEmboss(block, UI_EMBOSSN);
/* left-align ............................... */
- sub = uiLayoutRow(row, 0);
+ sub = uiLayoutRow(row, FALSE);
/* active */
block = uiLayoutGetBlock(sub);
icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
but = uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &gpd->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer"));
+ &gpl->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer"));
uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl);
/* locked */
@@ -151,7 +151,7 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
/* delete button (only if hidden but not locked!) */
if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) {
/* right-align ............................... */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
block = uiLayoutGetBlock(sub); /* XXX... err... */
@@ -179,7 +179,7 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
/* delete 'button' */
uiBlockSetEmboss(block, UI_EMBOSSN);
/* right-align ............................... */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
block = uiLayoutGetBlock(sub); /* XXX... err... */
@@ -190,14 +190,14 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
/* new backdrop ----------------------------------- */
box = uiLayoutBox(layout);
- split = uiLayoutSplit(box, 0.5f, 0);
+ split = uiLayoutSplit(box, 0.5f, FALSE);
/* draw settings ---------------------------------- */
/* left column ..................... */
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
/* color */
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiItemR(sub, &ptr, "color", 0, "", ICON_NONE);
uiItemR(sub, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -210,10 +210,10 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
}
/* right column ................... */
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
/* onion-skinning */
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiItemR(sub, &ptr, "use_onion_skinning", 0, NULL, ICON_NONE);
uiItemR(sub, &ptr, "ghost_range_max", 0, IFACE_("Frames"), ICON_NONE);
@@ -236,14 +236,14 @@ static void draw_gpencil_space_specials(const bContext *C, uiLayout *layout)
uiLayout *col, *row;
SpaceClip *sc = CTX_wm_space_clip(C);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
if (sc) {
bScreen *screen = CTX_wm_screen(C);
PointerRNA sc_ptr;
RNA_pointer_create(&screen->id, &RNA_SpaceClipEditor, sc, &sc_ptr);
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, &sc_ptr, "grease_pencil_source", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
}
@@ -262,7 +262,7 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
RNA_id_pointer_create((ID *)gpd, &gpd_ptr);
/* draw gpd settings first ------------------------------------- */
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
/* current Grease Pencil block */
/* TODO: show some info about who owns this? */
@@ -270,7 +270,7 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
/* add new layer button - can be used even when no data, since it can add a new block too */
uiItemO(col, IFACE_("New Layer"), ICON_NONE, "GPENCIL_OT_layer_add");
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemO(row, IFACE_("Delete Frame"), ICON_NONE, "GPENCIL_OT_active_frame_delete");
uiItemO(row, IFACE_("Convert"), ICON_NONE, "GPENCIL_OT_convert");
@@ -280,12 +280,12 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
/* draw each layer --------------------------------------------- */
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
gp_drawui_layer(col, gpd, gpl, is_v3d);
}
/* draw gpd drawing settings first ------------------------------------- */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
/* label */
uiItemL(col, IFACE_("Drawing Settings:"), ICON_NONE);
@@ -298,17 +298,17 @@ static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, Poin
}
/* drawing space options */
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "VIEW", NULL, ICON_NONE);
uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "CURSOR", NULL, ICON_NONE);
if (sc == NULL) {
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiLayoutSetActive(row, v3d_stroke_opts);
uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "SURFACE", NULL, ICON_NONE);
uiItemEnumR_string(row, &gpd_ptr, "draw_mode", "STROKE", NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiLayoutSetActive(row, v3d_stroke_opts == STROKE_OPTS_V3D_ON);
uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, ICON_NONE);
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 6d90824668e..12b002ef612 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -56,6 +56,7 @@
#include "ED_gpencil.h"
#include "ED_screen.h"
#include "ED_view3d.h"
+#include "ED_clip.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -1032,8 +1033,9 @@ static int gp_session_initdata(bContext *C, tGPsdata *p)
p->custom_color[3] = 0.9f;
if (sc->gpencil_src == SC_GPENCIL_SRC_TRACK) {
- int framenr = sc->user.framenr;
- MovieTrackingTrack *track = BKE_tracking_track_get_active(&sc->clip->tracking);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+ int framenr = ED_space_clip_get_clip_frame_number(sc);
+ MovieTrackingTrack *track = BKE_tracking_track_get_active(&clip->tracking);
MovieTrackingMarker *marker = BKE_tracking_marker_get_exact(track, framenr);
p->imat[3][0] -= marker->pos[0];
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 24aa88a36bd..e1401a8ff88 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -177,7 +177,7 @@ typedef enum eAnim_KeyType {
ALE_NONE = 0, /* no keyframe data */
ALE_FCURVE, /* F-Curve */
ALE_GPFRAME, /* Grease Pencil Frames */
- ALE_MASKLAY, /* Mask */
+ ALE_MASKLAY, /* Mask */
ALE_NLASTRIP, /* NLA Strips */
ALE_ALL, /* All channels summary */
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 3a9d73ccf10..2670fb5b042 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -42,6 +42,8 @@ struct SpaceClip;
struct wmEvent;
/* ** clip_editor.c ** */
+
+/* common poll functions */
int ED_space_clip_poll(struct bContext *C);
int ED_space_clip_view_clip_poll(struct bContext *C);
@@ -50,14 +52,10 @@ int ED_space_clip_tracking_poll(struct bContext *C);
int ED_space_clip_maskedit_poll(struct bContext *C);
int ED_space_clip_maskedit_mask_poll(bContext *C);
-struct MovieClip *ED_space_clip_get_clip(struct SpaceClip *sc);
-void ED_space_clip_set_clip(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip);
-
-void ED_space_clip_get_zoom(struct SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy);
-
-void ED_space_clip_get_clip_size(struct SpaceClip *sc, int *width, int *height);
-void ED_space_clip_get_clip_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
-void ED_space_clip_get_clip_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
+void ED_space_clip_get_size(const struct bContext *C, int *width, int *height);
+void ED_space_clip_get_zoom(const struct bContext *C, float *zoomx, float *zoomy);
+void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
+void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc);
@@ -65,18 +63,18 @@ struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc);
struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2], float *scale, float *angle);
void ED_clip_update_frame(const struct Main *mainp, int cfra);
-int ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
+int ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, int fit);
void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(const struct bContext *C, float x, float y, float *xr, float *yr);
-void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float co[2], float r_co[2]);
+void ED_clip_point_stable_pos__reverse(const struct bContext *C, const float co[2], float r_co[2]);
void ED_clip_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]);
int ED_space_clip_check_show_trackedit(struct SpaceClip *sc);
int ED_space_clip_check_show_maskedit(struct SpaceClip *sc);
-void ED_space_clip_get_mask_size(struct SpaceClip *sc, int *width, int *height);
-void ED_space_clip_get_mask_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
+struct MovieClip *ED_space_clip_get_clip(struct SpaceClip *sc);
+void ED_space_clip_set_clip(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip);
struct Mask *ED_space_clip_get_mask(struct SpaceClip *sc);
void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct Mask *mask);
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 66e65d114cb..6f86d01fb98 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -41,10 +41,20 @@ struct bNodeTree;
struct bNode;
struct bNodeTree;
struct ScrArea;
+struct View2D;
+
+typedef enum {
+ NODE_TOP = 1,
+ NODE_BOTTOM = 2,
+ NODE_LEFT = 4,
+ NODE_RIGHT = 8
+} NodeBorder;
/* drawnode.c */
void ED_init_node_butfuncs(void);
+void drawnodesnap(struct View2D *v2d, const float cent[2], float size, NodeBorder border);
+
/* node_draw.c */
void ED_node_tree_update(struct SpaceNode *snode, struct Scene *scene);
void ED_node_changed_update(struct ID *id, struct bNode *node);
@@ -61,6 +71,9 @@ void ED_node_link_insert(struct ScrArea *sa);
void ED_node_post_apply_transform(struct bContext *C, struct bNodeTree *ntree);
void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node);
+
+void ED_node_sample_set(const float col[4]);
+
/* node ops.c */
void ED_operatormacros_node(void);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 9c10a270ef8..9209bbb2db7 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -176,6 +176,12 @@ int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene,
struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
+int ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, int include_orig,
+ int (*callback)(struct Object *ob, void *callback_data),
+ void *callback_data);
+
+int ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index c53dca47da9..6b9d8385ac3 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -76,10 +76,10 @@ typedef struct ScreenFrameRateInfo {
/* Enum for Action Zone Edges. Which edge of area is action zone. */
typedef enum {
- AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimised to the top left */
- AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimised to the top right */
- AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimised to the bottom right */
- AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_edge is action zone. Region minimised to the top left */
+ AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimized to the top left */
+ AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimized to the top right */
+ AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimized to the bottom right */
+ AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_edge is action zone. Region minimized to the top left */
} AZEdge;
/* for editing areas/regions */
diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h
index cea567254de..7ba26f30c39 100644
--- a/source/blender/editors/include/ED_sequencer.h
+++ b/source/blender/editors/include/ED_sequencer.h
@@ -33,4 +33,6 @@ struct Sequence;
void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, int deselect_all);
void ED_sequencer_deselect_all(struct Scene *scene);
+void ED_operatormacros_sequencer(void);
+
#endif /* __ED_SEQUENCER_H__ */
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 608df8dd9b3..d7e9fc323a6 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -180,6 +180,8 @@ int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, cons
int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
+int snapNodesTransform(struct TransInfo *t, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode);
+int snapNodesContext(struct bContext *C, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode);
#endif
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 469388219d6..5039a30b61a 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -166,6 +166,7 @@ void UI_view2d_view_restore(const struct bContext *C);
View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy);
void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag);
void UI_view2d_constant_grid_draw(struct View2D *v2d);
+void UI_view2d_multi_grid_draw(struct View2D *v2d, float step, int level_size, int totlevels);
void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy);
void UI_view2d_grid_free(View2DGrid *grid);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index d26c8cefdf0..49d56d427ba 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -498,7 +498,7 @@ static int ui_but_float_precision(uiBut *but, double value)
return prec;
}
-static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines)
+static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines)
{
rcti rect;
@@ -511,7 +511,7 @@ static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines)
if (line->flag & UI_SELECT)
glColor3ub(100, 100, 100);
- else if (hilightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)))
+ else if (highlightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE)))
UI_ThemeColor(TH_TEXT_HI);
else
glColor3ub(0, 0, 0);
@@ -919,7 +919,7 @@ void uiEndBlock(const bContext *C, uiBlock *block)
if (ui_but_update_from_old_block(C, block, &but))
ui_check_but(but);
- /* temp? Proper check for greying out */
+ /* temp? Proper check for graying out */
if (but->optype) {
wmOperatorType *ot = but->optype;
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 0007facdf8f..f173e7ce630 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1310,7 +1310,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
fx = rect->xmin + zoomx * (-offsx);
if (fx > rect->xmin) fx -= dx * (floorf(fx - rect->xmin));
while (fx < rect->xmax) {
- glVertex2f(fx, rect->ymin);
+ glVertex2f(fx, rect->ymin);
glVertex2f(fx, rect->ymax);
fx += dx;
}
@@ -1319,7 +1319,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
fy = rect->ymin + zoomy * (-offsy);
if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin));
while (fy < rect->ymax) {
- glVertex2f(rect->xmin, fy);
+ glVertex2f(rect->xmin, fy);
glVertex2f(rect->xmax, fy);
fy += dy;
}
@@ -1346,7 +1346,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
cumap = (CurveMapping *)(but->editcumap ? but->editcumap : but->poin);
cuma = cumap->cm + cumap->cur;
-
+
/* need scissor test, curve can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
scissor_new.xmin = ar->winrct.xmin + rect->xmin;
@@ -1363,53 +1363,56 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
offsy = cumap->curr.ymin - but->aspect / zoomy;
/* backdrop */
- if (cumap->flag & CUMA_DO_CLIP) {
- gl_shaded_color((unsigned char *)wcol->inner, -20);
- glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
- glColor3ubv((unsigned char *)wcol->inner);
- glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
- rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
- rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
- rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
+ if (but->a1 == UI_GRAD_H) {
+ /* magic trigger for curve backgrounds */
+ rcti grid;
+ float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
+
+ grid.xmin = rect->xmin + zoomx * (-offsx);
+ grid.xmax = rect->xmax + zoomx * (-offsx);
+ grid.ymin = rect->ymin + zoomy * (-offsy);
+ grid.ymax = rect->ymax + zoomy * (-offsy);
+
+ ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
+
+ /* grid, hsv uses different grid */
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4ub(0, 0, 0, 48);
+ ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
+ glDisable(GL_BLEND);
}
else {
- glColor3ubv((unsigned char *)wcol->inner);
- glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
- }
-
- /* grid, every 0.25 step */
- gl_shaded_color((unsigned char *)wcol->inner, -16);
- ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
- /* grid, every 1.0 step */
- gl_shaded_color((unsigned char *)wcol->inner, -24);
- ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
- /* axes */
- gl_shaded_color((unsigned char *)wcol->inner, -50);
- glBegin(GL_LINES);
- glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
- glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));
- glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymin);
- glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymax);
- glEnd();
-
- /* magic trigger for curve backgrounds */
- if (but->a1 != -1) {
- if (but->a1 == UI_GRAD_H) {
- rcti grid;
- float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
-
- grid.xmin = rect->xmin + zoomx * (-offsx);
- grid.xmax = rect->xmax + zoomx * (-offsx);
- grid.ymin = rect->ymin + zoomy * (-offsy);
- grid.ymax = rect->ymax + zoomy * (-offsy);
-
- glEnable(GL_BLEND);
- ui_draw_gradient(&grid, col, UI_GRAD_H, 0.5f);
- glDisable(GL_BLEND);
+ if (cumap->flag & CUMA_DO_CLIP) {
+ gl_shaded_color((unsigned char *)wcol->inner, -20);
+ glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
+ glColor3ubv((unsigned char *)wcol->inner);
+ glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
+ rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
+ rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
+ rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
+ }
+ else {
+ glColor3ubv((unsigned char *)wcol->inner);
+ glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
+
+ /* grid, every 0.25 step */
+ gl_shaded_color((unsigned char *)wcol->inner, -16);
+ ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
+ /* grid, every 1.0 step */
+ gl_shaded_color((unsigned char *)wcol->inner, -24);
+ ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
+ /* axes */
+ gl_shaded_color((unsigned char *)wcol->inner, -50);
+ glBegin(GL_LINES);
+ glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
+ glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));
+ glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymin);
+ glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymax);
+ glEnd();
}
-
-
+
/* cfra option */
/* XXX 2.48 */
#if 0
@@ -1423,11 +1426,21 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
#endif
/* sample option */
- /* XXX 2.48 */
-#if 0
if (cumap->flag & CUMA_DRAW_SAMPLE) {
- if (cumap->cur == 3) {
- float lum = cumap->sample[0] * 0.35f + cumap->sample[1] * 0.45f + cumap->sample[2] * 0.2f;
+ if (but->a1 == UI_GRAD_H) {
+ float tsample[3];
+ float hsv[3];
+ linearrgb_to_srgb_v3_v3(tsample, cumap->sample);
+ rgb_to_hsv_v(tsample, hsv);
+ glColor3ub(240, 240, 240);
+
+ glBegin(GL_LINES);
+ glVertex2f(rect->xmin + zoomx * (hsv[0] - offsx), rect->ymin);
+ glVertex2f(rect->xmin + zoomx * (hsv[0] - offsx), rect->ymax);
+ glEnd();
+ }
+ else if (cumap->cur == 3) {
+ float lum = rgb_to_bw(cumap->sample);
glColor3ub(240, 240, 240);
glBegin(GL_LINES);
@@ -1449,7 +1462,6 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glEnd();
}
}
-#endif
/* the curve */
glColor3ubv((unsigned char *)wcol->item);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index a8a7a55c653..30c5f2fbe40 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3362,7 +3362,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND
ui_get_but_vectorf(but, rgb);
rgb_to_hsv_compat_v(rgb, hsv);
- /* Convert current colour on hue/sat disc to circular coordinates phi, r */
+ /* Convert current color on hue/sat disc to circular coordinates phi, r */
phi = fmodf(hsv[0] + 0.25f, 1.0f) * -2.0f * (float)M_PI;
r = hsv[1];
/* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */
@@ -5009,7 +5009,7 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
ui_window_to_block(ar, block, &mx, &my);
for (but = block->buttons.first; but; but = but->next) {
- /* note, LABEL is included for hilights, this allows drags */
+ /* note, LABEL is included for highlights, this allows drags */
if (but->type == LABEL && but->dragpoin == NULL)
continue;
if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
@@ -6244,9 +6244,9 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
case YKEY:
case ZKEY:
{
- if ((event->val == KM_PRESS) &&
+ if ((event->val == KM_PRESS) &&
(event->shift == FALSE) &&
- (event->ctrl == FALSE) &&
+ (event->ctrl == FALSE) &&
(event->oskey == FALSE))
{
for (but = block->buttons.first; but; but = but->next) {
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 9af3ff3bdd8..1f88db033a4 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -447,7 +447,7 @@ extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *r
/* interface_draw.c */
extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select);
-void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha);
+void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha);
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 4c2d86de502..3270015271a 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -370,7 +370,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
int colbuts = len / (2 * cols);
int layer_used = 0;
- uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0));
+ uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, FALSE));
unit = UI_UNIT_X * 0.75;
butw = unit;
@@ -409,7 +409,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
int totdim, dim_size[3]; /* 3 == RNA_MAX_ARRAY_DIMENSION */
int row, col;
- uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 1));
+ uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, TRUE));
totdim = RNA_property_array_dimension(ptr, prop, dim_size);
if (totdim != 2) return; /* only 2D matrices supported in UI so far */
@@ -532,7 +532,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
PropertySubType subtype;
int labelw;
- sub = uiLayoutRow(layout, 0);
+ sub = uiLayoutRow(layout, FALSE);
uiBlockSetCurLayout(block, sub);
if (name[0]) {
@@ -550,7 +550,7 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
subtype = RNA_property_subtype(prop);
if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
- uiBlockSetCurLayout(block, uiLayoutRow(sub, 1));
+ uiBlockSetCurLayout(block, uiLayoutRow(sub, TRUE));
uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w - UI_UNIT_X, h);
/* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */
@@ -798,8 +798,8 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
if (prop && RNA_property_type(prop) == PROP_ENUM) {
EnumPropertyItem *item;
int totitem, i, free;
- uiLayout *split = uiLayoutSplit(layout, 0, 0);
- uiLayout *column = uiLayoutColumn(split, 0);
+ uiLayout *split = uiLayoutSplit(layout, 0.0f, FALSE);
+ uiLayout *column = uiLayoutColumn(split, FALSE);
RNA_property_enum_items_gettexted(block->evil_C, &ptr, prop, &item, &totitem, &free);
@@ -825,7 +825,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
else {
if (item[i].name) {
if (i != 0) {
- column = uiLayoutColumn(split, 0);
+ column = uiLayoutColumn(split, FALSE);
/* inconsistent, but menus with labels do not look good flipped */
block->flag |= UI_BLOCK_NO_FLIP;
}
@@ -843,6 +843,14 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
MEM_freeN(item);
}
}
+ else if (prop && RNA_property_type(prop) != PROP_ENUM) {
+ RNA_warning("%s.%s, not an enum type", RNA_struct_identifier(ptr.type), propname);
+ return;
+ }
+ else {
+ RNA_warning("%s.%s not found", RNA_struct_identifier(ptr.type), propname);
+ return;
+ }
}
void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname)
@@ -1203,8 +1211,8 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
else {
EnumPropertyItem *item;
int totitem, i, free;
- uiLayout *split = uiLayoutSplit(layout, 0, 0);
- uiLayout *column = uiLayoutColumn(split, 0);
+ uiLayout *split = uiLayoutSplit(layout, 0.0f, FALSE);
+ uiLayout *column = uiLayoutColumn(split, FALSE);
RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
@@ -1215,7 +1223,7 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname
else {
if (item[i].name) {
if (i != 0) {
- column = uiLayoutColumn(split, 0);
+ column = uiLayoutColumn(split, FALSE);
/* inconsistent, but menus with labels do not look good flipped */
block->flag |= UI_BLOCK_NO_FLIP;
}
@@ -2301,7 +2309,7 @@ uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout)
uiBlock *block;
block = uiLayoutGetBlock(layout);
- uiLayoutAbsolute(layout, 0);
+ uiLayoutAbsolute(layout, FALSE);
return block;
}
@@ -2893,7 +2901,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, i
uiBut *but;
uiLayout *col; /* needed to avoid alignment errors with previous buttons */
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
block = uiLayoutGetBlock(col);
but = uiDefIconTextBut(block, BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, 18, 20,
NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults"));
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index dd6be9141ca..40f28de50fa 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1729,7 +1729,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
}
/* create items */
- split = uiLayoutSplit(layout, 0, 0);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
for (a = 0; a < md->nitems; a++) {
if (a == column_end) {
@@ -1748,7 +1748,7 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
}
}
- column = uiLayoutColumn(split, 0);
+ column = uiLayoutColumn(split, FALSE);
}
if (block->flag & UI_BLOCK_NO_FLIP)
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 2d9c6ee7657..e6a4c260d0f 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -370,7 +370,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
if ((idfrom && idfrom->lib) || !editable)
uiButSetFlag(but, UI_BUT_DISABLED);
- uiLayoutRow(layout, 1);
+ uiLayoutRow(layout, TRUE);
template->preview = 1;
}
else if (flag & UI_ID_BROWSE) {
@@ -528,7 +528,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
* - template_ID makes a copy of the template data and assigns it to the relevant buttons
*/
if (template->idlb) {
- uiLayoutRow(layout, 1);
+ uiLayoutRow(layout, TRUE);
template_ID(C, layout, template, type, idcode, flag, newop, openop, unlinkop);
}
@@ -576,7 +576,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
}
/* Start drawing UI Elements using standard defines */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
/* Label - either use the provided text, or will become "ID-Block:" */
if (text) {
@@ -617,7 +617,7 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna
}
/* Start drawing UI Elements using standard defines */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
/* Path (existing string) Widget */
uiItemR(row, ptr, propname, 0, text, ICON_RNA);
@@ -730,14 +730,14 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
/* create RNA pointer */
RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr);
- column = uiLayoutColumn(layout, 1);
+ column = uiLayoutColumn(layout, TRUE);
uiLayoutSetContextPointer(column, "modifier", &ptr);
/* rounded header ------------------------------------------------------------------- */
box = uiLayoutBox(column);
if (isVirtual) {
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
block = uiLayoutGetBlock(row);
/* VIRTUAL MODIFIER */
@@ -751,7 +751,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
}
else {
/* REAL MODIFIER */
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
block = uiLayoutGetBlock(row);
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -782,7 +782,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) {
/* -- convert to rna ? */
but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
- TIP_("Apply modifier to editing cage during Editmode"));
+ TIP_("Apply modifier to editing cage during Edit mode"));
if (index < cageIndex)
uiButSetFlag(but, UI_BUT_DISABLED);
uiButSetFunc(but, modifiers_setOnCage, ob, md);
@@ -836,7 +836,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
if (!isVirtual && (md->mode & eModifierMode_Expanded)) {
/* apply/convert/copy */
box = uiLayoutBox(column);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) {
/* only here obdata, the rest of modifiers is ob level */
@@ -868,14 +868,14 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
}
/* result is the layout block inside the box, that we return so that modifier settings can be drawn */
- result = uiLayoutColumn(box, 0);
+ result = uiLayoutColumn(box, FALSE);
block = uiLayoutAbsoluteBlock(box);
}
/* error messages */
if (md->error) {
box = uiLayoutBox(column);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemL(row, md->error, ICON_ERROR);
}
@@ -1005,11 +1005,11 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
RNA_pointer_create(&ob->id, &RNA_Constraint, con, &ptr);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiLayoutSetContextPointer(col, "constraint", &ptr);
box = uiLayoutBox(col);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
block = uiLayoutGetBlock(box);
/* Draw constraint header */
@@ -1051,7 +1051,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
* as that poses problems when restoring them, so disable the "up" button where
* it may cause this situation.
*
- * Up/Down buttons should only be shown (or not greyed - todo) if they serve some purpose.
+ * Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose.
*/
if (proxylocked_constraints_owner(ob, pchan)) {
if (con->prev) {
@@ -1197,8 +1197,8 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
/* layout */
block = uiLayoutGetBlock(layout);
- row = uiLayoutRow(layout, 0);
- col = uiLayoutColumn(row, 0);
+ row = uiLayoutRow(layout, FALSE);
+ col = uiLayoutColumn(row, FALSE);
uiLayoutSetKeepAspect(col, 1);
/* add preview */
@@ -1215,7 +1215,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
/* Create RNA Pointer */
RNA_pointer_create(id, &RNA_Material, ma, &material_ptr);
- col = uiLayoutColumn(row, 1);
+ col = uiLayoutColumn(row, TRUE);
uiLayoutSetScaleX(col, 1.5);
uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE);
}
@@ -1224,7 +1224,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
/* Create RNA Pointer */
RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
- uiLayoutRow(layout, 1);
+ uiLayoutRow(layout, TRUE);
uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, "");
if (GS(parent->name) == ID_MA)
uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, "");
@@ -1236,7 +1236,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
/* Alpha button for texture preview */
if (*pr_texture != TEX_PR_OTHER) {
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, &texture_ptr, "use_preview_alpha", 0, NULL, ICON_NONE);
}
}
@@ -1364,7 +1364,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
/* better to use rna so we can animate them */
PointerRNA ptr;
RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, &ptr, "position", 0, "Pos", ICON_NONE);
bt = block->buttons.last;
@@ -1775,11 +1775,11 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
block = uiLayoutGetBlock(layout);
/* curve chooser */
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
if (labeltype == 'v') {
/* vector */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
if (cumap->cm[0].curve) {
@@ -1797,7 +1797,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
}
else if (labeltype == 'c') {
/* color */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
if (cumap->cm[3].curve) {
@@ -1819,7 +1819,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
}
else if (labeltype == 'h') {
/* HSV */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
if (cumap->cm[0].curve) {
@@ -1842,7 +1842,7 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
bg = UI_GRAD_H;
/* operation buttons */
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -1872,16 +1872,16 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
/* curve itself */
size = uiLayoutGetWidth(layout);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 200), cumap, 0.0f, 1.0f, bg, 0, "");
/* black/white levels */
if (levels) {
- split = uiLayoutSplit(layout, 0, 0);
- uiItemR(uiLayoutColumn(split, 0), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
+ uiItemR(uiLayoutColumn(split, FALSE), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
+ uiItemR(uiLayoutColumn(split, FALSE), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- uiLayoutRow(layout, 0);
+ uiLayoutRow(layout, FALSE);
bt = uiDefBut(block, BUT, 0, IFACE_("Reset"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
TIP_("Reset Black/White point and curves"));
uiButSetNFunc(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap);
@@ -1940,8 +1940,8 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
- col = uiLayoutColumn(layout, 0);
- row = uiLayoutRow(col, 1);
+ col = uiLayoutColumn(layout, FALSE);
+ row = uiLayoutRow(col, TRUE);
but = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
@@ -2032,13 +2032,13 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
/* layers are laid out going across rows, with the columns being divided into groups */
for (group = 0; group < groups; group++) {
- uCol = uiLayoutColumn(layout, 1);
+ uCol = uiLayoutColumn(layout, TRUE);
for (row = 0; row < 2; row++) {
uiBlock *block;
uiBut *but;
- uRow = uiLayoutRow(uCol, 1);
+ uRow = uiLayoutRow(uCol, TRUE);
block = uiLayoutGetBlock(uRow);
layer = groups * cols_per_group * row + cols_per_group * group;
@@ -2112,12 +2112,12 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
overlap = uiLayoutOverlap(layout);
/* list item behind label & other buttons */
- sub = uiLayoutRow(overlap, 0);
+ sub = uiLayoutRow(overlap, FALSE);
but = uiDefButR_prop(block, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
- sub = uiLayoutRow(overlap, 0);
+ sub = uiLayoutRow(overlap, FALSE);
/* retrieve icon and name */
icon = list_item_icon_get(C, itemptr, rnaicon, 0);
@@ -2172,12 +2172,12 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
Key *key = (Key *)itemptr->id.data;
KeyBlock *kb = (KeyBlock *)itemptr->data;
- split = uiLayoutSplit(sub, 0.66f, 0);
+ split = uiLayoutSplit(sub, 0.66f, FALSE);
uiItemL(split, name, icon);
uiBlockSetEmboss(block, UI_EMBOSSN);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
if (i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
uiItemR(row, itemptr, "mute", 0, "", 0);
@@ -2185,7 +2185,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
if ((kb->flag & KEYBLOCK_MUTE) ||
(ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)))
{
- uiLayoutSetActive(row, 0);
+ uiLayoutSetActive(row, FALSE);
}
uiBlockSetEmboss(block, UI_EMBOSS);
}
@@ -2233,7 +2233,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
else if (itemptr->type == &RNA_MovieTrackingObject) {
MovieTrackingObject *tracking_object = (MovieTrackingObject *)itemptr->data;
- split = uiLayoutSplit(sub, 0.75f, 0);
+ split = uiLayoutSplit(sub, 0.75f, FALSE);
if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
uiItemL(split, name, ICON_CAMERA_DATA);
}
@@ -2242,12 +2242,12 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
}
}
else if (itemptr->type == &RNA_MaskLayer) {
- split = uiLayoutSplit(sub, 0.5f, 0);
+ split = uiLayoutSplit(sub, 0.5f, FALSE);
uiItemL(split, name, icon);
uiBlockSetEmboss(block, UI_EMBOSSN);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
// uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE); // enable when used
uiItemR(row, itemptr, "hide", 0, "", 0);
uiItemR(row, itemptr, "hide_select", 0, "", 0);
@@ -2277,7 +2277,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
* for the string prop, after the name of each item of the collection.
*/
else if (prop_list_id) {
- row = uiLayoutRow(sub, 1);
+ row = uiLayoutRow(sub, TRUE);
uiItemL(row, name, icon);
/* XXX: Check, as sometimes we get an itemptr looking like
@@ -2378,8 +2378,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
if (listtype == 'i') {
box = uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
- col = uiLayoutColumn(box, 1);
- row = uiLayoutRow(col, 0);
+ col = uiLayoutColumn(box, TRUE);
+ row = uiLayoutRow(col, FALSE);
if (ptr->data && prop) {
/* create list items */
@@ -2387,7 +2387,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
{
/* create button */
if (!(i % 9))
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
icon = list_item_icon_get(C, &itemptr, rnaicon, 1);
but = uiDefIconButR_prop(block, LISTROW, 0, icon, 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, activeptr, activeprop, 0, 0, i, 0, 0, "");
@@ -2402,7 +2402,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
else if (listtype == 'c') {
/* compact layout */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
if (ptr->data && prop) {
/* create list items */
@@ -2447,8 +2447,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* layout */
box = uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
- row = uiLayoutRow(box, 0);
- col = uiLayoutColumn(row, 1);
+ row = uiLayoutRow(box, FALSE);
+ col = uiLayoutColumn(row, TRUE);
/* init numbers */
RNA_property_int_range(activeptr, activeprop, &min, &max);
@@ -2488,7 +2488,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
/* add scrollbar */
if (len > items) {
- col = uiLayoutColumn(row, 0);
+ col = uiLayoutColumn(row, FALSE);
uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * items, &pa->list_scroll, 0, len - items, items, 0, "");
}
}
@@ -2624,7 +2624,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
if (owner) {
uiLayout *ui_abs;
- ui_abs = uiLayoutAbsolute(layout, 0);
+ ui_abs = uiLayoutAbsolute(layout, FALSE);
(void)ui_abs; // UNUSED
uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE,
@@ -2632,7 +2632,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner),
UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress"));
- uiLayoutRow(layout, 0);
+ uiLayoutRow(layout, FALSE);
}
if (WM_jobs_test(wm, screen))
uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
@@ -2664,7 +2664,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
if (!rti || rti->widthfac == 0.0f || !report) return;
- ui_abs = uiLayoutAbsolute(layout, 0);
+ ui_abs = uiLayoutAbsolute(layout, FALSE);
block = uiLayoutGetBlock(ui_abs);
width = BLF_width(style->widget.uifont_id, report->message);
@@ -2679,7 +2679,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
but->col[3] = 255;
but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
- but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->greyscale);
+ but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->grayscale);
but->col[3] = 255;
uiBlockEndAlign(block);
@@ -2699,7 +2699,8 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiBlockSetEmboss(block, UI_EMBOSSN);
if (reports->list.first != reports->list.last)
- uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see rest of reports in textblock: 'Recent Reports'"));
+ uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0,
+ UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'"));
else
uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
@@ -2725,7 +2726,7 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
if (title)
uiItemL(layout, title, ICON_NONE);
- flow = uiLayoutColumnFlow(layout, 2, 0);
+ flow = uiLayoutColumnFlow(layout, 2, FALSE);
RNA_STRUCT_BEGIN (ptr, prop)
{
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 9773918e508..8ff8e0824d6 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -158,17 +158,17 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr,
name = RNA_property_ui_name(prop);
if (label_align == 'V') {
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
if (!is_boolean)
uiItemL(col, name, ICON_NONE);
}
else if (label_align == 'H') {
- split = uiLayoutSplit(layout, 0.5f, 0);
+ split = uiLayoutSplit(layout, 0.5f, FALSE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
}
else {
col = NULL;
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 004c5306d65..5ee89bb418f 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1434,7 +1434,7 @@ static struct uiWidgetColors wcol_menu_back = {
25, -20
};
-/* tooltip colour */
+/* tooltip color */
static struct uiWidgetColors wcol_tooltip = {
{0, 0, 0, 255},
{25, 25, 25, 230},
@@ -1946,8 +1946,9 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* ************ custom buttons, old stuff ************** */
/* draws in resolution of 20x4 colors */
-void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
+void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha)
{
+ const float color_step = (type == UI_GRAD_H) ? 0.02 : 0.05f;
int a;
float h = hsv[0], s = hsv[1], v = hsv[2];
float dx, dy, sx1, sx2, sy;
@@ -2004,7 +2005,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
/* old below */
- for (dx = 0.0f; dx < 1.0f; dx += 0.05f) {
+ for (dx = 0.0f; dx < 1.0f; dx += color_step) {
// previous color
copy_v3_v3(col0[0], col1[0]);
copy_v3_v3(col0[1], col1[1]);
@@ -2032,11 +2033,15 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
hsv_to_rgb(dx, 1.0, v, &col1[3][0], &col1[3][1], &col1[3][2]);
break;
case UI_GRAD_H:
- hsv_to_rgb(dx, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
+ {
+ /* annoying but without this the color shifts - could be solved some other way
+ * - campbell */
+ hsv_to_rgb(dx + color_step, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
copy_v3_v3(col1[1], col1[0]);
copy_v3_v3(col1[2], col1[0]);
copy_v3_v3(col1[3], col1[0]);
break;
+ }
case UI_GRAD_S:
hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
copy_v3_v3(col1[0], col1[1]);
@@ -2053,7 +2058,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
// rect
sx1 = rect->xmin + dx * (rect->xmax - rect->xmin);
- sx2 = rect->xmin + (dx + 0.05f) * (rect->xmax - rect->xmin);
+ sx2 = rect->xmin + (dx + color_step) * (rect->xmax - rect->xmin);
sy = rect->ymin;
dy = (rect->ymax - rect->ymin) / 3.0;
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index fe46a5dc9c5..407b2308af8 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1888,8 +1888,8 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
/* NLA Colors */
- rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as dopesheet above */
- rgba_char_args_set(btheme->tnla.anim_non_active,153, 135, 97, 77);
+ rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as dopesheet above */
+ rgba_char_args_set(btheme->tnla.anim_non_active, 153, 135, 97, 77);
rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index b2227405d8b..392aae1632d 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -431,7 +431,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
/* curRatio = height / width; */ /* UNUSED */
winRatio = winy / winx;
- /* both sizes change (area/region maximised) */
+ /* both sizes change (area/region maximized) */
if (do_x == do_y) {
if (do_x && do_y) {
/* here is 1,1 case, so all others must be 0,0 */
@@ -1328,6 +1328,54 @@ void UI_view2d_constant_grid_draw(View2D *v2d)
glEnd();
}
+/* Draw a multi-level grid in given 2d-region */
+void UI_view2d_multi_grid_draw(View2D *v2d, float step, int level_size, int totlevels)
+{
+ int offset = -10;
+ float lstep = step;
+ int level;
+
+ for (level = 0; level < totlevels; ++level) {
+ int i;
+ float start;
+
+ UI_ThemeColorShade(TH_BACK, offset);
+
+ i = (v2d->cur.xmin >= 0.0f ? -(int)(-v2d->cur.xmin / lstep) : (int)(v2d->cur.xmin / lstep));
+ start = i * lstep;
+
+ glBegin(GL_LINES);
+ for (; start < v2d->cur.xmax; start += lstep, ++i) {
+ if (i == 0 || (level < totlevels - 1 && i % level_size == 0))
+ continue;
+ glVertex2f(start, v2d->cur.ymin);
+ glVertex2f(start, v2d->cur.ymax);
+ }
+
+ i = (v2d->cur.ymin >= 0.0f ? -(int)(-v2d->cur.ymin / lstep) : (int)(v2d->cur.ymin / lstep));
+ start = i * lstep;
+
+ for (; start < v2d->cur.ymax; start += lstep, ++i) {
+ if (i == 0 || (level < totlevels - 1 && i % level_size == 0))
+ continue;
+ glVertex2f(v2d->cur.xmin, start);
+ glVertex2f(v2d->cur.xmax, start);
+ }
+
+ /* X and Y axis */
+ UI_ThemeColorShade(TH_BACK, offset - 8);
+ glVertex2f(0.0f, v2d->cur.ymin);
+ glVertex2f(0.0f, v2d->cur.ymax);
+ glVertex2f(v2d->cur.xmin, 0.0f);
+ glVertex2f(v2d->cur.xmax, 0.0f);
+
+ glEnd();
+
+ lstep *= level_size;
+ offset -= 6;
+ }
+}
+
/* the price we pay for not exposting structs :( */
void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy)
{
@@ -2078,18 +2126,21 @@ void UI_view2d_text_cache_draw(ARegion *ar)
{
View2DString *v2s;
int col_pack_prev = 0;
+
+ /* investigate using BLF_ascender() */
+ const float default_height = strings.first ? BLF_height_default("28") : 0.0f;
// glMatrixMode(GL_PROJECTION);
// glPushMatrix();
// glMatrixMode(GL_MODELVIEW);
// glPushMatrix();
ED_region_pixelspace(ar);
-
+
for (v2s = strings.first; v2s; v2s = v2s->next) {
const char *str = (const char *)(v2s + 1);
int xofs = 0, yofs;
- yofs = ceil(0.5f * (v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28")));
+ yofs = ceil(0.5f * (v2s->rect.ymax - v2s->rect.ymin - default_height));
if (yofs < 1) yofs = 1;
if (col_pack_prev != v2s->col.pack) {
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
index 0c417c5dfb9..7db23041c88 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -31,6 +31,10 @@ set(INC
../../collada
)
+set(INC_SYS
+
+)
+
set(SRC
io_collada.c
io_ops.c
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index cf649207ff3..77808d0a00d 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -24,7 +24,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/collada.c
+/** \file blender/editors/io/io_collada.c
* \ingroup collada
*/
#ifdef WITH_COLLADA
@@ -83,6 +83,12 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int include_children;
int include_armatures;
int deform_bones_only;
+
+ int include_uv_textures;
+ int include_material_textures;
+ int use_texture_copies;
+ int active_uv_only;
+
int use_object_instantiation;
int sort_by_name;
int second_life;
@@ -97,11 +103,17 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
/* Options panel */
apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
- export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
+ export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
selected = RNA_boolean_get(op->ptr, "selected");
include_children = RNA_boolean_get(op->ptr, "include_children");
include_armatures = RNA_boolean_get(op->ptr, "include_armatures");
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
+
+ include_uv_textures = RNA_boolean_get(op->ptr, "include_uv_textures");
+ include_material_textures= RNA_boolean_get(op->ptr, "include_material_textures");
+ use_texture_copies = RNA_boolean_get(op->ptr, "use_texture_copies");
+ active_uv_only = RNA_boolean_get(op->ptr, "active_uv_only");
+
use_object_instantiation = RNA_boolean_get(op->ptr, "use_object_instantiation");
sort_by_name = RNA_boolean_get(op->ptr, "sort_by_name");
second_life = RNA_boolean_get(op->ptr, "second_life");
@@ -118,6 +130,12 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
include_children,
include_armatures,
deform_bones_only,
+
+ active_uv_only,
+ include_uv_textures,
+ include_material_textures,
+ use_texture_copies,
+
use_object_instantiation,
sort_by_name,
second_life)) {
@@ -130,7 +148,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
{
- uiLayout *box, *row, *col, *sub, *split;
+ uiLayout *box, *row, *col, *split;
/* Export Options: */
box = uiLayoutBox(layout);
@@ -138,49 +156,60 @@ void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
row = uiLayoutRow(box, 0);
- col = uiLayoutColumn(row, 0);
- split = uiLayoutSplit(col, 0.5f, 0);
- uiItemR(split, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
- sub = uiLayoutRow(split, 0);
- uiItemR(sub, imfptr, "export_mesh_type_selection", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
- uiLayoutSetEnabled(sub, RNA_boolean_get(imfptr, "apply_modifiers"));
-
- row = uiLayoutRow(box, 0);
+ split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
+ col = uiLayoutColumn(split, FALSE);
+ uiItemR(col, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
+ col = uiLayoutColumn(split, FALSE);
+ uiItemR(col, imfptr, "export_mesh_type_selection", 0, "", ICON_NONE);
+ uiLayoutSetEnabled(col, RNA_boolean_get(imfptr, "apply_modifiers"));
+
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
- col = uiLayoutColumn(row, 0);
- split = uiLayoutSplit(col, 0.1f, 0);
- sub = uiLayoutRow(split, 0);
- uiItemR(split, imfptr, "include_children", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(box, FALSE);
+ uiItemR(row, imfptr, "include_children", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
- row = uiLayoutRow(box, 0);
- col = uiLayoutColumn(row, 0);
- split = uiLayoutSplit(col, 0.1f, 0);
- sub = uiLayoutRow(split, 0);
- uiItemR(split, imfptr, "include_armatures", 0, NULL, ICON_NONE);
+ row = uiLayoutRow(box, FALSE);
+ uiItemR(row, imfptr, "include_armatures", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
+ // Texture options
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, FALSE);
+ uiItemL(row, IFACE_("Texture Options:"), ICON_TEXTURE_DATA);
+
+ row = uiLayoutRow(box, FALSE);
+ uiItemR(row, imfptr, "active_uv_only", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(box, FALSE);
+ uiItemR(row, imfptr, "include_uv_textures", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(box, FALSE);
+ uiItemR(row, imfptr, "include_material_textures", 0, NULL, ICON_NONE);
+
+ row = uiLayoutRow(box, FALSE);
+ uiItemR(row, imfptr, "use_texture_copies", 1, NULL, ICON_NONE);
+
// Armature options
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemL(row, IFACE_("Armature Options:"), ICON_ARMATURE_DATA);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "second_life", 0, NULL, ICON_NONE);
/* Collada options: */
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "use_object_instantiation", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
}
@@ -215,8 +244,9 @@ void WM_OT_collada_export(wmOperatorType *ot)
WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
- RNA_def_boolean(ot->srna, "apply_modifiers", 0, "Apply Modifiers",
- "Apply modifiers");
+ RNA_def_boolean(ot->srna,
+ "apply_modifiers", 0, "Apply Modifiers",
+ "Apply modifiers to exported mesh (non destructive))");
RNA_def_int(ot->srna, "export_mesh_type", 0, INT_MIN, INT_MAX,
"Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);
@@ -237,6 +267,19 @@ void WM_OT_collada_export(wmOperatorType *ot)
"Only export deforming bones with armatures");
+ RNA_def_boolean(ot->srna, "active_uv_only", 0, "Only Active UV layer",
+ "Export textures assigned to the object UV maps");
+
+ RNA_def_boolean(ot->srna, "include_uv_textures", 0, "Include UV Textures",
+ "Export textures assigned to the object UV maps");
+
+ RNA_def_boolean(ot->srna, "include_material_textures", 0, "Include Material Textures",
+ "Export textures assigned to the object Materials");
+
+ RNA_def_boolean(ot->srna, "use_texture_copies", 1, "Copy",
+ "Copy textures to same folder where the .dae file is exported");
+
+
RNA_def_boolean(ot->srna, "use_object_instantiation", 1, "Use Object Instances",
"Instantiate multiple Objects from same Data");
diff --git a/source/blender/editors/io/io_ops.h b/source/blender/editors/io/io_ops.h
index 1e2c4443e43..4c04b349655 100644
--- a/source/blender/editors/io/io_ops.h
+++ b/source/blender/editors/io/io_ops.h
@@ -24,7 +24,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editor/io/io_collada.h
+/** \file blender/editor/io/io_ops.h
* \ingroup editor/io
*/
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 71d3caf74c5..f080b9f96e7 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -116,7 +116,8 @@ static void draw_spline_parents(MaskLayer *UNUSED(masklay), MaskSpline *spline)
#endif
/* return non-zero if spline is selected */
-static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline)
+static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline,
+ const char UNUSED(draw_flag), const char draw_type)
{
const int is_spline_sel = (spline->flag & SELECT) && (masklay->restrictflag & MASK_RESTRICT_SELECT) == 0;
unsigned char rgb_spline[4];
@@ -188,8 +189,20 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline)
/* draw handle segment */
if (has_handle) {
- glColor3ubv(rgb_spline);
+ /* this could be split into its own loop */
+ if (draw_type == MASK_DT_OUTLINE) {
+ const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff};
+ glLineWidth(3);
+ glColor4ubv(rgb_gray);
+ glBegin(GL_LINES);
+ glVertex3fv(vert);
+ glVertex3fv(handle);
+ glEnd();
+ glLineWidth(1);
+ }
+
+ glColor3ubv(rgb_spline);
glBegin(GL_LINES);
glVertex3fv(vert);
glVertex3fv(handle);
@@ -415,7 +428,7 @@ static void draw_masklays(Mask *mask, const char draw_flag, const char draw_type
if (!(masklay->restrictflag & MASK_RESTRICT_SELECT)) {
/* ...and then handles over the curve so they're nicely visible */
- draw_spline_points(masklay, spline);
+ draw_spline_points(masklay, spline, draw_flag, draw_type);
}
/* show undeform for testing */
@@ -425,7 +438,7 @@ static void draw_masklays(Mask *mask, const char draw_flag, const char draw_type
spline->points_deform = NULL;
draw_spline_curve(masklay, spline, draw_flag, draw_type, is_active, width, height);
// draw_spline_parents(masklay, spline);
- draw_spline_points(masklay, spline);
+ draw_spline_points(masklay, spline, draw_flag, draw_type);
spline->points_deform = back;
}
}
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index fdf72043464..6e0da5fd756 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -121,7 +121,7 @@ void ED_mask_point_pos__reverse(const bContext *C, float x, float y, float *xr,
co[0] = x;
co[1] = y;
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, co, co);
- ED_clip_point_stable_pos__reverse(sc, ar, co, co);
+ ED_clip_point_stable_pos__reverse(C, co, co);
}
else {
/* possible other spaces from which mask editing is available */
@@ -137,8 +137,7 @@ void ED_mask_size(const bContext *C, int *width, int *height)
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacedata.first) {
if (sa->spacetype == SPACE_CLIP) {
- SpaceClip *sc = sa->spacedata.first;
- ED_space_clip_get_mask_size(sc, width, height);
+ ED_space_clip_get_size(C, width, height);
return;
}
else if (sa->spacetype == SPACE_SEQ) {
@@ -159,7 +158,7 @@ void ED_mask_aspect(const bContext *C, float *aspx, float *aspy)
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc) {
- ED_space_clip_get_mask_aspect(sc, aspx, aspy);
+ ED_space_clip_get_aspect(sc, aspx, aspy);
}
else {
/* possible other spaces from which mask editing is available */
@@ -173,13 +172,12 @@ void ED_mask_pixelspace_factor(const bContext *C, float *scalex, float *scaley)
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc) {
- ARegion *ar = CTX_wm_region(C);
int width, height;
float zoomx, zoomy, aspx, aspy;
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
*scalex = ((float)width * aspx) * zoomx;
*scaley = ((float)height * aspy) * zoomy;
@@ -239,6 +237,7 @@ void ED_operatortypes_mask(void)
WM_operatortype_append(MASK_OT_shape_key_insert);
WM_operatortype_append(MASK_OT_shape_key_clear);
WM_operatortype_append(MASK_OT_shape_key_feather_reset);
+ WM_operatortype_append(MASK_OT_shape_key_rekey);
}
void ED_keymap_mask(wmKeyConfig *keyconf)
diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h
index 408b585bf4c..f1d72f59078 100644
--- a/source/blender/editors/mask/mask_intern.h
+++ b/source/blender/editors/mask/mask_intern.h
@@ -110,5 +110,6 @@ void ED_mask_point_pos__reverse(const struct bContext *C, float x, float y, floa
void MASK_OT_shape_key_insert(struct wmOperatorType *ot);
void MASK_OT_shape_key_clear(struct wmOperatorType *ot);
void MASK_OT_shape_key_feather_reset(struct wmOperatorType *ot);
+void MASK_OT_shape_key_rekey(struct wmOperatorType *ot);
#endif /* __MASK_INTERN_H__ */
diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c
index 7ba3c27e18d..a1f2539ce7c 100644
--- a/source/blender/editors/mask/mask_relationships.c
+++ b/source/blender/editors/mask/mask_relationships.c
@@ -44,6 +44,7 @@
#include "WM_types.h"
#include "ED_screen.h"
+#include "ED_clip.h" /* frame remapping functions */
#include "ED_mask.h" /* own include */
#include "mask_intern.h" /* own include */
@@ -104,21 +105,25 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
MovieClip *clip;
MovieTrackingTrack *track;
MovieTrackingMarker *marker;
- MovieTrackingObject *tracking;
+ MovieTrackingObject *tracking_object;
/* done */
+ int framenr;
+
float marker_pos_ofs[2];
float parmask_pos[2];
if ((NULL == (sc = CTX_wm_space_clip(C))) ||
(NULL == (clip = sc->clip)) ||
(NULL == (track = clip->tracking.act_track)) ||
- (NULL == (marker = BKE_tracking_marker_get(track, sc->user.framenr))) ||
- (NULL == (tracking = BKE_tracking_object_get_active(&clip->tracking))))
+ (NULL == (tracking_object = BKE_tracking_object_get_active(&clip->tracking))))
{
return OPERATOR_CANCELLED;
}
+ framenr = ED_space_clip_get_clip_frame_number(sc);
+ marker = BKE_tracking_marker_get(track, framenr);
+
add_v2_v2v2(marker_pos_ofs, marker->pos, track->offset);
BKE_mask_coord_from_movieclip(clip, &sc->user, parmask_pos, marker_pos_ofs);
@@ -138,7 +143,7 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
if (MASKPOINT_ISSEL_ANY(point)) {
point->parent.id_type = ID_MC;
point->parent.id = &clip->id;
- strcpy(point->parent.parent, tracking->name);
+ strcpy(point->parent.parent, tracking_object->name);
strcpy(point->parent.sub_parent, track->name);
copy_v2_v2(point->parent.parent_orig, parmask_pos);
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index e34823278cb..e619277456e 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -581,8 +581,6 @@ static int circle_select_exec(bContext *C, wmOperator *op)
MaskLayer *masklay;
int i;
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
int x, y, radius, width, height, mode, change = FALSE;
float zoomx, zoomy, offset[2], ellipse[2];
@@ -595,8 +593,8 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* TODO - make generic! - this is SpaceClip only! */
/* compute ellipse and position in unified coordinates */
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
width = height = MAX2(width, height);
ellipse[0] = width * zoomx / radius;
diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c
index 8da083ab400..c5b9fc33a9b 100644
--- a/source/blender/editors/mask/mask_shapekey.c
+++ b/source/blender/editors/mask/mask_shapekey.c
@@ -29,7 +29,11 @@
* \ingroup edmask
*/
+#include <stdlib.h>
+
#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -39,6 +43,9 @@
#include "DNA_mask_types.h"
#include "DNA_scene_types.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -222,7 +229,7 @@ void MASK_OT_shape_key_feather_reset(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Feather Reset Animation";
- ot->description = "Resets fearther weights on all selected points animation values";
+ ot->description = "Reset feather weights on all selected points animation values";
ot->idname = "MASK_OT_shape_key_feather_reset";
/* api callbacks */
@@ -233,6 +240,175 @@ void MASK_OT_shape_key_feather_reset(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/*
+ * - loop over selected shapekeys.
+ * - find firstsel/lastsel pairs.
+ * - move these into a temp list.
+ * - re-key all the original shapes.
+ * - copy unselected values back from the original.
+ * - free the original.
+ */
+static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ const int frame = CFRA;
+ Mask *mask = CTX_data_edit_mask(C);
+ MaskLayer *masklay;
+ int change = FALSE;
+
+ const short do_feather = RNA_boolean_get(op->ptr, "feather");
+ const short do_location = RNA_boolean_get(op->ptr, "location");
+
+ for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+
+ if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
+ continue;
+ }
+
+ /* we need at least one point selected here to bother re-interpolating */
+ if (!ED_mask_layer_select_check(masklay)) {
+ continue;
+ }
+
+ if (masklay->splines_shapes.first) {
+ MaskLayerShape *masklay_shape;
+ MaskLayerShape *masklay_shape_lastsel = NULL;
+
+ for (masklay_shape = masklay->splines_shapes.first;
+ masklay_shape;
+ masklay_shape = masklay_shape->next)
+ {
+ MaskLayerShape *masklay_shape_a = NULL;
+ MaskLayerShape *masklay_shape_b = NULL;
+
+ /* find contiguous selections */
+ if (masklay_shape->flag & MASK_SHAPE_SELECT) {
+ if (masklay_shape_lastsel == NULL) {
+ masklay_shape_lastsel = masklay_shape;
+ }
+ if ((masklay_shape->next == NULL) ||
+ (((MaskLayerShape *)masklay_shape->next)->flag & MASK_SHAPE_SELECT) == 0)
+ {
+ masklay_shape_a = masklay_shape_lastsel;
+ masklay_shape_b = masklay_shape;
+ masklay_shape_lastsel = NULL;
+ }
+ }
+
+ /* we have a from<>to? - re-interpolate! */
+ if (masklay_shape_a && masklay_shape_b) {
+ ListBase shapes_tmp = {NULL, NULL};
+ MaskLayerShape *masklay_shape_tmp;
+ MaskLayerShape *masklay_shape_tmp_next;
+ MaskLayerShape *masklay_shape_tmp_last = masklay_shape_b->next;
+ MaskLayerShape *masklay_shape_tmp_rekey;
+
+ /* move keys */
+ for (masklay_shape_tmp = masklay_shape_a;
+ masklay_shape_tmp && (masklay_shape_tmp != masklay_shape_tmp_last);
+ masklay_shape_tmp = masklay_shape_tmp_next)
+ {
+ masklay_shape_tmp_next = masklay_shape_tmp->next;
+ BLI_remlink(&masklay->splines_shapes, masklay_shape_tmp);
+ BLI_addtail(&shapes_tmp, masklay_shape_tmp);
+ }
+
+ /* re-key, note: cant modify the keys here since it messes uop */
+ for (masklay_shape_tmp = shapes_tmp.first;
+ masklay_shape_tmp;
+ masklay_shape_tmp = masklay_shape_tmp->next)
+ {
+ BKE_mask_layer_evaluate(masklay, masklay_shape_tmp->frame, TRUE);
+ masklay_shape_tmp_rekey = BKE_mask_layer_shape_varify_frame(masklay, masklay_shape_tmp->frame);
+ BKE_mask_layer_shape_from_mask(masklay, masklay_shape_tmp_rekey);
+ masklay_shape_tmp_rekey->flag = masklay_shape_tmp->flag & MASK_SHAPE_SELECT;
+ }
+
+ /* restore unselected points and free copies */
+ for (masklay_shape_tmp = shapes_tmp.first;
+ masklay_shape_tmp;
+ masklay_shape_tmp = masklay_shape_tmp_next)
+ {
+ /* restore */
+ int i_abs = 0;
+ int i;
+ MaskSpline *spline;
+ MaskLayerShapeElem *shape_ele_src;
+ MaskLayerShapeElem *shape_ele_dst;
+
+ masklay_shape_tmp_next = masklay_shape_tmp->next;
+
+ /* we know this exists, added above */
+ masklay_shape_tmp_rekey = BKE_mask_layer_shape_find_frame(masklay, masklay_shape_tmp->frame);
+
+ shape_ele_src = (MaskLayerShapeElem *)masklay_shape_tmp->data;
+ shape_ele_dst = (MaskLayerShapeElem *)masklay_shape_tmp_rekey->data;
+
+ for (spline = masklay->splines.first; spline; spline = spline->next) {
+ for (i = 0; i < spline->tot_point; i++) {
+ MaskSplinePoint *point = &spline->points[i];
+
+ /* not especially efficient but makes this easier to follow */
+ SWAP(MaskLayerShapeElem, *shape_ele_src, *shape_ele_dst);
+
+ if (MASKPOINT_ISSEL_ANY(point)) {
+ if (do_location) {
+ memcpy(shape_ele_dst->value, shape_ele_src->value, sizeof(float) * 6);
+ }
+ if (do_feather) {
+ shape_ele_dst->value[6] = shape_ele_src->value[6];
+ }
+ }
+
+ shape_ele_src++;
+ shape_ele_dst++;
+
+ i_abs++;
+ }
+ }
+
+ BKE_mask_layer_shape_free(masklay_shape_tmp);
+ }
+
+ change = TRUE;
+ }
+ }
+
+ /* re-evaluate */
+ BKE_mask_layer_evaluate(masklay, frame, TRUE);
+ }
+ }
+
+ if (change) {
+ WM_event_add_notifier(C, NC_MASK | ND_DATA, mask);
+ DAG_id_tag_update(&mask->id, 0);
+
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
+}
+
+void MASK_OT_shape_key_rekey(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Re-Key Points of Selected Shapes";
+ ot->description = "Recalculate animation data on selected points for frames selected in the dopesheet";
+ ot->idname = "MASK_OT_shape_key_rekey";
+
+ /* api callbacks */
+ ot->exec = mask_shape_key_rekey_exec;
+ ot->poll = ED_maskedit_mask_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_boolean(ot->srna, "location", TRUE, "Location", "");
+ RNA_def_boolean(ot->srna, "feather", TRUE, "Feather", "");
+}
+
/* *** Shape Key Utils *** */
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index f154aec2eb4..2ceb8aeef26 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1468,6 +1468,8 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
if (cure && p) {
if (!kcd->ignore_edge_snapping || !(cure->e)) {
+ KnifeVert *edgesnap = NULL;
+
if (kcd->snap_midpoints) {
mid_v3_v3v3(p, cure->v1->co, cure->v2->co);
mid_v3_v3v3(cagep, cure->v1->cageco, cure->v2->cageco);
@@ -1479,6 +1481,13 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
d = len_v3v3(cagep, cure->v1->cageco) / len_v3v3(cure->v1->cageco, cure->v2->cageco);
interp_v3_v3v3(p, cure->v1->co, cure->v2->co, d);
}
+
+ /* update mouse coordinates to the snapped-to edge's screen coordinates
+ * this is important for angle snap, which uses the previous mouse position */
+ edgesnap = new_knife_vert(kcd, p, cagep);
+ kcd->cur.mval[0] = (int)edgesnap->sco[0];
+ kcd->cur.mval[1] = (int)edgesnap->sco[1];
+
}
else {
return NULL;
@@ -1557,6 +1566,11 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
if (curv && p) {
copy_v3_v3(p, curv->co);
copy_v3_v3(cagep, curv->cageco);
+
+ /* update mouse coordinates to the snapped-to vertex's screen coordinates
+ * this is important for angle snap, which uses the previous mouse position */
+ kcd->cur.mval[0] = (int)curv->sco[0];
+ kcd->cur.mval[1] = (int)curv->sco[1];
}
return curv;
@@ -1617,7 +1631,11 @@ static int knife_update_active(KnifeTool_OpData *kcd)
kcd->cur.mval[0] = kcd->vc.mval[0];
kcd->cur.mval[1] = kcd->vc.mval[1];
+ /* XXX knife_snap_angle updates the view coordinate mouse values to constrained angles,
+ * which current mouse values are set to current mouse values are then used
+ * for vertex and edge snap detection, without regard to the exact angle constraint */
kcd->cur.vert = knife_find_closest_vert(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
+
if (!kcd->cur.vert) {
kcd->cur.edge = knife_find_closest_edge(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
}
@@ -1989,9 +2007,9 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
remerge_faces(kcd);
/* delete left over faces */
- BMO_op_callf(bm, "del geom=%ff context=%i", DEL, DEL_ONLYFACES);
- BMO_op_callf(bm, "del geom=%fe context=%i", DEL, DEL_EDGES);
- BMO_op_callf(bm, "del geom=%fv context=%i", DEL, DEL_VERTS);
+ BMO_op_callf(bm, "delete geom=%ff context=%i", DEL, DEL_ONLYFACES);
+ BMO_op_callf(bm, "delete geom=%fe context=%i", DEL, DEL_EDGES);
+ BMO_op_callf(bm, "delete geom=%fv context=%i", DEL, DEL_VERTS);
if (face_nets)
MEM_freeN(face_nets);
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 15e3033b7eb..eb2aabd88b8 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -313,10 +313,13 @@ static void ringsel_finish(bContext *C, wmOperator *op)
edgering_sel(lcd, cuts, 1);
if (lcd->do_cut) {
+ /* Enable gridfill, so that intersecting loopcut works as one would expect.
+ * Note though that it will break edgeslide in this specific case.
+ * See [#31939]. */
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
0.0f, 0.0f, 0.0f,
cuts,
- SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, FALSE, 0);
+ SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, TRUE, 0);
/* force edge slide to edge select mode in in face select mode */
if (em->selectmode & SCE_SELECT_FACE) {
@@ -336,7 +339,8 @@ static void ringsel_finish(bContext *C, wmOperator *op)
DAG_id_tag_update(lcd->ob->data, 0);
}
else {
-
+ /* XXX Is this piece of code ever used now? Simple loop select is now
+ * in editmesh_select.c (around line 1000)... */
/* sets as active, useful for other tools */
if (em->selectmode & SCE_SELECT_VERTEX)
BM_select_history_store(em->bm, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index 1bcd5cee111..f71ec56ca5f 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -347,7 +347,7 @@ static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
{
BMOperator bmop;
- if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b",
+ if (!EDBM_op_init(em, &bmop, op, "split_edges edges=%he verts=%hv use_verts=%b",
BM_ELEM_TAG, BM_ELEM_SELECT, TRUE))
{
return FALSE;
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 44ec8bd6aaa..5404eb3bea6 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -710,7 +710,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+ EDBM_op_init(em, &bmop, op, "similar_faces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -748,7 +748,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+ EDBM_op_init(em, &bmop, op, "similar_edges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -789,7 +789,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+ EDBM_op_init(em, &bmop, op, "similar_verts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1001,12 +1001,13 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
BMEdge *eed;
int select = TRUE;
int dist = 50;
-
+ float mvalf[2];
+
em_setup_viewcontext(C, &vc);
- vc.mval[0] = mval[0];
- vc.mval[1] = mval[1];
+ mvalf[0] = (float)(vc.mval[0] = mval[0]);
+ mvalf[1] = (float)(vc.mval[1] = mval[1]);
em = vc.em;
-
+
/* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */
view3d_validate_backbuf(&vc);
@@ -1041,22 +1042,58 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
}
EDBM_selectmode_flush(em);
-// if (EM_texFaceCheck())
-
+
/* sets as active, useful for other tools */
if (select) {
if (em->selectmode & SCE_SELECT_VERTEX) {
- /* TODO: would be nice if the edge vertex chosen here
- * was the one closer to the selection pointer, instead
- * of arbitrarily selecting the first one */
- BM_select_history_store(em->bm, eed->v1);
+ /* Find nearest vert from mouse. */
+ float v1_co[2], v2_co[2];
+
+ /* We can't be sure this has already been set... */
+ ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
+ project_float_noclip(vc.ar, eed->v1->co, v1_co);
+ project_float_noclip(vc.ar, eed->v2->co, v2_co);
+#if 0
+ printf("mouse to v1: %f\nmouse to v2: %f\n", len_squared_v2v2(mvalf, v1_co),
+ len_squared_v2v2(mvalf, v2_co));
+#endif
+ if (len_squared_v2v2(mvalf, v1_co) < len_squared_v2v2(mvalf, v2_co))
+ BM_select_history_store(em->bm, eed->v1);
+ else
+ BM_select_history_store(em->bm, eed->v2);
}
else if (em->selectmode & SCE_SELECT_EDGE) {
BM_select_history_store(em->bm, eed);
}
- /* TODO: would be nice if the nearest face that
- * belongs to the selected edge could be set to
- * active here in face select mode */
+ else if (em->selectmode & SCE_SELECT_FACE) {
+ /* Select the face of eed which is the nearest of mouse. */
+ BMFace *f, *efa = NULL;
+ BMIter iterf;
+ float best_dist = MAXFLOAT;
+
+ /* We can't be sure this has already been set... */
+ ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
+
+ BM_ITER_ELEM(f, &iterf, eed, BM_FACES_OF_EDGE) {
+ if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+ float cent[3];
+ float co[2], tdist;
+
+ BM_face_calc_center_mean(f, cent);
+ project_float_noclip(vc.ar, cent, co);
+ tdist = len_squared_v2v2(mvalf, co);
+ if (tdist < best_dist) {
+/* printf("Best face: %p (%f)\n", f, tdist);*/
+ best_dist = tdist;
+ efa = f;
+ }
+ }
+ }
+ if (efa) {
+ BM_active_face_set(em->bm, efa);
+ BM_select_history_store(em->bm, efa);
+ }
+ }
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit);
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index a86a274eb70..f08c229d38a 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -211,7 +211,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
if (other_d < vso->snap_threshold) {
BM_vert_select_set(bm, other, TRUE);
BM_vert_select_set(bm, vso->start_vtx, TRUE);
- EDBM_op_callf(em, op, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, other->co);
+ EDBM_op_callf(em, op, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, other->co);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
}
else {
@@ -687,7 +687,7 @@ static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
/* Prepare operator */
if (!EDBM_op_init(em, &bmop, op,
- "vertex_slide vert=%e edge=%hev distance_t=%f",
+ "slide_vert vert=%e edge=%hev distance_t=%f",
start_vert, BM_ELEM_SELECT, distance_t))
{
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 0f7d4c5c547..0f13df4c777 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -172,7 +172,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, BMEditMes
/* individual face extrude */
/* will use vertex normals for extrusion directions, so *nor is unaffected */
-static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
+static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
{
BMOIter siter;
BMIter liter;
@@ -180,7 +180,7 @@ static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char
BMLoop *l;
BMOperator bmop;
- EDBM_op_init(em, &bmop, op, "extrude_face_indiv faces=%hf", hflag);
+ EDBM_op_init(em, &bmop, op, "extrude_discrete_faces faces=%hf", hflag);
/* deselect original verts */
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
@@ -473,7 +473,7 @@ static int edbm_extrude_mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe
else if (nr == 1) transmode = edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
else if (nr == 4) transmode = edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
else if (nr == 3) transmode = edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
- else transmode = edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+ else transmode = edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT, nor);
if (transmode == 0) {
BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude");
@@ -614,7 +614,7 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
float nor[3];
- edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+ edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT, nor);
EDBM_update_generic(C, em, TRUE);
@@ -853,7 +853,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
mul_m4_v3(vc.obedit->imat, min); // back in object space
- EDBM_op_init(vc.em, &bmop, op, "makevert co=%v", min);
+ EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", min);
BMO_op_exec(vc.em->bm, &bmop);
BMO_ITER (v1, &oiter, vc.em->bm, &bmop, "newvertout", BM_VERT) {
@@ -912,24 +912,24 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
int type = RNA_enum_get(op->ptr, "type");
if (type == 0) {
- if (!EDBM_op_callf(em, op, "del geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */
+ if (!EDBM_op_callf(em, op, "delete geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */
return OPERATOR_CANCELLED;
}
else if (type == 1) {
- if (!EDBM_op_callf(em, op, "del geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */
+ if (!EDBM_op_callf(em, op, "delete geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */
return OPERATOR_CANCELLED;
}
else if (type == 2) {
- if (!EDBM_op_callf(em, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */
+ if (!EDBM_op_callf(em, op, "delete geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */
return OPERATOR_CANCELLED;
}
else if (type == 3) {
- if (!EDBM_op_callf(em, op, "del geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */
+ if (!EDBM_op_callf(em, op, "delete geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */
return OPERATOR_CANCELLED;
}
else if (type == 4) {
//"Erase Only Faces";
- if (!EDBM_op_callf(em, op, "del geom=%hf context=%i",
+ if (!EDBM_op_callf(em, op, "delete geom=%hf context=%i",
BM_ELEM_SELECT, DEL_ONLYFACES))
{
return OPERATOR_CANCELLED;
@@ -1197,7 +1197,7 @@ static int edbm_vert_connect(bContext *C, wmOperator *op)
BMOperator bmop;
int len = 0;
- if (!EDBM_op_init(em, &bmop, op, "connectverts verts=%hv", BM_ELEM_SELECT)) {
+ if (!EDBM_op_init(em, &bmop, op, "connect_verts verts=%hv", BM_ELEM_SELECT)) {
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &bmop);
@@ -1234,7 +1234,7 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op)
BMOperator bmop;
int len = 0;
- if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he", BM_ELEM_SELECT)) {
+ if (!EDBM_op_init(em, &bmop, op, "split_edges edges=%he", BM_ELEM_SELECT)) {
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &bmop);
@@ -1271,7 +1271,7 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(ob);
BMOperator bmop;
- EDBM_op_init(em, &bmop, op, "dupe geom=%hvef", BM_ELEM_SELECT);
+ EDBM_op_init(em, &bmop, op, "duplicate geom=%hvef", BM_ELEM_SELECT);
BMO_op_exec(em->bm, &bmop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
@@ -1318,7 +1318,7 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- if (!EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT))
+ if (!EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
EDBM_update_generic(C, em, TRUE);
@@ -1386,7 +1386,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EDBM_op_init(em, &bmop, op, "edgerotate edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
+ EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
/* avoids leaving old verts selected which can be a problem running multiple times,
* since this means the edges become selected around the face which then attempt to rotate */
@@ -1490,11 +1490,11 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
/* doflip has to do with bmesh_rationalize_normals, it's an internal
* thing */
- if (!EDBM_op_callf(em, op, "righthandfaces faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE))
+ if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE))
return OPERATOR_CANCELLED;
if (RNA_boolean_get(op->ptr, "inside"))
- EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT);
+ EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT);
EDBM_update_generic(C, em, TRUE);
@@ -1560,7 +1560,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
for (i = 0; i < repeat; i++) {
if (!EDBM_op_callf(em, op,
- "vertexsmooth verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f",
+ "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f",
BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist))
{
return OPERATOR_CANCELLED;
@@ -1678,7 +1678,7 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
int dir = RNA_enum_get(op->ptr, "direction");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_rotateuvs faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+ EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf dir=%i", BM_ELEM_SELECT, dir);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1701,7 +1701,7 @@ static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_reverseuvs faces=%hf", BM_ELEM_SELECT);
+ EDBM_op_init(em, &bmop, op, "reverse_uvs faces=%hf", BM_ELEM_SELECT);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1727,7 +1727,7 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
int dir = RNA_enum_get(op->ptr, "direction");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_rotatecolors faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+ EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf dir=%i", BM_ELEM_SELECT, dir);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1752,7 +1752,7 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_reversecolors faces=%hf", BM_ELEM_SELECT);
+ EDBM_op_init(em, &bmop, op, "reverse_colors faces=%hf", BM_ELEM_SELECT);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1865,7 +1865,7 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w
return OPERATOR_CANCELLED;
}
- if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, mergevert->co))
+ if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, mergevert->co))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -1906,11 +1906,11 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
return OPERATOR_CANCELLED;
if (uvmerge) {
- if (!EDBM_op_callf(em, wmop, "vert_average_facedata verts=%hv", BM_ELEM_SELECT))
+ if (!EDBM_op_callf(em, wmop, "average_vert_facedata verts=%hv", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
}
- if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, co))
+ if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, co))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -2032,12 +2032,12 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
BMOperator bmop;
int count;
- EDBM_op_init(em, &bmop, op, "finddoubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist"));
+ EDBM_op_init(em, &bmop, op, "find_doubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist"));
BMO_op_exec(em->bm, &bmop);
count = BMO_slot_map_count(em->bm, &bmop, "targetmapout");
- if (!EDBM_op_callf(em, op, "weldverts targetmap=%s", &bmop, "targetmapout")) {
+ if (!EDBM_op_callf(em, op, "weld_verts targetmap=%s", &bmop, "targetmapout")) {
BMO_op_finish(em->bm, &bmop);
return OPERATOR_CANCELLED;
}
@@ -2109,7 +2109,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%i", sv->ele, ev->ele, type);
+ EDBM_op_init(em, &bmop, op, "shortest_path startv=%e endv=%e type=%i", sv->ele, ev->ele, type);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -2714,7 +2714,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
BLI_ghash_insert(gh, bv, scr);
}
- if (!EDBM_op_init(em, &bmop, op, "esubd")) {
+ if (!EDBM_op_init(em, &bmop, op, "subdivide_edges")) {
return OPERATOR_CANCELLED;
}
@@ -2819,8 +2819,8 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
ED_base_object_select(basenew, BA_DESELECT);
- EDBM_op_callf(em, wmop, "dupe geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new);
- EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES);
+ EDBM_op_callf(em, wmop, "duplicate geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new);
+ EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES);
/* clean up any loose edges */
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
@@ -2831,7 +2831,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
BM_edge_select_set(em->bm, e, FALSE);
}
}
- EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES);
+ EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES);
/* clean up any loose verts */
BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
@@ -2843,7 +2843,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
}
}
- EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS);
+ EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS);
BM_mesh_normals_update(bm_new, TRUE);
@@ -2892,11 +2892,9 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase, wmO
static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop)
{
int i;
- BMVert *v;
BMEdge *e;
BMVert *v_seed;
BMWalker walker;
- BMIter iter;
int result = FALSE;
Object *obedit = editbase->object;
BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -2913,11 +2911,7 @@ static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOper
* original mesh.*/
for (i = 0; i < max_iter; i++) {
/* Get a seed vertex to start the walk */
- v_seed = NULL;
- BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
- v_seed = v;
- break;
- }
+ v_seed = BM_iter_at_index(bm, BM_VERTS_OF_MESH, NULL, 0);
/* No vertices available, can't do anything */
if (v_seed == NULL) {
@@ -4187,11 +4181,11 @@ void MESH_OT_sort_elements(wmOperatorType *ot)
{
static EnumPropertyItem type_items[] = {
{SRT_VIEW_ZAXIS, "VIEW_ZAXIS", 0, "View Z Axis",
- "Sort selected elements from farest to nearest one in current view"},
+ "Sort selected elements from farthest to nearest one in current view"},
{SRT_VIEW_XAXIS, "VIEW_XAXIS", 0, "View X Axis",
"Sort selected elements from left to right one in current view"},
{SRT_CURSOR_DISTANCE, "CURSOR_DISTANCE", 0, "Cursor Distance",
- "Sort selected elements from nearest to farest from 3D cursor"},
+ "Sort selected elements from nearest to farthest from 3D cursor"},
{SRT_MATERIAL, "MATERIAL", 0, "Material",
"Sort selected elements from smallest to greatest material index (faces only!)"},
{SRT_SELECTED, "SELECTED", 0, "Selected",
@@ -4966,7 +4960,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_op_callf(em->bm, "del geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
+ BMO_op_callf(em->bm, "delete geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
}
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
@@ -5032,7 +5026,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Delete unused vertices, edges, and faces */
if (RNA_boolean_get(op->ptr, "delete_unused")) {
- if (!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
&bmop, "unused_geom", DEL_ONLYTAGGED))
{
EDBM_op_finish(em, &bmop, op, TRUE);
@@ -5042,7 +5036,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Delete hole edges/faces */
if (RNA_boolean_get(op->ptr, "make_holes")) {
- if (!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
&bmop, "holes_geom", DEL_ONLYTAGGED))
{
EDBM_op_finish(em, &bmop, op, TRUE);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index c3fbb2e8c16..4952dd3f09a 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -485,7 +485,7 @@ void EDBM_select_more(BMEditMesh *em)
int use_faces = em->selectmode == SCE_SELECT_FACE;
BMO_op_initf(em->bm, &bmop,
- "regionextend geom=%hvef constrict=%b use_faces=%b",
+ "region_extend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, FALSE, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
@@ -501,7 +501,7 @@ void EDBM_select_less(BMEditMesh *em)
int use_faces = em->selectmode == SCE_SELECT_FACE;
BMO_op_initf(em->bm, &bmop,
- "regionextend geom=%hvef constrict=%b use_faces=%b",
+ "region_extend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, TRUE, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 59a0475ebb5..cdbf5751ea1 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -45,6 +45,7 @@
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -418,8 +419,17 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
if (me->totloop) {
- if (base->object != ob)
+ if (base->object != ob) {
+ MultiresModifierData *mmd;
+
multiresModifier_prepare_join(scene, base->object, ob);
+
+ if ((mmd = get_multires_modifier(scene, base->object, TRUE))) {
+ ED_object_iter_other(bmain, base->object, TRUE,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
+ }
+ }
CustomData_merge(&me->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
CustomData_copy_data(&me->ldata, &ldata, 0, loopofs, me->totloop);
@@ -888,7 +898,7 @@ int mesh_mirrtopo_table(Object *ob, char mode)
return 0;
}
-static int mesh_get_x_mirror_vert_spacial(Object *ob, int index)
+static int mesh_get_x_mirror_vert_spatial(Object *ob, int index)
{
Mesh *me = ob->data;
MVert *mvert;
@@ -916,12 +926,12 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
return mesh_get_x_mirror_vert_topo(ob, index);
}
else {
- return mesh_get_x_mirror_vert_spacial(ob, index);
+ return mesh_get_x_mirror_vert_spatial(ob, index);
}
return 0;
}
-static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, const float co[3])
+static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, const float co[3])
{
float vec[3];
intptr_t poinval;
@@ -979,7 +989,7 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *e
return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
}
else {
- return editbmesh_get_x_mirror_vert_spacial(ob, em, co);
+ return editbmesh_get_x_mirror_vert_spatial(ob, em, co);
}
}
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 810fe244984..e1c715952d1 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -616,13 +616,15 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
CLAMP(ss_lvl, 0, 6);
- smd.levels = smd.renderLevels = ss_lvl;
- smd.flags |= eSubsurfModifierFlag_SubsurfUv;
+ if (ss_lvl > 0) {
+ smd.levels = smd.renderLevels = ss_lvl;
+ smd.flags |= eSubsurfModifierFlag_SubsurfUv;
- if (bkr->simple)
- smd.subdivType = ME_SIMPLE_SUBSURF;
+ if (bkr->simple)
+ smd.subdivType = ME_SIMPLE_SUBSURF;
- height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
+ height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
+ }
}
height_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 908c0a6f4f2..35ee641d2c1 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -106,7 +106,7 @@
/* ************* XXX **************** */
static void error(const char *UNUSED(arg)) {}
static void waitcursor(int UNUSED(val)) {}
-static int pupmenu(const char *UNUSED(msg)) {return 0;}
+static int pupmenu(const char *UNUSED(msg)) { return 0; }
/* port over here */
static void error_libdata(void) {}
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index b47591dddee..c9851c6a0db 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -160,7 +160,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int group_objects_remove_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -180,21 +180,116 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-void GROUP_OT_objects_remove(wmOperatorType *ot)
+void GROUP_OT_objects_remove_all(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Remove From Groups";
- ot->description = "Remove selected objects from all groups";
- ot->idname = "GROUP_OT_objects_remove";
+ ot->name = "Remove From All Groups";
+ ot->description = "Remove selected objects from all groups or a selected group";
+ ot->idname = "GROUP_OT_objects_remove_all";
/* api callbacks */
- ot->exec = group_objects_remove_exec;
+ ot->exec = group_objects_remove_all_exec;
ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+static int group_objects_remove_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = ED_object_context(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ int group_object_index = RNA_enum_get(op->ptr, "group");
+
+ /* first get the group back from the enum index, quite awkward and UI spesific */
+ if (ob) {
+ Group *group = NULL;
+ int i = 0;
+
+ while ((group = find_group(ob, group))) {
+ if (i == group_object_index) {
+ break;
+ }
+ i++;
+ }
+
+ /* now remove all selected objects from the group */
+ if (group) {
+
+ CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
+ {
+ rem_from_group(group, base->object, scene, base);
+ }
+ CTX_DATA_END;
+
+ DAG_scene_sort(bmain, scene);
+ WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
+
+ return OPERATOR_FINISHED;
+ }
+ }
+
+ return OPERATOR_CANCELLED;
+}
+
+
+/* can be called with C == NULL */
+static EnumPropertyItem *group_objects_remove_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+{
+ Object *ob;
+ EnumPropertyItem *item = NULL, item_tmp = {0};
+ int totitem = 0;
+
+ if (C == NULL) {
+ return DummyRNA_NULL_items;
+ }
+
+ ob = ED_object_context(C);
+
+ /* check that the action exists */
+ if (ob) {
+ Group *group = NULL;
+ int i = 0;
+
+ while ((group = find_group(ob, group))) {
+ item_tmp.identifier = item_tmp.name = group->id.name + 2;
+ /* item_tmp.icon = ICON_ARMATURE_DATA; */
+ item_tmp.value = i;
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ i++;
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *free = 1;
+
+ return item;
+}
+
+void GROUP_OT_objects_remove(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Remove From Group";
+ ot->description = "Remove selected objects from all groups or a selected group";
+ ot->idname = "GROUP_OT_objects_remove";
+
+ /* api callbacks */
+ ot->exec = group_objects_remove_exec;
+ ot->invoke = WM_menu_invoke;
+ ot->poll = ED_operator_objectmode;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "The group to remove this object from");
+ RNA_def_enum_funcs(prop, group_objects_remove_itemf);
+ ot->prop = prop;
+}
+
static int group_create_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 6f3cca442f0..917f1c67f8f 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -139,6 +139,7 @@ void LATTICE_OT_make_regular(struct wmOperatorType *ot);
/* object_group.c */
void GROUP_OT_create(struct wmOperatorType *ot);
+void GROUP_OT_objects_remove_all(struct wmOperatorType *ot);
void GROUP_OT_objects_remove(struct wmOperatorType *ot);
void GROUP_OT_objects_add_active(struct wmOperatorType *ot);
void GROUP_OT_objects_remove_active(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index d6b5fb9fc10..aab3d8afb22 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -173,7 +173,100 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
return new_md;
}
-static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgraph)
+/* Return TRUE if the object has a modifier of type 'type' other than
+ * the modifier pointed to be 'exclude', otherwise returns FALSE. */
+static int object_has_modifier(const Object *ob, const ModifierData *exclude,
+ ModifierType type)
+{
+ ModifierData *md;
+
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if ((md != exclude) && (md->type == type))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* If the object data of 'orig_ob' has other users, run 'callback' on
+ * each of them.
+ *
+ * If include_orig is TRUE, the callback will run on 'orig_ob' too.
+ *
+ * If the callback ever returns TRUE, iteration will stop and the
+ * function value will be TRUE. Otherwise the function returns FALSE.
+ */
+int ED_object_iter_other(Main *bmain, Object *orig_ob, int include_orig,
+ int (*callback)(Object *ob, void *callback_data),
+ void *callback_data)
+{
+ ID *ob_data_id = orig_ob->data;
+ int users = ob_data_id->us;
+
+ if (ob_data_id->flag & LIB_FAKEUSER)
+ users--;
+
+ /* First check that the object's data has multiple users */
+ if (users > 1) {
+ Object *ob;
+ int totfound = include_orig ? 0 : 1;
+
+ for (ob = bmain->object.first; ob && totfound < users;
+ ob = ob->id.next)
+ {
+ if (((ob != orig_ob) || include_orig) &&
+ (ob->data == orig_ob->data))
+ {
+ if (callback(ob, callback_data))
+ return TRUE;
+
+ totfound++;
+ }
+ }
+ }
+ else if (include_orig) {
+ return callback(orig_ob, callback_data);
+ }
+
+ return FALSE;
+}
+
+static int object_has_modifier_cb(Object *ob, void *data)
+{
+ ModifierType type = *((ModifierType*)data);
+
+ return object_has_modifier(ob, NULL, type);
+}
+
+/* Use with ED_object_iter_other(). Sets the total number of levels
+ * for any multires modifiers on the object to the int pointed to by
+ * callback_data. */
+int ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v)
+{
+ ModifierData *md;
+ int totlevel = *((int*)totlevel_v);
+
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_Multires) {
+ multires_set_tot_level(ob, (MultiresModifierData *)md, totlevel);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ }
+ }
+ return FALSE;
+}
+
+/* Return TRUE if no modifier of type 'type' other than 'exclude' */
+static int object_modifier_safe_to_delete(Main *bmain, Object *ob,
+ ModifierData *exclude,
+ ModifierType type)
+{
+ return (!object_has_modifier(ob, exclude, type) &&
+ !ED_object_iter_other(bmain, ob, FALSE,
+ object_has_modifier_cb, &type));
+}
+
+static int object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
+ int *sort_depsgraph)
{
ModifierData *obmd;
@@ -218,33 +311,13 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
ob->dt = OB_TEXTURE;
}
else if (md->type == eModifierType_Multires) {
- int ok = 1;
- ModifierData *tmpmd;
-
- /* ensure MDISPS CustomData layer isn't used by another multires modifiers */
- for (tmpmd = ob->modifiers.first; tmpmd; tmpmd = tmpmd->next)
- if (tmpmd != md && tmpmd->type == eModifierType_Multires) {
- ok = 0;
- break;
- }
-
- if (ok) {
+ /* Delete MDisps layer if not used by another multires modifier */
+ if (object_modifier_safe_to_delete(bmain, ob, md, eModifierType_Multires))
multires_customdata_delete(ob->data);
- }
}
else if (md->type == eModifierType_Skin) {
- int ok = 1;
- ModifierData *tmpmd;
-
- /* ensure skin CustomData layer isn't used by another skin modifier */
- for (tmpmd = ob->modifiers.first; tmpmd; tmpmd = tmpmd->next) {
- if (tmpmd != md && tmpmd->type == eModifierType_Skin) {
- ok = 0;
- break;
- }
- }
-
- if (ok)
+ /* Delete MVertSkin layer if not used by another skin modifier */
+ if (object_modifier_safe_to_delete(bmain, ob, md, eModifierType_Skin))
modifier_skin_customdata_delete(ob);
}
@@ -265,7 +338,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
int sort_depsgraph = 0;
int ok;
- ok = object_modifier_remove(ob, md, &sort_depsgraph);
+ ok = object_modifier_remove(bmain, ob, md, &sort_depsgraph);
if (!ok) {
BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name);
@@ -294,7 +367,7 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
next_md = md->next;
- object_modifier_remove(ob, md, &sort_depsgraph);
+ object_modifier_remove(bmain, ob, md, &sort_depsgraph);
md = next_md;
}
@@ -771,19 +844,21 @@ static void edit_modifier_properties(wmOperatorType *ot)
static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
ModifierData *md;
- if (RNA_struct_property_is_set(op->ptr, "modifier"))
- return 1;
-
- if (ptr.data) {
- md = ptr.data;
- RNA_string_set(op->ptr, "modifier", md->name);
- return 1;
+ if (RNA_struct_property_is_set(op->ptr, "modifier")) {
+ return TRUE;
}
-
- return 0;
+ else {
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+ if (ptr.data) {
+ md = ptr.data;
+ RNA_string_set(op->ptr, "modifier", md->name);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
}
static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
@@ -843,7 +918,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -882,7 +957,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -921,7 +996,7 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -969,7 +1044,7 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
RNA_def_enum(ot->srna, "apply_as", modifier_apply_as_items, MODIFIER_APPLY_DATA, "Apply as", "How to apply the modifier to the geometry");
edit_modifier_properties(ot);
@@ -1012,7 +1087,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1051,7 +1126,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1071,6 +1146,10 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
multiresModifier_del_levels(mmd, ob, 1);
+
+ ED_object_iter_other(CTX_data_main(C), ob, TRUE,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1096,7 +1175,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
ot->exec = multires_higher_levels_delete_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1112,6 +1191,10 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
multiresModifier_subdivide(mmd, ob, 0, mmd->simple);
+ ED_object_iter_other(CTX_data_main(C), ob, TRUE,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
+
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1137,7 +1220,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
ot->exec = multires_subdivide_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1201,7 +1284,7 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
ot->exec = multires_reshape_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1276,7 +1359,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
ot->poll = multires_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
WM_operator_properties_filesel(ot, FOLDERFILE | BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
edit_modifier_properties(ot);
@@ -1348,7 +1431,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
ot->exec = multires_base_apply_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1673,7 +1756,7 @@ static Object *modifier_skin_armature_create(struct Scene *scene,
edges_visited = BLI_BITMAP_NEW(me->totedge, "edge_visited");
/* note: we use EditBones here, easier to set them up and use
- * edit-armature functions to convert back to regular bones */
+ * edit-armature functions to convert back to regular bones */
for (v = 0; v < me->totvert; v++) {
if (mvert_skin[v].flag & MVERT_SKIN_ROOT) {
EditBone *bone = NULL;
@@ -1763,7 +1846,7 @@ void OBJECT_OT_skin_armature_create(wmOperatorType *ot)
ot->exec = skin_armature_create_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1858,7 +1941,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
ot->exec = meshdeform_bind_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1905,7 +1988,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot)
ot->exec = explode_refresh_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -2120,7 +2203,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot)
ot->exec = ocean_bake_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
RNA_def_boolean(ot->srna, "free", FALSE, "Free", "Free the bake, rather than generating it");
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index addc6cd4277..f8f4fe9c4e5 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -105,6 +105,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_select_mirror);
WM_operatortype_append(GROUP_OT_create);
+ WM_operatortype_append(GROUP_OT_objects_remove_all);
WM_operatortype_append(GROUP_OT_objects_remove);
WM_operatortype_append(GROUP_OT_objects_add_active);
WM_operatortype_append(GROUP_OT_objects_remove_active);
@@ -395,6 +396,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "GROUP_OT_create", GKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+ WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_all", GKEY, KM_PRESS, KM_SHIFT | KM_CTRL | KM_ALT, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 89f018a1b76..3d3f4ef1260 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -270,7 +270,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
{
if (nr == 1) {
// XXX old animation system
- //if (base->object->ipo==ipo) base->flag |= SELECT;
+ //if (base->object->ipo == ipo) base->flag |= SELECT;
//changed = 1;
}
else if (nr == 2) {
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index b31e5c0aea3..2e58fa85a11 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -567,11 +567,14 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
if (deform) {
fsmesh.channelSizeVertices = length;
fsmesh.channelVertices = fobj->VertexCache;
-
- // remove channels
+
+ /* remove channels */
fsmesh.channelTranslation =
fsmesh.channelRotation =
- fsmesh.channelScale = NULL;
+ fsmesh.channelScale = NULL;
+
+ /* Override user settings, only noslip is supported here! */
+ fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
}
elbeemAddMesh(&fsmesh);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index de3d2d4e871..d37a16cb1bb 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -518,7 +518,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
ibuf = BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
if (ibuf) {
- /* color -> greyscale */
+ /* color -> grayscale */
/* editing directly would alter the render view */
if (scene->r.im_format.planes == R_IMF_PLANES_BW) {
ImBuf *ibuf_bw = IMB_dupImBuf(ibuf);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 37ab87780b5..a638aac9423 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -862,7 +862,7 @@ static void draw_join_shape(ScrArea *sa, char dir)
draw_horizontal_join_shape(sa, dir);
}
-/* draw screen area darker with arrow (visualisation of future joining) */
+/* draw screen area darker with arrow (visualization of future joining) */
static void scrarea_draw_shape_dark(ScrArea *sa, char dir)
{
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1241,6 +1241,8 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
else
WM_cursor_set(win, CURSOR_X_MOVE);
}
+ else
+ WM_cursor_set(win, CURSOR_STD);
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index cacd6d01291..6be276dea14 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -458,7 +458,7 @@ int ED_operator_editmball(bContext *C)
int ED_operator_mask(bContext *C)
{
- SpaceClip *sc= CTX_wm_space_clip(C);
+ SpaceClip *sc = CTX_wm_space_clip(C);
return ED_space_clip_check_show_maskedit(sc);
}
@@ -2826,7 +2826,7 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U
uiItemS(layout);
- /* file browser should be fullscreen all the time, but other regions can be maximised/restored... */
+ /* file browser should be fullscreen all the time, but other regions can be maximized/restored... */
if (sa->spacetype != SPACE_FILE) {
if (sa->full)
uiItemO(layout, "Tile Area", ICON_NONE, "SCREEN_OT_screen_full_area");
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index b0867608840..6a8f7db5fc9 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -2344,8 +2344,8 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
/* Use tf_uv_pxoffset instead of tf->uv so we can offset the UV half a pixel
* this is done so we can avoid offsetting all the pixels by 0.5 which causes
* problems when wrapping negative coords */
- xhalfpx = (0.5f + (PROJ_GEOM_TOLERANCE / 3.0f) ) / ibuf_xf;
- yhalfpx = (0.5f + (PROJ_GEOM_TOLERANCE / 4.0f) ) / ibuf_yf;
+ xhalfpx = (0.5f + (PROJ_GEOM_TOLERANCE / 3.0f)) / ibuf_xf;
+ yhalfpx = (0.5f + (PROJ_GEOM_TOLERANCE / 4.0f)) / ibuf_yf;
/* Note about (PROJ_GEOM_TOLERANCE/x) above...
* Needed to add this offset since UV coords are often quads aligned to pixels.
@@ -4935,7 +4935,7 @@ static int texture_paint_init(bContext *C, wmOperator *op)
if (BKE_brush_size_get(scene, brush) < 2)
BKE_brush_size_set(scene, brush, 2);
- /* allocate and initialize spacial data structures */
+ /* allocate and initialize spatial data structures */
project_paint_begin(&pop->ps);
if (pop->ps.dm == NULL)
@@ -5728,7 +5728,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
image_undo_restore, image_undo_free);
- /* allocate and initialize spacial data structures */
+ /* allocate and initialize spatial data structures */
project_paint_begin(&ps);
if (ps.dm == NULL) {
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 3c37ad8cf2a..1b62ba8a7e0 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -3045,7 +3045,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op)
void PAINT_OT_weight_from_bones(wmOperatorType *ot)
{
static EnumPropertyItem type_items[] = {
- {ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights froms bones"},
+ {ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights from bones"},
{ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"},
{0, NULL, 0, NULL, NULL}};
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 89dbe14f62a..bfac2922c2b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -592,7 +592,7 @@ static float calc_overlap(StrokeCache *cache, const char symm, const char axis,
distsq = len_squared_v3v3(mirror, cache->true_location);
if (distsq <= 4.0f * (cache->radius_squared))
- return (2.0f * (cache->radius) - sqrtf(distsq)) / (2.0f * (cache->radius));
+ return (2.0f * (cache->radius) - sqrtf(distsq)) / (2.0f * (cache->radius));
else
return 0;
}
@@ -3145,40 +3145,46 @@ static const char *sculpt_tool_name(Sculpt *sd)
{
Brush *brush = paint_brush(&sd->paint);
- switch (brush->sculpt_tool) {
+ switch ((BrushSculptTool)brush->sculpt_tool) {
case SCULPT_TOOL_DRAW:
- return "Draw Brush"; break;
+ return "Draw Brush";
case SCULPT_TOOL_SMOOTH:
- return "Smooth Brush"; break;
+ return "Smooth Brush";
case SCULPT_TOOL_CREASE:
- return "Crease Brush"; break;
+ return "Crease Brush";
case SCULPT_TOOL_BLOB:
- return "Blob Brush"; break;
+ return "Blob Brush";
case SCULPT_TOOL_PINCH:
- return "Pinch Brush"; break;
+ return "Pinch Brush";
case SCULPT_TOOL_INFLATE:
- return "Inflate Brush"; break;
+ return "Inflate Brush";
case SCULPT_TOOL_GRAB:
- return "Grab Brush"; break;
+ return "Grab Brush";
case SCULPT_TOOL_NUDGE:
- return "Nudge Brush"; break;
+ return "Nudge Brush";
case SCULPT_TOOL_THUMB:
- return "Thumb Brush"; break;
+ return "Thumb Brush";
case SCULPT_TOOL_LAYER:
- return "Layer Brush"; break;
+ return "Layer Brush";
case SCULPT_TOOL_FLATTEN:
- return "Flatten Brush"; break;
+ return "Flatten Brush";
case SCULPT_TOOL_CLAY:
- return "Clay Brush"; break;
+ return "Clay Brush";
case SCULPT_TOOL_CLAY_STRIPS:
- return "Clay Strips Brush"; break;
+ return "Clay Strips Brush";
case SCULPT_TOOL_FILL:
- return "Fill Brush"; break;
+ return "Fill Brush";
case SCULPT_TOOL_SCRAPE:
- return "Scrape Brush"; break;
- default:
- return "Sculpting"; break;
+ return "Scrape Brush";
+ case SCULPT_TOOL_SNAKE_HOOK:
+ return "Snake Hook Brush";
+ case SCULPT_TOOL_ROTATE:
+ return "Rotate Brush";
+ case SCULPT_TOOL_MASK:
+ return "Mask Brush";
}
+
+ return "Sculpting";
}
/**
@@ -3639,8 +3645,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
}
/* Returns true iff any of the smoothing modes are active (currently
- one of smooth brush, autosmooth, mask smooth, or shift-key
- smooth) */
+ * one of smooth brush, autosmooth, mask smooth, or shift-key
+ * smooth) */
static int sculpt_any_smooth_mode(const Brush *brush,
StrokeCache *cache,
int stroke_mode)
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 539a32161e5..b42c6406362 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -930,8 +930,25 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s
ED_gpencil_select_frame(ale->data, selx, select_mode);
else if (ale->type == ANIMTYPE_MASKLAYER)
ED_mask_select_frame(ale->data, selx, select_mode);
- else
- ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
+ else {
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) &&
+ (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL))
+ {
+ ListBase anim_data = {NULL, NULL};
+ int filter;
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ if (ale->type == ANIMTYPE_GPLAYER)
+ ED_gpencil_select_frame(ale->data, selx, select_mode);
+ else if (ale->type == ANIMTYPE_MASKLAYER)
+ ED_mask_select_frame(ale->data, selx, select_mode);
+ }
+ }
+ else {
+ ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
+ }
+ }
}
/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index d8d664eea22..2cbcbcdbc9a 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -63,6 +63,7 @@
#include "ED_logic.h"
#include "ED_clip.h"
#include "ED_mask.h"
+#include "ED_sequencer.h"
#include "io_ops.h"
@@ -139,7 +140,8 @@ void ED_spacetypes_init(void)
ED_operatormacros_clip();
ED_operatormacros_curve();
ED_operatormacros_mask();
-
+ ED_operatormacros_sequencer();
+
/* register dropboxes (can use macros) */
spacetypes = BKE_spacetypes_list();
for (type = spacetypes->first; type; type = type->next) {
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index d1c2c1e092f..6154a1cc5ce 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -991,7 +991,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
if (!path)
return;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
block = uiLayoutGetBlock(row);
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 9b3d713d040..e561b2a9e79 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -118,13 +118,13 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL);
if (clip) {
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
block = uiLayoutGetBlock(row);
uiDefBut(block, LABEL, 0, "File Path:", 0, 19, 145, 19, NULL, 0, 0, 0, 0, "");
- row = uiLayoutRow(layout, 0);
- split = uiLayoutSplit(row, 0.0, 0);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(layout, FALSE);
+ split = uiLayoutSplit(row, 0.0f, FALSE);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, &clipptr, "filepath", 0, "", ICON_NONE);
uiItemO(row, "", ICON_FILE_REFRESH, "clip.reload");
@@ -396,7 +396,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
BKE_movieclip_get_size(clip, user, &width, &height);
if (track->flag & TRACK_LOCKED) {
- uiLayoutSetActive(layout, 0);
+ uiLayoutSetActive(layout, FALSE);
block = uiLayoutAbsoluteBlock(layout);
uiDefBut(block, LABEL, 0, "Track is locked", 0, 0, 300, 19, NULL, 0, 0, 0, 0, "");
@@ -434,7 +434,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, "Enabled", 10, 190, 145, 19, &cb->marker_flag,
0, 0, 0, 0, tip);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiLayoutSetActive(col, (cb->marker_flag & MARKER_DISABLED) == 0);
block = uiLayoutAbsoluteBlock(col);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 9b9e2223ae6..37da40e11b3 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1318,7 +1318,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
MovieTrackingTrack *track = BKE_tracking_track_get_active(&sc->clip->tracking);
if (track) {
- int framenr = sc->user.framenr;
+ int framenr = ED_space_clip_get_clip_frame_number(sc);
MovieTrackingMarker *marker = BKE_tracking_marker_get_exact(track, framenr);
offsx = marker->pos[0];
@@ -1408,19 +1408,23 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
glPopMatrix();
}
-void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
+void clip_draw_main(const bContext *C, ARegion *ar)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
+ Scene *scene = CTX_data_scene(C);
ImBuf *ibuf;
int width, height;
float zoomx, zoomy;
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+
/* if no clip, nothing to do */
- if (!clip)
+ if (!clip) {
+ ED_region_grid_draw(ar, zoomx, zoomy);
return;
-
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ }
if (sc->flag & SC_SHOW_STABLE) {
float smat[4][4], ismat[4][4];
@@ -1492,12 +1496,10 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
MovieTrackingTrack *track = BKE_tracking_track_get_active(&sc->clip->tracking);
if (track) {
- int framenr = sc->user.framenr;
- /* don't get the exact marker since it may not exist for the frame */
+ int framenr = ED_space_clip_get_clip_frame_number(sc);
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
- if (marker) {
- glTranslatef(marker->pos[0], marker->pos[1], 0.0f);
- }
+
+ glTranslatef(marker->pos[0], marker->pos[1], 0.0f);
}
}
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 4dd2f82df02..224a250fe4c 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -122,132 +122,73 @@ int ED_space_clip_maskedit_mask_poll(bContext *C)
return FALSE;
}
-/* ******** editing functions ******** */
+/* ******** common editing functions ******** */
-void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip)
+void ED_space_clip_get_size(const bContext *C, int *width, int *height)
{
- MovieClip *old_clip;
-
- if (!screen && C)
- screen = CTX_wm_screen(C);
-
- old_clip = sc->clip;
- sc->clip = clip;
-
- if (sc->clip && sc->clip->id.us == 0)
- sc->clip->id.us = 1;
-
- if (screen && sc->view == SC_VIEW_CLIP) {
- ScrArea *area;
- SpaceLink *sl;
-
- for (area = screen->areabase.first; area; area = area->next) {
- for (sl = area->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_CLIP) {
- SpaceClip *cur_sc = (SpaceClip *) sl;
+ SpaceClip *sc = CTX_wm_space_clip(C);
- if (cur_sc != sc && cur_sc->view != SC_VIEW_CLIP) {
- if (cur_sc->clip == old_clip || cur_sc->clip == NULL) {
- cur_sc->clip = clip;
- }
- }
- }
- }
- }
+ if (!sc->clip) {
+ *width = *height = 0;
+ }
+ else {
+ BKE_movieclip_get_size(sc->clip, &sc->user, width, height);
}
-
- if (C)
- WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip);
-}
-
-MovieClip *ED_space_clip_get_clip(SpaceClip *sc)
-{
- return sc->clip;
-}
-
-Mask *ED_space_clip_get_mask(SpaceClip *sc)
-{
- return sc->mask;
}
-ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
+void ED_space_clip_get_zoom(const bContext *C, float *zoomx, float *zoomy)
{
- if (sc->clip) {
- ImBuf *ibuf;
-
- ibuf = BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
-
- if (ibuf && (ibuf->rect || ibuf->rect_float))
- return ibuf;
+ ARegion *ar = CTX_wm_region(C);
+ int width, height;
- if (ibuf)
- IMB_freeImBuf(ibuf);
- }
+ ED_space_clip_get_size(C, &width, &height);
- return NULL;
+ *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
+ *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
}
-ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale, float *angle)
+void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
{
- if (sc->clip) {
- ImBuf *ibuf;
-
- ibuf = BKE_movieclip_get_stable_ibuf(sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
-
- if (ibuf && (ibuf->rect || ibuf->rect_float))
- return ibuf;
-
- if (ibuf)
- IMB_freeImBuf(ibuf);
- }
+ MovieClip *clip = ED_space_clip_get_clip(sc);
- return NULL;
-}
+ if (clip)
+ BKE_movieclip_aspect(clip, aspx, aspy);
+ else
+ *aspx = *aspy = 1.0f;
-void ED_space_clip_get_clip_size(SpaceClip *sc, int *width, int *height)
-{
- if (!sc->clip) {
- *width = *height = 0;
+ if (*aspx < *aspy) {
+ *aspy = *aspy / *aspx;
+ *aspx = 1.0f;
}
else {
- BKE_movieclip_get_size(sc->clip, &sc->user, width, height);
+ *aspx = *aspx / *aspy;
+ *aspy = 1.0f;
}
}
-void ED_space_clip_get_mask_size(SpaceClip *sc, int *width, int *height)
+void ED_space_clip_get_aspect_dimension_aware(SpaceClip *sc, float *aspx, float *aspy)
{
- /* quite the same as ED_space_clip_size, but it also runs aspect correction on output resolution
- * this is needed because mask should be rasterized with exactly the same resolution as
- * currently displaying frame and it doesn't have access to aspect correction currently
- * used for display. (sergey)
- */
+ int w, h;
- if (!sc->mask) {
- *width = 0;
- *height = 0;
- } else {
- float aspx, aspy;
+ /* most of tools does not require aspect to be returned with dimensions correction
+ * due to they're invariant to this stuff, but some transformation tools like rotation
+ * should be aware of aspect correction caused by different resolution in different
+ * directions.
+ * mainly this is sued for transformation stuff
+ */
- ED_space_clip_get_clip_size(sc, width, height);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ if (!sc->clip) {
+ *aspx = 1.0f;
+ *aspy = 1.0f;
- *width *= aspx;
- *height *= aspy;
+ return;
}
-}
-
-void ED_space_clip_get_mask_aspect(SpaceClip *sc, float *aspx, float *aspy)
-{
- int w, h;
- ED_space_clip_get_clip_aspect(sc, aspx, aspy);
- ED_space_clip_get_clip_size(sc, &w, &h);
+ ED_space_clip_get_aspect(sc, aspx, aspy);
+ BKE_movieclip_get_size(sc->clip, &sc->user, &w, &h);
- /* now this is not accounted for! */
-#if 0
- *aspx *= (float)w;
- *aspy *= (float)h;
-#endif
+ *aspx *= (float) w;
+ *aspy *= (float) h;
if (*aspx < *aspy) {
*aspy = *aspy / *aspx;
@@ -259,51 +200,46 @@ void ED_space_clip_get_mask_aspect(SpaceClip *sc, float *aspx, float *aspy)
}
}
-void ED_space_clip_get_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
+/* return current frame number in clip space */
+int ED_space_clip_get_clip_frame_number(SpaceClip *sc)
{
- int width, height;
-
- ED_space_clip_get_clip_size(sc, &width, &height);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
- *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
- *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
+ return BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr);
}
-void ED_space_clip_get_clip_aspect(SpaceClip *sc, float *aspx, float *aspy)
+ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
{
- MovieClip *clip = ED_space_clip_get_clip(sc);
+ if (sc->clip) {
+ ImBuf *ibuf;
- if (clip)
- BKE_movieclip_aspect(clip, aspx, aspy);
- else
- *aspx = *aspy = 1.0f;
+ ibuf = BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
+
+ if (ibuf && (ibuf->rect || ibuf->rect_float))
+ return ibuf;
+
+ if (ibuf)
+ IMB_freeImBuf(ibuf);
+ }
+
+ return NULL;
}
-void ED_space_clip_get_clip_aspect_dimension_aware(SpaceClip *sc, float *aspx, float *aspy)
+ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale, float *angle)
{
- int w, h;
-
- /* most of tools does not require aspect to be returned with dimensions correction
- * due to they're invariant to this stuff, but some transformation tools like rotation
- * should be aware of aspect correction caused by different resolution in different
- * directions.
- * mainly this is sued for transformation stuff
- */
+ if (sc->clip) {
+ ImBuf *ibuf;
- ED_space_clip_get_clip_aspect(sc, aspx, aspy);
- ED_space_clip_get_clip_size(sc, &w, &h);
+ ibuf = BKE_movieclip_get_stable_ibuf(sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
- *aspx *= (float)w;
- *aspy *= (float)h;
+ if (ibuf && (ibuf->rect || ibuf->rect_float))
+ return ibuf;
- if (*aspx < *aspy) {
- *aspy = *aspy / *aspx;
- *aspx = 1.0f;
- }
- else {
- *aspx = *aspx / *aspy;
- *aspy = 1.0f;
+ if (ibuf)
+ IMB_freeImBuf(ibuf);
}
+
+ return NULL;
}
void ED_clip_update_frame(const Main *mainp, int cfra)
@@ -329,29 +265,23 @@ void ED_clip_update_frame(const Main *mainp, int cfra)
}
}
-/* return current frame number in clip space */
-int ED_space_clip_get_clip_frame_number(SpaceClip *sc)
-{
- MovieClip *clip = ED_space_clip_get_clip(sc);
-
- return BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr);
-}
-
-static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
+static int selected_boundbox(const bContext *C, float min[2], float max[2])
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTrackingTrack *track;
int width, height, ok = FALSE;
ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
+ int framenr = ED_space_clip_get_clip_frame_number(sc);
INIT_MINMAX2(min, max);
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
track = tracksbase->first;
while (track) {
if (TRACK_VIEW_SELECTED(sc, track)) {
- MovieTrackingMarker *marker = BKE_tracking_marker_get(track, sc->user.framenr);
+ MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
if (marker) {
float pos[3];
@@ -383,22 +313,23 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
return ok;
}
-int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
+int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
int w, h, frame_width, frame_height;
float min[2], max[2];
- ED_space_clip_get_clip_size(sc, &frame_width, &frame_height);
+ ED_space_clip_get_size(C, &frame_width, &frame_height);
if (frame_width == 0 || frame_height == 0)
return FALSE;
- if (!selected_boundbox(sc, min, max))
+ if (!selected_boundbox(C, min, max))
return FALSE;
/* center view */
- clip_view_center_to_point(sc, (max[0] + min[0]) / (2 * frame_width),
- (max[1] + min[1]) / (2 * frame_height));
+ clip_view_center_to_point(C, (max[0] + min[0]) / (2 * frame_width),
+ (max[1] + min[1]) / (2 * frame_height));
w = max[0] - min[0];
h = max[1] - min[1];
@@ -408,7 +339,7 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
int width, height;
float zoomx, zoomy, newzoom, aspx, aspy;
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
width = ar->winrct.xmax - ar->winrct.xmin + 1;
height = ar->winrct.ymax - ar->winrct.ymin + 1;
@@ -434,7 +365,7 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[
float aspy = 1.0f / clip->tracking.camera.pixel_aspect;
int width, height;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ BKE_movieclip_get_size(sc->clip, &sc->user, &width, &height);
r_co[0] *= width;
r_co[1] *= height * aspy;
@@ -453,8 +384,8 @@ void ED_clip_point_stable_pos(const bContext *C, float x, float y, float *xr, fl
int sx, sy, width, height;
float zoomx, zoomy, pos[3], imat[4][4];
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
@@ -485,16 +416,18 @@ void ED_clip_point_stable_pos(const bContext *C, float x, float y, float *xr, fl
* \brief the reverse of ED_clip_point_stable_pos(), gets the marker region coords.
* better name here? view_to_track / track_to_view or so?
*/
-void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float co[2], float r_co[2])
+void ED_clip_point_stable_pos__reverse(const bContext *C, const float co[2], float r_co[2])
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ ARegion *ar = CTX_wm_region(C);
float zoomx, zoomy;
float pos[3];
int width, height;
int sx, sy;
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
ED_clip_point_undistorted_pos(sc, co, pos);
pos[2] = 0.0f;
@@ -511,6 +444,87 @@ void ED_clip_mouse_pos(const bContext *C, wmEvent *event, float co[2])
ED_clip_point_stable_pos(C, event->mval[0], event->mval[1], &co[0], &co[1]);
}
+int ED_space_clip_check_show_trackedit(SpaceClip *sc)
+{
+ if (sc) {
+ return ELEM3(sc->mode, SC_MODE_TRACKING, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION);
+ }
+
+ return FALSE;
+}
+
+int ED_space_clip_check_show_maskedit(SpaceClip *sc)
+{
+ if (sc) {
+ return sc->mode == SC_MODE_MASKEDIT;
+ }
+
+ return FALSE;
+}
+
+/* ******** clip editing functions ******** */
+
+MovieClip *ED_space_clip_get_clip(SpaceClip *sc)
+{
+ return sc->clip;
+}
+
+void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip)
+{
+ MovieClip *old_clip;
+
+ if (!screen && C)
+ screen = CTX_wm_screen(C);
+
+ old_clip = sc->clip;
+ sc->clip = clip;
+
+ if (sc->clip && sc->clip->id.us == 0)
+ sc->clip->id.us = 1;
+
+ if (screen && sc->view == SC_VIEW_CLIP) {
+ ScrArea *area;
+ SpaceLink *sl;
+
+ for (area = screen->areabase.first; area; area = area->next) {
+ for (sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_CLIP) {
+ SpaceClip *cur_sc = (SpaceClip *) sl;
+
+ if (cur_sc != sc && cur_sc->view != SC_VIEW_CLIP) {
+ if (cur_sc->clip == old_clip || cur_sc->clip == NULL) {
+ cur_sc->clip = clip;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (C)
+ WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip);
+}
+
+/* ******** masking editing functions ******** */
+
+Mask *ED_space_clip_get_mask(SpaceClip *sc)
+{
+ return sc->mask;
+}
+
+void ED_space_clip_set_mask(bContext *C, SpaceClip *sc, Mask *mask)
+{
+ sc->mask = mask;
+
+ if (sc->mask && sc->mask->id.us == 0) {
+ sc->clip->id.us = 1;
+ }
+
+ if (C) {
+ WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask);
+ }
+}
+
/* OpenGL draw context */
typedef struct SpaceClipDrawContext {
@@ -654,36 +668,3 @@ void ED_space_clip_free_texture_buffer(SpaceClip *sc)
MEM_freeN(context);
}
}
-
-/* ******** masking editing related functions ******** */
-
-int ED_space_clip_check_show_trackedit(SpaceClip *sc)
-{
- if (sc) {
- return ELEM3(sc->mode, SC_MODE_TRACKING, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION);
- }
-
- return FALSE;
-}
-
-int ED_space_clip_check_show_maskedit(SpaceClip *sc)
-{
- if (sc) {
- return sc->mode == SC_MODE_MASKEDIT;
- }
-
- return FALSE;
-}
-
-void ED_space_clip_set_mask(bContext *C, SpaceClip *sc, Mask *mask)
-{
- sc->mask = mask;
-
- if (sc->mask && sc->mask->id.us == 0) {
- sc->clip->id.us = 1;
- }
-
- if (C) {
- WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask);
- }
-}
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 5bc195a1ae2..c61a0baa82e 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -69,7 +69,7 @@ void clip_draw_dopesheet_channels(const struct bContext *C, struct ARegion *ar);
void CLIP_OT_dopesheet_select_channel(struct wmOperatorType *ot);
/* clip_draw.c */
-void clip_draw_main(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
+void clip_draw_main(const struct bContext *C, struct ARegion *ar);
void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
void clip_draw_curfra_label(struct SpaceClip *sc, float x, float y);
@@ -125,7 +125,7 @@ void clip_graph_tracking_iterate(struct SpaceClip *sc, int selected_only, int in
void clip_delete_track(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track);
void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker);
-void clip_view_center_to_point(struct SpaceClip *sc, float x, float y);
+void clip_view_center_to_point(const struct bContext *C, float x, float y);
void clip_draw_cfra(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index b3f7b221af0..9d1f52568b4 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -69,8 +69,10 @@
/******************** view navigation utilities *********************/
-static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float location[2])
+static void sclip_zoom_set(const bContext *C, float zoom, float location[2])
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ ARegion *ar = CTX_wm_region(C);
float oldzoom = sc->zoom;
int width, height;
@@ -78,7 +80,7 @@ static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float locatio
if (sc->zoom < 0.1f || sc->zoom > 4.0f) {
/* check zoom limits */
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
width *= sc->zoom;
height *= sc->zoom;
@@ -92,22 +94,22 @@ static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float locatio
}
if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
sc->xof += ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
sc->yof += ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
}
}
-static void sclip_zoom_set_factor(SpaceClip *sc, ARegion *ar, float zoomfac, float location[2])
+static void sclip_zoom_set_factor(const bContext *C, float zoomfac, float location[2])
{
- sclip_zoom_set(sc, ar, sc->zoom*zoomfac, location);
+ SpaceClip *sc = CTX_wm_space_clip(C);
+
+ sclip_zoom_set(C, sc->zoom * zoomfac, location);
}
static void sclip_zoom_set_factor_exec(bContext *C, wmEvent *event, float factor)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
float location[2], *mpos = NULL;
if (event) {
@@ -115,7 +117,7 @@ static void sclip_zoom_set_factor_exec(bContext *C, wmEvent *event, float factor
mpos = location;
}
- sclip_zoom_set_factor(sc, ar, factor, mpos);
+ sclip_zoom_set_factor(C, factor, mpos);
ED_region_tag_redraw(CTX_wm_region(C));
}
@@ -494,10 +496,7 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
static int view_zoom_exec(bContext *C, wmOperator *op)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
-
- sclip_zoom_set_factor(sc, ar, RNA_float_get(op->ptr, "factor"), NULL);
+ sclip_zoom_set_factor(C, RNA_float_get(op->ptr, "factor"), NULL);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -525,8 +524,6 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
ViewZoomData *vpd = op->customdata;
float factor;
@@ -534,7 +531,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
case MOUSEMOVE:
factor = 1.0f + (vpd->x - event->x + vpd->y - event->y) / 300.0f;
RNA_float_set(op->ptr, "factor", factor);
- sclip_zoom_set(sc, ar, vpd->zoom * factor, vpd->location);
+ sclip_zoom_set(C, vpd->zoom * factor, vpd->location);
ED_region_tag_redraw(CTX_wm_region(C));
break;
default:
@@ -582,13 +579,11 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
static int view_zoom_in_exec(bContext *C, wmOperator *op)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
- sclip_zoom_set_factor(sc, ar, 1.25f, location);
+ sclip_zoom_set_factor(C, 1.25f, location);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -624,13 +619,11 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot)
static int view_zoom_out_exec(bContext *C, wmOperator *op)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
- sclip_zoom_set_factor(sc, ar, 0.8f, location);
+ sclip_zoom_set_factor(C, 0.8f, location);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -661,7 +654,7 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location",
- "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
+ "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f);
}
/********************** view zoom ratio operator *********************/
@@ -669,9 +662,8 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
- sclip_zoom_set(sc, ar, RNA_float_get(op->ptr, "ratio"), NULL);
+ sclip_zoom_set(C, RNA_float_get(op->ptr, "ratio"), NULL);
/* ensure pixel exact locations for draw */
sc->xof = (int) sc->xof;
@@ -713,8 +705,8 @@ static int view_all_exec(bContext *C, wmOperator *op)
sc = CTX_wm_space_clip(C);
ar = CTX_wm_region(C);
- ED_space_clip_get_clip_size(sc, &w, &h);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_size(C, &w, &h);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
w = w * aspx;
h = h * aspy;
@@ -729,7 +721,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
zoomx = (float) width / (w + 2 * margin);
zoomy = (float) height / (h + 2 * margin);
- sclip_zoom_set(sc, ar, MIN2(zoomx, zoomy), NULL);
+ sclip_zoom_set(C, MIN2(zoomx, zoomy), NULL);
}
else {
if ((w >= width || h >= height) && (width > 0 && height > 0)) {
@@ -737,10 +729,10 @@ static int view_all_exec(bContext *C, wmOperator *op)
zoomy = (float) height / h;
/* find the zoom value that will fit the image in the image space */
- sclip_zoom_set(sc, ar, 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)), NULL);
+ sclip_zoom_set(C, 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)), NULL);
}
else
- sclip_zoom_set(sc, ar, 1.0f, NULL);
+ sclip_zoom_set(C, 1.0f, NULL);
}
sc->xof = sc->yof = 0.0f;
@@ -775,7 +767,7 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
sc->xlockof = 0.0f;
sc->ylockof = 0.0f;
- ED_clip_view_selection(sc, ar, 1);
+ ED_clip_view_selection(C, ar, 1);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 1c040c69fa9..d9c9f63e4a3 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -223,13 +223,14 @@ void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase,
}
}
-void clip_view_center_to_point(SpaceClip *sc, float x, float y)
+void clip_view_center_to_point(const bContext *C, float x, float y)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
int width, height;
float aspx, aspy;
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
sc->xof = (x - 0.5f) * width * aspx;
sc->yof = (y - 0.5f) * height * aspy;
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 49ee6b65256..0a6a4af6960 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1008,13 +1008,14 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
/********************* main region ********************/
/* sets up the fields of the View2D from zoom and offset */
-static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
+static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
float x1, y1, w, h;
int width, height, winx, winy;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
w = width;
h = height;
@@ -1074,11 +1075,54 @@ static void clip_main_area_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
+static void clip_main_area_draw_mask(const bContext *C, ARegion *ar)
+{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ int x, y;
+ int width, height;
+ float zoomx, zoomy;
+
+ /* frame image */
+ float maxdim;
+ float xofs, yofs;
+
+ /* find window pixel coordinates of origin */
+ UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
+
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+
+ /* frame the image */
+ maxdim = maxf(width, height);
+ if (width == height) {
+ xofs = yofs = 0;
+ }
+ else if (width < height) {
+ xofs = ((height - width) / -2.0f) * zoomx;
+ yofs = 0.0f;
+ }
+ else { /* (width > height) */
+ xofs = 0.0f;
+ yofs = ((width - height) / -2.0f) * zoomy;
+ }
+
+ /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
+ glPushMatrix();
+ glTranslatef(x + xofs, y + yofs, 0);
+ glScalef(maxdim * zoomx, maxdim * zoomy, 0);
+ glMultMatrixf(sc->stabmat);
+
+ ED_mask_draw(C, sc->mask_draw_flag, sc->mask_draw_type);
+
+ ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+
+ glPopMatrix();
+}
+
static void clip_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
SpaceClip *sc = CTX_wm_space_clip(C);
- Scene *scene = CTX_data_scene(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
/* if tracking is in progress, we should synchronize framenr from clipuser
@@ -1093,7 +1137,7 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
tmpibuf = ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
}
- if (ED_clip_view_selection(sc, ar, 0)) {
+ if (ED_clip_view_selection(C, ar, 0)) {
sc->xof += sc->xlockof;
sc->yof += sc->ylockof;
}
@@ -1107,51 +1151,12 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* data... */
- movieclip_main_area_set_view2d(sc, ar);
+ movieclip_main_area_set_view2d(C, ar);
- clip_draw_main(sc, ar, scene);
+ clip_draw_main(C, ar);
if (sc->mode == SC_MODE_MASKEDIT) {
- int x, y;
- int width, height;
- float zoomx, zoomy, aspx, aspy;
-
- /* frame image */
- float maxdim;
- float xofs, yofs;
-
- /* find window pixel coordinates of origin */
- UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
-
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
-
- /* frame the image */
- maxdim = maxf(width, height);
- if (width == height) {
- xofs = yofs = 0;
- }
- else if (width < height) {
- xofs = ((height - width) / -2.0f) * zoomx;
- yofs = 0.0f;
- }
- else { /* (width > height) */
- xofs = 0.0f;
- yofs = ((width - height) / -2.0f) * zoomy;
- }
-
- /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
- glPushMatrix();
- glTranslatef(x + xofs, y + yofs, 0);
- glScalef(maxdim * zoomx, maxdim * zoomy, 0);
- glMultMatrixf(sc->stabmat);
-
- ED_mask_draw(C, sc->mask_draw_flag, sc->mask_draw_type);
-
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
-
- glPopMatrix();
+ clip_main_area_draw_mask(C, ar);
}
/* Grease Pencil */
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 8f58df1cb2c..2e4ba844646 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -81,8 +81,9 @@
/********************** add marker operator *********************/
-static void add_marker(SpaceClip *sc, float x, float y)
+static void add_marker(const bContext *C, float x, float y)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
@@ -90,7 +91,7 @@ static void add_marker(SpaceClip *sc, float x, float y)
int width, height;
int framenr = ED_space_clip_get_clip_frame_number(sc);
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
track = BKE_tracking_track_add(tracking, tracksbase, x, y, framenr, width, height);
@@ -106,14 +107,14 @@ static int add_marker_exec(bContext *C, wmOperator *op)
float pos[2];
int width, height;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
if (!width || !height)
return OPERATOR_CANCELLED;
RNA_float_get_array(op->ptr, "location", pos);
- add_marker(sc, pos[0], pos[1]);
+ add_marker(C, pos[0], pos[1]);
/* reset offset from locked position, so frame jumping wouldn't be so confusing */
sc->xlockof = 0;
@@ -532,7 +533,7 @@ MovieTrackingTrack *tracking_marker_check_slide(bContext *C, wmEvent *event, int
int framenr = ED_space_clip_get_clip_frame_number(sc);
int action = -1, area = 0, corner = -1;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
if (width == 0 || height == 0)
return NULL;
@@ -628,7 +629,7 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event)
int framenr = ED_space_clip_get_clip_frame_number(sc);
int area, action, corner;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
if (width == 0 || height == 0)
return NULL;
@@ -1585,14 +1586,15 @@ static int clear_track_path_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
+ MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
- ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
+ ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
int action = RNA_enum_get(op->ptr, "action");
int clear_active = RNA_boolean_get(op->ptr, "clear_active");
int framenr = ED_space_clip_get_clip_frame_number(sc);
if (clear_active) {
- track = BKE_tracking_track_get_active(&clip->tracking);
+ track = BKE_tracking_track_get_active(tracking);
BKE_tracking_track_path_clear(track, framenr, action);
}
else {
@@ -1605,6 +1607,7 @@ static int clear_track_path_exec(bContext *C, wmOperator *op)
}
}
+ BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
return OPERATOR_FINISHED;
@@ -2605,6 +2608,7 @@ static int detect_features_exec(bContext *C, wmOperator *op)
IMB_freeImBuf(ibuf);
+ BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -3328,7 +3332,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op)
void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Movie Tracking Object";
+ ot->name = "Remove Tracking Object";
ot->description = "Remove object for tracking";
ot->idname = "CLIP_OT_tracking_object_remove";
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index f8f786e549c..0ebb84b3953 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -110,15 +110,16 @@ static int mouse_on_crns(float co[2], float pos[2], float crns[4][2], float epsx
return dist < MAX2(epsx, epsy);
}
-static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *track)
+static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *track)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
int framenr = ED_space_clip_get_clip_frame_number(sc);
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
float pat_min[2], pat_max[2];
float epsx, epsy;
int width, height;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
@@ -235,7 +236,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
track = find_nearest_track(sc, tracksbase, co);
if (track) {
- int area = track_mouse_area(sc, co, track);
+ int area = track_mouse_area(C, co, track);
if (!extend || !TRACK_VIEW_SELECTED(sc, track))
area = TRACK_AREA_ALL;
@@ -412,7 +413,6 @@ void CLIP_OT_select_border(wmOperatorType *ot)
static int do_lasso_select_marker(bContext *C, int mcords[][2], short moves, short select)
{
- ARegion *ar = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -435,7 +435,7 @@ static int do_lasso_select_marker(bContext *C, int mcords[][2], short moves, sho
float screen_co[2];
/* marker in screen coords */
- ED_clip_point_stable_pos__reverse(sc, ar, marker->pos, screen_co);
+ ED_clip_point_stable_pos__reverse(C, marker->pos, screen_co);
if (BLI_in_rcti(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], V2D_IS_CLIPPED))
@@ -520,7 +520,6 @@ static int circle_select_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- ARegion *ar = CTX_wm_region(C);
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
@@ -536,8 +535,8 @@ static int circle_select_exec(bContext *C, wmOperator *op)
mode = RNA_int_get(op->ptr, "gesture_mode");
/* compute ellipse and position in unified coordinates */
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
ellipse[0] = width * zoomx / radius;
ellipse[1] = height * zoomy / radius;
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 3ad6614d356..a07a560328c 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -91,7 +91,7 @@ int file_directory_exec(bContext *C, struct wmOperator *unused);
int file_directory_new_exec(bContext *C, struct wmOperator *unused);
int file_delete_exec(bContext *C, struct wmOperator *unused);
-int file_hilight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
+int file_highlight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my);
void file_sfile_to_operator(struct wmOperator *op, struct SpaceFile *sfile, char *filepath);
void file_operator_to_sfile(struct SpaceFile *sfile, struct wmOperator *op);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index e2fc1b64223..2d778b94216 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -515,7 +515,7 @@ void FILE_OT_delete_bookmark(wmOperatorType *ot)
RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000);
}
-int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
+int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
{
View2D *v2d = &ar->v2d;
FileSelectParams *params;
@@ -555,7 +555,7 @@ static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *e
ARegion *ar = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
- if (!file_hilight_set(sfile, ar, event->x, event->y))
+ if (!file_highlight_set(sfile, ar, event->x, event->y))
return OPERATOR_CANCELLED;
ED_area_tag_redraw(CTX_wm_area(C));
@@ -1277,7 +1277,8 @@ void FILE_OT_hidedot(struct wmOperatorType *ot)
ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
}
-struct ARegion *file_buttons_region(struct ScrArea *sa){
+struct ARegion *file_buttons_region(struct ScrArea *sa)
+{
ARegion *ar, *arnew;
for (ar = sa->regionbase.first; ar; ar = ar->next)
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 77e99a61b10..51bd660e126 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -87,12 +87,12 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
uiLayoutSetAlignment(pa->layout, UI_LAYOUT_ALIGN_LEFT);
block = uiLayoutGetBlock(pa->layout);
box = uiLayoutBox(pa->layout);
- col = uiLayoutColumn(box, 1);
+ col = uiLayoutColumn(box, TRUE);
for (i_iter = 0; i_iter < nentries; ++i_iter) {
char dir[FILE_MAX];
char temp[FILE_MAX];
- uiLayout *layout = uiLayoutRow(col, 0);
+ uiLayout *layout = uiLayoutRow(col, FALSE);
char *entry;
i = reverse ? nentries - (i_iter + 1) : i_iter;
@@ -143,7 +143,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
uiLayout *row;
if (sfile) {
- row = uiLayoutRow(pa->layout, 0);
+ row = uiLayoutRow(pa->layout, FALSE);
uiItemO(row, IFACE_("Add"), ICON_ZOOMIN, "file.bookmark_add");
uiItemL(row, NULL, ICON_NONE);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index a4cf447686c..fb12ea8417a 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -805,19 +805,19 @@ int ED_file_extension_icon(const char *relname)
if (type == BLENDERFILE || type == BLENDERFILE_BACKUP)
return ICON_FILE_BLEND;
- else if (type == IMAGEFILE)
+ else if (type == IMAGEFILE)
return ICON_FILE_IMAGE;
- else if (type == MOVIEFILE)
+ else if (type == MOVIEFILE)
return ICON_FILE_MOVIE;
- else if (type == PYSCRIPTFILE)
+ else if (type == PYSCRIPTFILE)
return ICON_FILE_SCRIPT;
- else if (type == SOUNDFILE)
+ else if (type == SOUNDFILE)
return ICON_FILE_SOUND;
- else if (type == FTFONTFILE)
+ else if (type == FTFONTFILE)
return ICON_FILE_FONT;
- else if (type == BTXFILE)
+ else if (type == BTXFILE)
return ICON_FILE_BLANK;
- else if (type == COLLADAFILE)
+ else if (type == COLLADAFILE)
return ICON_FILE_BLANK;
return ICON_FILE_BLANK;
@@ -831,7 +831,7 @@ static void filelist_setfiletypes(struct FileList *filelist)
file = filelist->filelist;
for (num = 0; num < filelist->numfiles; num++, file++) {
- file->type = file->s.st_mode; /* restore the mess below */
+ file->type = file->s.st_mode; /* restore the mess below */
/* Don't check extensions for directories */
if (file->type & S_IFDIR) {
@@ -856,7 +856,7 @@ static void filelist_read_dir(struct FileList *filelist)
filelist->fidx = NULL;
filelist->filelist = NULL;
- BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */
+ BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */
BLI_cleanup_dir(G.main->name, filelist->dir);
filelist->numfiles = BLI_dir_contents(filelist->dir, &(filelist->filelist));
@@ -1108,7 +1108,7 @@ void filelist_from_library(struct FileList *filelist)
filelist_sort(filelist, FILE_SORT_ALPHA);
- BLI_strncpy(G.main->name, filename, sizeof(filename)); // prevent G.main->name to change
+ BLI_strncpy(G.main->name, filename, sizeof(filename)); /* prevent G.main->name to change */
filelist->filter = 0;
filelist_filter(filelist);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 79979603f54..95d5483b42c 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -356,7 +356,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
/* on first read, find active file */
if (params->active_file == -1) {
wmEvent *event = CTX_wm_window(C)->eventstate;
- file_hilight_set(sfile, ar, event->x, event->y);
+ file_highlight_set(sfile, ar, event->x, event->y);
}
file_draw_list(C, ar);
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index ddcd46ba817..efe62eaf495 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -142,19 +142,19 @@ static void graph_panel_view(const bContext *C, Panel *pa)
RNA_pointer_create(&sc->id, &RNA_SpaceGraphEditor, sipo, &spaceptr);
/* 2D-Cursor */
- col = uiLayoutColumn(pa->layout, 0);
+ col = uiLayoutColumn(pa->layout, FALSE);
uiItemR(col, &spaceptr, "show_cursor", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
uiItemO(sub, IFACE_("Cursor from Selection"), ICON_NONE, "GRAPH_OT_frame_jump");
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor"));
- row = uiLayoutSplit(sub, 0.7, 1);
+ row = uiLayoutSplit(sub, 0.7f, TRUE);
uiItemR(row, &sceneptr, "frame_current", 0, IFACE_("Cursor X"), ICON_NONE);
uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_CFRA);
- row = uiLayoutSplit(sub, 0.7, 1);
+ row = uiLayoutSplit(sub, 0.7f, TRUE);
uiItemR(row, &spaceptr, "cursor_position_y", 0, IFACE_("Cursor Y"), ICON_NONE);
uiItemEnumO(row, "GRAPH_OT_snap", IFACE_("To Keys"), 0, "type", GRAPHKEYS_SNAP_VALUE);
}
@@ -183,24 +183,24 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
/* user-friendly 'name' for F-Curve */
/* TODO: only show the path if this is invalid? */
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
icon = getname_anim_fcurve(name, ale->id, fcu);
uiItemL(col, name, icon);
/* RNA-Path Editing - only really should be enabled when things aren't working */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiLayoutSetEnabled(col, (fcu->flag & FCURVE_DISABLED) != 0);
uiItemR(col, &fcu_ptr, "data_path", 0, "", ICON_RNA);
uiItemR(col, &fcu_ptr, "array_index", 0, NULL, ICON_NONE);
/* color settings */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(col, IFACE_("Display Color:"), ICON_NONE);
- row = uiLayoutRow(col, 1);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE);
- sub = uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiLayoutSetEnabled(sub, (fcu->color_mode == FCURVE_COLOR_CUSTOM));
uiItemR(sub, &fcu_ptr, "color", 0, "", ICON_NONE);
@@ -307,7 +307,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
}
/* interpolation */
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, &bezt_ptr, "interpolation", 0, NULL, ICON_NONE);
/* numerical coordinate editing
@@ -315,7 +315,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
* and unit conversion magic that cannot be achieved using a purely RNA-approach
*/
// XXX:
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
/* keyframe itself */
{
uiItemL(col, IFACE_("Key:"), ICON_NONE);
@@ -469,7 +469,7 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
/* Target ID */
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
/* Target Property */
@@ -480,7 +480,7 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
/* get pointer for resolving the property selected */
RNA_id_pointer_create(dtar->id, &root_ptr);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
/* rna path */
uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, IFACE_("Path"));
}
@@ -501,7 +501,7 @@ static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *
RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr);
/* Bone 1 */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Bone 1:"));
if (dtar->id && ob1->pose) {
@@ -511,7 +511,7 @@ static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
}
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Bone 2:"));
if (dtar2->id && ob2->pose) {
@@ -537,7 +537,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr);
/* Bone 1 */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone 1:"));
if (dtar->id && ob1->pose) {
@@ -549,7 +549,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/Bone 2:"));
if (dtar2->id && ob2->pose) {
@@ -574,7 +574,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr);
/* properties */
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone:"));
if (dtar->id && ob->pose) {
@@ -584,7 +584,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
uiItemPointerR(col, &dtar_ptr, "bone_target", &tar_ptr, "bones", "", ICON_BONE_DATA);
}
- sub = uiLayoutColumn(layout, 1);
+ sub = uiLayoutColumn(layout, TRUE);
uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
}
@@ -612,7 +612,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
uiBlockSetHandleFunc(block, do_graph_region_driver_buttons, NULL);
/* general actions - management */
- col = uiLayoutColumn(pa->layout, 0);
+ col = uiLayoutColumn(pa->layout, FALSE);
block = uiLayoutGetBlock(col);
but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Update Dependencies"), 0, 0, 10 * UI_UNIT_X, 22,
NULL, 0.0, 0.0, 0, 0, TIP_("Force updates of dependencies"));
@@ -625,7 +625,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* driver-level settings - type, expressions, and errors */
RNA_pointer_create(ale->id, &RNA_Driver, driver, &driver_ptr);
- col = uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, TRUE);
block = uiLayoutGetBlock(col);
uiItemR(col, &driver_ptr, "type", 0, NULL, ICON_NONE);
@@ -644,13 +644,13 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
uiItemL(col, IFACE_("ERROR: invalid target channel(s)"), ICON_ERROR);
}
- col = uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, TRUE);
/* debug setting */
uiItemR(col, &driver_ptr, "show_debug_info", 0, NULL, ICON_NONE);
/* value of driver */
if (driver->flag & DRIVER_FLAG_SHOWDEBUG) {
- uiLayout *row = uiLayoutRow(col, 1);
+ uiLayout *row = uiLayoutRow(col, TRUE);
char valBuf[32];
uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
@@ -660,7 +660,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
}
/* add driver variables */
- col = uiLayoutColumn(pa->layout, 0);
+ col = uiLayoutColumn(pa->layout, FALSE);
block = uiLayoutGetBlock(col);
but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Add Variable"), 0, 0, 10 * UI_UNIT_X, UI_UNIT_Y,
NULL, 0.0, 0.0, 0, 0, TIP_("Add a new target variable for this Driver"));
@@ -672,14 +672,14 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
uiLayout *box, *row;
/* sub-layout column for this variable's settings */
- col = uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, TRUE);
/* header panel */
box = uiLayoutBox(col);
/* first row context info for driver */
RNA_pointer_create(ale->id, &RNA_DriverVariable, dvar, &dvar_ptr);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
block = uiLayoutGetBlock(row);
/* variable name */
uiItemR(row, &dvar_ptr, "name", 0, "", ICON_NONE);
@@ -692,7 +692,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
uiBlockSetEmboss(block, UI_EMBOSS);
/* variable type */
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, &dvar_ptr, "type", 0, "", ICON_NONE);
/* variable type settings */
@@ -718,7 +718,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
char valBuf[32];
box = uiLayoutBox(col);
- row = uiLayoutRow(box, 1);
+ row = uiLayoutRow(box, TRUE);
uiItemL(row, IFACE_("Value:"), ICON_NONE);
BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
@@ -760,7 +760,7 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
/* 'add modifier' button at top of panel */
{
- row = uiLayoutRow(pa->layout, 0);
+ row = uiLayoutRow(pa->layout, FALSE);
block = uiLayoutGetBlock(row);
// XXX for now, this will be a operator button which calls a 'add modifier' operator
@@ -768,14 +768,14 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
10, 0, 150, 20, TIP_("Adds a new F-Curve Modifier for the active F-Curve"));
/* copy/paste (as sub-row)*/
- row = uiLayoutRow(row, 1);
+ row = uiLayoutRow(row, TRUE);
uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_fmodifier_copy");
uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste");
}
/* draw each modifier */
for (fcm = fcu->modifiers.first; fcm; fcm = fcm->next) {
- col = uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, TRUE);
ANIM_uiTemplate_fmodifier_draw(col, ale->id, &fcu->modifiers, fcm);
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index ddca0030cf5..870e9bb8168 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -276,7 +276,7 @@ static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short
View2D *v2d = &ar->v2d;
/* only draw points if curve is visible
- * - draw unselected points before selected points as separate passes to minimise color-changing overhead
+ * - draw unselected points before selected points as separate passes to minimize color-changing overhead
* (XXX dunno if this is faster than drawing all in one pass though)
* and also to make sure in the case of overlapping points that the selected is always visible
* - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users)
@@ -851,7 +851,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
setlinestyle(2);
}
if ( ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED) ) {
- /* muted curves are drawn in a greyish hue */
+ /* muted curves are drawn in a grayish hue */
// XXX should we have some variations?
UI_ThemeColorShade(TH_HEADER, 50);
}
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 756e6997fc8..f4cb4ec3d05 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -189,6 +189,8 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
sipo->ads->source = (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now...
}
+ /* force immediate init of any invalid F-Curve colors */
+ sipo->flag |= SIPO_TEMP_NEEDCHANSYNC;
ED_area_tag_refresh(sa);
}
@@ -477,7 +479,13 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
if (wmn->data == ND_SPACE_GRAPH)
ED_area_tag_redraw(sa);
break;
-
+ case NC_WINDOW:
+ if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) {
+ /* force redraw/refresh after undo/redo - prevents "black curve" problem */
+ ED_area_tag_refresh(sa);
+ }
+ break;
+
// XXX: restore the case below if not enough updates occur...
//default:
// if (wmn->data==ND_KEYS)
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 332a2ecada4..92c339d7672 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -148,7 +148,7 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
/* the frame number, even if we cant */
if (ima->source == IMA_SRC_SEQUENCE) {
/* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
- const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0);
+ const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0, NULL);
ofs += sprintf(str + ofs, IFACE_(", Frame: %d"), framenr);
}
@@ -512,7 +512,7 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image
int wmenu1, wmenu2, wmenu3, layer;
char *strp;
- uiLayoutRow(layout, 1);
+ uiLayoutRow(layout, TRUE);
/* layer menu is 1/3 larger than pass */
wmenu1 = (2 * w) / 5;
@@ -552,7 +552,7 @@ static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr,
uiBut *but;
const float dpi_fac = UI_DPI_FAC;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
if (rr == NULL || iuser == NULL)
return;
@@ -693,13 +693,13 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
uiItemR(layout, &imaptr, "source", 0, NULL, ICON_NONE);
if (ima->source != IMA_SRC_GENERATED) {
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
if (ima->packedfile)
uiItemO(row, "", ICON_PACKAGE, "image.unpack");
else
uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
- row = uiLayoutRow(row, 0);
+ row = uiLayoutRow(row, FALSE);
uiLayoutSetEnabled(row, ima->packedfile == NULL);
uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE);
uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
@@ -733,26 +733,26 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
if (compact == 0) { /* background image view doesnt need these */
uiItemS(layout);
- split = uiLayoutSplit(layout, 0, 0);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
/* XXX Why only display fields_per_frame only for video image types?
* And why allow fields for non-video image types at all??? */
if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
- uiLayout *subsplit = uiLayoutSplit(col, 0, 0);
- uiLayout *subcol = uiLayoutColumn(subsplit, 0);
+ uiLayout *subsplit = uiLayoutSplit(col, 0.0f, FALSE);
+ uiLayout *subcol = uiLayoutColumn(subsplit, FALSE);
uiItemR(subcol, &imaptr, "use_fields", 0, NULL, ICON_NONE);
- subcol = uiLayoutColumn(subsplit, 0);
+ subcol = uiLayoutColumn(subsplit, FALSE);
uiLayoutSetActive(subcol, RNA_boolean_get(&imaptr, "use_fields"));
uiItemR(subcol, userptr, "fields_per_frame", 0, IFACE_("Fields"), ICON_NONE);
}
else
uiItemR(col, &imaptr, "use_fields", 0, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, &imaptr, "use_premultiply", 0, NULL, ICON_NONE);
uiItemR(row, &imaptr, "use_color_unpremultiply", 0, NULL, ICON_NONE);
}
@@ -761,24 +761,24 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
uiItemS(layout);
- split = uiLayoutSplit(layout, 0, 0);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
BLI_snprintf(str, sizeof(str), IFACE_("(%d) Frames"), iuser->framenr);
uiItemR(col, userptr, "frame_duration", 0, str, ICON_NONE);
uiItemR(col, userptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
uiItemR(col, userptr, "frame_offset", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiItemO(col, NULL, ICON_NONE, "IMAGE_OT_match_movie_length");
uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
}
else if (ima->source == IMA_SRC_GENERATED) {
- split = uiLayoutSplit(layout, 0, 0);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE);
uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE);
uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE);
@@ -804,12 +804,12 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
uiLayout *col, *row, *split, *sub;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
- split = uiLayoutSplit(col, 0.5f, 0);
+ split = uiLayoutSplit(col, 0.5f, FALSE);
uiItemR(split, imfptr, "file_format", 0, "", ICON_NONE);
- sub = uiLayoutRow(split, 0);
+ sub = uiLayoutRow(split, FALSE);
uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, IFACE_("Color"), ICON_NONE);
/* only display depth setting if multiple depths can be used */
@@ -821,7 +821,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
R_IMF_CHAN_DEPTH_24,
R_IMF_CHAN_DEPTH_32)) == 0)
{
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -837,7 +837,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE);
}
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
if (BKE_imtype_supports_zbuf(imf->imtype)) {
uiItemR(row, imfptr, "use_zbuffer", 0, NULL, ICON_NONE);
}
@@ -847,7 +847,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
}
if (imf->imtype == R_IMF_IMTYPE_JP2) {
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE);
uiItemR(row, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE);
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 7e67e737cc2..3dc1fbd738f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1926,6 +1926,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
if (ibuf == NULL) {
ED_space_image_release_buffer(sima, lock);
+ info->draw = 0;
return;
}
@@ -2018,8 +2019,9 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
}
#endif
}
- else
+ else {
info->draw = 0;
+ }
ED_space_image_release_buffer(sima, lock);
ED_area_tag_redraw(CTX_wm_area(C));
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 080f12bf35b..33a2d5c18c5 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -340,7 +340,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
ReportTimerInfo *rti;
float progress = 0.0, color_progress = 0.0;
float neutral_col[3] = {0.35, 0.35, 0.35};
- float neutral_grey = 0.6;
+ float neutral_gray = 0.6;
float timeout = 0.0, color_timeout = 0.0;
int send_note = 0;
@@ -385,7 +385,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
rti->col[1] = 0.45;
rti->col[2] = 0.7;
}
- rti->greyscale = 0.75;
+ rti->grayscale = 0.75;
rti->widthfac = 1.0;
}
@@ -398,7 +398,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
/* fade colors out sharply according to progress through fade-out duration */
interp_v3_v3v3(rti->col, rti->col, neutral_col, color_progress);
- rti->greyscale = interpf(neutral_grey, rti->greyscale, color_progress);
+ rti->grayscale = interpf(neutral_gray, rti->grayscale, color_progress);
}
/* collapse report at end of timeout */
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 0eec61f599e..08842698214 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3197,8 +3197,8 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
uiLayout *box, *row, *sub;
bSensor *sens= (bSensor *)ptr->data;
- box= uiLayoutBox(layout);
- row= uiLayoutRow(box, 0);
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")) {
@@ -3210,13 +3210,13 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
uiItemL(row, sens->name, ICON_NONE);
}
- sub= uiLayoutRow(row, 0);
+ sub = uiLayoutRow(row, FALSE);
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") &&
RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")==0) {
- sub= uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up
uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down
}
@@ -3228,19 +3228,19 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *box, *split, *sub, *row;
- box= uiLayoutBox(layout);
- split = uiLayoutSplit(box, 0.45, 0);
+ box = uiLayoutBox(layout);
+ split = uiLayoutSplit(box, 0.45f, FALSE);
- row= uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, ptr, "use_pulse_true_level", 0, "", ICON_DOTSUP);
uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN);
- sub=uiLayoutRow(row, 0);
+ sub = uiLayoutRow(row, FALSE);
uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level") ||
RNA_boolean_get(ptr, "use_pulse_false_level")));
uiItemR(sub, ptr, "frequency", 0, "Freq", ICON_NONE);
- row= uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, ptr, "use_level", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, ptr, "use_tap", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -3282,7 +3282,7 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, as->posechannel, &pchan_ptr))
uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
}
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "test_type", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "test_type") != SENS_ARM_STATE_CHANGED)
uiItemR(row, ptr, "value", 0, NULL, ICON_NONE);
@@ -3295,8 +3295,8 @@ static void draw_sensor_collision(uiLayout *layout, PointerRNA *ptr, bContext *C
RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
- split = uiLayoutSplit(layout, 0.3, 0);
- row = uiLayoutRow(split, 1);
+ split = uiLayoutSplit(layout, 0.3f, FALSE);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, ptr, "use_pulse", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, ptr, "use_material", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -3314,7 +3314,7 @@ static void draw_sensor_delay(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *row;
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "delay", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "duration", 0, NULL, ICON_NONE);
@@ -3332,17 +3332,17 @@ static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr)
case SENS_JOY_BUTTON:
uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == FALSE);
uiItemR(col, ptr, "button_number", 0, NULL, ICON_NONE);
break;
case SENS_JOY_AXIS:
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "axis_number", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == FALSE);
uiItemR(col, ptr, "axis_direction", 0, NULL, ICON_NONE);
break;
@@ -3350,12 +3350,12 @@ static void draw_sensor_joystick(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "hat_number", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_all_events", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_events") == FALSE);
uiItemR(col, ptr, "hat_direction", 0, NULL, ICON_NONE);
break;
case SENS_JOY_AXIS_SINGLE:
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "single_axis_number", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "axis_threshold", 0, NULL, ICON_NONE);
break;
@@ -3368,21 +3368,21 @@ static void draw_sensor_keyboard(uiLayout *layout, PointerRNA *ptr)
PointerRNA settings_ptr;
uiLayout *row, *col;
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemL(row, "Key:", ICON_NONE);
- col = uiLayoutColumn(row, 0);
+ col = uiLayoutColumn(row, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
uiItemR(col, ptr, "key", UI_ITEM_R_EVENT, "", ICON_NONE);
- col = uiLayoutColumn(row, 0);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, ptr, "use_all_keys", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_all_keys") == FALSE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemL(row, "First Modifier:", ICON_NONE);
uiItemR(row, ptr, "modifier_key_1", UI_ITEM_R_EVENT, "", ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemL(row, "Second Modifier:", ICON_NONE);
uiItemR(row, ptr, "modifier_key_2", UI_ITEM_R_EVENT, "", ICON_NONE);
@@ -3407,7 +3407,7 @@ static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "reset_distance", 0, NULL, ICON_NONE);
}
@@ -3425,7 +3425,7 @@ static void draw_sensor_property(uiLayout *layout, PointerRNA *ptr)
switch (RNA_enum_get(ptr, "evaluation_type")) {
case SENS_PROP_INTERVAL:
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "value_min", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "value_max", 0, NULL, ICON_NONE);
break;
@@ -3447,7 +3447,7 @@ static void draw_sensor_radar(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "property", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "axis", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "angle", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "distance", 0, NULL, ICON_NONE);
}
@@ -3463,7 +3463,7 @@ static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr, bContext *C)
PointerRNA main_ptr;
RNA_main_pointer_create(CTX_data_main(C), &main_ptr);
- split= uiLayoutSplit(layout, 0.3, 0);
+ split = uiLayoutSplit(layout, 0.3f, FALSE);
uiItemR(split, ptr, "ray_type", 0, "", ICON_NONE);
switch (RNA_enum_get(ptr, "ray_type")) {
case SENS_RAY_PROPERTY:
@@ -3474,9 +3474,9 @@ static void draw_sensor_ray(uiLayout *layout, PointerRNA *ptr, bContext *C)
break;
}
- split= uiLayoutSplit(layout, 0.3, 0);
+ split = uiLayoutSplit(layout, 0.3, FALSE);
uiItemR(split, ptr, "axis", 0, "", ICON_NONE);
- row= uiLayoutRow(split, 0);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "range", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "use_x_ray", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
}
@@ -3555,8 +3555,8 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
char state[3];
BLI_snprintf(state, sizeof(state), "%d", RNA_int_get(ptr, "states"));
- box= uiLayoutBox(layout);
- row= uiLayoutRow(box, 0);
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")) {
@@ -3574,7 +3574,7 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
uiItemR(row, ptr, "use_priority", 0, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")==0) {
- sub= uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up
uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down
}
@@ -3590,13 +3590,13 @@ static void draw_controller_python(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *split, *sub;
- split = uiLayoutSplit(layout, 0.3, 1);
+ split = uiLayoutSplit(layout, 0.3, TRUE);
uiItemR(split, ptr, "mode", 0, "", ICON_NONE);
if (RNA_enum_get(ptr, "mode") == CONT_PY_SCRIPT) {
uiItemR(split, ptr, "text", 0, "", ICON_NONE);
}
else {
- sub = uiLayoutSplit(split, 0.8, 0);
+ sub = uiLayoutSplit(split, 0.8f, FALSE);
uiItemR(sub, ptr, "module", 0, "", ICON_NONE);
uiItemR(sub, ptr, "use_debug", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
}
@@ -3646,8 +3646,8 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
uiLayout *box, *row, *sub;
bActuator *act= (bActuator *)ptr->data;
- box= uiLayoutBox(layout);
- row= uiLayoutRow(box, 0);
+ box = uiLayoutBox(layout);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")) {
@@ -3659,13 +3659,13 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
uiItemL(row, act->name, ICON_NONE);
}
- sub= uiLayoutRow(row, 0);
+ sub = uiLayoutRow(row, FALSE);
uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") &&
RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
if (RNA_boolean_get(ptr, "show_expanded")==0) {
- sub= uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up
uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down
}
@@ -3680,22 +3680,22 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "play_mode", 0, "", ICON_NONE);
- sub= uiLayoutRow(row, 1);
+ sub = uiLayoutRow(row, TRUE);
uiItemR(sub, ptr, "use_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(sub, ptr, "use_additive", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- row = uiLayoutColumn(sub, 0);
+ row = uiLayoutColumn(sub, FALSE);
uiLayoutSetActive(row, (RNA_boolean_get(ptr, "use_additive") || RNA_boolean_get(ptr, "use_force")));
uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "action", 0, "", ICON_NONE);
uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
if ((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
@@ -3706,11 +3706,11 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "apply_to_children", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "layer", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "layer_weight", 0, NULL, ICON_NONE);
@@ -3798,11 +3798,11 @@ static void draw_actuator_camera(uiLayout *layout, PointerRNA *ptr)
uiLayout *row;
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "height", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "axis", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "min", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "max", 0, NULL, ICON_NONE);
@@ -3821,7 +3821,7 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
case ACT_CONST_TYPE_LOC:
uiItemR(layout, ptr, "limit", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "limit_min", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "limit_max", 0, NULL, ICON_NONE);
@@ -3829,36 +3829,36 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
break;
case ACT_CONST_TYPE_DIST:
- split = uiLayoutSplit(layout, 0.8, 0);
+ split = uiLayoutSplit(layout, 0.8, FALSE);
uiItemR(split, ptr, "direction", 0, NULL, ICON_NONE);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, ptr, "use_local", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, ptr, "use_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
- col = uiLayoutColumn(row, 1);
+ row = uiLayoutRow(layout, FALSE);
+ col = uiLayoutColumn(row, TRUE);
uiItemL(col, "Range:", ICON_NONE);
uiItemR(col, ptr, "range", 0, "", ICON_NONE);
- col = uiLayoutColumn(row, 1);
+ col = uiLayoutColumn(row, TRUE);
uiItemR(col, ptr, "use_force_distance", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 0);
+ sub = uiLayoutColumn(col, FALSE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_force_distance") == TRUE);
uiItemR(sub, ptr, "distance", 0, "", ICON_NONE);
uiItemR(layout, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.15, 0);
+ split = uiLayoutSplit(layout, 0.15f, FALSE);
uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
if (RNA_boolean_get(ptr, "use_material_detect"))
uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA);
else
uiItemR(split, ptr, "property", 0, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.15, 0);
+ split = uiLayoutSplit(layout, 0.15, FALSE);
uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
break;
@@ -3866,43 +3866,43 @@ static void draw_actuator_constraint(uiLayout *layout, PointerRNA *ptr, bContext
case ACT_CONST_TYPE_ORI:
uiItemR(layout, ptr, "direction_axis_pos", 0, NULL, ICON_NONE);
- row=uiLayoutRow(layout, 1);
+ row=uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
- row=uiLayoutRow(layout, 0);
+ row=uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "rotation_max", 0, NULL, ICON_NONE);
- row=uiLayoutRow(layout, 1);
+ row=uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "angle_min", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "angle_max", 0, NULL, ICON_NONE);
break;
case ACT_CONST_TYPE_FH:
- split=uiLayoutSplit(layout, 0.75, 0);
- row= uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.75, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "fh_damping", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "fh_height", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_fh_paralel_axis", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "direction_axis", 0, NULL, ICON_NONE);
- split = uiLayoutSplit(row, 0.9, 0);
+ split = uiLayoutSplit(row, 0.9f, FALSE);
uiItemR(split, ptr, "fh_force", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_fh_normal", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.15, 0);
+ split = uiLayoutSplit(layout, 0.15, FALSE);
uiItemR(split, ptr, "use_material_detect", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
if (RNA_boolean_get(ptr, "use_material_detect"))
uiItemPointerR(split, ptr, "material", &main_ptr, "materials", NULL, ICON_MATERIAL_DATA);
else
uiItemR(split, ptr, "property", 0, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.15, 0);
+ split = uiLayoutSplit(layout, 0.15, FALSE);
uiItemR(split, ptr, "use_persistent", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- row = uiLayoutRow(split, 0);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "damping_rotation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
break;
@@ -3917,17 +3917,17 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
switch (RNA_enum_get(ptr, "mode")) {
case ACT_EDOB_ADD_OBJECT:
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "time", 0, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
break;
@@ -3938,16 +3938,16 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
break;
}
- split = uiLayoutSplit(layout, 0.6, 0);
+ split = uiLayoutSplit(layout, 0.6, FALSE);
uiItemR(split, ptr, "mesh", 0, NULL, ICON_NONE);
- row = uiLayoutRow(split, 0);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "use_replace_display_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, ptr, "use_replace_physics_mesh", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
break;
case ACT_EDOB_TRACK_TO:
- split = uiLayoutSplit(layout, 0.5, 0);
+ split = uiLayoutSplit(layout, 0.5, FALSE);
uiItemR(split, ptr, "track_object", 0, NULL, ICON_NONE);
- sub = uiLayoutSplit(split, 0.7, 0);
+ sub = uiLayoutSplit(split, 0.7f, FALSE);
uiItemR(sub, ptr, "time", 0, NULL, ICON_NONE);
uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
break;
@@ -3974,8 +3974,8 @@ static void draw_actuator_filter_2d(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "glsl_shader", 0, NULL, ICON_NONE);
break;
case ACT_2DFILTER_MOTIONBLUR:
- split=uiLayoutSplit(layout, 0.75, 1);
- row= uiLayoutRow(split, 0);
+ split=uiLayoutSplit(layout, 0.75f, TRUE);
+ row = uiLayoutRow(split, FALSE);
uiLayoutSetActive(row, RNA_boolean_get(ptr, "use_motion_blur") == TRUE);
uiItemR(row, ptr, "motion_blur_factor", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_motion_blur", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -4007,7 +4007,7 @@ static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr, bContext *C
uiItemPointerR(layout, ptr, "to_property", &main_ptr, "objects", NULL, ICON_OBJECT_DATA);
uiItemR(layout, ptr, "subject", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "body_type", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG)
@@ -4031,37 +4031,37 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
switch (RNA_enum_get(ptr, "mode")) {
case ACT_OBJECT_NORMAL:
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "offset_location", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_location", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "offset_rotation", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_rotation", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
if (ELEM3(physics_type, OB_BODY_TYPE_DYNAMIC, OB_BODY_TYPE_RIGID, OB_BODY_TYPE_SOFT)) {
uiItemL(layout, "Dynamic Object Settings:", ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "force", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_force", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "torque", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_torque", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(row, ptr, "use_add_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "angular_velocity", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_angular_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
@@ -4071,29 +4071,29 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
case ACT_OBJECT_SERVO:
uiItemR(layout, ptr, "reference_object", 0, NULL, ICON_NONE);
- split = uiLayoutSplit(layout, 0.9, 0);
- row = uiLayoutRow(split, 0);
+ split = uiLayoutSplit(layout, 0.9, FALSE);
+ row = uiLayoutRow(split, FALSE);
uiItemR(row, ptr, "linear_velocity", 0, NULL, ICON_NONE);
uiItemR(split, ptr, "use_local_linear_velocity", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
- col = uiLayoutColumn(row, 0);
+ row = uiLayoutRow(layout, FALSE);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, ptr, "use_servo_limit_x", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_x") == TRUE);
uiItemR(sub, ptr, "force_max_x", 0, NULL, ICON_NONE);
uiItemR(sub, ptr, "force_min_x", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(row, 0);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, ptr, "use_servo_limit_y", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_y") == TRUE);
uiItemR(sub, ptr, "force_max_y", 0, NULL, ICON_NONE);
uiItemR(sub, ptr, "force_min_y", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(row, 0);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, ptr, "use_servo_limit_z", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_servo_limit_z") == TRUE);
uiItemR(sub, ptr, "force_max_z", 0, NULL, ICON_NONE);
uiItemR(sub, ptr, "force_min_z", 0, NULL, ICON_NONE);
@@ -4102,7 +4102,7 @@ static void draw_actuator_motion(uiLayout *layout, PointerRNA *ptr)
//Layout designers willing to help on that, please compare with 2.49 ui
// (since the old code is going to be deleted ... soon)
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "proportional_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "integral_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "derivate_coefficient", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -4119,9 +4119,9 @@ static void draw_actuator_parent(uiLayout *layout, PointerRNA *ptr)
if (RNA_enum_get(ptr, "mode") == ACT_PARENT_SET) {
uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "use_compound", 0, NULL, ICON_NONE);
- sub= uiLayoutRow(row, 0);
+ sub = uiLayoutRow(row, FALSE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_compound") == TRUE);
uiItemR(sub, ptr, "use_ghost", 0, NULL, ICON_NONE);
}
@@ -4152,15 +4152,15 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "value", 0, NULL, ICON_NONE);
break;
case ACT_PROP_COPY:
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
if (ob_from) {
RNA_pointer_create((ID *)ob_from, &RNA_GameObjectSettings, ob_from, &obj_settings_ptr);
uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE);
}
else {
- sub= uiLayoutRow(row, 0);
- uiLayoutSetActive(sub, 0);
+ sub = uiLayoutRow(row, FALSE);
+ uiLayoutSetActive(sub, FALSE);
uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE);
}
break;
@@ -4176,15 +4176,15 @@ static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr)
ob = (Object *)ptr->id.data;
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "seed", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "distribution", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
switch (RNA_enum_get(ptr, "distribution")) {
case ACT_RANDOM_BOOL_CONST:
@@ -4261,12 +4261,12 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "mode", 0, "", ICON_NONE);
uiItemR(row, ptr, "action", 0, "", ICON_NONE);
uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
if ((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
@@ -4275,11 +4275,11 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "frame_end", 0, NULL, ICON_NONE);
}
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "frame_blend_in", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "priority", 0, NULL, ICON_NONE);
- row= uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemPointerR(row, ptr, "frame_property", &settings_ptr, "properties", NULL, ICON_NONE);
#ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
@@ -4298,28 +4298,28 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
}
uiItemR(layout, ptr, "mode", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "volume", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "pitch", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_sound_3d", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_sound_3d") == TRUE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "gain_3d_min", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "gain_3d_max", 0, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "distance_3d_reference", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "distance_3d_max", 0, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "rolloff_factor_3d", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "cone_outer_gain_3d", 0, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "cone_outer_angle_3d", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "cone_inner_angle_3d", 0, NULL, ICON_NONE);
}
@@ -4331,7 +4331,7 @@ static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr)
PointerRNA settings_ptr;
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- split = uiLayoutSplit(layout, 0.35, 0);
+ split = uiLayoutSplit(layout, 0.35, FALSE);
uiItemR(split, ptr, "operation", 0, NULL, ICON_NONE);
uiTemplateLayers(split, ptr, "states", &settings_ptr, "used_states", 0);
@@ -4340,7 +4340,7 @@ static void draw_actuator_state(uiLayout *layout, PointerRNA *ptr)
static void draw_actuator_visibility(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *row;
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "use_visible", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "use_occlusion", 0, NULL, ICON_NONE);
@@ -4356,32 +4356,32 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
uiItemR(layout, ptr, "target", 0, NULL, 0);
uiItemR(layout, ptr, "navmesh", 0, NULL, 0);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "distance", 0, NULL, 0);
uiItemR(row, ptr, "velocity", 0, NULL, 0);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "acceleration", 0, NULL, 0);
uiItemR(row, ptr, "turn_speed", 0, NULL, 0);
- row = uiLayoutRow(layout, 0);
- col = uiLayoutColumn(row, 0);
+ row = uiLayoutRow(layout, FALSE);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, ptr, "facing", 0, NULL, 0);
- col = uiLayoutColumn(row, 0);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, ptr, "facing_axis", 0, NULL, 0);
if (!RNA_boolean_get(ptr, "facing")) {
- uiLayoutSetActive(col, 0);
+ uiLayoutSetActive(col, FALSE);
}
- col = uiLayoutColumn(row, 0);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, ptr, "normal_up", 0, NULL, 0);
if (!RNA_pointer_get(ptr, "navmesh").data) {
- uiLayoutSetActive(col, 0);
+ uiLayoutSetActive(col, FALSE);
}
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "self_terminated", 0, NULL, 0);
if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) {
uiItemR(row, ptr, "update_period", 0, NULL, 0);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
}
uiItemR(row, ptr, "show_visualization", 0, NULL, 0);
}
@@ -4522,7 +4522,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
xco= 420; yco= 170; width= 300;
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiDefBlockBut(block, controller_menu, NULL, "Controllers", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
@@ -4545,32 +4545,32 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
RNA_pointer_create((ID *)ob, &RNA_GameObjectSettings, ob, &settings_ptr);
- split= uiLayoutSplit(layout, 0.05, 0);
+ split = uiLayoutSplit(layout, 0.05f, FALSE);
uiItemR(split, &settings_ptr, "show_state_panel", UI_ITEM_R_NO_BG, "", ICON_DISCLOSURE_TRI_RIGHT);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide controllers");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_controller_add", "type", "Add Controller", ICON_NONE);
if (RNA_boolean_get(&settings_ptr, "show_state_panel")) {
- box= uiLayoutBox(layout);
- split= uiLayoutSplit(box, 0.2, 0);
+ box = uiLayoutBox(layout);
+ split = uiLayoutSplit(box, 0.2f, FALSE);
- col= uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiItemL(col, "Visible", ICON_NONE);
uiItemL(col, "Initial", ICON_NONE);
- subsplit= uiLayoutSplit(split, 0.85, 0);
- col= uiLayoutColumn(subsplit, 0);
- row= uiLayoutRow(col, 0);
+ subsplit = uiLayoutSplit(split, 0.85f, FALSE);
+ col = uiLayoutColumn(subsplit, FALSE);
+ row = uiLayoutRow(col, FALSE);
uiLayoutSetActive(row, RNA_boolean_get(&settings_ptr, "use_all_states") == FALSE);
uiTemplateLayers(row, &settings_ptr, "states_visible", &settings_ptr, "used_states", 0);
- row= uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiTemplateLayers(row, &settings_ptr, "states_initial", &settings_ptr, "used_states", 0);
- col= uiLayoutColumn(subsplit, 0);
+ col = uiLayoutColumn(subsplit, FALSE);
uiItemR(col, &settings_ptr, "use_all_states", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
uiItemR(col, &settings_ptr, "show_debug_state", 0, "", ICON_NONE);
}
@@ -4589,18 +4589,18 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
continue;
/* use two nested splits to align inlinks/links properly */
- split = uiLayoutSplit(layout, 0.05, 0);
+ split = uiLayoutSplit(layout, 0.05f, FALSE);
/* put inlink button to the left */
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
- //col = uiLayoutColumn(split, 1);
+ //col = uiLayoutColumn(split, TRUE);
/* nested split for middle and right columns */
- subsplit = uiLayoutSplit(split, 0.95, 0);
+ subsplit = uiLayoutSplit(split, 0.95f, FALSE);
- col = uiLayoutColumn(subsplit, 1);
+ col = uiLayoutColumn(subsplit, TRUE);
uiLayoutSetContextPointer(col, "controller", &ptr);
/* should make UI template for controller header.. function will do for now */
@@ -4612,7 +4612,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* put link button to the right */
- col = uiLayoutColumn(subsplit, 0);
+ col = uiLayoutColumn(subsplit, FALSE);
uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
@@ -4625,7 +4625,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
xco= 10; yco= 170; width= 340;
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiDefBlockBut(block, sensor_menu, NULL, "Sensors", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
@@ -4643,7 +4643,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* only draw the sensor common header if "use_visible" */
if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiDefButBitS(block, TOG, OB_SHOWSENS, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide sensors");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_sensor_add", "type", "Add Sensor", ICON_NONE);
@@ -4667,8 +4667,8 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* make as visible, for move operator */
sens->flag |= SENS_VISIBLE;
- split = uiLayoutSplit(layout, 0.95, 0);
- col = uiLayoutColumn(split, 1);
+ split = uiLayoutSplit(layout, 0.95f, FALSE);
+ col = uiLayoutColumn(split, TRUE);
uiLayoutSetContextPointer(col, "sensor", &ptr);
/* should make UI template for sensor header.. function will do for now */
@@ -4678,7 +4678,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
draw_brick_sensor(col, &ptr, C);
/* put link button to the right */
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
/* use old-school uiButtons for links for now */
but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
@@ -4691,7 +4691,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
xco= 800; yco= 170; width= 340;
layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, xco, yco, width, 20, UI_GetStyle());
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiDefBlockBut(block, actuator_menu, NULL, "Actuators", xco-10, yco, 300, UI_UNIT_Y, ""); /* replace this with uiLayout stuff later */
@@ -4709,7 +4709,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* only draw the actuator common header if "use_visible" */
if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiDefButBitS(block, TOG, OB_SHOWACT, B_REDR, ob->id.name+2, (short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 31, 0, 0, "Object name, click to show/hide actuators");
if (ob == act_ob)
uiItemMenuEnumO(row, "LOGIC_OT_actuator_add", "type", "Add Actuator", ICON_NONE);
@@ -4734,13 +4734,13 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
/* make as visible, for move operator */
act->flag |= ACT_VISIBLE;
- split = uiLayoutSplit(layout, 0.05, 0);
+ split = uiLayoutSplit(layout, 0.05f, FALSE);
/* put inlink button to the left */
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiDefIconBut(block, INLINK, 0, ICON_INLINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, act, LINK_ACTUATOR, 0, 0, 0, "");
- col = uiLayoutColumn(split, 1);
+ col = uiLayoutColumn(split, TRUE);
uiLayoutSetContextPointer(col, "actuator", &ptr);
/* should make UI template for actuator header.. function will do for now */
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 63e518e5aaa..804d44ba720 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -252,19 +252,19 @@ static void nla_panel_animdata(const bContext *C, Panel *pa)
/* Active Action Properties ------------------------------------- */
/* action */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiTemplateID(row, (bContext *)C, &adt_ptr, "action", "ACTION_OT_new", NULL, NULL /*"ACTION_OT_unlink"*/); // XXX: need to make these operators
/* extrapolation */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &adt_ptr, "action_extrapolation", 0, NULL, ICON_NONE);
/* blending */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &adt_ptr, "action_blend_type", 0, NULL, ICON_NONE);
/* influence */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &adt_ptr, "action_influence", 0, NULL, ICON_NONE);
}
@@ -284,7 +284,7 @@ static void nla_panel_track(const bContext *C, Panel *pa)
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
/* Info - Active NLA-Context:Track ---------------------- */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &nlt_ptr, "name", 0, NULL, ICON_NLA);
}
@@ -305,12 +305,12 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
/* Strip Properties ------------------------------------- */
/* strip type */
- row = uiLayoutColumn(layout, 1);
+ row = uiLayoutColumn(layout, TRUE);
uiItemR(row, &strip_ptr, "name", 0, NULL, ICON_NLA); // XXX icon?
uiItemR(row, &strip_ptr, "type", 0, NULL, ICON_NONE);
/* strip extents */
- column = uiLayoutColumn(layout, 1);
+ column = uiLayoutColumn(layout, TRUE);
uiItemL(column, "Strip Extents:", ICON_NONE);
uiItemR(column, &strip_ptr, "frame_start", 0, NULL, ICON_NONE);
uiItemR(column, &strip_ptr, "frame_end", 0, NULL, ICON_NONE);
@@ -324,27 +324,27 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
/* only show if allowed to... */
if (showEvalProps) {
/* extrapolation */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE);
/* blending */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE);
/* blend in/out + autoblending
* - blend in/out can only be set when autoblending is off
*/
- column = uiLayoutColumn(layout, 1);
+ column = uiLayoutColumn(layout, TRUE);
uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence") == FALSE);
uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle?
- sub = uiLayoutColumn(column, 1);
+ sub = uiLayoutColumn(column, TRUE);
uiLayoutSetActive(sub, RNA_boolean_get(&strip_ptr, "use_auto_blend") == FALSE);
uiItemR(sub, &strip_ptr, "blend_in", 0, NULL, ICON_NONE);
uiItemR(sub, &strip_ptr, "blend_out", 0, NULL, ICON_NONE);
/* settings */
- column = uiLayoutColumn(layout, 1);
+ column = uiLayoutColumn(layout, TRUE);
uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time")));
uiItemL(column, "Playback Settings:", ICON_NONE);
uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE);
@@ -370,19 +370,19 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
/* Strip Properties ------------------------------------- */
/* action pointer */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &strip_ptr, "action", 0, NULL, ICON_ACTION);
/* action extents */
// XXX custom names were used here (to avoid the prefixes)... probably not necessary in future?
- column = uiLayoutColumn(layout, 1);
+ column = uiLayoutColumn(layout, TRUE);
uiItemL(column, "Action Extents:", ICON_NONE);
uiItemR(column, &strip_ptr, "action_frame_start", 0, "Start Frame", ICON_NONE);
uiItemR(column, &strip_ptr, "action_frame_end", 0, "End Frame", ICON_NONE);
uiItemO(column, NULL, ICON_NONE, "NLA_OT_action_sync_length");
/* action usage */
- column = uiLayoutColumn(layout, 1);
+ column = uiLayoutColumn(layout, TRUE);
uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_time") == FALSE);
uiItemL(column, "Playback Settings:", ICON_NONE);
uiItemR(column, &strip_ptr, "scale", 0, NULL, ICON_NONE);
@@ -404,19 +404,19 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
block = uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, &strip_ptr, "use_animated_influence", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 1);
+ sub = uiLayoutColumn(col, TRUE);
uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_influence"));
uiItemR(sub, &strip_ptr, "influence", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 1);
- sub = uiLayoutRow(col, 0);
+ col = uiLayoutColumn(layout, TRUE);
+ sub = uiLayoutRow(col, FALSE);
uiItemR(sub, &strip_ptr, "use_animated_time", 0, NULL, ICON_NONE);
uiItemR(sub, &strip_ptr, "use_animated_time_cyclic", 0, NULL, ICON_NONE);
- sub = uiLayoutRow(col, 0);
+ sub = uiLayoutRow(col, FALSE);
uiLayoutSetEnabled(sub, RNA_boolean_get(&strip_ptr, "use_animated_time"));
uiItemR(sub, &strip_ptr, "strip_time", 0, NULL, ICON_NONE);
}
@@ -440,7 +440,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
/* 'add modifier' button at top of panel */
{
- row = uiLayoutRow(pa->layout, 0);
+ row = uiLayoutRow(pa->layout, FALSE);
block = uiLayoutGetBlock(row);
// XXX for now, this will be a operator button which calls a temporary 'add modifier' operator
@@ -449,14 +449,14 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
TIP_("Adds a new F-Modifier for the active NLA Strip"));
/* copy/paste (as sub-row)*/
- row = uiLayoutRow(row, 1);
+ row = uiLayoutRow(row, TRUE);
uiItemO(row, "", ICON_COPYDOWN, "NLA_OT_fmodifier_copy");
uiItemO(row, "", ICON_PASTEDOWN, "NLA_OT_fmodifier_paste");
}
/* draw each modifier */
for (fcm = strip->modifiers.first; fcm; fcm = fcm->next) {
- col = uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, TRUE);
ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.id.data, &strip->modifiers, fcm);
}
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 7eb0f676707..92f014fd804 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -89,7 +89,7 @@ static void nla_action_get_color(AnimData *adt, bAction *act, float color[4])
UI_GetThemeColor4fv(TH_ANIM_ACTIVE, color);
}
else {
- /* greyish-red color */
+ /* grayish-red color */
UI_GetThemeColor4fv(TH_ANIM_INACTIVE, color);
}
}
@@ -217,7 +217,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc)
{
const float yheight = ymaxc - yminc;
- /* drawing color is simply a light-grey */
+ /* drawing color is simply a light-gray */
// TODO: is this color suitable?
// XXX nasty hacked color for now... which looks quite bad too...
glColor3f(0.7f, 0.7f, 0.7f);
@@ -480,7 +480,7 @@ static void nla_draw_strip_text(AnimData *adt, NlaTrack *nlt, NlaStrip *strip, i
static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float UNUSED(yminc), float ymaxc)
{
const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */
- const char col[4] = {220, 220, 220, 255}; /* light grey */
+ const char col[4] = {220, 220, 220, 255}; /* light gray */
char numstr[32] = "";
@@ -551,7 +551,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* draw each strip in the track (if visible) */
for (strip = nlt->strips.first, index = 1; strip; strip = strip->next, index++) {
if (BKE_nlastrip_within_bounds(strip, v2d->cur.xmin, v2d->cur.xmax)) {
- /* draw the visualisation of the strip */
+ /* draw the visualization of the strip */
nla_draw_strip(snla, adt, nlt, strip, v2d, yminc, ymaxc);
/* add the text for this strip to the cache */
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 1ac069c772e..daab0ce0f5f 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -140,7 +140,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v)
block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
- layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), 0);
+ layout = uiLayoutColumn(uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, args->x, args->y + 2, args->width, NODE_DY, UI_GetStyle()), FALSE);
uiItemR(layout, &args->ptr, "default_value", UI_ITEM_R_EXPAND, "", ICON_NONE);
@@ -291,7 +291,7 @@ static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr
prop = RNA_struct_find_property(ptr, "outputs");
RNA_property_collection_lookup_int(ptr, prop, 0, &sockptr);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiTemplateColorWheel(col, &sockptr, "default_value", 1, 0, 0, 0);
uiItemR(col, &sockptr, "default_value", 0, "", ICON_NONE);
}
@@ -302,7 +302,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA
bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "blend_type", 0, "", ICON_NONE);
if (ntree->type == NTREE_COMPOSIT)
uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA);
@@ -325,7 +325,7 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt
uiTemplateCurveMapping(layout, ptr, "curve", 's', 0, 0);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "frame_start", 0, IFACE_("Sta"), ICON_NONE);
uiItemR(row, ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
}
@@ -340,25 +340,30 @@ static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA
uiTemplateCurveMapping(layout, ptr, "mapping", 'v', 0, 0);
}
-static float *_sample_col = NULL; // bad bad, 2.5 will do better?
-#if 0
-static void node_curvemap_sample(float *col)
+static float _sample_col[4]; // bad bad, 2.5 will do better?
+#define SAMPLE_FLT_ISNONE FLT_MAX
+void ED_node_sample_set(const float col[4])
{
- _sample_col = col;
+ if (col) {
+ copy_v4_v4(_sample_col, col);
+ }
+ else {
+ copy_v4_fl(_sample_col, SAMPLE_FLT_ISNONE);
+ }
}
-#endif
static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
bNode *node = ptr->data;
CurveMapping *cumap = node->storage;
- if (_sample_col) {
+ if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
cumap->flag |= CUMA_DRAW_SAMPLE;
copy_v3_v3(cumap->sample, _sample_col);
}
- else
+ else {
cumap->flag &= ~CUMA_DRAW_SAMPLE;
+ }
uiTemplateCurveMapping(layout, ptr, "mapping", 'c', 0, 0);
}
@@ -1189,7 +1194,7 @@ static void node_common_set_butfunc(bNodeType *ntype)
/* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
-static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imaptr, PointerRNA *iuserptr)
+static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr)
{
uiLayout *col;
int source;
@@ -1197,7 +1202,7 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imap
if (!imaptr->data)
return;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, imaptr, "source", 0, "", ICON_NONE);
@@ -1208,25 +1213,24 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imap
Scene *scene = CTX_data_scene(C);
ImageUser *iuser = iuserptr->data;
char numstr[32];
- const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0);
+ const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0, NULL);
BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr);
uiItemL(layout, numstr, ICON_NONE);
}
if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
- col = uiLayoutColumn(layout, 1);
- uiItemR(col, iuserptr, "frame_duration", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "frame_start", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "frame_offset", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "use_cyclic", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
+ col = uiLayoutColumn(layout, TRUE);
+ uiItemR(col, ptr, "frame_duration", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "frame_start", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "frame_offset", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "use_cyclic", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
}
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
if (RNA_enum_get(imaptr, "type") == IMA_TYPE_MULTILAYER)
- uiItemR(col, iuserptr, "layer", 0, NULL, ICON_NONE);
-
+ uiItemR(col, ptr, "layer", 0, NULL, ICON_NONE);
}
static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1238,7 +1242,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA
if (!node->id) return;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "use_diffuse", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_specular", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "invert_normal", 0, NULL, ICON_NONE);
@@ -1249,22 +1253,22 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), Poin
uiLayout *row;
uiItemL(layout, IFACE_("Location:"), ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "translation", 0, "", ICON_NONE);
uiItemL(layout, IFACE_("Rotation:"), ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "rotation", 0, "", ICON_NONE);
uiItemL(layout, IFACE_("Scale:"), ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "scale", 0, "", ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "use_min", 0, "Min", ICON_NONE);
uiItemR(row, ptr, "min", 0, "", ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "use_max", 0, "Max", ICON_NONE);
uiItemR(row, ptr, "max", 0, "", ICON_NONE);
}
@@ -1279,7 +1283,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
@@ -1306,7 +1310,10 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
- node_buts_image_user(layout, C, &imaptr, &iuserptr);
+ /* note: image user properties used directly here, unlike compositor image node,
+ * which redefines them in the node struct RNA to get proper updates.
+ */
+ node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr);
}
static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1318,7 +1325,7 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
- node_buts_image_user(layout, C, &imaptr, &iuserptr);
+ node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr);
}
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -1451,7 +1458,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
imaptr = RNA_pointer_get(ptr, "image");
RNA_pointer_create((ID *)ptr->id.data, &RNA_ImageUser, node->storage, &iuserptr);
- node_buts_image_user(layout, C, &imaptr, &iuserptr);
+ node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr);
}
static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1471,8 +1478,8 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
if (!node->id) return;
- col = uiLayoutColumn(layout, 0);
- row = uiLayoutRow(col, 0);
+ col = uiLayoutColumn(layout, FALSE);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "layer", 0, "", ICON_NONE);
prop = RNA_struct_find_property(ptr, "layer");
@@ -1494,7 +1501,7 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point
{
uiLayout *col, *row;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "filter_type", 0, "", ICON_NONE);
if (RNA_enum_get(ptr, "filter_type") != R_FILTER_FAST_GAUSS) {
@@ -1506,15 +1513,15 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point
if (RNA_boolean_get(ptr, "use_relative")) {
uiItemL(col, IFACE_("Aspect Correction"), 0);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "aspect_correction", UI_ITEM_R_EXPAND, NULL, 0);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "factor_x", 0, IFACE_("X"), ICON_NONE);
uiItemR(col, ptr, "factor_y", 0, IFACE_("Y"), ICON_NONE);
}
else {
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "size_x", 0, IFACE_("X"), ICON_NONE);
uiItemR(col, ptr, "size_y", 0, IFACE_("Y"), ICON_NONE);
}
@@ -1527,14 +1534,14 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), Poin
uiItemR(layout, ptr, "iterations", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_wrap", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(col, IFACE_("Center:"), ICON_NONE);
uiItemR(col, ptr, "center_x", 0, IFACE_("X"), ICON_NONE);
uiItemR(col, ptr, "center_y", 0, IFACE_("Y"), ICON_NONE);
uiItemS(layout);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "distance", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "angle", 0, NULL, ICON_NONE);
@@ -1548,7 +1555,7 @@ static void node_composit_buts_bilateralblur(uiLayout *layout, bContext *UNUSED(
{
uiLayout *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "iterations", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "sigma_color", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "sigma_space", 0, NULL, ICON_NONE);
@@ -1558,26 +1565,26 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *UNUSED(C), Po
{
uiLayout *sub, *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemL(col, IFACE_("Bokeh Type:"), ICON_NONE);
uiItemR(col, ptr, "bokeh", 0, "", ICON_NONE);
uiItemR(col, ptr, "angle", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "use_gamma_correction", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_zbuffer") == TRUE);
uiItemR(col, ptr, "f_stop", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "blur_max", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "use_preview", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "use_zbuffer", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 0);
+ sub = uiLayoutColumn(col, FALSE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_zbuffer") == FALSE);
uiItemR(sub, ptr, "z_scale", 0, NULL, ICON_NONE);
}
@@ -1617,7 +1624,7 @@ static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), Po
{
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "tonemap_type", 0, "", ICON_NONE);
if (RNA_enum_get(ptr, "tonemap_type") == 0) {
uiItemR(col, ptr, "key", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -1636,10 +1643,10 @@ static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), P
{
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "use_projector", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(col, 0);
+ col = uiLayoutColumn(col, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_projector") == FALSE);
uiItemR(col, ptr, "use_jitter", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "use_fit", 0, NULL, ICON_NONE);
@@ -1649,11 +1656,11 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), Po
{
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "samples", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "factor", 0, IFACE_("Blur"), ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(col, IFACE_("Speed:"), ICON_NONE);
uiItemR(col, ptr, "speed_min", 0, IFACE_("Min"), ICON_NONE);
uiItemR(col, ptr, "speed_max", 0, IFACE_("Max"), ICON_NONE);
@@ -1678,7 +1685,7 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), Point
uiItemR(layout, ptr, "use_crop_size", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "relative", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
if (RNA_boolean_get(ptr, "relative")) {
uiItemR(col, ptr, "rel_min_x", 0, IFACE_("Left"), ICON_NONE);
uiItemR(col, ptr, "rel_max_x", 0, IFACE_("Right"), ICON_NONE);
@@ -1697,8 +1704,8 @@ static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C)
{
uiLayout *row, *col;
- col = uiLayoutColumn(layout, 0);
- row = uiLayoutRow(col, 0);
+ col = uiLayoutColumn(layout, FALSE);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(col, ptr, "factor", 0, NULL, ICON_NONE);
}
@@ -1707,7 +1714,7 @@ static void node_composit_buts_double_edge_mask(uiLayout *layout, bContext *UNUS
{
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemL(col, IFACE_("Inner Edge:"), ICON_NONE);
uiItemR(col, ptr, "inner_mode", 0, "", ICON_NONE);
@@ -1719,19 +1726,19 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C),
{
uiLayout *sub, *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "offset", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "size", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "use_min", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 0);
+ sub = uiLayoutColumn(col, FALSE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min"));
uiItemR(sub, ptr, "min", 0, "", ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "use_max", 0, NULL, ICON_NONE);
- sub = uiLayoutColumn(col, 0);
+ sub = uiLayoutColumn(col, FALSE);
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max"));
uiItemR(sub, ptr, "max", 0, "", ICON_NONE);
}
@@ -1740,7 +1747,7 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C),
{
uiLayout *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "use_premultiply", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "premul", 0, NULL, ICON_NONE);
}
@@ -1749,7 +1756,7 @@ static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), P
{
uiLayout *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "use_alpha", 0, NULL, ICON_NONE);
}
@@ -1758,7 +1765,7 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), Po
{
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -1768,8 +1775,13 @@ static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C)
{
uiItemR(layout, ptr, "type", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "distance", 0, NULL, ICON_NONE);
- if (RNA_enum_get(ptr, "type") == CMP_NODE_DILATEERODE_DISTANCE_THRESH) {
- uiItemR(layout, ptr, "edge", 0, NULL, ICON_NONE);
+ switch (RNA_enum_get(ptr, "type")) {
+ case CMP_NODE_DILATEERODE_DISTANCE_THRESH:
+ uiItemR(layout, ptr, "edge", 0, NULL, ICON_NONE);
+ break;
+ case CMP_NODE_DILATEERODE_DISTANCE_FEATHER:
+ uiItemR(layout, ptr, "falloff", 0, NULL, ICON_NONE);
+ break;
}
}
@@ -1777,7 +1789,7 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C),
{
uiLayout *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
@@ -1786,10 +1798,10 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED
{
uiLayout *col, *row;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(layout, IFACE_("Color Space:"), ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -1801,15 +1813,15 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
uiLayout *row, *col;
uiItemL(layout, IFACE_("Despill Channel:"), ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "limit_method") == 0) {
uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1826,11 +1838,11 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C
{
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "tolerance", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "threshold", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
/*uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); Removed for now */
uiItemR(col, ptr, "gain", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
/*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, ICON_NONE); Removed for now*/
@@ -1840,7 +1852,7 @@ static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C)
{
uiLayout *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -1851,20 +1863,20 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(
uiLayout *col, *row;
uiItemL(layout, IFACE_("Color Space:"), ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "color_space", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemL(col, IFACE_("Key Channel:"), ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "matte_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "limit_method") == 0) {
uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
}
@@ -1876,7 +1888,7 @@ static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C),
{
uiLayout *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "limit_max", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "limit_min", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
@@ -1889,7 +1901,7 @@ static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), Poi
static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "index", 0, NULL, ICON_NONE);
- uiItemR(layout, ptr, "use_smooth_mask", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE);
}
/* draw function for file output node sockets, displays only sub-path and format, no value button */
@@ -1904,7 +1916,7 @@ static void node_draw_input_file_output(const bContext *C, uiBlock *block,
RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr);
layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y + NODE_DY, width, 20, UI_GetStyle());
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
imfptr = RNA_pointer_get(&nodeptr, "format");
imtype = RNA_enum_get(&imfptr, "file_format");
@@ -1973,7 +1985,7 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
/* XXX collection lookup does not return the ID part of the pointer, setting this manually here */
active_input_ptr.id.data = ptr->id.data;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_enum_set(&op_ptr, "direction", 1);
op_ptr = uiItemFullO(row, "NODE_OT_output_file_move_active_socket", "", ICON_TRIA_DOWN, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
@@ -1982,30 +1994,30 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C
if (active_input_ptr.data) {
if (multilayer) {
uiLayout *row, *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(col, IFACE_("Layer:"), 0);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &active_input_ptr, "name", 0, "", 0);
uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
}
else {
uiLayout *row, *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(col, IFACE_("File Path:"), 0);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &active_input_ptr, "path", 0, "", 0);
uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
/* format details for individual files */
imfptr = RNA_pointer_get(&active_input_ptr, "format");
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemL(col, IFACE_("Format:"), 0);
uiItemR(col, &active_input_ptr, "use_node_format", 0, NULL, 0);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiLayoutSetActive(col, RNA_boolean_get(&active_input_ptr, "use_node_format") == FALSE);
uiTemplateImageSettings(col, &imfptr);
}
@@ -2034,7 +2046,7 @@ static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), Poi
{
uiLayout *col;
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, ptr, "invert_rgb", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "invert_alpha", 0, NULL, ICON_NONE);
}
@@ -2057,39 +2069,39 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C
if (RNA_enum_get(ptr, "correction_method") == 0) {
- split = uiLayoutSplit(layout, 0, 0);
- col = uiLayoutColumn(split, 0);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
+ col = uiLayoutColumn(split, FALSE);
uiTemplateColorWheel(col, ptr, "lift", 1, 1, 0, 1);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "lift", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiTemplateColorWheel(col, ptr, "gamma", 1, 1, 1, 1);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "gamma", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiTemplateColorWheel(col, ptr, "gain", 1, 1, 1, 1);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "gain", 0, NULL, ICON_NONE);
}
else {
- split = uiLayoutSplit(layout, 0, 0);
- col = uiLayoutColumn(split, 0);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
+ col = uiLayoutColumn(split, FALSE);
uiTemplateColorWheel(col, ptr, "offset", 1, 1, 0, 1);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "offset", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiTemplateColorWheel(col, ptr, "power", 1, 1, 0, 1);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "power", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(split, 0);
+ col = uiLayoutColumn(split, FALSE);
uiTemplateColorWheel(col, ptr, "slope", 1, 1, 0, 1);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, ptr, "slope", 0, NULL, ICON_NONE);
}
@@ -2124,6 +2136,17 @@ static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUS
static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
+ bNode *node = ptr->data;
+ CurveMapping *cumap = node->storage;
+
+ if (_sample_col[0] != SAMPLE_FLT_ISNONE) {
+ cumap->flag |= CUMA_DRAW_SAMPLE;
+ copy_v3_v3(cumap->sample, _sample_col);
+ }
+ else {
+ cumap->flag &= ~CUMA_DRAW_SAMPLE;
+ }
+
uiTemplateCurveMapping(layout, ptr, "mapping", 'h', 0, 0);
}
@@ -2170,12 +2193,12 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
{
uiLayout *row;
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "red", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "green", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemL(row, "", 0);
uiItemL(row, IFACE_("Saturation"), 0);
uiItemL(row, IFACE_("Contrast"), 0);
@@ -2183,7 +2206,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemL(row, IFACE_("Gain"), 0);
uiItemL(row, IFACE_("Lift"), 0);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemL(row, IFACE_("Master"), 0);
uiItemR(row, ptr, "master_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "master_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2191,7 +2214,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "master_gain", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "master_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemL(row, IFACE_("Highlights"), 0);
uiItemR(row, ptr, "highlights_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "highlights_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2199,7 +2222,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "highlights_gain", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "highlights_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemL(row, IFACE_("Midtones"), 0);
uiItemR(row, ptr, "midtones_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "midtones_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2207,7 +2230,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "midtones_gain", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemL(row, IFACE_("Shadows"), 0);
uiItemR(row, ptr, "shadows_saturation", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "shadows_contrast", UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2215,7 +2238,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE
uiItemR(row, ptr, "shadows_gain", UI_ITEM_R_SLIDER, "", ICON_NONE);
uiItemR(row, ptr, "shadows_lift", UI_ITEM_R_SLIDER, "", ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "midtones_start", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "midtones_end", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
@@ -2224,7 +2247,7 @@ static void node_composit_buts_colorcorrection_but(uiLayout *layout, bContext *U
{
uiLayout *row;
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "red", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "green", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "blue", 0, NULL, ICON_NONE);
@@ -2259,7 +2282,7 @@ static void node_composit_buts_colorcorrection_but(uiLayout *layout, bContext *U
uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "shadows_lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
uiItemR(row, ptr, "midtones_start", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "midtones_end", 0, NULL, ICON_NONE);
}
@@ -2273,11 +2296,11 @@ static void node_composit_buts_boxmask(uiLayout *layout, bContext *UNUSED(C), Po
{
uiLayout *row;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "x", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "y", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "height", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -2400,10 +2423,10 @@ void node_composit_backdrop_ellipsemask(SpaceNode *snode, ImBuf *backdrop, bNode
static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *row;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "x", 0, NULL, ICON_NONE);
uiItemR(row, ptr, "y", 0, NULL, ICON_NONE);
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, ptr, "width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(row, ptr, "height", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -2417,7 +2440,7 @@ static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C),
uiItemR(layout, ptr, "tile_order", 0, NULL, ICON_NONE);
if (RNA_enum_get(ptr, "tile_order") == 0) {
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "center_x", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "center_y", 0, NULL, ICON_NONE);
}
@@ -2426,7 +2449,8 @@ static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C),
static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL);
- uiItemR(layout, ptr, "smooth_mask", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "use_feather", 0, NULL, ICON_NONE);
}
@@ -2443,7 +2467,7 @@ static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, Point
RNA_pointer_create(&clip->id, &RNA_MovieTracking, &clip->tracking, &tracking_ptr);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA);
}
}
@@ -2460,6 +2484,8 @@ static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), Poi
uiItemR(layout, ptr, "clip_black", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "clip_white", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "dilate_distance", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "feather_falloff", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "feather_distance", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "blur_post", 0, NULL, ICON_NONE);
}
@@ -2672,11 +2698,11 @@ static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), Poin
{
uiLayout *col;
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "offset", 0, IFACE_("Offset"), ICON_NONE);
uiItemR(col, ptr, "offset_frequency", 0, IFACE_("Frequency"), ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
uiItemR(col, ptr, "squash", 0, IFACE_("Squash"), ICON_NONE);
uiItemR(col, ptr, "squash_frequency", 0, IFACE_("Frequency"), ICON_NONE);
}
@@ -2691,23 +2717,23 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
RNA_pointer_create(id, &RNA_Texture, tex, &tex_ptr);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
switch (tex->type) {
case TEX_BLEND:
uiItemR(col, &tex_ptr, "progression", 0, "", ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "use_flip_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
break;
case TEX_MARBLE:
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "marble_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "noise_basis", 0, "", ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "noise_basis_2", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
break;
@@ -2716,9 +2742,9 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
break;
case TEX_STUCCI:
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "stucci_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(col, &tex_ptr, "noise_basis", 0, "", ICON_NONE);
break;
@@ -2726,18 +2752,18 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
case TEX_WOOD:
uiItemR(col, &tex_ptr, "noise_basis", 0, "", ICON_NONE);
uiItemR(col, &tex_ptr, "wood_type", 0, "", ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "noise_basis_2", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiLayoutSetActive(row, !(RNA_enum_get(&tex_ptr, "wood_type") == TEX_BAND || RNA_enum_get(&tex_ptr, "wood_type") == TEX_RING));
uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
break;
case TEX_CLOUDS:
uiItemR(col, &tex_ptr, "noise_basis", 0, "", ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "cloud_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
- row = uiLayoutRow(col, 0);
+ row = uiLayoutRow(col, FALSE);
uiItemR(row, &tex_ptr, "noise_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
uiItemR(col, &tex_ptr, "noise_depth", UI_ITEM_R_EXPAND, IFACE_("Depth"), ICON_NONE);
break;
@@ -3294,40 +3320,62 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
do_triple = TRUE;
}
else {
+ int cycle = 0;
+
/* going to give issues once... */
if (link->tosock->flag & SOCK_UNAVAIL)
return;
if (link->fromsock->flag & SOCK_UNAVAIL)
return;
- /* a bit ugly... but thats how we detect the internal group links */
- if (!link->fromnode || !link->tonode) {
- UI_ThemeColorBlend(TH_BACK, TH_WIRE, 0.5f);
- do_shaded = FALSE;
- }
- else {
- /* check cyclic */
- if ((link->fromnode->level >= link->tonode->level && link->tonode->level != 0xFFF) && (link->flag & NODE_LINK_VALID)) {
- /* special indicated link, on drop-node */
- if (link->flag & NODE_LINKFLAG_HILITE) {
- th_col1 = th_col2 = TH_ACTIVE;
- }
- else {
- /* regular link */
- if (link->fromnode->flag & SELECT)
- th_col1 = TH_EDGE_SELECT;
- if (link->tonode->flag & SELECT)
- th_col2 = TH_EDGE_SELECT;
- }
- do_shaded = TRUE;
- do_triple = TRUE;
- }
+ /* check cyclic */
+ if (link->fromnode && link->tonode)
+ cycle = (link->fromnode->level < link->tonode->level || link->tonode->level == 0xFFF);
+ if (!cycle && (link->flag & NODE_LINK_VALID)) {
+ /* special indicated link, on drop-node */
+ if (link->flag & NODE_LINKFLAG_HILITE) {
+ th_col1 = th_col2 = TH_ACTIVE;
+ }
else {
- th_col1 = TH_REDALERT;
+ /* regular link */
+ if (link->fromnode && link->fromnode->flag & SELECT)
+ th_col1 = TH_EDGE_SELECT;
+ if (link->tonode && link->tonode->flag & SELECT)
+ th_col2 = TH_EDGE_SELECT;
}
+ do_shaded = TRUE;
+ do_triple = TRUE;
+ }
+ else {
+ th_col1 = TH_REDALERT;
}
}
node_draw_link_bezier(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3);
// node_draw_link_straight(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3);
}
+
+void drawnodesnap(View2D *v2d, const float cent[2], float size, NodeBorder border)
+{
+ glBegin(GL_LINES);
+
+ if (border & (NODE_LEFT | NODE_RIGHT)) {
+ glVertex2f(cent[0], v2d->cur.ymin);
+ glVertex2f(cent[0], v2d->cur.ymax);
+ }
+ else {
+ glVertex2f(cent[0], cent[1] - size);
+ glVertex2f(cent[0], cent[1] + size);
+ }
+
+ if (border & (NODE_TOP | NODE_BOTTOM)) {
+ glVertex2f(v2d->cur.xmin, cent[1]);
+ glVertex2f(v2d->cur.xmax, cent[1]);
+ }
+ else {
+ glVertex2f(cent[0] - size, cent[1]);
+ glVertex2f(cent[0] + size, cent[1]);
+ }
+
+ glEnd();
+}
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index f2ec2289ad1..bc4c391720a 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -100,7 +100,7 @@ static void active_node_panel(const bContext *C, Panel *pa)
//else
RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
- layout = uiLayoutColumn(pa->layout, 0);
+ layout = uiLayoutColumn(pa->layout, FALSE);
uiLayoutSetContextPointer(layout, "node", &ptr);
/* draw this node's name, etc. */
@@ -113,17 +113,17 @@ static void active_node_panel(const bContext *C, Panel *pa)
uiItemS(layout);
uiItemS(layout);
- row = uiLayoutRow(layout, 0);
+ row = uiLayoutRow(layout, FALSE);
- col = uiLayoutColumn(row, 1);
+ col = uiLayoutColumn(row, TRUE);
uiItemM(col, (bContext *)C, "NODE_MT_node_color_presets", NULL, 0);
uiItemR(col, &ptr, "use_custom_color", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
- sub = uiLayoutRow(col, 0);
+ sub = uiLayoutRow(col, FALSE);
if (!(node->flag & NODE_CUSTOM_COLOR))
uiLayoutSetEnabled(sub, 0);
uiItemR(sub, &ptr, "color", 0, "", 0);
- col = uiLayoutColumn(row, 1);
+ col = uiLayoutColumn(row, TRUE);
uiItemO(col, "", ICON_ZOOMIN, "node.node_color_preset_add");
opptr = uiItemFullO(col, "node.node_color_preset_add", "", ICON_ZOOMOUT, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
RNA_boolean_set(&opptr, "remove_active", 1);
@@ -164,7 +164,7 @@ static void node_sockets_panel(const bContext *C, Panel *pa)
for (sock=node->inputs.first; sock; sock=sock->next) {
BLI_snprintf(name, sizeof(name), "%s:", sock->name);
- split = uiLayoutSplit(layout, 0.35f, 0);
+ split = uiLayoutSplit(layout, 0.35f, FALSE);
uiItemL(split, name, ICON_NONE);
uiTemplateNodeLink(split, ntree, node, sock);
}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index c65bbd6e15f..65646c855b7 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -65,6 +65,7 @@
#include "ED_node.h"
#include "ED_gpencil.h"
+#include "ED_space_api.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -723,6 +724,12 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
+ if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) {
+ if (node->highlight) {
+ UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
+ node->highlight = 0;
+ }
+ }
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
@@ -804,7 +811,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
glDisable(GL_BLEND);
/* outline active and selected emphasis */
- if ( node->flag & (NODE_ACTIVE|SELECT) ) {
+ if ( node->flag & (NODE_ACTIVE|SELECT)) {
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -861,7 +868,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
node->block= NULL;
}
-static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *node)
+static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock;
rctf *rct= &node->totr;
@@ -878,10 +885,18 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
UI_ThemeColor(color_id);
if (node->flag & NODE_MUTED)
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
+
+ if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) {
+ if (node->highlight) {
+ UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
+ node->highlight = 0;
+ }
+ }
+
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
/* outline active and selected emphasis */
- if ( node->flag & (NODE_ACTIVE|SELECT) ) {
+ if ( node->flag & (NODE_ACTIVE|SELECT)) {
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -1004,7 +1019,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode)
void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
{
if (node->flag & NODE_HIDDEN)
- node_draw_hidden(C, ar, snode, node);
+ node_draw_hidden(C, ar, snode, ntree, node);
else
node_draw_basis(C, ar, snode, ntree, node);
}
@@ -1087,6 +1102,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
//uiFreeBlocksWin(&sa->uiblocks, sa->win);
+ ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+
/* only set once */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_MAP1_VERTEX_3);
@@ -1095,7 +1112,9 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)ar->winx);
// XXX snode->curfont= uiSetCurFont_ext(snode->aspect);
- UI_view2d_constant_grid_draw(v2d);
+ /* grid */
+ UI_view2d_multi_grid_draw(v2d, 25.0f, 5, 2);
+
/* backdrop */
draw_nodespace_back_pix(ar, snode, color_manage);
@@ -1137,6 +1156,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
+ ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+
/* draw grease-pencil ('canvas' strokes) */
if (snode->nodetree)
draw_gpencil_view2d(C, 1);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 81e375f26bc..9a6906c43bc 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -120,7 +120,7 @@ typedef struct CompoJob {
/* called by compo, only to check job 'stop' value */
static int compo_breakjob(void *cjv)
{
- CompoJob *cj= cjv;
+ CompoJob *cj = cjv;
return *(cj->stop);
}
@@ -128,14 +128,14 @@ static int compo_breakjob(void *cjv)
/* called by compo, wmJob sends notifier */
static void compo_redrawjob(void *cjv, char *UNUSED(str))
{
- CompoJob *cj= cjv;
+ CompoJob *cj = cjv;
*(cj->do_update) = TRUE;
}
static void compo_freejob(void *cjv)
{
- CompoJob *cj= cjv;
+ CompoJob *cj = cjv;
if (cj->localtree) {
ntreeLocalMerge(cj->localtree, cj->ntree);
@@ -147,22 +147,22 @@ static void compo_freejob(void *cjv)
* sliding buttons doesn't frustrate */
static void compo_initjob(void *cjv)
{
- CompoJob *cj= cjv;
+ CompoJob *cj = cjv;
- cj->localtree= ntreeLocalize(cj->ntree);
+ cj->localtree = ntreeLocalize(cj->ntree);
}
/* called before redraw notifiers, it moves finished previews over */
static void compo_updatejob(void *cjv)
{
- CompoJob *cj= cjv;
+ CompoJob *cj = cjv;
ntreeLocalSync(cj->localtree, cj->ntree);
}
static void compo_progressjob(void *cjv, float progress)
{
- CompoJob *cj= cjv;
+ CompoJob *cj = cjv;
*(cj->progress) = progress;
}
@@ -171,49 +171,49 @@ static void compo_progressjob(void *cjv, float progress)
/* only this runs inside thread */
static void compo_startjob(void *cjv, short *stop, short *do_update, float *progress)
{
- CompoJob *cj= cjv;
- bNodeTree *ntree= cj->localtree;
+ CompoJob *cj = cjv;
+ bNodeTree *ntree = cj->localtree;
if (cj->scene->use_nodes == FALSE)
return;
- cj->stop= stop;
- cj->do_update= do_update;
- cj->progress= progress;
-
- ntree->test_break= compo_breakjob;
- ntree->tbh= cj;
- ntree->stats_draw= compo_redrawjob;
- ntree->sdh= cj;
- ntree->progress= compo_progressjob;
- ntree->prh= cj;
+ cj->stop = stop;
+ cj->do_update = do_update;
+ cj->progress = progress;
+
+ ntree->test_break = compo_breakjob;
+ ntree->tbh = cj;
+ ntree->stats_draw = compo_redrawjob;
+ ntree->sdh = cj;
+ ntree->progress = compo_progressjob;
+ ntree->prh = cj;
// XXX BIF_store_spare();
- ntreeCompositExecTree(ntree, &cj->scene->r, 0, 1); /* 1 is do_previews */
+ ntreeCompositExecTree(ntree, &cj->scene->r, 0, 1); /* 1 is do_previews */
- ntree->test_break= NULL;
- ntree->stats_draw= NULL;
- ntree->progress= NULL;
+ ntree->test_break = NULL;
+ ntree->stats_draw = NULL;
+ ntree->progress = NULL;
}
void snode_composite_job(const bContext *C, ScrArea *sa)
{
- SpaceNode *snode= sa->spacedata.first;
+ SpaceNode *snode = sa->spacedata.first;
wmJob *steve;
CompoJob *cj;
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Compositing", WM_JOB_EXCL_RENDER|WM_JOB_PROGRESS);
- cj= MEM_callocN(sizeof(CompoJob), "compo job");
+ steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS);
+ cj = MEM_callocN(sizeof(CompoJob), "compo job");
/* customdata for preview thread */
- cj->scene= CTX_data_scene(C);
- cj->ntree= snode->nodetree;
+ cj->scene = CTX_data_scene(C);
+ cj->ntree = snode->nodetree;
/* setup job */
WM_jobs_customdata(steve, cj, compo_freejob);
- WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE|ND_COMPO_RESULT);
+ WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT);
WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
@@ -225,9 +225,9 @@ void snode_composite_job(const bContext *C, ScrArea *sa)
/* operator poll callback */
static int composite_node_active(bContext *C)
{
- if ( ED_operator_node_active(C)) {
- SpaceNode *snode= CTX_wm_space_node(C);
- if (snode->treetype==NTREE_COMPOSIT)
+ if (ED_operator_node_active(C)) {
+ SpaceNode *snode = CTX_wm_space_node(C);
+ if (snode->treetype == NTREE_COMPOSIT)
return 1;
}
return 0;
@@ -239,7 +239,7 @@ static bNode *editnode_get_active(bNodeTree *ntree)
bNode *node;
/* check for edited group */
- for (node= ntree->nodes.first; node; node= node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
if (nodeGroupEditGet(node))
break;
if (node)
@@ -255,9 +255,9 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
if (ntree == lookup)
return 1;
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
if (node->type == NODE_GROUP && node->id)
- if (has_nodetree((bNodeTree*)node->id, lookup))
+ if (has_nodetree((bNodeTree *)node->id, lookup))
return 1;
return 0;
@@ -274,8 +274,8 @@ void snode_dag_update(bContext *C, SpaceNode *snode)
Main *bmain = CTX_data_main(C);
/* for groups, update all ID's using this */
- if (snode->edittree!=snode->nodetree) {
- bNodeTreeType *tti= ntreeGetType(snode->edittree->type);
+ if (snode->edittree != snode->nodetree) {
+ bNodeTreeType *tti = ntreeGetType(snode->edittree->type);
tti->foreach_nodetree(bmain, snode->edittree, snode_dag_update_group);
}
@@ -284,14 +284,14 @@ void snode_dag_update(bContext *C, SpaceNode *snode)
void snode_notify(bContext *C, SpaceNode *snode)
{
- WM_event_add_notifier(C, NC_NODE|NA_EDITED, NULL);
+ WM_event_add_notifier(C, NC_NODE | NA_EDITED, NULL);
- if (snode->treetype==NTREE_SHADER)
- WM_event_add_notifier(C, NC_MATERIAL|ND_NODES, snode->id);
- else if (snode->treetype==NTREE_COMPOSIT)
- WM_event_add_notifier(C, NC_SCENE|ND_NODES, snode->id);
- else if (snode->treetype==NTREE_TEXTURE)
- WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, snode->id);
+ if (snode->treetype == NTREE_SHADER)
+ WM_event_add_notifier(C, NC_MATERIAL | ND_NODES, snode->id);
+ else if (snode->treetype == NTREE_COMPOSIT)
+ WM_event_add_notifier(C, NC_SCENE | ND_NODES, snode->id);
+ else if (snode->treetype == NTREE_TEXTURE)
+ WM_event_add_notifier(C, NC_TEXTURE | ND_NODES, snode->id);
}
bNode *node_tree_get_editgroup(bNodeTree *nodetree)
@@ -299,7 +299,7 @@ bNode *node_tree_get_editgroup(bNodeTree *nodetree)
bNode *gnode;
/* get the groupnode */
- for (gnode= nodetree->nodes.first; gnode; gnode= gnode->next)
+ for (gnode = nodetree->nodes.first; gnode; gnode = gnode->next)
if (nodeGroupEditGet(gnode))
break;
return gnode;
@@ -316,11 +316,11 @@ void ED_node_shader_default(Scene *scene, ID *id)
int output_type, shader_type;
float color[3], strength = 1.0f;
- ntree= ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0);
+ ntree = ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0);
switch (GS(id->name)) {
case ID_MA: {
- Material *ma= (Material*)id;
+ Material *ma = (Material *)id;
ma->nodetree = ntree;
if (BKE_scene_use_new_shading_nodes(scene)) {
@@ -333,22 +333,22 @@ void ED_node_shader_default(Scene *scene, ID *id)
}
copy_v3_v3(color, &ma->r);
- strength= 0.0f;
+ strength = 0.0f;
break;
}
case ID_WO: {
- World *wo= (World*)id;
+ World *wo = (World *)id;
wo->nodetree = ntree;
output_type = SH_NODE_OUTPUT_WORLD;
shader_type = SH_NODE_BACKGROUND;
copy_v3_v3(color, &wo->horr);
- strength= 1.0f;
+ strength = 1.0f;
break;
}
case ID_LA: {
- Lamp *la= (Lamp*)id;
+ Lamp *la = (Lamp *)id;
la->nodetree = ntree;
output_type = SH_NODE_OUTPUT_LAMP;
@@ -356,9 +356,9 @@ void ED_node_shader_default(Scene *scene, ID *id)
copy_v3_v3(color, &la->r);
if (la->type == LA_LOCAL || la->type == LA_SPOT || la->type == LA_AREA)
- strength= 100.0f;
+ strength = 100.0f;
else
- strength= 1.0f;
+ strength = 1.0f;
break;
}
default:
@@ -367,27 +367,27 @@ void ED_node_shader_default(Scene *scene, ID *id)
}
ntemp.type = output_type;
- out= nodeAddNode(ntree, &ntemp);
- out->locx= 300.0f; out->locy= 300.0f;
+ out = nodeAddNode(ntree, &ntemp);
+ out->locx = 300.0f; out->locy = 300.0f;
ntemp.type = shader_type;
- in= nodeAddNode(ntree, &ntemp);
- in->locx= 10.0f; in->locy= 300.0f;
+ in = nodeAddNode(ntree, &ntemp);
+ in->locx = 10.0f; in->locy = 300.0f;
nodeSetActive(ntree, in);
/* only a link from color to color */
- fromsock= in->outputs.first;
- tosock= out->inputs.first;
+ fromsock = in->outputs.first;
+ tosock = out->inputs.first;
nodeAddLink(ntree, in, fromsock, out, tosock);
/* default values */
if (BKE_scene_use_new_shading_nodes(scene)) {
- sock= in->inputs.first;
- copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, color);
+ sock = in->inputs.first;
+ copy_v3_v3(((bNodeSocketValueRGBA *)sock->default_value)->value, color);
if (strength != 0.0f) {
- sock= in->inputs.last;
- ((bNodeSocketValueFloat*)sock->default_value)->value= strength;
+ sock = in->inputs.last;
+ ((bNodeSocketValueFloat *)sock->default_value)->value = strength;
}
}
@@ -409,28 +409,28 @@ void ED_node_composit_default(Scene *sce)
return;
}
- sce->nodetree= ntreeAddTree("Compositing Nodetree", NTREE_COMPOSIT, 0);
+ sce->nodetree = ntreeAddTree("Compositing Nodetree", NTREE_COMPOSIT, 0);
sce->nodetree->chunksize = 256;
sce->nodetree->edit_quality = NTREE_QUALITY_HIGH;
sce->nodetree->render_quality = NTREE_QUALITY_HIGH;
ntemp.type = CMP_NODE_COMPOSITE;
- out= nodeAddNode(sce->nodetree, &ntemp);
- out->locx= 300.0f; out->locy= 400.0f;
- out->id= &sce->id;
+ out = nodeAddNode(sce->nodetree, &ntemp);
+ out->locx = 300.0f; out->locy = 400.0f;
+ out->id = &sce->id;
id_us_plus(out->id);
ntemp.type = CMP_NODE_R_LAYERS;
- in= nodeAddNode(sce->nodetree, &ntemp);
- in->locx= 10.0f; in->locy= 400.0f;
- in->id= &sce->id;
+ in = nodeAddNode(sce->nodetree, &ntemp);
+ in->locx = 10.0f; in->locy = 400.0f;
+ in->id = &sce->id;
id_us_plus(in->id);
nodeSetActive(sce->nodetree, in);
/* links from color to color */
- fromsock= in->outputs.first;
- tosock= out->inputs.first;
+ fromsock = in->outputs.first;
+ tosock = out->inputs.first;
nodeAddLink(sce->nodetree, in, fromsock, out, tosock);
ntreeUpdateTree(sce->nodetree);
@@ -453,19 +453,19 @@ void ED_node_texture_default(Tex *tx)
return;
}
- tx->nodetree= ntreeAddTree("Texture Nodetree", NTREE_TEXTURE, 0);
+ tx->nodetree = ntreeAddTree("Texture Nodetree", NTREE_TEXTURE, 0);
ntemp.type = TEX_NODE_OUTPUT;
- out= nodeAddNode(tx->nodetree, &ntemp);
- out->locx= 300.0f; out->locy= 300.0f;
+ out = nodeAddNode(tx->nodetree, &ntemp);
+ out->locx = 300.0f; out->locy = 300.0f;
ntemp.type = TEX_NODE_CHECKER;
- in= nodeAddNode(tx->nodetree, &ntemp);
- in->locx= 10.0f; in->locy= 300.0f;
+ in = nodeAddNode(tx->nodetree, &ntemp);
+ in->locx = 10.0f; in->locy = 300.0f;
nodeSetActive(tx->nodetree, in);
- fromsock= in->outputs.first;
- tosock= out->inputs.first;
+ fromsock = in->outputs.first;
+ tosock = out->inputs.first;
nodeAddLink(tx->nodetree, in, fromsock, out, tosock);
ntreeUpdateTree(tx->nodetree);
@@ -475,128 +475,128 @@ void ED_node_texture_default(Tex *tx)
void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype)
{
if (id) {
- bNode *node= NULL;
- short idtype= GS(id->name);
+ bNode *node = NULL;
+ short idtype = GS(id->name);
if (idtype == ID_NT) {
- *ntree= (bNodeTree*)id;
- if (treetype) *treetype= (*ntree)->type;
+ *ntree = (bNodeTree *)id;
+ if (treetype) *treetype = (*ntree)->type;
}
else if (idtype == ID_MA) {
- *ntree= ((Material*)id)->nodetree;
- if (treetype) *treetype= NTREE_SHADER;
+ *ntree = ((Material *)id)->nodetree;
+ if (treetype) *treetype = NTREE_SHADER;
}
else if (idtype == ID_LA) {
- *ntree= ((Lamp*)id)->nodetree;
- if (treetype) *treetype= NTREE_SHADER;
+ *ntree = ((Lamp *)id)->nodetree;
+ if (treetype) *treetype = NTREE_SHADER;
}
else if (idtype == ID_WO) {
- *ntree= ((World*)id)->nodetree;
- if (treetype) *treetype= NTREE_SHADER;
+ *ntree = ((World *)id)->nodetree;
+ if (treetype) *treetype = NTREE_SHADER;
}
else if (idtype == ID_SCE) {
- *ntree= ((Scene*)id)->nodetree;
- if (treetype) *treetype= NTREE_COMPOSIT;
+ *ntree = ((Scene *)id)->nodetree;
+ if (treetype) *treetype = NTREE_COMPOSIT;
}
else if (idtype == ID_TE) {
- *ntree= ((Tex*)id)->nodetree;
- if (treetype) *treetype= NTREE_TEXTURE;
+ *ntree = ((Tex *)id)->nodetree;
+ if (treetype) *treetype = NTREE_TEXTURE;
}
else {
- if (treetype) *treetype= 0;
+ if (treetype) *treetype = 0;
return;
}
/* find editable group */
if (edittree) {
if (*ntree)
- for (node= (*ntree)->nodes.first; node; node= node->next)
+ for (node = (*ntree)->nodes.first; node; node = node->next)
if (nodeGroupEditGet(node))
break;
if (node && node->id)
- *edittree= (bNodeTree *)node->id;
+ *edittree = (bNodeTree *)node->id;
else
- *edittree= *ntree;
+ *edittree = *ntree;
}
}
else {
- *ntree= NULL;
- *edittree= NULL;
- if (treetype) *treetype= 0;
+ *ntree = NULL;
+ *edittree = NULL;
+ if (treetype) *treetype = 0;
}
}
/* Here we set the active tree(s), even called for each redraw now, so keep it fast :) */
void snode_set_context(SpaceNode *snode, Scene *scene)
{
- Object *ob= OBACT;
+ Object *ob = OBACT;
- snode->id= snode->from= NULL;
+ snode->id = snode->from = NULL;
- if (snode->treetype==NTREE_SHADER) {
+ if (snode->treetype == NTREE_SHADER) {
/* need active object, or we allow pinning... */
if (snode->shaderfrom == SNODE_SHADER_OBJECT) {
if (ob) {
if (ob->type == OB_LAMP) {
- snode->from= &ob->id;
- snode->id= ob->data;
+ snode->from = &ob->id;
+ snode->id = ob->data;
}
else {
- Material *ma= give_current_material(ob, ob->actcol);
+ Material *ma = give_current_material(ob, ob->actcol);
if (ma) {
- snode->from= &ob->id;
- snode->id= &ma->id;
+ snode->from = &ob->id;
+ snode->id = &ma->id;
}
}
}
}
else { /* SNODE_SHADER_WORLD */
if (scene->world) {
- snode->from= NULL;
- snode->id= &scene->world->id;
+ snode->from = NULL;
+ snode->id = &scene->world->id;
}
}
}
- else if (snode->treetype==NTREE_COMPOSIT) {
- snode->id= &scene->id;
+ else if (snode->treetype == NTREE_COMPOSIT) {
+ snode->id = &scene->id;
/* update output sockets based on available layers */
ntreeCompositForceHidden(scene->nodetree, scene);
}
- else if (snode->treetype==NTREE_TEXTURE) {
- Tex *tx= NULL;
+ else if (snode->treetype == NTREE_TEXTURE) {
+ Tex *tx = NULL;
- if (snode->texfrom==SNODE_TEX_OBJECT) {
+ if (snode->texfrom == SNODE_TEX_OBJECT) {
if (ob) {
- tx= give_current_object_texture(ob);
+ tx = give_current_object_texture(ob);
if (ob->type == OB_LAMP)
- snode->from= (ID*)ob->data;
+ snode->from = (ID *)ob->data;
else
- snode->from= (ID*)give_current_material(ob, ob->actcol);
+ snode->from = (ID *)give_current_material(ob, ob->actcol);
/* from is not set fully for material nodes, should be ID + Node then */
- snode->id= &tx->id;
+ snode->id = &tx->id;
}
}
- else if (snode->texfrom==SNODE_TEX_WORLD) {
- tx= give_current_world_texture(scene->world);
- snode->from= (ID *)scene->world;
- snode->id= &tx->id;
+ else if (snode->texfrom == SNODE_TEX_WORLD) {
+ tx = give_current_world_texture(scene->world);
+ snode->from = (ID *)scene->world;
+ snode->id = &tx->id;
}
else {
- struct Brush *brush= NULL;
+ struct Brush *brush = NULL;
if (ob && (ob->mode & OB_MODE_SCULPT))
- brush= paint_brush(&scene->toolsettings->sculpt->paint);
+ brush = paint_brush(&scene->toolsettings->sculpt->paint);
else
- brush= paint_brush(&scene->toolsettings->imapaint.paint);
+ brush = paint_brush(&scene->toolsettings->imapaint.paint);
if (brush) {
- snode->from= (ID *)brush;
- tx= give_current_brush_texture(brush);
- snode->id= &tx->id;
+ snode->from = (ID *)brush;
+ tx = give_current_brush_texture(brush);
+ snode->id = &tx->id;
}
}
}
@@ -618,7 +618,7 @@ static void snode_update(SpaceNode *snode, bNode *node)
nodeUpdate(snode->edittree, node);
/* if inside group, tag entire group */
- gnode= node_tree_get_editgroup(snode->nodetree);
+ gnode = node_tree_get_editgroup(snode->nodetree);
if (gnode)
nodeUpdateID(snode->nodetree, gnode->id);
}
@@ -629,24 +629,24 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
nodeSetActive(ntree, node);
- if (node->type!=NODE_GROUP) {
- int was_output= (node->flag & NODE_DO_OUTPUT);
+ if (node->type != NODE_GROUP) {
+ int was_output = (node->flag & NODE_DO_OUTPUT);
/* tree specific activate calls */
- if (ntree->type==NTREE_SHADER) {
+ if (ntree->type == NTREE_SHADER) {
/* when we select a material, active texture is cleared, for buttons */
if (node->id && ELEM3(GS(node->id->name), ID_MA, ID_LA, ID_WO))
nodeClearActiveID(ntree, ID_TE);
- if (node->type==SH_NODE_OUTPUT) {
+ if (node->type == SH_NODE_OUTPUT) {
bNode *tnode;
- for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
- if ( tnode->type==SH_NODE_OUTPUT)
+ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next)
+ if (tnode->type == SH_NODE_OUTPUT)
tnode->flag &= ~NODE_DO_OUTPUT;
node->flag |= NODE_DO_OUTPUT;
- if (was_output==0)
+ if (was_output == 0)
ED_node_generic_update(bmain, ntree, node);
}
@@ -654,49 +654,49 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
Material *ma;
- for (ma=bmain->mat.first; ma; ma=ma->id.next)
+ for (ma = bmain->mat.first; ma; ma = ma->id.next)
if (ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree))
GPU_material_free(ma);
WM_main_add_notifier(NC_IMAGE, NULL);
}
- WM_main_add_notifier(NC_MATERIAL|ND_NODES, node->id);
+ WM_main_add_notifier(NC_MATERIAL | ND_NODES, node->id);
}
- else if (ntree->type==NTREE_COMPOSIT) {
+ else if (ntree->type == NTREE_COMPOSIT) {
/* make active viewer, currently only 1 supported... */
- if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
bNode *tnode;
- for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
- if ( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next)
+ if (ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
tnode->flag &= ~NODE_DO_OUTPUT;
node->flag |= NODE_DO_OUTPUT;
- if (was_output==0)
+ if (was_output == 0)
ED_node_generic_update(bmain, ntree, node);
/* addnode() doesnt link this yet... */
- node->id= (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
+ node->id = (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
}
- else if (node->type==CMP_NODE_R_LAYERS) {
+ else if (node->type == CMP_NODE_R_LAYERS) {
Scene *scene;
- for (scene=bmain->scene.first; scene; scene=scene->id.next) {
+ for (scene = bmain->scene.first; scene; scene = scene->id.next) {
if (scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) {
- if (node->id==NULL || node->id==(ID *)scene) {
- scene->r.actlay= node->custom1;
+ if (node->id == NULL || node->id == (ID *)scene) {
+ scene->r.actlay = node->custom1;
}
}
}
}
- else if (node->type==CMP_NODE_COMPOSITE) {
- if (was_output==0) {
+ else if (node->type == CMP_NODE_COMPOSITE) {
+ if (was_output == 0) {
bNode *tnode;
- for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
- if ( tnode->type==CMP_NODE_COMPOSITE)
+ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next)
+ if (tnode->type == CMP_NODE_COMPOSITE)
tnode->flag &= ~NODE_DO_OUTPUT;
node->flag |= NODE_DO_OUTPUT;
@@ -704,11 +704,11 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
}
}
}
- else if (ntree->type==NTREE_TEXTURE) {
+ else if (ntree->type == NTREE_TEXTURE) {
// XXX
#if 0
if (node->id)
- ; // XXX BIF_preview_changed(-1);
+ ; // XXX BIF_preview_changed(-1);
// allqueue(REDRAWBUTSSHADING, 1);
// allqueue(REDRAWIPO, 0);
#endif
@@ -745,7 +745,7 @@ static void edit_node_properties(wmOperatorType *ot)
static int edit_node_invoke_properties(bContext *C, wmOperator *op)
{
if (!RNA_struct_property_is_set(op->ptr, "node")) {
- bNode *node= CTX_data_pointer_get_type(C, "node", &RNA_Node).data;
+ bNode *node = CTX_data_pointer_get_type(C, "node", &RNA_Node).data;
if (!node)
return 0;
else
@@ -764,7 +764,7 @@ static int edit_node_invoke_properties(bContext *C, wmOperator *op)
static void edit_node_properties_get(wmOperator *op, bNodeTree *ntree, bNode **rnode, bNodeSocket **rsock, int *rin_out)
{
bNode *node;
- bNodeSocket *sock=NULL;
+ bNodeSocket *sock = NULL;
char nodename[MAX_NAME];
int sockindex;
int in_out;
@@ -776,8 +776,8 @@ static void edit_node_properties_get(wmOperator *op, bNodeTree *ntree, bNode **r
sockindex = RNA_int_get(op->ptr, "socket");
switch (in_out) {
- case SOCK_IN: sock = BLI_findlink(&node->inputs, sockindex); break;
- case SOCK_OUT: sock = BLI_findlink(&node->outputs, sockindex); break;
+ case SOCK_IN: sock = BLI_findlink(&node->inputs, sockindex); break;
+ case SOCK_OUT: sock = BLI_findlink(&node->outputs, sockindex); break;
}
if (rnode)
@@ -796,25 +796,25 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
bNode *node;
/* make sure nothing has group editing on */
- for (node=snode->nodetree->nodes.first; node; node=node->next)
+ for (node = snode->nodetree->nodes.first; node; node = node->next)
nodeGroupEditClear(node);
- if (gnode==NULL) {
+ if (gnode == NULL) {
/* with NULL argument we do a toggle */
- if (snode->edittree==snode->nodetree)
- gnode= nodeGetActive(snode->nodetree);
+ if (snode->edittree == snode->nodetree)
+ gnode = nodeGetActive(snode->nodetree);
}
if (gnode) {
snode->edittree = nodeGroupEditSet(gnode, 1);
/* deselect all other nodes, so we can also do grabbing of entire subtree */
- for (node= snode->nodetree->nodes.first; node; node= node->next)
+ for (node = snode->nodetree->nodes.first; node; node = node->next)
node_deselect(node);
node_select(gnode);
}
else
- snode->edittree= snode->nodetree;
+ snode->edittree = snode->nodetree;
}
static int node_group_edit_exec(bContext *C, wmOperator *UNUSED(op))
@@ -823,14 +823,14 @@ static int node_group_edit_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(C);
- if (snode->nodetree==snode->edittree) {
+ if (snode->nodetree == snode->edittree) {
bNode *gnode = nodeGetActive(snode->edittree);
snode_make_group_editable(snode, gnode);
}
else
snode_make_group_editable(snode, NULL);
- WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_NODES, NULL);
return OPERATOR_FINISHED;
}
@@ -841,9 +841,9 @@ static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
bNode *gnode;
/* XXX callback? */
- if (snode->nodetree==snode->edittree) {
+ if (snode->nodetree == snode->edittree) {
gnode = nodeGetActive(snode->edittree);
- if (gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
+ if (gnode && gnode->id && GS(gnode->id->name) == ID_NT && gnode->id->lib) {
uiPupMenuOkee(C, op->type->idname, "Make group local?");
return OPERATOR_CANCELLED;
}
@@ -865,7 +865,7 @@ void NODE_OT_group_edit(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ***************** Add Group Socket operator ************* */
@@ -873,10 +873,10 @@ void NODE_OT_group_edit(wmOperatorType *ot)
static int node_group_socket_add_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- int in_out= -1;
- char name[MAX_NAME]= "";
- int type= SOCK_FLOAT;
- bNodeTree *ngroup= snode->edittree;
+ int in_out = -1;
+ char name[MAX_NAME] = "";
+ int type = SOCK_FLOAT;
+ bNodeTree *ngroup = snode->edittree;
/* bNodeSocket *sock; */ /* UNUSED */
ED_preview_kill_jobs(C);
@@ -914,7 +914,7 @@ void NODE_OT_group_socket_add(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Type", "Input or Output");
RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Group socket name");
@@ -926,9 +926,9 @@ void NODE_OT_group_socket_add(wmOperatorType *ot)
static int node_group_socket_remove_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- int index= -1;
- int in_out= -1;
- bNodeTree *ngroup= snode->edittree;
+ int index = -1;
+ int in_out = -1;
+ bNodeTree *ngroup = snode->edittree;
bNodeSocket *sock;
ED_preview_kill_jobs(C);
@@ -943,7 +943,7 @@ static int node_group_socket_remove_exec(bContext *C, wmOperator *op)
else
return OPERATOR_CANCELLED;
- sock = (bNodeSocket*)BLI_findlink(in_out==SOCK_IN ? &ngroup->inputs : &ngroup->outputs, index);
+ sock = (bNodeSocket *)BLI_findlink(in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs, index);
if (sock) {
node_group_remove_socket(ngroup, sock, in_out);
ntreeUpdateTree(ngroup);
@@ -966,7 +966,7 @@ void NODE_OT_group_socket_remove(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Type", "Input or Output");
@@ -977,9 +977,9 @@ void NODE_OT_group_socket_remove(wmOperatorType *ot)
static int node_group_socket_move_up_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- int index= -1;
- int in_out= -1;
- bNodeTree *ngroup= snode->edittree;
+ int index = -1;
+ int in_out = -1;
+ bNodeTree *ngroup = snode->edittree;
bNodeSocket *sock, *prev;
ED_preview_kill_jobs(C);
@@ -995,8 +995,8 @@ static int node_group_socket_move_up_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* swap */
- if (in_out==SOCK_IN) {
- sock = (bNodeSocket*)BLI_findlink(&ngroup->inputs, index);
+ if (in_out == SOCK_IN) {
+ sock = (bNodeSocket *)BLI_findlink(&ngroup->inputs, index);
prev = sock->prev;
/* can't move up the first socket */
if (!prev)
@@ -1006,8 +1006,8 @@ static int node_group_socket_move_up_exec(bContext *C, wmOperator *op)
ngroup->update |= NTREE_UPDATE_GROUP_IN;
}
- else if (in_out==SOCK_OUT) {
- sock = (bNodeSocket*)BLI_findlink(&ngroup->outputs, index);
+ else if (in_out == SOCK_OUT) {
+ sock = (bNodeSocket *)BLI_findlink(&ngroup->outputs, index);
prev = sock->prev;
/* can't move up the first socket */
if (!prev)
@@ -1036,7 +1036,7 @@ void NODE_OT_group_socket_move_up(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Type", "Input or Output");
@@ -1047,9 +1047,9 @@ void NODE_OT_group_socket_move_up(wmOperatorType *ot)
static int node_group_socket_move_down_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
- int index= -1;
- int in_out= -1;
- bNodeTree *ngroup= snode->edittree;
+ int index = -1;
+ int in_out = -1;
+ bNodeTree *ngroup = snode->edittree;
bNodeSocket *sock, *next;
ED_preview_kill_jobs(C);
@@ -1065,8 +1065,8 @@ static int node_group_socket_move_down_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* swap */
- if (in_out==SOCK_IN) {
- sock = (bNodeSocket*)BLI_findlink(&ngroup->inputs, index);
+ if (in_out == SOCK_IN) {
+ sock = (bNodeSocket *)BLI_findlink(&ngroup->inputs, index);
next = sock->next;
/* can't move down the last socket */
if (!next)
@@ -1076,8 +1076,8 @@ static int node_group_socket_move_down_exec(bContext *C, wmOperator *op)
ngroup->update |= NTREE_UPDATE_GROUP_IN;
}
- else if (in_out==SOCK_OUT) {
- sock = (bNodeSocket*)BLI_findlink(&ngroup->outputs, index);
+ else if (in_out == SOCK_OUT) {
+ sock = (bNodeSocket *)BLI_findlink(&ngroup->outputs, index);
next = sock->next;
/* can't move down the last socket */
if (!next)
@@ -1106,7 +1106,7 @@ void NODE_OT_group_socket_move_down(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Type", "Input or Output");
@@ -1122,22 +1122,22 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
bNodeTree *ngroup, *wgroup;
ListBase anim_basepaths = {NULL, NULL};
- ngroup= (bNodeTree *)gnode->id;
- if (ngroup==NULL) return 0;
+ ngroup = (bNodeTree *)gnode->id;
+ if (ngroup == NULL) return 0;
/* clear new pointers, set in copytree */
- for (node= ntree->nodes.first; node; node= node->next)
- node->new_node= NULL;
+ for (node = ntree->nodes.first; node; node = node->next)
+ node->new_node = NULL;
/* wgroup is a temporary copy of the NodeTree we're merging in
* - all of wgroup's nodes are transferred across to their new home
* - ngroup (i.e. the source NodeTree) is left unscathed
*/
- wgroup= ntreeCopyTree(ngroup);
+ wgroup = ntreeCopyTree(ngroup);
/* add the nodes into the ntree */
- for (node= wgroup->nodes.first; node; node= nextn) {
- nextn= node->next;
+ for (node = wgroup->nodes.first; node; node = nextn) {
+ nextn = node->next;
/* keep track of this node's RNA "base" path (the part of the path identifying the node)
* if the old nodetree has animation data which potentially covers this node
@@ -1164,10 +1164,10 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
}
/* restore external links to and from the gnode */
- for (link= ntree->links.first; link; link= link->next) {
- if (link->fromnode==gnode) {
+ for (link = ntree->links.first; link; link = link->next) {
+ if (link->fromnode == gnode) {
if (link->fromsock->groupsock) {
- bNodeSocket *gsock= link->fromsock->groupsock;
+ bNodeSocket *gsock = link->fromsock->groupsock;
if (gsock->link) {
if (gsock->link->fromnode) {
/* NB: using the new internal copies here! the groupsock pointer still maps to the old tree */
@@ -1176,7 +1176,7 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
}
else {
/* group output directly maps to group input */
- bNodeSocket *insock= node_group_find_input(gnode, gsock->link->fromsock);
+ bNodeSocket *insock = node_group_find_input(gnode, gsock->link->fromsock);
if (insock->link) {
link->fromnode = insock->link->fromnode;
link->fromsock = insock->link->fromsock;
@@ -1191,20 +1191,20 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
}
}
/* remove internal output links, these are not used anymore */
- for (link=wgroup->links.first; link; link= linkn) {
+ for (link = wgroup->links.first; link; link = linkn) {
linkn = link->next;
if (!link->tonode)
nodeRemLink(wgroup, link);
}
/* restore links from internal nodes */
- for (link= wgroup->links.first; link; link= link->next) {
+ for (link = wgroup->links.first; link; link = link->next) {
/* indicates link to group input */
if (!link->fromnode) {
/* NB: can't use find_group_node_input here,
* because gnode sockets still point to the old tree!
*/
bNodeSocket *insock;
- for (insock= gnode->inputs.first; insock; insock= insock->next)
+ for (insock = gnode->inputs.first; insock; insock = insock->next)
if (insock->groupsock->new_sock == link->fromsock)
break;
if (insock->link) {
@@ -1220,8 +1220,8 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
}
/* add internal links to the ntree */
- for (link= wgroup->links.first; link; link= linkn) {
- linkn= link->next;
+ for (link = wgroup->links.first; link; link = linkn) {
+ linkn = link->next;
BLI_remlink(&wgroup->links, link);
BLI_addtail(&ntree->links, link);
}
@@ -1229,7 +1229,7 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
/* and copy across the animation,
* note that the animation data's action can be NULL here */
if (wgroup->adt) {
- LinkData *ld, *ldn=NULL;
+ LinkData *ld, *ldn = NULL;
bAction *waction;
/* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */
@@ -1271,15 +1271,15 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op)
ED_preview_kill_jobs(C);
/* are we inside of a group? */
- gnode= node_tree_get_editgroup(snode->nodetree);
+ gnode = node_tree_get_editgroup(snode->nodetree);
if (gnode)
snode_make_group_editable(snode, NULL);
- gnode= nodeGetActive(snode->edittree);
- if (gnode==NULL)
+ gnode = nodeGetActive(snode->edittree);
+ if (gnode == NULL)
return OPERATOR_CANCELLED;
- if (gnode->type!=NODE_GROUP) {
+ if (gnode->type != NODE_GROUP) {
BKE_report(op->reports, RPT_WARNING, "Not a group");
return OPERATOR_CANCELLED;
}
@@ -1309,7 +1309,7 @@ void NODE_OT_group_ungroup(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ******************** Separate operator ********************** */
@@ -1322,19 +1322,19 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
bNodeTree *ngroup;
ListBase anim_basepaths = {NULL, NULL};
- ngroup= (bNodeTree *)gnode->id;
- if (ngroup==NULL) return 0;
+ ngroup = (bNodeTree *)gnode->id;
+ if (ngroup == NULL) return 0;
/* deselect all nodes in the target tree */
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
node_deselect(node);
/* clear new pointers, set in nodeCopyNode */
- for (node= ngroup->nodes.first; node; node= node->next)
- node->new_node= NULL;
+ for (node = ngroup->nodes.first; node; node = node->next)
+ node->new_node = NULL;
/* add selected nodes into the ntree */
- for (node= ngroup->nodes.first; node; node= node_next) {
+ for (node = ngroup->nodes.first; node; node = node_next) {
node_next = node->next;
if (!(node->flag & NODE_SELECT))
continue;
@@ -1375,7 +1375,7 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
}
/* add internal links to the ntree */
- for (link= ngroup->links.first; link; link= link_next) {
+ for (link = ngroup->links.first; link; link = link_next) {
int fromselect = (link->fromnode && (link->fromnode->flag & NODE_SELECT));
int toselect = (link->tonode && (link->tonode->flag & NODE_SELECT));
link_next = link->next;
@@ -1400,7 +1400,7 @@ static int node_group_separate_selected(bNodeTree *ntree, bNode *gnode, int make
/* and copy across the animation,
* note that the animation data's action can be NULL here */
if (ngroup->adt) {
- LinkData *ld, *ldn=NULL;
+ LinkData *ld, *ldn = NULL;
/* now perform the moving */
BKE_animdata_separate_by_basepath(&ngroup->id, &ntree->id, &anim_basepaths);
@@ -1428,7 +1428,7 @@ typedef enum eNodeGroupSeparateType {
/* Operator Property */
EnumPropertyItem node_group_separate_types[] = {
- {NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"},
+ {NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"},
{NODE_GS_MOVE, "MOVE", 0, "Move", "Move to parent node tree, remove from group"},
{0, NULL, 0, NULL, NULL}
};
@@ -1442,25 +1442,25 @@ static int node_group_separate_exec(bContext *C, wmOperator *op)
ED_preview_kill_jobs(C);
/* are we inside of a group? */
- gnode= node_tree_get_editgroup(snode->nodetree);
+ gnode = node_tree_get_editgroup(snode->nodetree);
if (!gnode) {
BKE_report(op->reports, RPT_WARNING, "Not inside node group");
return OPERATOR_CANCELLED;
}
switch (type) {
- case NODE_GS_COPY:
- if (!node_group_separate_selected(snode->nodetree, gnode, 1)) {
- BKE_report(op->reports, RPT_WARNING, "Can't separate nodes");
- return OPERATOR_CANCELLED;
- }
- break;
- case NODE_GS_MOVE:
- if (!node_group_separate_selected(snode->nodetree, gnode, 0)) {
- BKE_report(op->reports, RPT_WARNING, "Can't separate nodes");
- return OPERATOR_CANCELLED;
- }
- break;
+ case NODE_GS_COPY:
+ if (!node_group_separate_selected(snode->nodetree, gnode, 1)) {
+ BKE_report(op->reports, RPT_WARNING, "Can't separate nodes");
+ return OPERATOR_CANCELLED;
+ }
+ break;
+ case NODE_GS_MOVE:
+ if (!node_group_separate_selected(snode->nodetree, gnode, 0)) {
+ BKE_report(op->reports, RPT_WARNING, "Can't separate nodes");
+ return OPERATOR_CANCELLED;
+ }
+ break;
}
/* switch to parent tree */
@@ -1501,7 +1501,7 @@ void NODE_OT_group_separate(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", node_group_separate_types, NODE_GS_COPY, "Type", "");
}
@@ -1513,7 +1513,7 @@ static bNode *visible_node(SpaceNode *snode, rctf *rct)
{
bNode *node;
- for (node=snode->edittree->nodes.last; node; node=node->prev) {
+ for (node = snode->edittree->nodes.last; node; node = node->prev) {
if (BLI_isect_rctf(&node->totr, rct, NULL))
break;
}
@@ -1529,17 +1529,17 @@ typedef struct NodeViewMove {
static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
- NodeViewMove *nvm= op->customdata;
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ NodeViewMove *nvm = op->customdata;
switch (event->type) {
case MOUSEMOVE:
- snode->xof -= (nvm->mvalo[0]-event->mval[0]);
- snode->yof -= (nvm->mvalo[1]-event->mval[1]);
- nvm->mvalo[0]= event->mval[0];
- nvm->mvalo[1]= event->mval[1];
+ snode->xof -= (nvm->mvalo[0] - event->mval[0]);
+ snode->yof -= (nvm->mvalo[1] - event->mval[1]);
+ nvm->mvalo[0] = event->mval[0];
+ nvm->mvalo[1] = event->mval[1];
/* prevent dragging image outside of the window and losing it! */
CLAMP(snode->xof, nvm->xmin, nvm->xmax);
@@ -1554,9 +1554,9 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
case RIGHTMOUSE:
MEM_freeN(nvm);
- op->customdata= NULL;
+ op->customdata = NULL;
- WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE, NULL);
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_NODE, NULL);
return OPERATOR_FINISHED;
}
@@ -1566,30 +1566,30 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
NodeViewMove *nvm;
Image *ima;
ImBuf *ibuf;
- int pad= 10;
+ int pad = 10;
void *lock;
- ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
- ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
+ ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
if (ibuf == NULL) {
BKE_image_release_ibuf(ima, lock);
return OPERATOR_CANCELLED;
}
- nvm= MEM_callocN(sizeof(NodeViewMove), "NodeViewMove struct");
- op->customdata= nvm;
- nvm->mvalo[0]= event->mval[0];
- nvm->mvalo[1]= event->mval[1];
+ nvm = MEM_callocN(sizeof(NodeViewMove), "NodeViewMove struct");
+ op->customdata = nvm;
+ nvm->mvalo[0] = event->mval[0];
+ nvm->mvalo[1] = event->mval[1];
- nvm->xmin = -(ar->winx/2) - ibuf->x/2 + pad;
- nvm->xmax = ar->winx/2 + ibuf->x/2 - pad;
- nvm->ymin = -(ar->winy/2) - ibuf->y/2 + pad;
- nvm->ymax = ar->winy/2 + ibuf->y/2 - pad;
+ nvm->xmin = -(ar->winx / 2) - ibuf->x / 2 + pad;
+ nvm->xmax = ar->winx / 2 + ibuf->x / 2 - pad;
+ nvm->ymin = -(ar->winy / 2) - ibuf->y / 2 + pad;
+ nvm->ymax = ar->winy / 2 + ibuf->y / 2 - pad;
BKE_image_release_ibuf(ima, lock);
@@ -1602,7 +1602,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
- op->customdata= NULL;
+ op->customdata = NULL;
return OPERATOR_CANCELLED;
}
@@ -1621,14 +1621,14 @@ void NODE_OT_backimage_move(wmOperatorType *ot)
ot->cancel = snode_bg_viewmove_cancel;
/* flags */
- ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+ ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
}
static int backimage_zoom(bContext *C, wmOperator *op)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
- float fac= RNA_float_get(op->ptr, "factor");
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ float fac = RNA_float_get(op->ptr, "factor");
snode->zoom *= fac;
ED_region_tag_redraw(ar);
@@ -1643,7 +1643,7 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot)
/* identifiers */
ot->name = "Background Image Zoom";
ot->idname = "NODE_OT_backimage_zoom";
- ot->description = "Zoom in/out the brackground image";
+ ot->description = "Zoom in/out the background image";
/* api callbacks */
ot->exec = backimage_zoom;
@@ -1674,28 +1674,32 @@ typedef struct ImageSampleInfo {
static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
{
Scene *scene = CTX_data_scene(C);
- ImageSampleInfo *info= arg_info;
+ ImageSampleInfo *info = arg_info;
- ED_image_draw_info(ar, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels,
- info->x, info->y, info->col, info->colf,
- NULL, NULL /* zbuf - unused for nodes */
- );
+ if (info->draw) {
+ ED_image_draw_info(ar, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels,
+ info->x, info->y, info->col, info->colf,
+ NULL, NULL /* zbuf - unused for nodes */
+ );
+ }
}
static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
- ImageSampleInfo *info= op->customdata;
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ ImageSampleInfo *info = op->customdata;
void *lock;
Image *ima;
ImBuf *ibuf;
float fx, fy, bufx, bufy;
- ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
- ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (!ibuf)
+ ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ if (!ibuf) {
+ info->draw = 0;
return;
+ }
if (!ibuf->rect) {
if (info->color_manage)
@@ -1708,46 +1712,50 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
/* map the mouse coords to the backdrop image space */
bufx = ibuf->x * snode->zoom;
bufy = ibuf->y * snode->zoom;
- fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
- fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+ fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
- if (fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
+ if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
float *fp;
char *cp;
- int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y);
+ int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
- CLAMP(x, 0, ibuf->x-1);
- CLAMP(y, 0, ibuf->y-1);
+ CLAMP(x, 0, ibuf->x - 1);
+ CLAMP(y, 0, ibuf->y - 1);
- info->x= x;
- info->y= y;
- info->draw= 1;
- info->channels= ibuf->channels;
+ info->x = x;
+ info->y = y;
+ info->draw = 1;
+ info->channels = ibuf->channels;
if (ibuf->rect) {
- cp= (char *)(ibuf->rect + y*ibuf->x + x);
+ cp = (char *)(ibuf->rect + y * ibuf->x + x);
- info->col[0]= cp[0];
- info->col[1]= cp[1];
- info->col[2]= cp[2];
- info->col[3]= cp[3];
+ info->col[0] = cp[0];
+ info->col[1] = cp[1];
+ info->col[2] = cp[2];
+ info->col[3] = cp[3];
- info->colf[0]= (float)cp[0]/255.0f;
- info->colf[1]= (float)cp[1]/255.0f;
- info->colf[2]= (float)cp[2]/255.0f;
- info->colf[3]= (float)cp[3]/255.0f;
+ info->colf[0] = (float)cp[0] / 255.0f;
+ info->colf[1] = (float)cp[1] / 255.0f;
+ info->colf[2] = (float)cp[2] / 255.0f;
+ info->colf[3] = (float)cp[3] / 255.0f;
}
if (ibuf->rect_float) {
- fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
+ fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
- info->colf[0]= fp[0];
- info->colf[1]= fp[1];
- info->colf[2]= fp[2];
- info->colf[3]= fp[3];
+ info->colf[0] = fp[0];
+ info->colf[1] = fp[1];
+ info->colf[2] = fp[2];
+ info->colf[3] = fp[3];
}
+
+ ED_node_sample_set(info->colf);
+ }
+ else {
+ info->draw = 0;
+ ED_node_sample_set(NULL);
}
- else
- info->draw= 0;
BKE_image_release_ibuf(ima, lock);
@@ -1756,8 +1764,9 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
static void sample_exit(bContext *C, wmOperator *op)
{
- ImageSampleInfo *info= op->customdata;
+ ImageSampleInfo *info = op->customdata;
+ ED_node_sample_set(NULL);
ED_region_draw_cb_exit(info->art, info->draw_handle);
ED_area_tag_redraw(CTX_wm_area(C));
MEM_freeN(info);
@@ -1765,17 +1774,17 @@ static void sample_exit(bContext *C, wmOperator *op)
static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
ImageSampleInfo *info;
- if (snode->treetype!=NTREE_COMPOSIT || !(snode->flag & SNODE_BACKDRAW))
+ if (snode->treetype != NTREE_COMPOSIT || !(snode->flag & SNODE_BACKDRAW))
return OPERATOR_CANCELLED;
- info= MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
- info->art= ar->type;
+ info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
+ info->art = ar->type;
info->draw_handle = ED_region_draw_cb_activate(ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
- op->customdata= info;
+ op->customdata = info;
sample_apply(C, op, event);
@@ -1837,20 +1846,20 @@ static void node_resize_init(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
{
SpaceNode *snode = CTX_wm_space_node(C);
- NodeSizeWidget *nsw= MEM_callocN(sizeof(NodeSizeWidget), "size widget op data");
+ NodeSizeWidget *nsw = MEM_callocN(sizeof(NodeSizeWidget), "size widget op data");
- op->customdata= nsw;
- nsw->mxstart= snode->mx;
- nsw->mystart= snode->my;
+ op->customdata = nsw;
+ nsw->mxstart = snode->mx;
+ nsw->mystart = snode->my;
/* store old */
- nsw->oldlocx= node->locx;
- nsw->oldlocy= node->locy;
- nsw->oldoffsetx= node->offsetx;
- nsw->oldoffsety= node->offsety;
- nsw->oldwidth= node->width;
- nsw->oldheight= node->height;
- nsw->oldminiwidth= node->miniwidth;
+ nsw->oldlocx = node->locx;
+ nsw->oldlocy = node->locy;
+ nsw->oldoffsetx = node->offsetx;
+ nsw->oldoffsety = node->offsety;
+ nsw->oldwidth = node->width;
+ nsw->oldheight = node->height;
+ nsw->oldminiwidth = node->miniwidth;
nsw->directions = dir;
WM_cursor_modal(CTX_wm_window(C), node_get_resize_cursor(dir));
@@ -1863,15 +1872,15 @@ static void node_resize_exit(bContext *C, wmOperator *op, int UNUSED(cancel))
WM_cursor_restore(CTX_wm_window(C));
MEM_freeN(op->customdata);
- op->customdata= NULL;
+ op->customdata = NULL;
}
static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
- bNode *node= editnode_get_active(snode->edittree);
- NodeSizeWidget *nsw= op->customdata;
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ bNode *node = editnode_get_active(snode->edittree);
+ NodeSizeWidget *nsw = op->customdata;
float mx, my, dx, dy;
switch (event->type) {
@@ -1886,46 +1895,46 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
float widthmin = 0.0f;
float widthmax = 100.0f;
if (nsw->directions & NODE_RESIZE_RIGHT) {
- node->miniwidth= nsw->oldminiwidth + dx;
+ node->miniwidth = nsw->oldminiwidth + dx;
CLAMP(node->miniwidth, widthmin, widthmax);
}
if (nsw->directions & NODE_RESIZE_LEFT) {
float locmax = nsw->oldlocx + nsw->oldminiwidth;
- node->locx= nsw->oldlocx + dx;
+ node->locx = nsw->oldlocx + dx;
CLAMP(node->locx, locmax - widthmax, locmax - widthmin);
- node->miniwidth= locmax - node->locx;
+ node->miniwidth = locmax - node->locx;
}
}
else {
- float widthmin = UI_DPI_FAC*node->typeinfo->minwidth;
- float widthmax = UI_DPI_FAC*node->typeinfo->maxwidth;
+ float widthmin = UI_DPI_FAC * node->typeinfo->minwidth;
+ float widthmax = UI_DPI_FAC * node->typeinfo->maxwidth;
if (nsw->directions & NODE_RESIZE_RIGHT) {
- node->width= nsw->oldwidth + dx;
+ node->width = nsw->oldwidth + dx;
CLAMP(node->width, widthmin, widthmax);
}
if (nsw->directions & NODE_RESIZE_LEFT) {
float locmax = nsw->oldlocx + nsw->oldwidth;
- node->locx= nsw->oldlocx + dx;
+ node->locx = nsw->oldlocx + dx;
CLAMP(node->locx, locmax - widthmax, locmax - widthmin);
- node->width= locmax - node->locx;
+ node->width = locmax - node->locx;
}
}
/* height works the other way round ... */
{
- float heightmin = UI_DPI_FAC*node->typeinfo->minheight;
- float heightmax = UI_DPI_FAC*node->typeinfo->maxheight;
+ float heightmin = UI_DPI_FAC * node->typeinfo->minheight;
+ float heightmax = UI_DPI_FAC * node->typeinfo->maxheight;
if (nsw->directions & NODE_RESIZE_TOP) {
float locmin = nsw->oldlocy - nsw->oldheight;
- node->locy= nsw->oldlocy + dy;
+ node->locy = nsw->oldlocy + dy;
CLAMP(node->locy, locmin + heightmin, locmin + heightmax);
- node->height= node->locy - locmin;
+ node->height = node->locy - locmin;
}
if (nsw->directions & NODE_RESIZE_BOTTOM) {
- node->height= nsw->oldheight - dy;
+ node->height = nsw->oldheight - dy;
CLAMP(node->height, heightmin, heightmax);
}
}
@@ -1934,20 +1943,20 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
if (node->type == NODE_FRAME) {
/* keep the offset symmetric around center point */
if (nsw->directions & NODE_RESIZE_LEFT) {
- node->locx = nsw->oldlocx + 0.5f*dx;
- node->offsetx = nsw->oldoffsetx + 0.5f*dx;
+ node->locx = nsw->oldlocx + 0.5f * dx;
+ node->offsetx = nsw->oldoffsetx + 0.5f * dx;
}
if (nsw->directions & NODE_RESIZE_RIGHT) {
- node->locx = nsw->oldlocx + 0.5f*dx;
- node->offsetx = nsw->oldoffsetx - 0.5f*dx;
+ node->locx = nsw->oldlocx + 0.5f * dx;
+ node->offsetx = nsw->oldoffsetx - 0.5f * dx;
}
if (nsw->directions & NODE_RESIZE_TOP) {
- node->locy = nsw->oldlocy + 0.5f*dy;
- node->offsety = nsw->oldoffsety + 0.5f*dy;
+ node->locy = nsw->oldlocy + 0.5f * dy;
+ node->offsety = nsw->oldoffsety + 0.5f * dy;
}
if (nsw->directions & NODE_RESIZE_BOTTOM) {
- node->locy = nsw->oldlocy + 0.5f*dy;
- node->offsety = nsw->oldoffsety - 0.5f*dy;
+ node->locy = nsw->oldlocy + 0.5f * dy;
+ node->offsety = nsw->oldoffsety - 0.5f * dy;
}
}
}
@@ -1971,9 +1980,9 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
- bNode *node= editnode_get_active(snode->edittree);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ bNode *node = editnode_get_active(snode->edittree);
int dir;
if (node) {
@@ -1986,7 +1995,7 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
}
- return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
static int node_resize_cancel(bContext *C, wmOperator *op)
@@ -2020,10 +2029,10 @@ int node_has_hidden_sockets(bNode *node)
{
bNodeSocket *sock;
- for (sock= node->inputs.first; sock; sock= sock->next)
+ for (sock = node->inputs.first; sock; sock = sock->next)
if (sock->flag & SOCK_HIDDEN)
return 1;
- for (sock= node->outputs.first; sock; sock= sock->next)
+ for (sock = node->outputs.first; sock; sock = sock->next)
if (sock->flag & SOCK_HIDDEN)
return 1;
return 0;
@@ -2033,20 +2042,20 @@ void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set)
{
bNodeSocket *sock;
- if (set==0) {
- for (sock= node->inputs.first; sock; sock= sock->next)
+ if (set == 0) {
+ for (sock = node->inputs.first; sock; sock = sock->next)
sock->flag &= ~SOCK_HIDDEN;
- for (sock= node->outputs.first; sock; sock= sock->next)
+ for (sock = node->outputs.first; sock; sock = sock->next)
sock->flag &= ~SOCK_HIDDEN;
}
else {
/* hide unused sockets */
- for (sock= node->inputs.first; sock; sock= sock->next) {
- if (sock->link==NULL)
+ for (sock = node->inputs.first; sock; sock = sock->next) {
+ if (sock->link == NULL)
sock->flag |= SOCK_HIDDEN;
}
- for (sock= node->outputs.first; sock; sock= sock->next) {
- if (nodeCountSocketLinks(snode->edittree, sock)==0)
+ for (sock = node->outputs.first; sock; sock = sock->next) {
+ if (nodeCountSocketLinks(snode->edittree, sock) == 0)
sock->flag |= SOCK_HIDDEN;
}
}
@@ -2060,20 +2069,20 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
bNodeSocket *sock;
/* context check */
- if (tonode==NULL || tonode->outputs.first==NULL)
+ if (tonode == NULL || tonode->outputs.first == NULL)
return OPERATOR_CANCELLED;
- if ( ELEM(tonode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ if (ELEM(tonode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
return OPERATOR_CANCELLED;
/* get viewer */
- for (node= snode->edittree->nodes.first; node; node= node->next)
- if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+ for (node = snode->edittree->nodes.first; node; node = node->next)
+ if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
if (node->flag & NODE_DO_OUTPUT)
break;
/* no viewer, we make one active */
- if (node==NULL) {
- for (node= snode->edittree->nodes.first; node; node= node->next) {
- if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+ if (node == NULL) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
+ if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
node->flag |= NODE_DO_OUTPUT;
break;
}
@@ -2085,17 +2094,17 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
/* try to find an already connected socket to cycle to the next */
if (node) {
link = NULL;
- for (link= snode->edittree->links.first; link; link= link->next)
- if (link->tonode==node && link->fromnode==tonode)
- if (link->tosock==node->inputs.first)
+ for (link = snode->edittree->links.first; link; link = link->next)
+ if (link->tonode == node && link->fromnode == tonode)
+ if (link->tosock == node->inputs.first)
break;
if (link) {
/* unlink existing connection */
- sock= link->fromsock;
+ sock = link->fromsock;
nodeRemLink(snode->edittree, link);
/* find a socket after the previously connected socket */
- for (sock=sock->next; sock; sock= sock->next)
+ for (sock = sock->next; sock; sock = sock->next)
if (!nodeSocketIsHidden(sock))
break;
}
@@ -2103,7 +2112,7 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
/* find a socket starting from the first socket */
if (!sock) {
- for (sock= tonode->outputs.first; sock; sock= sock->next)
+ for (sock = tonode->outputs.first; sock; sock = sock->next)
if (!nodeSocketIsHidden(sock))
break;
}
@@ -2125,17 +2134,17 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
}
else {
/* get link to viewer */
- for (link= snode->edittree->links.first; link; link= link->next)
- if (link->tonode==node && link->tosock==node->inputs.first)
+ for (link = snode->edittree->links.first; link; link = link->next)
+ if (link->tonode == node && link->tosock == node->inputs.first)
break;
}
- if (link==NULL) {
+ if (link == NULL) {
nodeAddLink(snode->edittree, tonode, sock, node, node->inputs.first);
}
else {
- link->fromnode= tonode;
- link->fromsock= sock;
+ link->fromnode = tonode;
+ link->fromsock = sock;
/* make sure the dependency sorting is updated */
snode->edittree->update |= NTREE_UPDATE_LINKS;
}
@@ -2149,10 +2158,10 @@ static int node_link_viewer(const bContext *C, bNode *tonode)
static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
- node= editnode_get_active(snode->edittree);
+ node = editnode_get_active(snode->edittree);
if (!node)
return OPERATOR_CANCELLED;
@@ -2181,31 +2190,31 @@ void NODE_OT_link_viewer(wmOperatorType *ot)
ot->poll = composite_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* return 0, nothing done */
-static int UNUSED_FUNCTION(node_mouse_groupheader)(SpaceNode *snode)
+static int UNUSED_FUNCTION(node_mouse_groupheader) (SpaceNode * snode)
{
bNode *gnode;
- float mx=0, my=0;
+ float mx = 0, my = 0;
// XXX int mval[2];
- gnode= node_tree_get_editgroup(snode->nodetree);
- if (gnode==NULL) return 0;
+ gnode = node_tree_get_editgroup(snode->nodetree);
+ if (gnode == NULL) return 0;
// XXX getmouseco_areawin(mval);
// XXX areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
/* click in header or outside? */
- if (BLI_in_rctf(&gnode->totr, mx, my)==0) {
- rctf rect= gnode->totr;
+ if (BLI_in_rctf(&gnode->totr, mx, my) == 0) {
+ rctf rect = gnode->totr;
rect.ymax += NODE_DY;
- if (BLI_in_rctf(&rect, mx, my)==0)
- snode_make_group_editable(snode, NULL); /* toggles, so exits editmode */
+ if (BLI_in_rctf(&rect, mx, my) == 0)
+ snode_make_group_editable(snode, NULL); /* toggles, so exits editmode */
// else
// XXX transform_nodes(snode->nodetree, 'g', "Move group");
@@ -2222,36 +2231,36 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
bNodeSocket *sock;
rctf rect;
- *nodep= NULL;
- *sockp= NULL;
+ *nodep = NULL;
+ *sockp = NULL;
/* check if we click in a socket */
- for (node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
- rect.xmin = snode->mx - (NODE_SOCKSIZE+4);
- rect.ymin = snode->my - (NODE_SOCKSIZE+4);
- rect.xmax = snode->mx + (NODE_SOCKSIZE+4);
- rect.ymax = snode->my + (NODE_SOCKSIZE+4);
+ rect.xmin = snode->mx - (NODE_SOCKSIZE + 4);
+ rect.ymin = snode->my - (NODE_SOCKSIZE + 4);
+ rect.xmax = snode->mx + (NODE_SOCKSIZE + 4);
+ rect.ymax = snode->my + (NODE_SOCKSIZE + 4);
if (!(node->flag & NODE_HIDDEN)) {
/* extra padding inside and out - allow dragging on the text areas too */
if (in_out == SOCK_IN) {
rect.xmax += NODE_SOCKSIZE;
- rect.xmin -= NODE_SOCKSIZE*4;
+ rect.xmin -= NODE_SOCKSIZE * 4;
}
else if (in_out == SOCK_OUT) {
- rect.xmax += NODE_SOCKSIZE*4;
+ rect.xmax += NODE_SOCKSIZE * 4;
rect.xmin -= NODE_SOCKSIZE;
}
}
if (in_out & SOCK_IN) {
- for (sock= node->inputs.first; sock; sock= sock->next) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
if (node == visible_node(snode, &rect)) {
- *nodep= node;
- *sockp= sock;
+ *nodep = node;
+ *sockp = sock;
return 1;
}
}
@@ -2259,12 +2268,12 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
}
}
if (in_out & SOCK_OUT) {
- for (sock= node->outputs.first; sock; sock= sock->next) {
+ for (sock = node->outputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
if (node == visible_node(snode, &rect)) {
- *nodep= node;
- *sockp= sock;
+ *nodep = node;
+ *sockp = sock;
return 1;
}
}
@@ -2277,22 +2286,22 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
* NB: using ngroup->outputs as input sockets and vice versa here!
*/
if (in_out & SOCK_IN) {
- for (sock= snode->edittree->outputs.first; sock; sock= sock->next) {
+ for (sock = snode->edittree->outputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
- *nodep= NULL; /* NULL node pointer indicates group socket */
- *sockp= sock;
+ *nodep = NULL; /* NULL node pointer indicates group socket */
+ *sockp = sock;
return 1;
}
}
}
}
if (in_out & SOCK_OUT) {
- for (sock= snode->edittree->inputs.first; sock; sock= sock->next) {
+ for (sock = snode->edittree->inputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
- *nodep= NULL; /* NULL node pointer indicates group socket */
- *sockp= sock;
+ *nodep = NULL; /* NULL node pointer indicates group socket */
+ *sockp = sock;
return 1;
}
}
@@ -2304,7 +2313,7 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
static int outside_group_rect(SpaceNode *snode)
{
- bNode *gnode= node_tree_get_editgroup(snode->nodetree);
+ bNode *gnode = node_tree_get_editgroup(snode->nodetree);
if (gnode) {
return (snode->mx < gnode->totr.xmin ||
snode->mx >= gnode->totr.xmax ||
@@ -2351,7 +2360,7 @@ static bNodeSocket *best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocke
bNodeSocket *sock;
/* first look for selected output */
- for (sock=node->outputs.first; sock; sock=sock->next) {
+ for (sock = node->outputs.first; sock; sock = sock->next) {
if (!socket_is_available(ntree, sock, allow_multiple))
continue;
@@ -2360,19 +2369,19 @@ static bNodeSocket *best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocke
}
/* try to find a socket with a matching name */
- for (sock=node->outputs.first; sock; sock=sock->next) {
+ for (sock = node->outputs.first; sock; sock = sock->next) {
if (!socket_is_available(ntree, sock, allow_multiple))
continue;
/* check for same types */
if (sock->type == sock_target->type) {
- if (strcmp(sock->name, sock_target->name)==0)
+ if (strcmp(sock->name, sock_target->name) == 0)
return sock;
}
}
/* otherwise settle for the first available socket of the right type */
- for (sock=node->outputs.first; sock; sock=sock->next) {
+ for (sock = node->outputs.first; sock; sock = sock->next) {
if (!socket_is_available(ntree, sock, allow_multiple))
continue;
@@ -2391,16 +2400,16 @@ static bNodeSocket *best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocke
static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, int replace)
{
bNodeSocket *sock;
- int socktype, maxtype=0;
+ int socktype, maxtype = 0;
int a = 0;
- for (sock=node->inputs.first; sock; sock=sock->next) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
maxtype = MAX2(sock->type, maxtype);
}
/* find sockets of higher 'types' first (i.e. image) */
- for (socktype=maxtype; socktype >= 0; socktype--) {
- for (sock=node->inputs.first; sock; sock=sock->next) {
+ for (socktype = maxtype; socktype >= 0; socktype--) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
if (!socket_is_available(ntree, sock, replace)) {
a++;
@@ -2447,9 +2456,9 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
ListBase *nodelist = MEM_callocN(sizeof(ListBase), "items_list");
bNodeListItem *nli;
bNode *node;
- int i, numlinks=0;
+ int i, numlinks = 0;
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & NODE_SELECT) {
nli = MEM_mallocN(sizeof(bNodeListItem), "temporary node list item");
nli->node = node;
@@ -2460,7 +2469,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
/* sort nodes left to right */
BLI_sortlist(nodelist, sort_nodes_locx);
- for (nli=nodelist->first; nli; nli=nli->next) {
+ for (nli = nodelist->first; nli; nli = nli->next) {
bNode *node_fr, *node_to;
bNodeSocket *sock_fr, *sock_to;
int has_selected_inputs = 0;
@@ -2471,7 +2480,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
node_to = nli->next->node;
/* if there are selected sockets, connect those */
- for (sock_to = node_to->inputs.first; sock_to; sock_to=sock_to->next) {
+ for (sock_to = node_to->inputs.first; sock_to; sock_to = sock_to->next) {
if (sock_to->flag & SELECT) {
has_selected_inputs = 1;
@@ -2492,7 +2501,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
/* no selected inputs, connect by finding suitable match */
int num_inputs = BLI_countlist(&node_to->inputs);
- for (i=0; i<num_inputs; i++) {
+ for (i = 0; i < num_inputs; i++) {
/* find the best guess input socket */
sock_to = best_socket_input(ntree, node_to, i, replace);
@@ -2523,7 +2532,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
/* can be called from menus too, but they should do own undopush and redraws */
bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate *ntemp, float locx, float locy)
{
- bNode *node= NULL, *gnode;
+ bNode *node = NULL, *gnode;
node_deselect_all(snode);
@@ -2531,11 +2540,11 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
/* generics */
if (node) {
- node->locx= locx;
- node->locy= locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node
+ node->locx = locx;
+ node->locy = locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node
node_select(node);
- gnode= node_tree_get_editgroup(snode->nodetree);
+ gnode = node_tree_get_editgroup(snode->nodetree);
if (gnode) {
node->locx -= gnode->locx;
node->locy -= gnode->locy;
@@ -2544,7 +2553,7 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
ntreeUpdateTree(snode->edittree);
ED_node_set_active(bmain, snode->edittree, node);
- if (snode->nodetree->type==NTREE_COMPOSIT) {
+ if (snode->nodetree->type == NTREE_COMPOSIT) {
if (ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) {
node->id = &scene->id;
}
@@ -2561,7 +2570,7 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
snode_update(snode, node);
}
- if (snode->nodetree->type==NTREE_TEXTURE) {
+ if (snode->nodetree->type == NTREE_TEXTURE) {
ntreeTexCheckCyclics(snode->edittree);
}
@@ -2577,7 +2586,7 @@ static void node_duplicate_reparent_recursive(bNode *node)
node->flag |= NODE_TEST;
/* find first selected parent */
- for (parent=node->parent; parent; parent=parent->parent) {
+ for (parent = node->parent; parent; parent = parent->parent) {
if (parent->flag & SELECT) {
if (!(parent->flag & NODE_TEST))
node_duplicate_reparent_recursive(parent);
@@ -2593,8 +2602,8 @@ static void node_duplicate_reparent_recursive(bNode *node)
static int node_duplicate_exec(bContext *C, wmOperator *op)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- bNodeTree *ntree= snode->edittree;
+ SpaceNode *snode = CTX_wm_space_node(C);
+ bNodeTree *ntree = snode->edittree;
bNode *node, *newnode, *lastnode;
bNodeLink *link, *newlink, *lastlink;
int keep_inputs = RNA_boolean_get(op->ptr, "keep_inputs");
@@ -2602,7 +2611,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
ED_preview_kill_jobs(C);
lastnode = ntree->nodes.last;
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
newnode = nodeCopyNode(ntree, node);
@@ -2616,7 +2625,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
}
/* make sure we don't copy new nodes again! */
- if (node==lastnode)
+ if (node == lastnode)
break;
}
@@ -2624,7 +2633,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
* NB: this depends on correct node->new_node and sock->new_sock pointers from above copy!
*/
lastlink = ntree->links.last;
- for (link=ntree->links.first; link; link=link->next) {
+ for (link = ntree->links.first; link; link = link->next) {
/* This creates new links between copied nodes.
* If keep_inputs is set, also copies input links from unselected (when fromnode==NULL)!
*/
@@ -2649,25 +2658,25 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
}
/* make sure we don't copy new links again! */
- if (link==lastlink)
+ if (link == lastlink)
break;
}
/* clear flags for recursive depth-first iteration */
- for (node= ntree->nodes.first; node; node= node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
node->flag &= ~NODE_TEST;
/* reparent copied nodes */
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if ((node->flag & SELECT) && !(node->flag & NODE_TEST))
node_duplicate_reparent_recursive(node);
/* only has to check old nodes */
- if (node==lastnode)
+ if (node == lastnode)
break;
}
/* deselect old nodes, select the copies instead */
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
/* has been set during copy above */
newnode = node->new_node;
@@ -2678,7 +2687,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
}
/* make sure we don't copy new nodes again! */
- if (node==lastnode)
+ if (node == lastnode)
break;
}
@@ -2702,7 +2711,7 @@ void NODE_OT_duplicate(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "keep_inputs", 0, "Keep Inputs", "Keep the input links to duplicated nodes");
}
@@ -2716,21 +2725,21 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL
if (tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
- for (tlink= snode->edittree->links.first; tlink; tlink= tlink->next) {
- if (link!=tlink && tlink->tosock==link->tosock)
+ for (tlink = snode->edittree->links.first; tlink; tlink = tlink->next) {
+ if (link != tlink && tlink->tosock == link->tosock)
break;
}
if (tlink) {
/* try to move the existing link to the next available socket */
if (tlink->tonode) {
/* is there a free input socket with the target type? */
- for (sock= tlink->tonode->inputs.first; sock; sock= sock->next) {
- if (sock->type==tlink->tosock->type)
+ for (sock = tlink->tonode->inputs.first; sock; sock = sock->next) {
+ if (sock->type == tlink->tosock->type)
if (nodeCountSocketLinks(snode->edittree, sock) < sock->limit)
break;
}
if (sock) {
- tlink->tosock= sock;
+ tlink->tosock = sock;
sock->flag &= ~SOCK_HIDDEN;
}
else {
@@ -2749,12 +2758,12 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL
/* in_out = starting socket */
static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
- bNodeLinkDrag *nldrag= op->customdata;
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ bNodeLinkDrag *nldrag = op->customdata;
bNodeTree *ntree = snode->edittree;
bNode *tnode;
- bNodeSocket *tsock= NULL;
+ bNodeSocket *tsock = NULL;
bNodeLink *link;
LinkData *linkdata;
int in_out;
@@ -2762,14 +2771,14 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
in_out = nldrag->in_out;
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
- &snode->mx, &snode->my);
+ &snode->mx, &snode->my);
switch (event->type) {
case MOUSEMOVE:
- if (in_out==SOCK_OUT) {
+ if (in_out == SOCK_OUT) {
if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_IN)) {
- for (linkdata=nldrag->links.first; linkdata; linkdata=linkdata->next) {
+ for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
link = linkdata->data;
/* skip if this is already the target socket */
@@ -2792,14 +2801,14 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
else {
int do_update = FALSE;
- for (linkdata=nldrag->links.first; linkdata; linkdata=linkdata->next) {
+ for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
link = linkdata->data;
if (link->tonode || link->tosock) {
BLI_remlink(&ntree->links, link);
link->prev = link->next = NULL;
- link->tonode= NULL;
- link->tosock= NULL;
+ link->tonode = NULL;
+ link->tosock = NULL;
ntree->update |= NTREE_UPDATE_LINKS;
do_update = TRUE;
@@ -2812,7 +2821,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
else {
if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_OUT)) {
- for (linkdata=nldrag->links.first; linkdata; linkdata=linkdata->next) {
+ for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
link = linkdata->data;
/* skip if this is already the target socket */
@@ -2835,14 +2844,14 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
else {
int do_update = FALSE;
- for (linkdata=nldrag->links.first; linkdata; linkdata=linkdata->next) {
+ for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
link = linkdata->data;
if (link->fromnode || link->fromsock) {
BLI_remlink(&ntree->links, link);
link->prev = link->next = NULL;
- link->fromnode= NULL;
- link->fromsock= NULL;
+ link->fromnode = NULL;
+ link->fromsock = NULL;
ntree->update |= NTREE_UPDATE_LINKS;
do_update = TRUE;
@@ -2860,7 +2869,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
case LEFTMOUSE:
case RIGHTMOUSE:
case MIDDLEMOUSE: {
- for (linkdata=nldrag->links.first; linkdata; linkdata=linkdata->next) {
+ for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) {
link = linkdata->data;
if (link->tosock && link->fromsock) {
@@ -2869,7 +2878,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
snode_update(snode, link->tonode);
/* we might need to remove a link */
- if (in_out==SOCK_OUT)
+ if (in_out == SOCK_OUT)
node_remove_extra_links(snode, link->tosock, link);
/* when linking to group outputs, update the socket type */
@@ -2930,16 +2939,16 @@ static bNodeLinkDrag *node_link_init(SpaceNode *snode, int detach)
/* output indicated? */
if (node_find_indicated_socket(snode, &node, &sock, SOCK_OUT)) {
- nldrag= MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata");
+ nldrag = MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata");
num_links = nodeCountSocketLinks(snode->edittree, sock);
if (num_links > 0 && (num_links >= sock->limit || detach)) {
/* dragged links are fixed on input side */
nldrag->in_out = SOCK_IN;
/* detach current links and store them in the operator data */
- for (link= snode->edittree->links.first; link; link= link_next) {
+ for (link = snode->edittree->links.first; link; link = link_next) {
link_next = link->next;
- if (link->fromsock==sock) {
+ if (link->fromsock == sock) {
linkdata = MEM_callocN(sizeof(LinkData), "drag link op link data");
linkdata->data = oplink = MEM_callocN(sizeof(bNodeLink), "drag link op link");
*oplink = *link;
@@ -2962,16 +2971,16 @@ static bNodeLinkDrag *node_link_init(SpaceNode *snode, int detach)
}
/* or an input? */
else if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN)) {
- nldrag= MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata");
+ nldrag = MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata");
num_links = nodeCountSocketLinks(snode->edittree, sock);
if (num_links > 0 && (num_links >= sock->limit || detach)) {
/* dragged links are fixed on output side */
nldrag->in_out = SOCK_OUT;
/* detach current links and store them in the operator data */
- for (link= snode->edittree->links.first; link; link= link_next) {
+ for (link = snode->edittree->links.first; link; link = link_next) {
link_next = link->next;
- if (link->tosock==sock) {
+ if (link->tosock == sock) {
linkdata = MEM_callocN(sizeof(LinkData), "drag link op link data");
linkdata->data = oplink = MEM_callocN(sizeof(bNodeLink), "drag link op link");
*oplink = *link;
@@ -3002,20 +3011,20 @@ static bNodeLinkDrag *node_link_init(SpaceNode *snode, int detach)
static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
bNodeLinkDrag *nldrag;
int detach = RNA_boolean_get(op->ptr, "detach");
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
- &snode->mx, &snode->my);
+ &snode->mx, &snode->my);
ED_preview_kill_jobs(C);
nldrag = node_link_init(snode, detach);
if (nldrag) {
- op->customdata= nldrag;
+ op->customdata = nldrag;
BLI_addtail(&snode->linkdrag, nldrag);
/* add modal handler */
@@ -3024,13 +3033,13 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
else
- return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
static int node_link_cancel(bContext *C, wmOperator *op)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- bNodeLinkDrag *nldrag= op->customdata;
+ SpaceNode *snode = CTX_wm_space_node(C);
+ bNodeLinkDrag *nldrag = op->customdata;
BLI_remlink(&snode->linkdrag, nldrag);
@@ -3055,7 +3064,7 @@ void NODE_OT_link(wmOperatorType *ot)
ot->cancel = node_link_cancel;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
RNA_def_boolean(ot->srna, "detach", FALSE, "Detach", "Detach and redirect existing links");
}
@@ -3065,7 +3074,7 @@ void NODE_OT_link(wmOperatorType *ot)
/* makes a link between selected output and input sockets */
static int node_make_link_exec(bContext *C, wmOperator *op)
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
int replace = RNA_boolean_get(op->ptr, "replace");
ED_preview_kill_jobs(C);
@@ -3095,7 +3104,7 @@ void NODE_OT_link_make(wmOperatorType *ot)
ot->poll = ED_operator_node_active; // XXX we need a special poll which checks that there are selected input/output sockets
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "replace", 0, "Replace", "Replace socket connections with the new links");
}
@@ -3104,16 +3113,16 @@ void NODE_OT_link_make(wmOperatorType *ot)
#define LINK_RESOL 12
static int add_reroute_intersect_check(bNodeLink *link, float mcoords[][2], int tot, float result[2])
{
- float coord_array[LINK_RESOL+1][2];
+ float coord_array[LINK_RESOL + 1][2];
int i, b;
if (node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
- for (i=0; i<tot-1; i++)
- for (b=0; b<LINK_RESOL; b++)
- if (isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0) {
- result[0] = (mcoords[i][0]+mcoords[i+1][0])/2.0f;
- result[1] = (mcoords[i][1]+mcoords[i+1][1])/2.0f;
+ for (i = 0; i < tot - 1; i++)
+ for (b = 0; b < LINK_RESOL; b++)
+ if (isect_line_line_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0) {
+ result[0] = (mcoords[i][0] + mcoords[i + 1][0]) / 2.0f;
+ result[1] = (mcoords[i][1] + mcoords[i + 1][1]) / 2.0f;
return 1;
}
}
@@ -3122,29 +3131,30 @@ static int add_reroute_intersect_check(bNodeLink *link, float mcoords[][2], int
static int add_reroute_exec(bContext *C, wmOperator *op)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
float mcoords[256][2];
- int i= 0;
+ int i = 0;
- RNA_BEGIN(op->ptr, itemptr, "path") {
+ RNA_BEGIN(op->ptr, itemptr, "path")
+ {
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
UI_view2d_region_to_view(&ar->v2d, (short)loc[0], (short)loc[1],
- &mcoords[i][0], &mcoords[i][1]);
+ &mcoords[i][0], &mcoords[i][1]);
i++;
- if (i>= 256) break;
+ if (i >= 256) break;
}
RNA_END;
- if (i>1) {
+ if (i > 1) {
bNodeLink *link;
float insertPoint[2];
ED_preview_kill_jobs(C);
- for (link= snode->edittree->links.first; link; link=link->next) {
+ for (link = snode->edittree->links.first; link; link = link->next) {
if (add_reroute_intersect_check(link, mcoords, i, insertPoint)) {
bNodeTemplate ntemp;
bNode *rerouteNode;
@@ -3171,27 +3181,27 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
void NODE_OT_add_reroute(wmOperatorType *ot)
{
PropertyRNA *prop;
- ot->name= "Add reroute";
- ot->idname= "NODE_OT_add_reroute";
+ ot->name = "Add reroute";
+ ot->idname = "NODE_OT_add_reroute";
- ot->invoke= WM_gesture_lines_invoke;
- ot->modal= WM_gesture_lines_modal;
- ot->exec= add_reroute_exec;
- ot->cancel= WM_gesture_lines_cancel;
+ ot->invoke = WM_gesture_lines_invoke;
+ ot->modal = WM_gesture_lines_modal;
+ ot->exec = add_reroute_exec;
+ ot->cancel = WM_gesture_lines_cancel;
- ot->poll= ED_operator_node_active;
+ ot->poll = ED_operator_node_active;
/* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
+ prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
/* internal */
RNA_def_int(ot->srna, "cursor", BC_CROSSCURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
@@ -3201,14 +3211,14 @@ void NODE_OT_add_reroute(wmOperatorType *ot)
/* ********************** Cut Link operator ***************** */
static int cut_links_intersect(bNodeLink *link, float mcoords[][2], int tot)
{
- float coord_array[LINK_RESOL+1][2];
+ float coord_array[LINK_RESOL + 1][2];
int i, b;
if (node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
- for (i=0; i<tot-1; i++)
- for (b=0; b<LINK_RESOL; b++)
- if (isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
+ for (i = 0; i < tot - 1; i++)
+ for (b = 0; b < LINK_RESOL; b++)
+ if (isect_line_line_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0)
return 1;
}
return 0;
@@ -3216,30 +3226,30 @@ static int cut_links_intersect(bNodeLink *link, float mcoords[][2], int tot)
static int cut_links_exec(bContext *C, wmOperator *op)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- ARegion *ar= CTX_wm_region(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
float mcoords[256][2];
- int i= 0;
+ int i = 0;
- RNA_BEGIN (op->ptr, itemptr, "path")
+ RNA_BEGIN(op->ptr, itemptr, "path")
{
float loc[2];
RNA_float_get_array(&itemptr, "loc", loc);
UI_view2d_region_to_view(&ar->v2d, (int)loc[0], (int)loc[1],
- &mcoords[i][0], &mcoords[i][1]);
+ &mcoords[i][0], &mcoords[i][1]);
i++;
- if (i>= 256) break;
+ if (i >= 256) break;
}
RNA_END;
- if (i>1) {
+ if (i > 1) {
bNodeLink *link, *next;
ED_preview_kill_jobs(C);
- for (link= snode->edittree->links.first; link; link= next) {
- next= link->next;
+ for (link = snode->edittree->links.first; link; link = next) {
+ next = link->next;
if (cut_links_intersect(link, mcoords, i)) {
snode_update(snode, link->tonode);
@@ -3254,7 +3264,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
- return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
+ return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
void NODE_OT_links_cut(wmOperatorType *ot)
@@ -3273,9 +3283,9 @@ void NODE_OT_links_cut(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
+ prop = RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
/* internal */
RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
@@ -3285,13 +3295,13 @@ void NODE_OT_links_cut(wmOperatorType *ot)
static int detach_links_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
- bNodeTree *ntree= snode->edittree;
+ SpaceNode *snode = CTX_wm_space_node(C);
+ bNodeTree *ntree = snode->edittree;
bNode *node;
ED_preview_kill_jobs(C);
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
nodeInternalRelink(ntree, node);
}
@@ -3315,7 +3325,7 @@ void NODE_OT_links_detach(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ********************* automatic node insert on dragging ******************* */
@@ -3324,25 +3334,25 @@ void NODE_OT_links_detach(wmOperatorType *ot)
static bNodeSocket *socket_best_match(ListBase *sockets)
{
bNodeSocket *sock;
- int type, maxtype=0;
+ int type, maxtype = 0;
/* find type range */
- for (sock=sockets->first; sock; sock=sock->next)
+ for (sock = sockets->first; sock; sock = sock->next)
maxtype = MAX2(sock->type, maxtype);
/* try all types, starting from 'highest' (i.e. colors, vectors, values) */
- for (type=maxtype; type >= 0; --type) {
- for (sock= sockets->first; sock; sock= sock->next) {
- if (!nodeSocketIsHidden(sock) && type==sock->type) {
+ for (type = maxtype; type >= 0; --type) {
+ for (sock = sockets->first; sock; sock = sock->next) {
+ if (!nodeSocketIsHidden(sock) && type == sock->type) {
return sock;
}
}
}
/* no visible sockets, unhide first of highest type */
- for (type=maxtype; type >= 0; --type) {
- for (sock= sockets->first; sock; sock= sock->next) {
- if (type==sock->type) {
+ for (type = maxtype; type >= 0; --type) {
+ for (sock = sockets->first; sock; sock = sock->next) {
+ if (type == sock->type) {
sock->flag &= ~SOCK_HIDDEN;
return sock;
}
@@ -3355,31 +3365,31 @@ static bNodeSocket *socket_best_match(ListBase *sockets)
/* prevent duplicate testing code below */
static SpaceNode *ed_node_link_conditions(ScrArea *sa, bNode **select)
{
- SpaceNode *snode= sa?sa->spacedata.first:NULL;
+ SpaceNode *snode = sa ? sa->spacedata.first : NULL;
bNode *node;
bNodeLink *link;
/* no unlucky accidents */
- if (sa==NULL || sa->spacetype!=SPACE_NODE) return NULL;
+ if (sa == NULL || sa->spacetype != SPACE_NODE) return NULL;
- *select= NULL;
+ *select = NULL;
- for (node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
if (*select)
break;
else
- *select= node;
+ *select = node;
}
}
/* only one selected */
- if (node || *select==NULL) return NULL;
+ if (node || *select == NULL) return NULL;
/* correct node */
- if ((*select)->inputs.first==NULL || (*select)->outputs.first==NULL) return NULL;
+ if ((*select)->inputs.first == NULL || (*select)->outputs.first == NULL) return NULL;
/* test node for links */
- for (link= snode->edittree->links.first; link; link=link->next) {
+ for (link = snode->edittree->links.first; link; link = link->next) {
if (link->tonode == *select || link->fromnode == *select)
return NULL;
}
@@ -3391,27 +3401,27 @@ static SpaceNode *ed_node_link_conditions(ScrArea *sa, bNode **select)
void ED_node_link_insert(ScrArea *sa)
{
bNode *node, *select;
- SpaceNode *snode= ed_node_link_conditions(sa, &select);
+ SpaceNode *snode = ed_node_link_conditions(sa, &select);
bNodeLink *link;
bNodeSocket *sockto;
- if (snode==NULL) return;
+ if (snode == NULL) return;
/* get the link */
- for (link= snode->edittree->links.first; link; link=link->next)
+ for (link = snode->edittree->links.first; link; link = link->next)
if (link->flag & NODE_LINKFLAG_HILITE)
break;
if (link) {
- node= link->tonode;
- sockto= link->tosock;
+ node = link->tonode;
+ sockto = link->tosock;
- link->tonode= select;
- link->tosock= socket_best_match(&select->inputs);
+ link->tonode = select;
+ link->tosock = socket_best_match(&select->inputs);
link->flag &= ~NODE_LINKFLAG_HILITE;
nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs), node, sockto);
- ntreeUpdateTree(snode->edittree); /* needed for pointers */
+ ntreeUpdateTree(snode->edittree); /* needed for pointers */
snode_update(snode, select);
ED_node_changed_update(snode->id, select);
}
@@ -3422,44 +3432,44 @@ void ED_node_link_insert(ScrArea *sa)
void ED_node_link_intersect_test(ScrArea *sa, int test)
{
bNode *select;
- SpaceNode *snode= ed_node_link_conditions(sa, &select);
- bNodeLink *link, *selink=NULL;
+ SpaceNode *snode = ed_node_link_conditions(sa, &select);
+ bNodeLink *link, *selink = NULL;
float mcoords[6][2];
- if (snode==NULL) return;
+ if (snode == NULL) return;
/* clear flags */
- for (link= snode->edittree->links.first; link; link=link->next)
+ for (link = snode->edittree->links.first; link; link = link->next)
link->flag &= ~NODE_LINKFLAG_HILITE;
- if (test==0) return;
+ if (test == 0) return;
/* okay, there's 1 node, without links, now intersect */
- mcoords[0][0]= select->totr.xmin;
- mcoords[0][1]= select->totr.ymin;
- mcoords[1][0]= select->totr.xmax;
- mcoords[1][1]= select->totr.ymin;
- mcoords[2][0]= select->totr.xmax;
- mcoords[2][1]= select->totr.ymax;
- mcoords[3][0]= select->totr.xmin;
- mcoords[3][1]= select->totr.ymax;
- mcoords[4][0]= select->totr.xmin;
- mcoords[4][1]= select->totr.ymin;
- mcoords[5][0]= select->totr.xmax;
- mcoords[5][1]= select->totr.ymax;
+ mcoords[0][0] = select->totr.xmin;
+ mcoords[0][1] = select->totr.ymin;
+ mcoords[1][0] = select->totr.xmax;
+ mcoords[1][1] = select->totr.ymin;
+ mcoords[2][0] = select->totr.xmax;
+ mcoords[2][1] = select->totr.ymax;
+ mcoords[3][0] = select->totr.xmin;
+ mcoords[3][1] = select->totr.ymax;
+ mcoords[4][0] = select->totr.xmin;
+ mcoords[4][1] = select->totr.ymin;
+ mcoords[5][0] = select->totr.xmax;
+ mcoords[5][1] = select->totr.ymax;
/* we only tag a single link for intersect now */
/* idea; use header dist when more? */
- for (link= snode->edittree->links.first; link; link=link->next) {
+ for (link = snode->edittree->links.first; link; link = link->next) {
if (cut_links_intersect(link, mcoords, 5)) { /* intersect code wants edges */
if (selink)
break;
- selink= link;
+ selink = link;
}
}
- if (link==NULL && selink)
+ if (link == NULL && selink)
selink->flag |= NODE_LINKFLAG_HILITE;
}
@@ -3471,20 +3481,20 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
/* goes over all scenes, reads render layers */
static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- SpaceNode *snode= CTX_wm_space_node(C);
- Scene *curscene= CTX_data_scene(C), *scene;
+ Main *bmain = CTX_data_main(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ Scene *curscene = CTX_data_scene(C), *scene;
bNode *node;
ED_preview_kill_jobs(C);
/* first tag scenes unread */
- for (scene= bmain->scene.first; scene; scene= scene->id.next)
+ for (scene = bmain->scene.first; scene; scene = scene->id.next)
scene->id.flag |= LIB_DOIT;
- for (node= snode->edittree->nodes.first; node; node= node->next) {
- if (node->type==CMP_NODE_R_LAYERS) {
- ID *id= node->id;
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_R_LAYERS) {
+ ID *id = node->id;
if (id->flag & LIB_DOIT) {
RE_ReadRenderResult(curscene, (Scene *)id);
ntreeCompositTagRender((Scene *)id);
@@ -3516,10 +3526,10 @@ void NODE_OT_read_renderlayers(wmOperatorType *ot)
static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
{
- Main *bmain= CTX_data_main(C);
- SpaceNode *snode= CTX_wm_space_node(C);
- Scene *curscene= CTX_data_scene(C);
- Render *re= RE_NewRender(curscene->id.name);
+ Main *bmain = CTX_data_main(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ Scene *curscene = CTX_data_scene(C);
+ Render *re = RE_NewRender(curscene->id.name);
WM_cursor_wait(1);
RE_MergeFullSample(re, bmain, curscene, snode->nodetree);
@@ -3527,7 +3537,7 @@ static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
/* note we are careful to send the right notifier, as otherwise the
* compositor would reexecute and overwrite the full sample result */
- WM_event_add_notifier(C, NC_SCENE|ND_COMPO_RESULT, NULL);
+ WM_event_add_notifier(C, NC_SCENE | ND_COMPO_RESULT, NULL);
return OPERATOR_FINISHED;
}
@@ -3550,23 +3560,23 @@ void NODE_OT_read_fullsamplelayers(wmOperatorType *ot)
int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
{
- Scene *sce= CTX_data_scene(C);
+ 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) {
+ 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);
+ 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);
+ RNA_string_set(&op_ptr, "scene", sce->id.name + 2);
/* to keep keypositions */
sce->r.scemode |= R_NO_FRAME_UPDATE;
@@ -3607,35 +3617,35 @@ static int node_group_make_test(bNodeTree *ntree, bNode *gnode)
int totnode = 0;
/* is there something to group? also do some clearing */
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node == gnode)
continue;
if (node->flag & NODE_SELECT) {
/* no groups in groups */
- if (node->type==NODE_GROUP)
+ if (node->type == NODE_GROUP)
return 0;
totnode++;
}
node->done = 0;
}
- if (totnode==0) return 0;
+ if (totnode == 0) return 0;
/* check if all connections are OK, no unselected node has both
* inputs and outputs to a selection */
- for (link= ntree->links.first; link; link= link->next) {
+ for (link = ntree->links.first; link; link = link->next) {
if (link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT && link->fromnode != gnode)
link->tonode->done |= 1;
if (link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT && link->tonode != gnode)
link->fromnode->done |= 2;
}
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node == gnode)
continue;
- if ((node->flag & NODE_SELECT)==0)
- if (node->done==3)
+ if ((node->flag & NODE_SELECT) == 0)
+ if (node->done == 3)
break;
}
if (node)
@@ -3648,7 +3658,7 @@ static void node_get_selected_minmax(bNodeTree *ntree, bNode *gnode, float *min,
{
bNode *node;
INIT_MINMAX2(min, max);
- for (node= ntree->nodes.first; node; node= node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node == gnode)
continue;
if (node->flag & NODE_SELECT) {
@@ -3667,14 +3677,14 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
float min[2], max[2];
/* deselect all nodes in the target tree */
- for (node = ngroup->nodes.first; node; node=node->next)
+ for (node = ngroup->nodes.first; node; node = node->next)
node_deselect(node);
node_get_selected_minmax(ntree, gnode, min, max);
/* move nodes over */
- for (node= ntree->nodes.first; node; node= nextn) {
- nextn= node->next;
+ for (node = ntree->nodes.first; node; node = nextn) {
+ nextn = node->next;
if (node == gnode)
continue;
if (node->flag & NODE_SELECT) {
@@ -3700,14 +3710,14 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
BLI_remlink(&ntree->nodes, node);
BLI_addtail(&ngroup->nodes, node);
- node->locx-= 0.5f*(min[0]+max[0]);
- node->locy-= 0.5f*(min[1]+max[1]);
+ node->locx -= 0.5f * (min[0] + max[0]);
+ node->locy -= 0.5f * (min[1] + max[1]);
}
}
/* move animation data over */
if (ntree->adt) {
- LinkData *ld, *ldn=NULL;
+ LinkData *ld, *ldn = NULL;
BKE_animdata_separate_by_basepath(&ntree->id, &ngroup->id, &anim_basepaths);
@@ -3724,10 +3734,10 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
ntreeFreeCache(ngroup);
/* relink external sockets */
- for (link= ntree->links.first; link; link= linkn) {
+ for (link = ntree->links.first; link; link = linkn) {
int fromselect = (link->fromnode && (link->fromnode->flag & NODE_SELECT) && link->fromnode != gnode);
int toselect = (link->tonode && (link->tonode->flag & NODE_SELECT) && link->tonode != gnode);
- linkn= link->next;
+ linkn = link->next;
if (gnode && ((fromselect && link->tonode == gnode) || (toselect && link->fromnode == gnode))) {
/* remove all links to/from the gnode.
@@ -3747,8 +3757,8 @@ static int node_group_make_insert_selected(bNodeTree *ntree, bNode *gnode)
}
else if (fromselect) {
/* search for existing group node socket */
- for (gsock=ngroup->outputs.first; gsock; gsock=gsock->next)
- if (gsock->link && gsock->link->fromsock==link->fromsock)
+ for (gsock = ngroup->outputs.first; gsock; gsock = gsock->next)
+ if (gsock->link && gsock->link->fromsock == link->fromsock)
break;
if (!gsock) {
gsock = node_group_expose_socket(ngroup, link->fromsock, SOCK_OUT);
@@ -3779,14 +3789,14 @@ static bNode *node_group_make_from_selected(bNodeTree *ntree)
node_get_selected_minmax(ntree, NULL, min, max);
/* new nodetree */
- ngroup= ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP);
+ ngroup = ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP);
/* make group node */
ntemp.type = NODE_GROUP;
ntemp.ngroup = ngroup;
- gnode= nodeAddNode(ntree, &ntemp);
- gnode->locx= 0.5f*(min[0]+max[0]);
- gnode->locy= 0.5f*(min[1]+max[1]);
+ gnode = nodeAddNode(ntree, &ntemp);
+ gnode->locx = 0.5f * (min[0] + max[0]);
+ gnode->locy = 0.5f * (min[1] + max[1]);
node_group_make_insert_selected(ntree, gnode);
@@ -3814,16 +3824,16 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
bNode *gnode;
int type = RNA_enum_get(op->ptr, "type");
- if (snode->edittree!=snode->nodetree) {
+ if (snode->edittree != snode->nodetree) {
BKE_report(op->reports, RPT_WARNING, "Can not add a new Group in a Group");
return OPERATOR_CANCELLED;
}
/* for time being... is too complex to handle */
- if (snode->treetype==NTREE_COMPOSIT) {
- for (gnode=snode->nodetree->nodes.first; gnode; gnode= gnode->next) {
+ if (snode->treetype == NTREE_COMPOSIT) {
+ for (gnode = snode->nodetree->nodes.first; gnode; gnode = gnode->next) {
if (gnode->flag & SELECT)
- if (gnode->type==CMP_NODE_R_LAYERS)
+ if (gnode->type == CMP_NODE_R_LAYERS)
break;
}
@@ -3836,29 +3846,29 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
ED_preview_kill_jobs(C);
switch (type) {
- case NODE_GM_NEW:
- if (node_group_make_test(snode->nodetree, NULL)) {
- gnode = node_group_make_from_selected(snode->nodetree);
- }
- else {
- BKE_report(op->reports, RPT_WARNING, "Can not make Group");
- return OPERATOR_CANCELLED;
- }
- break;
- case NODE_GM_INSERT:
- gnode = nodeGetActive(snode->nodetree);
- if (!gnode || gnode->type != NODE_GROUP) {
- BKE_report(op->reports, RPT_WARNING, "No active Group node");
- return OPERATOR_CANCELLED;
- }
- if (node_group_make_test(snode->nodetree, gnode)) {
- node_group_make_insert_selected(snode->nodetree, gnode);
- }
- else {
- BKE_report(op->reports, RPT_WARNING, "Can not insert into Group");
- return OPERATOR_CANCELLED;
- }
- break;
+ case NODE_GM_NEW:
+ if (node_group_make_test(snode->nodetree, NULL)) {
+ gnode = node_group_make_from_selected(snode->nodetree);
+ }
+ else {
+ BKE_report(op->reports, RPT_WARNING, "Can not make Group");
+ return OPERATOR_CANCELLED;
+ }
+ break;
+ case NODE_GM_INSERT:
+ gnode = nodeGetActive(snode->nodetree);
+ if (!gnode || gnode->type != NODE_GROUP) {
+ BKE_report(op->reports, RPT_WARNING, "No active Group node");
+ return OPERATOR_CANCELLED;
+ }
+ if (node_group_make_test(snode->nodetree, gnode)) {
+ node_group_make_insert_selected(snode->nodetree, gnode);
+ }
+ else {
+ BKE_report(op->reports, RPT_WARNING, "Can not insert into Group");
+ return OPERATOR_CANCELLED;
+ }
+ break;
}
if (gnode) {
@@ -3909,7 +3919,7 @@ void NODE_OT_group_make(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", node_group_make_types, NODE_GM_NEW, "Type", "");
}
@@ -3919,18 +3929,18 @@ void NODE_OT_group_make(wmOperatorType *ot)
static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
{
bNode *node;
- int tot_eq= 0, tot_neq= 0;
+ int tot_eq = 0, tot_neq = 0;
/* Toggles the flag on all selected nodes.
* If the flag is set on all nodes it is unset.
* If the flag is not set on all nodes, it is set.
*/
- for (node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
- if (toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
+ if (toggle_flag == NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW) == 0)
continue;
- if (toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+ if (toggle_flag == NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS) == 0)
continue;
if (node->flag & toggle_flag)
@@ -3939,15 +3949,15 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
tot_neq++;
}
}
- for (node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
- if (toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
+ if (toggle_flag == NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW) == 0)
continue;
- if (toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+ if (toggle_flag == NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS) == 0)
continue;
- if ( (tot_eq && tot_neq) || tot_eq==0)
+ if ( (tot_eq && tot_neq) || tot_eq == 0)
node->flag |= toggle_flag;
else
node->flag &= ~toggle_flag;
@@ -3957,7 +3967,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
/* sanity checking (poll callback checks this already) */
if ((snode == NULL) || (snode->edittree == NULL))
@@ -3982,12 +3992,12 @@ void NODE_OT_hide_toggle(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
/* sanity checking (poll callback checks this already) */
if ((snode == NULL) || (snode->edittree == NULL))
@@ -4014,12 +4024,12 @@ void NODE_OT_preview_toggle(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
/* sanity checking (poll callback checks this already) */
if ((snode == NULL) || (snode->edittree == NULL))
@@ -4044,12 +4054,12 @@ void NODE_OT_options_toggle(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
int hidden;
@@ -4061,16 +4071,16 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
/* Toggle for all selected nodes */
hidden = 0;
- for (node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
if (node_has_hidden_sockets(node)) {
- hidden= 1;
+ hidden = 1;
break;
}
}
}
- for (node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
if (node->flag & SELECT) {
node_set_hidden_sockets(snode, node, !hidden);
}
@@ -4095,19 +4105,19 @@ void NODE_OT_hide_socket_toggle(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Mute operator *********************** */
static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
ED_preview_kill_jobs(C);
- for (node= snode->edittree->nodes.first; node; node= node->next) {
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
/* Only allow muting of nodes having a mute func! */
if ((node->flag & SELECT) && node->typeinfo->internal_connect) {
node->flag ^= NODE_MUTED;
@@ -4133,20 +4143,20 @@ void NODE_OT_mute_toggle(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Delete operator ******************* */
static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
bNode *node, *next;
ED_preview_kill_jobs(C);
- for (node= snode->edittree->nodes.first; node; node= next) {
- next= node->next;
+ for (node = snode->edittree->nodes.first; node; node = next) {
+ next = node->next;
if (node->flag & SELECT) {
/* check id user here, nodeFreeNode is called for free dbase too */
if (node->id)
@@ -4175,19 +4185,19 @@ void NODE_OT_delete(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Delete with reconnect ******************* */
static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
bNode *node, *next;
ED_preview_kill_jobs(C);
- for (node= snode->edittree->nodes.first; node; node= next) {
- next= node->next;
+ for (node = snode->edittree->nodes.first; node; node = next) {
+ next = node->next;
if (node->flag & SELECT) {
nodeInternalRelink(snode->edittree, node);
@@ -4218,14 +4228,14 @@ void NODE_OT_delete_reconnect(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Show Cyclic Dependencies Operator ******************* */
static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
/* this is just a wrapper around this call... */
ntreeUpdateTree(snode->nodetree);
@@ -4246,18 +4256,18 @@ void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Add File Node Operator ******************* */
static int node_add_file_exec(bContext *C, wmOperator *op)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
- SpaceNode *snode= CTX_wm_space_node(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
bNode *node;
- Image *ima= NULL;
+ Image *ima = NULL;
bNodeTemplate ntemp;
/* check input variables */
@@ -4265,9 +4275,9 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
- errno= 0;
+ errno = 0;
- ima= BKE_image_load_exists(path);
+ ima = BKE_image_load_exists(path);
if (!ima) {
BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s", path, errno ? strerror(errno) : "Unsupported image format");
@@ -4275,9 +4285,9 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
}
}
else if (RNA_struct_property_is_set(op->ptr, "name")) {
- char name[MAX_ID_NAME-2];
+ char name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "name", name);
- ima= (Image *)BKE_libblock_find_name(ID_IM, name);
+ ima = (Image *)BKE_libblock_find_name(ID_IM, name);
if (!ima) {
BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found", name);
@@ -4320,12 +4330,12 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
static int node_add_file_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- SpaceNode *snode= CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
- &snode->mx, &snode->my);
+ &snode->mx, &snode->my);
if (RNA_struct_property_is_set(op->ptr, "filepath") || RNA_struct_property_is_set(op->ptr, "name"))
return node_add_file_exec(C, op);
@@ -4346,10 +4356,10 @@ void NODE_OT_add_file(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
- RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Datablock name to assign");
+ WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY); //XXX TODO, relative_path
+ RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Datablock name to assign");
}
/********************** New node tree operator *********************/
@@ -4361,10 +4371,10 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
PointerRNA ptr, idptr;
PropertyRNA *prop;
int treetype;
- char treename[MAX_ID_NAME-2] = "NodeTree";
+ char treename[MAX_ID_NAME - 2] = "NodeTree";
/* retrieve state */
- snode= CTX_wm_space_node(C);
+ snode = CTX_wm_space_node(C);
if (RNA_struct_property_is_set(op->ptr, "type"))
treetype = RNA_enum_get(op->ptr, "type");
@@ -4391,7 +4401,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
RNA_property_update(C, &ptr, prop);
}
else if (snode) {
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
snode->nodetree = ntree;
ED_node_tree_update(snode, scene);
@@ -4412,18 +4422,18 @@ void NODE_OT_new_node_tree(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "type", nodetree_type_items, NTREE_COMPOSIT, "Tree Type", "");
- RNA_def_string(ot->srna, "name", "NodeTree", MAX_ID_NAME-2, "Name", "");
+ RNA_def_string(ot->srna, "name", "NodeTree", MAX_ID_NAME - 2, "Name", "");
}
/* ****************** File Output Add Socket ******************* */
static int node_output_file_add_socket_exec(bContext *C, wmOperator *op)
{
- Scene *scene= CTX_data_scene(C);
- SpaceNode *snode= CTX_wm_space_node(C);
+ Scene *scene = CTX_data_scene(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
PointerRNA ptr;
bNodeTree *ntree;
bNode *node;
@@ -4455,7 +4465,7 @@ void NODE_OT_output_file_add_socket(wmOperatorType *ot)
ot->poll = composite_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_string(ot->srna, "file_path", "Image", MAX_NAME, "File Path", "Sub-path of the output file");
}
@@ -4464,7 +4474,7 @@ void NODE_OT_output_file_add_socket(wmOperatorType *ot)
static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
PointerRNA ptr = CTX_data_pointer_get(C, "node");
bNodeTree *ntree;
bNode *node;
@@ -4494,14 +4504,14 @@ void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot)
ot->poll = composite_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Multi File Output Move Socket ******************* */
static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op)
{
- SpaceNode *snode= CTX_wm_space_node(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
PointerRNA ptr = CTX_data_pointer_get(C, "node");
bNode *node;
NodeImageMultiFile *nimf;
@@ -4519,7 +4529,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op)
direction = RNA_enum_get(op->ptr, "direction");
- if (direction==1) {
+ if (direction == 1) {
bNodeSocket *before = sock->prev;
if (!before)
return OPERATOR_CANCELLED;
@@ -4546,7 +4556,8 @@ void NODE_OT_output_file_move_active_socket(wmOperatorType *ot)
static EnumPropertyItem direction_items[] = {
{1, "UP", 0, "Up", ""},
{2, "DOWN", 0, "Down", ""},
- { 0, NULL, 0, NULL, NULL }};
+ { 0, NULL, 0, NULL, NULL }
+ };
/* identifiers */
ot->name = "Move File Node Socket";
@@ -4558,7 +4569,7 @@ void NODE_OT_output_file_move_active_socket(wmOperatorType *ot)
ot->poll = composite_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_enum(ot->srna, "direction", direction_items, 2, "Direction", "");
}
@@ -4577,7 +4588,7 @@ static int node_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
if (!node)
return OPERATOR_CANCELLED;
- for (tnode=ntree->nodes.first; tnode; tnode=tnode->next) {
+ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) {
if (tnode->flag & NODE_SELECT && tnode != node) {
if (node->flag & NODE_CUSTOM_COLOR) {
tnode->flag |= NODE_CUSTOM_COLOR;
@@ -4589,7 +4600,7 @@ static int node_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
}
ED_node_sort(ntree);
- WM_event_add_notifier(C, NC_NODE|ND_DISPLAY, NULL);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -4606,7 +4617,7 @@ void NODE_OT_node_copy_color(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Set Parent ******************* */
@@ -4619,7 +4630,7 @@ static int node_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
if (!frame || frame->type != NODE_FRAME)
return OPERATOR_CANCELLED;
- for (node=ntree->nodes.first; node; node=node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node == frame)
continue;
if (node->flag & NODE_SELECT) {
@@ -4629,7 +4640,7 @@ static int node_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
}
ED_node_sort(ntree);
- WM_event_add_notifier(C, NC_NODE|ND_DISPLAY, NULL);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -4646,7 +4657,7 @@ void NODE_OT_parent_set(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Clear Parent ******************* */
@@ -4657,13 +4668,13 @@ static int node_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
bNodeTree *ntree = snode->edittree;
bNode *node;
- for (node=ntree->nodes.first; node; node=node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & NODE_SELECT) {
nodeDetachNode(node);
}
}
- WM_event_add_notifier(C, NC_NODE|ND_DISPLAY, NULL);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -4680,14 +4691,14 @@ void NODE_OT_parent_clear(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Join Nodes ******************* */
/* tags for depth-first search */
-#define NODE_JOIN_DONE 1
-#define NODE_JOIN_IS_DESCENDANT 2
+#define NODE_JOIN_DONE 1
+#define NODE_JOIN_IS_DESCENDANT 2
static void node_join_attach_recursive(bNode *node, bNode *frame)
{
@@ -4727,7 +4738,7 @@ static int node_join_exec(bContext *C, wmOperator *UNUSED(op))
bNodeTemplate ntemp;
/* XXX save selection: node_add_node call below sets the new frame as single active+selected node */
- for (node=ntree->nodes.first; node; node=node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & NODE_SELECT)
node->flag |= NODE_TEST;
else
@@ -4740,22 +4751,22 @@ static int node_join_exec(bContext *C, wmOperator *UNUSED(op))
frame = node_add_node(snode, bmain, scene, &ntemp, 0.0f, 0.0f);
/* reset tags */
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
node->done = 0;
- for (node=ntree->nodes.first; node; node=node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (!(node->done & NODE_JOIN_DONE))
node_join_attach_recursive(node, frame);
}
/* restore selection */
- for (node=ntree->nodes.first; node; node=node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (node->flag & NODE_TEST)
node->flag |= NODE_SELECT;
}
ED_node_sort(ntree);
- WM_event_add_notifier(C, NC_NODE|ND_DISPLAY, NULL);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -4772,7 +4783,7 @@ void NODE_OT_join(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Attach ******************* */
@@ -4784,7 +4795,7 @@ static int node_attach_exec(bContext *C, wmOperator *UNUSED(op))
bNode *frame;
/* check nodes front to back */
- for (frame=ntree->nodes.last; frame; frame=frame->prev) {
+ for (frame = ntree->nodes.last; frame; frame = frame->prev) {
/* skip selected, those are the nodes we want to attach */
if ((frame->type != NODE_FRAME) || (frame->flag & NODE_SELECT))
continue;
@@ -4793,7 +4804,7 @@ static int node_attach_exec(bContext *C, wmOperator *UNUSED(op))
}
if (frame) {
bNode *node, *parent;
- for (node=ntree->nodes.last; node; node=node->prev) {
+ for (node = ntree->nodes.last; node; node = node->prev) {
if (node->flag & NODE_SELECT) {
if (node->parent == NULL) {
/* attach all unparented nodes */
@@ -4801,7 +4812,7 @@ static int node_attach_exec(bContext *C, wmOperator *UNUSED(op))
}
else {
/* attach nodes which share parent with the frame */
- for (parent=frame->parent; parent; parent=parent->parent)
+ for (parent = frame->parent; parent; parent = parent->parent)
if (parent == node->parent)
break;
if (parent) {
@@ -4814,15 +4825,15 @@ static int node_attach_exec(bContext *C, wmOperator *UNUSED(op))
}
ED_node_sort(ntree);
- WM_event_add_notifier(C, NC_NODE|ND_DISPLAY, NULL);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
static int node_attach_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- ARegion *ar= CTX_wm_region(C);
- SpaceNode *snode= CTX_wm_space_node(C);
+ ARegion *ar = CTX_wm_region(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &snode->mx, &snode->my);
@@ -4843,14 +4854,14 @@ void NODE_OT_attach(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/* ****************** Detach ******************* */
/* tags for depth-first search */
-#define NODE_DETACH_DONE 1
-#define NODE_DETACH_IS_DESCENDANT 2
+#define NODE_DETACH_DONE 1
+#define NODE_DETACH_IS_DESCENDANT 2
static void node_detach_recursive(bNode *node)
{
@@ -4883,18 +4894,18 @@ static int node_detach_exec(bContext *C, wmOperator *UNUSED(op))
bNode *node;
/* reset tags */
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
node->done = 0;
/* detach nodes recursively
* relative order is preserved here!
*/
- for (node=ntree->nodes.first; node; node=node->next) {
+ for (node = ntree->nodes.first; node; node = node->next) {
if (!(node->done & NODE_DETACH_DONE))
node_detach_recursive(node);
}
ED_node_sort(ntree);
- WM_event_add_notifier(C, NC_NODE|ND_DISPLAY, NULL);
+ WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
}
@@ -4911,5 +4922,5 @@ void NODE_OT_detach(wmOperatorType *ot)
ot->poll = ED_operator_node_active;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 0d03df2298f..d4cfa2a3ba2 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -239,7 +239,7 @@ static void node_menu_add(const bContext *C, Menu *menu)
bNodeTreeType *ntreetype= ntreeGetType(snode->treetype);
if (!snode->nodetree)
- uiLayoutSetActive(layout, 0);
+ uiLayoutSetActive(layout, FALSE);
if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, layout, node_menu_add_foreach_cb);
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 97e64c4acdf..f12c7941e1d 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -68,11 +68,11 @@ static void node_tag_recursive(bNode *node)
bNodeSocket *input;
if (!node || (node->flag & NODE_TEST))
- return; /* in case of cycles */
-
+ return; /* in case of cycles */
+
node->flag |= NODE_TEST;
- for (input=node->inputs.first; input; input=input->next)
+ for (input = node->inputs.first; input; input = input->next)
if (input->link)
node_tag_recursive(input->link->fromnode);
}
@@ -82,11 +82,11 @@ static void node_clear_recursive(bNode *node)
bNodeSocket *input;
if (!node || !(node->flag & NODE_TEST))
- return; /* in case of cycles */
-
+ return; /* in case of cycles */
+
node->flag &= ~NODE_TEST;
- for (input=node->inputs.first; input; input=input->next)
+ for (input = node->inputs.first; input; input = input->next)
if (input->link)
node_clear_recursive(input->link->fromnode);
}
@@ -100,20 +100,20 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
return;
/* tag linked nodes to be removed */
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
node->flag &= ~NODE_TEST;
-
+
node_tag_recursive(rem_node);
/* clear tags on nodes that are still used by other nodes */
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
if (!(node->flag & NODE_TEST))
- for (sock=node->inputs.first; sock; sock=sock->next)
+ for (sock = node->inputs.first; sock; sock = sock->next)
if (sock->link && sock->link->fromnode != rem_node)
node_clear_recursive(sock->link->fromnode);
/* remove nodes */
- for (node=ntree->nodes.first; node; node=next) {
+ for (node = ntree->nodes.first; node; node = next) {
next = node->next;
if (node->flag & NODE_TEST) {
@@ -166,7 +166,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
}
/* find existing node that we can use */
- for (node_from=ntree->nodes.first; node_from; node_from=node_from->next)
+ for (node_from = ntree->nodes.first; node_from; node_from = node_from->next)
if (node_from->type == ntemp->type)
break;
@@ -181,7 +181,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
node_from = node_prev;
}
else if (!node_from) {
- node_from= nodeAddNode(ntree, ntemp);
+ node_from = nodeAddNode(ntree, ntemp);
node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
node_from->locy = node_to->locy;
@@ -199,11 +199,11 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
if (node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
- for (sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
- for (sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
+ for (sock_prev = node_prev->inputs.first; sock_prev; sock_prev = sock_prev->next) {
+ for (sock_from = node_from->inputs.first; sock_from; sock_from = sock_from->next) {
if (nodeCountSocketLinks(ntree, sock_from) >= sock_from->limit)
continue;
-
+
if (strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
bNodeLink *link = sock_prev->link;
@@ -239,9 +239,9 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
/****************************** Node Link Menu *******************************/
-#define UI_NODE_LINK_ADD 0
-#define UI_NODE_LINK_DISCONNECT -1
-#define UI_NODE_LINK_REMOVE -2
+#define UI_NODE_LINK_ADD 0
+#define UI_NODE_LINK_DISCONNECT -1
+#define UI_NODE_LINK_REMOVE -2
typedef struct NodeLinkArg {
Main *bmain;
@@ -259,7 +259,7 @@ typedef struct NodeLinkArg {
static void ui_node_link(bContext *C, void *arg_p, void *event_p)
{
- NodeLinkArg *arg = (NodeLinkArg*)arg_p;
+ NodeLinkArg *arg = (NodeLinkArg *)arg_p;
Main *bmain = arg->bmain;
bNode *node_to = arg->node;
bNodeSocket *sock_to = arg->sock;
@@ -278,7 +278,7 @@ static void ui_node_link(bContext *C, void *arg_p, void *event_p)
node_socket_remove(bmain, ntree, node_to, sock_to);
else
node_socket_add_replace(bmain, ntree, node_to, sock_to, &ntemp, arg->output);
-
+
ED_undo_push(C, "Node input modify");
}
@@ -290,7 +290,7 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
if (node->type == NODE_GROUP) {
if (node->id)
- BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
+ BLI_strncpy(node_name, node->id->name + 2, UI_MAX_NAME_STR);
else
BLI_strncpy(node_name, N_("Group"), UI_MAX_NAME_STR);
}
@@ -331,17 +331,17 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
bNodeTree *ngroup;
NodeLinkArg *argN;
int first = 1;
- int compatibility= 0;
+ int compatibility = 0;
if (ntree->type == NTREE_SHADER) {
if (BKE_scene_use_new_shading_nodes(arg->scene))
- compatibility= NODE_NEW_SHADING;
+ compatibility = NODE_NEW_SHADING;
else
- compatibility= NODE_OLD_SHADING;
+ compatibility = NODE_OLD_SHADING;
}
if (nclass == NODE_CLASS_GROUP) {
- for (ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
+ for (ngroup = bmain->nodetree.first; ngroup; ngroup = ngroup->id.next) {
bNodeSocket *gsock;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
@@ -349,40 +349,40 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (ngroup->type != ntree->type)
continue;
- for (gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
+ for (gsock = ngroup->inputs.first; gsock; gsock = gsock->next)
if (ui_compatible_sockets(gsock->type, sock->type))
num++;
- for (i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
+ for (i = 0, j = 0, gsock = ngroup->outputs.first; gsock; gsock = gsock->next, i++) {
if (!ui_compatible_sockets(gsock->type, sock->type))
continue;
if (first) {
- column= uiLayoutColumn(layout, 0);
+ column = uiLayoutColumn(layout, FALSE);
uiBlockSetCurLayout(block, column);
uiItemL(column, IFACE_(cname), ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
first = 0;
}
if (num > 1) {
if (j == 0) {
- uiItemL(column, ngroup->id.name+2, ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ uiItemL(column, ngroup->id.name + 2, ICON_NODE);
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
}
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", gsock->name);
j++;
}
else
- BLI_strncpy(name, ngroup->id.name+2, UI_MAX_NAME_STR);
+ BLI_strncpy(name, ngroup->id.name + 2, UI_MAX_NAME_STR);
- but = uiDefBut(block, BUT, 0, ngroup->id.name+2, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
+ but = uiDefBut(block, BUT, 0, ngroup->id.name + 2, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
argN = MEM_dupallocN(arg);
argN->type = NODE_GROUP;
@@ -393,9 +393,9 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
}
}
else {
- bNodeTreeType *ttype= ntreeGetType(ntree->type);
+ bNodeTreeType *ttype = ntreeGetType(ntree->type);
- for (ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
+ for (ntype = ttype->node_types.first; ntype; ntype = ntype->next) {
bNodeSocketTemplate *stemp;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
@@ -406,21 +406,21 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (ntype->nclass != nclass)
continue;
- for (i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
+ for (i = 0, stemp = ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
if (ui_compatible_sockets(stemp->type, sock->type))
num++;
- for (i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
+ for (i = 0, j = 0, stemp = ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
if (!ui_compatible_sockets(stemp->type, sock->type))
continue;
if (first) {
- column= uiLayoutColumn(layout, 0);
+ column = uiLayoutColumn(layout, FALSE);
uiBlockSetCurLayout(block, column);
uiItemL(column, IFACE_(cname), ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
first = 0;
}
@@ -428,8 +428,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (num > 1) {
if (j == 0) {
uiItemL(column, IFACE_(ntype->name), ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
}
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", IFACE_(stemp->name));
@@ -438,8 +438,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
else
BLI_strncpy(name, IFACE_(ntype->name), UI_MAX_NAME_STR);
- but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
+ but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
argN = MEM_dupallocN(arg);
argN->type = ntype->type;
@@ -452,7 +452,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *name)
{
- NodeLinkArg *arg = (NodeLinkArg*)calldata;
+ NodeLinkArg *arg = (NodeLinkArg *)calldata;
if (!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
ui_node_menu_column(arg, nclass, name);
@@ -460,39 +460,39 @@ static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *
static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_p)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
uiBlock *block = uiLayoutGetBlock(layout);
- uiBut *but = (uiBut*)but_p;
+ uiBut *but = (uiBut *)but_p;
uiLayout *split, *column;
- NodeLinkArg *arg = (NodeLinkArg*)but->func_argN;
+ NodeLinkArg *arg = (NodeLinkArg *)but->func_argN;
bNodeSocket *sock = arg->sock;
- bNodeTreeType *ntreetype= ntreeGetType(arg->ntree->type);
+ bNodeTreeType *ntreetype = ntreeGetType(arg->ntree->type);
uiBlockSetCurLayout(block, layout);
- split= uiLayoutSplit(layout, 0, 0);
+ split = uiLayoutSplit(layout, 0.0f, FALSE);
+
+ arg->bmain = bmain;
+ arg->scene = scene;
+ arg->layout = split;
- arg->bmain= bmain;
- arg->scene= scene;
- arg->layout= split;
-
if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb);
- column= uiLayoutColumn(split, 0);
+ column = uiLayoutColumn(split, FALSE);
uiBlockSetCurLayout(block, column);
if (sock->link) {
uiItemL(column, IFACE_("Link"), ICON_NONE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
- but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input"));
+ but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input"));
uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_REMOVE));
- but = uiDefBut(block, BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input"));
+ but = uiDefBut(block, BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input"));
uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT));
}
@@ -517,14 +517,14 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
if (sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
char name[UI_MAX_NAME_STR];
ui_node_sock_name(sock, name);
- but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
+ but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, "");
}
else
but = uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
- but->type= MENU;
- but->flag |= UI_TEXT_LEFT|UI_BUT_NODE_LINK;
- but->poin= (char*)but;
+ but->type = MENU;
+ but->flag |= UI_TEXT_LEFT | UI_BUT_NODE_LINK;
+ but->poin = (char *)but;
but->func_argN = arg;
if (sock->link && sock->link->fromnode)
@@ -535,7 +535,7 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
/**************************** Node Tree Layout *******************************/
static void ui_node_draw_input(uiLayout *layout, bContext *C,
- bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth);
+ bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth);
static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, int depth)
{
@@ -547,16 +547,16 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b
if (node->typeinfo->uifunc) {
if (node->type != NODE_GROUP) {
- split = uiLayoutSplit(layout, 0.35f, 0);
- col = uiLayoutColumn(split, 0);
- col = uiLayoutColumn(split, 0);
+ split = uiLayoutSplit(layout, 0.35f, FALSE);
+ col = uiLayoutColumn(split, FALSE);
+ col = uiLayoutColumn(split, FALSE);
node->typeinfo->uifunc(col, C, &nodeptr);
}
}
- for (input=node->inputs.first; input; input=input->next)
- ui_node_draw_input(layout, C, ntree, node, input, depth+1);
+ for (input = node->inputs.first; input; input = input->next)
+ ui_node_draw_input(layout, C, ntree, node, input, depth + 1);
}
static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth)
@@ -567,7 +567,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
uiLayout *split, *row, *col;
bNode *lnode;
char label[UI_MAX_NAME_STR];
- int indent = (depth > 1)? 2*(depth - 1): 0;
+ int indent = (depth > 1) ? 2 * (depth - 1) : 0;
int dependency_loop;
if (input->flag & SOCK_UNAVAIL)
@@ -575,7 +575,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
/* to avoid eternal loops on cyclic dependencies */
node->flag |= NODE_TEST;
- lnode = (input->link)? input->link->fromnode: NULL;
+ lnode = (input->link) ? input->link->fromnode : NULL;
dependency_loop = (lnode && (lnode->flag & NODE_TEST));
if (dependency_loop)
@@ -590,32 +590,32 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
BLI_snprintf(label, UI_MAX_NAME_STR, "%s%s:", label, IFACE_(input->name));
/* split in label and value */
- split = uiLayoutSplit(layout, 0.35f, 0);
+ split = uiLayoutSplit(layout, 0.35f, FALSE);
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
if (depth > 0) {
uiBlockSetEmboss(block, UI_EMBOSSN);
if (lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) {
- int icon = (input->flag & SOCK_COLLAPSED)? ICON_DISCLOSURE_TRI_RIGHT: ICON_DISCLOSURE_TRI_DOWN;
+ int icon = (input->flag & SOCK_COLLAPSED) ? ICON_DISCLOSURE_TRI_RIGHT : ICON_DISCLOSURE_TRI_DOWN;
uiItemR(row, &inputptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", icon);
}
else
uiItemL(row, "", ICON_BLANK1);
bt = block->buttons.last;
- bt->x2 = UI_UNIT_X/2;
+ bt->x2 = UI_UNIT_X / 2;
uiBlockSetEmboss(block, UI_EMBOSS);
}
uiItemL(row, label, ICON_NONE);
- bt= block->buttons.last;
- bt->flag= UI_TEXT_LEFT;
+ bt = block->buttons.last;
+ bt->flag = UI_TEXT_LEFT;
if (dependency_loop) {
- row = uiLayoutRow(split, 0);
+ row = uiLayoutRow(split, FALSE);
uiItemL(row, IFACE_("Dependency Loop"), ICON_ERROR);
}
else if (lnode) {
@@ -633,18 +633,18 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
/* input not linked, show value */
if (input->type != SOCK_SHADER && !(input->flag & SOCK_HIDE_VALUE)) {
if (input->type == SOCK_VECTOR) {
- row = uiLayoutRow(split, 0);
- col = uiLayoutColumn(row, 0);
+ row = uiLayoutRow(split, FALSE);
+ col = uiLayoutColumn(row, FALSE);
uiItemR(col, &inputptr, "default_value", 0, "", 0);
}
else {
- row = uiLayoutRow(split, 1);
+ row = uiLayoutRow(split, TRUE);
uiItemR(row, &inputptr, "default_value", 0, "", 0);
}
}
else
- row = uiLayoutRow(split, 0);
+ row = uiLayoutRow(split, FALSE);
uiTemplateNodeLink(row, ntree, node, input);
}
@@ -661,7 +661,7 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
return;
/* clear for cycle check */
- for (tnode=ntree->nodes.first; tnode; tnode=tnode->next)
+ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next)
tnode->flag &= ~NODE_TEST;
if (input)
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index e069ba2a5fc..349259ad71b 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -4,7 +4,7 @@
* 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.
+ * 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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -63,7 +63,7 @@
#include "RNA_access.h"
-#include "node_intern.h" // own include
+#include "node_intern.h" // own include
/* ******************** manage regions ********************* */
@@ -71,23 +71,23 @@ ARegion *node_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
- ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
-
+
/* add subdiv level; after header */
- ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if (ar==NULL) return NULL;
-
- arnew= MEM_callocN(sizeof(ARegion), "buttons for node");
-
+ if (ar == NULL) return NULL;
+
+ arnew = MEM_callocN(sizeof(ARegion), "buttons for node");
+
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
- arnew->regiontype= RGN_TYPE_UI;
- arnew->alignment= RGN_ALIGN_RIGHT;
-
+ arnew->regiontype = RGN_TYPE_UI;
+ arnew->alignment = RGN_ALIGN_RIGHT;
+
arnew->flag = RGN_FLAG_HIDDEN;
-
+
return arnew;
}
@@ -97,64 +97,64 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceNode *snode;
-
- snode= MEM_callocN(sizeof(SpaceNode), "initnode");
- snode->spacetype= SPACE_NODE;
-
+
+ snode = MEM_callocN(sizeof(SpaceNode), "initnode");
+ snode->spacetype = SPACE_NODE;
+
/* backdrop */
snode->zoom = 1.0f;
-
+
/* header */
- ar= MEM_callocN(sizeof(ARegion), "header for node");
-
+ ar = MEM_callocN(sizeof(ARegion), "header for node");
+
BLI_addtail(&snode->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
-
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_BOTTOM;
+
/* buttons/list view */
- ar= MEM_callocN(sizeof(ARegion), "buttons for node");
-
+ ar = MEM_callocN(sizeof(ARegion), "buttons for node");
+
BLI_addtail(&snode->regionbase, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_RIGHT;
+ ar->regiontype = RGN_TYPE_UI;
+ ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
-
+
/* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for node");
-
+ ar = MEM_callocN(sizeof(ARegion), "main area for node");
+
BLI_addtail(&snode->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
-
+ ar->regiontype = RGN_TYPE_WINDOW;
+
ar->v2d.tot.xmin = -256.0f;
ar->v2d.tot.ymin = -256.0f;
ar->v2d.tot.xmax = 768.0f;
ar->v2d.tot.ymax = 768.0f;
-
+
ar->v2d.cur.xmin = -256.0f;
ar->v2d.cur.ymin = -256.0f;
ar->v2d.cur.xmax = 768.0f;
ar->v2d.cur.ymax = 768.0f;
-
- ar->v2d.min[0]= 1.0f;
- ar->v2d.min[1]= 1.0f;
-
- ar->v2d.max[0]= 32000.0f;
- ar->v2d.max[1]= 32000.0f;
-
- ar->v2d.minzoom= 0.09f;
- ar->v2d.maxzoom= 2.31f;
-
- ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
- ar->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
- ar->v2d.keeptot= 0;
-
+
+ ar->v2d.min[0] = 1.0f;
+ ar->v2d.min[1] = 1.0f;
+
+ ar->v2d.max[0] = 32000.0f;
+ ar->v2d.max[1] = 32000.0f;
+
+ ar->v2d.minzoom = 0.09f;
+ ar->v2d.maxzoom = 2.31f;
+
+ ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
+ ar->v2d.keeptot = 0;
+
return (SpaceLink *)snode;
}
/* not spacelink itself */
static void node_free(SpaceLink *UNUSED(sl))
-{
-
+{
+
}
@@ -167,10 +167,10 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
{
/* note, ED_area_tag_refresh will re-execute compositor */
- SpaceNode *snode= sa->spacedata.first;
- int type= snode->treetype;
+ SpaceNode *snode = sa->spacedata.first;
+ int type = snode->treetype;
short shader_type = snode->shaderfrom;
-
+
/* preview renders */
switch (wmn->category) {
case NC_SCENE:
@@ -183,9 +183,9 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case ND_TRANSFORM_DONE:
- if (type==NTREE_COMPOSIT) {
+ if (type == NTREE_COMPOSIT) {
if (snode->flag & SNODE_AUTO_RENDER) {
- snode->recalc= 1;
+ snode->recalc = 1;
ED_area_tag_refresh(sa);
}
}
@@ -193,43 +193,43 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_WM:
- if (wmn->data==ND_FILEREAD)
+ if (wmn->data == ND_FILEREAD)
ED_area_tag_refresh(sa);
break;
-
+
/* future: add ID checks? */
case NC_MATERIAL:
- if (type==NTREE_SHADER) {
- if (wmn->data==ND_SHADING)
+ if (type == NTREE_SHADER) {
+ if (wmn->data == ND_SHADING)
ED_area_tag_refresh(sa);
- else if (wmn->data==ND_SHADING_DRAW)
+ else if (wmn->data == ND_SHADING_DRAW)
ED_area_tag_refresh(sa);
- else if (wmn->action==NA_ADDED && snode->edittree)
+ else if (wmn->action == NA_ADDED && snode->edittree)
nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
-
+
}
break;
case NC_TEXTURE:
- if (type==NTREE_SHADER || type==NTREE_TEXTURE) {
- if (wmn->data==ND_NODES)
+ if (type == NTREE_SHADER || type == NTREE_TEXTURE) {
+ if (wmn->data == ND_NODES)
ED_area_tag_refresh(sa);
}
break;
case NC_WORLD:
- if (type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
- ED_area_tag_refresh(sa);
+ if (type == NTREE_SHADER && shader_type == SNODE_SHADER_WORLD) {
+ ED_area_tag_refresh(sa);
}
break;
case NC_OBJECT:
- if (type==NTREE_SHADER) {
- if (wmn->data==ND_OB_SHADING)
+ if (type == NTREE_SHADER) {
+ if (wmn->data == ND_OB_SHADING)
ED_area_tag_refresh(sa);
}
break;
case NC_SPACE:
- if (wmn->data==ND_SPACE_NODE)
+ if (wmn->data == ND_SPACE_NODE)
ED_area_tag_refresh(sa);
- else if (wmn->data==ND_SPACE_NODE_VIEW)
+ else if (wmn->data == ND_SPACE_NODE_VIEW)
ED_area_tag_redraw(sa);
break;
case NC_NODE:
@@ -247,7 +247,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_MASK:
if (wmn->action == NA_EDITED) {
- if (type==NTREE_COMPOSIT) {
+ if (type == NTREE_COMPOSIT) {
ED_area_tag_refresh(sa);
}
}
@@ -255,7 +255,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
case NC_IMAGE:
if (wmn->action == NA_EDITED) {
- if (type==NTREE_COMPOSIT) {
+ if (type == NTREE_COMPOSIT) {
/* note that nodeUpdateID is already called by BKE_image_signal() on all
* scenes so really this is just to know if the images is used in the compo else
* painting on images could become very slow when the compositor is open. */
@@ -270,42 +270,42 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
{
/* default now: refresh node is starting preview */
- SpaceNode *snode= sa->spacedata.first;
+ SpaceNode *snode = sa->spacedata.first;
snode_set_context(snode, CTX_data_scene(C));
-
+
if (snode->nodetree) {
- if (snode->treetype==NTREE_SHADER) {
+ if (snode->treetype == NTREE_SHADER) {
if (GS(snode->id->name) == ID_MA) {
- Material *ma= (Material *)snode->id;
+ Material *ma = (Material *)snode->id;
if (ma->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_LA) {
- Lamp *la= (Lamp *)snode->id;
+ Lamp *la = (Lamp *)snode->id;
if (la->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_WO) {
- World *wo= (World *)snode->id;
+ World *wo = (World *)snode->id;
if (wo->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
}
- else if (snode->treetype==NTREE_COMPOSIT) {
- Scene *scene= (Scene *)snode->id;
+ else if (snode->treetype == NTREE_COMPOSIT) {
+ Scene *scene = (Scene *)snode->id;
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);
+ snode->recalc = 0;
+ node_render_changed_exec((struct bContext *)C, NULL);
}
- else
+ else
snode_composite_job(C, sa);
}
}
- else if (snode->treetype==NTREE_TEXTURE) {
- Tex *tex= (Tex *)snode->id;
+ else if (snode->treetype == NTREE_TEXTURE) {
+ Tex *tex = (Tex *)snode->id;
if (tex->use_nodes) {
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
@@ -315,12 +315,12 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
static SpaceLink *node_duplicate(SpaceLink *sl)
{
- SpaceNode *snoden= MEM_dupallocN(sl);
-
+ SpaceNode *snoden = MEM_dupallocN(sl);
+
/* clear or remove stuff from old */
- snoden->nodetree= NULL;
- snoden->linkdrag.first= snoden->linkdrag.last= NULL;
-
+ snoden->nodetree = NULL;
+ snoden->linkdrag.first = snoden->linkdrag.last = NULL;
+
return (SpaceLink *)snoden;
}
@@ -331,7 +331,7 @@ static void node_buttons_area_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
ED_region_panels_init(wm, ar);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -343,12 +343,12 @@ static void node_buttons_area_draw(const bContext *C, ARegion *ar)
static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
{
- SpaceNode *snode= sa->spacedata.first;
-
+ SpaceNode *snode = sa->spacedata.first;
+
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(&ar->v2d, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin,
&snode->mx, &snode->my);
-
+
node_set_cursor(win, snode);
}
@@ -357,26 +357,26 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
ListBase *lb;
-
+
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
-
+
/* own keymaps */
keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-
+
/* add drop boxes */
lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
-
+
WM_event_add_dropbox_handler(&ar->handlers, lb);
}
static void node_main_area_draw(const bContext *C, ARegion *ar)
{
- View2D *v2d= &ar->v2d;
-
+ View2D *v2d = &ar->v2d;
+
drawnodespace(C, ar, v2d);
}
@@ -385,13 +385,13 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if (drag->type==WM_DRAG_ID) {
- ID *id= (ID *)drag->poin;
- if ( GS(id->name)==ID_IM )
+ if (drag->type == WM_DRAG_ID) {
+ ID *id = (ID *)drag->poin;
+ if (GS(id->name) == ID_IM)
return 1;
}
- else if (drag->type==WM_DRAG_PATH) {
- if (ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
+ else if (drag->type == WM_DRAG_PATH) {
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
return 1;
}
return 0;
@@ -399,10 +399,10 @@ static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve
static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
- ID *id= (ID *)drag->poin;
-
+ ID *id = (ID *)drag->poin;
+
if (id) {
- RNA_string_set(drop->ptr, "name", id->name+2);
+ RNA_string_set(drop->ptr, "name", id->name + 2);
}
if (drag->path[0]) {
RNA_string_set(drop->ptr, "filepath", drag->path);
@@ -412,10 +412,10 @@ static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
/* this region dropbox definition */
static void node_dropboxes(void)
{
- ListBase *lb= WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
-
+ ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
+
WM_dropbox_add(lb, "NODE_OT_add_file", node_drop_poll, node_id_path_drop_copy);
-
+
}
/* ************* end drop *********** */
@@ -429,8 +429,8 @@ static void node_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
static void node_header_area_draw(const bContext *C, ARegion *ar)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- Scene *scene= CTX_data_scene(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ Scene *scene = CTX_data_scene(C);
/* find and set the context */
snode_set_context(snode, scene);
@@ -444,12 +444,19 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch (wmn->category) {
case NC_SPACE:
- if (wmn->data==ND_SPACE_NODE)
+ if (wmn->data == ND_SPACE_NODE)
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
- if (wmn->data == ND_GPENCIL)
- ED_region_tag_redraw(ar);
+ switch (wmn->data) {
+ case ND_GPENCIL:
+ ED_region_tag_redraw(ar);
+ break;
+ case ND_SCREENCAST:
+ case ND_ANIMPLAY:
+ ED_region_tag_redraw(ar);
+ break;
+ }
break;
case NC_SCENE:
case NC_MATERIAL:
@@ -458,7 +465,7 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_OBJECT:
- if (wmn->data==ND_OB_SHADING)
+ if (wmn->data == ND_OB_SHADING)
ED_region_tag_redraw(ar);
break;
case NC_ID:
@@ -472,17 +479,17 @@ const char *node_context_dir[] = {"selected_nodes", "active_node", NULL};
static int node_context(const bContext *C, const char *member, bContextDataResult *result)
{
- SpaceNode *snode= CTX_wm_space_node(C);
-
+ SpaceNode *snode = CTX_wm_space_node(C);
+
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, node_context_dir);
return 1;
}
else if (CTX_data_equals(member, "selected_nodes")) {
bNode *node;
-
+
if (snode->edittree) {
- for (node=snode->edittree->nodes.last; node; node=node->prev) {
+ for (node = snode->edittree->nodes.last; node; node = node->prev) {
if (node->flag & NODE_SELECT) {
CTX_data_list_add(result, &snode->edittree->id, &RNA_Node, node);
}
@@ -500,67 +507,67 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
CTX_data_type_set(result, CTX_DATA_TYPE_POINTER);
return 1;
}
-
+
return 0;
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_node(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype node");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype node");
ARegionType *art;
-
- st->spaceid= SPACE_NODE;
+
+ st->spaceid = SPACE_NODE;
strncpy(st->name, "Node", BKE_ST_MAXNAME);
-
- st->new= node_new;
- st->free= node_free;
- st->init= node_init;
- st->duplicate= node_duplicate;
- st->operatortypes= node_operatortypes;
- st->keymap= node_keymap;
- st->listener= node_area_listener;
- st->refresh= node_area_refresh;
- st->context= node_context;
+
+ st->new = node_new;
+ st->free = node_free;
+ st->init = node_init;
+ st->duplicate = node_duplicate;
+ st->operatortypes = node_operatortypes;
+ st->keymap = node_keymap;
+ st->listener = node_area_listener;
+ st->refresh = node_area_refresh;
+ st->context = node_context;
st->dropboxes = node_dropboxes;
-
+
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= node_main_area_init;
- art->draw= node_main_area_draw;
- art->listener= node_region_listener;
+ art->init = node_main_area_init;
+ art->draw = node_main_area_draw;
+ art->listener = node_region_listener;
art->cursor = node_cursor;
art->event_cursor = TRUE;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
- art->listener= node_region_listener;
- art->init= node_header_area_init;
- art->draw= node_header_area_draw;
-
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
+ art->listener = node_region_listener;
+ art->init = node_header_area_init;
+ art->draw = node_header_area_draw;
+
BLI_addhead(&st->regiontypes, art);
node_menus_register();
-
+
/* regions: listview/buttons */
- art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_UI;
- art->prefsizex= 180; // XXX
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
- art->listener= node_region_listener;
- art->init= node_buttons_area_init;
- art->draw= node_buttons_area_draw;
+ art->prefsizex = 180; // XXX
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+ art->listener = node_region_listener;
+ art->init = node_buttons_area_init;
+ art->draw = node_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
-
+
node_buttons_register(art);
-
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index f0ecaf3ab2c..42fdd5173d4 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -202,26 +202,39 @@ static int group_restrict_flag(Group *gr, int flag)
{
GroupObject *gob;
+#ifdef USE_GROUP_SELECT
for (gob = gr->gobject.first; gob; gob = gob->next) {
if ((gob->ob->restrictflag & flag) == 0)
return 0;
}
-
return 1;
+#else
+ /* weak but fast */
+ if ((gob = gr->gobject.first))
+ if ((gob->ob->restrictflag & flag) == 0)
+ return 0;
+ return 1;
+#endif
}
-#ifdef USE_GROUP_SELECT
static int group_select_flag(Group *gr)
{
GroupObject *gob;
+#ifdef USE_GROUP_SELECT
for (gob = gr->gobject.first; gob; gob = gob->next)
if ((gob->ob->flag & SELECT))
return 1;
return 0;
-}
+#else
+ /* weak but fast */
+ if ((gob = gr->gobject.first))
+ if (gob->ob->flag & SELECT)
+ return 1;
+ return 0;
#endif
+}
void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
{
@@ -428,25 +441,15 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
uiBlockSetEmboss(block, UI_EMBOSSN);
-#ifndef USE_GROUP_SELECT
- restrict_bool = FALSE;
-#endif
-
-#ifdef USE_GROUP_SELECT
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW);
-#endif
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr);
-#ifdef USE_GROUP_SELECT
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT);
-#endif
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr);
-#ifdef USE_GROUP_SELECT
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER);
-#endif
bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow renderability");
uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr);
@@ -1289,7 +1292,6 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
}
}
else if (te->idcode == ID_GR) {
-#ifdef USE_GROUP_SELECT
Group *gr = (Group *)tselem->id;
if (group_select_flag(gr)) {
char col[4];
@@ -1299,7 +1301,6 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
active = 2;
}
-#endif
}
else if (te->idcode == ID_OB) {
Object *ob = (Object *)tselem->id;
@@ -1540,7 +1541,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
outliner_draw_selection(ar, soops, &soops->tree, &starty);
- // grey hierarchy lines
+ // gray hierarchy lines
UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.4f);
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET;
startx = 6;
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index eb740e441b7..449914feae4 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -1360,7 +1360,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
/* identifiers */
ot->idname = "OUTLINER_OT_keyingset_add_selected";
ot->name = "Keying Set Add Selected";
- ot->description = "Add selected items (blue-grey rows) to active Keying Set";
+ ot->description = "Add selected items (blue-gray rows) to active Keying Set";
/* api callbacks */
ot->exec = outliner_keyingset_additems_exec;
@@ -1397,7 +1397,7 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
/* identifiers */
ot->idname = "OUTLINER_OT_keyingset_remove_selected";
ot->name = "Keying Set Remove Selected";
- ot->description = "Remove selected items (blue-grey rows) from active Keying Set";
+ ot->description = "Remove selected items (blue-gray rows) from active Keying Set";
/* api callbacks */
ot->exec = outliner_keyingset_removeitems_exec;
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 812fba50295..096713f9cd3 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -69,7 +69,7 @@
#include "outliner_intern.h"
/* ****************************************************** */
-/* Outliner Selection (grey-blue highlight for rows) */
+/* Outliner Selection (gray-blue highlight for rows) */
static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting)
{
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index 1e452f2052d..7dbcabedccc 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -58,7 +58,7 @@ void sequencer_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
strcpy(pt->idname, "SEQUENCER_PT_gpencil");
strcpy(pt->label, N_("Grease Pencil"));
- pt->draw= gpencil_panel_standard;
+ pt->draw = gpencil_panel_standard;
BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index e48450e93bd..38f29e8816e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -72,8 +72,11 @@
#include "sequencer_intern.h"
-#define SEQ_LEFTHANDLE 1
-#define SEQ_RIGHTHANDLE 2
+#define SEQ_LEFTHANDLE 1
+#define SEQ_RIGHTHANDLE 2
+
+#define SEQ_HANDLE_SIZE_MIN 7.0f
+#define SEQ_HANDLE_SIZE_MAX 40.0f
/* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
@@ -325,13 +328,19 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
glDisable(GL_BLEND);
}
+/* clamp handles to defined size in pixel space */
+static float draw_seq_handle_size_get_clamped(Sequence *seq, const float pixelx)
+{
+ const float minhandle = pixelx * SEQ_HANDLE_SIZE_MIN;
+ const float maxhandle = pixelx * SEQ_HANDLE_SIZE_MAX;
+ return CLAMPIS(seq->handsize, minhandle, maxhandle);
+}
+
/* draw a handle, for each end of a sequence strip */
-static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short direction)
+static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_clamped, const short direction)
{
float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect
float x1, x2, y1, y2;
- float handsize;
- float minhandle, maxhandle;
char numstr[32];
unsigned int whichsel = 0;
@@ -340,31 +349,25 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
-
- /* clamp handles to defined size in pixel space */
- handsize = seq->handsize;
- minhandle = 7;
- maxhandle = 40;
- CLAMP(handsize, minhandle * pixelx, maxhandle * pixelx);
-
+
/* set up co-ordinates/dimensions for either left or right handle */
if (direction == SEQ_LEFTHANDLE) {
rx1 = x1;
- rx2 = x1 + handsize * 0.75f;
+ rx2 = x1 + handsize_clamped * 0.75f;
- v1[0] = x1 + handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
- v2[0] = x1 + handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
- v3[0] = v2[0] + handsize / 4; v3[1] = (y1 + y2) / 2.0f;
+ v1[0] = x1 + handsize_clamped / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
+ v2[0] = x1 + handsize_clamped / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
+ v3[0] = v2[0] + handsize_clamped / 4; v3[1] = (y1 + y2) / 2.0f;
whichsel = SEQ_LEFTSEL;
}
else if (direction == SEQ_RIGHTHANDLE) {
- rx1 = x2 - handsize * 0.75f;
+ rx1 = x2 - handsize_clamped * 0.75f;
rx2 = x2;
- v1[0] = x2 - handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
- v2[0] = x2 - handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
- v3[0] = v2[0] - handsize / 4; v3[1] = (y1 + y2) / 2.0f;
+ v1[0] = x2 - handsize_clamped / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
+ v2[0] = x2 - handsize_clamped / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
+ v3[0] = v2[0] - handsize_clamped / 4; v3[1] = (y1 + y2) / 2.0f;
whichsel = SEQ_RIGHTSEL;
}
@@ -404,7 +407,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short dire
}
else {
BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
- x1 = x2 - handsize * 0.75f;
+ x1 = x2 - handsize_clamped * 0.75f;
y1 = y2 + 0.05f;
}
UI_view2d_text_cache_add(v2d, x1, y1, numstr, col);
@@ -530,67 +533,67 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
name = give_seqname(seq);
if (seq->type == SEQ_TYPE_META || seq->type == SEQ_TYPE_ADJUSTMENT) {
- BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%s | %d", name, seq->len);
}
else if (seq->type == SEQ_TYPE_SCENE) {
if (seq->scene) {
if (seq->scene_camera) {
- BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)",
- seq->len, name, seq->scene->id.name + 2, ((ID *)seq->scene_camera)->name + 2);
+ BLI_snprintf(str, sizeof(str), "%s: %s (%s) | %d",
+ name, seq->scene->id.name + 2, ((ID *)seq->scene_camera)->name + 2, seq->len);
}
else {
- BLI_snprintf(str, sizeof(str), "%d | %s: %s",
- seq->len, name, seq->scene->id.name + 2);
+ BLI_snprintf(str, sizeof(str), "%s: %s | %d",
+ name, seq->scene->id.name + 2, seq->len);
}
}
else {
- BLI_snprintf(str, sizeof(str), "%d | %s",
- seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%s | %d",
+ name, seq->len);
}
}
else if (seq->type == SEQ_TYPE_MOVIECLIP) {
if (seq->clip && strcmp(name, seq->clip->id.name + 2) != 0) {
- BLI_snprintf(str, sizeof(str), "%d | %s: %s",
- seq->len, name, seq->clip->id.name + 2);
+ BLI_snprintf(str, sizeof(str), "%s: %s | %d",
+ name, seq->clip->id.name + 2, seq->len);
}
else {
- BLI_snprintf(str, sizeof(str), "%d | %s",
- seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%s | %d",
+ name, seq->len);
}
}
else if (seq->type == SEQ_TYPE_MASK) {
if (seq->mask && strcmp(name, seq->mask->id.name + 2) != 0) {
- BLI_snprintf(str, sizeof(str), "%d | %s: %s",
- seq->len, name, seq->mask->id.name + 2);
+ BLI_snprintf(str, sizeof(str), "%s: %s | %d",
+ name, seq->mask->id.name + 2, seq->len);
}
else {
- BLI_snprintf(str, sizeof(str), "%d | %s",
- seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%s | %d",
+ name, seq->len);
}
}
else if (seq->type == SEQ_TYPE_MULTICAM) {
- BLI_snprintf(str, sizeof(str), "Cam | %s: %d",
+ BLI_snprintf(str, sizeof(str), "Cam %s: %d",
name, seq->multicam_source);
}
else if (seq->type == SEQ_TYPE_IMAGE) {
- BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
- seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_snprintf(str, sizeof(str), "%s: %s%s | %d",
+ name, seq->strip->dir, seq->strip->stripdata->name, seq->len);
}
else if (seq->type & SEQ_TYPE_EFFECT) {
- BLI_snprintf(str, sizeof(str), "%d | %s",
- seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%s | %d",
+ name, seq->len);
}
else if (seq->type == SEQ_TYPE_SOUND_RAM) {
if (seq->sound)
- BLI_snprintf(str, sizeof(str), "%d | %s: %s",
- seq->len, name, seq->sound->name);
+ BLI_snprintf(str, sizeof(str), "%s: %s | %d",
+ name, seq->sound->name, seq->len);
else
- BLI_snprintf(str, sizeof(str), "%d | %s",
- seq->len, name);
+ BLI_snprintf(str, sizeof(str), "%s | %d",
+ name, seq->len);
}
else if (seq->type == SEQ_TYPE_MOVIE) {
- BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
- seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_snprintf(str, sizeof(str), "%s: %s%s | %d",
+ name, seq->strip->dir, seq->strip->stripdata->name, seq->len);
}
if (seq->flag & SELECT) {
@@ -679,6 +682,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
View2D *v2d = &ar->v2d;
float x1, x2, y1, y2;
unsigned char col[3], background_col[3], is_single_image;
+ const float handsize_clamped = draw_seq_handle_size_get_clamped(seq, pixelx);
/* we need to know if this is a single image/color or not for drawing */
is_single_image = (char)seq_single_check(seq);
@@ -706,8 +710,8 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
if (!is_single_image)
draw_seq_extensions(scene, ar, seq);
- draw_seq_handle(v2d, seq, pixelx, SEQ_LEFTHANDLE);
- draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE);
+ draw_seq_handle(v2d, seq, handsize_clamped, SEQ_LEFTHANDLE);
+ draw_seq_handle(v2d, seq, handsize_clamped, SEQ_RIGHTHANDLE);
/* draw the strip outline */
x1 = seq->startdisp;
@@ -766,8 +770,8 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
}
/* calculate if seq is long enough to print a name */
- x1 = seq->startdisp + seq->handsize;
- x2 = seq->enddisp - seq->handsize;
+ x1 = seq->startdisp + handsize_clamped;
+ x2 = seq->enddisp - handsize_clamped;
/* info text on the strip */
if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin;
@@ -1072,7 +1076,7 @@ static void draw_seq_backdrop(View2D *v2d)
{
int i;
- /* darker grey overlay over the view backdrop */
+ /* darker gray overlay over the view backdrop */
UI_ThemeColorShade(TH_BACK, -20);
glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index c686f8440a9..7ed5c77ed1f 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -1570,16 +1570,6 @@ static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
-static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
- sequencer_add_duplicate_exec(C, op);
-
- RNA_enum_set(op->ptr, "mode", TFM_TRANSLATION);
- WM_operator_name_call(C, "TRANSFORM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr);
-
- return OPERATOR_FINISHED;
-}
-
void SEQUENCER_OT_duplicate(wmOperatorType *ot)
{
/* identifiers */
@@ -1588,7 +1578,6 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
ot->description = "Duplicate the selected strips";
/* api callbacks */
- ot->invoke = sequencer_add_duplicate_invoke;
ot->exec = sequencer_add_duplicate_exec;
ot->poll = ED_operator_sequencer_active;
@@ -2705,8 +2694,11 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- sound_remove_scene_sound(scene, seq_act->scene_sound);
- sound_remove_scene_sound(scene, seq_other->scene_sound);
+ if (seq_act->scene_sound)
+ sound_remove_scene_sound(scene, seq_act->scene_sound);
+
+ if (seq_other->scene_sound)
+ sound_remove_scene_sound(scene, seq_other->scene_sound);
seq_act->scene_sound = NULL;
seq_other->scene_sound = NULL;
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 79ecd9f7481..4a1c8f0c006 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -167,7 +167,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", DELKEY, KM_PRESS, 0, 0);
@@ -321,3 +321,13 @@ void sequencer_keymap(wmKeyConfig *keyconf)
#endif
}
+void ED_operatormacros_sequencer(void)
+{
+ wmOperatorType *ot;
+
+ ot = WM_operatortype_append_macro("SEQUENCER_OT_duplicate_move", "Duplicate Strips",
+ "Duplicate selected strips and move them", OPTYPE_UNDO | OPTYPE_REGISTER);
+
+ WM_operatortype_macro_define(ot, "SEQUENCER_OT_duplicate");
+ WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+}
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index b03edfc61b9..a55f0edc06c 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -587,14 +587,14 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
/* only get unselected nabours */
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel);
if (neighbor) {
- if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
+ if (sel) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (Sequence *)1;
change = 1;
}
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, isel);
if (neighbor) {
- if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
+ if (sel) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (void *)1;
change = 1;
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index b8bf764fabc..cabc761161e 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -454,6 +454,10 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
if (wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
break;
+ case NC_SCREEN:
+ if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
+ ED_region_tag_redraw(ar);
+ break;
}
}
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 3ebc4eb974c..f0275fb6584 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -830,7 +830,7 @@ void TEXT_OT_paste(wmOperatorType *ot)
static int text_duplicate_line_exec(bContext *C, wmOperator *UNUSED(op))
{
- Text *text= CTX_data_edit_text(C);
+ Text *text = CTX_data_edit_text(C);
txt_duplicate_line(text);
@@ -1341,7 +1341,7 @@ static int move_lines_exec(bContext *C, wmOperator *op)
txt_move_lines(text, direction);
text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+ WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
if (CTX_wm_space_text(C)->live_edit)
@@ -1352,7 +1352,7 @@ static int move_lines_exec(bContext *C, wmOperator *op)
void TEXT_OT_move_lines(wmOperatorType *ot)
{
- static EnumPropertyItem direction_items[]= {
+ static EnumPropertyItem direction_items[] = {
{TXT_MOVE_LINE_UP, "UP", 0, "Up", ""},
{TXT_MOVE_LINE_DOWN, "DOWN", 0, "Down", ""},
{0, NULL, 0, NULL, NULL}
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 248f73b9ab6..5376b82f24c 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -57,23 +57,23 @@ static SpaceLink *userpref_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceUserPref *spref;
-
- spref= MEM_callocN(sizeof(SpaceUserPref), "inituserpref");
- spref->spacetype= SPACE_USERPREF;
-
+
+ spref = MEM_callocN(sizeof(SpaceUserPref), "inituserpref");
+ spref->spacetype = SPACE_USERPREF;
+
/* header */
- ar= MEM_callocN(sizeof(ARegion), "header for userpref");
-
+ ar = MEM_callocN(sizeof(ARegion), "header for userpref");
+
BLI_addtail(&spref->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
-
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_BOTTOM;
+
/* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for userpref");
-
+ ar = MEM_callocN(sizeof(ARegion), "main area for userpref");
+
BLI_addtail(&spref->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
-
+ ar->regiontype = RGN_TYPE_WINDOW;
+
return (SpaceLink *)spref;
}
@@ -93,10 +93,10 @@ static void userpref_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa
static SpaceLink *userpref_duplicate(SpaceLink *sl)
{
- SpaceUserPref *sprefn= MEM_dupallocN(sl);
-
+ SpaceUserPref *sprefn = MEM_dupallocN(sl);
+
/* clear or remove stuff from old */
-
+
return (SpaceLink *)sprefn;
}
@@ -155,41 +155,41 @@ static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn
/* only called once, from space/spacetypes.c */
void ED_spacetype_userpref(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype userpref");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype userpref");
ARegionType *art;
-
- st->spaceid= SPACE_USERPREF;
+
+ st->spaceid = SPACE_USERPREF;
strncpy(st->name, "Userpref", BKE_ST_MAXNAME);
-
- st->new= userpref_new;
- st->free= userpref_free;
- st->init= userpref_init;
- st->duplicate= userpref_duplicate;
- st->operatortypes= userpref_operatortypes;
- st->keymap= userpref_keymap;
-
+
+ st->new = userpref_new;
+ st->free = userpref_free;
+ st->init = userpref_init;
+ st->duplicate = userpref_duplicate;
+ st->operatortypes = userpref_operatortypes;
+ st->keymap = userpref_keymap;
+
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= userpref_main_area_init;
- art->draw= userpref_main_area_draw;
- art->listener= userpref_main_area_listener;
- art->keymapflag= ED_KEYMAP_UI;
+ art->init = userpref_main_area_init;
+ art->draw = userpref_main_area_draw;
+ art->listener = userpref_main_area_listener;
+ art->keymapflag = ED_KEYMAP_UI;
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
- art->listener= userpref_header_listener;
- art->init= userpref_header_area_init;
- art->draw= userpref_header_area_draw;
-
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
+ art->listener = userpref_header_listener;
+ art->init = userpref_header_area_init;
+ art->draw = userpref_header_area_draw;
+
BLI_addhead(&st->regiontypes, art);
-
-
+
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index e51f7a312eb..33aada7b811 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -2269,7 +2269,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
}
}
-/* ****************************** Armature Visualisation ******************************** */
+/* ****************************** Armature Visualization ******************************** */
/* ---------- Paths --------- */
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index b92d3d9d24c..339b5560711 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -6442,7 +6442,7 @@ static void draw_hooks(Object *ob)
}
}
-static void drawRBpivot(bRigidBodyJointConstraint *data, const unsigned char ob_wire_col[4])
+static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, const unsigned char ob_wire_col[4])
{
const char *axis_str[3] = {"px", "py", "pz"};
int axis;
@@ -7068,12 +7068,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) {
bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data;
if (data->flag & CONSTRAINT_DRAW_PIVOT)
- drawRBpivot(data, ob_wire_col);
+ draw_rigid_body_pivot(data, ob_wire_col);
}
}
if (ob->gameflag & OB_BOUNDS) {
if (ob->boundtype != ob->collision_boundtype || (dtx & OB_BOUNDBOX) == 0) {
+
setlinestyle(2);
draw_bounding_volume(scene, ob, ob->collision_boundtype);
setlinestyle(0);
@@ -7108,8 +7109,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
if (dt <= OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
- if ((ob->gameflag & OB_DYNAMIC) ||
- ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE)))
+ if (((ob->gameflag & OB_DYNAMIC) &&
+ !ELEM(ob->collision_boundtype, OB_BOUND_TRIANGLE_MESH, OB_BOUND_CONVEX_HULL)) ||
+
+ ((ob->gameflag & OB_BOUNDS) &&
+ (ob->boundtype == OB_BOUND_SPHERE)))
{
float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f};
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 4a135f91d91..6cfa828024d 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -834,7 +834,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
uiBlockSetHandleFunc(block, do_view3d_vgroup_buttons, NULL);
- col = uiLayoutColumn(pa->layout, 0);
+ col = uiLayoutColumn(pa->layout, FALSE);
block = uiLayoutAbsoluteBlock(col);
uiBlockBeginAlign(block);
@@ -856,7 +856,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
uiDefBut(block, BUT, B_VGRP_PNL_NORMALIZE, IFACE_("Normalize"), 0, yco, 100, 20,
NULL, 0, 0, 0, 0, TIP_("Normalize active vertex weights"));
uiDefBut(block, BUT, B_VGRP_PNL_COPY, IFACE_("Copy"), 100, yco, 100, 20,
- NULL, 0, 0, 0, 0, TIP_("Copy active vertex to other seleted verts"));
+ NULL, 0, 0, 0, 0, TIP_("Copy active vertex to other selected verts"));
uiBlockEndAlign(block);
}
}
@@ -865,7 +865,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
{
uiLayout *split, *colsub;
- split = uiLayoutSplit(layout, 0.8, 0);
+ split = uiLayoutSplit(layout, 0.8f, FALSE);
if (ptr->type == &RNA_PoseBone) {
PointerRNA boneptr;
@@ -875,19 +875,19 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
bone = boneptr.data;
uiLayoutSetActive(split, !(bone->parent && bone->flag & BONE_CONNECTED));
}
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemR(colsub, ptr, "location", 0, NULL, ICON_NONE);
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemL(colsub, "", ICON_NONE);
uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- split = uiLayoutSplit(layout, 0.8, 0);
+ split = uiLayoutSplit(layout, 0.8f, FALSE);
switch (RNA_enum_get(ptr, "rotation_mode")) {
case ROT_MODE_QUAT: /* quaternion */
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemR(colsub, ptr, "rotation_quaternion", 0, IFACE_("Rotation"), ICON_NONE);
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE);
if (RNA_boolean_get(ptr, "lock_rotations_4d"))
uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE + UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
@@ -896,9 +896,9 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
case ROT_MODE_AXISANGLE: /* axis angle */
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemR(colsub, ptr, "rotation_axis_angle", 0, IFACE_("Rotation"), ICON_NONE);
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE);
if (RNA_boolean_get(ptr, "lock_rotations_4d"))
uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
@@ -907,19 +907,19 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
default: /* euler rotations */
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemR(colsub, ptr, "rotation_euler", 0, IFACE_("Rotation"), ICON_NONE);
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemL(colsub, "", ICON_NONE);
uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
break;
}
uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NONE);
- split = uiLayoutSplit(layout, 0.8, 0);
- colsub = uiLayoutColumn(split, 1);
+ split = uiLayoutSplit(layout, 0.8f, FALSE);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemR(colsub, ptr, "scale", 0, NULL, ICON_NONE);
- colsub = uiLayoutColumn(split, 1);
+ colsub = uiLayoutColumn(split, TRUE);
uiItemL(colsub, "", ICON_NONE);
uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
@@ -948,7 +948,7 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &pchanptr);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
/* XXX: RNA buts show data in native types (i.e. quats, 4-component axis/angle, etc.)
* but old-school UI shows in eulers always. Do we want to be able to still display in Eulers?
@@ -972,7 +972,7 @@ static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
RNA_pointer_create(&arm->id, &RNA_EditBone, ebone, &eboneptr);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, &eboneptr, "head", 0, NULL, ICON_NONE);
if (ebone->parent && ebone->flag & BONE_CONNECTED) {
PointerRNA parptr = RNA_pointer_get(&eboneptr, "parent");
@@ -1002,7 +1002,7 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
RNA_pointer_create(&mball->id, &RNA_MetaElement, mball->lastelem, &ptr);
- col = uiLayoutColumn(layout, 0);
+ col = uiLayoutColumn(layout, FALSE);
uiItemR(col, &ptr, "co", 0, NULL, ICON_NONE);
uiItemR(col, &ptr, "radius", 0, NULL, ICON_NONE);
@@ -1010,7 +1010,7 @@ static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
uiItemR(col, &ptr, "type", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(layout, 1);
+ col = uiLayoutColumn(layout, TRUE);
switch (RNA_enum_get(&ptr, "type")) {
case MB_BALL:
break;
@@ -1081,8 +1081,8 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
block = uiLayoutGetBlock(pa->layout);
uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL);
- col = uiLayoutColumn(pa->layout, 0);
- /* row = uiLayoutRow(col, 0); */ /* UNUSED */
+ col = uiLayoutColumn(pa->layout, FALSE);
+ /* row = uiLayoutRow(col, FALSE); */ /* UNUSED */
RNA_id_pointer_create(&ob->id, &obptr);
if (ob == obedit) {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 709a73178aa..e6ea42aa5ba 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1561,7 +1561,12 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
if (ima == NULL)
continue;
BKE_image_user_frame_calc(&bgpic->iuser, CFRA, 0);
- ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser);
+ if (ima->source == IMA_SRC_SEQUENCE && !(bgpic->iuser.flag & IMA_USER_FRAME_IN_RANGE)) {
+ ibuf = NULL; /* frame is out of range, dont show */
+ }
+ else {
+ ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser);
+ }
image_aspect[0] = ima->aspx;
image_aspect[1] = ima->aspx;
@@ -1589,6 +1594,11 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d,
* be dereferenced after usage. */
freeibuf = ibuf;
}
+ else {
+ /* perhaps when loading future files... */
+ BLI_assert(0);
+ copy_v2_fl(image_aspect, 1.0f);
+ }
if (ibuf == NULL)
continue;
@@ -2790,6 +2800,14 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);
+static int view3d_main_area_do_render_draw(const bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ RenderEngineType *type = RE_engines_find(scene->r.engine);
+
+ return (type && type->view_update && type->view_draw);
+}
+
static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border)
{
Scene *scene = CTX_data_scene(C);
@@ -3126,7 +3144,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
int draw_border = (rv3d->persp == RV3D_CAMOB && (scene->r.mode & R_BORDER));
/* draw viewport using opengl */
- if (v3d->drawtype != OB_RENDER || draw_border) {
+ if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) {
view3d_main_area_draw_objects(C, ar, &grid_unit);
ED_region_pixelspace(ar);
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index a68caeb0719..eb202497260 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -451,7 +451,7 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
BMEditMesh *em = BMEdit_FromObject(obedit);
uiLayout *row;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
block = uiLayoutGetBlock(row);
uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_SEL_VERT, ICON_VERTEXSEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Vertex select - Shift-Click for multiple modes");
uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_SEL_EDGE, ICON_EDGESEL, 0, 0, UI_UNIT_X, UI_UNIT_Y, &em->selectmode, 1.0, 0.0, 0, 0, "Edge select - Shift-Click for multiple modes");
@@ -494,7 +494,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
v3d->modeselect = OB_MODE_OBJECT;
}
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene),
0, 0, 126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode"));
@@ -512,7 +512,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
else {
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
@@ -521,7 +521,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
else {
const char *str_menu;
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
/* pose/object only however we want to allow in weight paint mode too
@@ -531,7 +531,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
}
/* Transform widget / manipulators */
- row = uiLayoutRow(layout, 1);
+ row = uiLayoutRow(layout, TRUE);
uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
block = uiLayoutGetBlock(row);
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index ff896a95941..ee1ead76f7c 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -211,12 +211,12 @@ static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
for (ct = st->toolshelf.first; ct; ct = ct->next) {
if (0 == strncmp(context, ct->context, OP_MAX_TYPENAME)) {
- col = uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, TRUE);
uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0);
}
}
}
- col = uiLayoutColumn(pa->layout, 1);
+ col = uiLayoutColumn(pa->layout, TRUE);
uiDefBlockBut(uiLayoutGetBlock(pa->layout), tool_search_menu, &st->toolshelf, "Add Tool", 0, 0, UI_UNIT_X, UI_UNIT_Y, "Add Tool in shelf, gets saved in files");
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 8fb012a18d6..4782b95ba1c 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1564,13 +1564,15 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa)
static int localview_exec(bContext *C, wmOperator *UNUSED(unused))
{
+ Main *bmain = CTX_data_main(C);
View3D *v3d = CTX_wm_view3d(C);
if (v3d->localvd)
endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
else
initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
-
+
+ DAG_id_type_tag(bmain, ID_OB);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 67e87afc5c3..164c1dd7c12 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -183,11 +183,11 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
r_vec[2] = 0.0f;
if (t->options & CTX_MOVIECLIP) {
- ED_space_clip_get_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
}
else if (t->options & CTX_MASK) {
/* TODO - NOT WORKING, this isnt so bad since its only display aspect */
- ED_space_clip_get_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
}
r_vec[0] *= aspx;
@@ -254,9 +254,9 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
copy_v2_v2(v, vec);
if (t->options & CTX_MOVIECLIP)
- ED_space_clip_get_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
else if (t->options & CTX_MASK)
- ED_space_clip_get_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
v[0] /= aspx;
v[1] /= aspy;
@@ -317,13 +317,13 @@ void applyAspectRatio(TransInfo *t, float vec[2])
if (t->options & CTX_MOVIECLIP) {
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
vec[0] /= aspx;
vec[1] /= aspy;
}
else if (t->options & CTX_MASK) {
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
vec[0] /= aspx;
vec[1] /= aspy;
@@ -356,10 +356,10 @@ void removeAspectRatio(TransInfo *t, float vec[2])
float aspx = 1.0f, aspy = 1.0f;
if (t->options & CTX_MOVIECLIP) {
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
}
else if (t->options & CTX_MASK) {
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
}
vec[0] *= aspx;
@@ -1655,6 +1655,12 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
unit_m3(t->spacemtx);
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
}
+ else if (t->spacetype == SPACE_NODE) {
+ unit_m3(t->spacemtx);
+ /*t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);*/
+ t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ /*t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);*/
+ }
else
unit_m3(t->spacemtx);
@@ -2170,8 +2176,8 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
/* objects and bones do normalization first too, otherwise
- * we don't necessarily end up with a rotation matrix, and
- * then conversion back to quat gives a different result */
+ * we don't necessarily end up with a rotation matrix, and
+ * then conversion back to quat gives a different result */
float quat[4];
normalize_qt_qt(quat, td->ext->quat);
quat_to_mat4(cob->matrix, quat);
@@ -3542,6 +3548,11 @@ void initTranslation(TransInfo *t)
t->snap[1] = 0.125f;
t->snap[2] = 0.0625f;
}
+ else if (t->spacetype == SPACE_NODE) {
+ t->snap[0] = 0.0f;
+ t->snap[1] = 125.0f;
+ t->snap[2] = 25.0f;
+ }
else {
t->snap[0] = 0.0f;
t->snap[1] = t->snap[2] = 1.0f;
@@ -5004,7 +5015,6 @@ void projectSVData(TransInfo *t, int final)
for (i = 0, sv = sld->sv; i < sld->totsv; sv++, i++) {
BMIter fiter;
BMFace *f;
-
/* BMESH_TODO, this interpolates between vertex/loops which are not moved
* (are only apart of a face attached to a slide vert), couldn't we iterate BM_LOOPS_OF_VERT
@@ -5034,6 +5044,8 @@ void projectSVData(TransInfo *t, int final)
/* project onto copied projection face */
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+ /* only affected verts will get interpolated */
+ char affected = FALSE;
f_copy_flip = f_copy;
if (BM_elem_flag_test(l->e, BM_ELEM_SELECT) || BM_elem_flag_test(l->prev->e, BM_ELEM_SELECT)) {
@@ -5058,6 +5070,8 @@ void projectSVData(TransInfo *t, int final)
if (!f_copy_flip) {
continue; /* shouldn't happen, but protection */
}
+
+ affected = TRUE;
}
else {
/* the loop is attached to only one vertex and not a selected edge,
@@ -5094,10 +5108,15 @@ void projectSVData(TransInfo *t, int final)
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
}
}
+
+ affected = TRUE;
}
}
+ if(!affected)
+ continue;
+
/* only loop data, no vertex data since that contains shape keys,
* and we do not want to mess up other shape keys */
BM_loop_interp_from_face(em->bm, l, f_copy_flip, FALSE, FALSE);
@@ -5122,7 +5141,7 @@ void projectSVData(TransInfo *t, int final)
}
}
}
-
+
BLI_smallhash_release(&visit);
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index fdc09c1bed0..3ab5bf7bbfb 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -86,6 +86,7 @@ typedef struct TransSnap {
float snapTarget[3]; /* to this point */
float snapNormal[3];
float snapTangent[3];
+ char snapNodeBorder;
ListBase points;
TransSnapPoint *selectedPoint;
float dist; // Distance from snapPoint to snapTarget
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index d2910c5b602..034ea3eb704 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -276,7 +276,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
sub_v3_v3v3(out, i1, t_con_center);
/* possible some values become nan when
- * viewpoint and object are both zero */
+ * viewpoint and object are both zero */
if (!finite(out[0])) out[0] = 0.0f;
if (!finite(out[1])) out[1] = 0.0f;
if (!finite(out[2])) out[2] = 0.0f;
@@ -306,7 +306,7 @@ static void planeProjection(TransInfo *t, float in[3], float out[3])
}
/*
- * Generic callback for constant spacial constraints applied to linear motion
+ * Generic callback for constant spatial constraints applied to linear motion
*
* The IN vector in projected into the constrained space and then further
* projected along the view vector.
@@ -404,9 +404,7 @@ static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], f
}
/*
- * Generic callback for constant spacial constraints applied to resize motion
- *
- *
+ * Generic callback for constant spatial constraints applied to resize motion
*/
static void applyAxisConstraintSize(TransInfo *t, TransData *td, float smat[3][3])
@@ -430,9 +428,7 @@ static void applyAxisConstraintSize(TransInfo *t, TransData *td, float smat[3][3
}
/*
- * Callback for object based spacial constraints applied to resize motion
- *
- *
+ * Callback for object based spatial constraints applied to resize motion
*/
static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3][3])
@@ -459,7 +455,7 @@ static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3]
}
/*
- * Generic callback for constant spacial constraints applied to rotations
+ * Generic callback for constant spatial constraints applied to rotations
*
* The rotation axis is copied into VEC.
*
@@ -501,7 +497,7 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], fl
}
/*
- * Callback for object based spacial constraints applied to rotations
+ * Callback for object based spatial constraints applied to rotations
*
* The rotation axis is copied into VEC.
*
@@ -644,7 +640,7 @@ void drawConstraint(TransInfo *t)
{
TransCon *tc = &(t->con);
- if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE))
+ if (!ELEM3(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE))
return;
if (!(tc->mode & CON_APPLY))
return;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index a9716483db7..af0b33d58ae 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2819,7 +2819,7 @@ static void posttrans_mask_clean(Mask *mask)
short added = 0;
masklay_shape_new = masklay_shape->next;
- if (masklay_shape->flag & GP_FRAME_SELECT) {
+ if (masklay_shape->flag & MASK_SHAPE_SELECT) {
BLI_remlink(&masklay->splines_shapes, masklay_shape);
/* find place to add them in buffer
@@ -5516,8 +5516,11 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
}
td->loc = td2d->loc;
- copy_v3_v3(td->center, td->loc);
copy_v3_v3(td->iloc, td->loc);
+ /* use node center instead of origin (top-left corner) */
+ td->center[0] = node->locx + 0.5f * (node->totr.xmax - node->totr.xmin);
+ td->center[1] = node->locy - 0.5f * (node->totr.ymax - node->totr.ymin); /* node height is used negative */
+ td->center[2] = 0.0f;
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
@@ -5529,6 +5532,8 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
unit_m3(td->mtx);
unit_m3(td->smtx);
+
+ td->extra = node;
}
static void createTransNodeData(bContext *C, TransInfo *t)
@@ -5736,7 +5741,7 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
if (t->total == 0)
return;
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransTracking TransData");
td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransTracking TransData2D");
@@ -5913,9 +5918,12 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
t->total = 0;
+ if (!clip)
+ return;
+
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
- if (!clip || width == 0 || height == 0)
+ if (width == 0 || height == 0)
return;
if (ar->regiontype == RGN_TYPE_PREVIEW) {
@@ -5992,7 +6000,7 @@ void flushTransTracking(TransInfo *t)
int a;
float aspx, aspy;
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
if (t->state == TRANS_CANCEL)
cancelTransTracking(t);
@@ -6072,7 +6080,7 @@ static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point,
tdm->point = point;
copy_m3_m3(tdm->vec, bezt->vec);
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
if (propmode || is_sel_point) {
int i;
@@ -6250,7 +6258,7 @@ void flushTransMasking(TransInfo *t)
int a;
float aspx, aspy, invx, invy;
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
invx = 1.0f / aspx;
invy = 1.0f / aspy;
@@ -6321,7 +6329,7 @@ void createTransData(bContext *C, TransInfo *t)
#endif
}
else if (t->spacetype == SPACE_NODE) {
- t->flag |= T_2D_EDIT | T_POINTS;
+ t->flag |= T_POINTS | T_2D_EDIT;
createTransNodeData(C, t);
if (t->data && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 0ecfa2695e0..9f335b4afe7 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -643,7 +643,7 @@ static void recalcData_spaceclip(TransInfo *t)
MovieClip *clip = ED_space_clip_get_clip(sc);
ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
MovieTrackingTrack *track;
- int framenr = sc->user.framenr;
+ int framenr = ED_space_clip_get_clip_frame_number(sc);
flushTransTracking(t);
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index b3ccf004810..1507dbfddda 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -745,7 +745,7 @@ static char axisBlendAngle(float angle)
}
/* three colors can be set;
- * grey for ghosting
+ * gray for ghosting
* moving: in transform theme color
* else the red/green/blue
*/
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 90b67951614..c49e1715f34 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -42,6 +42,7 @@
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h" // Temporary, for snapping to other unselected meshes
+#include "DNA_node_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
@@ -74,6 +75,7 @@
#include "ED_armature.h"
#include "ED_image.h"
#include "ED_mesh.h"
+#include "ED_node.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
@@ -113,6 +115,9 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]);
/****************** IMPLEMENTATIONS *********************/
+static int snapNodeTest(View2D *v2d, bNode *node, SnapMode mode);
+static NodeBorder snapNodeBorder(int snap_node_mode);
+
#if 0
int BIF_snappingSupported(Object *obedit)
{
@@ -140,19 +145,22 @@ int activeSnap(TransInfo *t)
void drawSnapping(const struct bContext *C, TransInfo *t)
{
- if (validSnap(t) && activeSnap(t)) {
-
- unsigned char col[4], selectedCol[4], activeCol[4];
- UI_GetThemeColor3ubv(TH_TRANSFORM, col);
- col[3] = 128;
-
- UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
- selectedCol[3] = 128;
-
- UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
- activeCol[3] = 192;
-
- if (t->spacetype == SPACE_VIEW3D) {
+ unsigned char col[4], selectedCol[4], activeCol[4];
+
+ if (!activeSnap(t))
+ return;
+
+ UI_GetThemeColor3ubv(TH_TRANSFORM, col);
+ col[3] = 128;
+
+ UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
+ selectedCol[3] = 128;
+
+ UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
+ activeCol[3] = 192;
+
+ if (t->spacetype == SPACE_VIEW3D) {
+ if (validSnap(t)) {
TransSnapPoint *p;
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -160,11 +168,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
float size;
glDisable(GL_DEPTH_TEST);
-
+
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
-
+
invert_m4_m4(imat, rv3d->viewmat);
-
+
for (p = t->tsnap.points.first; p; p = p->next) {
if (p == t->tsnap.selectedPoint) {
glColor4ubv(selectedCol);
@@ -172,20 +180,20 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
else {
glColor4ubv(col);
}
-
+
drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size * 0.75f, imat);
}
-
+
if (t->tsnap.status & POINT_INIT) {
glColor4ubv(activeCol);
-
+
drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat);
}
/* draw normal if needed */
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
glColor4ubv(activeCol);
-
+
glBegin(GL_LINES);
glVertex3f(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
glVertex3f(t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
@@ -197,7 +205,9 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
if (v3d->zbuf)
glEnable(GL_DEPTH_TEST);
}
- else if (t->spacetype == SPACE_IMAGE) {
+ }
+ else if (t->spacetype == SPACE_IMAGE) {
+ if (validSnap(t)) {
/* This will not draw, and Im nor sure why - campbell */
#if 0
float xuser_asp, yuser_asp;
@@ -228,7 +238,36 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
glTranslatef(-t->tsnap.snapPoint[0], -t->tsnap.snapPoint[1], 0.0f);
setlinestyle(0);
#endif
+ }
+ }
+ else if (t->spacetype == SPACE_NODE) {
+ if (validSnap(t)) {
+ ARegion *ar = CTX_wm_region(C);
+ TransSnapPoint *p;
+ float size;
+
+ size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
+
+ glEnable(GL_BLEND);
+ for (p = t->tsnap.points.first; p; p = p->next) {
+ if (p == t->tsnap.selectedPoint) {
+ glColor4ubv(selectedCol);
+ }
+ else {
+ glColor4ubv(col);
+ }
+
+ drawnodesnap(&ar->v2d, p->co, size, 0);
+ }
+
+ if (t->tsnap.status & POINT_INIT) {
+ glColor4ubv(activeCol);
+
+ drawnodesnap(&ar->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder);
+ }
+
+ glDisable(GL_BLEND);
}
}
}
@@ -349,6 +388,8 @@ void resetSnapping(TransInfo *t)
t->tsnap.snapNormal[0] = 0;
t->tsnap.snapNormal[1] = 0;
t->tsnap.snapNormal[2] = 0;
+
+ t->tsnap.snapNodeBorder = 0;
}
int usingSnappingNormal(TransInfo *t)
@@ -373,12 +414,20 @@ static void initSnappingMode(TransInfo *t)
Object *obedit = t->obedit;
Scene *scene = t->scene;
- /* force project off when not supported */
- if (ts->snap_mode != SCE_SNAP_MODE_FACE) {
+ if (t->spacetype == SPACE_NODE) {
+ /* force project off when not supported */
t->tsnap.project = 0;
+
+ t->tsnap.mode = ts->snap_node_mode;
+ }
+ else {
+ /* force project off when not supported */
+ if (ts->snap_mode != SCE_SNAP_MODE_FACE) {
+ t->tsnap.project = 0;
+ }
+
+ t->tsnap.mode = ts->snap_mode;
}
-
- t->tsnap.mode = ts->snap_mode;
if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) && /* Only 3D view or UV */
(t->flag & T_CAMERA) == 0) /* Not with camera selected in camera view */
@@ -414,6 +463,19 @@ static void initSnappingMode(TransInfo *t)
t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
}
}
+ else if (t->spacetype == SPACE_NODE)
+ {
+ setSnappingCallback(t);
+
+ if (t->tsnap.applySnap != NULL)
+ {
+ t->tsnap.modeSelect = SNAP_NOT_SELECTED;
+ }
+ else {
+ /* Grid if snap is not possible */
+ t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
+ }
+ }
else {
/* Always grid outside of 3D view */
t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
@@ -459,7 +521,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
}
/* use scene defaults only when transform is modal */
else if (t->flag & T_MODAL) {
- if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
+ if (ELEM3(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE)) {
if (ts->snap_flag & SCE_SNAP) {
t->modifiers |= MOD_SNAP;
}
@@ -624,7 +686,17 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
{
float point[3];
getSnapPoint(t, point);
- sub_v3_v3v3(vec, point, t->tsnap.snapTarget);
+
+ if (t->spacetype == SPACE_NODE) {
+ char border = t->tsnap.snapNodeBorder;
+ if (border & (NODE_LEFT | NODE_RIGHT))
+ vec[0] = point[0] - t->tsnap.snapTarget[0];
+ if (border & (NODE_BOTTOM | NODE_TOP))
+ vec[1] = point[1] - t->tsnap.snapTarget[1];
+ }
+ else {
+ sub_v3_v3v3(vec, point, t->tsnap.snapTarget);
+ }
}
static void ApplySnapRotation(TransInfo *t, float *value)
@@ -879,20 +951,57 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
t->tsnap.status &= ~POINT_INIT;
}
}
+ else if (t->spacetype == SPACE_NODE) {
+ float loc[2];
+ int dist = SNAP_MIN_DISTANCE; // Use a user defined value here
+ char node_border;
+
+ if (snapNodesTransform(t, t->mval, &dist, loc, &node_border, t->tsnap.modeSelect)) {
+ copy_v2_v2(t->tsnap.snapPoint, loc);
+ t->tsnap.snapNodeBorder = node_border;
+
+ t->tsnap.status |= POINT_INIT;
+ }
+ else {
+ t->tsnap.status &= ~POINT_INIT;
+ }
+ }
}
/********************** TARGET **************************/
+static void TargetSnapOffset(TransInfo *t, TransData *td)
+{
+ if (t->spacetype == SPACE_NODE && td != NULL) {
+ bNode *node = td->extra;
+ char border = t->tsnap.snapNodeBorder;
+ float width = node->totr.xmax - node->totr.xmin;
+ float height = node->totr.ymax - node->totr.ymin;
+
+ if (border & NODE_LEFT)
+ t->tsnap.snapTarget[0] -= 0.5f * width;
+ if (border & NODE_RIGHT)
+ t->tsnap.snapTarget[0] += 0.5f * width;
+ if (border & NODE_BOTTOM)
+ t->tsnap.snapTarget[1] -= 0.5f * height;
+ if (border & NODE_TOP)
+ t->tsnap.snapTarget[1] += 0.5f * height;
+ }
+}
+
static void TargetSnapCenter(TransInfo *t)
{
/* Only need to calculate once */
if ((t->tsnap.status & TARGET_INIT) == 0) {
copy_v3_v3(t->tsnap.snapTarget, t->center);
+
if (t->flag & (T_EDIT | T_POSE)) {
Object *ob = t->obedit ? t->obedit : t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
+ TargetSnapOffset(t, NULL);
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -914,12 +1023,14 @@ static void TargetSnapActive(TransInfo *t)
if (active_td) {
copy_v3_v3(t->tsnap.snapTarget, active_td->center);
-
+
if (t->flag & (T_EDIT | T_POSE)) {
Object *ob = t->obedit ? t->obedit : t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
+ TargetSnapOffset(t, active_td);
+
t->tsnap.status |= TARGET_INIT;
}
/* No active, default to median */
@@ -953,6 +1064,8 @@ static void TargetSnapMedian(TransInfo *t)
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
+ TargetSnapOffset(t, NULL);
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -1029,6 +1142,8 @@ static void TargetSnapClosest(TransInfo *t)
}
}
+ TargetSnapOffset(t, closest);
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -1876,6 +1991,113 @@ int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2],
return peelObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), depth_peels, mval, mode);
}
+/******************** NODES ***********************************/
+
+static int snapNodeTest(View2D *v2d, bNode *node, SnapMode mode)
+{
+ /* node is use for snapping only if a) snap mode matches and b) node is inside the view */
+ return ((mode == SNAP_NOT_SELECTED && !(node->flag & NODE_SELECT)) ||
+ (mode == SNAP_ALL && !(node->flag & NODE_ACTIVE))) &&
+ (node->totr.xmin < v2d->cur.xmax && node->totr.xmax > v2d->cur.xmin &&
+ node->totr.ymin < v2d->cur.ymax && node->totr.ymax > v2d->cur.ymin);
+}
+
+static NodeBorder snapNodeBorder(int snap_node_mode)
+{
+ switch (snap_node_mode) {
+ case SCE_SNAP_MODE_NODE_X:
+ return NODE_LEFT | NODE_RIGHT;
+ case SCE_SNAP_MODE_NODE_Y:
+ return NODE_TOP | NODE_BOTTOM;
+ case SCE_SNAP_MODE_NODE_XY:
+ return NODE_LEFT | NODE_RIGHT | NODE_TOP | NODE_BOTTOM;
+ }
+ return 0;
+}
+
+static int snapNode(ToolSettings *ts, SpaceNode *UNUSED(snode), ARegion *ar, bNode *node, const int mval[2],
+ float r_loc[2], int *r_dist, char *r_node_border)
+{
+ View2D *v2d = &ar->v2d;
+ NodeBorder border = snapNodeBorder(ts->snap_node_mode);
+ int retval = 0;
+ rcti totr;
+ int new_dist;
+
+ UI_view2d_to_region_no_clip(v2d, node->totr.xmin, node->totr.ymin, &totr.xmin, &totr.ymin);
+ UI_view2d_to_region_no_clip(v2d, node->totr.xmax, node->totr.ymax, &totr.xmax, &totr.ymax);
+
+ if (border & NODE_LEFT) {
+ new_dist = abs(totr.xmin - mval[0]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, totr.xmin, mval[1], &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_LEFT;
+ retval = 1;
+ }
+ }
+
+ if (border & NODE_RIGHT) {
+ new_dist = abs(totr.xmax - mval[0]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, totr.xmax, mval[1], &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_RIGHT;
+ retval = 1;
+ }
+ }
+
+ if (border & NODE_BOTTOM) {
+ new_dist = abs(totr.ymin - mval[1]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, mval[0], totr.ymin, &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_BOTTOM;
+ retval = 1;
+ }
+ }
+
+ if (border & NODE_TOP) {
+ new_dist = abs(totr.ymax - mval[1]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, mval[0], totr.ymax, &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_TOP;
+ retval = 1;
+ }
+ }
+
+ return retval;
+}
+
+static int snapNodes(ToolSettings *ts, SpaceNode *snode, ARegion *ar, const int mval[2],
+ int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode)
+{
+ bNodeTree *ntree = snode->edittree;
+ bNode *node;
+ int retval = 0;
+
+ *r_node_border = 0;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (snapNodeTest(&ar->v2d, node, mode))
+ retval |= snapNode(ts, snode, ar, node, mval, r_loc, r_dist, r_node_border);
+ }
+
+ return retval;
+}
+
+int snapNodesTransform(TransInfo *t, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode)
+{
+ return snapNodes(t->settings, t->sa->spacedata.first, t->ar, mval, r_dist, r_loc, r_node_border, mode);
+}
+
+int snapNodesContext(bContext *C, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode)
+{
+ Scene *scene = CTX_data_scene(C);
+ return snapNodes(scene->toolsettings, CTX_wm_space_node(C), CTX_wm_region(C), mval, r_dist, r_loc, r_node_border, mode);
+}
+
/*================================================================*/
static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action);
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 65d23641ab5..0c2bfff3b57 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -493,12 +493,13 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
if (totitem > 0) {
uiPopupMenu *pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
uiLayout *layout = uiPupMenuLayout(pup);
- uiLayout *split = uiLayoutSplit(layout, 0, 0), *column = NULL;
+ uiLayout *split = uiLayoutSplit(layout, 0.0f, FALSE);
+ uiLayout *column = NULL;
int i, c;
for (c = 0, i = totitem - 1; i >= 0; i--, c++) {
if ( (c % 20) == 0)
- column = uiLayoutColumn(split, 0);
+ column = uiLayoutColumn(split, FALSE);
if (item[i].identifier)
uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index a90f8253654..17c57b1f6e4 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -133,7 +133,7 @@ static void draw_uvs_shadow(Object *obedit)
BMIter iter, liter;
MLoopUV *luv;
- /* draws the grey mesh when painting */
+ /* draws the gray mesh when painting */
glColor3ub(112, 112, 112);
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
@@ -467,7 +467,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
/* draw other uvs */
if (sima->flag & SI_DRAW_OTHER) {
- Image *curimage = (activetf) ? activetf->tpage : NULL;
+ Image *curimage = (activetf) ? activetf->tpage : ima;
draw_uvs_other(scene, obedit, curimage);
}
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index b15df9c3e89..216ac61b628 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -3402,7 +3402,8 @@ static void UV_OT_cursor_set(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
+ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location",
+ "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f);
}
/********************** set tile operator **********************/