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:
-rw-r--r--release/scripts/startup/bl_operators/clip.py22
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py15
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/BKE_modifier.h3
-rw-r--r--source/blender/blenkernel/BKE_ocean.h8
-rw-r--r--source/blender/blenkernel/intern/camera.c72
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c32
-rw-r--r--source/blender/blenkernel/intern/image.c4
-rw-r--r--source/blender/blenkernel/intern/modifier.c38
-rw-r--r--source/blender/blenkernel/intern/ocean.c25
-rw-r--r--source/blender/blenkernel/intern/particle_system.c7
-rw-r--r--source/blender/blenlib/BLI_math_geom.h32
-rw-r--r--source/blender/blenlib/intern/math_geom.c178
-rw-r--r--source/blender/blenloader/intern/readfile.c5
-rw-r--r--source/blender/editors/include/UI_interface.h3
-rw-r--r--source/blender/editors/interface/interface_panel.c39
-rw-r--r--source/blender/editors/object/object_modifier.c7
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c8
-rw-r--r--source/blender/editors/physics/physics_fluid.c39
-rw-r--r--source/blender/editors/render/render_opengl.c6
-rw-r--r--source/blender/editors/screen/area.c42
-rw-r--r--source/blender/editors/screen/screendump.c4
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h1
-rw-r--r--source/blender/makesdna/DNA_object_fluidsim.h5
-rw-r--r--source/blender/makesrna/intern/makesrna.c12
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c17
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c5
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c2
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c61
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c38
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c3
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c61
-rw-r--r--source/blender/render/intern/source/pipeline.c18
33 files changed, 477 insertions, 337 deletions
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py
index 6c2256dc08b..59c4f88251d 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -259,14 +259,10 @@ object's movement caused by this constraint"""
con = x
if not con:
- return
-
- if con.type == 'FOLLOW_TRACK' and con.use_3d_position:
- mat = ob.matrix_world.copy()
- ob.constraints.remove(con)
- ob.matrix_world = mat
+ self.report({'ERROR'},
+ "Motion Tracking constraint to be converted not found")
- return
+ return {'CANCELLED'}
# Get clip used for parenting
if con.use_active_clip:
@@ -275,7 +271,17 @@ object's movement caused by this constraint"""
clip = con.clip
if not clip:
- return
+ self.report({'ERROR'},
+ "Movie clip to use tracking data from isn't set")
+
+ return {'CANCELLED'}
+
+ if con.type == 'FOLLOW_TRACK' and con.use_3d_position:
+ mat = ob.matrix_world.copy()
+ ob.constraints.remove(con)
+ ob.matrix_world = mat
+
+ return {'FINISHED'}
# Find start and end frames
for track in clip.tracking.tracks:
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index d4594e84744..d73307d152a 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -458,12 +458,19 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
layout.separator()
layout.prop(md, "use_normals")
-
- row = layout.row()
- row.prop(md, "use_foam")
- sub = row.row()
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "use_foam")
+ sub = col.row()
sub.active = md.use_foam
sub.prop(md, "foam_coverage", text="Coverage")
+
+ col = split.column()
+ col.active = md.use_foam
+ col.label("Foam Data Layer Name:")
+ col.prop(md, "foam_layer_name", text="")
layout.separator()
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index adb34f4c501..a3e0b5b6d5a 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -52,7 +52,7 @@ void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *re
int BKE_alphatest_ibuf(struct ImBuf *ibuf);
int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
-void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
+void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, int imtype, const short use_ext, const short use_frames);
int BKE_add_image_extension(char *string, int imtype);
int BKE_ftype_to_imtype(int ftype);
int BKE_imtype_to_ftype(int imtype);
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index db57f2e30fa..3063d9bc40a 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -365,5 +365,8 @@ void test_object_modifiers(struct Object *ob);
/* here for do_versions */
void modifier_mdef_compact_influences(struct ModifierData *md);
+void modifier_path_init(char *path, int path_maxlen, const char *name);
+const char *modifier_path_relbase(struct Object *ob);
+
#endif
diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h
index c1f228fe186..c8ce3f8ce63 100644
--- a/source/blender/blenkernel/BKE_ocean.h
+++ b/source/blender/blenkernel/BKE_ocean.h
@@ -48,7 +48,8 @@ typedef struct OceanCache {
struct ImBuf **ibufs_foam;
struct ImBuf **ibufs_norm;
- char *bakepath;
+ const char *bakepath;
+ const char *relbase;
/* precalculated for time range */
float *time;
@@ -92,8 +93,9 @@ void BKE_ocean_eval_ij(struct Ocean * oc, struct OceanResult *ocr, int i, int j)
/* ocean cache handling */
-struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale,
- float chop_amount, float foam_coverage, float foam_fade, int resolution);
+struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase,
+ int start, int end, float wave_scale,
+ float chop_amount, float foam_coverage, float foam_fade, int resolution);
void BKE_simulate_ocean_cache(struct OceanCache *och, int frame);
void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data);
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index da7c0ab1774..08e8a80750e 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -456,7 +456,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
unsigned int i;
for (i= 0; i < 4; i++) {
- float nd= -dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]);
+ float nd= dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]);
if (nd < data->dist_vals[i]) {
data->dist_vals[i]= nd;
}
@@ -530,55 +530,49 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam
mul_v3_v3fl(plane_tx[i], data_cb.normal_tx[i], data_cb.dist_vals[i]);
}
- if ( (isect_plane_plane_v3(plane_isect_1, plane_isect_1_no,
- plane_tx[0], data_cb.normal_tx[0],
- plane_tx[2], data_cb.normal_tx[2]) == 0) ||
- (isect_plane_plane_v3(plane_isect_2, plane_isect_2_no,
- plane_tx[1], data_cb.normal_tx[1],
- plane_tx[3], data_cb.normal_tx[3]) == 0))
+ isect_plane_plane_v3(plane_isect_1, plane_isect_1_no,
+ plane_tx[0], data_cb.normal_tx[0],
+ plane_tx[2], data_cb.normal_tx[2]);
+ isect_plane_plane_v3(plane_isect_2, plane_isect_2_no,
+ plane_tx[1], data_cb.normal_tx[1],
+ plane_tx[3], data_cb.normal_tx[3]);
+
+ add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
+ add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
+
+ if (isect_line_line_v3(plane_isect_1, plane_isect_1_other,
+ plane_isect_2, plane_isect_2_other,
+ plane_isect_pt_1, plane_isect_pt_2) == 0)
{
- /* this is very unlikely */
return FALSE;
}
else {
+ float cam_plane_no[3]= {0.0f, 0.0f, -1.0f};
+ float plane_isect_delta[3];
+ float plane_isect_delta_len;
- add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
- add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
-
- if (isect_line_line_v3(plane_isect_1, plane_isect_1_other,
- plane_isect_2, plane_isect_2_other,
- plane_isect_pt_1, plane_isect_pt_2) == 0)
- {
- return FALSE;
- }
- else {
- float cam_plane_no[3]= {0.0f, 0.0f, -1.0f};
- float plane_isect_delta[3];
- float plane_isect_delta_len;
-
- mul_m3_v3(rot_obmat, cam_plane_no);
+ mul_m3_v3(rot_obmat, cam_plane_no);
- sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
- plane_isect_delta_len= len_v3(plane_isect_delta);
+ sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
+ plane_isect_delta_len= len_v3(plane_isect_delta);
- if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
- copy_v3_v3(r_co, plane_isect_pt_1);
+ if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
+ copy_v3_v3(r_co, plane_isect_pt_1);
- /* offset shift */
- normalize_v3(plane_isect_1_no);
- madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len);
- }
- else {
- copy_v3_v3(r_co, plane_isect_pt_2);
+ /* offset shift */
+ normalize_v3(plane_isect_1_no);
+ madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len);
+ }
+ else {
+ copy_v3_v3(r_co, plane_isect_pt_2);
- /* offset shift */
- normalize_v3(plane_isect_2_no);
- madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len);
- }
+ /* offset shift */
+ normalize_v3(plane_isect_2_no);
+ madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len);
+ }
- return TRUE;
- }
+ return TRUE;
}
}
}
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 11fe79daa51..aa2790fca2e 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -976,8 +976,8 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett
surface->wave_timescale = 1.0f;
surface->wave_spring = 0.20f;
- BLI_snprintf(surface->image_output_path, sizeof(surface->image_output_path), "%sdynamicpaint", U.textudir);
- BLI_cleanup_dir(NULL, surface->image_output_path);
+ modifier_path_init(surface->image_output_path, sizeof(surface->image_output_path), "dynamicpaint");
+
dynamicPaintSurface_setUniqueName(surface, "Surface");
surface->effector_weights = BKE_add_effector_weights(NULL);
@@ -1475,11 +1475,12 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
}
/* make sure allocated surface size matches current requirements */
-static void dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
+static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
{
if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
- dynamicPaint_resetSurface(surface);
+ return dynamicPaint_resetSurface(surface);
}
+ return 1;
}
@@ -1614,6 +1615,10 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
/* paint layer */
col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name);
+ /* if output layer is lost from a constructive modifier, re-add it */
+ if (!col && dynamicPaint_outputLayerExists(surface, ob, 0))
+ col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name);
+ /* apply color */
if (col) {
#pragma omp parallel for schedule(static)
for (i=0; i<numOfFaces; i++) {
@@ -1634,6 +1639,10 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
/* wet layer */
col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name2);
+ /* if output layer is lost from a constructive modifier, re-add it */
+ if (!col && dynamicPaint_outputLayerExists(surface, ob, 1))
+ col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name2);
+ /* apply color */
if (col) {
#pragma omp parallel for schedule(static)
for (i=0; i<numOfFaces; i++) {
@@ -1792,7 +1801,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
if (!(surface->flags & MOD_DPAINT_ACTIVE)) continue;
/* make sure surface is valid */
- dynamicPaint_checkSurfaceData(surface);
+ if (!dynamicPaint_checkSurfaceData(surface)) continue;
/* limit frame range */
CLAMP(current_frame, surface->start_frame, surface->end_frame);
@@ -3396,7 +3405,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
velocity_val = len_v3(velocity);
/* if brush has smudge enabled store brush velocity */
- if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
+ brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
copy_v3_v3(&bData->brush_velocity[index*4], velocity);
mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
bData->brush_velocity[index*4+3] = velocity_val;
@@ -3690,7 +3700,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
velocity_val = len_v3(velocity);
/* store brush velocity for smudge */
- if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
+ brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
copy_v3_v3(&bData->brush_velocity[index*4], velocity);
mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
bData->brush_velocity[index*4+3] = velocity_val;
@@ -3788,7 +3799,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
velocity_val = len_v3(velocity);
/* store brush velocity for smudge */
- if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
+ brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
copy_v3_v3(&bData->brush_velocity[index*4], velocity);
mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
bData->brush_velocity[index*4+3] = velocity_val;
@@ -4802,7 +4814,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
BrushMaterials bMats = {0};
/* calculate brush speed vectors if required */
- if (brush->flags & MOD_DPAINT_DO_SMUDGE) {
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE) {
bData->brush_velocity = MEM_callocN(sData->total_points*sizeof(float)*4, "Dynamic Paint brush velocity");
/* init adjacency data if not already */
if (!sData->adj_data)
@@ -4852,7 +4864,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
/* process special brush effects, like smudge */
if (bData->brush_velocity) {
- if (brush->flags & MOD_DPAINT_DO_SMUDGE)
+ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE)
dynamicPaint_doSmudge(surface, brush, timescale);
MEM_freeN(bData->brush_velocity);
bData->brush_velocity = NULL;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 08440849a4e..a61ae705020 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1484,11 +1484,11 @@ int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const
}
-void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames)
+void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, int imtype, const short use_ext, const short use_frames)
{
if (string==NULL) return;
BLI_strncpy(string, base, FILE_MAX - 10); /* weak assumption */
- BLI_path_abs(string, G.main->name);
+ BLI_path_abs(string, relbase);
if(use_frames)
BLI_path_frame(string, frame, 4);
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index bbc1b596889..f09be8c34ad 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -60,6 +60,11 @@
#include "BKE_key.h"
#include "BKE_multires.h"
+/* may move these, only for modifier_path_relbase */
+#include "BKE_global.h" /* ugh, G.main->name only */
+#include "BKE_main.h"
+/* end */
+
#include "MOD_modifiertypes.h"
ModifierTypeInfo *modifierType_getInfo(ModifierType type)
@@ -573,3 +578,36 @@ void test_object_modifiers(Object *ob)
}
}
}
+
+/* where should this go?, it doesnt fit well anywhere :S - campbell */
+
+/* elubie: changed this to default to the same dir as the render output
+ * to prevent saving to C:\ on Windows */
+
+/* campbell: logic behind this...
+ *
+ * - if the ID is from a library, return library path
+ * - else if the file has been saved return the blend file path.
+ * - else if the file isn't saved and the ID isnt from a library, return the temp dir.
+ */
+const char *modifier_path_relbase(Object *ob)
+{
+ if (G.relbase_valid || ob->id.lib) {
+ return ID_BLEND_PATH(G.main, &ob->id);
+ }
+ else {
+ /* last resort, better then using "" which resolves to the current
+ * working directory */
+ return BLI_temporary_dir();
+ }
+}
+
+/* initializes the path with either */
+void modifier_path_init(char *path, int path_maxlen, const char *name)
+{
+ /* elubie: changed this to default to the same dir as the render output
+ * to prevent saving to C:\ on Windows */
+ BLI_join_dirfile(path, path_maxlen,
+ G.relbase_valid ? "//" : BLI_temporary_dir(),
+ name);
+}
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index df4cd94cf38..5cf0b8c2348 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -998,7 +998,7 @@ void BKE_free_ocean(struct Ocean *oc)
#define CACHE_TYPE_FOAM 2
#define CACHE_TYPE_NORMAL 3
-static void cache_filename(char *string, const char *path, int frame, int type)
+static void cache_filename(char *string, const char *path, const char *relbase, int frame, int type)
{
char cachepath[FILE_MAX];
const char *fname;
@@ -1018,7 +1018,7 @@ static void cache_filename(char *string, const char *path, int frame, int type)
BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname);
- BKE_makepicstring(string, cachepath, frame, R_OPENEXR, 1, TRUE);
+ BKE_makepicstring(string, cachepath, relbase, frame, R_OPENEXR, 1, TRUE);
}
void BKE_free_ocean_cache(struct OceanCache *och)
@@ -1119,12 +1119,15 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, in
}
}
-struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale,
- float chop_amount, float foam_coverage, float foam_fade, int resolution)
+struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase,
+ int start, int end, float wave_scale,
+ float chop_amount, float foam_coverage, float foam_fade, int resolution)
{
OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data");
och->bakepath = bakepath;
+ och->relbase = relbase;
+
och->start = start;
och->end = end;
och->duration = (end - start) + 1;
@@ -1158,17 +1161,17 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame)
if (och->ibufs_disp[f] != NULL ) return;
- cache_filename(string, och->bakepath, frame, CACHE_TYPE_DISPLACE);
+ cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE);
och->ibufs_disp[f] = IMB_loadiffname(string, 0);
//if (och->ibufs_disp[f] == NULL) printf("error loading %s \n", string);
//else printf("loaded cache %s \n", string);
- cache_filename(string, och->bakepath, frame, CACHE_TYPE_FOAM);
+ cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_FOAM);
och->ibufs_foam[f] = IMB_loadiffname(string, 0);
//if (och->ibufs_foam[f] == NULL) printf("error loading %s \n", string);
//else printf("loaded cache %s \n", string);
- cache_filename(string, och->bakepath, frame, CACHE_TYPE_NORMAL);
+ cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_NORMAL);
och->ibufs_norm[f] = IMB_loadiffname(string, 0);
//if (och->ibufs_norm[f] == NULL) printf("error loading %s \n", string);
//else printf("loaded cache %s \n", string);
@@ -1288,18 +1291,18 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
}
/* write the images */
- cache_filename(string, och->bakepath, f, CACHE_TYPE_DISPLACE);
+ cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE);
if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
printf("Cannot save Displacement File Output to %s\n", string);
if (o->_do_jacobian) {
- cache_filename(string, och->bakepath, f, CACHE_TYPE_FOAM);
+ cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM);
if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
printf("Cannot save Foam File Output to %s\n", string);
}
if (o->_do_normals) {
- cache_filename(string, och->bakepath, f, CACHE_TYPE_NORMAL);
+ cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL);
if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2)) // 2 == ZIP exr codec
printf("Cannot save Normal File Output to %s\n", string);
}
@@ -1409,7 +1412,7 @@ struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start
return och;
}
-void BKE_simulate_ocean_cache(struct OceanCache *UNUSED(och), int UNUSED(frame))
+void BKE_simulate_ocean_cache(struct OceanCache *UNUSED(och), const char *UNUSED(relbase), int UNUSED(frame))
{
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 3f127c7656b..3c5674f0b0f 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -3936,9 +3936,10 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
// return;
// ok, start loading
- BLI_snprintf(filename, sizeof(filename), "%sfluidsurface_particles_####.gz", fss->surfdataPath);
-
- BLI_path_abs(filename, G.main->name);
+ BLI_join_dirfile(filename, sizeof(filename), fss->surfdataPath, OB_FLUIDSIM_SURF_PARTICLES_FNAME);
+
+ BLI_path_abs(filename, modifier_path_relbase(sim->ob));
+
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
gzf = gzopen(filename, "rb");
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 74869ca347b..bb19a50f22e 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -62,6 +62,7 @@ float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2]);
float dist_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2]);
void closest_to_line_segment_v2(float closest[2], const float p[2], const float l1[2], const float l2[2]);
+float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]);
float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]);
float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]);
float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]);
@@ -98,12 +99,13 @@ int isect_line_line_v3(const float v1[3], const float v2[3],
float i1[3], float i2[3]);
int isect_line_line_strict_v3(const float v1[3], const float v2[3],
const float v3[3], const float v4[3],
- float vi[3], float *lambda);
+ float vi[3], float *r_lambda);
/*if clip is nonzero, will only return true if lambda is >= 0.0
(i.e. intersection point is along positive d)*/
-int isect_ray_plane_v3(float p1[3], float d[3], float v0[3],
- float v1[3], float v2[3], float *lambda, int clip);
+int isect_ray_plane_v3(const float p1[3], const float d[3],
+ const float v0[3], const float v1[3], const float v2[3],
+ float *r_lambda, const int clip);
/**
* Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument.
@@ -128,19 +130,19 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3],
* @param plane_b_co The point on the second plane.
* @param plane_b_no The normal of the second plane.
*/
-int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
- const float plane_a_co[3], const float plane_a_no[3],
- const float plane_b_co[3], const float plane_b_no[3]);
+void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
+ const float plane_a_co[3], const float plane_a_no[3],
+ const float plane_b_co[3], const float plane_b_no[3]);
/* line/ray triangle */
int isect_line_tri_v3(const float p1[3], const float p2[3],
- const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]);
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]);
int isect_ray_tri_v3(const float p1[3], const float d[3],
- const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]);
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2]);
int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
- const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float threshold);
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float threshold);
int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
- const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon);
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2], const float epsilon);
/* point in polygon */
int isect_point_quad_v2(const float p[2], const float a[2], const float b[2], const float c[2], const float d[2]);
@@ -150,16 +152,16 @@ int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y
int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3]);
void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2],
- const float pt[2], float *uv);
+ const float pt[2], float r_uv[2]);
void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2],
- const float v3[2], const float pt[2], float *uv);
+ const float v3[2], const float pt[2], float r_uv[2]);
/* other */
int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius,
- const float v0[3], const float v1[3], const float v2[3], float *lambda, float ipoint[3]);
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3]);
int isect_axial_line_tri_v3(const int axis, const float co1[3], const float co2[3],
- const float v0[3], const float v1[3], const float v2[3], float *lambda);
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda);
int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]);
@@ -186,7 +188,7 @@ void barycentric_transform(float pt_tar[3], float const pt_src[3],
void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2],
const float co[2], float w[3]);
-void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]);
+void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2]);
void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2]);
/***************************** View & Projection *****************************/
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index eecaed10bcc..e37c00078fa 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -238,6 +238,15 @@ void closest_to_line_segment_v3(float closest[3], const float v1[3], const float
}
/* signed distance from the point to the plane in 3D */
+float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3])
+{
+ float plane_co_other[3];
+
+ add_v3_v3v3(plane_co_other, plane_co, plane_no_unit);
+
+ return line_point_factor_v3(p, plane_co, plane_co_other);
+}
+
float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3])
{
float plane_no_unit[3];
@@ -246,7 +255,7 @@ float dist_to_plane_v3(const float p[3], const float plane_co[3], const float pl
normalize_v3_v3(plane_no_unit, plane_no);
add_v3_v3v3(plane_co_other, plane_co, plane_no_unit);
- return -line_point_factor_v3(p, plane_co, plane_co_other);
+ return line_point_factor_v3(p, plane_co, plane_co_other);
}
/* distance v1 to line-piece v2-v3 in 3D */
@@ -601,7 +610,9 @@ int isect_point_quad_v2(const float pt[2], const float v1[2], const float v2[2],
test if the line starting at p1 ending at p2 intersects the triangle v0..v2
return non zero if it does
*/
-int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2])
+int isect_line_tri_v3(const float p1[3], const float p2[3],
+ const float v0[3], const float v1[3], const float v2[3],
+ float *r_lambda, float r_uv[2])
{
float p[3], s[3], d[3], e1[3], e2[3], q[3];
@@ -626,12 +637,12 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c
v = f * dot_v3v3(d, q);
if ((v < 0.0f)||((u + v) > 1.0f)) return 0;
- *lambda = f * dot_v3v3(e2, q);
- if ((*lambda < 0.0f)||(*lambda > 1.0f)) return 0;
+ *r_lambda = f * dot_v3v3(e2, q);
+ if ((*r_lambda < 0.0f)||(*r_lambda > 1.0f)) return 0;
- if(uv) {
- uv[0]= u;
- uv[1]= v;
+ if(r_uv) {
+ r_uv[0]= u;
+ r_uv[1]= v;
}
return 1;
@@ -640,7 +651,9 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c
test if the ray starting at p1 going in d direction intersects the triangle v0..v2
return non zero if it does
*/
-int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2])
+int isect_ray_tri_v3(const float p1[3], const float d[3],
+ const float v0[3], const float v1[3], const float v2[3],
+ float *r_lambda, float r_uv[2])
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
@@ -665,18 +678,20 @@ int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], con
v = f * dot_v3v3(d, q);
if ((v < 0.0f)||((u + v) > 1.0f)) return 0;
- *lambda = f * dot_v3v3(e2, q);
- if ((*lambda < 0.0f)) return 0;
+ *r_lambda = f * dot_v3v3(e2, q);
+ if ((*r_lambda < 0.0f)) return 0;
- if(uv) {
- uv[0]= u;
- uv[1]= v;
+ if(r_uv) {
+ r_uv[0]= u;
+ r_uv[1]= v;
}
return 1;
}
-int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], float v1[3], float v2[3], float *lambda, int clip)
+int isect_ray_plane_v3(const float p1[3], const float d[3],
+ const float v0[3], const float v1[3], const float v2[3],
+ float *r_lambda, const int clip)
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f;
@@ -700,13 +715,15 @@ int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], float v1[3], float
/* v = f * dot_v3v3(d, q); */ /*UNUSED*/
- *lambda = f * dot_v3v3(e2, q);
- if (clip && (*lambda < 0.0f)) return 0;
+ *r_lambda = f * dot_v3v3(e2, q);
+ if (clip && (*r_lambda < 0.0f)) return 0;
return 1;
}
-int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon)
+int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
+ const float v0[3], const float v1[3], const float v2[3],
+ float *r_lambda, float uv[2], const float epsilon)
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
@@ -729,8 +746,8 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0
v = f * dot_v3v3(d, q);
if ((v < -epsilon)||((u + v) > 1.0f+epsilon)) return 0;
- *lambda = f * dot_v3v3(e2, q);
- if ((*lambda < 0.0f)) return 0;
+ *r_lambda = f * dot_v3v3(e2, q);
+ if ((*r_lambda < 0.0f)) return 0;
if(uv) {
uv[0]= u;
@@ -740,7 +757,9 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0
return 1;
}
-int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float *uv, const float threshold)
+int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
+ const float v0[3], const float v1[3], const float v2[3],
+ float *r_lambda, float r_uv[2], const float threshold)
{
float p[3], s[3], e1[3], e2[3], q[3];
float a, f, u, v;
@@ -757,8 +776,8 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float
sub_v3_v3v3(s, p1, v0);
cross_v3_v3v3(q, s, e1);
- *lambda = f * dot_v3v3(e2, q);
- if ((*lambda < 0.0f)) return 0;
+ *r_lambda = f * dot_v3v3(e2, q);
+ if ((*r_lambda < 0.0f)) return 0;
u = f * dot_v3v3(s, p);
v = f * dot_v3v3(d, q);
@@ -782,9 +801,9 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3], const float
return 0;
}
- if(uv) {
- uv[0]= u;
- uv[1]= v;
+ if(r_uv) {
+ r_uv[0]= u;
+ r_uv[1]= v;
}
return 1;
@@ -833,24 +852,16 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
}
}
-int isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
+/* note: return normal isnt unit length */
+void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
const float plane_a_co[3], const float plane_a_no[3],
const float plane_b_co[3], const float plane_b_no[3])
{
- float p1_co_other[3], p2_co_other[3];
- float isect_co_dummy[3];
-
- cross_v3_v3v3(r_isect_no, plane_a_no, plane_b_no);
- cross_v3_v3v3(p1_co_other, plane_a_no, r_isect_no);
- cross_v3_v3v3(p2_co_other, plane_b_no, r_isect_no);
-
- add_v3_v3(p1_co_other, plane_a_co);
- add_v3_v3(p2_co_other, plane_b_co);
-
- /* we could use either ix_1, ix_2 - doesnt matter in this case */
- return isect_line_line_v3(plane_a_co, p1_co_other,
- plane_b_co, p2_co_other,
- r_isect_co, isect_co_dummy);
+ float plane_a_co_other[3];
+ cross_v3_v3v3(r_isect_no, plane_a_no, plane_b_no); /* direction is simply the cross product */
+ cross_v3_v3v3(plane_a_co_other, plane_a_no, r_isect_no);
+ add_v3_v3(plane_a_co_other, plane_a_co);
+ isect_line_plane_v3(r_isect_co, plane_a_co, plane_a_co_other, plane_b_co, plane_b_no, FALSE);
}
@@ -893,7 +904,10 @@ static int getLowestRoot(const float a, const float b, const float c, const floa
return 0;
}
-int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, const float v0[3], const float v1[3], const float v2[3], float *lambda, float ipoint[3])
+int isect_sweeping_sphere_tri_v3(
+ const float p1[3], const float p2[3], const float radius,
+ const float v0[3], const float v1[3], const float v2[3],
+ float *r_lambda, float ipoint[3])
{
float e1[3], e2[3], e3[3], point[3], vel[3], /*dist[3],*/ nor[3], temp[3], bv[3];
float a, b, c, d, e, x, y, z, radius2=radius*radius;
@@ -960,14 +974,14 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
if(z <= 0.0f && (x >= 0.0f && y >= 0.0f))
{
//(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000){
- *lambda=t0;
+ *r_lambda=t0;
copy_v3_v3(ipoint,point);
return 1;
}
}
- *lambda=1.0f;
+ *r_lambda=1.0f;
/*---test points---*/
a=dot_v3v3(vel,vel);
@@ -977,7 +991,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *lambda, lambda))
+ if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
{
copy_v3_v3(ipoint,v0);
found_by_sweep=1;
@@ -988,7 +1002,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *lambda, lambda))
+ if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
{
copy_v3_v3(ipoint,v1);
found_by_sweep=1;
@@ -999,7 +1013,7 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *lambda, lambda))
+ if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
{
copy_v3_v3(ipoint,v2);
found_by_sweep=1;
@@ -1020,13 +1034,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
- if(getLowestRoot(a, b, c, *lambda, &newLambda))
+ if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
{
e=(edotv*newLambda-edotbv)/elen2;
if(e >= 0.0f && e <= 1.0f)
{
- *lambda = newLambda;
+ *r_lambda = newLambda;
copy_v3_v3(ipoint,e1);
mul_v3_fl(ipoint,e);
add_v3_v3(ipoint, v0);
@@ -1044,13 +1058,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
- if(getLowestRoot(a, b, c, *lambda, &newLambda))
+ if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
{
e=(edotv*newLambda-edotbv)/elen2;
if(e >= 0.0f && e <= 1.0f)
{
- *lambda = newLambda;
+ *r_lambda = newLambda;
copy_v3_v3(ipoint,e2);
mul_v3_fl(ipoint,e);
add_v3_v3(ipoint, v0);
@@ -1073,13 +1087,13 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
- if(getLowestRoot(a, b, c, *lambda, &newLambda))
+ if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
{
e=(edotv*newLambda-edotbv)/elen2;
if(e >= 0.0f && e <= 1.0f)
{
- *lambda = newLambda;
+ *r_lambda = newLambda;
copy_v3_v3(ipoint,e3);
mul_v3_fl(ipoint,e);
add_v3_v3(ipoint, v1);
@@ -1090,7 +1104,8 @@ int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const flo
return found_by_sweep;
}
-int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3], const float v0[3], const float v1[3], const float v2[3], float *lambda)
+int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3],
+ const float v0[3], const float v1[3], const float v2[3], float *r_lambda)
{
float p[3], e1[3], e2[3];
float u, v, f;
@@ -1127,9 +1142,9 @@ int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3]
if ((u < 0.0f) || ((u + v) > 1.0f)) return 0;
- *lambda = (p[a0]+u*e1[a0]+v*e2[a0])/(p2[a0]-p1[a0]);
+ *r_lambda = (p[a0]+u*e1[a0]+v*e2[a0])/(p2[a0]-p1[a0]);
- if ((*lambda < 0.0f) || (*lambda > 1.0f)) return 0;
+ if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return 0;
return 1;
}
@@ -1203,7 +1218,7 @@ int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3],
/* Intersection point strictly between the two lines
* 0 when no intersection is found
* */
-int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *lambda)
+int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float vi[3], float *r_lambda)
{
float a[3], b[3], c[3], ab[3], cb[3], ca[3], dir1[3], dir2[3];
float d;
@@ -1237,12 +1252,9 @@ int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float
{
mul_v3_fl(a, f1);
add_v3_v3v3(vi, v1, a);
-
- if (lambda != NULL)
- {
- *lambda = f1;
- }
-
+
+ if (r_lambda) *r_lambda = f1;
+
return 1; /* intersection found */
}
else
@@ -1306,7 +1318,7 @@ float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2
}
/* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */
-void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv)
+void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2])
{
float x0,y0, x1,y1, wtot, v2d[2], w1, w2;
@@ -1331,7 +1343,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
wtot = w1+w2;
/*w1 = w1/wtot;*/
/*w2 = w2/wtot;*/
- uv[0] = w1/wtot;
+ r_uv[0] = w1/wtot;
} else {
/* lines are parallel, lambda_cp_line_ex is 3d grrr */
/*printf("\tparallel1\n");*/
@@ -1353,7 +1365,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
v2d[1] = pt[1]-pt_on_line[1];
w2 = len_v2(v2d);
wtot = w1+w2;
- uv[0] = w1/wtot;
+ r_uv[0] = w1/wtot;
}
/* Same as above to calc the uv[1] value, alternate calculation */
@@ -1371,7 +1383,7 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
v2d[1] = y1-v1[1];
w2 = len_v2(v2d);
wtot = w1+w2;
- uv[1] = w1/wtot;
+ r_uv[1] = w1/wtot;
} else {
/* lines are parallel, lambda_cp_line_ex is 3d grrr */
/*printf("\tparallel2\n");*/
@@ -1394,23 +1406,23 @@ void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2
v2d[1] = pt[1]-pt_on_line[1];
w2 = len_v2(v2d);
wtot = w1+w2;
- uv[1] = w1/wtot;
+ r_uv[1] = w1/wtot;
}
/* may need to flip UV's here */
}
/* same as above but does tri's and quads, tri's are a bit of a hack */
-void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float *uv)
+void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2])
{
if (isquad) {
- isect_point_quad_uv_v2(v0, v1, v2, v3, pt, uv);
+ isect_point_quad_uv_v2(v0, v1, v2, v3, pt, r_uv);
}
else {
/* not for quads, use for our abuse of LineIntersectsTriangleUV */
float p1_3d[3], p2_3d[3], v0_3d[3], v1_3d[3], v2_3d[3], lambda;
- p1_3d[0] = p2_3d[0] = uv[0];
- p1_3d[1] = p2_3d[1] = uv[1];
+ p1_3d[0] = p2_3d[0] = r_uv[0];
+ p1_3d[1] = p2_3d[1] = r_uv[1];
p1_3d[2] = 1.0f;
p2_3d[2] = -1.0f;
v0_3d[2] = v1_3d[2] = v2_3d[2] = 0.0;
@@ -1427,7 +1439,7 @@ void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[
copy_v2_v2(v2_3d, v2);
/* Doing this in 3D is not nice */
- isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, uv);
+ isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, r_uv);
}
}
@@ -1993,7 +2005,7 @@ void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3
#define IS_ZERO(x) ((x>(-DBL_EPSILON) && x<DBL_EPSILON) ? 1 : 0)
/* Barycentric reverse */
-void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2])
+void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2])
{
/* find UV such that
t= u*t0 + v*t1 + (1-u-v)*t2
@@ -2005,13 +2017,13 @@ void resolve_tri_uv(float uv[2], const float st[2], const float st0[2], const fl
if(IS_ZERO(det)==0) { /* det should never be zero since the determinant is the signed ST area of the triangle. */
const double x[]= {st[0]-st2[0], st[1]-st2[1]};
- uv[0]= (float)((d*x[0] - b*x[1])/det);
- uv[1]= (float)(((-c)*x[0] + a*x[1])/det);
- } else zero_v2(uv);
+ r_uv[0]= (float)((d*x[0] - b*x[1])/det);
+ r_uv[1]= (float)(((-c)*x[0] + a*x[1])/det);
+ } else zero_v2(r_uv);
}
/* bilinear reverse */
-void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
+void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
{
const double signed_area= (st0[0]*st1[1] - st0[1]*st1[0]) + (st1[0]*st2[1] - st1[1]*st2[0]) +
(st2[0]*st3[1] - st2[1]*st3[0]) + (st3[0]*st0[1] - st3[1]*st0[0]);
@@ -2029,25 +2041,25 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f
const double denom= a - 2*b + fC;
// clear outputs
- zero_v2(uv);
+ zero_v2(r_uv);
if(IS_ZERO(denom)!=0) {
const double fDen= a-fC;
if(IS_ZERO(fDen)==0)
- uv[0]= (float)(a / fDen);
+ r_uv[0]= (float)(a / fDen);
} else {
const double desc_sq= b*b - a*fC;
const double desc= sqrt(desc_sq<0.0?0.0:desc_sq);
const double s= signed_area>0 ? (-1.0) : 1.0;
- uv[0]= (float)(( (a-b) + s * desc ) / denom);
+ r_uv[0]= (float)(( (a-b) + s * desc ) / denom);
}
/* find UV such that
fST = (1-u)(1-v)*ST0 + u*(1-v)*ST1 + u*v*ST2 + (1-u)*v*ST3 */
{
- const double denom_s= (1-uv[0])*(st0[0]-st3[0]) + uv[0]*(st1[0]-st2[0]);
- const double denom_t= (1-uv[0])*(st0[1]-st3[1]) + uv[0]*(st1[1]-st2[1]);
+ const double denom_s= (1-r_uv[0])*(st0[0]-st3[0]) + r_uv[0]*(st1[0]-st2[0]);
+ const double denom_t= (1-r_uv[0])*(st0[1]-st3[1]) + r_uv[0]*(st1[1]-st2[1]);
int i= 0; double denom= denom_s;
if(fabs(denom_s)<fabs(denom_t)) {
@@ -2056,7 +2068,7 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f
}
if(IS_ZERO(denom)==0)
- uv[1]= (float) (( (1.0f-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom);
+ r_uv[1]= (float) (( (1.0f-r_uv[0])*(st0[i]-st[i]) + r_uv[0]*(st1[i]-st[i]) ) / denom);
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index afd153358c2..b58a27f556a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4808,6 +4808,9 @@ static void lib_link_scene(FileData *fd, Main *main)
/*Game Settings: Dome Warp Text*/
sce->gm.dome.warptext= newlibadr(fd, sce->id.lib, sce->gm.dome.warptext);
+ /* Motion Tracking */
+ sce->clip= newlibadr_us(fd, sce->id.lib, sce->clip);
+
sce->id.flag -= LIB_NEEDLINK;
}
@@ -5011,8 +5014,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->nodetree= newdataadr(fd, sce->nodetree);
if(sce->nodetree)
direct_link_nodetree(fd, sce->nodetree);
-
- sce->clip= newlibadr_us(fd, sce->id.lib, sce->clip);
}
/* ************ READ WM ***************** */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 01273b291a2..a0b477413e4 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -592,7 +592,8 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname);
* not clear yet so we postpone that. */
void uiBeginPanels(const struct bContext *C, struct ARegion *ar);
-void uiEndPanels(const struct bContext *C, struct ARegion *ar);
+void uiEndPanels(const struct bContext *C, struct ARegion *ar, int *x, int *y);
+void uiDrawPanels(const struct bContext *C, struct ARegion *ar);
struct Panel *uiBeginPanel(struct ScrArea *sa, struct ARegion *ar, uiBlock *block, struct PanelType *pt, int *open);
void uiEndPanel(uiBlock *block, int width, int height);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index ad79e550575..d66e6852f1d 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -779,6 +779,35 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
return done;
}
+static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
+{
+ Panel *pa;
+ int align= panel_aligned(sa, ar);
+ int sizex = UI_PANEL_WIDTH;
+ int sizey = UI_PANEL_WIDTH;
+
+ /* compute size taken up by panels, for setting in view2d */
+ for(pa= ar->panels.first; pa; pa= pa->next) {
+ if(pa->runtime_flag & PNL_ACTIVE) {
+ int pa_sizex, pa_sizey;
+
+ if(align==BUT_VERTICAL) {
+ pa_sizex= pa->ofsx + pa->sizex;
+ pa_sizey= get_panel_real_ofsy(pa);
+ }
+ else {
+ pa_sizex= get_panel_real_ofsx(pa) + pa->sizex;
+ pa_sizey= pa->ofsy + get_panel_size_y(pa);
+ }
+
+ sizex= MAX2(sizex, pa_sizex);
+ sizey= MIN2(sizey, pa_sizey);
+ }
+ }
+
+ *x= sizex;
+ *y= sizey;
+}
static void ui_do_animate(const bContext *C, Panel *panel)
{
@@ -818,7 +847,7 @@ void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
}
/* only draws blocks with panels */
-void uiEndPanels(const bContext *C, ARegion *ar)
+void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
{
ScrArea *sa= CTX_wm_area(C);
uiBlock *block;
@@ -871,6 +900,14 @@ void uiEndPanels(const bContext *C, ARegion *ar)
if(firstpa)
firstpa->runtime_flag |= PNL_FIRST;
+
+ /* compute size taken up by panel */
+ ui_panels_size(sa, ar, x, y);
+}
+
+void uiDrawPanels(const bContext *C, ARegion *ar)
+{
+ uiBlock *block;
UI_ThemeClearColor(TH_BACK);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 2f9f5e08911..f1a36a07734 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1598,9 +1598,10 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
return OPERATOR_FINISHED;
}
-
- och = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale,
- omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
+
+ och = BKE_init_ocean_cache(omd->cachepath, modifier_path_relbase(ob),
+ omd->bakestart, omd->bakeend, omd->wave_scale,
+ omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
och->time = MEM_mallocN(och->duration*sizeof(float), "foam bake time");
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index a12a9c8720b..6e25307b786 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -312,22 +312,22 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
*/
{
char filename[FILE_MAX];
- /* make sure output path has ending slash */
- BLI_add_slash(surface->image_output_path);
/* primary output layer */
if (surface->flags & MOD_DPAINT_OUT1) {
/* set filepath */
- BLI_snprintf(filename, sizeof(filename), "%s%s", surface->image_output_path, surface->output_name);
+ BLI_join_dirfile(filename, sizeof(filename), surface->image_output_path, surface->output_name);
BLI_path_frame(filename, frame, 4);
+
/* save image */
dynamicPaint_outputSurfaceImage(surface, filename, 0);
}
/* secondary output */
if (surface->flags & MOD_DPAINT_OUT2 && surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
/* set filepath */
- BLI_snprintf(filename, sizeof(filename), "%s%s", surface->image_output_path, surface->output_name2);
+ BLI_join_dirfile(filename, sizeof(filename), surface->image_output_path, surface->output_name2);
BLI_path_frame(filename, frame, 4);
+
/* save image */
dynamicPaint_outputSurfaceImage(surface, filename, 1);
}
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 6e88d477d9c..9dd4503414a 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -640,14 +640,17 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
char newSurfdataPath[FILE_MAXDIR+FILE_MAXFILE]; // modified output settings
const char *suffixConfig = FLUID_SUFFIX_CONFIG;
int outStringsChanged = 0;
-
+
// prepare names...
- strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
- strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR);
- BLI_path_abs(targetDir, G.main->name); // fixed #frame-no
+ const char *relbase= modifier_path_relbase(fsDomain);
+
+ BLI_strncpy(targetDir, domainSettings->surfdataPath, FILE_MAXDIR);
+ BLI_strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); /* if 0'd out below, this value is never used! */
+ BLI_path_abs(targetDir, relbase); // fixed #frame-no
- // .tmp: dont overwrite/delete original file
- BLI_snprintf(targetFile, FILE_MAXDIR+FILE_MAXFILE, "%s%s.tmp", targetDir, suffixConfig);
+ BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfig);
+ /* .tmp: dont overwrite/delete original file */
+ strncat(targetFile, ".tmp", FILE_MAX);
// make sure all directories exist
// as the bobjs use the same dir, this only needs to be checked
@@ -663,7 +666,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
BLI_delete(targetFile, 0,0);
}
- if((strlen(targetDir)<1) || (!dirExist)) {
+ if(targetDir[0] == '\0' || (!dirExist)) {
char blendDir[FILE_MAXDIR+FILE_MAXFILE];
char blendFile[FILE_MAXDIR+FILE_MAXFILE];
@@ -805,20 +808,20 @@ static void fluidbake_free_data(FluidAnimChannels *channels, ListBase *fobjects,
}
/* copied from rna_fluidsim.c: fluidsim_find_lastframe() */
-static void fluidsim_delete_until_lastframe(FluidsimSettings *fss)
+static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *relbase)
{
char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR];
char targetDirVel[FILE_MAXFILE+FILE_MAXDIR], targetFileVel[FILE_MAXFILE+FILE_MAXDIR];
char previewDir[FILE_MAXFILE+FILE_MAXDIR], previewFile[FILE_MAXFILE+FILE_MAXDIR];
int curFrame = 1, exists = 0;
- BLI_snprintf(targetDir, sizeof(targetDir), "%sfluidsurface_final_####.bobj.gz", fss->surfdataPath);
- BLI_snprintf(targetDirVel, sizeof(targetDir), "%sfluidsurface_final_####.bvel.gz", fss->surfdataPath);
- BLI_snprintf(previewDir, sizeof(targetDir), "%sfluidsurface_preview_####.bobj.gz", fss->surfdataPath);
+ BLI_join_dirfile(targetDir, sizeof(targetDir), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME);
+ BLI_join_dirfile(targetDirVel, sizeof(targetDirVel), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_VEL_FNAME);
+ BLI_join_dirfile(previewDir, sizeof(previewDir), fss->surfdataPath, OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME);
- BLI_path_abs(targetDir, G.main->name);
- BLI_path_abs(targetDirVel, G.main->name);
- BLI_path_abs(previewDir, G.main->name);
+ BLI_path_abs(targetDir, relbase);
+ BLI_path_abs(targetDirVel, relbase);
+ BLI_path_abs(previewDir, relbase);
do {
BLI_strncpy(targetFile, targetDir, sizeof(targetFile));
@@ -851,6 +854,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
char debugStrBuffer[256];
int gridlevels = 0;
+ const char *relbase= modifier_path_relbase(fsDomain);
const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp
const char *suffixConfig = FLUID_SUFFIX_CONFIG;
const char *suffixSurface = FLUID_SUFFIX_SURFACE;
@@ -911,7 +915,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
domainSettings->lastgoodframe = -1;
/* delete old baked files */
- fluidsim_delete_until_lastframe(domainSettings);
+ fluidsim_delete_until_lastframe(domainSettings, relbase);
/* rough check of settings... */
if(domainSettings->previewresxyz > domainSettings->resolutionxyz) {
@@ -997,7 +1001,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* ******** start writing / exporting ******** */
// use .tmp, dont overwrite/delete original file
- BLI_snprintf(targetFile, 240, "%s%s.tmp", targetDir, suffixConfig);
+ BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfig);
+ strncat(targetFile, ".tmp", sizeof(targetFile));
// make sure these directories exist as well
if(outStringsChanged) {
@@ -1025,7 +1030,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
fsset->aniFrameTime = channels->aniFrameTime;
fsset->noOfFrames = noFrames; // is otherwise subtracted in parser
- BLI_snprintf(targetFile, 240, "%s%s", targetDir, suffixSurface);
+ BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixSurface);
// defaults for compressibility and adaptive grids
fsset->gstar = domainSettings->gstar;
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 843918e9173..188a61181ce 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -73,6 +73,7 @@
#include "render_intern.h"
typedef struct OGLRender {
+ Main *bmain;
Render *re;
Scene *scene;
@@ -223,7 +224,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
IMB_color_to_bw(ibuf);
}
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
+ BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); /* no need to stamp here */
if(ok) printf("OpenGL Render written to '%s'\n", name);
else printf("OpenGL Render failed to write '%s'\n", name);
@@ -292,6 +293,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
oglrender->ofs= ofs;
oglrender->sizex= sizex;
oglrender->sizey= sizey;
+ oglrender->bmain= CTX_data_main(C);
oglrender->scene= scene;
oglrender->write_still= is_write_still && !is_animation;
@@ -462,7 +464,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
}
}
else {
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
if(ok==0) {
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 4a06ee6d0ae..f3d087d6986 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1559,7 +1559,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
Panel *panel;
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
- int xco, yco, x, y, miny=0, w, em, header, triangle, open, newcontext= 0;
+ int x, y, xco, yco, w, em, triangle, open, newcontext= 0;
if(contextnr >= 0)
newcontext= UI_view2d_tab_set(v2d, contextnr);
@@ -1573,9 +1573,6 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y;
}
- x= 0;
- y= 0;
-
/* create panels */
uiBeginPanels(C, ar);
@@ -1594,16 +1591,12 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
panel= uiBeginPanel(sa, ar, block, pt, &open);
/* bad fixed values */
- header= (pt->flag & PNL_NO_HEADER)? 0: UI_UNIT_Y;
triangle= (int)(UI_UNIT_Y * 1.1f);
- if(vertical)
- y -= header;
-
- if(pt->draw_header && header && (open || vertical)) {
+ if(pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
/* for enabled buttons */
panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
- triangle, header+style->panelspace, header, 1, style);
+ triangle, UI_UNIT_Y+style->panelspace, UI_UNIT_Y, 1, style);
pt->draw_header(C, panel);
@@ -1641,30 +1634,11 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
}
uiEndBlock(C, block);
-
- if(vertical) {
- if(pt->flag & PNL_NO_HEADER)
- y += yco;
- else
- y += yco;
- }
- else {
- x += w;
- miny= MIN2(y, yco-header);
- }
}
}
- if(vertical)
- x += w;
- else
- y= miny;
-
- /* in case there are no panels */
- if(x == 0 || y == 0) {
- x= UI_PANEL_WIDTH;
- y= UI_PANEL_WIDTH;
- }
+ /* align panels and return size */
+ uiEndPanels(C, ar, &x, &y);
/* clear */
UI_ThemeClearColor((ar->type->regionid == RGN_TYPE_PREVIEW)?TH_PREVIEW_BACK:TH_BACK);
@@ -1706,9 +1680,9 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
/* set the view */
UI_view2d_view_ortho(v2d);
- /* this does the actual drawing! */
- uiEndPanels(C, ar);
-
+ /* draw panels */
+ uiDrawPanels(C, ar);
+
/* restore view matrix */
UI_view2d_view_restore(C);
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 017325c535e..8a90aadbee2 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -219,6 +219,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
/* *************** screenshot movie job ************************* */
typedef struct ScreenshotJob {
+ Main *bmain;
Scene *scene;
unsigned int *dumprect;
int x, y, dumpsx, dumpsy;
@@ -297,7 +298,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
char name[FILE_MAXDIR+FILE_MAXFILE];
int ok;
- BKE_makepicstring(name, rd.pic, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, rd.pic, sj->bmain->name, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE);
ibuf->rect= sj->dumprect;
ok= BKE_write_ibuf(ibuf, name, rd.imtype, rd.subimtype, rd.quality);
@@ -355,6 +356,7 @@ static int screencast_exec(bContext *C, wmOperator *op)
sj->dumpsx= curarea->totrct.xmax - sj->x;
sj->dumpsy= curarea->totrct.ymax - sj->y;
}
+ sj->bmain= CTX_data_main(C);
sj->scene= CTX_data_scene(C);
BKE_reports_init(&sj->reports, RPT_PRINT);
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index c2dfcd1d441..194287d9abc 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -781,6 +781,7 @@ typedef struct OceanModifierData {
int bakeend;
char cachepath[240]; // FILE_MAX
+ char foamlayername[32];
char cached;
char geometry_mode;
diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h
index a32320b1740..fd6f4afd593 100644
--- a/source/blender/makesdna/DNA_object_fluidsim.h
+++ b/source/blender/makesdna/DNA_object_fluidsim.h
@@ -178,6 +178,11 @@ typedef struct FluidsimSettings {
#define OB_FLUIDSIM_ACTIVE (1 << 1)
#define OB_FLUIDSIM_OVERRIDE_TIME (1 << 2)
+#define OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME "fluidsurface_preview_####.bobj.gz"
+#define OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME "fluidsurface_final_####.bobj.gz"
+#define OB_FLUIDSIM_SURF_FINAL_VEL_FNAME "fluidsurface_final_####.bvel.gz"
+#define OB_FLUIDSIM_SURF_PARTICLES_FNAME "fluidsurface_particles_####.gz"
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index c21685c9add..1fcc8072f9b 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1434,21 +1434,21 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
case PROP_BOOLEAN: {
if(!prop->arraydimension)
fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier));
- else
+ else if(prop->totarraylength)
fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
break;
}
case PROP_INT: {
if(!prop->arraydimension)
fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier));
- else
+ else if(prop->totarraylength)
fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
break;
}
case PROP_FLOAT: {
if(!prop->arraydimension)
fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier));
- else
+ else if(prop->totarraylength)
fprintf(f, "\tinline Array<float, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
break;
}
@@ -1509,21 +1509,21 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
case PROP_BOOLEAN: {
if(!prop->arraydimension)
fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
- else
+ else if(prop->totarraylength)
fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
break;
}
case PROP_INT: {
if(!prop->arraydimension)
fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
- else
+ else if(prop->totarraylength)
fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
break;
}
case PROP_FLOAT: {
if(!prop->arraydimension)
fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
- else
+ else if(prop->totarraylength)
fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
break;
}
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index a7eedf5f062..09f339fa7db 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -83,18 +83,19 @@ static void rna_fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
}
-static int fluidsim_find_lastframe(FluidsimSettings *fss)
+static int fluidsim_find_lastframe(Object *ob, FluidsimSettings *fss)
{
- char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR];
+ char targetFileTest[FILE_MAX];
+ char targetFile[FILE_MAX];
int curFrame = 1;
- BLI_snprintf(targetDir, sizeof(targetDir), "%sfluidsurface_final_####.bobj.gz", fss->surfdataPath);
- BLI_path_abs(targetDir, G.main->name);
+ BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME);
+ BLI_path_abs(targetFile, modifier_path_relbase(ob));
do {
- BLI_strncpy(targetFile, targetDir, sizeof(targetFile));
- BLI_path_frame(targetFile, curFrame++, 0);
- } while(BLI_exists(targetFile));
+ BLI_strncpy(targetFileTest, targetFile, sizeof(targetFileTest));
+ BLI_path_frame(targetFileTest, curFrame++, 0);
+ } while(BLI_exists(targetFileTest));
return curFrame - 1;
}
@@ -105,7 +106,7 @@ static void rna_fluid_find_enframe(Main *bmain, Scene *scene, PointerRNA *ptr)
FluidsimModifierData *fluidmd= (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim);
if(fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) {
- fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(fluidmd->fss);
+ fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(ob, fluidmd->fss);
}
else {
fluidmd->fss->lastgoodframe = -1;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index cc8ed911541..6cf3a3ee56e 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2997,6 +2997,11 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0);
RNA_def_property_update(prop, 0, NULL);
+ prop= RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "foamlayername");
+ RNA_def_property_ui_text(prop, "Foam Layer Name", "Name of the vertex color layer used for foam");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop= RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "chop_amount");
RNA_def_property_ui_text(prop, "Choppiness", "");
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 250c61ed5f4..6816903090d 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -77,7 +77,7 @@ static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name
if(BKE_imtype_is_movie(rd->imtype))
BKE_makeanimstring(name, rd);
else
- BKE_makepicstring(name, rd->pic, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, rd->pic, G.main->name, (frame==INT_MIN) ? rd->cfra : frame, rd->imtype, rd->scemode & R_EXTENSION, TRUE);
}
#ifdef WITH_COLLADA
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 236351a5e29..fa699e449db 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -69,8 +69,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
if(fluidmd)
{
FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
- int surfdataPathMax = FILE_MAX;
-
+
fluidmd->fss = fss;
if(!fss)
@@ -103,24 +102,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
// fluid/inflow settings
// fss->iniVel --> automatically set to 0
- /* elubie: changed this to default to the same dir as the render output
- to prevent saving to C:\ on Windows */
- if (G.relbase_valid) { /* is the .blend saved? */
- /* subfolder next to saved file */
- BLI_strncpy(fss->surfdataPath, "//fluid_cache", surfdataPathMax);
- BLI_add_slash(fss->surfdataPath);
- }
- else {
- /* subfolder in temp. directory */
- BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), surfdataPathMax);
- surfdataPathMax -= strlen(fss->surfdataPath);
- if (surfdataPathMax > 1) {
- BLI_strncpy(fss->surfdataPath+strlen(fss->surfdataPath), "fluid_cache", surfdataPathMax);
- surfdataPathMax -= strlen("fluid_cache");
- if (surfdataPathMax > 1)
- BLI_add_slash(fss->surfdataPath);
- }
- }
+ modifier_path_init(fss->surfdataPath, sizeof(fss->surfdataPath), "fluid_cache");
// first init of bounding box
// no bounding box needed
@@ -461,11 +443,11 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
gzclose(gzf);
}
-static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams)
+static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams)
{
int displaymode = 0;
int curFrame = framenr - 1 /*scene->r.sfra*/; /* start with 0 at start frame */
- char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR];
+ char targetFile[FILE_MAXFILE+FILE_MAXDIR];
FluidsimSettings *fss = fluidmd->fss;
DerivedMesh *dm = NULL;
MFace *mface;
@@ -478,27 +460,22 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData
displaymode = fss->renderDisplayMode;
}
- BLI_strncpy(targetDir, fss->surfdataPath, sizeof(targetDir));
-
- // use preview or final mesh?
- if(displaymode==1)
- {
- // just display original object
+ switch (displaymode) {
+ case 1:
+ /* just display original object */
return NULL;
+ case 2:
+ /* use preview mesh */
+ BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME);
+ break;
+ default: /* 3 */
+ /* 3. use final mesh */
+ BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME);
+ break;
}
- else if(displaymode==2)
- {
- strcat(targetDir,"fluidsurface_preview_####");
- }
- else
- { // 3
- strcat(targetDir,"fluidsurface_final_####");
- }
-
- BLI_path_abs(targetDir, G.main->name);
- BLI_path_frame(targetDir, curFrame, 0); // fixed #frame-no
- BLI_snprintf(targetFile, sizeof(targetFile), "%s.bobj.gz", targetDir);
+ BLI_path_abs(targetFile, modifier_path_relbase(ob));
+ BLI_path_frame(targetFile, curFrame, 0); // fixed #frame-no
dm = fluidsim_read_obj(targetFile);
@@ -554,7 +531,7 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData
#endif // WITH_MOD_FLUID
DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
- Object *UNUSED(ob),
+ Object *ob,
DerivedMesh *dm,
int useRenderParams, int UNUSED(isFinalCalc))
{
@@ -587,7 +564,7 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
/* try to read from cache */
/* if the frame is there, fine, otherwise don't do anything */
- if((result = fluidsim_read_cache(dm, fluidmd, framenr, useRenderParams)))
+ if((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
return result;
return dm;
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index d609ffc23c4..d5c36f25a32 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -48,10 +48,13 @@
#include "MOD_util.h"
#ifdef WITH_OCEANSIM
-static void init_cache_data(struct OceanModifierData *omd)
+static void init_cache_data(Object *ob, struct OceanModifierData *omd)
{
- omd->oceancache = BKE_init_ocean_cache(omd->cachepath, omd->bakestart, omd->bakeend, omd->wave_scale,
- omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
+ const char *relbase= modifier_path_relbase(ob);
+
+ omd->oceancache = BKE_init_ocean_cache(omd->cachepath, relbase,
+ omd->bakestart, omd->bakeend, omd->wave_scale,
+ omd->chop_amount, omd->foam_coverage, omd->foam_fade, omd->resolution);
}
static void clear_cache_data(struct OceanModifierData *omd)
@@ -97,7 +100,6 @@ static void initData(ModifierData *md)
{
#ifdef WITH_OCEANSIM
OceanModifierData *omd = (OceanModifierData*) md;
- int cachepathmax = sizeof(omd->cachepath);
omd->resolution = 7;
omd->spatial_size = 50;
@@ -125,28 +127,14 @@ static void initData(ModifierData *md)
omd->repeat_x = 1;
omd->repeat_y = 1;
- if (G.relbase_valid) { /* is the .blend saved? */
- /* subfolder next to saved file */
- BLI_strncpy(omd->cachepath, "//ocean_cache", cachepathmax);
- BLI_add_slash(omd->cachepath);
- }
- else {
- /* subfolder in temp. directory */
- BLI_strncpy(omd->cachepath, BLI_temporary_dir(), cachepathmax);
- cachepathmax -= strlen(omd->cachepath);
- if (cachepathmax > 1) {
- BLI_strncpy(omd->cachepath+strlen(omd->cachepath), "ocean_cache", cachepathmax);
- cachepathmax -= strlen("ocean_cache");
- if (cachepathmax > 1)
- BLI_add_slash(omd->cachepath);
- }
- }
+ modifier_path_init(omd->cachepath, sizeof(omd->cachepath), "ocean_cache");
omd->cached = 0;
omd->bakestart = 1;
omd->bakeend = 250;
omd->oceancache = NULL;
omd->foam_fade = 0.98;
+ omd->foamlayername[0] = '\0'; /* layer name empty by default */
omd->ocean = BKE_add_ocean();
init_ocean_modifier(omd);
@@ -376,9 +364,9 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
return result;
}
-static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob),
- DerivedMesh *derivedData,
- int UNUSED(useRenderParams))
+static DerivedMesh *doOcean(ModifierData *md, Object *ob,
+ DerivedMesh *derivedData,
+ int UNUSED(useRenderParams))
{
OceanModifierData *omd = (OceanModifierData*) md;
@@ -409,7 +397,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob),
/* do ocean simulation */
if (omd->cached == TRUE) {
- if (!omd->oceancache) init_cache_data(omd);
+ if (!omd->oceancache) init_cache_data(ob, omd);
BKE_simulate_ocean_cache(omd->oceancache, md->scene->r.cfra);
} else {
simulate_ocean_modifier(omd);
@@ -441,7 +429,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *UNUSED(ob),
if(cdlayer >= MAX_MCOL)
return dm;
- CustomData_add_layer(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces);
+ CustomData_add_layer_named(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces, omd->foamlayername);
mc = dm->getFaceDataArray(dm, CD_MCOL);
mv = dm->getVertArray(dm);
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index 5b502bbee7b..845c5b88020 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -56,6 +56,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
* scrubbing through the timeline when the compositor updates */
return;
} else {
+ Main *bmain= G.main; /* TODO, have this passed along */
CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
char string[256];
@@ -74,7 +75,7 @@ static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack *
}
}
- BKE_makepicstring(string, nif->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE);
+ BKE_makepicstring(string, nif->name, bmain->name, rd->cfra, nif->imtype, (rd->scemode & R_EXTENSION), TRUE);
if(0 == BKE_write_ibuf(ibuf, string, nif->imtype, nif->subimtype, nif->imtype==R_OPENEXR?nif->codec:nif->quality))
printf("Cannot save Node File Output to %s\n", string);
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index 3bf2997e8c9..2f79dfd9914 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -497,6 +497,65 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
}
}
+PyDoc_STRVAR(M_Geometry_intersect_plane_plane_doc,
+".. function:: intersect_plane_plane(plane_a_co, plane_a_no, plane_b_co, plane_b_no)\n"
+"\n"
+" Return the intersection between two planes\n"
+"\n"
+" :arg plane_a_co: Point on the first plane\n"
+" :type plane_a_co: :class:`mathutils.Vector`\n"
+" :arg plane_a_no: Normal of the first plane\n"
+" :type plane_a_no: :class:`mathutils.Vector`\n"
+" :arg plane_b_co: Point on the second plane\n"
+" :type plane_b_co: :class:`mathutils.Vector`\n"
+" :arg plane_b_no: Normal of the second plane\n"
+" :type plane_b_no: :class:`mathutils.Vector`\n"
+" :return: The line of the intersection represented as a point and a vector\n"
+" :rtype: tuple pair of :class:`mathutils.Vector`\n"
+);
+static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObject* args)
+{
+ PyObject *ret;
+ VectorObject *plane_a_co, *plane_a_no, *plane_b_co, *plane_b_no;
+
+ float isect_co[3];
+ float isect_no[3];
+
+ if (!PyArg_ParseTuple(args, "O!O!O!O!|i:intersect_plane_plane",
+ &vector_Type, &plane_a_co,
+ &vector_Type, &plane_a_no,
+ &vector_Type, &plane_b_co,
+ &vector_Type, &plane_b_no))
+ {
+ return NULL;
+ }
+
+ if ( BaseMath_ReadCallback(plane_a_co) == -1 ||
+ BaseMath_ReadCallback(plane_a_no) == -1 ||
+ BaseMath_ReadCallback(plane_b_co) == -1 ||
+ BaseMath_ReadCallback(plane_b_no) == -1)
+ {
+ return NULL;
+ }
+
+ if (ELEM4(2, plane_a_co->size, plane_a_no->size, plane_b_co->size, plane_b_no->size)) {
+ PyErr_SetString(PyExc_ValueError,
+ "geometry.intersect_plane_plane(...): "
+ " can't use 2D Vectors");
+ return NULL;
+ }
+
+ isect_plane_plane_v3(isect_co, isect_no,
+ plane_a_co->vec, plane_a_no->vec,
+ plane_b_co->vec, plane_b_no->vec);
+
+ normalize_v3(isect_no);
+
+ ret= PyTuple_New(2);
+ PyTuple_SET_ITEM(ret, 0, newVectorObject(isect_co, 3, Py_NEW, NULL));
+ PyTuple_SET_ITEM(ret, 1, newVectorObject(isect_no, 3, Py_NEW, NULL));
+ return ret;
+}
PyDoc_STRVAR(M_Geometry_intersect_line_sphere_doc,
".. function:: intersect_line_sphere(line_a, line_b, sphere_co, sphere_radius, clip=True)\n"
@@ -1211,7 +1270,7 @@ static PyMethodDef M_Geometry_methods[]= {
{"intersect_line_line", (PyCFunction) M_Geometry_intersect_line_line, METH_VARARGS, M_Geometry_intersect_line_line_doc},
{"intersect_line_line_2d", (PyCFunction) M_Geometry_intersect_line_line_2d, METH_VARARGS, M_Geometry_intersect_line_line_2d_doc},
{"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc},
- /* TODO: isect_plane_plane_v3 --> intersect_plane_plane */
+ {"intersect_plane_plane", (PyCFunction) M_Geometry_intersect_plane_plane, METH_VARARGS, M_Geometry_intersect_plane_plane_doc},
{"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc},
{"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc},
{"distance_point_to_plane", (PyCFunction) M_Geometry_distance_point_to_plane, METH_VARARGS, M_Geometry_distance_point_to_plane_doc},
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index d7045c0b322..ca019e3ffe8 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -130,7 +130,7 @@ Render R;
/* ********* alloc and free ******** */
-static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, const char *name_override);
+static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovieHandle *mh, const char *name_override);
static volatile int g_break= 0;
static int thread_break(void *UNUSED(arg))
@@ -2964,10 +2964,10 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
}
else {
char name[FILE_MAX];
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
-
+ BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
+
/* reports only used for Movie */
- do_write_image_or_movie(re, scene, NULL, name);
+ do_write_image_or_movie(re, bmain, scene, NULL, name);
}
}
@@ -2978,7 +2978,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
G.rendering= 0;
}
-static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, const char *name_override)
+static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovieHandle *mh, const char *name_override)
{
char name[FILE_MAX];
RenderResult rres;
@@ -3006,7 +3006,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, c
if(name_override)
BLI_strncpy(name, name_override, sizeof(name));
else
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
if(re->r.imtype==R_MULTILAYER) {
if(re->result) {
@@ -3109,7 +3109,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
do_render_all_options(re);
if(re->test_break(re->tbh) == 0) {
- if(!do_write_image_or_movie(re, scene, mh, NULL))
+ if(!do_write_image_or_movie(re, bmain, scene, mh, NULL))
G.afbreek= 1;
}
@@ -3151,7 +3151,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
/* Touch/NoOverwrite options are only valid for image's */
if(BKE_imtype_is_movie(scene->r.imtype) == 0) {
if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
- BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
+ BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
if(scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) {
printf("skipping existing frame \"%s\"\n", name);
@@ -3173,7 +3173,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
if(re->test_break(re->tbh) == 0) {
if(!G.afbreek)
- if(!do_write_image_or_movie(re, scene, mh, NULL))
+ if(!do_write_image_or_movie(re, bmain, scene, mh, NULL))
G.afbreek= 1;
}
else