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:
authorMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
committerMiika Hamalainen <blender@miikah.org>2011-11-05 12:04:49 +0400
commit2ed6f077b3952123d56916980d18a379ecb3e5ac (patch)
tree1aa273e5566c95214739fb224d4c6cf115417882 /source/blender/editors
parentb9c83456b27da57a14bcf8d274b460e670d49990 (diff)
parent62f22185546e80b661424b45c88006f8b592d8b1 (diff)
Merge with trunk r41545
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/CMakeLists.txt1
-rw-r--r--source/blender/editors/SConscript1
-rw-r--r--source/blender/editors/animation/anim_markers.c6
-rw-r--r--source/blender/editors/curve/curve_ops.c1
-rw-r--r--source/blender/editors/curve/editcurve.c7
-rw-r--r--source/blender/editors/include/ED_mesh.h2
-rw-r--r--source/blender/editors/include/ED_node.h2
-rw-r--r--source/blender/editors/include/ED_render.h4
-rw-r--r--source/blender/editors/include/ED_screen.h1
-rw-r--r--source/blender/editors/include/ED_space_api.h1
-rw-r--r--source/blender/editors/include/ED_view3d.h4
-rw-r--r--source/blender/editors/interface/interface.c11
-rw-r--r--source/blender/editors/interface/interface_handlers.c138
-rw-r--r--source/blender/editors/interface/interface_ops.c26
-rw-r--r--source/blender/editors/interface/resources.c41
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c57
-rw-r--r--source/blender/editors/object/object_add.c1
-rw-r--r--source/blender/editors/object/object_bake.c21
-rw-r--r--source/blender/editors/object/object_edit.c4
-rw-r--r--source/blender/editors/object/object_transform.c2
-rw-r--r--source/blender/editors/object/object_vgroup.c136
-rw-r--r--source/blender/editors/render/render_internal.c19
-rw-r--r--source/blender/editors/render/render_preview.c24
-rw-r--r--source/blender/editors/render/render_shading.c26
-rw-r--r--source/blender/editors/render/render_update.c105
-rw-r--r--source/blender/editors/render/render_view.c19
-rw-r--r--source/blender/editors/screen/area.c22
-rw-r--r--source/blender/editors/screen/screen_ops.c13
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c6
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c102
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c89
-rw-r--r--source/blender/editors/space_api/spacetypes.c1
-rw-r--r--source/blender/editors/space_graph/graph_draw.c10
-rw-r--r--source/blender/editors/space_graph/graph_intern.h4
-rw-r--r--source/blender/editors/space_image/image_intern.h3
-rw-r--r--source/blender/editors/space_image/image_ops.c14
-rw-r--r--source/blender/editors/space_nla/nla_intern.h5
-rw-r--r--source/blender/editors/space_node/drawnode.c7
-rw-r--r--source/blender/editors/space_node/node_draw.c10
-rw-r--r--source/blender/editors/space_node/node_edit.c93
-rw-r--r--source/blender/editors/space_node/node_header.c27
-rw-r--r--source/blender/editors/space_node/space_node.c26
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h3
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c6
-rw-r--r--source/blender/editors/space_script/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_script/script_header.c120
-rw-r--r--source/blender/editors/space_script/script_intern.h4
-rw-r--r--source/blender/editors/space_sound/CMakeLists.txt43
-rw-r--r--source/blender/editors/space_sound/SConscript9
-rw-r--r--source/blender/editors/space_sound/sound_header.c127
-rw-r--r--source/blender/editors/space_sound/sound_intern.h42
-rw-r--r--source/blender/editors/space_sound/space_sound.c266
-rw-r--r--source/blender/editors/space_time/time_intern.h3
-rw-r--r--source/blender/editors/space_view3d/drawobject.c44
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c22
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c145
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c65
-rw-r--r--source/blender/editors/transform/transform.c63
-rw-r--r--source/blender/editors/transform/transform_ops.c2
63 files changed, 1003 insertions, 1076 deletions
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 16c0d4a2c79..7b7d11bd487 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -46,7 +46,6 @@ if(WITH_BLENDER)
add_subdirectory(space_outliner)
add_subdirectory(space_script)
add_subdirectory(space_sequencer)
- add_subdirectory(space_sound)
add_subdirectory(space_text)
add_subdirectory(space_time)
add_subdirectory(space_userpref)
diff --git a/source/blender/editors/SConscript b/source/blender/editors/SConscript
index e8159bdf03f..a1b766ec2be 100644
--- a/source/blender/editors/SConscript
+++ b/source/blender/editors/SConscript
@@ -25,7 +25,6 @@ SConscript(['datafiles/SConscript',
'space_outliner/SConscript',
'space_time/SConscript',
'space_view3d/SConscript',
- 'space_sound/SConscript',
'space_action/SConscript',
'space_nla/SConscript',
'space_script/SConscript',
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 5345fcd756d..4a359acabd9 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -777,7 +777,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
fac= ((float)(evt->x - mm->firstx)*dx);
- if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND))
+ if (mm->slink->spacetype == SPACE_TIME)
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, FPS, 0.1*FPS, 0);
else
apply_keyb_grid(evt->shift, evt->ctrl, &fac, 0.0, 1.0, 0.1, 0 /*was: U.flag & USER_AUTOGRABGRID*/);
@@ -796,7 +796,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
if (totmark==1) {
/* we print current marker value */
- if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
+ if (mm->slink->spacetype == SPACE_TIME) {
SpaceTime *stime= (SpaceTime *)mm->slink;
if (stime->flag & TIME_DRAWFRAMES)
BLI_snprintf(str, sizeof(str), "Marker %d offset %d", selmarker->frame, offs);
@@ -816,7 +816,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
}
else {
/* we only print the offset */
- if (ELEM(mm->slink->spacetype, SPACE_TIME, SPACE_SOUND)) {
+ if (mm->slink->spacetype == SPACE_TIME) {
SpaceTime *stime= (SpaceTime *)mm->slink;
if (stime->flag & TIME_DRAWFRAMES)
BLI_snprintf(str, sizeof(str), "Marker offset %d ", offs);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index be6b322e6b4..95f3bb55ba5 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -223,7 +223,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TRANSFORM_OT_tilt", TKEY, KM_PRESS, KM_CTRL, 0);
- RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_CTRL, 0)->ptr, "mode", TFM_TILT);
RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_CURVE_SHRINKFATTEN);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 4087002598e..4a12206d404 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -2812,12 +2812,7 @@ void CURVE_OT_select_inverse(wmOperatorType *ot)
/** Divide the line segments associated with the currently selected
* curve nodes (Bezier or NURB). If there are no valid segment
* selections within the current selection, nothing happens.
- *
- * @deffunc subdividenurb subdivideNurb(void)
- * @return Nothing
- * @param None
-*/
-
+ */
static void subdividenurb(Object *obedit, int number_cuts)
{
Curve *cu= obedit->data;
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 28650452b3f..d2ac24cd9da 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -209,7 +209,7 @@ void ED_vgroup_select_by_name(struct Object *ob, const char *name);
int ED_vgroup_data_create(struct ID *id);
int ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
int ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);
-void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups);
+void ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups);
int ED_vgroup_object_is_edit_mode(struct Object *ob);
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index b6cb59e2f4a..18bb4975da9 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -51,7 +51,7 @@ void ED_node_changed_update(struct ID *id, struct bNode *node);
void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node);
/* node_edit.c */
-void ED_node_shader_default(struct Material *ma);
+void ED_node_shader_default(struct Scene *scene, struct ID *id);
void ED_node_composit_default(struct Scene *sce);
void ED_node_texture_default(struct Tex *tex);
void ED_node_link_intersect_test(struct ScrArea *sa, int test);
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h
index 651c298ad5e..7461f5e9e9f 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -44,6 +44,8 @@ void ED_operatortypes_render(void);
/* render_shading.c */
void ED_render_id_flush_update(struct Main *bmain, struct ID *id);
+void ED_render_engine_changed(struct Main *bmain);
+void ED_render_engine_update_tagged(struct bContext *C, struct Main *bmain);
/* render_preview.c */
@@ -54,7 +56,7 @@ typedef struct RenderInfo {
short curtile, tottile, status;
rcti disprect; /* storage for view3d preview rect */
unsigned int* rect;
- struct Render *re; /* persistant render */
+ struct Render *re; /* persistent render */
} RenderInfo;
/* ri->status */
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index f92ee724f6f..05537004927 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -159,6 +159,7 @@ int ED_operator_editmesh_view3d(struct bContext *C);
int ED_operator_editmesh_region_view3d(struct bContext *C);
int ED_operator_editarmature(struct bContext *C);
int ED_operator_editcurve(struct bContext *C);
+int ED_operator_editcurve_3d(struct bContext *C);
int ED_operator_editsurf(struct bContext *C);
int ED_operator_editsurfcurve(struct bContext *C);
int ED_operator_editsurfcurve_region_view3d(struct bContext *C);
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index 5c42dfc5d05..8e445ab1cee 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -46,7 +46,6 @@ void ED_spacetype_node(void);
void ED_spacetype_buttons(void);
void ED_spacetype_info(void);
void ED_spacetype_file(void);
-void ED_spacetype_sound(void);
void ED_spacetype_action(void);
void ED_spacetype_nla(void);
void ED_spacetype_script(void);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index f69abb0996a..e43ad964c9c 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -130,7 +130,6 @@ void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const
* In orthographic view the resulting ray_normal will match the view vector.
* @param ar The region (used for the window width and height).
* @param v3d The 3d viewport (used for near clipping value).
- * @param out The resulting normalized world-space direction vector.
* @param mval The area relative 2d location (such as event->mval, converted into float[2]).
* @param ray_start The world-space starting point of the segment.
* @param ray_normal The normalized world-space direction of towards mval.
@@ -140,7 +139,7 @@ void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mv
/**
* Calculate a normalized 3d direction vector from the viewpoint towards a global location.
* In orthographic view the resulting vector will match the view vector.
- * @param ar The region (used for the window width and height).
+ * @param rv3d The region (used for the window width and height).
* @param coord The world-space location.
* @param vec The resulting normalized vector.
*/
@@ -171,6 +170,7 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
* @param ofs The view offset to be set, normally from RegionView3D.ofs.
* @param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat.
* @param dist The view distance from ofs to be set, normally from RegionView3D.dist.
+ * @param lens The view lens angle set for cameras and lamps, normally from View3D.lens.
*/
void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 5b27fe88b4b..eff4d1f6397 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -962,6 +962,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
ARegion *ar;
uiBut *but;
rcti rect;
+ int multisample_enabled;
/* get menu region or area region */
ar= CTX_wm_menu(C);
@@ -971,6 +972,11 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
if(!block->endblock)
uiEndBlock(C, block);
+ /* disable AA, makes widgets too blurry */
+ multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
+ if(multisample_enabled)
+ glDisable(GL_MULTISAMPLE_ARB);
+
/* we set this only once */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1015,6 +1021,9 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
+
+ if(multisample_enabled)
+ glEnable(GL_MULTISAMPLE_ARB);
ui_draw_links(block);
}
@@ -2560,10 +2569,12 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
if(block->curlayout)
ui_layout_add_but(block->curlayout, but);
+#ifdef WITH_PYTHON
/* if the 'UI_OT_editsource' is running, extract the source info from the button */
if (UI_editsource_enable_check()) {
UI_editsource_active_but_test(but);
}
+#endif
return but;
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index e49cb4898d9..0ba141163b3 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -3216,6 +3216,63 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
return changed;
}
+static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift)
+{
+ float *hsv= ui_block_hsv_get(but->block);
+ float rgb[3];
+ float sensitivity = (shift?0.15:0.3) * ndof->dt;
+
+ int color_profile = but->block->color_profile;
+
+ if (but->rnaprop) {
+ if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
+ color_profile = BLI_PR_NONE;
+ }
+
+ ui_get_but_vectorf(but, rgb);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+
+ switch((int)but->a1) {
+ case UI_GRAD_SV:
+ hsv[2] += ndof->ry * sensitivity;
+ hsv[1] += ndof->rx * sensitivity;
+ break;
+ case UI_GRAD_HV:
+ hsv[0] += ndof->ry * sensitivity;
+ hsv[2] += ndof->rx * sensitivity;
+ break;
+ case UI_GRAD_HS:
+ hsv[0] += ndof->ry * sensitivity;
+ hsv[1] += ndof->rx * sensitivity;
+ break;
+ case UI_GRAD_H:
+ hsv[0] += ndof->ry * sensitivity;
+ break;
+ case UI_GRAD_S:
+ hsv[1] += ndof->ry * sensitivity;
+ break;
+ case UI_GRAD_V:
+ hsv[2] += ndof->ry * sensitivity;
+ break;
+ case UI_GRAD_V_ALT:
+ /* vertical 'value' strip */
+
+ /* exception only for value strip - use the range set in but->min/max */
+ hsv[2] += ndof->rx * sensitivity;
+
+ if (color_profile)
+ hsv[2] = srgb_to_linearrgb(hsv[2]);
+
+ CLAMP(hsv[2], but->softmin, but->softmax);
+ default:
+ assert(!"invalid hsv type");
+ }
+
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+ copy_v3_v3(data->vec, rgb);
+ ui_set_but_vectorf(but, data->vec);
+}
+
static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
int mx, my;
@@ -3238,8 +3295,18 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
return WM_UI_HANDLER_BREAK;
}
+ else if (event->type == NDOF_MOTION) {
+ wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata;
+
+ ui_ndofedit_but_HSVCUBE(but, data, ndof, event->shift);
+
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ ui_apply_button(C, but->block, but, data, 1);
+
+ return WM_UI_HANDLER_BREAK;
+ }
/* XXX hardcoded keymap check.... */
- else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) {
+ else if (event->type == DELKEY && event->val == KM_PRESS) {
if (but->a1==UI_GRAD_V_ALT){
int len;
@@ -3337,11 +3404,62 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
return changed;
}
+static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift)
+{
+ float *hsv= ui_block_hsv_get(but->block);
+ float rgb[3];
+ float phi, r /*, sqr */ /* UNUSED */, v[2];
+ float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt;
+
+ ui_get_but_vectorf(but, rgb);
+ rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+
+ /* Convert current colour on hue/sat disc to circular coordinates phi, r */
+ phi = fmodf(hsv[0]+0.25f, 1.0f) * -2.0f*M_PI;
+ r = hsv[1];
+ /* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */
+
+ /* Convert to 2d vectors */
+ v[0] = r * cosf(phi);
+ v[1] = r * sinf(phi);
+
+ /* Use ndof device y and x rotation to move the vector in 2d space */
+ v[0] += ndof->ry * sensitivity;
+ v[1] += ndof->rx * sensitivity;
+
+ /* convert back to polar coords on circle */
+ phi = atan2(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f;
+
+ /* use ndof z rotation to additionally rotate hue */
+ phi -= ndof->rz * sensitivity * 0.5f;
+
+ r = len_v2(v);
+ CLAMP(r, 0.0f, 1.0f);
+
+ /* convert back to hsv values, in range [0,1] */
+ hsv[0] = fmodf(phi, 1.0f);
+ hsv[1] = r;
+
+ /* exception, when using color wheel in 'locked' value state:
+ * allow choosing a hue for black values, by giving a tiny increment */
+ if (but->flag & UI_BUT_COLOR_LOCK) { // lock
+ if (hsv[2] == 0.0f) hsv[2] = 0.0001f;
+ }
+
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2);
+
+ if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) {
+ normalize_v3(data->vec);
+ mul_v3_fl(data->vec, but->a2);
+ }
+
+ ui_set_but_vectorf(but, data->vec);
+}
+
static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
int mx, my;
-
mx= event->x;
my= event->y;
ui_window_to_block(data->region, block, &mx, &my);
@@ -3360,8 +3478,18 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
+ else if (event->type == NDOF_MOTION) {
+ wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata;
+
+ ui_ndofedit_but_HSVCIRCLE(but, data, ndof, event->shift);
+
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ ui_apply_button(C, but->block, but, data, 1);
+
+ return WM_UI_HANDLER_BREAK;
+ }
/* XXX hardcoded keymap check.... */
- else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) {
+ else if (event->type == DELKEY && event->val == KM_PRESS) {
int len;
/* reset only saturation */
@@ -3810,7 +3938,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
- else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) {
+ else if (event->type == DELKEY && event->val == KM_PRESS) {
Histogram *hist = (Histogram *)but->poin;
hist->ymax = 1.f;
@@ -3893,7 +4021,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
return WM_UI_HANDLER_BREAK;
}
/* XXX hardcoded keymap check.... */
- else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) {
+ else if (event->type == DELKEY && event->val == KM_PRESS) {
Scopes *scopes = (Scopes *)but->poin;
scopes->wavefrm_yfac = 1.f;
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 27f94ae8e49..5803054caa7 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -43,6 +43,7 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
+#include "BKE_screen.h"
#include "BKE_global.h"
#include "BKE_text.h" /* for UI_OT_reports_to_text */
#include "BKE_report.h"
@@ -476,6 +477,7 @@ static void UI_OT_reports_to_textblock(wmOperatorType *ot)
ot->exec= reports_to_text_exec;
}
+#ifdef WITH_PYTHON
/* ------------------------------------------------------------------------- */
/* EditSource Utility funcs and operator,
@@ -576,24 +578,6 @@ void UI_editsource_active_but_test(uiBut *but)
/* editsource operator component */
-static ScrArea *biggest_text_view(bContext *C)
-{
- bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa, *big= NULL;
- int size, maxsize= 0;
-
- for(sa= sc->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_TEXT) {
- size= sa->winx * sa->winy;
- if(size > maxsize) {
- maxsize= size;
- big= sa;
- }
- }
- }
- return big;
-}
-
static int editsource_text_edit(bContext *C, wmOperator *op,
char filepath[240], int line)
{
@@ -618,7 +602,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
else {
/* naughty!, find text area to set, not good behavior
* but since this is a dev tool lets allow it - campbell */
- ScrArea *sa= biggest_text_view(C);
+ ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
if(sa) {
SpaceText *st= sa->spacedata.first;
st->text= text;
@@ -711,6 +695,7 @@ static void UI_OT_editsource(wmOperatorType *ot)
ot->exec= editsource_exec;
}
+#endif /* WITH_PYTHON */
/* ********************************************************* */
/* Registration */
@@ -723,6 +708,9 @@ void UI_buttons_operatortypes(void)
WM_operatortype_append(UI_OT_reset_default_button);
WM_operatortype_append(UI_OT_copy_to_selected_button);
WM_operatortype_append(UI_OT_reports_to_textblock); // XXX: temp?
+
+#ifdef WITH_PYTHON
WM_operatortype_append(UI_OT_editsource);
+#endif
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index d3a5c6691ef..921a1879bb7 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -129,18 +129,12 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
case SPACE_IMAGE:
ts= &btheme->tima;
break;
- case SPACE_IMASEL:
- ts= &btheme->timasel;
- break;
case SPACE_TEXT:
ts= &btheme->text;
break;
case SPACE_OUTLINER:
ts= &btheme->toops;
break;
- case SPACE_SOUND:
- ts= &btheme->tsnd;
- break;
case SPACE_INFO:
ts= &btheme->tinfo;
break;
@@ -528,12 +522,10 @@ static void ui_theme_init_new(bTheme *btheme)
ui_theme_init_new_do(&btheme->tfile);
ui_theme_init_new_do(&btheme->tipo);
ui_theme_init_new_do(&btheme->tinfo);
- ui_theme_init_new_do(&btheme->tsnd);
ui_theme_init_new_do(&btheme->tact);
ui_theme_init_new_do(&btheme->tnla);
ui_theme_init_new_do(&btheme->tseq);
ui_theme_init_new_do(&btheme->tima);
- ui_theme_init_new_do(&btheme->timasel);
ui_theme_init_new_do(&btheme->text);
ui_theme_init_new_do(&btheme->toops);
ui_theme_init_new_do(&btheme->ttime);
@@ -731,18 +723,6 @@ void ui_theme_init_default(void)
SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
SETCOLF(btheme->tima.preview_back, 0.45, 0.45, 0.45, 1.0);
- /* space imageselect */
- btheme->timasel= btheme->tv3d;
- SETCOL(btheme->timasel.active, 195, 195, 195, 255); /* active tile */
- SETCOL(btheme->timasel.grid, 94, 94, 94, 255); /* active file text */
- SETCOL(btheme->timasel.back, 110, 110, 110, 255);
- SETCOL(btheme->timasel.shade1, 94, 94, 94, 255); /* bar */
- SETCOL(btheme->timasel.shade2, 172, 172, 172, 255); /* sliders */
- SETCOL(btheme->timasel.hilite, 17, 27, 60, 100); /* selected tile */
- SETCOL(btheme->timasel.text, 0, 0, 0, 255);
- SETCOL(btheme->timasel.text_hi, 255, 255, 255, 255);
- SETCOL(btheme->timasel.panel, 132, 132, 132, 255);
-
/* space text */
btheme->text= btheme->tv3d;
SETCOL(btheme->text.back, 153, 153, 153, 255);
@@ -778,15 +758,11 @@ void ui_theme_init_default(void)
SETCOL(btheme->tconsole.console_error, 220, 96, 96, 255);
SETCOL(btheme->tconsole.console_cursor, 220, 96, 96, 255);
-
- /* space sound */
- btheme->tsnd= btheme->tv3d;
- SETCOLF(btheme->tsnd.back, 0.45, 0.45, 0.45, 1.0);
- SETCOLF(btheme->tsnd.grid, 0.36, 0.36, 0.36, 1.0);
- SETCOL(btheme->tsnd.shade1, 173, 173, 173, 255); // sliders
-
/* space time */
- btheme->ttime= btheme->tsnd; // same as sound space
+ btheme->ttime= btheme->tv3d;
+ SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
+ SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
+ SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
/* space node, re-uses syntax color storage */
btheme->tnode= btheme->tv3d;
@@ -801,7 +777,6 @@ void ui_theme_init_default(void)
/* space logic */
btheme->tlogic= btheme->tv3d;
SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
-
}
@@ -1193,7 +1168,11 @@ void init_userdef_do_versions(void)
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
/* check for alpha==0 is safe, then color was never set */
if(btheme->ttime.back[3]==0) {
- btheme->ttime = btheme->tsnd; // copy from sound
+ // copied from ui_theme_init_default
+ btheme->ttime= btheme->tv3d;
+ SETCOLF(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
+ SETCOLF(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
+ SETCOL(btheme->ttime.shade1, 173, 173, 173, 255); // sliders
}
if(btheme->text.syntaxn[3]==0) {
SETCOL(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
@@ -1320,7 +1299,7 @@ void init_userdef_do_versions(void)
SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
- SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255);
+ //SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
}
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 5455bf966ef..99af17c161e 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1456,11 +1456,11 @@ void MESH_OT_delete(wmOperatorType *ot)
/* calculates offset for co, based on fractal, sphere or smooth settings */
static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int beauty, float perc)
{
- float vec1[3], fac;
+ float tvec[3], fac;
if(beauty & B_SMOOTH) {
- /* we calculate an offset vector vec1[], to be added to *co */
- float len, fac, nor[3], nor1[3], nor2[3];
+ /* we calculate an offset vector tvec[], to be added to *co */
+ float len, nor[3], nor1[3], nor2[3];
sub_v3_v3v3(nor, edge->v1->co, edge->v2->co);
len= 0.5f*normalize_v3(nor);
@@ -1469,43 +1469,31 @@ static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int
copy_v3_v3(nor2, edge->v2->no);
/* cosine angle */
- fac= nor[0]*nor1[0] + nor[1]*nor1[1] + nor[2]*nor1[2] ;
-
- vec1[0]= fac*nor1[0];
- vec1[1]= fac*nor1[1];
- vec1[2]= fac*nor1[2];
+ fac= dot_v3v3(nor, nor1);
+ mul_v3_v3fl(tvec, nor1, fac);
/* cosine angle */
- fac= -nor[0]*nor2[0] - nor[1]*nor2[1] - nor[2]*nor2[2] ;
-
- vec1[0]+= fac*nor2[0];
- vec1[1]+= fac*nor2[1];
- vec1[2]+= fac*nor2[2];
+ fac= -dot_v3v3(nor, nor2);
+ madd_v3_v3fl(tvec, nor2, fac);
/* falloff for multi subdivide */
smooth *= sqrtf(fabs(1.0f - 2.0f*fabsf(0.5f-perc)));
- vec1[0]*= smooth*len;
- vec1[1]*= smooth*len;
- vec1[2]*= smooth*len;
+ mul_v3_fl(tvec, smooth * len);
- co[0] += vec1[0];
- co[1] += vec1[1];
- co[2] += vec1[2];
+ add_v3_v3(co, tvec);
}
else if(beauty & B_SPHERE) { /* subdivide sphere */
normalize_v3(co);
- co[0]*= smooth;
- co[1]*= smooth;
- co[2]*= smooth;
+ mul_v3_fl(co, smooth);
}
if(beauty & B_FRACTAL) {
fac= fractal*len_v3v3(edge->v1->co, edge->v2->co);
- vec1[0]= fac*(float)(0.5-BLI_drand());
- vec1[1]= fac*(float)(0.5-BLI_drand());
- vec1[2]= fac*(float)(0.5-BLI_drand());
- add_v3_v3(co, vec1);
+ tvec[0]= fac*(float)(0.5-BLI_drand());
+ tvec[1]= fac*(float)(0.5-BLI_drand());
+ tvec[2]= fac*(float)(0.5-BLI_drand());
+ add_v3_v3(co, tvec);
}
}
@@ -1517,9 +1505,7 @@ static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smoo
EditVert *ev;
float co[3];
- co[0] = (edge->v2->co[0]-edge->v1->co[0])*percent + edge->v1->co[0];
- co[1] = (edge->v2->co[1]-edge->v1->co[1])*percent + edge->v1->co[1];
- co[2] = (edge->v2->co[2]-edge->v1->co[2])*percent + edge->v1->co[2];
+ interp_v3_v3v3(co, edge->v1->co, edge->v2->co, percent);
/* offset for smooth or sphere or fractal */
alter_co(co, edge, smooth, fractal, beauty, percent);
@@ -1543,9 +1529,7 @@ static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smoo
EM_data_interp_from_verts(em, edge->v1, edge->v2, ev, percent);
/* normal */
- ev->no[0] = (edge->v2->no[0]-edge->v1->no[0])*percent + edge->v1->no[0];
- ev->no[1] = (edge->v2->no[1]-edge->v1->no[1])*percent + edge->v1->no[1];
- ev->no[2] = (edge->v2->no[2]-edge->v1->no[2])*percent + edge->v1->no[2];
+ interp_v3_v3v3(ev->no, edge->v1->no, edge->v2->no, percent);
normalize_v3(ev->no);
return ev;
@@ -6986,12 +6970,12 @@ static void beautify_fill(EditMesh *em)
w= EM_face_from_faces(em, efaa[0], efaa[1],
vindex[0], vindex[1], 4+vindex[2], -1);
- w->f |= SELECT;
+ EM_select_face(w, 1);
w= EM_face_from_faces(em, efaa[0], efaa[1],
vindex[0], 4+vindex[2], 4+vindex[3], -1);
- w->f |= SELECT;
+ EM_select_face(w, 1);
onedone= 1;
}
@@ -7007,12 +6991,11 @@ static void beautify_fill(EditMesh *em)
w= EM_face_from_faces(em, efaa[0], efaa[1],
vindex[1], 4+vindex[2], 4+vindex[3], -1);
- w->f |= SELECT;
-
+ EM_select_face(w, 1);
w= EM_face_from_faces(em, efaa[0], efaa[1],
vindex[0], 4+vindex[1], 4+vindex[3], -1);
- w->f |= SELECT;
+ EM_select_face(w, 1);
onedone= 1;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 452e7e4857c..7ff233fa609 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -863,6 +863,7 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
/* note: now unlinks constraints as well */
void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
{
+ DAG_id_type_tag(bmain, ID_OB);
BLI_remlink(&scene->base, base);
free_libblock_us(&bmain->object, base->object);
if(scene->basact==base) scene->basact= NULL;
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index e29dfaa0a23..5487cbdadb2 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -54,6 +54,7 @@
#include "BLI_math_geom.h"
#include "BKE_blender.h"
+#include "BKE_screen.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_image.h"
@@ -1202,24 +1203,6 @@ static int thread_break(void *UNUSED(arg))
return G.afbreek;
}
-static ScrArea *biggest_image_area(bScreen *screen)
-{
- ScrArea *sa, *big= NULL;
- int size, maxsize= 0;
-
- for(sa= screen->areabase.first; sa; sa= sa->next) {
- if(sa->spacetype==SPACE_IMAGE) {
- size= sa->winx*sa->winy;
- if(sa->winx > 10 && sa->winy > 10 && size > maxsize) {
- maxsize= size;
- big= sa;
- }
- }
- }
- return big;
-}
-
-
typedef struct BakeRender {
Render *re;
Main *main;
@@ -1270,7 +1253,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C)
/* get editmode results */
ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
- bkr->sa= biggest_image_area(CTX_wm_screen(C)); /* can be NULL */
+ bkr->sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_IMAGE, 10); /* can be NULL */
bkr->main= CTX_data_main(C);
bkr->scene= scene;
bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 04272b48d51..f2997dc743d 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -145,6 +145,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
}
}
if (changed) {
+ DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
@@ -197,6 +198,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
if (changed) {
+ DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
@@ -1180,7 +1182,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
base->object->min_vel= ob->min_vel;
base->object->max_vel= ob->max_vel;
if (ob->gameflag & OB_BOUNDS) {
- base->object->boundtype = ob->boundtype;
+ base->object->collision_boundtype = ob->collision_boundtype;
}
base->object->margin= ob->margin;
base->object->bsoft= copy_bulletsoftbody(ob->bsoft);
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 1efe79fff9e..a82ed95079f 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -645,7 +645,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
/* get the view settings if 'around' isnt set and the view is available */
View3D *v3d= CTX_wm_view3d(C);
copy_v3_v3(cursor, give_cursor(scene, v3d));
- if(v3d && !RNA_property_is_set(op->ptr, "around"))
+ if(v3d && !RNA_property_is_set(op->ptr, "center"))
around= v3d->around;
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index d4ee68f8b72..a59ca5ad954 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -99,8 +99,7 @@ int ED_vgroup_object_is_edit_mode(Object *ob)
bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
{
bDeformGroup *defgroup;
-
- if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE))
+ if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
return NULL;
defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
@@ -1528,14 +1527,32 @@ static void vgroup_clean_all(Object *ob, float eul, int keep_single)
static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
const char sel, const char sel_mirr,
const int *flip_map, const int flip_map_len,
- const short mirror_weights, const short flip_vgroups)
+ const short mirror_weights, const short flip_vgroups,
+ const short all_vgroups, const int act_vgroup)
{
BLI_assert(sel || sel_mirr);
if(sel_mirr && sel) {
/* swap */
- if(mirror_weights)
- SWAP(MDeformVert, *dvert, *dvert_mirr);
+ if(mirror_weights) {
+ if (all_vgroups) {
+ SWAP(MDeformVert, *dvert, *dvert_mirr);
+ }
+ else {
+ MDeformWeight *dw= defvert_find_index(dvert, act_vgroup);
+ MDeformWeight *dw_mirr= defvert_find_index(dvert_mirr, act_vgroup);
+
+ if (dw || dw_mirr) {
+ if (dw_mirr == NULL)
+ dw_mirr= defvert_verify_index(dvert_mirr, act_vgroup);
+ if (dw == NULL)
+ dw= defvert_verify_index(dvert, act_vgroup);
+
+ SWAP(float, dw->weight, dw_mirr->weight);
+ }
+ }
+ }
+
if(flip_vgroups) {
defvert_flip(dvert, flip_map, flip_map_len);
defvert_flip(dvert_mirr, flip_map, flip_map_len);
@@ -1555,52 +1572,109 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
}
}
-void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_vgroups)
+/* TODO, vgroup locking */
+/* TODO, face masking */
+void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups)
{
-#define VGROUP_MIRR_OP dvert_mirror_op(dvert, dvert_mirr, sel, sel_mirr, flip_map, flip_map_len, mirror_weights, flip_vgroups)
+
+#define VGROUP_MIRR_OP \
+ dvert_mirror_op(dvert, dvert_mirr, \
+ sel, sel_mirr, \
+ flip_map, flip_map_len, \
+ mirror_weights, flip_vgroups, \
+ all_vgroups, act_vgroup \
+ )
EditVert *eve, *eve_mirr;
MDeformVert *dvert, *dvert_mirr;
short sel, sel_mirr;
int *flip_map, flip_map_len;
+ const int act_vgroup= ob->actdef > 0 ? ob->actdef-1 : 0;
if(mirror_weights==0 && flip_vgroups==0)
return;
- flip_map= defgroup_flip_map(ob, &flip_map_len, FALSE);
+ flip_map= all_vgroups ?
+ defgroup_flip_map(ob, &flip_map_len, FALSE) :
+ defgroup_flip_map_single(ob, &flip_map_len, FALSE, act_vgroup);
/* only the active group */
if(ob->type == OB_MESH) {
Mesh *me= ob->data;
EditMesh *em = BKE_mesh_get_editmesh(me);
+ if (em) {
+ if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
+ MEM_freeN(flip_map);
+ return;
+ }
- if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
- MEM_freeN(flip_map);
- return;
+ EM_cache_x_mirror_vert(ob, em);
+
+ /* Go through the list of editverts and assign them */
+ for(eve=em->verts.first; eve; eve=eve->next){
+ if((eve_mirr=eve->tmp.v)) {
+ sel= eve->f & SELECT;
+ sel_mirr= eve_mirr->f & SELECT;
+
+ if((sel || sel_mirr) && (eve != eve_mirr)) {
+ dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+ dvert_mirr= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT);
+ if(dvert && dvert_mirr) {
+ VGROUP_MIRR_OP;
+ }
+ }
+
+ eve->tmp.v= eve_mirr->tmp.v= NULL;
+ }
+ }
+
+ BKE_mesh_end_editmesh(me, em);
}
+ else {
+ /* object mode / weight paint */
+ MVert *mv, *mv_mirr;
+ int vidx, vidx_mirr;
+ const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+
+ if (me->dvert == NULL) {
+ MEM_freeN(flip_map);
+ return;
+ }
- EM_cache_x_mirror_vert(ob, em);
+ if (!use_vert_sel) {
+ sel= sel_mirr= TRUE;
+ }
+
+ /* tag verts we have used */
+ for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ mv->flag &= ~ME_VERT_TMP_TAG;
+ }
+
+ for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+ if ( ((mv->flag & ME_VERT_TMP_TAG) == 0) &&
+ ((vidx_mirr= mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
+ (vidx != vidx_mirr) &&
+ ((((mv_mirr= me->mvert + vidx_mirr)->flag) & ME_VERT_TMP_TAG) == 0))
+ {
+
+ if (use_vert_sel) {
+ sel= mv->flag & SELECT;
+ sel_mirr= mv_mirr->flag & SELECT;
+ }
+
+ if (sel || sel_mirr) {
+ dvert= &me->dvert[vidx];
+ dvert_mirr= &me->dvert[vidx_mirr];
- /* Go through the list of editverts and assign them */
- for(eve=em->verts.first; eve; eve=eve->next){
- if((eve_mirr=eve->tmp.v)) {
- sel= eve->f & SELECT;
- sel_mirr= eve_mirr->f & SELECT;
-
- if((sel || sel_mirr) && (eve != eve_mirr)) {
- dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
- dvert_mirr= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT);
- if(dvert && dvert_mirr) {
VGROUP_MIRR_OP;
}
- }
- eve->tmp.v= eve_mirr->tmp.v= NULL;
+ mv->flag |= ME_VERT_TMP_TAG;
+ mv_mirr->flag |= ME_VERT_TMP_TAG;
+ }
}
}
-
- BKE_mesh_end_editmesh(me, em);
}
else if (ob->type == OB_LATTICE) {
Lattice *lt= ob->data;
@@ -2013,7 +2087,7 @@ static int vertex_group_poll(bContext *C)
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
ID *data= (ob)? ob->data: NULL;
- return (ob && !ob->id.lib && ELEM(ob->type, OB_MESH, OB_LATTICE) && data && !data->lib);
+ return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib);
}
static int vertex_group_poll_edit(bContext *C)
@@ -2509,7 +2583,10 @@ static int vertex_group_mirror_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- ED_vgroup_mirror(ob, RNA_boolean_get(op->ptr,"mirror_weights"), RNA_boolean_get(op->ptr,"flip_group_names"));
+ ED_vgroup_mirror(ob,
+ RNA_boolean_get(op->ptr,"mirror_weights"),
+ RNA_boolean_get(op->ptr,"flip_group_names"),
+ RNA_boolean_get(op->ptr,"all_groups"));
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -2527,7 +2604,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
"flipping when both sides are selected otherwise copy from unselected";
/* api callbacks */
- ot->poll= vertex_group_poll_edit;
+ ot->poll= vertex_group_poll;
ot->exec= vertex_group_mirror_exec;
/* flags */
@@ -2536,6 +2613,7 @@ void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "mirror_weights", TRUE, "Mirror Weights", "Mirror weights");
RNA_def_boolean(ot->srna, "flip_group_names", TRUE, "Flip Groups", "Flip vertex group names");
+ RNA_def_boolean(ot->srna, "all_groups", FALSE, "All Groups", "Mirror all vertex groups weights");
}
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 2f0958371f9..cc1c8843015 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -223,20 +223,26 @@ static int screen_render_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
SceneRenderLayer *srl= NULL;
- Render *re= RE_NewRender(scene->id.name);
+ Render *re;
Image *ima;
View3D *v3d= CTX_wm_view3d(C);
Main *mainp= CTX_data_main(C);
- unsigned int lay= (v3d)? v3d->lay: scene->lay;
+ unsigned int lay;
const short is_animation= RNA_boolean_get(op->ptr, "animation");
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
+ /* custom scene and single layer re-render */
+ screen_render_scene_layer_set(op, mainp, &scene, &srl);
+
if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected");
return OPERATOR_CANCELLED;
}
+ re= RE_NewRender(scene->id.name);
+ lay= (v3d)? v3d->lay: scene->lay;
+
G.afbreek= 0;
RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
@@ -252,9 +258,6 @@ static int screen_render_exec(bContext *C, wmOperator *op)
RE_SetReports(re, op->reports);
- /* custom scene and single layer re-render */
- screen_render_scene_layer_set(op, mainp, &scene, &srl);
-
if(is_animation)
RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
else
@@ -500,6 +503,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
const short is_animation= RNA_boolean_get(op->ptr, "animation");
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
+ const char *name;
/* only one render job at a time */
if(WM_jobs_test(CTX_wm_manager(C), scene))
@@ -574,7 +578,10 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj->reports= op->reports;
/* setup job */
- steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Render", jobflag);
+ if(RE_seq_render_active(scene, &scene->r)) name= "Sequence Render";
+ else name= "Render";
+
+ steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
WM_jobs_customdata(steve, rj, render_freejob);
WM_jobs_timer(steve, 0.2, NC_SCENE|ND_RENDER_RESULT, 0);
WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 49bdb103139..9da160948cc 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -420,6 +420,12 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
base->object->data= la;
}
}
+
+ if(la && la->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ /* two previews, they get copied by wmJob */
+ ntreeInitPreview(origla->nodetree, sp->sizex, sp->sizey);
+ ntreeInitPreview(la->nodetree, sp->sizex, sp->sizey);
+ }
}
else if(id_type==ID_WO) {
World *wrld= NULL, *origwrld= (World *)id;
@@ -432,6 +438,12 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->lay= 1<<MA_SKY;
sce->world= wrld;
+
+ if(wrld && wrld->nodetree && sp->pr_method==PR_NODE_RENDER) {
+ /* two previews, they get copied by wmJob */
+ ntreeInitPreview(wrld->nodetree, sp->sizex, sp->sizey);
+ ntreeInitPreview(origwrld->nodetree, sp->sizex, sp->sizey);
+ }
}
return sce;
@@ -566,6 +578,18 @@ static void shader_preview_updatejob(void *spv)
if(sp->texcopy && tex->nodetree && sp->texcopy->nodetree)
ntreeLocalSync(sp->texcopy->nodetree, tex->nodetree);
}
+ else if( GS(sp->id->name) == ID_WO) {
+ World *wrld= (World *)sp->id;
+
+ if(sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree)
+ ntreeLocalSync(sp->worldcopy->nodetree, wrld->nodetree);
+ }
+ else if( GS(sp->id->name) == ID_LA) {
+ Lamp *la= (Lamp *)sp->id;
+
+ if(sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
+ ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree);
+ }
}
}
}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 35d679146fe..80c54d970b4 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -26,7 +26,6 @@
* \ingroup edrend
*/
-
#include <stdlib.h>
#include <string.h>
@@ -76,6 +75,7 @@
#include "ED_curve.h"
#include "ED_mesh.h"
+#include "ED_node.h"
#include "ED_render.h"
#include "ED_screen.h"
@@ -363,16 +363,24 @@ void OBJECT_OT_material_slot_copy(wmOperatorType *ot)
static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Scene *scene= CTX_data_scene(C);
Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
PointerRNA ptr, idptr;
PropertyRNA *prop;
/* add or copy material */
- if(ma)
+ if(ma) {
ma= copy_material(ma);
- else
+ }
+ else {
ma= add_material("Material");
+ if(scene_use_new_shading_nodes(scene)) {
+ ED_node_shader_default(scene, &ma->id);
+ ma->use_nodes= 1;
+ }
+ }
+
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
@@ -455,16 +463,24 @@ void TEXTURE_OT_new(wmOperatorType *ot)
static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
{
+ Scene *scene= CTX_data_scene(C);
World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
PointerRNA ptr, idptr;
PropertyRNA *prop;
/* add or copy world */
- if(wo)
+ if(wo) {
wo= copy_world(wo);
- else
+ }
+ else {
wo= add_world("World");
+ if(scene_use_new_shading_nodes(scene)) {
+ ED_node_shader_default(scene, &wo->id);
+ wo->use_nodes= 1;
+ }
+ }
+
/* hook into UI */
uiIDContextProperty(C, &ptr, &prop);
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index e80c3d85670..72ea79fae7e 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -56,11 +56,110 @@
#include "GPU_material.h"
+#include "RE_engine.h"
+
#include "ED_node.h"
#include "ED_render.h"
#include "render_intern.h" // own include
+/***************************** Render Engines ********************************/
+
+void ED_render_engine_update_tagged(bContext *C, Main *bmain)
+{
+ /* viewport rendering update on data changes, happens after depsgraph
+ * updates if there was any change. context is set to the 3d view */
+ bScreen *sc, *prev_sc= CTX_wm_screen(C);
+ ScrArea *sa, *prev_sa= CTX_wm_area(C);
+ ARegion *ar, *prev_ar= CTX_wm_region(C);
+
+ for(sc=bmain->screen.first; sc; sc=sc->id.next) {
+ for(sa=sc->areabase.first; sa; sa=sa->next) {
+ if(sa->spacetype != SPACE_VIEW3D)
+ continue;
+
+ for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ RegionView3D *rv3d;
+ RenderEngine *engine;
+
+ if(ar->regiontype != RGN_TYPE_WINDOW)
+ continue;
+
+ rv3d= ar->regiondata;
+ engine= rv3d->render_engine;
+
+ if(engine && (engine->flag & RE_ENGINE_DO_UPDATE)) {
+ CTX_wm_screen_set(C, sc);
+ CTX_wm_area_set(C, sa);
+ CTX_wm_region_set(C, ar);
+
+ engine->flag &= ~RE_ENGINE_DO_UPDATE;
+ engine->type->view_update(engine, C);
+ }
+ }
+ }
+ }
+
+ CTX_wm_screen_set(C, prev_sc);
+ CTX_wm_area_set(C, prev_sa);
+ CTX_wm_region_set(C, prev_ar);
+}
+
+void ED_render_engine_changed(Main *bmain)
+{
+ /* on changing the render engine type, clear all running render engines */
+ bScreen *sc;
+ ScrArea *sa;
+ ARegion *ar;
+
+ for(sc=bmain->screen.first; sc; sc=sc->id.next) {
+ for(sa=sc->areabase.first; sa; sa=sa->next) {
+ if(sa->spacetype != SPACE_VIEW3D)
+ continue;
+
+ for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ RegionView3D *rv3d;
+
+ if(ar->regiontype != RGN_TYPE_WINDOW)
+ continue;
+
+ rv3d= ar->regiondata;
+
+ if(rv3d->render_engine) {
+ RE_engine_free(rv3d->render_engine);
+ rv3d->render_engine= NULL;
+ }
+ }
+ }
+ }
+}
+
+static void tag_render_engines(Main *bmain)
+{
+ /* tag running render engines for update later on */
+ bScreen *sc;
+ ScrArea *sa;
+ ARegion *ar;
+
+ for(sc=bmain->screen.first; sc; sc=sc->id.next) {
+ for(sa=sc->areabase.first; sa; sa=sa->next) {
+ if(sa->spacetype != SPACE_VIEW3D)
+ continue;
+
+ for(ar=sa->regionbase.first; ar; ar=ar->next) {
+ RegionView3D *rv3d;
+
+ if(ar->regiontype != RGN_TYPE_WINDOW)
+ continue;
+
+ rv3d= ar->regiondata;
+ if(rv3d->render_engine)
+ rv3d->render_engine->flag |= RE_ENGINE_DO_UPDATE;
+ }
+ }
+ }
+}
+
/***************************** Updates ***********************************
* ED_render_id_flush_update gets called from DAG_id_tag_update, to do *
* editor level updates when the ID changes. when these ID blocks are in *
@@ -135,6 +234,7 @@ static void texture_changed(Main *bmain, Tex *tex)
/* find lamps */
for(la=bmain->lamp.first; la; la=la->id.next) {
if(mtex_use_tex(la->mtex, MAX_MTEX, tex));
+ else if(la->nodetree && nodes_use_tex(la->nodetree, tex));
else continue;
BKE_icon_changed(BKE_icon_getid(&la->id));
@@ -143,6 +243,7 @@ static void texture_changed(Main *bmain, Tex *tex)
/* find worlds */
for(wo=bmain->world.first; wo; wo=wo->id.next) {
if(mtex_use_tex(wo->mtex, MAX_MTEX, tex));
+ else if(wo->nodetree && nodes_use_tex(wo->nodetree, tex));
else continue;
BKE_icon_changed(BKE_icon_getid(&wo->id));
@@ -220,8 +321,10 @@ static void scene_changed(Main *bmain, Scene *UNUSED(scene))
void ED_render_id_flush_update(Main *bmain, ID *id)
{
- if(!id)
+ if(!id) {
+ tag_render_engines(bmain);
return;
+ }
switch(GS(id->name)) {
case ID_MA:
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index 47957c0bb5a..d8719c7d7cd 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -58,6 +58,7 @@
/* returns biggest area that is not uv/image editor. Note that it uses buttons */
/* window as the last possible alternative. */
+/* would use BKE_screen_find_big_area(...) but this is too specific */
static ScrArea *biggest_non_image_area(bContext *C)
{
bScreen *sc= CTX_wm_screen(C);
@@ -85,22 +86,6 @@ static ScrArea *biggest_non_image_area(bContext *C)
return big;
}
-static ScrArea *biggest_area(bContext *C)
-{
- bScreen *sc= CTX_wm_screen(C);
- ScrArea *sa, *big= NULL;
- int size, maxsize= 0;
-
- for(sa= sc->areabase.first; sa; sa= sa->next) {
- size= sa->winx*sa->winy;
- if(size > maxsize) {
- maxsize= size;
- big= sa;
- }
- }
- return big;
-}
-
static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
{
wmWindowManager *wm= CTX_wm_manager(C);
@@ -206,7 +191,7 @@ void render_view_open(bContext *C, int mx, int my)
}
else {
/* use any area of decent size */
- sa= biggest_area(C);
+ sa= BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0);
if(sa->spacetype!=SPACE_IMAGE) {
// XXX newspace(sa, SPACE_IMAGE);
sima= sa->spacedata.first;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 7e79849ba40..9d6d663df5c 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -84,19 +84,19 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
/* right */
- glColor4ub(0,0,0, 50);
+ glColor4ub(0,0,0, 30);
sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax);
/* bottom */
- glColor4ub(0,0,0, 80);
+ glColor4ub(0,0,0, 30);
sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin);
/* top */
- glColor4ub(255,255,255, 60);
+ glColor4ub(255,255,255, 30);
sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax);
/* left */
- glColor4ub(255,255,255, 50);
+ glColor4ub(255,255,255, 30);
sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax);
glDisable( GL_BLEND );
@@ -414,6 +414,9 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* note; this sets state, so we can use wmOrtho and friends */
wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
+
+ ar->do_draw= 0;
+ memset(&ar->drawrct, 0, sizeof(ar->drawrct));
UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
@@ -429,18 +432,15 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
at->draw(C, ar);
}
+ /* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
+ ED_region_pixelspace(ar);
+
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
uiFreeInactiveBlocks(C, &ar->uiblocks);
-
+
if(sa)
region_draw_emboss(ar, &winrct);
-
- /* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */
- ED_region_pixelspace(ar);
-
- ar->do_draw= 0;
- memset(&ar->drawrct, 0, sizeof(ar->drawrct));
}
/* **********************************
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 0a7e3a2763a..e86dd8dbde3 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -192,7 +192,7 @@ int ED_operator_animview_active(bContext *C)
{
if(ED_operator_areaactive(C)) {
SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
- if (sl && (ELEM6(sl->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
+ if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
return TRUE;
}
@@ -406,6 +406,17 @@ int ED_operator_editcurve(bContext *C)
return 0;
}
+int ED_operator_editcurve_3d(bContext *C)
+{
+ Object *obedit= CTX_data_edit_object(C);
+ if(obedit && obedit->type==OB_CURVE) {
+ Curve *cu= (Curve *)obedit->data;
+
+ return (cu->flag&CU_3D) && (NULL != cu->editnurb);
+ }
+ return 0;
+}
+
int ED_operator_editsurf(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index d49ce0cf49a..6b6003fb098 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -57,6 +57,7 @@
#include "IMB_imbuf_types.h"
#include "DNA_brush_types.h"
+#include "DNA_camera_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
@@ -3000,7 +3001,8 @@ static void project_paint_begin(ProjPaintState *ps)
Object *camera= ps->scene->camera;
/* dont actually use these */
- float _viewdx, _viewdy, _ycor, _lens=0.0f;
+ float _viewdx, _viewdy, _ycor, _lens=0.0f, _sensor_x=DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
+ short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
rctf _viewplane;
/* viewmat & viewinv */
@@ -3012,7 +3014,7 @@ static void project_paint_begin(ProjPaintState *ps)
object_camera_mode(&ps->scene->r, camera);
object_camera_matrix(&ps->scene->r, camera, ps->winx, ps->winy, 0,
winmat, &_viewplane, &ps->clipsta, &ps->clipend,
- &_lens, &_ycor, &_viewdx, &_viewdy);
+ &_lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_ycor, &_viewdx, &_viewdy);
ps->is_ortho= (ps->scene->r.mode & R_ORTHO) ? 1 : 0;
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 3e2c4666528..57f926b0612 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -387,37 +387,16 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
/* fills in the selected faces with the current weight and vertex group */
void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
{
- Mesh *me;
+ Mesh *me= ob->data;
+ MFace *mf;
MDeformWeight *dw, *uw;
- int *indexar;
- unsigned int index;
int vgroup, vgroup_mirror= -1;
- int selected;
-
- int use_vert_sel;
-
- me= ob->data;
- if(me==NULL || me->totface==0 || me->dvert==NULL || !me->mface) return;
-
- selected= (me->editflag & ME_EDIT_PAINT_MASK);
-
- use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+ unsigned int index;
- indexar= get_indexarray(me);
+ /* mutually exclusive, could be made into a */
+ const short paint_selmode= ME_EDIT_PAINT_SEL_MODE(me);
- if(selected) {
- MFace *mf;
- for(index=0, mf= me->mface; index<me->totface; index++, mf++) {
- if((mf->flag & ME_FACE_SEL)==0)
- indexar[index]= 0;
- else
- indexar[index]= index+1;
- }
- }
- else {
- for(index=0; index<me->totface; index++)
- indexar[index]= index+1;
- }
+ if(me->totface==0 || me->dvert==NULL || !me->mface) return;
vgroup= ob->actdef-1;
@@ -428,47 +407,47 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
copy_wpaint_prev(wp, me->dvert, me->totvert);
- for(index=0; index<me->totface; index++) {
- if(indexar[index] && indexar[index]<=me->totface) {
- MFace *mf= &me->mface[indexar[index]-1];
- unsigned int fidx= mf->v4 ? 3:2;
+ for(index=0, mf= me->mface; index < me->totface; index++, mf++) {
+ unsigned int fidx= mf->v4 ? 3:2;
- do {
- unsigned int vidx= *(&mf->v1 + fidx);
+ if ((paint_selmode == SCE_SELECT_FACE) && !(mf->flag & ME_FACE_SEL)) {
+ continue;
+ }
- if(!me->dvert[vidx].flag) {
- if(use_vert_sel && !(me->mvert[vidx].flag & SELECT)) {
- continue;
- }
+ do {
+ unsigned int vidx= *(&mf->v1 + fidx);
- dw= defvert_verify_index(&me->dvert[vidx], vgroup);
- if(dw) {
- uw= defvert_verify_index(wp->wpaint_prev+vidx, vgroup);
- uw->weight= dw->weight; /* set the undo weight */
- dw->weight= paintweight;
-
- if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
- int j= mesh_get_x_mirror_vert(ob, vidx);
- if(j>=0) {
- /* copy, not paint again */
- if(vgroup_mirror != -1) {
- dw= defvert_verify_index(me->dvert+j, vgroup_mirror);
- uw= defvert_verify_index(wp->wpaint_prev+j, vgroup_mirror);
- } else {
- dw= defvert_verify_index(me->dvert+j, vgroup);
- uw= defvert_verify_index(wp->wpaint_prev+j, vgroup);
- }
- uw->weight= dw->weight; /* set the undo weight */
- dw->weight= paintweight;
+ if(!me->dvert[vidx].flag) {
+ if((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
+ continue;
+ }
+
+ dw= defvert_verify_index(&me->dvert[vidx], vgroup);
+ if(dw) {
+ uw= defvert_verify_index(wp->wpaint_prev+vidx, vgroup);
+ uw->weight= dw->weight; /* set the undo weight */
+ dw->weight= paintweight;
+
+ if(me->editflag & ME_EDIT_MIRROR_X) { /* x mirror painting */
+ int j= mesh_get_x_mirror_vert(ob, vidx);
+ if(j>=0) {
+ /* copy, not paint again */
+ if(vgroup_mirror != -1) {
+ dw= defvert_verify_index(me->dvert+j, vgroup_mirror);
+ uw= defvert_verify_index(wp->wpaint_prev+j, vgroup_mirror);
+ } else {
+ dw= defvert_verify_index(me->dvert+j, vgroup);
+ uw= defvert_verify_index(wp->wpaint_prev+j, vgroup);
}
+ uw->weight= dw->weight; /* set the undo weight */
+ dw->weight= paintweight;
}
}
- me->dvert[vidx].flag= 1;
}
+ me->dvert[vidx].flag= 1;
+ }
-
- } while (fidx--);
- }
+ } while (fidx--);
}
{
@@ -477,8 +456,7 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
dv->flag= 0;
}
}
-
- MEM_freeN(indexar);
+
copy_wpaint_prev(wp, NULL, 0);
DAG_id_tag_update(&me->id, 0);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 0b009dba651..c26a4d52a9e 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -208,7 +208,8 @@ typedef struct StrokeCache {
int first_time; /* Beginning of stroke may do some things special */
- bglMats *mats;
+ /* from ED_view3d_ob_project_mat_get() */
+ float projection_mat[4][4];
/* Clean this up! */
ViewContext *vc;
@@ -405,7 +406,8 @@ static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float loca
}
}
-static float frontface(Brush *brush, float sculpt_normal[3], short no[3], float fno[3])
+static float frontface(Brush *brush, const float sculpt_normal[3],
+ const short no[3], const float fno[3])
{
if (brush->flag & BRUSH_FRONTFACE) {
float dot;
@@ -655,7 +657,11 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
}
/* Return a multiplier for brush strength on a particular vertex. */
-static float tex_strength(SculptSession *ss, Brush *br, float *point, const float len)
+static float tex_strength(SculptSession *ss, Brush *br, float point[3],
+ const float len,
+ const float sculpt_normal[3],
+ const short vno[3],
+ const float fno[3])
{
MTex *mtex = &br->mtex;
float avg= 1;
@@ -673,7 +679,8 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
}
else if(ss->texcache) {
float rotation = -mtex->rot;
- float x, y, point_2d[3];
+ float symm_point[3], point_2d[2];
+ float x, y;
float radius;
/* if the active area is being applied for symmetry, flip it
@@ -681,12 +688,13 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
position in order to project it. This insures that the
brush texture will be oriented correctly. */
- flip_coord(point_2d, point, ss->cache->mirror_symmetry_pass);
+ flip_coord(symm_point, point, ss->cache->mirror_symmetry_pass);
if (ss->cache->radial_symmetry_pass)
- mul_m4_v3(ss->cache->symm_rot_mat_inv, point_2d);
+ mul_m4_v3(ss->cache->symm_rot_mat_inv, symm_point);
- projectf(ss->cache->mats, point_2d, point_2d);
+ ED_view3d_project_float(ss->cache->vc->ar, symm_point, point_2d,
+ ss->cache->projection_mat);
/* if fixed mode, keep coordinates relative to mouse */
if(mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) {
@@ -742,7 +750,10 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
avg += br->texture_sample_bias;
- avg *= brush_curve_strength(br, len, ss->cache->radius); /* Falloff curve */
+ /* Falloff curve */
+ avg *= brush_curve_strength(br, len, ss->cache->radius);
+
+ avg *= frontface(br, sculpt_normal, vno, fno);
return avg;
}
@@ -980,7 +991,8 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, ss->cache->view_normal, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
+ ss->cache->view_normal, vd.no, vd.fno);
float avg[3], val[3];
neighbor_average(ss, avg, vd.vert_indices[vd.i]);
@@ -1073,7 +1085,8 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
fno= data[index].no;
if(sculpt_brush_test(&test, co)) {
- const float fade = bstrength*tex_strength(ss, brush, co, test.dist)*frontface(brush, ss->cache->view_normal, NULL, fno);
+ const float fade = bstrength*tex_strength(ss, brush, co, test.dist,
+ ss->cache->view_normal, NULL, fno);
float *avg, val[3];
float n;
@@ -1169,9 +1182,9 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if (sculpt_brush_test(&test, vd.co)) {
- //if(sculpt_brush_test_cyl(&test, vd.co, ss->cache->location, area_normal)) {
/* offset vertex */
- float fade = tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno);
+ float fade = tex_strength(ss, brush, vd.co, test.dist,
+ area_normal, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], offset, fade);
@@ -1225,7 +1238,8 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
/* offset vertex */
- const float fade = tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno);
+ const float fade = tex_strength(ss, brush, vd.co, test.dist,
+ area_normal, vd.no, vd.fno);
float val1[3];
float val2[3];
@@ -1266,7 +1280,8 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, ss->cache->view_normal, vd.no, vd.fno);
+ float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
+ ss->cache->view_normal, vd.no, vd.fno);
float val[3];
sub_v3_v3v3(val, test.location, vd.co);
@@ -1326,7 +1341,8 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist)*frontface(brush, an, origno[vd.i], NULL);
+ const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
+ an, origno[vd.i], NULL);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
@@ -1367,7 +1383,8 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, an, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
+ an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], cono, fade);
@@ -1416,7 +1433,8 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, an, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
+ an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
@@ -1464,7 +1482,8 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist)*frontface(brush, an, origno[vd.i], NULL);
+ const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
+ an, origno[vd.i], NULL);
mul_v3_v3fl(proxy[vd.i], cono, fade);
@@ -1510,7 +1529,8 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist)*frontface(brush, an, origno[vd.i], NULL);
+ const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
+ an, origno[vd.i], NULL);
mul_v3_m3v3(proxy[vd.i], m, origco[vd.i]);
sub_v3_v3(proxy[vd.i], origco[vd.i]);
@@ -1564,7 +1584,8 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, origco[vd.i])) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
+ area_normal, vd.no, vd.fno);
float *disp= &layer_disp[vd.i];
float val[3];
@@ -1615,7 +1636,8 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, ss->cache->view_normal, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
+ ss->cache->view_normal, vd.no, vd.fno);
float val[3];
if(vd.fno) copy_v3_v3(val, vd.fno);
@@ -1947,7 +1969,8 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist),
+ an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2020,7 +2043,9 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co,
+ sqrt(test.dist),
+ an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2111,7 +2136,9 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, ss->cache->radius*test.dist)*frontface(brush, an, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co,
+ ss->cache->radius*test.dist,
+ an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2172,7 +2199,9 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co,
+ sqrt(test.dist),
+ an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2233,7 +2262,9 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
sub_v3_v3v3(val, intr, vd.co);
if (plane_trim(ss->cache, brush, val)) {
- const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist))*frontface(brush, an, vd.no, vd.fno);
+ const float fade = bstrength*tex_strength(ss, brush, vd.co,
+ sqrt(test.dist),
+ an, vd.no, vd.fno);
mul_v3_v3fl(proxy[vd.i], val, fade);
@@ -2782,8 +2813,6 @@ static void sculpt_cache_free(StrokeCache *cache)
{
if(cache->face_norms)
MEM_freeN(cache->face_norms);
- if(cache->mats)
- MEM_freeN(cache->mats);
MEM_freeN(cache);
}
@@ -2882,8 +2911,8 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
cache->brush = brush;
- cache->mats = MEM_callocN(sizeof(bglMats), "sculpt bglMats");
- view3d_get_transformation(vc->ar, vc->rv3d, vc->obact, cache->mats);
+ /* cache projection matrix */
+ ED_view3d_ob_project_mat_get(cache->vc->rv3d, ob, cache->projection_mat);
ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal);
/* Initialize layer brush displacements and persistent coords */
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 99ab356ac5f..905f7bc80b6 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -81,7 +81,6 @@ void ED_spacetypes_init(void)
ED_spacetype_buttons();
ED_spacetype_info();
ED_spacetype_file();
- ED_spacetype_sound();
ED_spacetype_action();
ED_spacetype_nla();
ED_spacetype_script();
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 37e6c0b73c9..7091fe094c6 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -78,11 +78,11 @@
* - intV: integer value containing color info packed into an int
* - alpha: float value describing the
*/
-#define cpackA(intVC, alpha) \
- { \
- float _cpackCol[3]; \
- cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \
- glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \
+#define cpackA(intVC, alpha) \
+ { \
+ float _cpackCol[3]; \
+ cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \
+ glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \
}
/* *************************** */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index d0efdefe5a5..bc4fa398221 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -57,10 +57,6 @@ void graph_draw_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct AR
void graph_draw_ghost_curves(struct bAnimContext *ac, struct SpaceIpo *sipo, struct ARegion *ar);
/* ***************************************** */
-/* graph_header.c */
-void graph_header_buttons(const bContext *C, struct ARegion *ar);
-
-/* ***************************************** */
/* graph_select.c */
void GRAPH_OT_select_all_toggle(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 051926bf689..4310b5dbae8 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -51,9 +51,6 @@ struct ARegion *image_has_scope_region(struct ScrArea *sa);
extern const char *image_context_dir[]; /* doc access */
-/* image_header.c */
-void image_header_buttons(const struct bContext *C, struct ARegion *ar);
-
void IMAGE_OT_toolbox(struct wmOperatorType *ot);
/* image_draw.c */
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index c83baf24c1c..7121e4872eb 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1009,11 +1009,17 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
return (ibuf != NULL);
}
-static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op)
+static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op, Scene *evil_scene)
{
if (RNA_property_is_set(op->ptr, "color_mode")) simopts->planes= RNA_enum_get(op->ptr, "color_mode");
if (RNA_property_is_set(op->ptr, "file_format")) simopts->imtype= RNA_enum_get(op->ptr, "file_format");
- // if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
+
+#if 0
+ if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
+#else
+ simopts->subimtype= evil_scene->r.subimtype;
+#endif
+
if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
if (RNA_property_is_set(op->ptr, "filepath")) {
@@ -1141,7 +1147,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op)
/* just incase to initialize values,
* these should be set on invoke or by the caller. */
save_image_options_defaults(&simopts);
- save_image_options_from_op(&simopts, op);
+ save_image_options_from_op(&simopts, op, CTX_data_scene(C));
save_image_doit(C, sima, op, &simopts, TRUE);
@@ -1225,7 +1231,7 @@ static int image_save_exec(bContext *C, wmOperator *op)
if (save_image_options_init(&simopts, sima, scene, FALSE) == 0)
return OPERATOR_CANCELLED;
- save_image_options_from_op(&simopts, op);
+ save_image_options_from_op(&simopts, op, scene);
if (BLI_exists(simopts.filepath) && BLI_file_is_writable(simopts.filepath)) {
save_image_doit(C, sima, op, &simopts, FALSE);
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index ec2e22e65fa..00c16d68f36 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -51,11 +51,6 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar);
void draw_nla_channel_list(bContext *C, bAnimContext *ac, ARegion *ar);
/* **************************************** */
-/* nla_header.c */
-
-void nla_header_buttons(const bContext *C, ARegion *ar);
-
-/* **************************************** */
/* nla_select.c */
/* defines for left-right select tool */
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 7a9cf644b55..db8d9b1ddf1 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -842,6 +842,11 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
}
}
+void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+ uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL);
+}
+
static void node_common_buts_whileloop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiItemR(layout, ptr, "max_iterations", 0, NULL, 0);
@@ -867,7 +872,7 @@ static void node_common_set_butfunc(bNodeType *ntype)
{
switch(ntype->type) {
case NODE_GROUP:
-// ntype->uifunc= node_common_buts_group;
+ ntype->uifunc= node_uifunc_group;
ntype->drawfunc= node_draw_group;
ntype->drawupdatefunc= node_update_group;
break;
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index fd7a6ee21fd..c2a2f319c28 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -36,11 +36,13 @@
#include "MEM_guardedalloc.h"
#include "DNA_node_types.h"
+#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
+#include "DNA_world_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
@@ -97,7 +99,13 @@ void ED_node_changed_update(ID *id, bNode *node)
if(treetype==NTREE_SHADER) {
DAG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
+
+ if(GS(id->name) == ID_MA)
+ WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
+ else if(GS(id->name) == ID_LA)
+ WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, id);
+ else if(GS(id->name) == ID_WO)
+ WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, id);
}
else if(treetype==NTREE_COMPOSIT) {
nodeUpdate(edittree, node);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 4c98028644a..c1e50c112fa 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -39,11 +39,13 @@
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
-#include "DNA_object_types.h"
+#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_node_types.h"
+#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
+#include "DNA_world_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
@@ -267,36 +269,61 @@ bNode *node_tree_get_editgroup(bNodeTree *nodetree)
/* assumes nothing being done in ntree yet, sets the default in/out node */
/* called from shading buttons or header */
-void ED_node_shader_default(Material *ma)
+void ED_node_shader_default(Scene *UNUSED(scene), ID *id)
{
bNode *in, *out;
bNodeSocket *fromsock, *tosock;
+ bNodeTree *ntree;
bNodeTemplate ntemp;
+ int output_type, shader_type;
- /* but lets check it anyway */
- if(ma->nodetree) {
- if (G.f & G_DEBUG)
- printf("error in shader initialize\n");
- return;
+ ntree= ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0);
+
+ switch(GS(id->name)) {
+ case ID_MA: {
+ Material *ma= (Material*)id;
+ ma->nodetree = ntree;
+
+ output_type = SH_NODE_OUTPUT;
+ shader_type = SH_NODE_MATERIAL;
+ break;
+ }
+ case ID_WO: {
+ World *wo= (World*)id;
+ wo->nodetree = ntree;
+
+ output_type = SH_NODE_OUTPUT;
+ shader_type = SH_NODE_MATERIAL;
+ break;
+ }
+ case ID_LA: {
+ Lamp *la= (Lamp*)id;
+ la->nodetree = ntree;
+
+ output_type = SH_NODE_OUTPUT;
+ shader_type = SH_NODE_MATERIAL;
+ break;
+ }
+ default:
+ printf("ED_node_shader_default called on wrong ID type.\n");
+ return;
}
- ma->nodetree= ntreeAddTree("Shader Nodetree", NTREE_SHADER, 0);
-
- ntemp.type = SH_NODE_OUTPUT;
- out= nodeAddNode(ma->nodetree, &ntemp);
+ ntemp.type = output_type;
+ out= nodeAddNode(ntree, &ntemp);
out->locx= 300.0f; out->locy= 300.0f;
- ntemp.type = SH_NODE_MATERIAL;
- in= nodeAddNode(ma->nodetree, &ntemp);
+ ntemp.type = shader_type;
+ in= nodeAddNode(ntree, &ntemp);
in->locx= 10.0f; in->locy= 300.0f;
- nodeSetActive(ma->nodetree, in);
+ nodeSetActive(ntree, in);
/* only a link from color to color */
fromsock= in->outputs.first;
tosock= out->inputs.first;
- nodeAddLink(ma->nodetree, in, fromsock, out, tosock);
+ nodeAddLink(ntree, in, fromsock, out, tosock);
- ntreeUpdateTree(ma->nodetree);
+ ntreeUpdateTree(ntree);
}
/* assumes nothing being done in ntree yet, sets the default in/out node */
@@ -387,6 +414,14 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
*ntree= ((Material*)id)->nodetree;
if(treetype) *treetype= NTREE_SHADER;
}
+ else if(idtype == ID_LA) {
+ *ntree= ((Lamp*)id)->nodetree;
+ if(treetype) *treetype= NTREE_SHADER;
+ }
+ else if(idtype == ID_WO) {
+ *ntree= ((World*)id)->nodetree;
+ if(treetype) *treetype= NTREE_SHADER;
+ }
else if(idtype == ID_SCE) {
*ntree= ((Scene*)id)->nodetree;
if(treetype) *treetype= NTREE_COMPOSIT;
@@ -428,11 +463,25 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
if(snode->treetype==NTREE_SHADER) {
/* need active object, or we allow pinning... */
- if(ob) {
- Material *ma= give_current_material(ob, ob->actcol);
- if(ma) {
- snode->from= &ob->id;
- snode->id= &ma->id;
+ if(snode->shaderfrom == SNODE_SHADER_OBJECT) {
+ if(ob) {
+ if(ob->type == OB_LAMP) {
+ snode->from= &ob->id;
+ snode->id= ob->data;
+ }
+ else {
+ Material *ma= give_current_material(ob, ob->actcol);
+ if(ma) {
+ snode->from= &ob->id;
+ snode->id= &ma->id;
+ }
+ }
+ }
+ }
+ else { /* SNODE_SHADER_WORLD */
+ if(scene->world) {
+ snode->from= NULL;
+ snode->id= &scene->world->id;
}
}
}
@@ -526,7 +575,7 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
/* tree specific activate calls */
if(ntree->type==NTREE_SHADER) {
/* when we select a material, active texture is cleared, for buttons */
- if(node->id && GS(node->id->name)==ID_MA)
+ if(node->id && ELEM3(GS(node->id->name), ID_MA, ID_LA, ID_WO))
nodeClearActiveID(ntree, ID_TE);
if(node->type==SH_NODE_OUTPUT) {
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 68f5dd6bf14..42b5dafa3e1 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -46,9 +46,10 @@
#include "BKE_context.h"
#include "BKE_global.h"
-#include "BKE_screen.h"
-#include "BKE_node.h"
#include "BKE_main.h"
+#include "BKE_node.h"
+#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "RNA_access.h"
@@ -168,10 +169,11 @@ static int node_tree_has_type(int treetype, int nodetype)
static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
{
Main *bmain= CTX_data_main(C);
+ Scene *scene= CTX_data_scene(C);
SpaceNode *snode= CTX_wm_space_node(C);
bNodeTree *ntree;
int nodeclass= GET_INT_FROM_POINTER(arg_nodeclass);
- int event;
+ int event, compatibility= 0;
ntree = snode->nodetree;
@@ -179,6 +181,13 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
uiItemS(layout);
return;
}
+
+ if(ntree->type == NTREE_SHADER) {
+ if(scene_use_new_shading_nodes(scene))
+ compatibility= NODE_NEW_SHADING;
+ else
+ compatibility= NODE_OLD_SHADING;
+ }
if (nodeclass==NODE_CLASS_GROUP) {
bNodeTree *ngroup;
@@ -210,14 +219,16 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
uiLayoutSetFunc(layout, do_node_add_static, NULL);
for (ntype=ntreeGetType(ntree->type)->node_types.first; ntype; ntype=ntype->next) {
- if(ntype->nclass==nodeclass && ntype->name)
- uiItemV(layout, ntype->name, 0, ntype->type);
+ if (ntype->nclass==nodeclass && ntype->name)
+ if (!compatibility || (ntype->compatibility & compatibility))
+ uiItemV(layout, ntype->name, 0, ntype->type);
}
}
}
static void node_menu_add(const bContext *C, Menu *menu)
{
+ Scene *scene= CTX_data_scene(C);
SpaceNode *snode= CTX_wm_space_node(C);
uiLayout *layout= menu->layout;
@@ -227,11 +238,15 @@ static void node_menu_add(const bContext *C, Menu *menu)
if(snode->treetype==NTREE_SHADER) {
uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT));
uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT));
+ if(scene_use_new_shading_nodes(scene)) {
+ uiItemMenuF(layout, IFACE_("Shader"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_SHADER));
+ uiItemMenuF(layout, IFACE_("Texture"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE));
+ }
uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR));
uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR));
uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR));
uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP));
- uiItemMenuF(layout, IFACE_("Dynamic"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC));
+ //uiItemMenuF(layout, IFACE_("Dynamic"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC));
uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT));
}
else if(snode->treetype==NTREE_COMPOSIT) {
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 35b8666f274..1a808e8ee5f 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -32,10 +32,12 @@
#include <string.h>
#include <stdio.h>
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
-#include "DNA_material_types.h"
#include "DNA_scene_types.h"
+#include "DNA_world_types.h"
#include "MEM_guardedalloc.h"
@@ -268,9 +270,21 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
if(snode->nodetree) {
if(snode->treetype==NTREE_SHADER) {
- Material *ma= (Material *)snode->id;
- if(ma->use_nodes)
- ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
+ if(GS(snode->id->name) == ID_MA) {
+ 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;
+ 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;
+ 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;
@@ -426,6 +440,10 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
case NC_NODE:
ED_region_tag_redraw(ar);
break;
+ case NC_OBJECT:
+ if(wmn->data==ND_OB_SHADING)
+ ED_region_tag_redraw(ar);
+ break;
case NC_ID:
if(wmn->action == NA_RENAME)
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 215ab508ab6..4065b3e2e0b 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -229,7 +229,4 @@ void OUTLINER_OT_action_set(struct wmOperatorType *ot);
void outliner_operatortypes(void);
void outliner_keymap(struct wmKeyConfig *keyconf);
-/* outliner_header.c */
-void outliner_header_buttons(const struct bContext *C, struct ARegion *ar);
-
#endif /* ED_OUTLINER_INTERN_H */
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 925c4571a66..794f898a1fc 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -109,7 +109,7 @@
#define TS_CHUNK 128
/* ********************************************************* */
-/* Persistant Data */
+/* Persistent Data */
static void outliner_storage_cleanup(SpaceOops *soops)
{
@@ -156,7 +156,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
}
}
-static void check_persistant(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
+static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
{
TreeStore *ts;
TreeStoreElem *tselem;
@@ -818,7 +818,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
/* add to the visual tree */
BLI_addtail(lb, te);
/* add to the storage */
- check_persistant(soops, te, id, type, index);
+ check_persistent(soops, te, id, type, index);
tselem= TREESTORE(te);
/* if we are searching for something expand to see child elements */
diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt
index fb88d81ddf6..00f8df299e2 100644
--- a/source/blender/editors/space_script/CMakeLists.txt
+++ b/source/blender/editors/space_script/CMakeLists.txt
@@ -35,7 +35,6 @@ set(INC_SYS
set(SRC
script_edit.c
- script_header.c
script_ops.c
space_script.c
diff --git a/source/blender/editors/space_script/script_header.c b/source/blender/editors/space_script/script_header.c
deleted file mode 100644
index 8354dc1e996..00000000000
--- a/source/blender/editors/space_script/script_header.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_script/script_header.c
- * \ingroup spscript
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-
-
-#include "BKE_context.h"
-
-#include "ED_screen.h"
-#include "ED_types.h"
-#include "ED_util.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "script_intern.h"
-
-/* ************************ header area region *********************** */
-
-static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
-
-}
-
-static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- ScrArea *curarea= CTX_wm_area(C);
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
-}
-
-static void do_script_buttons(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
- //switch(event) {
- //}
-}
-
-
-void script_header_buttons(const bContext *C, ARegion *ar)
-{
- ScrArea *sa= CTX_wm_area(C);
- uiBlock *block;
- int xco, yco= 3;
-
- block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
- uiBlockSetHandleFunc(block, do_script_buttons, NULL);
-
- xco= ED_area_header_standardbuttons(C, block, yco);
-
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- int xmax;
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
- "View", xco, yco-2, xmax-3, UI_UNIT_Y, "");
- xco+=UI_UNIT_X+xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
-
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
-}
-
-
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index a3565d070eb..98e9699079b 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -33,10 +33,6 @@
/* internal exports only */
-
-/* script_header.c */
-void script_header_buttons(const bContext *C, ARegion *ar);
-
/* script_ops.c */
void script_operatortypes(void);
void script_keymap(struct wmKeyConfig *keyconf);
diff --git a/source/blender/editors/space_sound/CMakeLists.txt b/source/blender/editors/space_sound/CMakeLists.txt
deleted file mode 100644
index ae605760975..00000000000
--- a/source/blender/editors/space_sound/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# Contributor(s): Jacques Beaurain.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-set(INC
- ../include
- ../../blenkernel
- ../../blenlib
- ../../blenloader
- ../../makesdna
- ../../makesrna
- ../../windowmanager
- ../../../../intern/guardedalloc
-)
-
-set(INC_SYS
- ${GLEW_INCLUDE_PATH}
-)
-
-set(SRC
- sound_header.c
- space_sound.c
-
- sound_intern.h
-)
-
-blender_add_lib(bf_editor_space_sound "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_sound/SConscript b/source/blender/editors/space_sound/SConscript
deleted file mode 100644
index d76fb7939ea..00000000000
--- a/source/blender/editors/space_sound/SConscript
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/python
-Import ('env')
-
-sources = env.Glob('*.c')
-
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
-incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
-
-env.BlenderLib ( 'bf_editors_space_sound', sources, Split(incs), [], libtype=['core'], priority=[75] )
diff --git a/source/blender/editors/space_sound/sound_header.c b/source/blender/editors/space_sound/sound_header.c
deleted file mode 100644
index 6e2010c0c63..00000000000
--- a/source/blender/editors/space_sound/sound_header.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_sound/sound_header.c
- * \ingroup spsnd
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_utildefines.h"
-
-
-#include "BKE_context.h"
-
-#include "ED_screen.h"
-#include "ED_types.h"
-#include "ED_util.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "sound_intern.h"
-
-
-/* ************************ header area region *********************** */
-
-static void do_viewmenu(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
-
-}
-
-static uiBlock *dummy_viewmenu(bContext *C, ARegion *ar, void *UNUSED(arg))
-{
- ScrArea *curarea= CTX_wm_area(C);
- uiBlock *block;
- short yco= 0, menuwidth=120;
-
- block= uiBeginBlock(C, ar, "dummy_viewmenu", UI_EMBOSSP);
- uiBlockSetButmFunc(block, do_viewmenu, NULL);
-
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20,
- menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
-
- if(curarea->headertype==HEADERTOP) {
- uiBlockSetDirection(block, UI_DOWN);
- }
- else {
- uiBlockSetDirection(block, UI_TOP);
- uiBlockFlipOrder(block);
- }
-
- uiTextBoundsBlock(block, 50);
- uiEndBlock(C, block);
-
- return block;
-}
-
-static void do_sound_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event)
-{
- switch(event) {
- }
-}
-
-
-void sound_header_buttons(const bContext *C, ARegion *ar)
-{
- ScrArea *sa= CTX_wm_area(C);
- uiBlock *block;
- int xco, yco= 3;
-
- block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
- uiBlockSetHandleFunc(block, do_sound_buttons, NULL);
-
- xco= ED_area_header_standardbuttons(C, block, yco);
-
- if((sa->flag & HEADER_NO_PULLDOWN)==0) {
- int xmax;
-
- xmax= GetButStringLength("View");
- uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C),
- "View", xco, yco-2, xmax-3, UI_UNIT_Y, "");
- xco+=UI_UNIT_X+xmax;
- }
-
- uiBlockSetEmboss(block, UI_EMBOSS);
-
- /* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco+UI_UNIT_X+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
-
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
-}
-
-
diff --git a/source/blender/editors/space_sound/sound_intern.h b/source/blender/editors/space_sound/sound_intern.h
deleted file mode 100644
index 88891ff4913..00000000000
--- a/source/blender/editors/space_sound/sound_intern.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_sound/sound_intern.h
- * \ingroup spsnd
- */
-
-#ifndef ED_SOUND_INTERN_H
-#define ED_SOUND_INTERN_H
-
-/* internal exports only */
-
-
-/* sound_header.c */
-void sound_header_buttons(const bContext *C, ARegion *ar);
-
-
-#endif /* ED_SOUND_INTERN_H */
-
diff --git a/source/blender/editors/space_sound/space_sound.c b/source/blender/editors/space_sound/space_sound.c
deleted file mode 100644
index 83d1b5b06c2..00000000000
--- a/source/blender/editors/space_sound/space_sound.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2008 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_sound/space_sound.c
- * \ingroup spsnd
- */
-
-
-#include <string.h>
-#include <stdio.h>
-
-#include "DNA_scene_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
-#include "BKE_screen.h"
-
-#include "ED_space_api.h"
-#include "ED_screen.h"
-
-#include "BIF_gl.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-
-#include "sound_intern.h" // own include
-
-/* ******************** default callbacks for sound space ***************** */
-
-static SpaceLink *sound_new(const bContext *UNUSED(C))
-{
- ARegion *ar;
- SpaceSound *ssound;
-
- ssound= MEM_callocN(sizeof(SpaceSound), "initsound");
- ssound->spacetype= SPACE_SOUND;
-
- /* header */
- ar= MEM_callocN(sizeof(ARegion), "header for sound");
-
- BLI_addtail(&ssound->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
-
- /* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for sound");
-
- BLI_addtail(&ssound->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
-
- ar->v2d.tot.xmin= -4.0f;
- ar->v2d.tot.ymin= -4.0f;
- ar->v2d.tot.xmax= 250.0f;
- ar->v2d.tot.ymax= 255.0f;
-
- ar->v2d.cur.xmin= -4.0f;
- ar->v2d.cur.ymin= -4.0f;
- ar->v2d.cur.xmax= 50.0f;
- ar->v2d.cur.ymax= 255.0f;
-
- ar->v2d.min[0]= 1.0f;
- ar->v2d.min[1]= 259.0f;
-
- ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= 259.0f;
-
- ar->v2d.minzoom= 0.1f;
- ar->v2d.maxzoom= 10.0f;
-
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT);
- ar->v2d.keepzoom= 0;
- ar->v2d.keeptot= 0;
- ar->v2d.keepzoom = V2D_LOCKZOOM_Y;
-
-
- return (SpaceLink *)ssound;
-}
-
-/* not spacelink itself */
-static void sound_free(SpaceLink *UNUSED(sl))
-{
-// SpaceSound *ssound= (SpaceSound*) sl;
-
-
-}
-
-
-/* spacetype; init callback */
-static void sound_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
-{
-
-}
-
-static SpaceLink *sound_duplicate(SpaceLink *sl)
-{
- SpaceSound *ssoundn= MEM_dupallocN(sl);
-
- /* clear or remove stuff from old */
-
- return (SpaceLink *)ssoundn;
-}
-
-
-
-/* add handlers, stuff you only do once or on area/region changes */
-static void sound_main_area_init(wmWindowManager *wm, ARegion *ar)
-{
- wmKeyMap *keymap;
-
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
-
- /* own keymap */
- keymap= WM_keymap_find(wm->defaultconf, "Sound", SPACE_SOUND, 0);
- WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-}
-
-static void sound_main_area_draw(const bContext *C, ARegion *ar)
-{
- /* draw entirely, view changes should be handled here */
- // SpaceSound *ssound= (SpaceSound*)CTX_wm_space_data(C);
- View2D *v2d= &ar->v2d;
-
- /* clear and setup matrix */
- UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
-
- UI_view2d_view_ortho(v2d);
-
- /* data... */
-
-
- /* reset view matrix */
- UI_view2d_view_restore(C);
-
- /* scrollers? */
-}
-
-static void sound_operatortypes(void)
-{
-
-}
-
-static void sound_keymap(struct wmKeyConfig *UNUSED(keyconf))
-{
-
-}
-
-/* add handlers, stuff you only do once or on area/region changes */
-static void sound_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
-{
- UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
-}
-
-static void sound_header_area_draw(const bContext *C, ARegion *ar)
-{
- float col[3];
-
- /* clear */
- if(ED_screen_area_active(C))
- UI_GetThemeColor3fv(TH_HEADER, col);
- else
- UI_GetThemeColor3fv(TH_HEADERDESEL, col);
-
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- /* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(&ar->v2d);
-
- sound_header_buttons(C, ar);
-
- /* restore view matrix? */
- UI_view2d_view_restore(C);
-}
-
-static void sound_main_area_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn))
-{
- /* context changes */
-}
-
-/* only called once, from space/spacetypes.c */
-void ED_spacetype_sound(void)
-{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype sound");
- ARegionType *art;
-
- st->spaceid= SPACE_SOUND;
- strncpy(st->name, "Sound", BKE_ST_MAXNAME);
-
- st->new= sound_new;
- st->free= sound_free;
- st->init= sound_init;
- st->duplicate= sound_duplicate;
- st->operatortypes= sound_operatortypes;
- st->keymap= sound_keymap;
-
- /* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
- art->regionid = RGN_TYPE_WINDOW;
- art->init= sound_main_area_init;
- art->draw= sound_main_area_draw;
- art->listener= sound_main_area_listener;
- art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
-
- BLI_addhead(&st->regiontypes, art);
-
- /* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
- art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
-
- art->init= sound_header_area_init;
- art->draw= sound_header_area_draw;
-
- BLI_addhead(&st->regiontypes, art);
-
- /* regions: channels */
- art= MEM_callocN(sizeof(ARegionType), "spacetype sound region");
- art->regionid = RGN_TYPE_CHANNELS;
- art->prefsizex= 80;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
-
-// art->init= sound_channel_area_init;
-// art->draw= sound_channel_area_draw;
-
- BLI_addhead(&st->regiontypes, art);
-
-
- BKE_spacetype_register(st);
-}
-
diff --git a/source/blender/editors/space_time/time_intern.h b/source/blender/editors/space_time/time_intern.h
index 094b0bc9e86..a345d00bd74 100644
--- a/source/blender/editors/space_time/time_intern.h
+++ b/source/blender/editors/space_time/time_intern.h
@@ -40,8 +40,5 @@ struct wmWindowManager;
void time_operatortypes(void);
void time_keymap(struct wmKeyConfig *keyconf);
-/* time_header.c */
-void time_header_buttons(const bContext *C, ARegion *ar);
-
#endif /* ED_TIME_INTERN_H */
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 036223ce577..bf4a7720564 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -104,11 +104,11 @@
/* this condition has been made more complex since editmode can draw textures */
-#define CHECK_OB_DRAWTEXTURE(vd, dt) \
-((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \
+#define CHECK_OB_DRAWTEXTURE(vd, dt) \
+ ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \
(vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
-static void draw_bounding_volume(Scene *scene, Object *ob);
+static void draw_bounding_volume(Scene *scene, Object *ob, char type);
static void drawcube_size(float size);
static void drawcircle_size(float size);
@@ -2713,15 +2713,14 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
totface = dm->getNumFaces(dm);
/* vertexpaint, faceselect wants this, but it doesnt work for shaded? */
- if(dt!=OB_SHADED)
- glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+ glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
// Unwanted combination.
if (draw_flags & DRAW_IS_PAINT_SEL) draw_wire = 0;
if(dt==OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
- draw_bounding_volume(scene, ob);
+ draw_bounding_volume(scene, ob, ob->boundtype);
}
else if(hasHaloMat || (totface==0 && totedge==0)) {
glPointSize(1.5);
@@ -2863,7 +2862,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
dm->drawLooseEdges(dm);
}
}
- else if(dt==OB_SHADED) {
+ else if(dt==OB_PAINT) {
if(ob==OBACT) {
if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
/* enforce default material settings */
@@ -5519,7 +5518,7 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
}
#endif
-static void draw_bb_quadric(BoundBox *bb, short type)
+static void draw_bb_quadric(BoundBox *bb, char type)
{
float size[3], cent[3];
GLUquadricObj *qobj = gluNewQuadric();
@@ -5558,7 +5557,7 @@ static void draw_bb_quadric(BoundBox *bb, short type)
gluDeleteQuadric(qobj);
}
-static void draw_bounding_volume(Scene *scene, Object *ob)
+static void draw_bounding_volume(Scene *scene, Object *ob, char type)
{
BoundBox *bb= NULL;
@@ -5584,8 +5583,8 @@ static void draw_bounding_volume(Scene *scene, Object *ob)
if(bb==NULL) return;
- if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec);
- else draw_bb_quadric(bb, ob->boundtype);
+ if(type==OB_BOUND_BOX) draw_box(bb->vec);
+ else draw_bb_quadric(bb, type);
}
@@ -6004,7 +6003,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* maximum drawtype */
- dt= MIN2(v3d->drawtype, ob->dt);
+ dt= v3d->drawtype;
+ if(dt==OB_RENDER) dt= OB_SOLID;
+ dt= MIN2(dt, ob->dt);
if(v3d->zbuf==0 && dt>OB_WIRE) dt= OB_WIRE;
dtx= 0;
@@ -6019,7 +6020,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
dt= OB_SOLID;
}
else {
- dt= OB_SHADED;
+ dt= OB_PAINT;
}
glEnable(GL_DEPTH_TEST);
@@ -6149,7 +6150,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else if(dt==OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
- draw_bounding_volume(scene, ob);
+ draw_bounding_volume(scene, ob, ob->boundtype);
}
else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
@@ -6165,7 +6166,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else if(dt==OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
- draw_bounding_volume(scene, ob);
+ draw_bounding_volume(scene, ob, ob->boundtype);
}
else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
empty_object= drawDispList(scene, v3d, rv3d, base, dt);
@@ -6182,7 +6183,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawmball(scene, v3d, rv3d, base, dt);
else if(dt==OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
- draw_bounding_volume(scene, ob);
+ draw_bounding_volume(scene, ob, ob->boundtype);
}
else
empty_object= drawmball(scene, v3d, rv3d, base, dt);
@@ -6424,6 +6425,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
}
+ 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);
+ }
+ }
+
/* draw extra: after normal draw because of makeDispList */
if(dtx && (G.f & G_RENDER_OGL)==0) {
@@ -6431,8 +6440,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawaxes(1.0f, OB_ARROWS);
}
if(dtx & OB_BOUNDBOX) {
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
- draw_bounding_volume(scene, ob);
+ draw_bounding_volume(scene, ob, ob->boundtype);
}
if(dtx & OB_TEXSPACE) drawtexspace(ob);
if(dtx & OB_DRAWNAME) {
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index f868cda485f..ef806cb8881 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -56,6 +56,7 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "RE_engine.h"
#include "RNA_access.h"
@@ -344,6 +345,9 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
v3do->lay= v3dn->localvd->lay;
v3do->lay &= 0xFFFFFF;
}
+
+ if(v3dn->drawtype == OB_RENDER)
+ v3dn->drawtype = OB_SOLID;
/* copy or clear inside new stuff */
@@ -549,6 +553,9 @@ static void view3d_main_area_free(ARegion *ar)
if(rv3d->ri) {
// XXX BIF_view3d_previewrender_free(rv3d);
}
+
+ if(rv3d->render_engine)
+ RE_engine_free(rv3d->render_engine);
if(rv3d->depths) {
if(rv3d->depths->depths) MEM_freeN(rv3d->depths->depths);
@@ -573,6 +580,7 @@ static void *view3d_main_area_duplicate(void *poin)
new->depths= NULL;
new->ri= NULL;
+ new->render_engine= NULL;
new->gpd= NULL;
new->sms= NULL;
new->smooth_timer= NULL;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 63b0f68f158..70cf113384b 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -139,6 +139,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
float median[7], ve_median[7];
int tot, totw, totweight, totedge, totradius;
char defstr[320];
+ PointerRNA radius_ptr;
median[0]= median[1]= median[2]= median[3]= median[4]= median[5]= median[6]= 0.0;
tot= totw= totweight= totedge= totradius= 0;
@@ -210,6 +211,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
BezTriple *bezt;
int a;
ListBase *nurbs= curve_editnurbs(cu);
+ StructRNA *seltype= NULL;
+ void *selp= NULL;
nu= nurbs->first;
while(nu) {
@@ -224,6 +227,8 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
totweight++;
median[5]+= bezt->radius;
totradius++;
+ selp= bezt;
+ seltype= &RNA_BezierSplinePoint;
}
else {
if(bezt->f1 & SELECT) {
@@ -251,12 +256,17 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
totweight++;
median[5]+= bp->radius;
totradius++;
+ selp= bp;
+ seltype= &RNA_SplinePoint;
}
bp++;
}
}
nu= nu->next;
}
+
+ if(totradius==1)
+ RNA_pointer_create(&cu->id, seltype, selp, &radius_ptr);
}
else if(ob->type==OB_LATTICE) {
Lattice *lt= ob->data;
@@ -319,9 +329,11 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiBlockEndAlign(block);
if(totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "");
- if(totradius)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs");
+ if(totradius) {
+ if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 20, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
+ else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs");
}
+ }
else {
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global", 0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
@@ -329,8 +341,10 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
uiBlockEndAlign(block);
if(totweight)
uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:", 0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "");
- if(totradius)
- uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs");
+ if(totradius) {
+ if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 40, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
+ else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:", 0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs");
+ }
}
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 32e553262e2..aa69e7121e0 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -62,6 +62,7 @@
#include "BKE_screen.h"
#include "BKE_unit.h"
+#include "RE_engine.h"
#include "RE_pipeline.h" // make_stars
#include "IMB_imbuf_types.h"
@@ -920,17 +921,34 @@ static void draw_selected_name(Scene *scene, Object *ob)
BLF_draw_default(offset, 10, 0.0f, info, sizeof(info)-1);
}
-void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2])
+void view3d_viewborder_size_get(Scene *scene, Object *camob, ARegion *ar, float size_r[2])
{
- float winmax= MAX2(ar->winx, ar->winy);
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
-
- if(aspect > 1.0f) {
- size_r[0]= winmax;
- size_r[1]= winmax/aspect;
- } else {
- size_r[0]= winmax*aspect;
- size_r[1]= winmax;
+ short sensor_fit= CAMERA_SENSOR_FIT_AUTO;
+
+ if(camob && camob->type==OB_CAMERA) {
+ Camera *cam= (Camera *)camob->data;
+ sensor_fit= cam->sensor_fit;
+ }
+
+ if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
+ float winmax= MAX2(ar->winx, ar->winy);
+
+ if(aspect > 1.0f) {
+ size_r[0]= winmax;
+ size_r[1]= winmax/aspect;
+ } else {
+ size_r[0]= winmax*aspect;
+ size_r[1]= winmax;
+ }
+ }
+ else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+ size_r[0]= ar->winx;
+ size_r[1]= ar->winx/aspect;
+ }
+ else {
+ size_r[0]= ar->winy*aspect;
+ size_r[1]= ar->winy;
}
}
@@ -940,7 +958,7 @@ void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, Region
float size[2];
float dx= 0.0f, dy= 0.0f;
- view3d_viewborder_size_get(scene, ar, size);
+ view3d_viewborder_size_get(scene, v3d->camera, ar, size);
size[0]= size[0]*zoomfac;
size[1]= size[1]*zoomfac;
@@ -1207,6 +1225,21 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
uiSetRoundBox(UI_CNR_ALL);
uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0);
}
+ if (ca && (ca->flag & CAM_SHOWSENSOR)) {
+ /* assume fixed sensor width for now */
+
+ /* float sensor_aspect = ca->sensor_x / ca->sensor_y; */ /* UNUSED */
+ float sensor_scale = (x2i-x1i) / ca->sensor_x;
+ float sensor_height = sensor_scale * ca->sensor_y;
+
+ float ymid = y1i + (y2i-y1i)/2.f;
+ float sy1= ymid - sensor_height/2.f;
+ float sy2= ymid + sensor_height/2.f;
+
+ UI_ThemeColorShade(TH_WIRE, 100);
+
+ uiDrawBox(GL_LINE_LOOP, x1i, sy1, x2i, sy2, 2.0f);
+ }
}
setlinestyle(0);
@@ -1226,6 +1259,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
{
RegionView3D *rv3d= ar->regiondata;
struct Base *base = scene->basact;
+ int multisample_enabled;
rcti winrct;
BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
@@ -1252,8 +1286,13 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE;
+ /* dithering and AA break color coding, so disable */
glDisable(GL_DITHER);
+ multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
+ if(multisample_enabled)
+ glDisable(GL_MULTISAMPLE_ARB);
+
region_scissor_winrct(ar, &winrct);
glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin);
@@ -1272,9 +1311,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
G.f |= G_BACKBUFSEL;
- if(base && (base->lay & v3d->lay)) {
+ if(base && (base->lay & v3d->lay))
draw_object_backbufsel(scene, v3d, rv3d, base->object);
- }
v3d->flag &= ~V3D_INVALID_BACKBUF;
ar->swap= 0; /* mark invalid backbuf for wm draw */
@@ -1283,6 +1321,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
v3d->zbuf= FALSE;
glDisable(GL_DEPTH_TEST);
glEnable(GL_DITHER);
+ if(multisample_enabled)
+ glEnable(GL_MULTISAMPLE_ARB);
if(rv3d->rflag & RV3D_CLIPPING)
view3d_clr_clipping();
@@ -2388,10 +2428,12 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
/* render 3d view */
if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
float winmat[4][4];
- float _clipsta, _clipend, _lens, _yco, _dx, _dy;
+ float _clipsta, _clipend, _lens, _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
+ short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
rctf _viewplane;
- object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens, &_yco, &_dx, &_dy);
+ object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens,
+ &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy);
ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
}
@@ -2446,9 +2488,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w
invert_m4_m4(rv3d.viewmat, rv3d.viewinv);
{
- float _yco, _dx, _dy;
+ float _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT;
+ short _sensor_fit= CAMERA_SENSOR_FIT_AUTO;
rctf _viewplane;
- object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_yco, &_dx, &_dy);
+ object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy);
}
mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat);
@@ -2511,6 +2554,62 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
BLF_draw_default_ascii(22, ar->winy-17, 0.0f, printable, sizeof(printable)-1);
}
+static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
+{
+ Scene *scene= CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ RenderEngineType *type;
+
+ if(!rv3d->render_engine) {
+ type= RE_engines_find(scene->r.engine);
+
+ if(!(type->view_update && type->view_draw))
+ return 0;
+
+ rv3d->render_engine= RE_engine_create(type);
+ type->view_update(rv3d->render_engine, C);
+ }
+
+ view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
+
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ ED_region_pixelspace(ar);
+
+ type= rv3d->render_engine->type;
+ type->view_draw(rv3d->render_engine, C);
+
+ return 1;
+}
+
+static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar)
+{
+ rcti rect;
+ const int header_height = 18;
+
+ if(!rv3d->render_engine || !rv3d->render_engine->text)
+ return;
+
+ /* background box */
+ rect= ar->winrct;
+ rect.xmin= 0;
+ rect.ymin= ar->winrct.ymax - ar->winrct.ymin - header_height;
+ rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
+ rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+ glColor4f(0.0f, 0.0f, 0.0f, 0.25f);
+ glRecti(rect.xmin, rect.ymin, rect.xmax+1, rect.ymax+1);
+ glDisable(GL_BLEND);
+
+ /* text */
+ UI_ThemeColor(TH_TEXT_HI);
+ UI_DrawString(12, rect.ymin + 5, rv3d->render_engine->text);
+}
+
/* warning: this function has duplicate drawing in ED_view3d_draw_offscreen() */
static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit)
{
@@ -2721,6 +2820,11 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
else
draw_view_icon(rv3d);
+ if(rv3d->render_engine) {
+ view3d_main_area_draw_engine_info(rv3d, ar);
+ return;
+ }
+
if((U.uiflag & USER_SHOW_FPS) && screen->animtimer) {
draw_viewport_fps(scene, ar);
}
@@ -2748,9 +2852,12 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
View3D *v3d = CTX_wm_view3d(C);
const char *grid_unit= NULL;
- view3d_main_area_draw_objects(C, ar, &grid_unit);
-
- ED_region_pixelspace(ar);
+ /* draw viewport using external renderer? */
+ if(!(v3d->drawtype == OB_RENDER && view3d_main_area_draw_engine(C, ar))) {
+ /* draw viewport using opengl */
+ view3d_main_area_draw_objects(C, ar, &grid_unit);
+ ED_region_pixelspace(ar);
+ }
view3d_main_area_draw_info(C, ar, grid_unit);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index ea8db17daf0..e7fbdaf1deb 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -2255,13 +2255,14 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
{
ARegion *ar= CTX_wm_region(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ View3D *v3d= CTX_wm_view3d(C);
Scene *scene= CTX_data_scene(C);
float xfac, yfac;
float size[2];
rv3d->camdx= rv3d->camdy= 0.0f;
- view3d_viewborder_size_get(scene, ar, size);
+ view3d_viewborder_size_get(scene, v3d->camera, ar, size);
/* 4px is just a little room from the edge of the area */
xfac= (float)ar->winx / (float)(size[0] + 4);
@@ -2523,13 +2524,13 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot)
}
/* sets the view to 1:1 camera/render-pixel */
-static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
+static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d)
{
RegionView3D *rv3d= ar->regiondata;
float size[2];
int im_width= (scene->r.size*scene->r.xsch)/100;
- view3d_viewborder_size_get(scene, ar, size);
+ view3d_viewborder_size_get(scene, v3d->camera, ar, size);
rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]);
CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
@@ -2540,7 +2541,7 @@ static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C);
- view3d_set_1_to_1_viewborder(scene, ar);
+ view3d_set_1_to_1_viewborder(scene, ar, CTX_wm_view3d(C));
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index fa6611b9925..73174dcace8 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -83,9 +83,6 @@
* This can be cleaned when I make some new 'mode' icons.
*/
-#define TEST_EDITMESH if(obedit==0) return; \
- if( (v3d->lay & obedit->lay)==0 ) return;
-
/* view3d handler codes */
#define VIEW3D_HANDLER_BACKGROUND 1
#define VIEW3D_HANDLER_PROPERTIES 2
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 78af6a823ab..772f29fb502 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -139,7 +139,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
void view3d_clr_clipping(void);
void view3d_set_clipping(RegionView3D *rv3d);
void add_view3d_after(ListBase *lb, Base *base, int flag);
-void view3d_viewborder_size_get(struct Scene *scene, struct ARegion *ar, float size_r[2]);
+void view3d_viewborder_size_get(struct Scene *scene, struct Object *camob, struct ARegion *ar, float size_r[2]);
void circf(float x, float y, float rad);
void circ(float x, float y, float rad);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 93c577619de..7de1f2a85bb 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -966,10 +966,14 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl
int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize)
{
Camera *cam=NULL;
- float lens, fac, x1, y1, x2, y2;
+ float lens, sensor_x =DEFAULT_SENSOR_WIDTH, sensor_y= DEFAULT_SENSOR_HEIGHT, fac, x1, y1, x2, y2;
float winx= (float)winxi, winy= (float)winyi;
int orth= 0;
-
+ short sensor_fit= CAMERA_SENSOR_FIT_AUTO;
+
+ /* currnetly using sensor size (depends on fov calculating method) */
+ float sensor= DEFAULT_SENSOR_WIDTH;
+
lens= v3d->lens;
*clipsta= v3d->near;
@@ -992,8 +996,13 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy
else if(v3d->camera->type==OB_CAMERA) {
cam= v3d->camera->data;
lens= cam->lens;
+ sensor_x= cam->sensor_x;
+ sensor_y= cam->sensor_y;
*clipsta= cam->clipsta;
*clipend= cam->clipend;
+ sensor_fit= cam->sensor_fit;
+
+ sensor= (cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : (cam->sensor_x);
}
}
}
@@ -1024,21 +1033,44 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy
if(cam && cam->type==CAM_ORTHO) {
/* ortho_scale == 1 means exact 1 to 1 mapping */
float dfac= 2.0f*cam->ortho_scale/fac;
-
- if(winx>winy) x1= -dfac;
- else x1= -winx*dfac/winy;
+
+ if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
+ if(winx>winy) {
+ x1= -dfac;
+ y1= -winy*dfac/winx;
+ }
+ else {
+ x1= -winx*dfac/winy;
+ y1= -dfac;
+ }
+ }
+ else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+ x1= -dfac;
+ y1= -winy*dfac/winx;
+ }
+ else {
+ x1= -winx*dfac/winy;
+ y1= -dfac;
+ }
+
x2= -x1;
-
- if(winx>winy) y1= -winy*dfac/winx;
- else y1= -dfac;
y2= -y1;
+
orth= 1;
}
else {
float dfac;
- if(winx>winy) dfac= 64.0f/(fac*winx*lens);
- else dfac= 64.0f/(fac*winy*lens);
+ if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
+ if(winx>winy) dfac= (sensor_x * 2.0) / (fac*winx*lens);
+ else dfac= (sensor_x * 2.0) / (fac*winy*lens);
+ }
+ else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+ dfac= (sensor_x * 2.0) / (fac*winx*lens);
+ }
+ else {
+ dfac= (sensor_y * 2.0) / (fac*winy*lens);
+ }
x1= - *clipsta * winx*dfac;
x2= -x1;
@@ -1057,8 +1089,8 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy
dy += cam->shifty * cam->ortho_scale;
}
else {
- dx += cam->shiftx * (cam->clipsta / cam->lens) * 32.0f;
- dy += cam->shifty * (cam->clipsta / cam->lens) * 32.0f;
+ dx += cam->shiftx * (cam->clipsta / cam->lens) * sensor;
+ dy += cam->shifty * (cam->clipsta / cam->lens) * sensor;
}
x1+= dx;
@@ -1076,7 +1108,14 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy
*pixsize= 1.0f/viewfac;
}
else {
- viewfac= (((winx >= winy)? winx: winy)*lens)/32.0f;
+ float size= ((winx >= winy)? winx: winy);
+
+ if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
+ size= winx;
+ else if(sensor_fit==CAMERA_SENSOR_FIT_VERT)
+ size= winy;
+
+ viewfac= (size*lens)/sensor;
*pixsize= *clipsta/viewfac;
}
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 9c1d5adcd1b..759fefba438 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -118,10 +118,22 @@ void setTransformViewMatrices(TransInfo *t)
calculateCenter2D(t);
}
+static void convertViewVec2D(View2D *v2d, float *vec, int dx, int dy)
+{
+ float divx, divy;
+
+ divx= v2d->mask.xmax - v2d->mask.xmin;
+ divy= v2d->mask.ymax - v2d->mask.ymin;
+
+ vec[0]= (v2d->cur.xmax - v2d->cur.xmin) * dx / divx;
+ vec[1]= (v2d->cur.ymax - v2d->cur.ymin) * dy / divy;
+ vec[2]= 0.0f;
+}
+
void convertViewVec(TransInfo *t, float *vec, int dx, int dy)
{
- if (t->spacetype==SPACE_VIEW3D) {
- if (t->ar->regiontype == RGN_TYPE_WINDOW) {
+ if(t->spacetype==SPACE_VIEW3D) {
+ if(t->ar->regiontype == RGN_TYPE_WINDOW) {
float mval_f[2];
mval_f[0]= dx;
mval_f[1]= dy;
@@ -129,50 +141,19 @@ void convertViewVec(TransInfo *t, float *vec, int dx, int dy)
}
}
else if(t->spacetype==SPACE_IMAGE) {
- View2D *v2d = t->view;
- float divx, divy, aspx, aspy;
-
- ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ float aspx, aspy;
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
+ convertViewVec2D(t->view, vec, dx, dy);
- vec[0]= aspx*(v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
- vec[1]= aspy*(v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
+ ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ vec[0]*= aspx;
+ vec[1]*= aspy;
}
else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
- View2D *v2d = t->view;
- float divx, divy;
-
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
-
- vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx) / (divx);
- vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy) / (divy);
- vec[2]= 0.0f;
+ convertViewVec2D(t->view, vec, dx, dy);
}
- else if(t->spacetype==SPACE_NODE) {
- View2D *v2d = &t->ar->v2d;
- float divx, divy;
-
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
-
- vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
- vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
- }
- else if(t->spacetype==SPACE_SEQ) {
- View2D *v2d = &t->ar->v2d;
- float divx, divy;
-
- divx= v2d->mask.xmax-v2d->mask.xmin;
- divy= v2d->mask.ymax-v2d->mask.ymin;
-
- vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
- vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
- vec[2]= 0.0f;
+ else if(ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
+ convertViewVec2D(&t->ar->v2d, vec, dx, dy);
}
}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 2d3c1d80d8d..f926f442830 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -610,7 +610,7 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
- ot->poll = ED_operator_editcurve;
+ ot->poll = ED_operator_editcurve_3d;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);