[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36778] branches/cycles: Cycles: svn merge -r36747:36777 https://svn.blender.org/svnroot/bf-blender/trunk/ blender/
Brecht Van Lommel
brechtvanlommel at pandora.be
Thu May 19 14:37:27 CEST 2011
Revision: 36778
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36778
Author: blendix
Date: 2011-05-19 12:37:26 +0000 (Thu, 19 May 2011)
Log Message:
-----------
Cycles: svn merge -r36747:36777 https://svn.blender.org/svnroot/bf-blender/trunk/blender/
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36747
Modified Paths:
--------------
branches/cycles/release/scripts/modules/bpy/path.py
branches/cycles/release/scripts/modules/bpy_extras/view3d_utils.py
branches/cycles/release/scripts/startup/bl_ui/space_userpref.py
branches/cycles/release/scripts/startup/bl_ui/space_userpref_keymap.py
branches/cycles/source/blender/blenkernel/BKE_icons.h
branches/cycles/source/blender/blenkernel/intern/icons.c
branches/cycles/source/blender/blenkernel/intern/object.c
branches/cycles/source/blender/blenkernel/intern/world.c
branches/cycles/source/blender/blenlib/BLI_math_geom.h
branches/cycles/source/blender/blenlib/intern/math_geom.c
branches/cycles/source/blender/blenloader/BLO_readfile.h
branches/cycles/source/blender/blenloader/intern/readblenentry.c
branches/cycles/source/blender/blenloader/intern/readfile.c
branches/cycles/source/blender/editors/armature/editarmature.c
branches/cycles/source/blender/editors/gpencil/gpencil_edit.c
branches/cycles/source/blender/editors/include/ED_view3d.h
branches/cycles/source/blender/editors/interface/interface_layout.c
branches/cycles/source/blender/editors/screen/screendump.c
branches/cycles/source/blender/editors/space_file/filelist.c
branches/cycles/source/blender/editors/space_view3d/drawmesh.c
branches/cycles/source/blender/editors/space_view3d/view3d_edit.c
branches/cycles/source/blender/editors/space_view3d/view3d_view.c
branches/cycles/source/blender/imbuf/intern/png.c
branches/cycles/source/blender/makesdna/DNA_view3d_types.h
branches/cycles/source/blender/makesrna/intern/rna_space.c
branches/cycles/source/blender/python/generic/mathutils_Matrix.c
branches/cycles/source/blender/python/generic/mathutils_geometry.c
Property Changed:
----------------
branches/cycles/
branches/cycles/source/blender/editors/datafiles/startup.blend.c
branches/cycles/source/blender/editors/render/render_shading.c
branches/cycles/source/blender/editors/render/render_update.c
branches/cycles/source/blender/editors/uvedit/uvedit_buttons.c
Property changes on: branches/cycles
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/blender:36353-36747
+ /trunk/blender:36353-36777
Modified: branches/cycles/release/scripts/modules/bpy/path.py
===================================================================
--- branches/cycles/release/scripts/modules/bpy/path.py 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/release/scripts/modules/bpy/path.py 2011-05-19 12:37:26 UTC (rev 36778)
@@ -135,7 +135,7 @@
filename = os.path.basename(path) # filename may be a directory or a file
dirpath = os.path.dirname(path)
- suffix = ""
+ suffix = path[:0] # "" but ensure byte/str match
if not filename: # dir ends with a slash?
if len(dirpath) < len(path):
suffix = path[:len(path) - len(dirpath)]
Modified: branches/cycles/release/scripts/modules/bpy_extras/view3d_utils.py
===================================================================
--- branches/cycles/release/scripts/modules/bpy_extras/view3d_utils.py 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/release/scripts/modules/bpy_extras/view3d_utils.py 2011-05-19 12:37:26 UTC (rev 36778)
@@ -36,14 +36,19 @@
"""
from mathutils import Vector
- dx = (2.0 * coord[0] / region.width) - 1.0
- dy = (2.0 * coord[1] / region.height) - 1.0
+ viewvec = rv3d.view_matrix.inverted()[2].xyz.normalized()
- viewvec = rv3d.view_matrix.inverted()[2].to_3d().normalized()
- perspinv_x, perspinv_y = rv3d.perspective_matrix.inverted().to_3x3()[0:2]
- return ((perspinv_x * dx + perspinv_y * dy) - viewvec).normalized()
+ if rv3d.is_perspective:
+ dx = (2.0 * coord[0] / region.width) - 1.0
+ dy = (2.0 * coord[1] / region.height) - 1.0
+ persmat = rv3d.perspective_matrix.copy()
+ perspinv_x, perspinv_y = persmat.inverted().to_3x3()[0:2]
+ return ((perspinv_x * dx + perspinv_y * dy) - viewvec).normalized()
+ else:
+ return viewvec
+
def region_2d_to_location_3d(region, rv3d, coord, depth_location):
"""
Return a 3d location from the region relative 2d coords, aligned with
@@ -62,12 +67,30 @@
:return: normalized 3d vector.
:rtype: :class:`Vector`
"""
+ from mathutils import Vector
from mathutils.geometry import intersect_point_line
- origin_start = rv3d.view_matrix.inverted()[3].to_3d()
- origin_end = origin_start + region_2d_to_vector_3d(region, rv3d, coord)
- return intersect_point_line(depth_location, origin_start, origin_end)[0]
+ persmat = rv3d.perspective_matrix.copy()
+ coord_vec = region_2d_to_vector_3d(region, rv3d, coord)
+ depth_location = Vector(depth_location)
+ if rv3d.is_perspective:
+ from mathutils.geometry import intersect_line_plane
+
+ origin_start = rv3d.view_matrix.inverted()[3].to_3d()
+ origin_end = origin_start + coord_vec
+ view_vec = rv3d.view_matrix.inverted()[2]
+ return intersect_line_plane(origin_start, origin_end, depth_location, view_vec, 1)
+ else:
+ dx = (2.0 * coord[0] / region.width) - 1.0
+ dy = (2.0 * coord[1] / region.height) - 1.0
+ persinv = persmat.inverted()
+ viewinv = rv3d.view_matrix.inverted()
+ origin_start = (persinv[0].xyz * dx) + (persinv[1].xyz * dy) + viewinv[3].xyz
+ origin_end = origin_start + coord_vec
+ return intersect_point_line(depth_location, origin_start, origin_end)[0]
+
+
def location_3d_to_region_2d(region, rv3d, coord):
"""
Return the *region* relative 2d location of a 3d position.
Modified: branches/cycles/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/space_userpref.py 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/release/scripts/startup/bl_ui/space_userpref.py 2011-05-19 12:37:26 UTC (rev 36778)
@@ -752,7 +752,7 @@
from bl_ui.space_userpref_keymap import InputKeyMapPanel
-class USERPREF_PT_input(InputKeyMapPanel):
+class USERPREF_PT_input(bpy.types.Panel, InputKeyMapPanel):
bl_space_type = 'USER_PREFERENCES'
bl_label = "Input"
Modified: branches/cycles/release/scripts/startup/bl_ui/space_userpref_keymap.py
===================================================================
--- branches/cycles/release/scripts/startup/bl_ui/space_userpref_keymap.py 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/release/scripts/startup/bl_ui/space_userpref_keymap.py 2011-05-19 12:37:26 UTC (rev 36778)
@@ -138,7 +138,7 @@
bpy.types.Menu.draw_preset(self, context)
-class InputKeyMapPanel(bpy.types.Panel):
+class InputKeyMapPanel:
bl_space_type = 'USER_PREFERENCES'
bl_label = "Input"
bl_region_type = 'WINDOW'
Modified: branches/cycles/source/blender/blenkernel/BKE_icons.h
===================================================================
--- branches/cycles/source/blender/blenkernel/BKE_icons.h 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/source/blender/blenkernel/BKE_icons.h 2011-05-19 12:37:26 UTC (rev 36778)
@@ -52,6 +52,7 @@
typedef struct Icon Icon;
struct PreviewImage;
+struct ID;
void BKE_icons_init(int first_dyn_id);
@@ -74,11 +75,14 @@
/* free all icons */
void BKE_icons_free(void);
+/* free the preview image for use in list */
+void BKE_previewimg_freefunc(void *link);
+
/* free the preview image */
void BKE_previewimg_free(struct PreviewImage **prv);
/* free the preview image belonging to the id */
-void BKE_previewimg_free_id(ID *id);
+void BKE_previewimg_free_id(struct ID *id);
/* create a new preview image */
struct PreviewImage* BKE_previewimg_create(void) ;
@@ -87,6 +91,6 @@
struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv);
/* retrieve existing or create new preview image */
-PreviewImage* BKE_previewimg_get(ID *id);
+struct PreviewImage* BKE_previewimg_get(struct ID *id);
#endif /* BKE_ICONS_H */
Modified: branches/cycles/source/blender/blenkernel/intern/icons.c
===================================================================
--- branches/cycles/source/blender/blenkernel/intern/icons.c 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/source/blender/blenkernel/intern/icons.c 2011-05-19 12:37:26 UTC (rev 36778)
@@ -132,18 +132,26 @@
return prv_img;
}
-void BKE_previewimg_free(PreviewImage **prv)
+void BKE_previewimg_freefunc(void *link)
{
- if(prv && (*prv)) {
+ PreviewImage *prv = (PreviewImage *)link;
+ if (prv) {
int i;
-
+
for (i=0; i<NUM_ICON_SIZES;++i) {
- if ((*prv)->rect[i]) {
- MEM_freeN((*prv)->rect[i]);
- (*prv)->rect[i] = NULL;
+ if (prv->rect[i]) {
+ MEM_freeN(prv->rect[i]);
+ prv->rect[i] = NULL;
}
}
- MEM_freeN((*prv));
+ MEM_freeN(prv);
+ }
+}
+
+void BKE_previewimg_free(PreviewImage **prv)
+{
+ if(prv && (*prv)) {
+ BKE_previewimg_freefunc(*prv);
*prv = NULL;
}
}
Modified: branches/cycles/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/cycles/source/blender/blenkernel/intern/object.c 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/source/blender/blenkernel/intern/object.c 2011-05-19 12:37:26 UTC (rev 36778)
@@ -871,7 +871,8 @@
if(la->nodetree)
lan->nodetree= ntreeCopyTree(la->nodetree);
- if (la->preview) lan->preview = BKE_previewimg_copy(la->preview);
+ if(la->preview)
+ lan->preview = BKE_previewimg_copy(la->preview);
return lan;
}
Modified: branches/cycles/source/blender/blenkernel/intern/world.c
===================================================================
--- branches/cycles/source/blender/blenkernel/intern/world.c 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/source/blender/blenkernel/intern/world.c 2011-05-19 12:37:26 UTC (rev 36778)
@@ -135,7 +135,8 @@
if(wrld->nodetree)
wrldn->nodetree= ntreeCopyTree(wrld->nodetree);
- if (wrld->preview) wrldn->preview = BKE_previewimg_copy(wrld->preview);
+ if(wrld->preview)
+ wrldn->preview = BKE_previewimg_copy(wrld->preview);
return wrldn;
}
Modified: branches/cycles/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- branches/cycles/source/blender/blenlib/BLI_math_geom.h 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/source/blender/blenlib/BLI_math_geom.h 2011-05-19 12:37:26 UTC (rev 36778)
@@ -96,6 +96,18 @@
int isect_ray_plane_v3(float p1[3], float d[3], float v0[3],
float v1[3], float v2[3], float *lambda, int clip);
+/**
+ * Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument.
+ * @param out The intersection point.
+ * @param l1 The first point of the line.
+ * @param l2 The second point of the line.
+ * @param plane_co A point on the plane to intersect with.
+ * @param plane_no The direction of the plane (does not need to be normalized).
+ * @param no_flip When true, the intersection point will always be from l1 to l2, even if this is not on the plane.
+ */
+int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3],
+ const float plane_co[3], const float plane_no[3], const short no_flip);
+
/* 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]);
Modified: branches/cycles/source/blender/blenlib/intern/math_geom.c
===================================================================
--- branches/cycles/source/blender/blenlib/intern/math_geom.c 2011-05-19 11:54:03 UTC (rev 36777)
+++ branches/cycles/source/blender/blenlib/intern/math_geom.c 2011-05-19 12:37:26 UTC (rev 36778)
@@ -37,8 +37,8 @@
#include "BLI_memarena.h"
#include "BLI_utildefines.h"
+static float lambda_cp_line(const float p[3], const float l1[3], const float l2[3]);
-
/********************************** Polygons *********************************/
void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
@@ -640,7 +640,49 @@
return 1;
}
+int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3], const short no_flip)
+{
+ float l_vec[3]; /* l1 -> l2 normalized vector */
+ float p_no[3]; /* 'plane_no' normalized */
+ float dot;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list